linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] staging: fsl-dpaa2/ethsw: code cleanup
@ 2019-02-06 11:51 Ioana Ciornei
  2019-02-06 11:51 ` [PATCH 1/7] staging: fsl-dpaa2/ethsw: Fix setting port learning/flooding flags Ioana Ciornei
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Ioana Ciornei @ 2019-02-06 11:51 UTC (permalink / raw)
  To: gregkh; +Cc: Ioana Ciocoi Radulescu, linux-kernel, Ioana Ciornei

This patch set contains various small cleanup patches
for the DPAA2 ethsw driver.

Ioana Ciornei (1):
  staging: fsl-dpaa2/ethsw: Check notification relevance

Razvan Stefanescu (6):
  staging: fsl-dpaa2/ethsw: Fix setting port learning/flooding flags
  staging: fsl-dpaa2/ethsw: Add network interface statistics
  staging: fsl-dpaa2/ethsw: Remove netdevice on port probing error
  staging: fsl-dpaa2/ethsw: Add ndo_get_phys_port_name
  staging: fsl-dpaa2/ethsw: Add switch driver documentation
  staging: fsl-dpaa2/ethsw: Add comments to ETHSW_VLAN flags

 .../device_drivers/freescale/dpaa2/overview.rst    |  6 ++++
 MAINTAINERS                                        |  1 +
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c            | 42 ++++++++++++++++++----
 drivers/staging/fsl-dpaa2/ethsw/ethsw.h            |  4 +++
 4 files changed, 47 insertions(+), 6 deletions(-)

-- 
1.9.1


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

* [PATCH 1/7] staging: fsl-dpaa2/ethsw: Fix setting port learning/flooding flags
  2019-02-06 11:51 [PATCH 0/7] staging: fsl-dpaa2/ethsw: code cleanup Ioana Ciornei
@ 2019-02-06 11:51 ` Ioana Ciornei
  2019-02-06 11:52 ` [PATCH 3/7] staging: fsl-dpaa2/ethsw: Remove netdevice on port probing error Ioana Ciornei
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Ioana Ciornei @ 2019-02-06 11:51 UTC (permalink / raw)
  To: gregkh; +Cc: Ioana Ciocoi Radulescu, linux-kernel, Ioana Ciornei

From: Razvan Stefanescu <razvan.stefanescu@nxp.com>

ethsw_set_learning()/ethsw_set_flood() use flags parameter as an
enable/disable (1/0) indicator. Previous usage sent incorrect values.

Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index daabace..9463e05 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -676,11 +676,12 @@ static int port_attr_br_flags_set(struct net_device *netdev,
 		return 0;
 
 	/* Learning is enabled per switch */
-	err = ethsw_set_learning(port_priv->ethsw_data, flags & BR_LEARNING);
+	err = ethsw_set_learning(port_priv->ethsw_data,
+				 !!(flags & BR_LEARNING));
 	if (err)
 		goto exit;
 
-	err = ethsw_port_set_flood(port_priv, flags & BR_FLOOD);
+	err = ethsw_port_set_flood(port_priv, !!(flags & BR_FLOOD));
 
 exit:
 	return err;
-- 
1.9.1


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

* [PATCH 2/7] staging: fsl-dpaa2/ethsw: Add network interface statistics
  2019-02-06 11:51 [PATCH 0/7] staging: fsl-dpaa2/ethsw: code cleanup Ioana Ciornei
  2019-02-06 11:51 ` [PATCH 1/7] staging: fsl-dpaa2/ethsw: Fix setting port learning/flooding flags Ioana Ciornei
  2019-02-06 11:52 ` [PATCH 3/7] staging: fsl-dpaa2/ethsw: Remove netdevice on port probing error Ioana Ciornei
@ 2019-02-06 11:52 ` Ioana Ciornei
  2019-02-06 11:52 ` [PATCH 5/7] staging: fsl-dpaa2/ethsw: Add switch driver documentation Ioana Ciornei
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Ioana Ciornei @ 2019-02-06 11:52 UTC (permalink / raw)
  To: gregkh; +Cc: Ioana Ciocoi Radulescu, linux-kernel, Ioana Ciornei

From: Razvan Stefanescu <razvan.stefanescu@nxp.com>

Allocate MC portal with atomic context for I/O and enable network interface
statistics for hardware counters.

Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index 9463e05..d15d03b 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -510,6 +510,7 @@ static netdev_tx_t port_dropframe(struct sk_buff *skb,
 	.ndo_stop		= port_stop,
 
 	.ndo_set_mac_address	= eth_mac_addr,
+	.ndo_get_stats64	= port_get_stats,
 	.ndo_change_mtu		= port_change_mtu,
 	.ndo_has_offload_stats	= port_has_offload_stats,
 	.ndo_get_offload_stats	= port_get_offload_stats,
@@ -1468,7 +1469,8 @@ static int ethsw_probe(struct fsl_mc_device *sw_dev)
 	ethsw->dev = dev;
 	dev_set_drvdata(dev, ethsw);
 
-	err = fsl_mc_portal_allocate(sw_dev, 0, &ethsw->mc_io);
+	err = fsl_mc_portal_allocate(sw_dev, FSL_MC_IO_ATOMIC_CONTEXT_PORTAL,
+				     &ethsw->mc_io);
 	if (err) {
 		if (err == -ENXIO)
 			err = -EPROBE_DEFER;
-- 
1.9.1


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

* [PATCH 3/7] staging: fsl-dpaa2/ethsw: Remove netdevice on port probing error
  2019-02-06 11:51 [PATCH 0/7] staging: fsl-dpaa2/ethsw: code cleanup Ioana Ciornei
  2019-02-06 11:51 ` [PATCH 1/7] staging: fsl-dpaa2/ethsw: Fix setting port learning/flooding flags Ioana Ciornei
