tc-taprio is a qdisc based on the enhancements for scheduled traffic
specified in IEEE 802.1Qbv (later merged in 802.1Q).  This qdisc has
a software implementation and an optional offload through which
compatible Ethernet ports may configure their egress 802.1Qbv
schedulers.

Signed-off-by: Vladimir Oltean <olte...@gmail.com>
---
 include/net/dsa.h |  3 +++
 net/dsa/slave.c   | 14 ++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/include/net/dsa.h b/include/net/dsa.h
index 1e8650fa8acc..e7ee6ac8ce6b 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -152,6 +152,7 @@ struct dsa_mall_tc_entry {
        };
 };
 
+struct tc_taprio_qopt_offload;
 
 struct dsa_port {
        /* A CPU port is physically connected to a master device.
@@ -516,6 +517,8 @@ struct dsa_switch_ops {
                                   bool ingress);
        void    (*port_mirror_del)(struct dsa_switch *ds, int port,
                                   struct dsa_mall_mirror_tc_entry *mirror);
+       int     (*port_setup_taprio)(struct dsa_switch *ds, int port,
+                                    struct tc_taprio_qopt_offload *qopt);
 
        /*
         * Cross-chip operations
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 99673f6b07f6..2bae33788708 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -965,12 +965,26 @@ static int dsa_slave_setup_tc_block(struct net_device 
*dev,
        }
 }
 
+static int dsa_slave_setup_tc_taprio(struct net_device *dev,
+                                    struct tc_taprio_qopt_offload *f)
+{
+       struct dsa_port *dp = dsa_slave_to_port(dev);
+       struct dsa_switch *ds = dp->ds;
+
+       if (!ds->ops->port_setup_taprio)
+               return -EOPNOTSUPP;
+
+       return ds->ops->port_setup_taprio(ds, dp->index, f);
+}
+
 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;
        }
-- 
2.17.1

Reply via email to