public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	 Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: netdev@vger.kernel.org,  "(JC),
	Jayachandran" <j-rameshbabu@ti.com>,
	 "David S. Miller" <davem@davemloft.net>,
	 Andrew Lunn <andrew+netdev@lunn.ch>,
	 Chintan Vankar <c-vankar@ti.com>,
	 Danish Anwar <danishanwar@ti.com>,  Daolin Qiu <d-qiu@ti.com>,
	 Eric Dumazet <edumazet@google.com>,
	 Felix Maurer <fmaurer@redhat.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>,
	 Richard Cochran <richardcochran@gmail.com>,
	 Simon Horman <horms@kernel.org>
Subject: Re: [PATCH RFC net-next v2 2/2] af_packet: Add port specific handling for HSR
Date: Thu, 19 Mar 2026 12:27:57 -0400	[thread overview]
Message-ID: <willemdebruijn.kernel.8e323262df61@gmail.com> (raw)
In-Reply-To: <20260319142613.KHz32I-V@linutronix.de>

Sebastian Andrzej Siewior wrote:
> On 2026-03-19 09:29:44 [-0400], Willem de Bruijn wrote:
> > > But here you have PACKET_VNET_HDR_SZ to configure virtio_net_hdr. 
> > 
> > I mean an implicit header in the packet. virtio_net_hdr is something
> > that the packet socket needs to inspect. The metadata between ptp4l
> > and hsr_dev_xmit is not, so the packet socket can be oblivious to it.
> 
> Ah okay. If I insert a header, I would need to scan for something in
> every packet and it must not collide with anything that would include
> the same sequence.

True.

> This means the PTP packets from ptp4l and everything
> else that sends data. That is something I am not very comfortable with.
> Even the destination MAC address had to be changed a few times during
> testing so scanning for it would not be good.
> 
> > > This
> > > is kind of what I ask for with PACKET_HSR_INFO + PACKET_HSR_BIND_PORT
> > > (and I added static branches so nobody has to suffer with CONFIG_HSR
> > > enabled but no HSR enabled socket)..
> > > 
> > > The diff below would be what means to bypass AF_PACKET entirely and use
> > > eth0/ eth1 to send via SLAVE_A/ B and hsr0 with SO_MARK to send with
> > > system's HSR header but only on one of the two ports.
> > > With HSR-offloading enabled we need to attach the SO_MARK hints also on
> > > eth0/ eth1 devices, too. Otherwise the offloading part will send the
> > > packet on both ports and attach a header (as designed).
> > 
> > eth0/eth1 are not HSR devices, so how would they interpret skb->mark
> > and how would they loop packets to the other port?
> 
> If you look at the diff below, there is the
> hsr_skb_get_header_port_mark() helper.
> 
> So eth0/ eth1 are not HSR devices but they are used as slaves by hsr0.
> The intention is use the eth0/ eth1 devices to pass packets which
> include the HSR-header. So if I send on eth0 the intention is to send
> the packet 1:1 on this device. The skb->mark is not required there
> unless with hardware offload enabled. 

Right, so this is simple without hardware offload. Does this HW
offload exist, or is this aspirational. At least for infrequent PTP
it does not sound important.

> In this case if "PORT" marker is
> used to let the driver know to not duplicate the packet on the other
> port and if "HEADER" marker is set then it won't prepend a HSR header.
> The port marking is the same as for hsr0 and I used the next bit for the
> header to keep things a bit simple.
> The skb->mark with values 1…7 is then not available to anything else in
> this scenario.
> 
> > > diff --git a/drivers/net/ethernet/ti/icssg/icssg_common.c b/drivers/net/ethernet/ti/icssg/icssg_common.c
> > > index 79df641b4fb97..a2e50cae01686 100644
> > > --- a/drivers/net/ethernet/ti/icssg/icssg_common.c
> > > +++ b/drivers/net/ethernet/ti/icssg/icssg_common.c
> > > @@ -909,13 +909,17 @@ enum netdev_tx icssg_ndo_start_xmit(struct sk_buff *skb, struct net_device *ndev
> > >  	 */
> > >  	dst_tag_id = emac->port_id | (q_idx << 8);
> > >  
> > > -	if (prueth->is_hsr_offload_mode &&
> > > -	    (ndev->features & NETIF_F_HW_HSR_DUP))
> > > -		dst_tag_id = PRUETH_UNDIRECTED_PKT_DST_TAG;
> > > +	if (prueth->is_hsr_offload_mode) {
> > > +		bool has_header;
> > > +		bool has_port;
> > >  
> > > -	if (prueth->is_hsr_offload_mode &&
> > > -	    (ndev->features & NETIF_F_HW_HSR_TAG_INS))
> > > -		epib[1] |= PRUETH_UNDIRECTED_PKT_TAG_INS;
> > > +		hsr_skb_get_header_port_mark(skb, &has_header, &has_port);
> > > +		if (ndev->features & NETIF_F_HW_HSR_DUP && !has_port)
> > > +			dst_tag_id = PRUETH_UNDIRECTED_PKT_DST_TAG;
> > > +
> > > +		if (ndev->features & NETIF_F_HW_HSR_TAG_INS && !has_header)
> > > +			epib[1] |= PRUETH_UNDIRECTED_PKT_TAG_INS;
> > > +	}
> > >  
> > >  	cppi5_desc_set_tags_ids(&first_desc->hdr, 0, dst_tag_id);
> > >  	k3_udma_glue_tx_dma_to_cppi5_addr(tx_chn->tx_chn, &buf_dma);
> 
> Sebastian



  reply	other threads:[~2026-03-19 16:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-09 15:52 [PATCH RFC net-next v2 0/2] hsr: Add additional info to send/ receive skbs Sebastian Andrzej Siewior
2026-03-09 15:52 ` [PATCH RFC net-next v2 1/2] hsr: Allow to send a specific port and with HSR header Sebastian Andrzej Siewior
2026-03-09 15:52 ` [PATCH RFC net-next v2 2/2] af_packet: Add port specific handling for HSR Sebastian Andrzej Siewior
2026-03-10  1:38   ` Willem de Bruijn
2026-03-10 10:55     ` Sebastian Andrzej Siewior
2026-03-10 21:35       ` Willem de Bruijn
2026-03-12 15:42         ` Sebastian Andrzej Siewior
2026-03-12 21:43           ` Willem de Bruijn
2026-03-13  9:22             ` Sebastian Andrzej Siewior
2026-03-13 16:04               ` Sebastian Andrzej Siewior
2026-03-16 20:12                 ` Willem de Bruijn
2026-03-17 17:29                   ` Sebastian Andrzej Siewior
2026-03-19 13:29                     ` Willem de Bruijn
2026-03-19 14:26                       ` Sebastian Andrzej Siewior
2026-03-19 16:27                         ` Willem de Bruijn [this message]
2026-03-24 16:38                           ` Sebastian Andrzej Siewior

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=willemdebruijn.kernel.8e323262df61@gmail.com \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bigeasy@linutronix.de \
    --cc=c-vankar@ti.com \
    --cc=d-qiu@ti.com \
    --cc=danishanwar@ti.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fmaurer@redhat.com \
    --cc=horms@kernel.org \
    --cc=j-rameshbabu@ti.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@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