All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tobias Waldekranz <tobias@waldekranz.com>
To: Ido Schimmel <idosch@idosch.org>
Cc: andrew@lunn.ch, f.fainelli@gmail.com, jiri@resnulli.us,
	netdev@vger.kernel.org, bridge@lists.linux-foundation.org,
	vivien.didelot@gmail.com, nikolay@nvidia.com, roopa@nvidia.com,
	kuba@kernel.org, olteanv@gmail.com, davem@davemloft.net
Subject: Re: [Bridge] [RFC net-next 2/9] net: bridge: Disambiguate offload_fwd_mark
Date: Mon, 03 May 2021 10:49:12 +0200	[thread overview]
Message-ID: <87h7jknqwn.fsf@waldekranz.com> (raw)
In-Reply-To: <YI6+kQxjCcnYmwkx@shredder>

On Sun, May 02, 2021 at 18:00, Ido Schimmel <idosch@idosch.org> wrote:
> On Mon, Apr 26, 2021 at 07:04:04PM +0200, Tobias Waldekranz wrote:
>> - skb->cb->offload_fwd_mark becomes skb->cb->src_hwdom. There is a
>>   slight change here: Whereas previously this was only set for
>>   offloaded packets, we now always track the incoming hwdom. As all
>>   uses where already gated behind checks of skb->offload_fwd_mark,
>>   this will not introduce any functional change, but it paves the way
>>   for future changes where the ingressing hwdom must be known both for
>>   offloaded and non-offloaded frames.
>
> [...]
>
>> @@ -43,15 +43,15 @@ int nbp_switchdev_mark_set(struct net_bridge_port *p)
>>  void nbp_switchdev_frame_mark(const struct net_bridge_port *p,
>>  			      struct sk_buff *skb)
>>  {
>> -	if (skb->offload_fwd_mark && !WARN_ON_ONCE(!p->offload_fwd_mark))
>> -		BR_INPUT_SKB_CB(skb)->offload_fwd_mark = p->offload_fwd_mark;
>> +	if (p->hwdom)
>> +		BR_INPUT_SKB_CB(skb)->src_hwdom = p->hwdom;
>>  }
>
> I assume you are referring to this change? "src_hwdom" sounds weird if
> it's expected to be valid for non-offloaded frames.

Perhaps "non-offloaded" was a sloppy description on my part. I was
trying to describe frames that originate from a switchdev, but have not
been forwarded by hardware; e.g. STP BPDUs, IGMP reports, etc. So
nbp_switchdev_frame_mark now basically says: "If this skb came in from a
switchdev, make sure to note which one".

> Can you elaborate about "future changes where the ingressing hwdom must
> be known both for offloaded and non-offloaded frames"?

Typical example: The switchdev has a fixed configuration to trap STP
BPDUs, but STP is not running on the bridge and the group_fwd_mask
allows them to be forwarded. Say we have this setup:

      br0
    /  |  \
swp0 swp1 swp2

A BPDU comes in on swp0 and is trapped to the CPU; the driver does not
set skb->offload_fwd_mark. The bridge determines that the frame should
be forwarded to swp{1,2}. It is imperative that forward offloading is
_not_ allowed in this case, as the source hwdom is already "poisoned".

Recording the source hwdom allows this case to be handled properly.

> Probably best to split this change to a different patch given the rest
> of the changes are mechanical.

Right, but I think the change in name to warrants a change in
semantics. It is being renamed to src_hwdom because it now holds just
that information. Again, there is no functional change introduced by
this since nbp_switchdev_allowed_egress always checks for the presence
of skb->offload_fwd_mark anyway. But if you feel strongly about it, I
will split it up.

