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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1572957275-23383-11-git-send-email-ioana.ciornei@nxp.com>
Date:   Tue,  5 Nov 2019 14:34:33 +0200
From:   Ioana Ciornei <ioana.ciornei@....com>
To:     gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org
Cc:     andrew@...n.ch, f.fainelli@...il.com,
        Ioana Ciornei <ioana.ciornei@....com>
Subject: [PATCH 10/12] staging: dpaa2-ethsw: enable the CTRL_IF based on the FW version

Introduce a features bitmask in the dpaa2-ethsw driver that would be
populated based on the running version of MC firmware. The first and
only feature, at the moment, is the control traffic which is available
only when the DPSW object version is greater than 8.4.

Signed-off-by: Ioana Ciornei <ioana.ciornei@....com>
---
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 13 +++++++++++++
 drivers/staging/fsl-dpaa2/ethsw/ethsw.h | 11 +++++++++++
 2 files changed, 24 insertions(+)

diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index abe920f8a665..df9d81be242b 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -2111,6 +2111,14 @@ static int ethsw_ctrl_if_setup(struct ethsw_core *ethsw)
 	return err;
 }
 
+void dpaa2_ethsw_set_features(struct ethsw_core *ethsw,
+			      u16 major, u16 minor)
+{
+	if (major >= DPAA2_ETHSW_CTRL_IF_MIN_MAJOR &&
+	    minor >= DPAA2_ETHSW_CTRL_IF_MIN_MINOR)
+		ethsw->features |= DPAA2_ETHSW_CONTROL_TRAFFIC;
+}
+
 static int ethsw_init(struct fsl_mc_device *sw_dev)
 {
 	struct device *dev = &sw_dev->dev;
@@ -2154,6 +2162,11 @@ static int ethsw_init(struct fsl_mc_device *sw_dev)
 		goto err_close;
 	}
 
+	/* Compose the set of supported features by
+	 * the current firmware image
+	 */
+	dpaa2_ethsw_set_features(ethsw, version_major, version_minor);
+
 	err = dpsw_reset(ethsw->mc_io, 0, ethsw->dpsw_handle);
 	if (err) {
 		dev_err(dev, "dpsw_reset err %d\n", err);
diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.h b/drivers/staging/fsl-dpaa2/ethsw/ethsw.h
index 747a4e15d28a..d880a3321e14 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.h
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.h
@@ -116,6 +116,13 @@ struct ethsw_port_priv {
 	u16			tx_qdid;
 };
 
+#define DPAA2_ETHSW_CTRL_IF_MIN_MAJOR 8
+#define DPAA2_ETHSW_CTRL_IF_MIN_MINOR 4
+
+enum dpaa2_ethsw_features {
+	DPAA2_ETHSW_CONTROL_TRAFFIC = BIT(0),
+};
+
 /* Switch data */
 struct ethsw_core {
 	struct device			*dev;
@@ -125,6 +132,7 @@ struct ethsw_core {
 	int				dev_id;
 	struct ethsw_port_priv		**ports;
 	struct iommu_domain		*iommu_domain;
+	int				features;
 
 	u8				vlans[VLAN_VID_MASK + 1];
 	bool				learning;
@@ -138,6 +146,9 @@ struct ethsw_core {
 
 static inline bool ethsw_has_ctrl_if(struct ethsw_core *ethsw)
 {
+	if (!ethsw->features & DPAA2_ETHSW_CONTROL_TRAFFIC)
+		return false;
+
 	return !(ethsw->sw_attr.options & DPSW_OPT_CTRL_IF_DIS);
 }
 #endif	/* __ETHSW_H */
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