mbox series

[net-next,0/9] Remove skb_mac_header() dependency in DSA xmit path

Message ID 20230322233823.1806736-1-vladimir.oltean@nxp.com (mailing list archive)
Headers show
Series Remove skb_mac_header() dependency in DSA xmit path | expand

Message

Vladimir Oltean March 22, 2023, 11:38 p.m. UTC
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.

tcf_vlan_act() is also a potential caller of __skb_vlan_pop() on xmit,
through skb_vlan_pop(), but I haven't actually managed to convince this
veth setup to not use vlan hwaccel tags, so I couldn't test my
assumptions:

ip link add veth0 type veth peer name veth1

ip netns add ns0
ip link set veth1 netns ns0 && ip -n ns0 link set veth1 up
ip link set veth0 up

ethtool -K veth0 rx-vlan-offload off tx-vlan-offload off
ip netns exec ns0 ethtool -K veth1 rx-vlan-offload off tx-vlan-offload off

tc qdisc add dev veth0 clsact
tc -n ns0 qdisc add dev veth1 clsact
tc filter add dev veth0 egress protocol 802.1Q flower vlan_id 3 action vlan pop
tc filter add dev veth0 ingress protocol all matchall action vlan push id 3

ip link add link veth0 name veth0.3 type vlan id 3
ip link set veth0.3 up

ip -n ns0 addr add 192.168.100.2/24 dev veth1
ip addr add 192.168.100.1/24 dev veth0.3

I'm likely going to need to resend this, but I'm not able to come up
with something better for today, so posting this at least for a
preliminary view.

Vladimir Oltean (9):
  net: vlan: don't adjust MAC header in __vlan_insert_inner_tag() unless
    set
  net: vlan: introduce skb_vlan_eth_hdr()
  net: dpaa: avoid one skb_reset_mac_header() in dpaa_enable_tx_csum()
  net: dsa: tag_ocelot: do not rely on skb_mac_header() for VLAN xmit
  net: dsa: tag_ksz: do not rely on skb_mac_header() in TX paths
  net: dsa: tag_sja1105: don't rely on skb_mac_header() in TX paths
  net: dsa: tag_sja1105: replace skb_mac_header() with vlan_eth_hdr()
  net: dsa: update TX path comments to not mention skb_mac_header()
  net: dsa: tag_ocelot: call only the relevant portion of
    __skb_vlan_pop() on TX

 .../net/ethernet/broadcom/bnx2x/bnx2x_cmn.c   |  3 +-
 drivers/net/ethernet/emulex/benet/be_main.c   |  2 +-
 .../net/ethernet/freescale/dpaa/dpaa_eth.c    |  9 ++---
 .../net/ethernet/hisilicon/hns3/hns3_enet.c   |  2 +-
 drivers/net/ethernet/intel/i40e/i40e_txrx.c   |  2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |  2 +-
 .../ethernet/qlogic/netxen/netxen_nic_main.c  |  2 +-
 .../net/ethernet/qlogic/qlcnic/qlcnic_io.c    |  4 +--
 drivers/net/ethernet/sfc/tx_tso.c             |  2 +-
 .../net/ethernet/stmicro/stmmac/stmmac_main.c |  7 ++--
 drivers/staging/gdm724x/gdm_lte.c             |  4 +--
 include/linux/if_vlan.h                       | 35 +++++++++++++++++--
 net/batman-adv/soft-interface.c               |  2 +-
 net/core/skbuff.c                             |  8 +----
 net/dsa/tag.h                                 |  2 +-
 net/dsa/tag_8021q.c                           |  4 +--
 net/dsa/tag_ksz.c                             | 18 +++++-----
 net/dsa/tag_ocelot.c                          |  4 +--
 net/dsa/tag_sja1105.c                         |  4 +--
 19 files changed, 65 insertions(+), 51 deletions(-)

Comments

Eric Dumazet March 23, 2023, 4:24 p.m. UTC | #1
On Wed, Mar 22, 2023 at 4:38 PM Vladimir Oltean <vladimir.oltean@nxp.com> wrote:
>
> 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.
>

SGTM, thanks a lot !

For the whole series :

Reviewed-by: Eric Dumazet <edumazet@google.com>
Vladimir Oltean March 23, 2023, 4:36 p.m. UTC | #2
Hi Eric,

On Thu, Mar 23, 2023 at 09:24:28AM -0700, Eric Dumazet wrote:
> On Wed, Mar 22, 2023 at 4:38 PM Vladimir Oltean <vladimir.oltean@nxp.com> wrote:
> >
> > 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.
> >
> 
> SGTM, thanks a lot !
> 
> For the whole series :
> 
> Reviewed-by: Eric Dumazet <edumazet@google.com>

I'd have to resend this patch set anyway, due to the kdoc warning from
the last patch:
https://patchwork.hopto.org/static/nipa/732927/13184745/kdoc/stderr
(and also probably to CC the driver maintainers where I'm refactoring
stuff; didn't want to do that for what I was sure would only be the
initial patch set)

Have you seen my dilemma from patch 9/9 and from the cover letter -
__skb_vlan_pop() potentially being called from not just one xmit code
path? I took a different approach for vlan_insert_tag() (patch 1/9)
compared to __skb_vlan_pop() (patch 9/9). If we look at the larger
picture with the tc-vlan action, it would be a valid alternative to also
use skb_mac_header_was_set() in __skb_vlan_pop().