All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] Add DSA callback to traffic control information
@ 2022-04-11 13:11 Erez Geva
  2022-04-11 13:11 ` [PATCH 1/1] DSA Add " Erez Geva
  0 siblings, 1 reply; 12+ messages in thread
From: Erez Geva @ 2022-04-11 13:11 UTC (permalink / raw)
  To: netdev, Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean
  Cc: Simon Sudler, Andreas Meisinger, Henning Schild, Jan Kiszka, Erez Geva

Add a new callback function to DSA switch,
 so a tag driver could fetch traffic control information.

For example, if the switch enabel ETF,
 the tag driver would need to insert the transmit time stamp into the tag.

* P.S.
In "Documentation/networking/dsa (master)$ retext dsa.rst",
 under "Driver development".
I did not find any text regarding traffic control callbacks.

Erez Geva (1):
  DSA Add callback to traffic control information

 include/net/dsa.h  |  2 ++
 net/dsa/dsa_priv.h |  1 +
 net/dsa/slave.c    | 17 +++++++++++++++++
 3 files changed, 20 insertions(+)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/1] DSA Add callback to traffic control information
  2022-04-11 13:11 [PATCH 0/1] Add DSA callback to traffic control information Erez Geva
@ 2022-04-11 13:11 ` Erez Geva
  2022-04-11 13:29   ` Andrew Lunn
  2022-04-11 13:29   ` Vladimir Oltean
  0 siblings, 2 replies; 12+ messages in thread
From: Erez Geva @ 2022-04-11 13:11 UTC (permalink / raw)
  To: netdev, Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean
  Cc: Simon Sudler, Andreas Meisinger, Henning Schild, Jan Kiszka, Erez Geva

Provide a callback for the DSA tag driver
 to fetch information regarding a traffic control.

Signed-off-by: Erez Geva <erez.geva.ext@siemens.com>
---
 include/net/dsa.h  |  2 ++
 net/dsa/dsa_priv.h |  1 +
 net/dsa/slave.c    | 17 +++++++++++++++++
 3 files changed, 20 insertions(+)

diff --git a/include/net/dsa.h b/include/net/dsa.h
index 934958fda962..ab8f0988bcfc 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -1036,6 +1036,8 @@ struct dsa_switch_ops {
 	void	(*port_policer_del)(struct dsa_switch *ds, int port);
 	int	(*port_setup_tc)(struct dsa_switch *ds, int port,
 				 enum tc_setup_type type, void *type_data);
+	int	(*port_fetch_tc)(struct dsa_switch *ds, int port,
+				 enum tc_setup_type type, void *type_data);
 
 	/*
 	 * Cross-chip operations
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index 5d3f4a67dce1..d03c23680a50 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -320,6 +320,7 @@ void dsa_slave_setup_tagger(struct net_device *slave);
 int dsa_slave_change_mtu(struct net_device *dev, int new_mtu);
 int dsa_slave_manage_vlan_filtering(struct net_device *dev,
 				    bool vlan_filtering);
+int dsa_slave_fetch_tc(struct net_device *dev, enum tc_setup_type type, void *type_data);
 
 static inline struct dsa_port *dsa_slave_to_port(const struct net_device *dev)
 {
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 41c69a6e7854..0db7b99b06f9 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -1535,6 +1535,23 @@ static int dsa_slave_setup_tc(struct net_device *dev, enum tc_setup_type type,
 	return ds->ops->port_setup_tc(ds, dp->index, type, type_data);
 }
 
+/* Allow TAG driver to retrieve TC information from a DSA switch driver.
+ * Some TC require the TAG driver to pass information from the SKB into the TAG
+ * depending on the TC configuratin set used with port_setup_tc() callback.
+ * Though only the driver can know the proper value.
+ */
+int dsa_slave_fetch_tc(struct net_device *dev, enum tc_setup_type type, void *type_data)
+{
+	struct dsa_port *dp = dsa_slave_to_port(dev);
+	struct dsa_switch *ds = dp->ds;
+
+	if (!ds->ops->port_fetch_tc)
+		return -EOPNOTSUPP;
+
+	return ds->ops->port_fetch_tc(ds, dp->index, type, type_data);
+}
+EXPORT_SYMBOL_GPL(dsa_slave_fetch_tc);
+
 static int dsa_slave_get_rxnfc(struct net_device *dev,
 			       struct ethtool_rxnfc *nfc, u32 *rule_locs)
 {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/1] DSA Add callback to traffic control information
  2022-04-11 13:11 ` [PATCH 1/1] DSA Add " Erez Geva
@ 2022-04-11 13:29   ` Andrew Lunn
  2022-04-11 14:17     ` Geva, Erez
  2022-04-11 13:29   ` Vladimir Oltean
  1 sibling, 1 reply; 12+ messages in thread
From: Andrew Lunn @ 2022-04-11 13:29 UTC (permalink / raw)
  To: Erez Geva
  Cc: netdev, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	Simon Sudler, Andreas Meisinger, Henning Schild, Jan Kiszka

On Mon, Apr 11, 2022 at 03:11:48PM +0200, Erez Geva wrote:
> Provide a callback for the DSA tag driver
>  to fetch information regarding a traffic control.

Hi Erez

When you add a new API you also need to add a user of it. Please
include your tag driver change in the patchset.

	Andrew

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/1] DSA Add callback to traffic control information
  2022-04-11 13:11 ` [PATCH 1/1] DSA Add " Erez Geva
  2022-04-11 13:29   ` Andrew Lunn
@ 2022-04-11 13:29   ` Vladimir Oltean
  2022-04-11 14:23     ` Geva, Erez
  1 sibling, 1 reply; 12+ messages in thread
From: Vladimir Oltean @ 2022-04-11 13:29 UTC (permalink / raw)
  To: Erez Geva
  Cc: netdev, Andrew Lunn, Vivien Didelot, Florian Fainelli,
	Simon Sudler, Andreas Meisinger, Henning Schild, Jan Kiszka

On Mon, Apr 11, 2022 at 03:11:48PM +0200, Erez Geva wrote:
> Provide a callback for the DSA tag driver
>  to fetch information regarding a traffic control.
> 
> Signed-off-by: Erez Geva <erez.geva.ext@siemens.com>
> ---

This is all? Can you show us some users?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH 1/1] DSA Add callback to traffic control information
  2022-04-11 13:29   ` Andrew Lunn
@ 2022-04-11 14:17     ` Geva, Erez
  2022-04-11 14:25       ` Andrew Lunn
  0 siblings, 1 reply; 12+ messages in thread
From: Geva, Erez @ 2022-04-11 14:17 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: netdev, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	Sudler, Simon, Meisinger, Andreas, Schild, Henning, jan.kiszka

The Tag driver code in not by me.
So I can not publish it, only the owner may.

Erez

-----Original Message-----
From: Andrew Lunn <andrew@lunn.ch> 
Sent: Monday, 11 April 2022 15:29
To: Geva, Erez (ext) (DI PA DCP R&D 3) <erez.geva.ext@siemens.com>
Cc: netdev@vger.kernel.org; Vivien Didelot <vivien.didelot@gmail.com>; Florian Fainelli <f.fainelli@gmail.com>; Vladimir Oltean <olteanv@gmail.com>; Sudler, Simon (DI PA DCP TI) <simon.sudler@siemens.com>; Meisinger, Andreas (DI PA DCP TI) <andreas.meisinger@siemens.com>; Schild, Henning (T CED SES-DE) <henning.schild@siemens.com>; Kiszka, Jan (T CED) <jan.kiszka@siemens.com>
Subject: Re: [PATCH 1/1] DSA Add callback to traffic control information

On Mon, Apr 11, 2022 at 03:11:48PM +0200, Erez Geva wrote:
> Provide a callback for the DSA tag driver  to fetch information 
> regarding a traffic control.

Hi Erez

When you add a new API you also need to add a user of it. Please include your tag driver change in the patchset.

	Andrew

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH 1/1] DSA Add callback to traffic control information
  2022-04-11 13:29   ` Vladimir Oltean
@ 2022-04-11 14:23     ` Geva, Erez
  2022-04-11 14:43       ` Vladimir Oltean
  0 siblings, 1 reply; 12+ messages in thread
From: Geva, Erez @ 2022-04-11 14:23 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: netdev, Andrew Lunn, Vivien Didelot, Florian Fainelli, Sudler,
	Simon, Meisinger, Andreas, Schild, Henning, jan.kiszka

As I mention, I do not own the tag driver code.

But for example for ETF, is like:

... tag_xmit(struct sk_buff *skb, struct net_device *dev)
+       struct tc_etf_qopt_offload etf;
...
+       etf.queue = skb_get_queue_mapping(skb);
+       if (dsa_slave_fetch_tc(dev, TC_SETUP_QDISC_ETF, &etf) == 0 && etf.enable) {
...

The port_fetch_tc callback is similar to port_setup_tc, only it reads the configuration instead of setting it.

I think it is easier to add a generic call back, so we do not need to add a new callback each time we support a new TC.

Erez



-----Original Message-----
From: Vladimir Oltean <olteanv@gmail.com> 
Sent: Monday, 11 April 2022 15:30
To: Geva, Erez (ext) (DI PA DCP R&D 3) <erez.geva.ext@siemens.com>
Cc: netdev@vger.kernel.org; Andrew Lunn <andrew@lunn.ch>; Vivien Didelot <vivien.didelot@gmail.com>; Florian Fainelli <f.fainelli@gmail.com>; Sudler, Simon (DI PA DCP TI) <simon.sudler@siemens.com>; Meisinger, Andreas (DI PA DCP TI) <andreas.meisinger@siemens.com>; Schild, Henning (T CED SES-DE) <henning.schild@siemens.com>; Kiszka, Jan (T CED) <jan.kiszka@siemens.com>
Subject: Re: [PATCH 1/1] DSA Add callback to traffic control information

On Mon, Apr 11, 2022 at 03:11:48PM +0200, Erez Geva wrote:
> Provide a callback for the DSA tag driver  to fetch information 
> regarding a traffic control.
> 
> Signed-off-by: Erez Geva <erez.geva.ext@siemens.com>
> ---

This is all? Can you show us some users?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/1] DSA Add callback to traffic control information
  2022-04-11 14:17     ` Geva, Erez
@ 2022-04-11 14:25       ` Andrew Lunn
  2022-04-11 14:29         ` Geva, Erez
  0 siblings, 1 reply; 12+ messages in thread
From: Andrew Lunn @ 2022-04-11 14:25 UTC (permalink / raw)
  To: Geva, Erez
  Cc: netdev, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	Sudler, Simon, Meisinger, Andreas, Schild, Henning, jan.kiszka

On Mon, Apr 11, 2022 at 02:17:44PM +0000, Geva, Erez wrote:
> The Tag driver code in not by me.
> So I can not publish it, only the owner may.

If the code is licensed GPL, and you can fulfil the requirements of
adding a Signed-off-by: you can submit it.

However until there is a user of this, sorry, this patch will not be
accepted.

     Andrew

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH 1/1] DSA Add callback to traffic control information
  2022-04-11 14:25       ` Andrew Lunn
@ 2022-04-11 14:29         ` Geva, Erez
  2022-04-11 14:48           ` Andrew Lunn
  0 siblings, 1 reply; 12+ messages in thread
From: Geva, Erez @ 2022-04-11 14:29 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: netdev, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	Sudler, Simon, Meisinger, Andreas, Schild, Henning, jan.kiszka

Although the code is GPL, as the code comes with Hardware,
And the Hardware belong to a third party ...

I understand the reason for users. But like ant rule. It should be used properly.

This patch is really small and could solve many future TC issues.

The current state of many TC callbacks does not make sense.
May be it is time to do some cleaning?

Just hope a light the way.

Erez

-----Original Message-----
From: Andrew Lunn <andrew@lunn.ch> 
Sent: Monday, 11 April 2022 16:26
To: Geva, Erez (ext) (DI PA DCP R&D 3) <erez.geva.ext@siemens.com>
Cc: netdev@vger.kernel.org; Vivien Didelot <vivien.didelot@gmail.com>; Florian Fainelli <f.fainelli@gmail.com>; Vladimir Oltean <olteanv@gmail.com>; Sudler, Simon (DI PA DCP TI) <simon.sudler@siemens.com>; Meisinger, Andreas (DI PA DCP TI) <andreas.meisinger@siemens.com>; Schild, Henning (T CED SES-DE) <henning.schild@siemens.com>; Kiszka, Jan (T CED) <jan.kiszka@siemens.com>
Subject: Re: [PATCH 1/1] DSA Add callback to traffic control information

On Mon, Apr 11, 2022 at 02:17:44PM +0000, Geva, Erez wrote:
> The Tag driver code in not by me.
> So I can not publish it, only the owner may.

If the code is licensed GPL, and you can fulfil the requirements of adding a Signed-off-by: you can submit it.

However until there is a user of this, sorry, this patch will not be accepted.

     Andrew

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/1] DSA Add callback to traffic control information
  2022-04-11 14:23     ` Geva, Erez
@ 2022-04-11 14:43       ` Vladimir Oltean
  2022-04-11 14:49         ` Geva, Erez
  2022-04-11 14:57         ` Geva, Erez
  0 siblings, 2 replies; 12+ messages in thread
From: Vladimir Oltean @ 2022-04-11 14:43 UTC (permalink / raw)
  To: Geva, Erez
  Cc: netdev, Andrew Lunn, Vivien Didelot, Florian Fainelli, Sudler,
	Simon, Meisinger, Andreas, Schild, Henning, jan.kiszka

On Mon, Apr 11, 2022 at 02:23:59PM +0000, Geva, Erez wrote:
> As I mention, I do not own the tag driver code.
> 
> But for example for ETF, is like:
> 
> ... tag_xmit(struct sk_buff *skb, struct net_device *dev)
> +       struct tc_etf_qopt_offload etf;
> ...
> +       etf.queue = skb_get_queue_mapping(skb);
> +       if (dsa_slave_fetch_tc(dev, TC_SETUP_QDISC_ETF, &etf) == 0 && etf.enable) {
> ...
> 
> The port_fetch_tc callback is similar to port_setup_tc, only it reads the configuration instead of setting it.
> 
> I think it is easier to add a generic call back, so we do not need to add a new callback each time we support a new TC.
> 
> Erez

Since kernel v5.17 there exists struct dsa_device_ops :: connect() which
allows tagging protocol drivers to store persistent data for each switch.
Switch drivers also have a struct dsa_switch_ops :: connect_tag_protocol()
through which they can fix up or populate stuff in the tagging protocol
driver's private storage.
What you could do is set up something lockless, or even a function
pointer, to denote whether TX queue X is set up for ETF or not.

In any case, demanding that code with no in-kernel user gets accepted
will get a hard no, no matter how small it is.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/1] DSA Add callback to traffic control information
  2022-04-11 14:29         ` Geva, Erez
@ 2022-04-11 14:48           ` Andrew Lunn
  0 siblings, 0 replies; 12+ messages in thread
From: Andrew Lunn @ 2022-04-11 14:48 UTC (permalink / raw)
  To: Geva, Erez
  Cc: netdev, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	Sudler, Simon, Meisinger, Andreas, Schild, Henning, jan.kiszka

> The current state of many TC callbacks does not make sense.
> May be it is time to do some cleaning?

Feel free, and if that makes your new call useful, you can get it
merged that way.

Historically, we have tried to keep the taggers independent of the
switch driver. That is not always possible. But developers do combine
the loop DSA driver with any random tag drivers at times, so please be
careful with any cleanup to ensure you check for unexpected
combinations and -EOPNOTSUPP etc.

	Andrew

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH 1/1] DSA Add callback to traffic control information
  2022-04-11 14:43       ` Vladimir Oltean
@ 2022-04-11 14:49         ` Geva, Erez
  2022-04-11 14:57         ` Geva, Erez
  1 sibling, 0 replies; 12+ messages in thread
From: Geva, Erez @ 2022-04-11 14:49 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: netdev, Andrew Lunn, Vivien Didelot, Florian Fainelli, Sudler,
	Simon, Meisinger, Andreas, Schild, Henning, jan.kiszka



-----Original Message-----
From: Vladimir Oltean <olteanv@gmail.com> 
Sent: Monday, 11 April 2022 16:43
To: Geva, Erez (ext) (DI PA DCP R&D 3) <erez.geva.ext@siemens.com>
Cc: netdev@vger.kernel.org; Andrew Lunn <andrew@lunn.ch>; Vivien Didelot <vivien.didelot@gmail.com>; Florian Fainelli <f.fainelli@gmail.com>; Sudler, Simon (DI PA DCP TI) <simon.sudler@siemens.com>; Meisinger, Andreas (DI PA DCP TI) <andreas.meisinger@siemens.com>; Schild, Henning (T CED SES-DE) <henning.schild@siemens.com>; Kiszka, Jan (T CED) <jan.kiszka@siemens.com>
Subject: Re: [PATCH 1/1] DSA Add callback to traffic control information

On Mon, Apr 11, 2022 at 02:23:59PM +0000, Geva, Erez wrote:
> As I mention, I do not own the tag driver code.
> 
> But for example for ETF, is like:
> 
> ... tag_xmit(struct sk_buff *skb, struct net_device *dev)
> +       struct tc_etf_qopt_offload etf;
> ...
> +       etf.queue = skb_get_queue_mapping(skb);
> +       if (dsa_slave_fetch_tc(dev, TC_SETUP_QDISC_ETF, &etf) == 0 && 
> + etf.enable) {
> ...
> 
> The port_fetch_tc callback is similar to port_setup_tc, only it reads the configuration instead of setting it.
> 
> I think it is easier to add a generic call back, so we do not need to add a new callback each time we support a new TC.
> 
> Erez

Since kernel v5.17 there exists struct dsa_device_ops :: connect() which allows tagging protocol drivers to store persistent data for each switch.
Switch drivers also have a struct dsa_switch_ops :: connect_tag_protocol() through which they can fix up or populate stuff in the tagging protocol driver's private storage.
What you could do is set up something lockless, or even a function pointer, to denote whether TX queue X is set up for ETF or not.

In any case, demanding that code with no in-kernel user gets accepted will get a hard no, no matter how small it is.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH 1/1] DSA Add callback to traffic control information
  2022-04-11 14:43       ` Vladimir Oltean
  2022-04-11 14:49         ` Geva, Erez
@ 2022-04-11 14:57         ` Geva, Erez
  1 sibling, 0 replies; 12+ messages in thread
From: Geva, Erez @ 2022-04-11 14:57 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: netdev, Andrew Lunn, Vivien Didelot, Florian Fainelli, Sudler,
	Simon, Meisinger, Andreas, Schild, Henning, jan.kiszka

Thanks for the tip.

Thanks
  Erez

-----Original Message-----
From: Vladimir Oltean <olteanv@gmail.com> 
Sent: Monday, 11 April 2022 16:43
To: Geva, Erez (ext) (DI PA DCP R&D 3) <erez.geva.ext@siemens.com>
Cc: netdev@vger.kernel.org; Andrew Lunn <andrew@lunn.ch>; Vivien Didelot <vivien.didelot@gmail.com>; Florian Fainelli <f.fainelli@gmail.com>; Sudler, Simon (DI PA DCP TI) <simon.sudler@siemens.com>; Meisinger, Andreas (DI PA DCP TI) <andreas.meisinger@siemens.com>; Schild, Henning (T CED SES-DE) <henning.schild@siemens.com>; Kiszka, Jan (T CED) <jan.kiszka@siemens.com>
Subject: Re: [PATCH 1/1] DSA Add callback to traffic control information

On Mon, Apr 11, 2022 at 02:23:59PM +0000, Geva, Erez wrote:
> As I mention, I do not own the tag driver code.
> 
> But for example for ETF, is like:
> 
> ... tag_xmit(struct sk_buff *skb, struct net_device *dev)
> +       struct tc_etf_qopt_offload etf;
> ...
> +       etf.queue = skb_get_queue_mapping(skb);
> +       if (dsa_slave_fetch_tc(dev, TC_SETUP_QDISC_ETF, &etf) == 0 && 
> + etf.enable) {
> ...
> 
> The port_fetch_tc callback is similar to port_setup_tc, only it reads the configuration instead of setting it.
> 
> I think it is easier to add a generic call back, so we do not need to add a new callback each time we support a new TC.
> 
> Erez

Since kernel v5.17 there exists struct dsa_device_ops :: connect() which allows tagging protocol drivers to store persistent data for each switch.
Switch drivers also have a struct dsa_switch_ops :: connect_tag_protocol() through which they can fix up or populate stuff in the tagging protocol driver's private storage.
What you could do is set up something lockless, or even a function pointer, to denote whether TX queue X is set up for ETF or not.

In any case, demanding that code with no in-kernel user gets accepted will get a hard no, no matter how small it is.


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-04-11 14:57 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-11 13:11 [PATCH 0/1] Add DSA callback to traffic control information Erez Geva
2022-04-11 13:11 ` [PATCH 1/1] DSA Add " Erez Geva
2022-04-11 13:29   ` Andrew Lunn
2022-04-11 14:17     ` Geva, Erez
2022-04-11 14:25       ` Andrew Lunn
2022-04-11 14:29         ` Geva, Erez
2022-04-11 14:48           ` Andrew Lunn
2022-04-11 13:29   ` Vladimir Oltean
2022-04-11 14:23     ` Geva, Erez
2022-04-11 14:43       ` Vladimir Oltean
2022-04-11 14:49         ` Geva, Erez
2022-04-11 14:57         ` Geva, Erez

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.