Commit 00266b36 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'dsa-skb_mac_header'

Vladimir Oltean says:

====================
Remove skb_mac_header() dependency in DSA xmit path

Eric started working on removing skb_mac_header() assumptions from the
networking xmit path, and I offered to help for DSA:
https://lore.kernel.org/netdev/20230321164519.1286357-1-edumazet@google.com/

The majority of this patch set is a straightforward replacement of
skb_mac_header() with skb->data (hidden either behind skb_eth_hdr(), or
behind skb_vlan_eth_hdr()). The only patch which is more "interesting"
is 9/9.

Another potential caller of __skb_vlan_pop() on xmit (and therefore
also of skb_mac_header()) is tcf_vlan_act(), but I haven't had the time
to investigate that (enough to submit changes other than what's here).

v1->v2:
- 09/09: document the vlan_tci argument of vlan_remove_tag() in the kdoc

v1 at:
https://lore.kernel.org/netdev/20230322233823.1806736-1-vladimir.oltean@nxp.com/



Cc: Madalin Bucur <madalin.bucur@nxp.com>
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 4d2bd258 0bcf2e4a
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -1935,8 +1935,7 @@ u16 bnx2x_select_queue(struct net_device *dev, struct sk_buff *skb,

		/* Skip VLAN tag if present */
		if (ether_type == ETH_P_8021Q) {
			struct vlan_ethhdr *vhdr =
				(struct vlan_ethhdr *)skb->data;
			struct vlan_ethhdr *vhdr = skb_vlan_eth_hdr(skb);

			ether_type = ntohs(vhdr->h_vlan_encapsulated_proto);
		}
+1 −1
Original line number Diff line number Diff line
@@ -1124,7 +1124,7 @@ static struct sk_buff *be_lancer_xmit_workarounds(struct be_adapter *adapter,
						  struct be_wrb_params
						  *wrb_params)
{
	struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
	struct vlan_ethhdr *veh = skb_vlan_eth_hdr(skb);
	unsigned int eth_hdr_len;
	struct iphdr *ip;

+2 −7
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -1532,7 +1532,7 @@ static int hns3_handle_vtags(struct hns3_enet_ring *tx_ring,
	if (unlikely(rc < 0))
		return rc;

	vhdr = (struct vlan_ethhdr *)skb->data;
	vhdr = skb_vlan_eth_hdr(skb);
	vhdr->h_vlan_TCI |= cpu_to_be16((skb->priority << VLAN_PRIO_SHIFT)
					 & VLAN_PRIO_MASK);

+1 −1
Original line number Diff line number Diff line
@@ -3063,7 +3063,7 @@ static inline int i40e_tx_prepare_vlan_flags(struct sk_buff *skb,
			rc = skb_cow_head(skb, 0);
			if (rc < 0)
				return rc;
			vhdr = (struct vlan_ethhdr *)skb->data;
			vhdr = skb_vlan_eth_hdr(skb);
			vhdr->h_vlan_TCI = htons(tx_flags >>
						 I40E_TX_FLAGS_VLAN_SHIFT);
		} else {
Loading