* [NET-NEXT PATCH 1/2] e1000e: don't generate bad checksums for tcp packets with 0 csum
@ 2008-10-09 16:58 Jeff Kirsher
2008-10-09 16:58 ` [NET-NEXT PATCH 2/2] e1000: " Jeff Kirsher
2008-10-09 21:29 ` [NET-NEXT PATCH 1/2] e1000e: " David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Jeff Kirsher @ 2008-10-09 16:58 UTC (permalink / raw)
To: jeff, davem; +Cc: netdev, Dave Graham, Jesse Brandeburg, Jeff Kirsher
From: Dave Graham <david.graham@intel.com>
When offloading transmit checksums only, the driver was not
correctly configuring the hardware to handle the case of a zero
checksum. For UDP the correct behavior is to leave it alone, but
for tcp the checksum must be changed from 0x0000 to 0xFFFF. The
hardware takes care of this case but only if it is told the
packet is tcp.
Signed-off-by: Dave Graham <david.graham@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/e1000e/netdev.c | 62 +++++++++++++++++++++++++++----------------
1 files changed, 39 insertions(+), 23 deletions(-)
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 1b72749..abd492b 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -3749,34 +3749,50 @@ static bool e1000_tx_csum(struct e1000_adapter *adapter, struct sk_buff *skb)
struct e1000_buffer *buffer_info;
unsigned int i;
u8 css;
+ u32 cmd_len = E1000_TXD_CMD_DEXT;
- if (skb->ip_summed == CHECKSUM_PARTIAL) {
- css = skb_transport_offset(skb);
-
- i = tx_ring->next_to_use;
- buffer_info = &tx_ring->buffer_info[i];
- context_desc = E1000_CONTEXT_DESC(*tx_ring, i);
-
- context_desc->lower_setup.ip_config = 0;
- context_desc->upper_setup.tcp_fields.tucss = css;
- context_desc->upper_setup.tcp_fields.tucso =
- css + skb->csum_offset;
- context_desc->upper_setup.tcp_fields.tucse = 0;
- context_desc->tcp_seg_setup.data = 0;
- context_desc->cmd_and_length = cpu_to_le32(E1000_TXD_CMD_DEXT);
+ if (skb->ip_summed != CHECKSUM_PARTIAL)
+ return 0;
- buffer_info->time_stamp = jiffies;
- buffer_info->next_to_watch = i;
+ switch (skb->protocol) {
+ case __constant_htons(ETH_P_IP):
+ if (ip_hdr(skb)->protocol == IPPROTO_TCP)
+ cmd_len |= E1000_TXD_CMD_TCP;
+ break;
+ case __constant_htons(ETH_P_IPV6):
+ /* XXX not handling all IPV6 headers */
+ if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP)
+ cmd_len |= E1000_TXD_CMD_TCP;
+ break;
+ default:
+ if (unlikely(net_ratelimit()))
+ e_warn("checksum_partial proto=%x!\n", skb->protocol);
+ break;
+ }
- i++;
- if (i == tx_ring->count)
- i = 0;
- tx_ring->next_to_use = i;
+ css = skb_transport_offset(skb);
- return 1;
- }
+ i = tx_ring->next_to_use;
+ buffer_info = &tx_ring->buffer_info[i];
+ context_desc = E1000_CONTEXT_DESC(*tx_ring, i);
+
+ context_desc->lower_setup.ip_config = 0;
+ context_desc->upper_setup.tcp_fields.tucss = css;
+ context_desc->upper_setup.tcp_fields.tucso =
+ css + skb->csum_offset;
+ context_desc->upper_setup.tcp_fields.tucse = 0;
+ context_desc->tcp_seg_setup.data = 0;
+ context_desc->cmd_and_length = cpu_to_le32(cmd_len);
+
+ buffer_info->time_stamp = jiffies;
+ buffer_info->next_to_watch = i;
+
+ i++;
+ if (i == tx_ring->count)
+ i = 0;
+ tx_ring->next_to_use = i;
- return 0;
+ return 1;
}
#define E1000_MAX_PER_TXD 8192
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [NET-NEXT PATCH 2/2] e1000: don't generate bad checksums for tcp packets with 0 csum
2008-10-09 16:58 [NET-NEXT PATCH 1/2] e1000e: don't generate bad checksums for tcp packets with 0 csum Jeff Kirsher
@ 2008-10-09 16:58 ` Jeff Kirsher
2008-10-09 21:29 ` David Miller
2008-10-09 21:29 ` [NET-NEXT PATCH 1/2] e1000e: " David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Jeff Kirsher @ 2008-10-09 16:58 UTC (permalink / raw)
To: jeff, davem; +Cc: netdev, Dave Graham, Jesse Brandeburg, Jeff Kirsher
From: Dave Graham <david.graham@intel.com>
When offloading transmit checksums only, the driver was not
correctly configuring the hardware to handle the case of a zero
checksum. For UDP the correct behavior is to leave it alone, but
for tcp the checksum must be changed from 0x0000 to 0xFFFF. The
hardware takes care of this case but only if it is told the
packet is tcp.
same patch as e1000e
Signed-off-by: Dave Graham <david.graham@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/e1000/e1000_main.c | 55 ++++++++++++++++++++++++++--------------
1 files changed, 36 insertions(+), 19 deletions(-)
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 2ab44db..3bafaed 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -2873,32 +2873,49 @@ static bool e1000_tx_csum(struct e1000_adapter *adapter,
struct e1000_buffer *buffer_info;
unsigned int i;
u8 css;
+ u32 cmd_len = E1000_TXD_CMD_DEXT;
- if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
- css = skb_transport_offset(skb);
+ if (skb->ip_summed != CHECKSUM_PARTIAL)
+ return false;
- i = tx_ring->next_to_use;
- buffer_info = &tx_ring->buffer_info[i];
- context_desc = E1000_CONTEXT_DESC(*tx_ring, i);
+ switch (skb->protocol) {
+ case __constant_htons(ETH_P_IP):
+ if (ip_hdr(skb)->protocol == IPPROTO_TCP)
+ cmd_len |= E1000_TXD_CMD_TCP;
+ break;
+ case __constant_htons(ETH_P_IPV6):
+ /* XXX not handling all IPV6 headers */
+ if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP)
+ cmd_len |= E1000_TXD_CMD_TCP;
+ break;
+ default:
+ if (unlikely(net_ratelimit()))
+ DPRINTK(DRV, WARNING,
+ "checksum_partial proto=%x!\n", skb->protocol);
+ break;
+ }
- context_desc->lower_setup.ip_config = 0;
- context_desc->upper_setup.tcp_fields.tucss = css;
- context_desc->upper_setup.tcp_fields.tucso =
- css + skb->csum_offset;
- context_desc->upper_setup.tcp_fields.tucse = 0;
- context_desc->tcp_seg_setup.data = 0;
- context_desc->cmd_and_length = cpu_to_le32(E1000_TXD_CMD_DEXT);
+ css = skb_transport_offset(skb);
- buffer_info->time_stamp = jiffies;
- buffer_info->next_to_watch = i;
+ i = tx_ring->next_to_use;
+ buffer_info = &tx_ring->buffer_info[i];
+ context_desc = E1000_CONTEXT_DESC(*tx_ring, i);
- if (unlikely(++i == tx_ring->count)) i = 0;
- tx_ring->next_to_use = i;
+ context_desc->lower_setup.ip_config = 0;
+ context_desc->upper_setup.tcp_fields.tucss = css;
+ context_desc->upper_setup.tcp_fields.tucso =
+ css + skb->csum_offset;
+ context_desc->upper_setup.tcp_fields.tucse = 0;
+ context_desc->tcp_seg_setup.data = 0;
+ context_desc->cmd_and_length = cpu_to_le32(cmd_len);
- return true;
- }
+ buffer_info->time_stamp = jiffies;
+ buffer_info->next_to_watch = i;
- return false;
+ if (unlikely(++i == tx_ring->count)) i = 0;
+ tx_ring->next_to_use = i;
+
+ return true;
}
#define E1000_MAX_TXD_PWR 12
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [NET-NEXT PATCH 1/2] e1000e: don't generate bad checksums for tcp packets with 0 csum
2008-10-09 16:58 [NET-NEXT PATCH 1/2] e1000e: don't generate bad checksums for tcp packets with 0 csum Jeff Kirsher
2008-10-09 16:58 ` [NET-NEXT PATCH 2/2] e1000: " Jeff Kirsher
@ 2008-10-09 21:29 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2008-10-09 21:29 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: jeff, netdev, david.graham, jesse.brandeburg
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Thu, 09 Oct 2008 09:58:31 -0700
> When offloading transmit checksums only, the driver was not
> correctly configuring the hardware to handle the case of a zero
> checksum. For UDP the correct behavior is to leave it alone, but
> for tcp the checksum must be changed from 0x0000 to 0xFFFF. The
> hardware takes care of this case but only if it is told the
> packet is tcp.
>
> Signed-off-by: Dave Graham <david.graham@intel.com>
> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [NET-NEXT PATCH 2/2] e1000: don't generate bad checksums for tcp packets with 0 csum
2008-10-09 16:58 ` [NET-NEXT PATCH 2/2] e1000: " Jeff Kirsher
@ 2008-10-09 21:29 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2008-10-09 21:29 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: jeff, netdev, david.graham, jesse.brandeburg
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Thu, 09 Oct 2008 09:58:52 -0700
> When offloading transmit checksums only, the driver was not
> correctly configuring the hardware to handle the case of a zero
> checksum. For UDP the correct behavior is to leave it alone, but
> for tcp the checksum must be changed from 0x0000 to 0xFFFF. The
> hardware takes care of this case but only if it is told the
> packet is tcp.
>
> same patch as e1000e
>
> Signed-off-by: Dave Graham <david.graham@intel.com>
> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-10-09 21:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-09 16:58 [NET-NEXT PATCH 1/2] e1000e: don't generate bad checksums for tcp packets with 0 csum Jeff Kirsher
2008-10-09 16:58 ` [NET-NEXT PATCH 2/2] e1000: " Jeff Kirsher
2008-10-09 21:29 ` David Miller
2008-10-09 21:29 ` [NET-NEXT PATCH 1/2] e1000e: " David Miller
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).