aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorYuval Mintz <yuvalmin@broadcom.com>2013-04-23 21:44:58 -0400
committerDavid S. Miller <davem@davemloft.net>2013-04-24 16:33:53 -0400
commit2c2d06d5126e62e90aee71da9b85c9d95de6bbe2 (patch)
tree15343681c0cd5282d6c72b9b0a47cd09ed9726dd /drivers
parent0996076973856e093c84ed870501fb9d5c72f8a3 (diff)
bnx2x: prevent GRO false checksum claims
This patch introduces a more robust error handling flow in case of incorrect behaviour by the FW when passing on GRO aggregations. Although this should never happen (i.e., this is merely a theoretical fix), if the bnx2x driver was to receive a GRO from FW with protocol other than IPv4/IPv6, the driver would falsely claim to have performed partial checksum and set various incorrect fields in the skb header. Current behaviour of the bnx2x driver (i.e., print an error) is insufficient. This patch remedies this by simply preventing the false claims. Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com> Signed-off-by: Ariel Elior <ariele@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index d72bd8c40aa1..5a815ce7dee0 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -642,6 +642,14 @@ static void bnx2x_gro_ipv6_csum(struct bnx2x *bp, struct sk_buff *skb)
642 th->check = ~tcp_v6_check(skb->len - skb_transport_offset(skb), 642 th->check = ~tcp_v6_check(skb->len - skb_transport_offset(skb),
643 &iph->saddr, &iph->daddr, 0); 643 &iph->saddr, &iph->daddr, 0);
644} 644}
645
646static void bnx2x_gro_csum(struct bnx2x *bp, struct sk_buff *skb,
647 void (*gro_func)(struct bnx2x*, struct sk_buff*))
648{
649 skb_set_network_header(skb, 0);
650 gro_func(bp, skb);
651 tcp_gro_complete(skb);
652}
645#endif 653#endif
646 654
647static void bnx2x_gro_receive(struct bnx2x *bp, struct bnx2x_fastpath *fp, 655static void bnx2x_gro_receive(struct bnx2x *bp, struct bnx2x_fastpath *fp,
@@ -649,19 +657,17 @@ static void bnx2x_gro_receive(struct bnx2x *bp, struct bnx2x_fastpath *fp,
649{ 657{
650#ifdef CONFIG_INET 658#ifdef CONFIG_INET
651 if (skb_shinfo(skb)->gso_size) { 659 if (skb_shinfo(skb)->gso_size) {
652 skb_set_network_header(skb, 0);
653 switch (be16_to_cpu(skb->protocol)) { 660 switch (be16_to_cpu(skb->protocol)) {
654 case ETH_P_IP: 661 case ETH_P_IP:
655 bnx2x_gro_ip_csum(bp, skb); 662 bnx2x_gro_csum(bp, skb, bnx2x_gro_ip_csum);
656 break; 663 break;
657 case ETH_P_IPV6: 664 case ETH_P_IPV6:
658 bnx2x_gro_ipv6_csum(bp, skb); 665 bnx2x_gro_csum(bp, skb, bnx2x_gro_ipv6_csum);
659 break; 666 break;
660 default: 667 default:
661 BNX2X_ERR("FW GRO supports only IPv4/IPv6, not 0x%04x\n", 668 BNX2X_ERR("Error: FW GRO supports only IPv4/IPv6, not 0x%04x\n",
662 be16_to_cpu(skb->protocol)); 669 be16_to_cpu(skb->protocol));
663 } 670 }
664 tcp_gro_complete(skb);
665 } 671 }
666#endif 672#endif
667 napi_gro_receive(&fp->napi, skb); 673 napi_gro_receive(&fp->napi, skb);