aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorIdo Shamay <idos@mellanox.com>2015-06-25 04:29:43 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-07-10 12:49:30 -0400
commit1b74080050336e29a82abc2a9b2e1f901485a362 (patch)
tree16700164a5efff76140f3c71a8280bcba724d05e /drivers/net
parent7a9aa8ab0c706b3d2770a3996c9e63f08074c855 (diff)
net/mlx4_en: Fix wrong csum complete report when rxvlan offload is disabled
[ Upstream commit 79a258526ce1051cb9684018c25a89d51ac21be8 ] The check_csum() function relied on hwtstamp_rx_filter to know if rxvlan offload is disabled. This is wrong since rxvlan offload can be switched on/off regardless of hwtstamp_rx_filter. Also moved check_csum to query CQE information to identify VLAN packets and removed the check of IP packets, since it has been validated before. Fixes: f8c6455bb04b ('net/mlx4_en: Extend checksum offloading by CHECKSUM COMPLETE') Signed-off-by: Ido Shamay <idos@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_rx.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index 2a77a6b19121..eab4e080ebd2 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -723,7 +723,7 @@ static int get_fixed_ipv6_csum(__wsum hw_checksum, struct sk_buff *skb,
723} 723}
724#endif 724#endif
725static int check_csum(struct mlx4_cqe *cqe, struct sk_buff *skb, void *va, 725static int check_csum(struct mlx4_cqe *cqe, struct sk_buff *skb, void *va,
726 int hwtstamp_rx_filter) 726 netdev_features_t dev_features)
727{ 727{
728 __wsum hw_checksum = 0; 728 __wsum hw_checksum = 0;
729 729
@@ -731,14 +731,8 @@ static int check_csum(struct mlx4_cqe *cqe, struct sk_buff *skb, void *va,
731 731
732 hw_checksum = csum_unfold((__force __sum16)cqe->checksum); 732 hw_checksum = csum_unfold((__force __sum16)cqe->checksum);
733 733
734 if (((struct ethhdr *)va)->h_proto == htons(ETH_P_8021Q) && 734 if (cqe->vlan_my_qpn & cpu_to_be32(MLX4_CQE_VLAN_PRESENT_MASK) &&
735 hwtstamp_rx_filter != HWTSTAMP_FILTER_NONE) { 735 !(dev_features & NETIF_F_HW_VLAN_CTAG_RX)) {
736 /* next protocol non IPv4 or IPv6 */
737 if (((struct vlan_hdr *)hdr)->h_vlan_encapsulated_proto
738 != htons(ETH_P_IP) &&
739 ((struct vlan_hdr *)hdr)->h_vlan_encapsulated_proto
740 != htons(ETH_P_IPV6))
741 return -1;
742 hw_checksum = get_fixed_vlan_csum(hw_checksum, hdr); 736 hw_checksum = get_fixed_vlan_csum(hw_checksum, hdr);
743 hdr += sizeof(struct vlan_hdr); 737 hdr += sizeof(struct vlan_hdr);
744 } 738 }
@@ -901,7 +895,8 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
901 895
902 if (ip_summed == CHECKSUM_COMPLETE) { 896 if (ip_summed == CHECKSUM_COMPLETE) {
903 void *va = skb_frag_address(skb_shinfo(gro_skb)->frags); 897 void *va = skb_frag_address(skb_shinfo(gro_skb)->frags);
904 if (check_csum(cqe, gro_skb, va, ring->hwtstamp_rx_filter)) { 898 if (check_csum(cqe, gro_skb, va,
899 dev->features)) {
905 ip_summed = CHECKSUM_NONE; 900 ip_summed = CHECKSUM_NONE;
906 ring->csum_none++; 901 ring->csum_none++;
907 ring->csum_complete--; 902 ring->csum_complete--;
@@ -956,7 +951,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
956 } 951 }
957 952
958 if (ip_summed == CHECKSUM_COMPLETE) { 953 if (ip_summed == CHECKSUM_COMPLETE) {
959 if (check_csum(cqe, skb, skb->data, ring->hwtstamp_rx_filter)) { 954 if (check_csum(cqe, skb, skb->data, dev->features)) {
960 ip_summed = CHECKSUM_NONE; 955 ip_summed = CHECKSUM_NONE;
961 ring->csum_complete--; 956 ring->csum_complete--;
962 ring->csum_none++; 957 ring->csum_none++;