>>  
>>  bool nbp_switchdev_allowed_egress(const struct net_bridge_port *p,
>>  				  const struct sk_buff *skb)
>>  {
>>  	return !skb->offload_fwd_mark ||
>> -	       BR_INPUT_SKB_CB(skb)->offload_fwd_mark != p->offload_fwd_mark;
>> +	       BR_INPUT_SKB_CB(skb)->src_hwdom != p->hwdom;
>>  }
>>  
>>  /* Flags that can be offloaded to hardware */
>> -- 
>> 2.25.1
>> 

WARNING: multiple messages have this Message-ID (diff)
From: Tobias Waldekranz <tobias@waldekranz.com>
To: Ido Schimmel <idosch@idosch.org>
Cc: davem@davemloft.net, kuba@kernel.org, andrew@lunn.ch,
	vivien.didelot@gmail.com, f.fainelli@gmail.com,
	olteanv@gmail.com, roopa@nvidia.com, nikolay@nvidia.com,
	jiri@resnulli.us, stephen@networkplumber.org,
	netdev@vger.kernel.org, bridge@lists.linux-foundation.org
Subject: Re: [RFC net-next 2/9] net: bridge: Disambiguate offload_fwd_mark
Date: Mon, 03 May 2021 10:49:12 +0200	[thread overview]
Message-ID: <87h7jknqwn.fsf@waldekranz.com> (raw)
In-Reply-To: <YI6+kQxjCcnYmwkx@shredder>

On Sun, May 02, 2021 at 18:00, Ido Schimmel <idosch@idosch.org> wrote:
> On Mon, Apr 26, 2021 at 07:04:04PM +0200, Tobias Waldekranz wrote:
>> - skb->cb->offload_fwd_mark becomes skb->cb->src_hwdom. There is a
>>   slight change here: Whereas previously this was only set for
>>   offloaded packets, we now always track the incoming hwdom. As all
>>   uses where already gated behind checks of skb->offload_fwd_mark,
>>   this will not introduce any functional change, but it paves the way
>>   for future changes where the ingressing hwdom must be known both for
>>   offloaded and non-offloaded frames.
>
> [...]
>
>> @@ -43,15 +43,15 @@ int nbp_switchdev_mark_set(struct net_bridge_port *p)
>>  void nbp_switchdev_frame_mark(const struct net_bridge_port *p,
>>  			      struct sk_buff *skb)
>>  {
>> -	if (skb->offload_fwd_mark && !WARN_ON_ONCE(!p->offload_fwd_mark))
>> -		BR_INPUT_SKB_CB(skb)->offload_fwd_mark = p->offload_fwd_mark;
>> +	if (p->hwdom)
>> +		BR_INPUT_SKB_CB(skb)->src_hwdom = p->hwdom;
>>  }
>
> I assume you are referring to this change? "src_hwdom" sounds weird if
> it's expected to be valid for non-offloaded frames.

Perhaps "non-offloaded" was a sloppy description on my part. I was
trying to describe frames that originate from a switchdev, but have not
been forwarded by hardware; e.g. STP BPDUs, IGMP reports, etc. So
nbp_switchdev_frame_mark now basically says: "If this skb came in from a
switchdev, make sure to note which one".

> Can you elaborate about "future changes where the ingressing hwdom must
> be known both for offloaded and non-offloaded frames"?

Typical example: The switchdev has a fixed configuration to trap STP
BPDUs, but STP is not running on the bridge and the group_fwd_mask
allows them to be forwarded. Say we have this setup:

      br0
    /  |  \
swp0 swp1 swp2

A BPDU comes in on swp0 and is trapped to the CPU; the driver does not
set skb->offload_fwd_mark. The bridge determines that the frame should
be forwarded to swp{1,2}. It is imperative that forward offloading is
_not_ allowed in this case, as the source hwdom is already "poisoned".

Recording the source hwdom allows this case to be handled properly.

> Probably best to split this change to a different patch given the rest
> of the changes are mechanical.

Right, but I think the change in name to warrants a change in
semantics. It is being renamed to src_hwdom because it now holds just
that information. Again, there is no functional change introduced by
this since nbp_switchdev_allowed_egress always checks for the presence
of skb->offload_fwd_mark anyway. But if you feel strongly about it, I
will split it up.

>>  
>>  bool nbp_switchdev_allowed_egress(const struct net_bridge_port *p,
>>  				  const struct sk_buff *skb)
>>  {
>>  	return !skb->offload_fwd_mark ||
>> -	       BR_INPUT_SKB_CB(skb)->offload_fwd_mark != p->offload_fwd_mark;
>> +	       BR_INPUT_SKB_CB(skb)->src_hwdom != p->hwdom;
>>  }
>>  
>>  /* Flags that can be offloaded to hardware */
>> -- 
>> 2.25.1
>> 

  reply	other threads:[~2021-05-03  8:49 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-26 17:04 [Bridge] [RFC net-next 0/9] net: bridge: Forward offloading Tobias Waldekranz
2021-04-26 17:04 ` Tobias Waldekranz
2021-04-26 17:04 ` [Bridge] [RFC net-next 1/9] net: dfwd: Constrain existing users to macvlan subordinates Tobias Waldekranz
2021-04-26 17:04   ` Tobias Waldekranz
2021-04-26 17:04 ` [Bridge] [RFC net-next 2/9] net: bridge: Disambiguate offload_fwd_mark Tobias Waldekranz
2021-04-26 17:04   ` Tobias Waldekranz
2021-05-02 15:00   ` [Bridge] " Ido Schimmel
2021-05-02 15:00     ` Ido Schimmel
2021-05-03  8:49     ` Tobias Waldekranz [this message]
2021-05-03  8:49       ` Tobias Waldekranz
2021-05-05  7:39       ` [Bridge] " Ido Schimmel
2021-05-05  7:39         ` Ido Schimmel
2021-04-26 17:04 ` [Bridge] [RFC net-next 3/9] net: bridge: switchdev: Recycle unused hwdoms Tobias Waldekranz
2021-04-26 17:04   ` Tobias Waldekranz
2021-04-27 10:42   ` [Bridge] " Nikolay Aleksandrov
2021-04-27 10:42     ` Nikolay Aleksandrov
2021-04-26 17:04 ` [Bridge] [RFC net-next 4/9] net: bridge: switchdev: Forward offloading Tobias Waldekranz
2021-04-26 17:04   ` Tobias Waldekranz
2021-04-27 10:35   ` [Bridge] " Nikolay Aleksandrov
2021-04-27 10:35     ` Nikolay Aleksandrov
2021-04-28 22:47     ` [Bridge] " Tobias Waldekranz
2021-04-28 22:47       ` Tobias Waldekranz
2021-04-29  9:16       ` [Bridge] " Nikolay Aleksandrov
2021-04-29  9:16         ` Nikolay Aleksandrov
2021-04-29 14:55         ` [Bridge] " Tobias Waldekranz
2021-04-29 14:55           ` Tobias Waldekranz
2021-05-02 15:04   ` [Bridge] " Ido Schimmel
2021-05-02 15:04     ` Ido Schimmel
2021-05-03  8:53     ` [Bridge] " Tobias Waldekranz
2021-05-03  8:53       ` Tobias Waldekranz
2021-05-06 11:01       ` [Bridge] " Vladimir Oltean
2021-05-06 11:01         ` Vladimir Oltean
2021-04-26 17:04 ` [Bridge] [RFC net-next 5/9] net: dsa: Track port PVIDs Tobias Waldekranz
2021-04-26 17:04   ` Tobias Waldekranz
2021-04-26 19:40   ` [Bridge] " Vladimir Oltean
2021-04-26 19:40     ` Vladimir Oltean
2021-04-26 20:05     ` [Bridge] " Tobias Waldekranz
2021-04-26 20:05       ` Tobias Waldekranz
2021-04-26 20:28       ` [Bridge] " Vladimir Oltean
2021-04-26 20:28         ` Vladimir Oltean
2021-04-27  9:12         ` [Bridge] " Tobias Waldekranz
2021-04-27  9:12           ` Tobias Waldekranz
2021-04-27  9:27           ` [Bridge] " Vladimir Oltean
2021-04-27  9:27             ` Vladimir Oltean
2021-04-27 10:07           ` [Bridge] " Vladimir Oltean
2021-04-27 10:07             ` Vladimir Oltean
2021-04-28 23:10             ` [Bridge] " Tobias Waldekranz
2021-04-28 23:10               ` Tobias Waldekranz
2021-04-26 17:04 ` [Bridge] [RFC net-next 6/9] net: dsa: Forward offloading Tobias Waldekranz
2021-04-26 17:04   ` Tobias Waldekranz
2021-04-27 10:17   ` [Bridge] " Vladimir Oltean
2021-04-27 10:17     ` Vladimir Oltean
2021-05-04 14:44     ` [Bridge] " Tobias Waldekranz
2021-05-04 14:44       ` Tobias Waldekranz
2021-05-04 15:21       ` [Bridge] " Vladimir Oltean
2021-05-04 15:21         ` Vladimir Oltean
2021-05-04 20:07         ` [Bridge] " Tobias Waldekranz
2021-05-04 20:07           ` Tobias Waldekranz
2021-05-04 20:33           ` [Bridge] " Andrew Lunn
2021-05-04 20:33             ` Andrew Lunn
2021-05-04 21:24             ` [Bridge] " Tobias Waldekranz
2021-05-04 21:24               ` Tobias Waldekranz
2021-05-04 20:58           ` [Bridge] " Vladimir Oltean
2021-05-04 20:58             ` Vladimir Oltean
2021-05-04 22:12             ` [Bridge] " Tobias Waldekranz
2021-05-04 22:12               ` Tobias Waldekranz
2021-05-04 23:04               ` [Bridge] " Vladimir Oltean
2021-05-04 23:04                 ` Vladimir Oltean
2021-05-05  9:01                 ` [Bridge] " Tobias Waldekranz
2021-05-05  9:01                   ` Tobias Waldekranz
2021-05-05 16:12                   ` [Bridge] " Vladimir Oltean
2021-05-05 16:12                     ` Vladimir Oltean
2021-04-26 17:04 ` [Bridge] [RFC net-next 7/9] net: dsa: mv88e6xxx: Allocate a virtual DSA port for each bridge Tobias Waldekranz
2021-04-26 17:04   ` Tobias Waldekranz
2021-04-26 17:04 ` [Bridge] [RFC net-next 8/9] net: dsa: mv88e6xxx: Map virtual bridge port in PVT Tobias Waldekranz
2021-04-26 17:04   ` Tobias Waldekranz
2021-04-26 17:04 ` [Bridge] [RFC net-next 9/9] net: dsa: mv88e6xxx: Forward offloading Tobias Waldekranz
2021-04-26 17:04   ` Tobias Waldekranz
2021-04-27  1:31   ` kernel test robot
2021-05-02 14:58 ` [Bridge] [RFC net-next 0/9] net: bridge: " Ido Schimmel
2021-05-02 14:58   ` Ido Schimmel
2021-05-03  9:44   ` [Bridge] " Tobias Waldekranz
2021-05-03  9:44     ` Tobias Waldekranz
2021-05-06 10:59     ` [Bridge] " Vladimir Oltean
2021-05-06 10:59       ` Vladimir Oltean

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=87h7jknqwn.fsf@waldekranz.com \
    --to=tobias@waldekranz.com \
    --cc=andrew@lunn.ch \
    --cc=bridge@lists.linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=idosch@idosch.org \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@nvidia.com \
    --cc=olteanv@gmail.com \
    --cc=roopa@nvidia.com \
    --cc=vivien.didelot@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.