Skip to contentSkip to conversation

e1000: Fix multi-descriptor packet checksum offload

PATCH Applied Stefan Hajnoczi 2 participants 2 messages Mar 7, 2011 – Mar 21, 2011

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 e1000: Fix multi-descriptor packet checksum offload

The PCI/PCI-X Family of Gigabit Ethernet Controllers Software Developer’s Manual states the following about the POPTS field:

Provides a number of options which control the handling of this packet. This field is ignored except on the first data descriptor of a packet.

The current implementation always loads the field and its checksum offload flags. This patch uses only the first descriptor's POPTS field in order to comply with the specification.

When Solaris sends multi-descriptor packets it fills in POPTS for the first descriptor only. Therefore this patch is necessary in order to perform checksum offload correctly for multi-descriptor packets.

---
v2:
* Fix Reported-by: details

 hw/e1000.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
hw/e1000.c +3 -1
index 0a4574c..2a4d5c7 100644
@@ -446,7 +446,9 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
         return;
     } else if (dtype == (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D)) {
         // data descriptor
-        tp->sum_needed = le32_to_cpu(dp->upper.data) >> 8;
+        if (tp->size == 0) {
+            tp->sum_needed = le32_to_cpu(dp->upper.data) >> 8;
+        }
         tp->cptse = ( txd_lower & E1000_TXD_CMD_TSE ) ? 1 : 0;
     } else {
         // legacy descriptor
Signature · 1 line
1.7.2.3
#1 lore raw
Quoted 18 lines · Stefan Hajnoczi

The PCI/PCI-X Family of Gigabit Ethernet Controllers Software Developer’s Manual states the following about the POPTS field:

Provides a number of options which control the handling of this packet. This field is ignored except on the first data descriptor of a packet.

The current implementation always loads the field and its checksum offload flags. This patch uses only the first descriptor's POPTS field in order to comply with the specification.

When Solaris sends multi-descriptor packets it fills in POPTS for the first descriptor only. Therefore this patch is necessary in order to perform checksum offload correctly for multi-descriptor packets.

Quoted 6 lines

---
v2:
* Fix Reported-by: details

 hw/e1000.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Thanks, applied.

Quoted 20 lines
hw/e1000.c +3 -1
index 0a4574c..2a4d5c7 100644
@@ -446,7 +446,9 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
         return;
     } else if (dtype == (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D)) {
         // data descriptor
-        tp->sum_needed = le32_to_cpu(dp->upper.data) >> 8;
+        if (tp->size == 0) {
+            tp->sum_needed = le32_to_cpu(dp->upper.data) >> 8;
+        }
         tp->cptse = ( txd_lower & E1000_TXD_CMD_TSE ) ? 1 : 0;
     } else {
         // legacy descriptor
Signature · 1 line
1.7.2.3
Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net