From: Kurt Kanzenbach <kurt.kanzenbach@linutronix.de>
To: Vladimir Oltean <olteanv@gmail.com>
Cc: f.fainelli@gmail.com, vivien.didelot@gmail.com, andrew@lunn.ch,
davem@davemloft.net, vinicius.gomes@intel.com,
vedang.patel@intel.com, richardcochran@gmail.com,
weifeng.voon@intel.com, jiri@mellanox.com, m-karicheri2@ti.com,
Jose.Abreu@synopsys.com, ilias.apalodimas@linaro.org,
jhs@mojatatu.com, xiyou.wangcong@gmail.com,
netdev@vger.kernel.org
Subject: Re: [RFC PATCH v2 net-next 10/15] net: dsa: Pass ndo_setup_tc slave callback to drivers
Date: Mon, 2 Sep 2019 09:52:09 +0200 [thread overview]
Message-ID: <20190902075209.GC3343@linutronix.de> (raw)
In-Reply-To: <20190830004635.24863-11-olteanv@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3694 bytes --]
Hi,
On Fri, Aug 30, 2019 at 03:46:30AM +0300, Vladimir Oltean wrote:
> DSA currently handles shared block filters (for the classifier-action
> qdisc) in the core due to what I believe are simply pragmatic reasons -
> hiding the complexity from drivers and offerring a simple API for port
> mirroring.
>
> Extend the dsa_slave_setup_tc function by passing all other qdisc
> offloads to the driver layer, where the driver may choose what it
> implements and how. DSA is simply a pass-through in this case.
I'm having the same problem on how to pass the taprio schedule down to
the DSA driver. I didn't perform a pass-through to keep it in sync with
the already implemented offload. See my approach below.
>
> There is an open question related to the drivers potentially needing to
> do work in process context, but .ndo_setup_tc is called in atomic
> context. At the moment the drivers are left to handle this on their own.
> The risk is that once accepting the offload callback right away in the
> DSA core, then the driver would have no way to signal an error back. So
> right now the driver has to do as much error checking as possible in the
> atomic context and only defer (probably) the actual configuring of the
> offload.
>
> Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
> ---
> include/net/dsa.h | 3 +++
> net/dsa/slave.c | 12 ++++++++----
> 2 files changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/include/net/dsa.h b/include/net/dsa.h
> index 96acb14ec1a8..232b5d36815d 100644
> --- a/include/net/dsa.h
> +++ b/include/net/dsa.h
> @@ -154,6 +154,7 @@ struct dsa_mall_tc_entry {
> };
> };
>
> +struct tc_taprio_qopt_offload;
Is this needed? The rest looks good to me.
My approach:
diff --git a/include/net/dsa.h b/include/net/dsa.h
index ba6dfff98196..a60bd55f27f2 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -20,6 +20,7 @@
#include <linux/platform_data/dsa.h>
#include <net/devlink.h>
#include <net/switchdev.h>
+#include <net/pkt_sched.h>
struct tc_action;
struct phy_device;
@@ -539,6 +540,13 @@ struct dsa_switch_ops {
*/
netdev_tx_t (*port_deferred_xmit)(struct dsa_switch *ds, int port,
struct sk_buff *skb);
+
+ /*
+ * Scheduled traffic functionality
+ */
+ int (*port_set_schedule)(struct dsa_switch *ds, int port,
+ const struct tc_taprio_qopt_offload *taprio);
+ int (*port_del_schedule)(struct dsa_switch *ds, int port);
};
struct dsa_switch_driver {
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 8157be7e162d..6290d55e6011 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -15,6 +15,7 @@
#include <linux/mdio.h>
#include <net/rtnetlink.h>
#include <net/pkt_cls.h>
+#include <net/pkt_sched.h>
#include <net/tc_act/tc_mirred.h>
#include <linux/if_bridge.h>
#include <linux/netpoll.h>
@@ -953,12 +954,33 @@ static int dsa_slave_setup_tc_block(struct net_device *dev,
}
}
+static int dsa_slave_setup_tc_taprio(struct net_device *dev,
+ const struct tc_taprio_qopt_offload *taprio)
+{
+ struct dsa_port *dp = dsa_slave_to_port(dev);
+ struct dsa_switch *ds = dp->ds;
+
+ if (taprio->enable) {
+ if (!ds->ops->port_set_schedule)
+ return -EOPNOTSUPP;
+
+ return ds->ops->port_set_schedule(ds, dp->index, taprio);
+ }
+
+ if (!ds->ops->port_del_schedule)
+ return -EOPNOTSUPP;
+
+ return ds->ops->port_del_schedule(ds, dp->index);
+}
+
static int dsa_slave_setup_tc(struct net_device *dev, enum tc_setup_type type,
void *type_data)
{
switch (type) {
case TC_SETUP_BLOCK:
return dsa_slave_setup_tc_block(dev, type_data);
+ case TC_SETUP_QDISC_TAPRIO:
+ return dsa_slave_setup_tc_taprio(dev, type_data);
default:
return -EOPNOTSUPP;
}
Thanks,
Kurt
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2019-09-02 7:52 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-30 0:46 [RFC PATCH v2 net-next 00/15] tc-taprio offload for SJA1105 DSA Vladimir Oltean
2019-08-30 0:46 ` [RFC PATCH v2 net-next 01/15] net: dsa: sja1105: Change the PTP command access pattern Vladimir Oltean
2019-08-30 0:46 ` [RFC PATCH v2 net-next 02/15] net: dsa: sja1105: Get rid of global declaration of struct ptp_clock_info Vladimir Oltean
2019-08-30 0:46 ` [RFC PATCH v2 net-next 03/15] net: dsa: sja1105: Switch to hardware operations for PTP Vladimir Oltean
2019-08-30 0:46 ` [RFC PATCH v2 net-next 04/15] net: dsa: sja1105: Implement the .gettimex64 system call " Vladimir Oltean
2019-08-30 0:46 ` [RFC PATCH v2 net-next 05/15] net: dsa: sja1105: Restore PTP time after switch reset Vladimir Oltean
2019-08-30 0:46 ` [RFC PATCH v2 net-next 06/15] net: dsa: sja1105: Disallow management xmit during " Vladimir Oltean
2019-08-30 0:46 ` [RFC PATCH v2 net-next 07/15] net: dsa: sja1105: Move PTP data to its own private structure Vladimir Oltean
2019-08-30 0:46 ` [RFC PATCH v2 net-next 08/15] net: dsa: sja1105: Advertise the 8 TX queues Vladimir Oltean
2019-08-30 0:46 ` [RFC PATCH v2 net-next 09/15] taprio: Add support for hardware offloading Vladimir Oltean
2019-08-30 0:46 ` [RFC PATCH v2 net-next 10/15] net: dsa: Pass ndo_setup_tc slave callback to drivers Vladimir Oltean
2019-09-02 7:52 ` Kurt Kanzenbach [this message]
2019-09-02 8:49 ` Vladimir Oltean
2019-09-04 7:31 ` Kurt Kanzenbach
2019-08-30 0:46 ` [RFC PATCH v2 net-next 11/15] net: dsa: sja1105: Add static config tables for scheduling Vladimir Oltean
2019-08-30 0:46 ` [RFC PATCH v2 net-next 12/15] net: dsa: sja1105: Configure the Time-Aware Scheduler via tc-taprio offload Vladimir Oltean
2019-08-30 0:46 ` [RFC PATCH v2 net-next 13/15] net: dsa: sja1105: Make HOSTPRIO a kernel config Vladimir Oltean
2019-08-30 0:46 ` [RFC PATCH v2 net-next 14/15] net: dsa: sja1105: Make the PTP command read-write Vladimir Oltean
2019-08-30 0:46 ` [RFC PATCH v2 net-next 15/15] net: dsa: sja1105: Implement state machine for TAS with PTP clock source Vladimir Oltean
2019-08-30 1:21 ` [RFC PATCH v2 net-next 00/15] tc-taprio offload for SJA1105 DSA Jakub Kicinski
2019-08-30 10:11 ` Vladimir Oltean
2019-08-30 22:28 ` Jakub Kicinski
2019-08-31 17:03 ` Vladimir Oltean
2019-08-31 19:41 ` Andrew Lunn
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=20190902075209.GC3343@linutronix.de \
--to=kurt.kanzenbach@linutronix.de \
--cc=Jose.Abreu@synopsys.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=ilias.apalodimas@linaro.org \
--cc=jhs@mojatatu.com \
--cc=jiri@mellanox.com \
--cc=m-karicheri2@ti.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=richardcochran@gmail.com \
--cc=vedang.patel@intel.com \
--cc=vinicius.gomes@intel.com \
--cc=vivien.didelot@gmail.com \
--cc=weifeng.voon@intel.com \
--cc=xiyou.wangcong@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).