@ 2019-02-06 11:52 ` Ioana Ciornei
  2019-02-06 11:52 ` [PATCH 2/7] staging: fsl-dpaa2/ethsw: Add network interface statistics Ioana Ciornei
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Ioana Ciornei @ 2019-02-06 11:52 UTC (permalink / raw)
  To: gregkh; +Cc: Ioana Ciocoi Radulescu, linux-kernel, Ioana Ciornei

From: Razvan Stefanescu <razvan.stefanescu@nxp.com>

If the ethsw_port_init() call failed, the netdevice remains registered in
the system.

Use labels to ensure that netdevice is unregistered and freed in this case.

Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index d15d03b..fa3af4a 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -1445,13 +1445,23 @@ static int ethsw_probe_port(struct ethsw_core *ethsw, u16 port_idx)
 	err = register_netdev(port_netdev);
 	if (err < 0) {
 		dev_err(dev, "register_netdev error %d\n", err);
-		free_netdev(port_netdev);
-		return err;
+		goto err_register_netdev;
 	}
 
 	ethsw->ports[port_idx] = port_priv;
 
-	return ethsw_port_init(port_priv, port_idx);
+	err = ethsw_port_init(port_priv, port_idx);
+	if (err)
+		goto err_ethsw_port_init;
+
+	return 0;
+
+err_ethsw_port_init:
+	unregister_netdev(port_netdev);
+err_register_netdev:
+	free_netdev(port_netdev);
+
+	return err;
 }
 
 static int ethsw_probe(struct fsl_mc_device *sw_dev)
-- 
1.9.1


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

* [PATCH 4/7] staging: fsl-dpaa2/ethsw: Add ndo_get_phys_port_name
  2019-02-06 11:51 [PATCH 0/7] staging: fsl-dpaa2/ethsw: code cleanup Ioana Ciornei
                   ` (3 preceding siblings ...)
  2019-02-06 11:52 ` [PATCH 5/7] staging: fsl-dpaa2/ethsw: Add switch driver documentation Ioana Ciornei
