All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH net-next 3/9] net: dpaa: avoid one skb_reset_mac_header() in dpaa_enable_tx_csum()
Date: Thu, 23 Mar 2023 01:38:17 +0200	[thread overview]
Message-ID: <20230322233823.1806736-4-vladimir.oltean@nxp.com> (raw)
In-Reply-To: <20230322233823.1806736-1-vladimir.oltean@nxp.com>

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>
---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 9318a2554056..1fa676308c5e 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -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
-- 
2.34.1


  parent reply	other threads:[~2023-03-22 23:39 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22 23:38 [PATCH net-next 0/9] Remove skb_mac_header() dependency in DSA xmit path Vladimir Oltean
2023-03-22 23:38 ` [PATCH net-next 1/9] net: vlan: don't adjust MAC header in __vlan_insert_inner_tag() unless set Vladimir Oltean
2023-03-23 16:08   ` Simon Horman
2023-03-23 16:30   ` Florian Fainelli
2023-03-22 23:38 ` [PATCH net-next 2/9] net: vlan: introduce skb_vlan_eth_hdr() Vladimir Oltean
2023-03-23 16:08   ` Simon Horman
2023-03-23 16:31   ` Florian Fainelli
2023-03-22 23:38 ` Vladimir Oltean [this message]
2023-03-23 16:09   ` [PATCH net-next 3/9] net: dpaa: avoid one skb_reset_mac_header() in dpaa_enable_tx_csum() Simon Horman
2023-03-23 16:31   ` Florian Fainelli
2023-03-22 23:38 ` [PATCH net-next 4/9] net: dsa: tag_ocelot: do not rely on skb_mac_header() for VLAN xmit Vladimir Oltean
2023-03-23 16:09   ` Simon Horman
2023-03-23 16:31   ` Florian Fainelli
2023-03-22 23:38 ` [PATCH net-next 5/9] net: dsa: tag_ksz: do not rely on skb_mac_header() in TX paths Vladimir Oltean
2023-03-23 16:11   ` Simon Horman
2023-03-23 16:32   ` Florian Fainelli
2023-03-22 23:38 ` [PATCH net-next 6/9] net: dsa: tag_sja1105: don't " Vladimir Oltean
2023-03-23 16:11   ` Simon Horman
2023-03-23 16:32   ` Florian Fainelli
2023-03-22 23:38 ` [PATCH net-next 7/9] net: dsa: tag_sja1105: replace skb_mac_header() with vlan_eth_hdr() Vladimir Oltean
2023-03-23 16:12   ` Simon Horman
2023-03-23 16:32   ` Florian Fainelli
2023-03-22 23:38 ` [PATCH net-next 8/9] net: dsa: update TX path comments to not mention skb_mac_header() Vladimir Oltean
2023-03-23 16:13   ` Simon Horman
2023-03-23 16:33   ` Florian Fainelli
2023-03-22 23:38 ` [PATCH net-next 9/9] net: dsa: tag_ocelot: call only the relevant portion of __skb_vlan_pop() on TX Vladimir Oltean
2023-03-23 16:14   ` Simon Horman
2023-03-23 16:34   ` Florian Fainelli
2023-03-23 16:24 ` [PATCH net-next 0/9] Remove skb_mac_header() dependency in DSA xmit path Eric Dumazet
2023-03-23 16:36   ` Vladimir Oltean

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230322233823.1806736-4-vladimir.oltean@nxp.com \
    --to=vladimir.oltean@nxp.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.