All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google.com>
To: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	netdev@vger.kernel.org,  eric.dumazet@gmail.com,
	Eric Dumazet <edumazet@google.com>
Subject: [PATCH net-next 10/10] ice: do not assume mac header is set in tx paths
Date: Wed,  2 Sep 2026 00:33:44 +0000	[thread overview]
Message-ID: <20260902003344.1931843-11-edumazet@google.com> (raw)
In-Reply-To: <20260902003344.1931843-1-edumazet@google.com>

We should not assume mac header is set in output path.

Use skb_eth_hdr() instead of skb_mac_header() in ice_xmit_frame_ring()
and ice_eswitch_set_target_vsi(). Also use skb_checksum_start_offset()
instead of skb->csum_start - skb->mac_header in ice_tx_csum().

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 drivers/net/ethernet/intel/ice/ice_eswitch.c | 2 +-
 drivers/net/ethernet/intel/ice/ice_txrx.c    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch.c b/drivers/net/ethernet/intel/ice/ice_eswitch.c
index b069e6c514fb1279ddd9e941e76271be0e72c912..387e8fa8e924c64ce1146e0d86e0f8a853640085 100644
--- a/drivers/net/ethernet/intel/ice/ice_eswitch.c
+++ b/drivers/net/ethernet/intel/ice/ice_eswitch.c
@@ -244,7 +244,7 @@ ice_eswitch_set_target_vsi(struct sk_buff *skb,
 	u64 cd_cmd, dst_vsi;
 
 	if (!dst) {
-		struct ethhdr *eth = (struct ethhdr *)skb_mac_header(skb);
+		struct ethhdr *eth = skb_eth_hdr(skb);
 
 		if (unlikely(eth->h_proto == htons(ETH_P_LLDP)))
 			return;
diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c
index 31303ab5be175a5ce698f16715ea8d75eeea7bc5..5e73cdc71a68dc23022ff91d10b2c8c872939ff2 100644
--- a/drivers/net/ethernet/intel/ice/ice_txrx.c
+++ b/drivers/net/ethernet/intel/ice/ice_txrx.c
@@ -1743,7 +1743,7 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off)
 	    !(first->tx_flags & ICE_TX_FLAGS_TSO) &&
 	    !skb_csum_is_sctp(skb)) {
 		/* Set GCS */
-		u16 csum_start = (skb->csum_start - skb->mac_header) / 2;
+		u16 csum_start = skb_checksum_start_offset(skb) / 2;
 		u16 csum_offset = skb->csum_offset / 2;
 		u16 gcs_params;
 
@@ -2219,7 +2219,7 @@ ice_xmit_frame_ring(struct sk_buff *skb, struct ice_tx_ring *tx_ring)
 		goto out_drop;
 
 	/* allow CONTROL frames egress from main VSI if FW LLDP disabled */
-	eth = (struct ethhdr *)skb_mac_header(skb);
+	eth = skb_eth_hdr(skb);
 
 	if ((ice_is_switchdev_running(vsi->back) ||
 	     ice_lag_is_switchdev_running(vsi->back)) &&
-- 
2.55.0.966.g6673acef38-goog


  parent reply	other threads:[~2026-09-02  0:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02  0:33 [PATCH net-next 00/10] net: remove skb mac_header assumptions in TX paths (I) Eric Dumazet
2026-09-02  0:33 ` [PATCH net-next 01/10] bonding: do not assume mac header is set in ALB/TLB tx paths Eric Dumazet
2026-09-02  0:33 ` [PATCH net-next 02/10] atlantic: do not assume mac header is set in aq_ndev_start_xmit() Eric Dumazet
2026-09-02  0:33 ` [PATCH net-next 03/10] ibmveth: do not assume mac header is set in ibmveth_start_xmit() Eric Dumazet
2026-09-07  5:20   ` mingming cao
2026-09-07  6:41     ` Eric Dumazet
2026-09-02  0:33 ` [PATCH net-next 04/10] net: mediatek: do not assume mac header is set in mtk_start_xmit() Eric Dumazet
2026-09-02  0:33 ` [PATCH net-next 05/10] netvsc: do not assume mac header is set in netvsc_start_xmit() Eric Dumazet
2026-09-02  0:33 ` [PATCH net-next 06/10] macsec: do not assume mac header is set in macsec_encrypt_finish() Eric Dumazet
2026-09-02  0:33 ` [PATCH net-next 07/10] macvlan: do not assume mac header is set in macvlan_broadcast() Eric Dumazet
2026-09-02  0:33 ` [PATCH net-next 08/10] vxlan: do not assume mac header is set in tx paths Eric Dumazet
2026-09-02  0:33 ` [PATCH net-next 09/10] cdc_mbim: do not assume mac header is set in cdc_mbim_tx_fixup() Eric Dumazet
2026-09-02  0:33 ` Eric Dumazet [this message]
2026-09-02 11:22 ` [PATCH net-next 00/10] net: remove skb mac_header assumptions in TX paths (I) Eric Dumazet

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=20260902003344.1931843-11-edumazet@google.com \
    --to=edumazet@google.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=horms@kernel.org \
    --cc=kuba@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.