@ 2019-02-06 11:52 ` Ioana Ciornei
  2019-02-06 11:52 ` [PATCH 6/7] staging: fsl-dpaa2/ethsw: Add comments to ETHSW_VLAN flags Ioana Ciornei
  2019-02-06 11:52 ` [PATCH 7/7] staging: fsl-dpaa2/ethsw: Check notification relevance Ioana Ciornei
  6 siblings, 0 replies; 8+ messages in thread
From: Ioana Ciornei @ 2019-02-06 11:52 UTC (permalink / raw)
  To: gregkh; +Cc: Ioana Ciocoi Radulescu, linux-kernel, Ioana Ciornei

From: Razvan Stefanescu <razvan.stefanescu@nxp.com>

Add the ndo_get_phys_port_name callback to the ethsw driver.

Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index fa3af4a..f179fd0 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -505,6 +505,19 @@ static netdev_tx_t port_dropframe(struct sk_buff *skb,
 	return NETDEV_TX_OK;
 }
 
+static int port_get_phys_name(struct net_device *netdev, char *name,
+			      size_t len)
+{
+	struct ethsw_port_priv *port_priv = netdev_priv(netdev);
+	int err;
+
+	err = snprintf(name, len, "p%d", port_priv->idx);
+	if (err >= len)
+		return -EINVAL;
+
+	return 0;
+}
+
 static const struct net_device_ops ethsw_port_ops = {
 	.ndo_open		= port_open,
 	.ndo_stop		= port_stop,
@@ -516,6 +529,7 @@ static netdev_tx_t port_dropframe(struct sk_buff *skb,
 	.ndo_get_offload_stats	= port_get_offload_stats,
 
 	.ndo_start_xmit		= port_dropframe,
+	.ndo_get_phys_port_name = port_get_phys_name,
 };
 
 static void ethsw_links_state_update(struct ethsw_core *ethsw)
-- 
1.9.1


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

* [PATCH 5/7] staging: fsl-dpaa2/ethsw: Add switch driver documentation
  2019-02-06 11:51 [PATCH 0/7] staging: fsl-dpaa2/ethsw: code cleanup Ioana Ciornei
                   ` (2 preceding siblings ...)
  2019-02-06 11:52 ` [PATCH 2/7] staging: fsl-dpaa2/ethsw: Add network interface statistics Ioana Ciornei
@ 2019-02-06 11:52 ` Ioana Ciornei
  2019-02-06 11:52 ` [PATCH 4/7] staging: fsl-dpaa2/ethsw: Add ndo_get_phys_port_name Ioana Ciornei
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Ioana Ciornei @ 2019-02-06 11:52 UTC (permalink / raw)
  To: gregkh; +Cc: Ioana Ciocoi Radulescu, linux-kernel, Ioana Ciornei

From: Razvan Stefanescu <razvan.stefanescu@nxp.com>

Add a switch driver entry in the dpaa2 overview documentation.

Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
 .../networking/device_drivers/freescale/dpaa2/overview.rst          | 6 ++++++
 MAINTAINERS                                                         | 1 +
 2 files changed, 7 insertions(+)

diff --git a/Documentation/networking/device_drivers/freescale/dpaa2/overview.rst b/Documentation/networking/device_drivers/freescale/dpaa2/overview.rst
index d638b5a..7b7f3590 100644
--- a/Documentation/networking/device_drivers/freescale/dpaa2/overview.rst
+++ b/Documentation/networking/device_drivers/freescale/dpaa2/overview.rst
@@ -393,6 +393,12 @@ interfaces needed to connect the DPAA2 network interface to
 the network stack.
 Each DPNI corresponds to a Linux network interface.
 
+Ethernet L2 Switch driver
+-------------------------
+The Ethernet L2 Switch driver is bound to a DPSW and makes use of the
+switchdev support in kernel.
+Each switch port has a corresponding Linux network interface.
+
 MAC driver
 ----------
 An Ethernet PHY is an off-chip, board specific component and is managed
diff --git a/MAINTAINERS b/MAINTAINERS
index f35c77b..77e88a8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4733,6 +4733,7 @@ M:	Ioana Ciornei <ioana.ciornei@nxp.com>
 L:	linux-kernel@vger.kernel.org
 S:	Maintained
 F:	drivers/staging/fsl-dpaa2/ethsw
+F:	Documentation/networking/device_drivers/freescale/dpaa2/overview.rst
 
 DPAA2 PTP CLOCK DRIVER
 M:	Yangbo Lu <yangbo.lu@nxp.com>
-- 
1.9.1


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

* [PATCH 7/7] staging: fsl-dpaa2/ethsw: Check notification relevance
  2019-02-06 11:51 [PATCH 0/7] staging: fsl-dpaa2/ethsw: code cleanup Ioana Ciornei
                   ` (5 preceding siblings ...)
  2019-02-06 11:52 ` [PATCH 6/7] staging: fsl-dpaa2/ethsw: Add comments to ETHSW_VLAN flags Ioana Ciornei
@ 2019-02-06 11:52 ` Ioana Ciornei
  6 siblings, 0 replies; 8+ messages in thread
