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>
This commit is contained in:
committed by
Jeff Garzik
parent
5eba3699a3
commit
e59bd25d57
@@ -304,25 +304,40 @@ static void ixgbe_receive_skb(struct ixgbe_adapter *adapter,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ixgbe_rx_checksum - indicate in skb if hw indicated a good cksum
|
||||||
|
* @adapter: address of board private structure
|
||||||
|
* @status_err: hardware indication of status of receive
|
||||||
|
* @skb: skb currently being received and modified
|
||||||
|
**/
|
||||||
static inline void ixgbe_rx_checksum(struct ixgbe_adapter *adapter,
|
static inline void ixgbe_rx_checksum(struct ixgbe_adapter *adapter,
|
||||||
u32 status_err,
|
u32 status_err,
|
||||||
struct sk_buff *skb)
|
struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
skb->ip_summed = CHECKSUM_NONE;
|
skb->ip_summed = CHECKSUM_NONE;
|
||||||
|
|
||||||
/* Ignore Checksum bit is set */
|
/* Ignore Checksum bit is set, or rx csum disabled */
|
||||||
if ((status_err & IXGBE_RXD_STAT_IXSM) ||
|
if ((status_err & IXGBE_RXD_STAT_IXSM) ||
|
||||||
!(adapter->flags & IXGBE_FLAG_RX_CSUM_ENABLED))
|
!(adapter->flags & IXGBE_FLAG_RX_CSUM_ENABLED))
|
||||||
return;
|
return;
|
||||||
/* TCP/UDP checksum error bit is set */
|
|
||||||
if (status_err & (IXGBE_RXDADV_ERR_TCPE | IXGBE_RXDADV_ERR_IPE)) {
|
/* if IP and error */
|
||||||
/* let the stack verify checksum errors */
|
if ((status_err & IXGBE_RXD_STAT_IPCS) &&
|
||||||
|
(status_err & IXGBE_RXDADV_ERR_IPE)) {
|
||||||
adapter->hw_csum_rx_error++;
|
adapter->hw_csum_rx_error++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(status_err & IXGBE_RXD_STAT_L4CS))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (status_err & IXGBE_RXDADV_ERR_TCPE) {
|
||||||
|
adapter->hw_csum_rx_error++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* It must be a TCP or UDP packet with a valid checksum */
|
/* It must be a TCP or UDP packet with a valid checksum */
|
||||||
if (status_err & (IXGBE_RXD_STAT_L4CS | IXGBE_RXD_STAT_UDPCS))
|
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
|
||||||
adapter->hw_csum_rx_good++;
|
adapter->hw_csum_rx_good++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user