Netdev List
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemb@google.com>
To: netdev@vger.kernel.org
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
	 kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	elder@kernel.org,  Willem de Bruijn <willemb@google.com>
Subject: [PATCH net-next v2 0/5] net: remove dev_validate_header() and net_device::min_header_len
Date: Sun, 29 Nov 2026 11:30:35 -0500	[thread overview]
Message-ID: <20261129163327.893403-1-willemb@google.com> (raw)

Remove unused link-layer header validation plumbing, clean up the
remaining af_packet users, and drop net_device::min_header_len.

Mostly cleanup, with two user-visible changes:

- Patch 3: on devices that set hard_header_len but have no link layer
  header (e.g., PPP), SOCK_RAW sends, with or without a TX_RING, now
  always have skb->network_header at the start of the packet. Before,
  only short packets sent without a TX_RING did.
- Patch 4: on SOCK_DGRAM, the VLAN TCI of non-offloaded tags is now
  reported on all Ethernet devices, including those with
  hard_header_len != ETH_HLEN, and omitted (without setting
  TP_STATUS_VLAN_VALID) on non-Ethernet devices.

1. Drop stale Ethernet fields (including min_header_len) in IPA modem.
2. Remove header_ops->validate and dev_validate_header().
3. Reset network header on all headerless devices via dev_has_header().
4. Use ARPHRD_ETHER / ARPHRD_LOOPBACK and ETH_HLEN in vlan_get_tci().
5. Remove unused net_device::min_header_len.

Testing (under vng):
- tools/testing/selftests/net: psock_snd.sh, psock_tpacket, and
  txring_overwrite.
- Custom tests for short/zero header validation (SOCK_RAW, SOCK_DGRAM,
  SOCK_PACKET, TX_RING), SOCK_PACKET retry device swap via userfaultfd
  (tun -> veth), non-offloaded outgoing VLAN TCI capture (AUXDATA with
  non-zero TCI, TCI 0, TP_STATUS_COPY, and tun; TPACKET_V2; TPACKET_V3),
  and SOCK_RAW network header offset over PPP (40B/100B IPv4, with and
  without TX_RING).

Link: https://patch.msgid.link/willemdebruijn.kernel.251660d5aa3e@gmail.com

Changes
  v1 -> v2
    - rebase on net-next
    - cover letter: add Link: to the thread where this cleanup was
      proposed
    - cover letter: correct the summary of the network header change
    - cover letter: update the summary of the VLAN change and the list
      of custom tests to match v2
    - patch 1/5: add Acked-by from Alex Elder
    - patch 1/5: replace <linux/etherdevice.h> with <linux/if_ether.h>
      for ETH_P_MAP and ETH_MIN_MTU
    - patch 2/5: compare against live READ_ONCE(dev->hard_header_len) in
      all three af_packet callers instead of the snapshotted value. In
      packet_sendmsg_spkt() the snapshot could come from a different
      device than the one transmitted on (Sashiko)
    - drop v1 patch 3/6 ("packet: validate TX header length before skb
      allocation"): not needed to remove min_header_len. This keeps the
      TX header length checks against the live hard_header_len, after
      the skb is built, which also addresses the Sashiko report on that
      patch
    - patch 3/5: no code change; clarify commit message (needed_headroom
      vs hard_header_len, scope of the 6in4 workaround, why
      tpacket_fill_skb() is changed as well, and list hdlc_null_ops as a
      second header_ops without ->create)
    - patch 4/5: have vlan_get_tci() return bool so callers only set
      TP_STATUS_VLAN_VALID | TP_STATUS_VLAN_TPID_VALID when a VLAN
      header is extracted, avoiding false VLAN flags on TP_STATUS_COPY
      skbs (zeroed sll_hatype; Sashiko), non-Ethernet devices, and
      truncated frames
    - patch 4/5: update commit message to match
  v1: https://lore.kernel.org/netdev/20261124170551.1874487-1-willemdebruijn.kernel@gmail.com/

Willem de Bruijn (5):
  net: ipa: remove ethernet-specific artifacts from modem netdev setup
  net: remove header_ops->validate and dev_validate_header()
  packet: reset network header on all headerless devices
  packet: use Ethernet header length in vlan_get_tci()
  net: remove unused net_device::min_header_len

 .../networking/net_cachelines/net_device.rst  |  1 -
 drivers/net/ipa/ipa_modem.c                   |  5 +-
 drivers/net/loopback.c                        |  1 -
 include/linux/netdevice.h                     | 18 -----
 net/ethernet/eth.c                            |  1 -
 net/packet/af_packet.c                        | 78 +++++++++----------
 6 files changed, 36 insertions(+), 68 deletions(-)

-- 
2.56.1.839.g22a8290db9-goog


             reply	other threads:[~2026-11-29 16:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29 16:30 Willem de Bruijn [this message]
2026-11-29 16:30 ` [PATCH net-next v2 1/5] net: ipa: remove ethernet-specific artifacts from modem netdev setup Willem de Bruijn
2026-11-29 16:30 ` [PATCH net-next v2 2/5] net: remove header_ops->validate and dev_validate_header() Willem de Bruijn
2026-11-29 16:30 ` [PATCH net-next v2 3/5] packet: reset network header on all headerless devices Willem de Bruijn
2026-11-29 16:30 ` [PATCH net-next v2 4/5] packet: use Ethernet header length in vlan_get_tci() Willem de Bruijn
2026-11-29 16:30 ` [PATCH net-next v2 5/5] net: remove unused net_device::min_header_len Willem de Bruijn

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=20261129163327.893403-1-willemb@google.com \
    --to=willemb@google.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=elder@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox