netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Tobias Waldekranz <tobias@waldekranz.com>
Cc: davem@davemloft.net, kuba@kernel.org, andrew@lunn.ch,
	vivien.didelot@gmail.com, f.fainelli@gmail.com, roopa@nvidia.com,
	nikolay@nvidia.com, jiri@resnulli.us, idosch@idosch.org,
	stephen@networkplumber.org, netdev@vger.kernel.org,
	bridge@lists.linux-foundation.org
Subject: Re: [RFC net-next 6/9] net: dsa: Forward offloading
Date: Tue, 4 May 2021 18:21:06 +0300	[thread overview]
Message-ID: <20210504152106.oppawchuruapg4sb@skbuf> (raw)
In-Reply-To: <878s4uo8xc.fsf@waldekranz.com>

On Tue, May 04, 2021 at 04:44:31PM +0200, Tobias Waldekranz wrote:
> On Tue, Apr 27, 2021 at 13:17, Vladimir Oltean <olteanv@gmail.com> wrote:
> > On Mon, Apr 26, 2021 at 07:04:08PM +0200, Tobias Waldekranz wrote:
> >> Allow DSA drivers to support forward offloading from a bridge by:
> >> 
> >> - Passing calls to .ndo_dfwd_{add,del}_station to the drivers.
> >> 
> >> - Recording the subordinate device of offloaded skbs in the control
> >>   buffer so that the tagger can take the appropriate action.
> >> 
> >> Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
> >> ---
> >>  include/net/dsa.h |  7 +++++++
> >>  net/dsa/slave.c   | 36 ++++++++++++++++++++++++++++++++++--
> >>  2 files changed, 41 insertions(+), 2 deletions(-)
> >> 
> >> diff --git a/include/net/dsa.h b/include/net/dsa.h
> >> index 1f9ba9889034..77d4df819299 100644
> >> --- a/include/net/dsa.h
> >> +++ b/include/net/dsa.h
> >> @@ -119,6 +119,7 @@ struct dsa_netdevice_ops {
> >>  
> >>  struct dsa_skb_cb {
> >>  	struct sk_buff *clone;
> >> +	struct net_device *sb_dev;
> >>  };
> >>  
> >>  struct __dsa_skb_cb {
> >> @@ -828,6 +829,12 @@ struct dsa_switch_ops {
> >>  					  const struct switchdev_obj_ring_role_mrp *mrp);
> >>  	int	(*port_mrp_del_ring_role)(struct dsa_switch *ds, int port,
> >>  					  const struct switchdev_obj_ring_role_mrp *mrp);
> >> +
> >> +	/* L2 forward offloading */
> >> +	void *	(*dfwd_add_station)(struct dsa_switch *ds, int port,
> >> +				    struct net_device *sb_dev);
> >> +	void	(*dfwd_del_station)(struct dsa_switch *ds, int port,
> >> +				    struct net_device *sb_dev);
> >>  };
> >>  
> >>  #define DSA_DEVLINK_PARAM_DRIVER(_id, _name, _type, _cmodes)		\
> >> diff --git a/net/dsa/slave.c b/net/dsa/slave.c
> >> index 77b33bd161b8..3689ffa2dbb8 100644
> >> --- a/net/dsa/slave.c
> >> +++ b/net/dsa/slave.c
> >> @@ -657,6 +657,13 @@ static netdev_tx_t dsa_slave_xmit(struct sk_buff *skb, struct net_device *dev)
> >>  	return dsa_enqueue_skb(nskb, dev);
> >>  }
> >>  
> >> +static u16 dsa_slave_select_queue(struct net_device *dev, struct sk_buff *skb,
> >> +				  struct net_device *sb_dev)
> >> +{
> >> +	DSA_SKB_CB(skb)->sb_dev = sb_dev;
> >> +	return netdev_pick_tx(dev, skb, sb_dev);
> >> +}
> >> +
> >
> > DSA_SKB_CB is going away:
> > https://patchwork.kernel.org/project/netdevbpf/patch/20210427042203.26258-5-yangbo.lu@nxp.com/
> >
> > Let's either negotiate with Yangbo on keeping it, or make
> > .ndo_select_queue a bypass towards the tagger, where it can use its own
> > SKB_CB structure and be more flexible in general (I think I'm leaning
> > towards the latter).
> 
> Thus far, Yangbo is a tough negotiator, giving me the silent treatment:
> 
> https://lore.kernel.org/netdev/87y2d2noe5.fsf@waldekranz.com/
> 
> :)
> 
> That memset is giving me a hard time. I have just disabled it on my
> branch at the moment. Any ideas on how to get rid of it without breaking
> timestamping?

