]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
net/mlx5e: Rx, checksum handling refactoring
authorSaeed Mahameed <saeedm@mellanox.com>
Fri, 3 May 2019 22:12:46 +0000 (15:12 -0700)
committerSaeed Mahameed <saeedm@mellanox.com>
Thu, 1 Aug 2019 19:33:31 +0000 (12:33 -0700)
Move vlan checksum fixup flow into mlx5e_skb_padding_csum(), which is
supposed to fixup SKB checksum if needed. And rename
mlx5e_skb_padding_csum() to mlx5e_skb_csum_fixup().

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c

index ac6e586d403d8cb6bffdb44fa475efa60b0833c7..60570b442fffe6d0ac29fa56a7f457f9475ff78e 100644 (file)
@@ -859,13 +859,24 @@ tail_padding_csum(struct sk_buff *skb, int offset,
 }
 
 static void
-mlx5e_skb_padding_csum(struct sk_buff *skb, int network_depth, __be16 proto,
-                      struct mlx5e_rq_stats *stats)
+mlx5e_skb_csum_fixup(struct sk_buff *skb, int network_depth, __be16 proto,
+                    struct mlx5e_rq_stats *stats)
 {
        struct ipv6hdr *ip6;
        struct iphdr   *ip4;
        int pkt_len;
 
+       /* Fixup vlan headers, if any */
+       if (network_depth > ETH_HLEN)
+               /* CQE csum is calculated from the IP header and does
+                * not cover VLAN headers (if present). This will add
+                * the checksum manually.
+                */
+               skb->csum = csum_partial(skb->data + ETH_HLEN,
+                                        network_depth - ETH_HLEN,
+                                        skb->csum);
+
+       /* Fixup tail padding, if any */
        switch (proto) {
        case htons(ETH_P_IP):
                ip4 = (struct iphdr *)(skb->data + network_depth);
@@ -931,16 +942,7 @@ static inline void mlx5e_handle_csum(struct net_device *netdev,
                        return; /* CQE csum covers all received bytes */
 
                /* csum might need some fixups ...*/
-               if (network_depth > ETH_HLEN)
-                       /* CQE csum is calculated from the IP header and does
-                        * not cover VLAN headers (if present). This will add
-                        * the checksum manually.
-                        */
-                       skb->csum = csum_partial(skb->data + ETH_HLEN,
-                                                network_depth - ETH_HLEN,
-                                                skb->csum);
-
-               mlx5e_skb_padding_csum(skb, network_depth, proto, stats);
+               mlx5e_skb_csum_fixup(skb, network_depth, proto, stats);
                return;
        }