diff options
author | Ayyappan Veeraiyan <ayyappan.veeraiyan@intel.com> | 2008-02-01 18:59:09 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2008-02-05 13:31:35 -0500 |
commit | e59bd25d579c143f1b93a33d3243d67abbb15abe (patch) | |
tree | 69c0f6a7c074c2dd4fe64d032f17517e212853cc /drivers/net/ixgbe/ixgbe_main.c | |
parent | 5eba3699a3b2e0d7afa0d4594980bafb1e47e2b4 (diff) |
ixgbe: properly return CHECKSUM_NONE, cleanup csum code
We were not returning CHECKSUM_NONE in a lot of cases which is
wrong. Move common exit points in this function and error code
up before the actual work in this function.
Signed-off-by: Ayyappan Veeraiyan <ayyappan.veeraiyan@intel.com>
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_main.c')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index c814d9bfbca7..ee5ee10c918f 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -304,25 +304,40 @@ static void ixgbe_receive_skb(struct ixgbe_adapter *adapter, | |||
304 | } | 304 | } |
305 | } | 305 | } |
306 | 306 | ||
307 | /** | ||
308 | * ixgbe_rx_checksum - indicate in skb if hw indicated a good cksum | ||
309 | * @adapter: address of board private structure | ||
310 | * @status_err: hardware indication of status of receive | ||
311 | * @skb: skb currently being received and modified | ||
312 | **/ | ||
307 | static inline void ixgbe_rx_checksum(struct ixgbe_adapter *adapter, | 313 | static inline void ixgbe_rx_checksum(struct ixgbe_adapter *adapter, |
308 | u32 status_err, | 314 | u32 status_err, |
309 | struct sk_buff *skb) | 315 | struct sk_buff *skb) |
310 | { | 316 | { |
311 | skb->ip_summed = CHECKSUM_NONE; | 317 | skb->ip_summed = CHECKSUM_NONE; |
312 | 318 | ||
313 | /* Ignore Checksum bit is set */ | 319 | /* Ignore Checksum bit is set, or rx csum disabled */ |
314 | if ((status_err & IXGBE_RXD_STAT_IXSM) || | 320 | if ((status_err & IXGBE_RXD_STAT_IXSM) || |
315 | !(adapter->flags & IXGBE_FLAG_RX_CSUM_ENABLED)) | 321 | !(adapter->flags & IXGBE_FLAG_RX_CSUM_ENABLED)) |
316 | return; | 322 | return; |
317 | /* TCP/UDP checksum error bit is set */ | 323 | |
318 | if (status_err & (IXGBE_RXDADV_ERR_TCPE | IXGBE_RXDADV_ERR_IPE)) { | 324 | /* if IP and error */ |
319 | /* let the stack verify checksum errors */ | 325 | if ((status_err & IXGBE_RXD_STAT_IPCS) && |
326 | (status_err & IXGBE_RXDADV_ERR_IPE)) { | ||
320 | adapter->hw_csum_rx_error++; | 327 | adapter->hw_csum_rx_error++; |
321 | return; | 328 | return; |
322 | } | 329 | } |
330 | |||
331 | if (!(status_err & IXGBE_RXD_STAT_L4CS)) | ||
332 | return; | ||
333 | |||
334 | if (status_err & IXGBE_RXDADV_ERR_TCPE) { | ||
335 | adapter->hw_csum_rx_error++; | ||
336 | return; | ||
337 | } | ||
338 | |||
323 | /* It must be a TCP or UDP packet with a valid checksum */ | 339 | /* It must be a TCP or UDP packet with a valid checksum */ |
324 | if (status_err & (IXGBE_RXD_STAT_L4CS | IXGBE_RXD_STAT_UDPCS)) | 340 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
325 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
326 | adapter->hw_csum_rx_good++; | 341 | adapter->hw_csum_rx_good++; |
327 | } | 342 | } |
328 | 343 | ||