lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220411131148.532520-2-erez.geva.ext@siemens.com>
Date:   Mon, 11 Apr 2022 15:11:48 +0200
From:   Erez Geva <erez.geva.ext@...mens.com>
To:     netdev@...r.kernel.org, Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        Vladimir Oltean <olteanv@...il.com>
Cc:     Simon Sudler <simon.sudler@...mens.com>,
        Andreas Meisinger <andreas.meisinger@...mens.com>,
        Henning Schild <henning.schild@...mens.com>,
        Jan Kiszka <jan.kiszka@...mens.com>,
        Erez Geva <erez.geva.ext@...mens.com>
Subject: [PATCH 1/1] DSA Add callback to traffic control information

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

Signed-off-by: Erez Geva <erez.geva.ext@...mens.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