diff options
author | Somnath Kotur <somnath.kotur@emulex.com> | 2010-10-24 21:11:58 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-10-25 15:14:10 -0400 |
commit | c6ce2f4b270cb1d4d6b6f4f692a12ca2fea13f3f (patch) | |
tree | 326fb38f70b391291d5a170c1a3888f8bba6778b /drivers/net | |
parent | 63a76944b674bb758232e4213da0da95ae055012 (diff) |
be2net: Fix CSO for UDP packets
We're setting skb->ip_summed to CHECKSUM_NONE for all non-TCP pkts, making the stack
recompute checksum.This is a bug for UDP pkts for which cso must be used.
Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/benet/be_main.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index 87673558cde5..6b80a06eb3a7 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -849,20 +849,16 @@ static void be_rx_stats_update(struct be_rx_obj *rxo, | |||
849 | stats->rx_mcast_pkts++; | 849 | stats->rx_mcast_pkts++; |
850 | } | 850 | } |
851 | 851 | ||
852 | static inline bool do_pkt_csum(struct be_eth_rx_compl *rxcp, bool cso) | 852 | static inline bool csum_passed(struct be_eth_rx_compl *rxcp) |
853 | { | 853 | { |
854 | u8 l4_cksm, ip_version, ipcksm, tcpf = 0, udpf = 0, ipv6_chk; | 854 | u8 l4_cksm, ipv6, ipcksm; |
855 | 855 | ||
856 | l4_cksm = AMAP_GET_BITS(struct amap_eth_rx_compl, l4_cksm, rxcp); | 856 | l4_cksm = AMAP_GET_BITS(struct amap_eth_rx_compl, l4_cksm, rxcp); |
857 | ipcksm = AMAP_GET_BITS(struct amap_eth_rx_compl, ipcksm, rxcp); | 857 | ipcksm = AMAP_GET_BITS(struct amap_eth_rx_compl, ipcksm, rxcp); |
858 | ip_version = AMAP_GET_BITS(struct amap_eth_rx_compl, ip_version, rxcp); | 858 | ipv6 = AMAP_GET_BITS(struct amap_eth_rx_compl, ip_version, rxcp); |
859 | if (ip_version) { | ||
860 | tcpf = AMAP_GET_BITS(struct amap_eth_rx_compl, tcpf, rxcp); | ||
861 | udpf = AMAP_GET_BITS(struct amap_eth_rx_compl, udpf, rxcp); | ||
862 | } | ||
863 | ipv6_chk = (ip_version && (tcpf || udpf)); | ||
864 | 859 | ||
865 | return ((l4_cksm && ipv6_chk && ipcksm) && cso) ? false : true; | 860 | /* Ignore ipcksm for ipv6 pkts */ |
861 | return l4_cksm && (ipcksm || ipv6); | ||
866 | } | 862 | } |
867 | 863 | ||
868 | static struct be_rx_page_info * | 864 | static struct be_rx_page_info * |
@@ -1017,10 +1013,10 @@ static void be_rx_compl_process(struct be_adapter *adapter, | |||
1017 | 1013 | ||
1018 | skb_fill_rx_data(adapter, rxo, skb, rxcp, num_rcvd); | 1014 | skb_fill_rx_data(adapter, rxo, skb, rxcp, num_rcvd); |
1019 | 1015 | ||
1020 | if (do_pkt_csum(rxcp, adapter->rx_csum)) | 1016 | if (likely(adapter->rx_csum && csum_passed(rxcp))) |
1021 | skb_checksum_none_assert(skb); | ||
1022 | else | ||
1023 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 1017 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
1018 | else | ||
1019 | skb_checksum_none_assert(skb); | ||
1024 | 1020 | ||
1025 | skb->truesize = skb->len + sizeof(struct sk_buff); | 1021 | skb->truesize = skb->len + sizeof(struct sk_buff); |
1026 | skb->protocol = eth_type_trans(skb, adapter->netdev); | 1022 | skb->protocol = eth_type_trans(skb, adapter->netdev); |