Skip to content

Commit 2c0331f

Browse files
contremstefanhaRH
authored andcommitted
e1000: Discard oversized packets based on SBP|LPE
Discard packets longer than 16384 when !SBP to match the hardware behavior. Signed-off-by: Michael Contreras <[email protected]> Signed-off-by: Stefan Hajnoczi <[email protected]>
1 parent 8e4a424 commit 2c0331f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

hw/e1000.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ static int debugflags = DBGBIT(TXERR) | DBGBIT(GENERAL);
6161

6262
/* this is the size past which hardware will drop packets when setting LPE=0 */
6363
#define MAXIMUM_ETHERNET_VLAN_SIZE 1522
64+
/* this is the size past which hardware will drop packets when setting LPE=1 */
65+
#define MAXIMUM_ETHERNET_LPE_SIZE 16384
6466

6567
/*
6668
* HW models:
@@ -809,8 +811,9 @@ e1000_receive(NetClientState *nc, const uint8_t *buf, size_t size)
809811
}
810812

811813
/* Discard oversized packets if !LPE and !SBP. */
812-
if (size > MAXIMUM_ETHERNET_VLAN_SIZE
813-
&& !(s->mac_reg[RCTL] & E1000_RCTL_LPE)
814+
if ((size > MAXIMUM_ETHERNET_LPE_SIZE ||
815+
(size > MAXIMUM_ETHERNET_VLAN_SIZE
816+
&& !(s->mac_reg[RCTL] & E1000_RCTL_LPE)))
814817
&& !(s->mac_reg[RCTL] & E1000_RCTL_SBP)) {
815818
return size;
816819
}

0 commit comments

Comments
 (0)