From: Ioana Ciornei @ 2019-02-06 11:52 UTC (permalink / raw)
  To: gregkh; +Cc: Ioana Ciocoi Radulescu, linux-kernel, Ioana Ciornei

Verify the notification relevance by checking if the
device is a ethsw one.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index f179fd0..c5da40f 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -1063,6 +1063,9 @@ static int port_switchdev_event(struct notifier_block *unused,
 	struct ethsw_switchdev_event_work *switchdev_work;
 	struct switchdev_notifier_fdb_info *fdb_info = ptr;
 
+	if (!ethsw_port_dev_check(dev))
+		return NOTIFY_DONE;
+
 	switchdev_work = kzalloc(sizeof(*switchdev_work), GFP_ATOMIC);
 	if (!switchdev_work)
 		return NOTIFY_BAD;
-- 
1.9.1


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

* [PATCH 6/7] staging: fsl-dpaa2/ethsw: Add comments to ETHSW_VLAN flags
  2019-02-06 11:51 [PATCH 0/7] staging: fsl-dpaa2/ethsw: code cleanup Ioana Ciornei
                   ` (4 preceding siblings ...)
  2019-02-06 11:52 ` [PATCH 4/7] staging: fsl-dpaa2/ethsw: Add ndo_get_phys_port_name Ioana Ciornei
@ 2019-02-06 11:52 ` Ioana Ciornei
  2019-02-06 11:52 ` [PATCH 7/7] staging: fsl-dpaa2/ethsw: Check notification relevance Ioana Ciornei
  6 siblings, 0 replies; 8+ messages in thread
From: Ioana Ciornei @ 2019-02-06 11:52 UTC (permalink / raw)
  To: gregkh; +Cc: Ioana Ciocoi Radulescu, linux-kernel, Ioana Ciornei

From: Razvan Stefanescu <razvan.stefanescu@nxp.com>

Document each ETHSW_VLAN flag with the appropriate comment.

Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
 drivers/staging/fsl-dpaa2/ethsw/ethsw.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.h b/drivers/staging/fsl-dpaa2/ethsw/ethsw.h
index c487836..3ea8a0a 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.h
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.h
@@ -23,9 +23,13 @@
 /* Number of IRQs supported */
 #define DPSW_IRQ_NUM	2
 
+/* Port is member of VLAN */
 #define ETHSW_VLAN_MEMBER	1
+/* VLAN to be treated as untagged on egress */
 #define ETHSW_VLAN_UNTAGGED	2
+/* Untagged frames will be assigned to this VLAN */
 #define ETHSW_VLAN_PVID		4
+/* VLAN configured on the switch */
 #define ETHSW_VLAN_GLOBAL	8
 
 /* Maximum Frame Length supported by HW (currently 10k) */
-- 
1.9.1


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

end of thread, other threads:[~2019-02-06 11:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-06 11:51 [PATCH 0/7] staging: fsl-dpaa2/ethsw: code cleanup Ioana Ciornei
2019-02-06 11:51 ` [PATCH 1/7] staging: fsl-dpaa2/ethsw: Fix setting port learning/flooding flags Ioana Ciornei
2019-02-06 11:52 ` [PATCH 3/7] staging: fsl-dpaa2/ethsw: Remove netdevice on port probing error Ioana Ciornei
2019-02-06 11:52 ` [PATCH 2/7] staging: fsl-dpaa2/ethsw: Add network interface statistics Ioana Ciornei
2019-02-06 11:52 ` [PATCH 5/7] staging: fsl-dpaa2/ethsw: Add switch driver documentation Ioana Ciornei
2019-02-06 11:52 ` [PATCH 4/7] staging: fsl-dpaa2/ethsw: Add ndo_get_phys_port_name Ioana Ciornei
2019-02-06 11:52 ` [PATCH 6/7] staging: fsl-dpaa2/ethsw: Add comments to ETHSW_VLAN flags Ioana Ciornei
2019-02-06 11:52 ` [PATCH 7/7] staging: fsl-dpaa2/ethsw: Check notification relevance Ioana Ciornei

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).