qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] e1000: Fix multi-descriptor packet checksum offload
@ 2011-03-07 20:04 Stefan Hajnoczi
  2011-03-21 20:43 ` Aurelien Jarno
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hajnoczi @ 2011-03-07 20:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alex Williamson, Bug 638955, Stefan Hajnoczi, Michael S. Tsirkin

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.

Reported-by: Daniel Pecka <dpecka@techniservit.cz>
Reported-by: Gabriele A. Trombetti <gabriele.trombetti@itb.cnr.it>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
v2:
 * Fix Reported-by: details

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

diff --git a/hw/e1000.c b/hw/e1000.c
index 0a4574c..2a4d5c7 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -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
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH v2] e1000: Fix multi-descriptor packet checksum offload
  2011-03-07 20:04 [Qemu-devel] [PATCH v2] e1000: Fix multi-descriptor packet checksum offload Stefan Hajnoczi
@ 2011-03-21 20:43 ` Aurelien Jarno
  0 siblings, 0 replies; 2+ messages in thread
From: Aurelien Jarno @ 2011-03-21 20:43 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: Alex Williamson, Bug 638955, qemu-devel, Michael S. Tsirkin

On Mon, Mar 07, 2011 at 08:04:07PM +0000, Stefan Hajnoczi wrote:
> 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.
> 
> Reported-by: Daniel Pecka <dpecka@techniservit.cz>
> Reported-by: Gabriele A. Trombetti <gabriele.trombetti@itb.cnr.it>
> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
> ---
> v2:
>  * Fix Reported-by: details
> 
>  hw/e1000.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)

Thanks, applied.

> diff --git a/hw/e1000.c b/hw/e1000.c
> index 0a4574c..2a4d5c7 100644
> --- a/hw/e1000.c
> +++ b/hw/e1000.c
> @@ -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
> -- 
> 1.7.2.3
> 
> 
> 

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-21 20:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-07 20:04 [Qemu-devel] [PATCH v2] e1000: Fix multi-descriptor packet checksum offload Stefan Hajnoczi
2011-03-21 20:43 ` Aurelien Jarno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).