Netdev List
 help / color / mirror / Atom feed
From: Joe Damato <joe@dama.to>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	andrew+netdev@lunn.ch, willemb@google.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 1/2] net/packet: Reduce VLAN tag code duplication
Date: Wed, 12 Aug 2026 11:24:13 -0700	[thread overview]
Message-ID: <any6TenWsCUdIPvX@devvm20253.cco0.facebook.com> (raw)
In-Reply-To: <willemdebruijn.kernel.57d27685522a@gmail.com>

On Wed, Aug 12, 2026 at 08:28:39AM -0400, Willem de Bruijn wrote:
> Joe Damato wrote:
> > Reduce code duplication for VLAN tag extraction by factoring the
> > repeated code into a helper and using it.
> > 
> > Signed-off-by: Joe Damato <joe@dama.to>
> 
> Especially with the improving AI bots, we're getting even more fixes
> to PF_PACKET lately. Cleanup patches can block fix backports to stable.
> The bar for pure cleanup patches has to be high to warrant that.
> 
> Plus, they add risk, if it is not trivial to review that they are NOOPs.
> 
> Subjective, but not sure this one warrants the cost.

OK. In that case, I'll mark the series as rejected below. I was also working
on a test for ORIGDEV because many, many years ago I got bit by unexpected
results mixing packet sockets with bonded interfaces.

But, I'll refrain from touching anything related to af_packet including tests
from now on.

> > ---
> >  net/packet/af_packet.c | 95 +++++++++++++++++++++++-------------------
> >  1 file changed, 53 insertions(+), 42 deletions(-)
> > 
> > diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> > index 435756877aba..ee60dcc639ad 100644
> > --- a/net/packet/af_packet.c
> > +++ b/net/packet/af_packet.c

[...]

> > @@ -997,20 +1018,19 @@ static void prb_fill_vlan_info(struct tpacket_kbdq_core *pkc,
> >  			struct tpacket3_hdr *ppd)
> >  {
> >  	struct packet_sock *po = container_of(pkc, struct packet_sock, rx_ring.prb_bdqc);
> > +	struct net_device *dev = NULL;
> > +	u16 tci, tpid;
> >  
> > -	if (skb_vlan_tag_present(pkc->skb)) {
> > -		ppd->hv1.tp_vlan_tci = skb_vlan_tag_get(pkc->skb);
> > -		ppd->hv1.tp_vlan_tpid = ntohs(pkc->skb->vlan_proto);
> > -		ppd->tp_status = TP_STATUS_VLAN_VALID | TP_STATUS_VLAN_TPID_VALID;
> > -	} else if (unlikely(po->sk.sk_type == SOCK_DGRAM && eth_type_vlan(pkc->skb->protocol))) {
> > -		ppd->hv1.tp_vlan_tci = vlan_get_tci(pkc->skb, pkc->skb->dev);
> > -		ppd->hv1.tp_vlan_tpid = ntohs(pkc->skb->protocol);
> > +	if (po->sk.sk_type == SOCK_DGRAM)
> > +		dev = pkc->skb->dev;
> > +
> > +	if (packet_get_vlan_tci_tpid(pkc->skb, dev, &tci, &tpid))
> >  		ppd->tp_status = TP_STATUS_VLAN_VALID | TP_STATUS_VLAN_TPID_VALID;
> 
> Does this change behavior, now setting tp_status also for the second
> branch, where previously the flags were not set?

If you apply the patch to the tree and look at it, it'll be less confusing. It
looks weird because of what git generated, but as far as my reading of the
code goes, there is no behavior change.

---
pw-bot: rejected

  reply	other threads:[~2026-08-12 18:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-11 18:47 [PATCH net-next 0/2] packet socket cleanup Joe Damato
2026-08-11 18:47 ` [PATCH net-next 1/2] net/packet: Reduce VLAN tag code duplication Joe Damato
2026-08-12 12:28   ` Willem de Bruijn
2026-08-12 18:24     ` Joe Damato [this message]
2026-08-11 18:47 ` [PATCH net-next 2/2] net/packet: Use copy_safe_from_sockptr to dedupe code Joe Damato
2026-08-12 12:19   ` 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=any6TenWsCUdIPvX@devvm20253.cco0.facebook.com \
    --to=joe@dama.to \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=willemb@google.com \
    --cc=willemdebruijn.kernel@gmail.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