diff options
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0088-bnx2x-fix-checksum-validation.patch')
-rw-r--r-- | recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0088-bnx2x-fix-checksum-validation.patch | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0088-bnx2x-fix-checksum-validation.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0088-bnx2x-fix-checksum-validation.patch new file mode 100644 index 00000000..1a6bce5b --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0088-bnx2x-fix-checksum-validation.patch | |||
@@ -0,0 +1,112 @@ | |||
1 | From 4ffefa650ebbe2ef8bc2babff2e5686c33a2dab3 Mon Sep 17 00:00:00 2001 | ||
2 | From: Eric Dumazet <edumazet@google.com> | ||
3 | Date: Tue, 12 Jun 2012 23:50:04 +0000 | ||
4 | Subject: [PATCH 088/109] bnx2x: fix checksum validation | ||
5 | |||
6 | commit d6cb3e41386f20fb0777d0b59a2def82c65d37f7 upstream. | ||
7 | |||
8 | bnx2x driver incorrectly sets ip_summed to CHECKSUM_UNNECESSARY on | ||
9 | encapsulated segments. TCP stack happily accepts frames with bad | ||
10 | checksums, if they are inside a GRE or IPIP encapsulation. | ||
11 | |||
12 | Our understanding is that if no IP or L4 csum validation was done by the | ||
13 | hardware, we should leave ip_summed as is (CHECKSUM_NONE), since | ||
14 | hardware doesn't provide CHECKSUM_COMPLETE support in its cqe. | ||
15 | |||
16 | Then, if IP/L4 checksumming was done by the hardware, set | ||
17 | CHECKSUM_UNNECESSARY if no error was flagged. | ||
18 | |||
19 | Patch based on findings and analysis from Robert Evans | ||
20 | |||
21 | Signed-off-by: Eric Dumazet <edumazet@google.com> | ||
22 | Cc: Eilon Greenstein <eilong@broadcom.com> | ||
23 | Cc: Yaniv Rosner <yanivr@broadcom.com> | ||
24 | Cc: Merav Sicron <meravs@broadcom.com> | ||
25 | Cc: Tom Herbert <therbert@google.com> | ||
26 | Cc: Robert Evans <evansr@google.com> | ||
27 | Cc: Willem de Bruijn <willemb@google.com> | ||
28 | Acked-by: Eilon Greenstein <eilong@broadcom.com> | ||
29 | Signed-off-by: David S. Miller <davem@davemloft.net> | ||
30 | [bwh: Backported to 3.2: adjust context, indentation] | ||
31 | Signed-off-by: Ben Hutchings <ben@decadent.org.uk> | ||
32 | --- | ||
33 | drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 15 ------------ | ||
34 | drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 28 ++++++++++++++++++----- | ||
35 | 2 files changed, 22 insertions(+), 21 deletions(-) | ||
36 | |||
37 | diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | ||
38 | index aec7212..8dda46a 100644 | ||
39 | --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | ||
40 | +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | ||
41 | @@ -723,21 +723,6 @@ struct bnx2x_fastpath { | ||
42 | |||
43 | #define ETH_RX_ERROR_FALGS ETH_FAST_PATH_RX_CQE_PHY_DECODE_ERR_FLG | ||
44 | |||
45 | -#define BNX2X_IP_CSUM_ERR(cqe) \ | ||
46 | - (!((cqe)->fast_path_cqe.status_flags & \ | ||
47 | - ETH_FAST_PATH_RX_CQE_IP_XSUM_NO_VALIDATION_FLG) && \ | ||
48 | - ((cqe)->fast_path_cqe.type_error_flags & \ | ||
49 | - ETH_FAST_PATH_RX_CQE_IP_BAD_XSUM_FLG)) | ||
50 | - | ||
51 | -#define BNX2X_L4_CSUM_ERR(cqe) \ | ||
52 | - (!((cqe)->fast_path_cqe.status_flags & \ | ||
53 | - ETH_FAST_PATH_RX_CQE_L4_XSUM_NO_VALIDATION_FLG) && \ | ||
54 | - ((cqe)->fast_path_cqe.type_error_flags & \ | ||
55 | - ETH_FAST_PATH_RX_CQE_L4_BAD_XSUM_FLG)) | ||
56 | - | ||
57 | -#define BNX2X_RX_CSUM_OK(cqe) \ | ||
58 | - (!(BNX2X_L4_CSUM_ERR(cqe) || BNX2X_IP_CSUM_ERR(cqe))) | ||
59 | - | ||
60 | #define BNX2X_PRS_FLAG_OVERETH_IPV4(flags) \ | ||
61 | (((le16_to_cpu(flags) & \ | ||
62 | PARSING_FLAGS_OVER_ETHERNET_PROTOCOL) >> \ | ||
63 | diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | ||
64 | index 580b44e..27d6d6c 100644 | ||
65 | --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | ||
66 | +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | ||
67 | @@ -551,6 +551,26 @@ static inline void bnx2x_set_skb_rxhash(struct bnx2x *bp, union eth_rx_cqe *cqe, | ||
68 | le32_to_cpu(cqe->fast_path_cqe.rss_hash_result); | ||
69 | } | ||
70 | |||
71 | +static void bnx2x_csum_validate(struct sk_buff *skb, union eth_rx_cqe *cqe, | ||
72 | + struct bnx2x_fastpath *fp) | ||
73 | +{ | ||
74 | + /* Do nothing if no IP/L4 csum validation was done */ | ||
75 | + | ||
76 | + if (cqe->fast_path_cqe.status_flags & | ||
77 | + (ETH_FAST_PATH_RX_CQE_IP_XSUM_NO_VALIDATION_FLG | | ||
78 | + ETH_FAST_PATH_RX_CQE_L4_XSUM_NO_VALIDATION_FLG)) | ||
79 | + return; | ||
80 | + | ||
81 | + /* If both IP/L4 validation were done, check if an error was found. */ | ||
82 | + | ||
83 | + if (cqe->fast_path_cqe.type_error_flags & | ||
84 | + (ETH_FAST_PATH_RX_CQE_IP_BAD_XSUM_FLG | | ||
85 | + ETH_FAST_PATH_RX_CQE_L4_BAD_XSUM_FLG)) | ||
86 | + fp->eth_q_stats.hw_csum_err++; | ||
87 | + else | ||
88 | + skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
89 | +} | ||
90 | + | ||
91 | int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget) | ||
92 | { | ||
93 | struct bnx2x *bp = fp->bp; | ||
94 | @@ -746,13 +766,9 @@ reuse_rx: | ||
95 | |||
96 | skb_checksum_none_assert(skb); | ||
97 | |||
98 | - if (bp->dev->features & NETIF_F_RXCSUM) { | ||
99 | + if (bp->dev->features & NETIF_F_RXCSUM) | ||
100 | + bnx2x_csum_validate(skb, cqe, fp); | ||
101 | |||
102 | - if (likely(BNX2X_RX_CSUM_OK(cqe))) | ||
103 | - skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
104 | - else | ||
105 | - fp->eth_q_stats.hw_csum_err++; | ||
106 | - } | ||
107 | } | ||
108 | |||
109 | skb_record_rx_queue(skb, fp->index); | ||
110 | -- | ||
111 | 1.7.7.6 | ||
112 | |||