:)

Is there any guarantee written somewhere that the ownership of skb->cb
belongs to the NIC driver at the time of the ndo_select_queue call?

If there is, then the trivial solution is to just move the memset in
ndo_select_queue.

If there isn't, then we've got bigger issues (such as, for example, the
qdisc layer being able to overwrite your DSA_SKB_CB(skb)->sb_dev).

  reply	other threads:[~2021-05-04 15:21 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-26 17:04 [RFC net-next 0/9] net: bridge: Forward offloading Tobias Waldekranz
2021-04-26 17:04 ` [RFC net-next 1/9] net: dfwd: Constrain existing users to macvlan subordinates Tobias Waldekranz
2021-04-26 17:04 ` [RFC net-next 2/9] net: bridge: Disambiguate offload_fwd_mark Tobias Waldekranz
2021-05-02 15:00   ` Ido Schimmel
2021-05-03  8:49     ` Tobias Waldekranz
2021-05-05  7:39       ` Ido Schimmel
2021-04-26 17:04 ` [RFC net-next 3/9] net: bridge: switchdev: Recycle unused hwdoms Tobias Waldekranz
2021-04-27 10:42   ` Nikolay Aleksandrov
2021-04-26 17:04 ` [RFC net-next 4/9] net: bridge: switchdev: Forward offloading Tobias Waldekranz
2021-04-27 10:35   ` Nikolay Aleksandrov
2021-04-28 22:47     ` Tobias Waldekranz
2021-04-29  9:16       ` Nikolay Aleksandrov
2021-04-29 14:55         ` Tobias Waldekranz
2021-05-02 15:04   ` Ido Schimmel
2021-05-03  8:53     ` Tobias Waldekranz
2021-05-06 11:01       ` Vladimir Oltean
2021-04-26 17:04 ` [RFC net-next 5/9] net: dsa: Track port PVIDs Tobias Waldekranz
2021-04-26 19:40   ` Vladimir Oltean
2021-04-26 20:05     ` Tobias Waldekranz
2021-04-26 20:28       ` Vladimir Oltean
2021-04-27  9:12         ` Tobias Waldekranz
2021-04-27  9:27           ` Vladimir Oltean
2021-04-27 10:07           ` Vladimir Oltean
2021-04-28 23:10             ` Tobias Waldekranz
2021-04-26 17:04 ` [RFC net-next 6/9] net: dsa: Forward offloading Tobias Waldekranz
2021-04-27 10:17   ` Vladimir Oltean
2021-05-04 14:44     ` Tobias Waldekranz
2021-05-04 15:21       ` Vladimir Oltean [this message]
2021-05-04 20:07         ` Tobias Waldekranz
2021-05-04 20:33           ` Andrew Lunn
2021-05-04 21:24             ` Tobias Waldekranz
2021-05-04 20:58           ` Vladimir Oltean
2021-05-04 22:12             ` Tobias Waldekranz
2021-05-04 23:04               ` Vladimir Oltean
2021-05-05  9:01                 ` Tobias Waldekranz
2021-05-05 16:12                   ` Vladimir Oltean
2021-04-26 17:04 ` [RFC net-next 7/9] net: dsa: mv88e6xxx: Allocate a virtual DSA port for each bridge Tobias Waldekranz
2021-04-26 17:04 ` [RFC net-next 8/9] net: dsa: mv88e6xxx: Map virtual bridge port in PVT Tobias Waldekranz
2021-04-26 17:04 ` [RFC net-next 9/9] net: dsa: mv88e6xxx: Forward offloading Tobias Waldekranz
2021-05-02 14:58 ` [RFC net-next 0/9] net: bridge: " Ido Schimmel
2021-05-03  9:44   ` Tobias Waldekranz
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=20210504152106.oppawchuruapg4sb@skbuf \
    --to=olteanv@gmail.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=roopa@nvidia.com \
    --cc=stephen@networkplumber.org \
    --cc=tobias@waldekranz.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).