]> git.itanic.dy.fi Git - linux-stable/commitdiff
net: dpaa: avoid one skb_reset_mac_header() in dpaa_enable_tx_csum()
authorVladimir Oltean <vladimir.oltean@nxp.com>
Thu, 20 Apr 2023 22:55:55 +0000 (01:55 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sun, 23 Apr 2023 13:16:44 +0000 (14:16 +0100)
It appears that dpaa_enable_tx_csum() only calls skb_reset_mac_header()
to get to the VLAN header using skb_mac_header().

We can use skb_vlan_eth_hdr() to get to the VLAN header based on
skb->data directly. This avoids spending a few cycles to set
skb->mac_header.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Madalin Bucur <madalin.bucur@oss.nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c

index 9318a2554056d739a90b8d21173b705425ace272..1fa676308c5e553b323a422dceae55e4c082aa6b 100644 (file)
@@ -1482,13 +1482,8 @@ static int dpaa_enable_tx_csum(struct dpaa_priv *priv,
        parse_result = (struct fman_prs_result *)parse_results;
 
        /* If we're dealing with VLAN, get the real Ethernet type */
-       if (ethertype == ETH_P_8021Q) {
-               /* We can't always assume the MAC header is set correctly
-                * by the stack, so reset to beginning of skb->data
-                */
-               skb_reset_mac_header(skb);
-               ethertype = ntohs(vlan_eth_hdr(skb)->h_vlan_encapsulated_proto);
-       }
+       if (ethertype == ETH_P_8021Q)
+               ethertype = ntohs(skb_vlan_eth_hdr(skb)->h_vlan_encapsulated_proto);
 
        /* Fill in the relevant L3 parse result fields
         * and read the L4 protocol type