[PATCH 2/6] staging: dpaa2-ethsw: don't allow interfaces from different DPSWs to be bridged

2020-07-21 Thread Ioana Ciornei
Error out when the user tries to bridge two switch interfaces that are
from different DPSW instances. This is not supported by the hardware and
we should reflect this into what the user is aware of.

Signed-off-by: Ioana Ciornei 
---
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c 
b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index 557a75115da8..530e4105375c 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -1182,6 +1182,9 @@ static int port_bridge_join(struct net_device *netdev,
 {
struct ethsw_port_priv *port_priv = netdev_priv(netdev);
struct ethsw_core *ethsw = port_priv->ethsw_data;
+   struct ethsw_port_priv *other_port_priv;
+   struct net_device *other_dev;
+   struct list_head *iter;
int i, err;
 
for (i = 0; i < ethsw->sw_attr.num_ifs; i++)
@@ -1192,6 +1195,18 @@ static int port_bridge_join(struct net_device *netdev,
return -EINVAL;
}
 
+   netdev_for_each_lower_dev(upper_dev, other_dev, iter) {
+   if (!ethsw_port_dev_check(other_dev, NULL))
+   continue;
+
+   other_port_priv = netdev_priv(other_dev);
+   if (other_port_priv->ethsw_data != port_priv->ethsw_data) {
+   netdev_err(netdev,
+  "Interface from a different DPSW is in the 
bridge already!\n");
+   return -EINVAL;
+   }
+   }
+
/* Enable flooding */
err = ethsw_port_set_flood(port_priv, 1);
if (!err)
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/6] staging: dpaa2-ethsw: various fixes

2020-07-21 Thread Ioana Ciornei
This patch set adds various fixes to the dpaa2-ethsw driver: checking
the received notifier block before acting on a switchdev notification,
destroying a workqueue after deregistering the notifiers, making sure
that new VLANs added have a place before actually adding them and other
problems like this.

I know this driver should be moved along from staging but we still have
the Rx/Tx functionality on switch ports and some general cleanup that we
are working towards. This is tackling the second part, no new feature
added here.

Ioana Ciornei (6):
  staging: dpaa2-ethsw: verify the nofifier block
  staging: dpaa2-ethsw: don't allow interfaces from different DPSWs to
be bridged
  staging: dpaa2-ethsw: setup the STP state for all installed VLANs
  staging: dpaa2-ethsw: destroy workqueue after deregistering the
notifiers
  staging: dpaa2-ethsw: read the port state from firmware
  staging: dpaa2-ethsw: check if there is space for a new VLAN

 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 114 +++-
 1 file changed, 90 insertions(+), 24 deletions(-)

-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/6] staging: dpaa2-ethsw: setup the STP state for all installed VLANs

2020-07-21 Thread Ioana Ciornei
Setup the STP state for all VLANs installed on the port. This is also
avoiding the error situation when the DEFAULT_VLAN_ID is not installed
on the port (thus the firmware complains that it cannot setup the
required STP state).

Signed-off-by: Ioana Ciornei 
---
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 21 +
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c 
b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index 530e4105375c..83e6bd4a803b 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -183,21 +183,26 @@ static int ethsw_port_set_flood(struct ethsw_port_priv 
*port_priv, bool enable)
 static int ethsw_port_set_stp_state(struct ethsw_port_priv *port_priv, u8 
state)
 {
struct dpsw_stp_cfg stp_cfg = {
-   .vlan_id = DEFAULT_VLAN_ID,
.state = state,
};
int err;
+   u16 vid;
 
if (!netif_running(port_priv->netdev) || state == port_priv->stp_state)
return 0;   /* Nothing to do */
 
-   err = dpsw_if_set_stp(port_priv->ethsw_data->mc_io, 0,
- port_priv->ethsw_data->dpsw_handle,
- port_priv->idx, _cfg);
-   if (err) {
-   netdev_err(port_priv->netdev,
-  "dpsw_if_set_stp err %d\n", err);
-   return err;
+   for (vid = 0; vid <= VLAN_VID_MASK; vid++) {
+   if (port_priv->vlans[vid] & ETHSW_VLAN_MEMBER) {
+   stp_cfg.vlan_id = vid;
+   err = dpsw_if_set_stp(port_priv->ethsw_data->mc_io, 0,
+ 
port_priv->ethsw_data->dpsw_handle,
+ port_priv->idx, _cfg);
+   if (err) {
+   netdev_err(port_priv->netdev,
+  "dpsw_if_set_stp err %d\n", err);
+   return err;
+   }
+   }
}
 
port_priv->stp_state = state;
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 6/6] staging: dpaa2-ethsw: check if there is space for a new VLAN

2020-07-21 Thread Ioana Ciornei
Avoid getting into a WARNING as below by checking, while in the prepare
state of the transactional operation, if there is space for a new VLAN.
If we reached the maximum number, return an appropriate error.

[ 6503.657564] eth3: Commit of object (id=1) failed.
[ 6503.657588] WARNING: CPU: 2 PID: 17144 at net/switchdev/switchdev.c:277 
switchdev_port_obj_add_now+0xcc/0x110
...
[ 6503.657628] x1 : 70887ce26695c500 x0 : 
[ 6503.657630] Call trace:
[ 6503.657633]  switchdev_port_obj_add_now+0xcc/0x110
[ 6503.657635]  switchdev_port_obj_add+0x40/0xc0
[ 6503.657638]  br_switchdev_port_vlan_add+0x50/0x78
[ 6503.657640]  __vlan_add+0x2dc/0x758
[ 6503.657642]  nbp_vlan_add+0xc0/0x180
[ 6503.657644]  br_vlan_info.isra.0+0x68/0x128
[ 6503.657646]  br_process_vlan_info+0x224/0x2f8
[ 6503.657647]  br_afspec+0x158/0x188
[ 6503.657649]  br_setlink+0x1a4/0x290

Signed-off-by: Ioana Ciornei 
---
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 21 +++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c 
b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index c6885912c60b..19fc0401e261 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -979,10 +979,27 @@ static int port_vlans_add(struct net_device *netdev,
  struct switchdev_trans *trans)
 {
struct ethsw_port_priv *port_priv = netdev_priv(netdev);
-   int vid, err = 0;
+   struct ethsw_core *ethsw = port_priv->ethsw_data;
+   struct dpsw_attr *attr = >sw_attr;
+   int vid, err = 0, new_vlans = 0;
+
+   if (switchdev_trans_ph_prepare(trans)) {
+   for (vid = vlan->vid_begin; vid <= vlan->vid_end; vid++)
+   if (!port_priv->ethsw_data->vlans[vid])
+   new_vlans++;
+
+   /* Check if there is space for a new VLAN */
+   err = dpsw_get_attributes(ethsw->mc_io, 0, ethsw->dpsw_handle,
+ >sw_attr);
+   if (err) {
+   netdev_err(netdev, "dpsw_get_attributes err %d\n", err);
+   return err;
+   }
+   if (attr->max_vlans - attr->num_vlans < new_vlans)
+   return -ENOSPC;
 
-   if (switchdev_trans_ph_prepare(trans))
return 0;
+   }
 
for (vid = vlan->vid_begin; vid <= vlan->vid_end; vid++) {
if (!port_priv->ethsw_data->vlans[vid]) {
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/6] staging: dpaa2-ethsw: verify the nofifier block

2020-07-21 Thread Ioana Ciornei
Since now we have a notifier block for each DPSW instance probed, we
have to also check that the netdev is indeed connected to the notifier
received. Without this, we end up with the same switchdev callback being
executed multiple times (because it would be received by all notifier
blocks, not just the one intended to).
Also, move the function higher in the source file because it will be
used in later patches from multiple places.

Signed-off-by: Ioana Ciornei 
---
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 31 -
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c 
b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index 2fb75a7c9314..557a75115da8 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -749,6 +749,20 @@ static const struct net_device_ops ethsw_port_ops = {
.ndo_get_phys_port_name = port_get_phys_name,
 };
 
+static bool ethsw_port_dev_check(const struct net_device *netdev,
+struct notifier_block *nb)
+{
+   struct ethsw_port_priv *port_priv = netdev_priv(netdev);
+
+   if (netdev->netdev_ops == _port_ops &&
+   (!nb || _priv->ethsw_data->port_nb == nb ||
+_priv->ethsw_data->port_switchdev_nb == nb ||
+_priv->ethsw_data->port_switchdevb_nb == nb))
+   return true;
+
+   return false;
+}
+
 static void ethsw_links_state_update(struct ethsw_core *ethsw)
 {
int i;
@@ -1199,12 +1213,7 @@ static int port_bridge_leave(struct net_device *netdev)
return err;
 }
 
-static bool ethsw_port_dev_check(const struct net_device *netdev)
-{
-   return netdev->netdev_ops == _port_ops;
-}
-
-static int port_netdevice_event(struct notifier_block *unused,
+static int port_netdevice_event(struct notifier_block *nb,
unsigned long event, void *ptr)
 {
struct net_device *netdev = netdev_notifier_info_to_dev(ptr);
@@ -1212,7 +1221,7 @@ static int port_netdevice_event(struct notifier_block 
*unused,
struct net_device *upper_dev;
int err = 0;
 
-   if (!ethsw_port_dev_check(netdev))
+   if (!ethsw_port_dev_check(netdev, nb))
return NOTIFY_DONE;
 
/* Handle just upper dev link/unlink for the moment */
@@ -1280,7 +1289,7 @@ static void ethsw_switchdev_event_work(struct work_struct 
*work)
 }
 
 /* Called under rcu_read_lock() */
-static int port_switchdev_event(struct notifier_block *unused,
+static int port_switchdev_event(struct notifier_block *nb,
unsigned long event, void *ptr)
 {
struct net_device *dev = switchdev_notifier_info_to_dev(ptr);
@@ -1289,7 +1298,7 @@ static int port_switchdev_event(struct notifier_block 
*unused,
struct switchdev_notifier_fdb_info *fdb_info = ptr;
struct ethsw_core *ethsw = port_priv->ethsw_data;
 
-   if (!ethsw_port_dev_check(dev))
+   if (!ethsw_port_dev_check(dev, nb))
return NOTIFY_DONE;
 
if (event == SWITCHDEV_PORT_ATTR_SET)
@@ -1353,12 +1362,12 @@ ethsw_switchdev_port_obj_event(unsigned long event, 
struct net_device *netdev,
return notifier_from_errno(err);
 }
 
-static int port_switchdev_blocking_event(struct notifier_block *unused,
+static int port_switchdev_blocking_event(struct notifier_block *nb,
 unsigned long event, void *ptr)
 {
struct net_device *dev = switchdev_notifier_info_to_dev(ptr);
 
-   if (!ethsw_port_dev_check(dev))
+   if (!ethsw_port_dev_check(dev, nb))
return NOTIFY_DONE;
 
switch (event) {
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 4/6] staging: dpaa2-ethsw: destroy workqueue after deregistering the notifiers

2020-07-21 Thread Ioana Ciornei
We should destroy the switch workqueue only after deregistering the
switchdev notifiers. Without this fix, we could end up with switchdev
notifications on a draining workqueue and also with a lock up since the
netdevice reference count is increased (in port_switchdev_event) and not
decreased ever (since the workqueue did not run).

Signed-off-by: Ioana Ciornei 
---
 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 83e6bd4a803b..9114437645a8 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -1628,8 +1628,6 @@ static int ethsw_remove(struct fsl_mc_device *sw_dev)
 
ethsw_teardown_irqs(sw_dev);
 
-   destroy_workqueue(ethsw->workqueue);
-
dpsw_disable(ethsw->mc_io, 0, ethsw->dpsw_handle);
 
for (i = 0; i < ethsw->sw_attr.num_ifs; i++) {
@@ -1640,6 +1638,9 @@ static int ethsw_remove(struct fsl_mc_device *sw_dev)
kfree(ethsw->ports);
 
ethsw_takedown(sw_dev);
+
+   destroy_workqueue(ethsw->workqueue);
+
fsl_mc_portal_free(ethsw->mc_io);
 
kfree(ethsw);
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 5/6] staging: dpaa2-ethsw: read the port state from firmware

2020-07-21 Thread Ioana Ciornei
Rely on the port state seen by the firmware since it will also be the
one erroring out when trying to setup anything major when the port is
up.

Signed-off-by: Ioana Ciornei 
---
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c 
b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index 9114437645a8..c6885912c60b 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -43,6 +43,25 @@ static int ethsw_add_vlan(struct ethsw_core *ethsw, u16 vid)
return 0;
 }
 
+static bool ethsw_port_is_up(struct ethsw_port_priv *port_priv)
+{
+   struct net_device *netdev = port_priv->netdev;
+   struct dpsw_link_state state;
+   int err;
+
+   err = dpsw_if_get_link_state(port_priv->ethsw_data->mc_io, 0,
+port_priv->ethsw_data->dpsw_handle,
+port_priv->idx, );
+   if (err) {
+   netdev_err(netdev, "dpsw_if_get_link_state() err %d\n", err);
+   return true;
+   }
+
+   WARN_ONCE(state.up > 1, "Garbage read into link_state");
+
+   return state.up ? true : false;
+}
+
 static int ethsw_port_set_pvid(struct ethsw_port_priv *port_priv, u16 pvid)
 {
struct ethsw_core *ethsw = port_priv->ethsw_data;
@@ -61,7 +80,7 @@ static int ethsw_port_set_pvid(struct ethsw_port_priv 
*port_priv, u16 pvid)
tci_cfg.vlan_id = pvid;
 
/* Interface needs to be down to change PVID */
-   up = netif_running(netdev);
+   up = ethsw_port_is_up(port_priv);
if (up) {
err = dpsw_if_disable(ethsw->mc_io, 0,
  ethsw->dpsw_handle,
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 0/6] staging: dpaa2-ethsw: cleanup of link state and MAC addresses

2020-07-15 Thread Ioana Ciornei
> Subject: Re: [PATCH 0/6] staging: dpaa2-ethsw: cleanup of link state and MAC
> addresses
> 
> On Tue, Jul 14, 2020 at 04:34:25PM +0300, Ioana Ciornei wrote:
> > This patch set is cleaning up the link state handling of the switch
> > ports in patches 1-4. The last two patches are setting up the MAC
> > addresses of the switch ports automatically so that the user is not
> > forced to manually add them before adding them to a bridge.
> 
> This feels like adding new functionality to this code.  What is keeping it 
> from
> getting out of staging at this point in time?  I would prefer for it to be 
> moved out
> before adding new stuff to it.
> 
> thanks,
> 
> greg k-h

We still have some work do to on this driver before moving it out of staging 
unfortunately, mainly integrating the Rx/Tx functionality for switch ports[1] 
and general cleanup on the driver. Sorry I did not mention this in the cover 
letter.

This patch set just does some cleanup of the link state handling since the 
state showed to the user in the ifconfig output was not consistent all the time 
with what actually was happening in the hardware.

Thanks,
Ioana

[1] https://lkml.org/lkml/2019/11/5/548

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 5/6] staging: dpaa2-ethsw: store version information of the DPSW object

2020-07-14 Thread Ioana Ciornei
Store the major and minor versions of the DPSW object in the ethsw
structure. This will be used in a subsequent patch to make sure some
commands are only called on the appropriate version of object.

Signed-off-by: Ioana Ciornei 
---
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 16 
 drivers/staging/fsl-dpaa2/ethsw/ethsw.h |  1 +
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c 
b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index f283ce195c1e..a8fc9bcf3b8a 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -1368,9 +1368,9 @@ static int ethsw_init(struct fsl_mc_device *sw_dev)
 {
struct device *dev = _dev->dev;
struct ethsw_core *ethsw = dev_get_drvdata(dev);
-   u16 version_major, version_minor, i;
struct dpsw_stp_cfg stp_cfg;
int err;
+   u16 i;
 
ethsw->dev_id = sw_dev->obj_desc.id;
 
@@ -1388,20 +1388,20 @@ static int ethsw_init(struct fsl_mc_device *sw_dev)
}
 
err = dpsw_get_api_version(ethsw->mc_io, 0,
-  _major,
-  _minor);
+  >major,
+  >minor);
if (err) {
dev_err(dev, "dpsw_get_api_version err %d\n", err);
goto err_close;
}
 
/* Minimum supported DPSW version check */
-   if (version_major < DPSW_MIN_VER_MAJOR ||
-   (version_major == DPSW_MIN_VER_MAJOR &&
-version_minor < DPSW_MIN_VER_MINOR)) {
+   if (ethsw->major < DPSW_MIN_VER_MAJOR ||
+   (ethsw->major == DPSW_MIN_VER_MAJOR &&
+ethsw->minor < DPSW_MIN_VER_MINOR)) {
dev_err(dev, "DPSW version %d:%d not supported. Use %d.%d or 
greater.\n",
-   version_major,
-   version_minor,
+   ethsw->major,
+   ethsw->minor,
DPSW_MIN_VER_MAJOR, DPSW_MIN_VER_MINOR);
err = -ENOTSUPP;
goto err_close;
diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.h 
b/drivers/staging/fsl-dpaa2/ethsw/ethsw.h
index a0244f7d5003..0e520fd94dbc 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.h
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.h
@@ -61,6 +61,7 @@ struct ethsw_core {
struct fsl_mc_io*mc_io;
u16 dpsw_handle;
struct dpsw_attrsw_attr;
+   u16 major, minor;
int dev_id;
struct ethsw_port_priv  **ports;
 
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/6] staging: dpaa2-ethsw: fix reported link state

2020-07-14 Thread Ioana Ciornei
On the .ndo_open() callback set netif_carrier_off() until the link state
interrupt is received so that the LOWER_UP flag does not show up
incorrectly in the output of 'ip link show'.

Signed-off-by: Ioana Ciornei 
---
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c 
b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index 546ad376df99..46aa37093e86 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -473,6 +473,13 @@ static int port_open(struct net_device *netdev)
/* No need to allow Tx as control interface is disabled */
netif_tx_stop_all_queues(netdev);
 
+   /* Explicitly set carrier off, otherwise
+* netif_carrier_ok() will return true and cause 'ip link show'
+* to report the LOWER_UP flag, even though the link
+* notification wasn't even received.
+*/
+   netif_carrier_off(netdev);
+
err = dpsw_if_enable(port_priv->ethsw_data->mc_io, 0,
 port_priv->ethsw_data->dpsw_handle,
 port_priv->idx);
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/6] staging: dpaa2-ethsw: cleanup of link state and MAC addresses

2020-07-14 Thread Ioana Ciornei
This patch set is cleaning up the link state handling of the switch
ports in patches 1-4. The last two patches are setting up the MAC
addresses of the switch ports automatically so that the user is not
forced to manually add them before adding them to a bridge.

Ioana Ciornei (6):
  staging: dpaa2-ethsw: fix reported link state
  staging: dpaa2-ethsw: ignore state interrupts when the interface is
not running
  staging: dpaa2-ethsw: use netif_running when checking for port up
  staging: dpaa2-ethsw: disable switch ports are probe time
  staging: dpaa2-ethsw: store version information of the DPSW object
  staging: dpaa2-ethsw: setup MAC address of switch netdevices

 drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h |  14 +++
 drivers/staging/fsl-dpaa2/ethsw/dpsw.c | 106 +
 drivers/staging/fsl-dpaa2/ethsw/dpsw.h |   9 ++
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c| 102 +---
 drivers/staging/fsl-dpaa2/ethsw/ethsw.h|   4 +
 5 files changed, 221 insertions(+), 14 deletions(-)

-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/6] staging: dpaa2-ethsw: ignore state interrupts when the interface is not running

2020-07-14 Thread Ioana Ciornei
Link state interrupts will be transmitted to the DPSW object even though
the user has not yet issued a 'ifconfig up' on a switch interface. Don't
act on those interrupts since there are of no interrest.

Signed-off-by: Ioana Ciornei 
---
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c 
b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index 46aa37093e86..b57bc705c2ee 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -445,6 +445,12 @@ static int port_carrier_state_sync(struct net_device 
*netdev)
struct dpsw_link_state state;
int err;
 
+   /* Interrupts are received even though no one issued an 'ifconfig up'
+* on the switch interface. Ignore these link state update interrupts
+*/
+   if (!netif_running(netdev))
+   return 0;
+
err = dpsw_if_get_link_state(port_priv->ethsw_data->mc_io, 0,
 port_priv->ethsw_data->dpsw_handle,
 port_priv->idx, );
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 4/6] staging: dpaa2-ethsw: disable switch ports are probe time

2020-07-14 Thread Ioana Ciornei
The MC firmware will enable the switch interfaces at DPSW creation
without waiting for an 'ifconfig up' on the switch interfaces. When this
happens, the states held by the Linux software vs the firmware are not
in sync. Make sure to disable the switch ports at probe time to not
encounter this issue.

Signed-off-by: Ioana Ciornei 
---
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c 
b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index a1917842536e..f283ce195c1e 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -1672,6 +1672,10 @@ static int ethsw_probe(struct fsl_mc_device *sw_dev)
goto err_free_ports;
}
 
+   /* Make sure the switch ports are disabled at probe time */
+   for (i = 0; i < ethsw->sw_attr.num_ifs; i++)
+   dpsw_if_disable(ethsw->mc_io, 0, ethsw->dpsw_handle, i);
+
/* Setup IRQs */
err = ethsw_setup_irqs(sw_dev);
if (err)
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 6/6] staging: dpaa2-ethsw: setup MAC address of switch netdevices

2020-07-14 Thread Ioana Ciornei
At probe time, retrieve the MAC addresses of the switch ports using a
firmware call and use that to setup the switch interface net_device
instead of relying entirely on the user to configure a MAC address on
the interface. In case a switch interface is not connected to a MAC,
thus the dpsw_if_get_port_mac_addr() will return all zeroes, generate a
random MAC address and use that.

This new functionality is dependent on a firmware call which is
available only on newer versions, so depending on the running DPSW
object version skip this step.

Signed-off-by: Ioana Ciornei 
---
 drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h |  14 +++
 drivers/staging/fsl-dpaa2/ethsw/dpsw.c | 106 +
 drivers/staging/fsl-dpaa2/ethsw/dpsw.h |   9 ++
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c|  59 +++-
 drivers/staging/fsl-dpaa2/ethsw/ethsw.h|   3 +
 5 files changed, 190 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h 
b/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h
index 5e1339daa7c7..f100d503bd17 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h
+++ b/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h
@@ -69,6 +69,10 @@
 #define DPSW_CMDID_FDB_SET_LEARNING_MODEDPSW_CMD_ID(0x088)
 #define DPSW_CMDID_FDB_DUMP DPSW_CMD_ID(0x08A)
 
+#define DPSW_CMDID_IF_GET_PORT_MAC_ADDR DPSW_CMD_ID(0x0A7)
+#define DPSW_CMDID_IF_GET_PRIMARY_MAC_ADDR  DPSW_CMD_ID(0x0A8)
+#define DPSW_CMDID_IF_SET_PRIMARY_MAC_ADDR  DPSW_CMD_ID(0x0A9)
+
 /* Macros for accessing command fields smaller than 1byte */
 #define DPSW_MASK(field)\
GENMASK(DPSW_##field##_SHIFT + DPSW_##field##_SIZE - 1, \
@@ -369,4 +373,14 @@ struct dpsw_rsp_get_api_version {
__le16 version_minor;
 };
 
+struct dpsw_rsp_if_get_mac_addr {
+   __le16 pad;
+   u8 mac_addr[6];
+};
+
+struct dpsw_cmd_if_set_mac_addr {
+   __le16 if_id;
+   u8 mac_addr[6];
+};
+
 #endif /* __FSL_DPSW_CMD_H */
diff --git a/drivers/staging/fsl-dpaa2/ethsw/dpsw.c 
b/drivers/staging/fsl-dpaa2/ethsw/dpsw.c
index 56b0fa789a67..f8bfe779bd30 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/dpsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/dpsw.c
@@ -1214,3 +1214,109 @@ int dpsw_get_api_version(struct fsl_mc_io *mc_io,
 
return 0;
 }
+
+/**
+ * dpsw_if_get_port_mac_addr()
+ * @mc_io: Pointer to MC portal's I/O object
+ * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token: Token of DPSW object
+ * @if_id: Interface Identifier
+ * @mac_addr:  MAC address of the physical port, if any, otherwise 0
+ *
+ * Return: Completion status. '0' on Success; Error code otherwise.
+ */
+int dpsw_if_get_port_mac_addr(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 
token,
+ u16 if_id, u8 mac_addr[6])
+{
+   struct dpsw_rsp_if_get_mac_addr *rsp_params;
+   struct fsl_mc_command cmd = { 0 };
+   struct dpsw_cmd_if *cmd_params;
+   int err, i;
+
+   /* prepare command */
+   cmd.header = mc_encode_cmd_header(DPSW_CMDID_IF_GET_PORT_MAC_ADDR,
+ cmd_flags,
+ token);
+   cmd_params = (struct dpsw_cmd_if *)cmd.params;
+   cmd_params->if_id = cpu_to_le16(if_id);
+
+   /* send command to mc*/
+   err = mc_send_command(mc_io, );
+   if (err)
+   return err;
+
+   /* retrieve response parameters */
+   rsp_params = (struct dpsw_rsp_if_get_mac_addr *)cmd.params;
+   for (i = 0; i < 6; i++)
+   mac_addr[5 - i] = rsp_params->mac_addr[i];
+
+   return 0;
+}
+
+/**
+ * dpsw_if_get_primary_mac_addr()
+ * @mc_io: Pointer to MC portal's I/O object
+ * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token: Token of DPSW object
+ * @if_id: Interface Identifier
+ * @mac_addr:  MAC address of the physical port, if any, otherwise 0
+ *
+ * Return: Completion status. '0' on Success; Error code otherwise.
+ */
+int dpsw_if_get_primary_mac_addr(struct fsl_mc_io *mc_io, u32 cmd_flags,
+u16 token, u16 if_id, u8 mac_addr[6])
+{
+   struct dpsw_rsp_if_get_mac_addr *rsp_params;
+   struct fsl_mc_command cmd = { 0 };
+   struct dpsw_cmd_if *cmd_params;
+   int err, i;
+
+   /* prepare command */
+   cmd.header = mc_encode_cmd_header(DPSW_CMDID_IF_SET_PRIMARY_MAC_ADDR,
+ cmd_flags,
+ token);
+   cmd_params = (struct dpsw_cmd_if *)cmd.params;
+   cmd_params->if_id = cpu_to_le16(if_id);
+
+   /* send command to mc*/
+   err = mc_send_command(mc_io, );
+   if (err)
+   return err;
+
+   /* retrieve response parameters */
+   rsp_params = (struct dpsw_rsp_if_get_mac_addr *)cmd.params;
+   for (i = 0; i < 6; i++)
+   mac_addr[5 - i] = rsp_params->mac_addr[i];

[PATCH 3/6] staging: dpaa2-ethsw: use netif_running when checking for port up

2020-07-14 Thread Ioana Ciornei
There are some cases where the switch interface needs to be disabled so
that changes in the configuration can be made. In such cases, we should
check for a running interface (bit __LINK_STATE_START of the netdev)
instead of netif_carrier_ok(). This is because on open() we enable the
switch interface even though the link up has not come out yet.

Signed-off-by: Ioana Ciornei 
---
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c 
b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index b57bc705c2ee..a1917842536e 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -48,7 +48,7 @@ static int ethsw_port_set_pvid(struct ethsw_port_priv 
*port_priv, u16 pvid)
struct ethsw_core *ethsw = port_priv->ethsw_data;
struct net_device *netdev = port_priv->netdev;
struct dpsw_tci_cfg tci_cfg = { 0 };
-   bool is_oper;
+   bool up;
int err, ret;
 
err = dpsw_if_get_tci(ethsw->mc_io, 0, ethsw->dpsw_handle,
@@ -61,8 +61,8 @@ static int ethsw_port_set_pvid(struct ethsw_port_priv 
*port_priv, u16 pvid)
tci_cfg.vlan_id = pvid;
 
/* Interface needs to be down to change PVID */
-   is_oper = netif_oper_up(netdev);
-   if (is_oper) {
+   up = netif_running(netdev);
+   if (up) {
err = dpsw_if_disable(ethsw->mc_io, 0,
  ethsw->dpsw_handle,
  port_priv->idx);
@@ -85,7 +85,7 @@ static int ethsw_port_set_pvid(struct ethsw_port_priv 
*port_priv, u16 pvid)
port_priv->pvid = pvid;
 
 set_tci_error:
-   if (is_oper) {
+   if (up) {
ret = dpsw_if_enable(ethsw->mc_io, 0,
 ethsw->dpsw_handle,
 port_priv->idx);
@@ -188,7 +188,7 @@ static int ethsw_port_set_stp_state(struct ethsw_port_priv 
*port_priv, u8 state)
};
int err;
 
-   if (!netif_oper_up(port_priv->netdev) || state == port_priv->stp_state)
+   if (!netif_running(port_priv->netdev) || state == port_priv->stp_state)
return 0;   /* Nothing to do */
 
err = dpsw_if_set_stp(port_priv->ethsw_data->mc_io, 0,
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH net] staging: fsl-dpaa2: ethsw: Add missing netdevice check

2019-02-25 Thread Ioana Ciornei

> Subject: Re: [PATCH net] staging: fsl-dpaa2: ethsw: Add missing netdevice 
> check
> 
> Le 2/23/19 à 12:45 AM, Ioana Ciornei a écrit :
> >
> >> Subject: [PATCH net] staging: fsl-dpaa2: ethsw: Add missing netdevice
> >> check
> >>
> >> port_switchdev_event() does not check that the target network device
> >> is actually backed by the ethsw driver, this could be problematic in
> >> a stacked environment case.
> >>
> >
> > Just FYI, I sent a patch set containing a similar patch verifying if the 
> > netdev is
> backed by the ethsw:
> > https://lkml.org/lkml/2019/2/6/216
> >
> > I sent the entire patch set against the staging tree.
> 
> Thank you. BTW do you have any plans for moving this driver out of staging? It
> looks pretty good to me to get promoted in tree, provided that you also have 
> all
> the dependencies in place etc.

Driver dependencies such as the fsl-mc bus or the dpio driver are out of 
staging but not all the TODO items are yet implemented (most notably support 
for control traffic).
Do you think maybe we can move it now and submit directly to the netdev tree 
the other features?

Ioana C
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH net] staging: fsl-dpaa2: ethsw: Add missing netdevice check

2019-02-23 Thread Ioana Ciornei


> Subject: [PATCH net] staging: fsl-dpaa2: ethsw: Add missing netdevice check
> 
> port_switchdev_event() does not check that the target network device is
> actually backed by the ethsw driver, this could be problematic in a stacked
> environment case.
> 

Just FYI, I sent a patch set containing a similar patch verifying if the netdev 
is backed by the ethsw:
https://lkml.org/lkml/2019/2/6/216

I sent the entire patch set against the staging tree.

Ioana C

> Fixes: 44baaa43d7cc ("staging: fsl-dpaa2/ethsw: Add Freescale DPAA2 Ethernet
> Switch driver")
> Signed-off-by: Florian Fainelli 
> ---
>  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 daabaceeea52..2edd82f5229a 100644
> --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
> +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
> @@ -1047,6 +1047,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;
> --
> 2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] bus: fsl-mc: explicitly define the fsl_mc_command endianness

2018-10-02 Thread Ioana Ciornei
Both the header and the command parameters of the fsl_mc_command are
64-bit little-endian words. Use the appropriate type to explicitly
specify their endianness.

Signed-off-by: Ioana Ciornei 
---
 include/linux/fsl/mc.h | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/linux/fsl/mc.h b/include/linux/fsl/mc.h
index f27cb14..96c54bb 100644
--- a/include/linux/fsl/mc.h
+++ b/include/linux/fsl/mc.h
@@ -210,8 +210,8 @@ struct mc_cmd_header {
 };
 
 struct fsl_mc_command {
-   u64 header;
-   u64 params[MC_CMD_NUM_OF_PARAMS];
+   __le64 header;
+   __le64 params[MC_CMD_NUM_OF_PARAMS];
 };
 
 enum mc_cmd_status {
@@ -238,11 +238,11 @@ enum mc_cmd_status {
 /* Command completion flag */
 #define MC_CMD_FLAG_INTR_DIS   0x01
 
-static inline u64 mc_encode_cmd_header(u16 cmd_id,
-  u32 cmd_flags,
-  u16 token)
+static inline __le64 mc_encode_cmd_header(u16 cmd_id,
+ u32 cmd_flags,
+ u16 token)
 {
-   u64 header = 0;
+   __le64 header = 0;
struct mc_cmd_header *hdr = (struct mc_cmd_header *)
 
hdr->cmd_id = cpu_to_le16(cmd_id);
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/2] staging: fsl-dpaa2/eth: convert documentation to .rst format

2018-07-31 Thread Ioana Ciornei
Convert the DPAA2 Ethernet driver documentation to .rst format
and rename the file accordingly.
Also add a SPDX tag to the new rst file.

Signed-off-by: Ioana Ciornei 
---
 .../ethernet/{README => ethernet-driver.rst}   | 39 +++---
 1 file changed, 19 insertions(+), 20 deletions(-)
 rename drivers/staging/fsl-dpaa2/ethernet/{README => ethernet-driver.rst} (94%)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/README 
b/drivers/staging/fsl-dpaa2/ethernet/ethernet-driver.rst
similarity index 94%
rename from drivers/staging/fsl-dpaa2/ethernet/README
rename to drivers/staging/fsl-dpaa2/ethernet/ethernet-driver.rst
index e3b5c90..90ec940 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/README
+++ b/drivers/staging/fsl-dpaa2/ethernet/ethernet-driver.rst
@@ -1,16 +1,13 @@
-Freescale DPAA2 Ethernet driver
-===
-
-This file provides documentation for the Freescale DPAA2 Ethernet driver.
+.. SPDX-License-Identifier: GPL-2.0
+.. include:: 
 
+===
+DPAA2 Ethernet driver
+===
 
-Contents
-
-   Supported Platforms
-   Architecture Overview
-   Creating a Network Interface
-   Features & Offloads
+:Copyright: |copy| 2017-2018 NXP
 
+This file provides documentation for the Freescale DPAA2 Ethernet driver.
 
 Supported Platforms
 ===
@@ -23,10 +20,11 @@ Architecture Overview
 Unlike regular NICs, in the DPAA2 architecture there is no single hardware 
block
 representing network interfaces; instead, several separate hardware resources
 concur to provide the networking functionality:
-- network interfaces
-- queues, channels
-- buffer pools
-- MAC/PHY
+
+- network interfaces
+- queues, channels
+- buffer pools
+- MAC/PHY
 
 All hardware resources are allocated and configured through the Management
 Complex (MC) portals. MC abstracts most of these resources as DPAA2 objects
@@ -35,14 +33,13 @@ hardware resources, like queues, do not have a 
corresponding MC object and
 are treated as internal resources of other objects.
 
 For a more detailed description of the DPAA2 architecture and its object
-abstractions see:
-   Documentation/networking/dpaa2/overview.rst
+abstractions see *Documentation/networking/dpaa2/overview.rst*.
 
 Each Linux net device is built on top of a Datapath Network Interface (DPNI)
 object and uses Buffer Pools (DPBPs), I/O Portals (DPIOs) and Concentrators
 (DPCONs).
 
-Configuration interface:
+Configuration interface::
 
  ---
 | DPAA2 Ethernet Driver |
@@ -56,7 +53,7 @@ Configuration interface:
 | DPBP API |   | DPNI API || DPCON API |
  -- --  ---
  .  .. software
-===  .  ==  .    .  ===
+===  .  ==  .    .  ===
  .  .. hardware
  --
 |MC hardware portals   |
@@ -72,11 +69,11 @@ DPBPs represent hardware buffer pools. Packet I/O is 
performed in the context
 of DPCON objects, using DPIO portals for managing and communicating with the
 hardware resources.
 
-Datapath (I/O) interface:
+Datapath (I/O) interface::
 
  ---
 |   DPAA2 Ethernet Driver   |
-  ---
+ ---
   |  ^^ ||
   |  || ||
enqueue|   dequeue|   data |  dequeue|   seed |
@@ -132,6 +129,8 @@ DPNIs are decoupled from PHYs; a DPNI can be connected to a 
PHY through a DPMAC
 object or to another DPNI through an internal link, but the connection is
 managed by MC and completely transparent to the Ethernet driver.
 
+::
+
  - - -
 | eth if1 |   | eth if2 |   | eth ifn |
  - - -
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2] staging: fsl-dpaa2/eth: add SPDX license identifiers

2018-07-31 Thread Ioana Ciornei
The DPAA2 Ethernet driver files use a GPL-2.0+ OR BSD-3-Clause
license. Add SPDX tags and delete the full license text,
keeping the existing licenses for each file.
Add a GPL-2.0 tag for the Makefile.

Signed-off-by: Ioana Ciornei 
---
 drivers/staging/fsl-dpaa2/ethernet/Makefile|  1 +
 .../staging/fsl-dpaa2/ethernet/dpaa2-eth-trace.h   | 29 +
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 29 +
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 29 +
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c | 29 +
 drivers/staging/fsl-dpaa2/ethernet/dpkg.h  | 30 +-
 drivers/staging/fsl-dpaa2/ethernet/dpni-cmd.h  | 30 +-
 drivers/staging/fsl-dpaa2/ethernet/dpni.c  | 30 +-
 drivers/staging/fsl-dpaa2/ethernet/dpni.h  | 30 +-
 drivers/staging/fsl-dpaa2/ethernet/net.h   | 30 +-
 10 files changed, 10 insertions(+), 257 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/Makefile 
b/drivers/staging/fsl-dpaa2/ethernet/Makefile
index 77b0b74..9315ecd 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/Makefile
+++ b/drivers/staging/fsl-dpaa2/ethernet/Makefile
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
 #
 # Makefile for the Freescale DPAA2 Ethernet controller
 #
diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth-trace.h 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth-trace.h
index 3b040e8..9801528 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth-trace.h
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth-trace.h
@@ -1,32 +1,5 @@
+/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
 /* Copyright 2014-2015 Freescale Semiconductor Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- *  notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *  notice, this list of conditions and the following disclaimer in the
- *  documentation and/or other materials provided with the distribution.
- * * Neither the name of Freescale Semiconductor nor the
- *  names of its contributors may be used to endorse or promote products
- *  derived from this software without specific prior written permission.
- *
- *
- * ALTERNATIVELY, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") as published by the Free Software
- * Foundation, either version 2 of that License or (at your option) any
- * later version.
- *
- * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 
THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #undef TRACE_SYSTEM
diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 41dd6d88..e2dac44 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -1,33 +1,6 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
 /* Copyright 2014-2016 Freescale Semiconductor Inc.
  * Copyright 2016-2017 NXP
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- *  notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *  notice, this list of conditions and the following disclaimer in the
- *  documentation and/or other materials provided with the distribution.
- * * Neither the name of Freescale Semiconductor nor the
- *  names of its contributors may be used to endorse or promote products
- *  derived from this software without specific prior written permission.
- *
- *
- * ALTERNATIVELY, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") as published by the Free Software
- * Foundation, either version 2 of that License or 

[PATCH v2 1/2] staging: fsl-dpaa2/eth: document nested structs as per kernel-doc

2018-07-27 Thread Ioana Ciornei
Document nested structs per kernel-doc requirements by moving
all comments before the actual struct.

Signed-off-by: Ioana Ciornei 
---
Changes in v2:
 - remove comments of non-existent fields

 drivers/staging/fsl-dpaa2/ethernet/dpkg.h |  70 +++-
 drivers/staging/fsl-dpaa2/ethernet/dpni.h | 129 +-
 2 files changed, 99 insertions(+), 100 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpkg.h 
b/drivers/staging/fsl-dpaa2/ethernet/dpkg.h
index 02290a0..8057a25 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpkg.h
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpkg.h
@@ -89,45 +89,41 @@ struct dpkg_mask {
 /**
  * struct dpkg_extract - A structure for defining a single extraction
  * @type: Determines how the union below is interpreted:
- * DPKG_EXTRACT_FROM_HDR: selects 'from_hdr';
- * DPKG_EXTRACT_FROM_DATA: selects 'from_data';
- * DPKG_EXTRACT_FROM_PARSE: selects 'from_parse'
+ * DPKG_EXTRACT_FROM_HDR: selects 'from_hdr';
+ * DPKG_EXTRACT_FROM_DATA: selects 'from_data';
+ * DPKG_EXTRACT_FROM_PARSE: selects 'from_parse'
  * @extract: Selects extraction method
+ * @extract.from_hdr: Used when 'type = DPKG_EXTRACT_FROM_HDR'
+ * @extract.from_data: Used when 'type = DPKG_EXTRACT_FROM_DATA'
+ * @extract.from_parse:  Used when 'type = DPKG_EXTRACT_FROM_PARSE'
+ * @extract.from_hdr.prot: Any of the supported headers
+ * @extract.from_hdr.type: Defines the type of header extraction:
+ * DPKG_FROM_HDR: use size & offset below;
+ * DPKG_FROM_FIELD: use field, size and offset below;
+ * DPKG_FULL_FIELD: use field below
+ * @extract.from_hdr.field: One of the supported fields (NH_FLD_)
+ * @extract.from_hdr.size: Size in bytes
+ * @extract.from_hdr.offset: Byte offset
+ * @extract.from_hdr.hdr_index: Clear for cases not listed below;
+ * Used for protocols that may have more than a single
+ * header, 0 indicates an outer header;
+ * Supported protocols (possible values):
+ * NET_PROT_VLAN (0, HDR_INDEX_LAST);
+ * NET_PROT_MPLS (0, 1, HDR_INDEX_LAST);
+ * NET_PROT_IP(0, HDR_INDEX_LAST);
+ * NET_PROT_IPv4(0, HDR_INDEX_LAST);
+ * NET_PROT_IPv6(0, HDR_INDEX_LAST);
+ * @extract.from_data.size: Size in bytes
+ * @extract.from_data.offset: Byte offset
+ * @extract.from_parse.size: Size in bytes
+ * @extract.from_parse.offset: Byte offset
  * @num_of_byte_masks: Defines the number of valid entries in the array below;
  * This is also the number of bytes to be used as masks
  * @masks: Masks parameters
  */
 struct dpkg_extract {
enum dpkg_extract_type type;
-   /**
-* union extract - Selects extraction method
-* @from_hdr - Used when 'type = DPKG_EXTRACT_FROM_HDR'
-* @from_data - Used when 'type = DPKG_EXTRACT_FROM_DATA'
-* @from_parse - Used when 'type = DPKG_EXTRACT_FROM_PARSE'
-*/
union {
-   /**
-* struct from_hdr - Used when 'type = DPKG_EXTRACT_FROM_HDR'
-* @prot: Any of the supported headers
-* @type: Defines the type of header extraction:
-*  DPKG_FROM_HDR: use size & offset below;
-*  DPKG_FROM_FIELD: use field, size and offset below;
-*  DPKG_FULL_FIELD: use field below
-* @field: One of the supported fields (NH_FLD_)
-*
-* @size: Size in bytes
-* @offset: Byte offset
-* @hdr_index: Clear for cases not listed below;
-*  Used for protocols that may have more than a single
-*  header, 0 indicates an outer header;
-*  Supported protocols (possible values):
-*  NET_PROT_VLAN (0, HDR_INDEX_LAST);
-*  NET_PROT_MPLS (0, 1, HDR_INDEX_LAST);
-*  NET_PROT_IP(0, HDR_INDEX_LAST);
-*  NET_PROT_IPv4(0, HDR_INDEX_LAST);
-*  NET_PROT_IPv6(0, HDR_INDEX_LAST);
-*/
-
struct {
enum net_prot   prot;
enum dpkg_extract_from_hdr_type type;
@@ -136,22 +132,10 @@ struct dpkg_extract {
u8  offset;
u8  hdr_index;
} from_hdr;
-   /**
-* struct from_data - Used when 'type = DPKG_EXTRACT_FROM_DATA'
-* @size: Size in bytes
-* @offset: Byte offset
-*/
struct {
u8 size;
u8 offset;
} from_data;
-
-   /**
-* struct from_parse - Used when
-* 'type = DPKG_EXTRACT_FROM_PARSE'
-* @size: Size in bytes
-* @offset: Byt

[PATCH v2 2/2] staging: fsl-dpaa2/ethsw: document nested structs as per kernel-doc

2018-07-27 Thread Ioana Ciornei
Document nested structs per kernel-doc requirements by moving
all comments before the actual struct.

Signed-off-by: Ioana Ciornei 
---
Changes in v2:
 - none

 drivers/staging/fsl-dpaa2/ethsw/dpsw.h | 27 ---
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethsw/dpsw.h 
b/drivers/staging/fsl-dpaa2/ethsw/dpsw.h
index 82f80c40..db43fa3 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/dpsw.h
+++ b/drivers/staging/fsl-dpaa2/ethsw/dpsw.h
@@ -79,24 +79,21 @@ enum dpsw_component_type {
  * struct dpsw_cfg - DPSW configuration
  * @num_ifs: Number of external and internal interfaces
  * @adv: Advanced parameters; default is all zeros;
- *  use this structure to change default settings
+ *  use this structure to change default settings
+ * @adv.options: Enable/Disable DPSW features (bitmap)
+ * @adv.max_vlans: Maximum Number of VLAN's; 0 - indicates default 16
+ * @adv.max_meters_per_if: Number of meters per interface
+ * @adv.max_fdbs: Maximum Number of FDB's; 0 - indicates default 16
+ * @adv.max_fdb_entries: Number of FDB entries for default FDB table;
+ * 0 - indicates default 1024 entries.
+ * @adv.fdb_aging_time: Default FDB aging time for default FDB table;
+ * 0 - indicates default 300 seconds
+ * @adv.max_fdb_mc_groups: Number of multicast groups in each FDB table;
+ * 0 - indicates default 32
+ * @adv.component_type: Indicates the component type of this bridge
  */
 struct dpsw_cfg {
u16 num_ifs;
-   /**
-* struct adv - Advanced parameters
-* @options: Enable/Disable DPSW features (bitmap)
-* @max_vlans: Maximum Number of VLAN's; 0 - indicates default 16
-* @max_meters_per_if: Number of meters per interface
-* @max_fdbs: Maximum Number of FDB's; 0 - indicates default 16
-* @max_fdb_entries: Number of FDB entries for default FDB table;
-*  0 - indicates default 1024 entries.
-* @fdb_aging_time: Default FDB aging time for default FDB table;
-*  0 - indicates default 300 seconds
-* @max_fdb_mc_groups: Number of multicast groups in each FDB table;
-*  0 - indicates default 32
-* @component_type: Indicates the component type of this bridge
-*/
struct {
u64 options;
u16 max_vlans;
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 0/2] staging: fsl-dpaa2: document nested structs as per kernel-doc

2018-07-27 Thread Ioana Ciornei
Document nested structs per kernel-doc requirements by moving
all comments before the actual struct.

Changes in v2:
 - remove comments of non-existent fields

Ioana Ciornei (2):
  staging: fsl-dpaa2/eth: document nested structs as per kernel-doc
  staging: fsl-dpaa2/ethsw: document nested structs as per kernel-doc

 drivers/staging/fsl-dpaa2/ethernet/dpkg.h |  70 +++-
 drivers/staging/fsl-dpaa2/ethernet/dpni.h | 129 +-
 drivers/staging/fsl-dpaa2/ethsw/dpsw.h|  27 +++
 3 files changed, 111 insertions(+), 115 deletions(-)

-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/2] staging: fsl-dpaa2/eth: document nested structs as per kernel-doc

2018-07-27 Thread Ioana Ciornei
Document nested structs per kernel-doc requirements by moving
all comments before the actual struct.

Signed-off-by: Ioana Ciornei 
---
 drivers/staging/fsl-dpaa2/ethernet/dpkg.h |  70 ++-
 drivers/staging/fsl-dpaa2/ethernet/dpni.h | 145 ++
 2 files changed, 115 insertions(+), 100 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpkg.h 
b/drivers/staging/fsl-dpaa2/ethernet/dpkg.h
index 02290a0..8057a25 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpkg.h
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpkg.h
@@ -89,45 +89,41 @@ struct dpkg_mask {
 /**
  * struct dpkg_extract - A structure for defining a single extraction
  * @type: Determines how the union below is interpreted:
- * DPKG_EXTRACT_FROM_HDR: selects 'from_hdr';
- * DPKG_EXTRACT_FROM_DATA: selects 'from_data';
- * DPKG_EXTRACT_FROM_PARSE: selects 'from_parse'
+ * DPKG_EXTRACT_FROM_HDR: selects 'from_hdr';
+ * DPKG_EXTRACT_FROM_DATA: selects 'from_data';
+ * DPKG_EXTRACT_FROM_PARSE: selects 'from_parse'
  * @extract: Selects extraction method
+ * @extract.from_hdr: Used when 'type = DPKG_EXTRACT_FROM_HDR'
+ * @extract.from_data: Used when 'type = DPKG_EXTRACT_FROM_DATA'
+ * @extract.from_parse:  Used when 'type = DPKG_EXTRACT_FROM_PARSE'
+ * @extract.from_hdr.prot: Any of the supported headers
+ * @extract.from_hdr.type: Defines the type of header extraction:
+ * DPKG_FROM_HDR: use size & offset below;
+ * DPKG_FROM_FIELD: use field, size and offset below;
+ * DPKG_FULL_FIELD: use field below
+ * @extract.from_hdr.field: One of the supported fields (NH_FLD_)
+ * @extract.from_hdr.size: Size in bytes
+ * @extract.from_hdr.offset: Byte offset
+ * @extract.from_hdr.hdr_index: Clear for cases not listed below;
+ * Used for protocols that may have more than a single
+ * header, 0 indicates an outer header;
+ * Supported protocols (possible values):
+ * NET_PROT_VLAN (0, HDR_INDEX_LAST);
+ * NET_PROT_MPLS (0, 1, HDR_INDEX_LAST);
+ * NET_PROT_IP(0, HDR_INDEX_LAST);
+ * NET_PROT_IPv4(0, HDR_INDEX_LAST);
+ * NET_PROT_IPv6(0, HDR_INDEX_LAST);
+ * @extract.from_data.size: Size in bytes
+ * @extract.from_data.offset: Byte offset
+ * @extract.from_parse.size: Size in bytes
+ * @extract.from_parse.offset: Byte offset
  * @num_of_byte_masks: Defines the number of valid entries in the array below;
  * This is also the number of bytes to be used as masks
  * @masks: Masks parameters
  */
 struct dpkg_extract {
enum dpkg_extract_type type;
-   /**
-* union extract - Selects extraction method
-* @from_hdr - Used when 'type = DPKG_EXTRACT_FROM_HDR'
-* @from_data - Used when 'type = DPKG_EXTRACT_FROM_DATA'
-* @from_parse - Used when 'type = DPKG_EXTRACT_FROM_PARSE'
-*/
union {
-   /**
-* struct from_hdr - Used when 'type = DPKG_EXTRACT_FROM_HDR'
-* @prot: Any of the supported headers
-* @type: Defines the type of header extraction:
-*  DPKG_FROM_HDR: use size & offset below;
-*  DPKG_FROM_FIELD: use field, size and offset below;
-*  DPKG_FULL_FIELD: use field below
-* @field: One of the supported fields (NH_FLD_)
-*
-* @size: Size in bytes
-* @offset: Byte offset
-* @hdr_index: Clear for cases not listed below;
-*  Used for protocols that may have more than a single
-*  header, 0 indicates an outer header;
-*  Supported protocols (possible values):
-*  NET_PROT_VLAN (0, HDR_INDEX_LAST);
-*  NET_PROT_MPLS (0, 1, HDR_INDEX_LAST);
-*  NET_PROT_IP(0, HDR_INDEX_LAST);
-*  NET_PROT_IPv4(0, HDR_INDEX_LAST);
-*  NET_PROT_IPv6(0, HDR_INDEX_LAST);
-*/
-
struct {
enum net_prot   prot;
enum dpkg_extract_from_hdr_type type;
@@ -136,22 +132,10 @@ struct dpkg_extract {
u8  offset;
u8  hdr_index;
} from_hdr;
-   /**
-* struct from_data - Used when 'type = DPKG_EXTRACT_FROM_DATA'
-* @size: Size in bytes
-* @offset: Byte offset
-*/
struct {
u8 size;
u8 offset;
} from_data;
-
-   /**
-* struct from_parse - Used when
-* 'type = DPKG_EXTRACT_FROM_PARSE'
-* @size: Size in bytes
-* @offset: Byte offset
-*/
struct {
   

[PATCH 2/2] staging: fsl-dpaa2/ethsw: document nested structs as per kernel-doc

2018-07-27 Thread Ioana Ciornei
Document nested structs per kernel-doc requirements by moving
all comments before the actual struct.

Signed-off-by: Ioana Ciornei 
---
 drivers/staging/fsl-dpaa2/ethsw/dpsw.h | 27 ---
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethsw/dpsw.h 
b/drivers/staging/fsl-dpaa2/ethsw/dpsw.h
index 82f80c40..db43fa3 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/dpsw.h
+++ b/drivers/staging/fsl-dpaa2/ethsw/dpsw.h
@@ -79,24 +79,21 @@ enum dpsw_component_type {
  * struct dpsw_cfg - DPSW configuration
  * @num_ifs: Number of external and internal interfaces
  * @adv: Advanced parameters; default is all zeros;
- *  use this structure to change default settings
+ *  use this structure to change default settings
+ * @adv.options: Enable/Disable DPSW features (bitmap)
+ * @adv.max_vlans: Maximum Number of VLAN's; 0 - indicates default 16
+ * @adv.max_meters_per_if: Number of meters per interface
+ * @adv.max_fdbs: Maximum Number of FDB's; 0 - indicates default 16
+ * @adv.max_fdb_entries: Number of FDB entries for default FDB table;
+ * 0 - indicates default 1024 entries.
+ * @adv.fdb_aging_time: Default FDB aging time for default FDB table;
+ * 0 - indicates default 300 seconds
+ * @adv.max_fdb_mc_groups: Number of multicast groups in each FDB table;
+ * 0 - indicates default 32
+ * @adv.component_type: Indicates the component type of this bridge
  */
 struct dpsw_cfg {
u16 num_ifs;
-   /**
-* struct adv - Advanced parameters
-* @options: Enable/Disable DPSW features (bitmap)
-* @max_vlans: Maximum Number of VLAN's; 0 - indicates default 16
-* @max_meters_per_if: Number of meters per interface
-* @max_fdbs: Maximum Number of FDB's; 0 - indicates default 16
-* @max_fdb_entries: Number of FDB entries for default FDB table;
-*  0 - indicates default 1024 entries.
-* @fdb_aging_time: Default FDB aging time for default FDB table;
-*  0 - indicates default 300 seconds
-* @max_fdb_mc_groups: Number of multicast groups in each FDB table;
-*  0 - indicates default 32
-* @component_type: Indicates the component type of this bridge
-*/
struct {
u64 options;
u16 max_vlans;
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/2] staging: fsl-dpaa2: document nested structs as per kernel-doc

2018-07-27 Thread Ioana Ciornei
Document nested structs per kernel-doc requirements by moving
all comments before the actual struct.

Ioana Ciornei (2):
  staging: fsl-dpaa2/eth: document nested structs as per kernel-doc
  staging: fsl-dpaa2/ethsw: document nested structs as per kernel-doc

 drivers/staging/fsl-dpaa2/ethernet/dpkg.h |  70 ++-
 drivers/staging/fsl-dpaa2/ethernet/dpni.h | 145 ++
 drivers/staging/fsl-dpaa2/ethsw/dpsw.h|  27 +++---
 3 files changed, 127 insertions(+), 115 deletions(-)

-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: Patch procedure

2016-11-15 Thread Ioana Ciornei

> -Original Message-
> From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel-
> ow...@vger.kernel.org] On Behalf Of feas
> Sent: Monday, November 14, 2016 7:16 PM
> To: de...@driverdev.osuosl.org; gre...@linuxfoundation.org; linux-
> ker...@vger.kernel.org
> Subject: Patch procedure
> 



I know you mentioned the kernel newbies page but just in case you missed this 
toturial, here is a link https://kernelnewbies.org/FirstKernelPatch. It has all 
the necessary info for you to submit a proper patch set.

Ioana C
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel