netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch net-next 0/3] mlxsw: small driver update, including switchdev doc update
@ 2016-04-05  8:20 Jiri Pirko
  2016-04-05  8:20 ` [patch net-next 1/3] mlxsw: spectrum: Reduce number of supported 802.1D bridges Jiri Pirko
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Jiri Pirko @ 2016-04-05  8:20 UTC (permalink / raw)
  To: netdev
  Cc: davem, idosch, eladr, yotamg, ogerlitz, roopa, gospo, corbet,
	sfeldma, nicolas.dichtel, vivien.didelot

From: Jiri Pirko <jiri@mellanox.com>

Ido Schimmel (3):
  mlxsw: spectrum: Reduce number of supported 802.1D bridges
  switchdev: Use switch ID in suggested udev rule
  mlxsw: spectrum: Add support for physical port names

 Documentation/networking/switchdev.txt         | 28 ++++++++--------
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 45 ++++++++++++++++++++++++--
 drivers/net/ethernet/mellanox/mlxsw/spectrum.h |  2 +-
 3 files changed, 57 insertions(+), 18 deletions(-)

-- 
2.5.5

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

* [patch net-next 1/3] mlxsw: spectrum: Reduce number of supported 802.1D bridges
  2016-04-05  8:20 [patch net-next 0/3] mlxsw: small driver update, including switchdev doc update Jiri Pirko
@ 2016-04-05  8:20 ` Jiri Pirko
  2016-05-18 12:40   ` Jiri Pirko
  2016-04-05  8:20 ` [patch net-next 2/3] switchdev: Use switch ID in suggested udev rule Jiri Pirko
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Jiri Pirko @ 2016-04-05  8:20 UTC (permalink / raw)
  To: netdev
  Cc: davem, idosch, eladr, yotamg, ogerlitz, roopa, gospo, corbet,
	sfeldma, nicolas.dichtel, vivien.didelot

From: Ido Schimmel <idosch@mellanox.com>

Resources allocated for these bridges at init time cannot be later used
for other purposes. While current number is supported by the device,
it's mostly theoretical with regards to any real use case, which leads
to poor utilization of device's resources. Solve that by reducing the
number.

The long term plan is to make this value (along with others) user
configurable via devlink and write it to NVRAM, so that it can be used
during the next init. Until then we must hardcode such values.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
index 4b8abaf..d58ab0c 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
@@ -50,7 +50,7 @@
 
 #define MLXSW_SP_VFID_BASE VLAN_N_VID
 #define MLXSW_SP_VFID_PORT_MAX 512	/* Non-bridged VLAN interfaces */
-#define MLXSW_SP_VFID_BR_MAX 8192	/* Bridged VLAN interfaces */
+#define MLXSW_SP_VFID_BR_MAX 6144	/* Bridged VLAN interfaces */
 #define MLXSW_SP_VFID_MAX (MLXSW_SP_VFID_PORT_MAX + MLXSW_SP_VFID_BR_MAX)
 
 #define MLXSW_SP_LAG_MAX 64
-- 
2.5.5

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

* [patch net-next 2/3] switchdev: Use switch ID in suggested udev rule
  2016-04-05  8:20 [patch net-next 0/3] mlxsw: small driver update, including switchdev doc update Jiri Pirko
  2016-04-05  8:20 ` [patch net-next 1/3] mlxsw: spectrum: Reduce number of supported 802.1D bridges Jiri Pirko
@ 2016-04-05  8:20 ` Jiri Pirko
  2016-04-05  8:20 ` [patch net-next 3/3] mlxsw: spectrum: Add support for physical port names Jiri Pirko
  2016-04-05 19:08 ` [patch net-next 0/3] mlxsw: small driver update, including switchdev doc update David Miller
  3 siblings, 0 replies; 7+ messages in thread
From: Jiri Pirko @ 2016-04-05  8:20 UTC (permalink / raw)
  To: netdev
  Cc: davem, idosch, eladr, yotamg, ogerlitz, roopa, gospo, corbet,
	sfeldma, nicolas.dichtel, vivien.didelot

From: Ido Schimmel <idosch@mellanox.com>

Since there can be multiple switch ASICs on the same system we should
use the switch ID in order to differentiate between them and set the
switch name (e.g. swX) accordingly.

Also, replace the order of the "Switch ID" and "Port Netdev Naming"
sections following the above change.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
 Documentation/networking/switchdev.txt | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/Documentation/networking/switchdev.txt b/Documentation/networking/switchdev.txt
index 2f65912..31c3911 100644
--- a/Documentation/networking/switchdev.txt
+++ b/Documentation/networking/switchdev.txt
@@ -89,6 +89,18 @@ Typically, the management port is not participating in offloaded data plane and
 is loaded with a different driver, such as a NIC driver, on the management port
 device.
 
+Switch ID
+^^^^^^^^^
+
+The switchdev driver must implement the switchdev op switchdev_port_attr_get
+for SWITCHDEV_ATTR_ID_PORT_PARENT_ID for each port netdev, returning the same
+physical ID for each port of a switch.  The ID must be unique between switches
+on the same system.  The ID does not need to be unique between switches on
+different systems.
+
+The switch ID is used to locate ports on a switch and to know if aggregated
+ports belong to the same switch.
+
 Port Netdev Naming
 ^^^^^^^^^^^^^^^^^^
 
@@ -104,25 +116,13 @@ external configuration.  For example, if a physical 40G port is split logically
 into 4 10G ports, resulting in 4 port netdevs, the device can give a unique
 name for each port using port PHYS name.  The udev rule would be:
 
-SUBSYSTEM=="net", ACTION=="add", DRIVER="<driver>", ATTR{phys_port_name}!="", \
-	NAME="$attr{phys_port_name}"
+SUBSYSTEM=="net", ACTION=="add", ATTR{phys_switch_id}=="<phys_switch_id>", \
+	ATTR{phys_port_name}!="", NAME="swX$attr{phys_port_name}"
 
 Suggested naming convention is "swXpYsZ", where X is the switch name or ID, Y
 is the port name or ID, and Z is the sub-port name or ID.  For example, sw1p1s0
 would be sub-port 0 on port 1 on switch 1.
 
-Switch ID
-^^^^^^^^^
-
-The switchdev driver must implement the switchdev op switchdev_port_attr_get
-for SWITCHDEV_ATTR_ID_PORT_PARENT_ID for each port netdev, returning the same
-physical ID for each port of a switch.  The ID must be unique between switches
-on the same system.  The ID does not need to be unique between switches on
-different systems.
-
-The switch ID is used to locate ports on a switch and to know if aggregated
-ports belong to the same switch.
-
 Port Features
 ^^^^^^^^^^^^^
 
-- 
2.5.5

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

* [patch net-next 3/3] mlxsw: spectrum: Add support for physical port names
  2016-04-05  8:20 [patch net-next 0/3] mlxsw: small driver update, including switchdev doc update Jiri Pirko
  2016-04-05  8:20 ` [patch net-next 1/3] mlxsw: spectrum: Reduce number of supported 802.1D bridges Jiri Pirko
  2016-04-05  8:20 ` [patch net-next 2/3] switchdev: Use switch ID in suggested udev rule Jiri Pirko
@ 2016-04-05  8:20 ` Jiri Pirko
  2016-04-05 19:08 ` [patch net-next 0/3] mlxsw: small driver update, including switchdev doc update David Miller
  3 siblings, 0 replies; 7+ messages in thread
From: Jiri Pirko @ 2016-04-05  8:20 UTC (permalink / raw)
  To: netdev
  Cc: davem, idosch, eladr, yotamg, ogerlitz, roopa, gospo, corbet,
	sfeldma, nicolas.dichtel, vivien.didelot

From: Ido Schimmel <idosch@mellanox.com>

Export to userspace the front panel name of the port, so that udev can
rename the ports accordingly. The convention suggested by switchdev
documentation is used:

1) Non-split: pX
2) Split: pXsY

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 45 ++++++++++++++++++++++++--
 1 file changed, 42 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 4afbc3e..cb5f36e 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -305,9 +305,9 @@ mlxsw_sp_port_system_port_mapping_set(struct mlxsw_sp_port *mlxsw_sp_port)
 	return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sspr), sspr_pl);
 }
 
-static int mlxsw_sp_port_module_info_get(struct mlxsw_sp *mlxsw_sp,
-					 u8 local_port, u8 *p_module,
-					 u8 *p_width)
+static int __mlxsw_sp_port_module_info_get(struct mlxsw_sp *mlxsw_sp,
+					   u8 local_port, u8 *p_module,
+					   u8 *p_width, u8 *p_lane)
 {
 	char pmlp_pl[MLXSW_REG_PMLP_LEN];
 	int err;
@@ -318,9 +318,20 @@ static int mlxsw_sp_port_module_info_get(struct mlxsw_sp *mlxsw_sp,
 		return err;
 	*p_module = mlxsw_reg_pmlp_module_get(pmlp_pl, 0);
 	*p_width = mlxsw_reg_pmlp_width_get(pmlp_pl);
+	*p_lane = mlxsw_reg_pmlp_tx_lane_get(pmlp_pl, 0);
 	return 0;
 }
 
+static int mlxsw_sp_port_module_info_get(struct mlxsw_sp *mlxsw_sp,
+					 u8 local_port, u8 *p_module,
+					 u8 *p_width)
+{
+	u8 lane;
+
+	return __mlxsw_sp_port_module_info_get(mlxsw_sp, local_port, p_module,
+					       p_width, &lane);
+}
+
 static int mlxsw_sp_port_module_map(struct mlxsw_sp *mlxsw_sp, u8 local_port,
 				    u8 module, u8 width, u8 lane)
 {
@@ -861,6 +872,33 @@ int mlxsw_sp_port_kill_vid(struct net_device *dev,
 	return 0;
 }
 
+static int mlxsw_sp_port_get_phys_port_name(struct net_device *dev, char *name,
+					    size_t len)
+{
+	struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
+	u8 module, width, lane;
+	int err;
+
+	err = __mlxsw_sp_port_module_info_get(mlxsw_sp_port->mlxsw_sp,
+					      mlxsw_sp_port->local_port,
+					      &module, &width, &lane);
+	if (err) {
+		netdev_err(dev, "Failed to retrieve module information\n");
+		return err;
+	}
+
+	if (!mlxsw_sp_port->split)
+		err = snprintf(name, len, "p%d", module + 1);
+	else
+		err = snprintf(name, len, "p%ds%d", module + 1,
+			       lane / width);
+
+	if (err >= len)
+		return -EINVAL;
+
+	return 0;
+}
+
 static const struct net_device_ops mlxsw_sp_port_netdev_ops = {
 	.ndo_open		= mlxsw_sp_port_open,
 	.ndo_stop		= mlxsw_sp_port_stop,
@@ -877,6 +915,7 @@ static const struct net_device_ops mlxsw_sp_port_netdev_ops = {
 	.ndo_bridge_setlink	= switchdev_port_bridge_setlink,
 	.ndo_bridge_getlink	= switchdev_port_bridge_getlink,
 	.ndo_bridge_dellink	= switchdev_port_bridge_dellink,
+	.ndo_get_phys_port_name	= mlxsw_sp_port_get_phys_port_name,
 };
 
 static void mlxsw_sp_port_get_drvinfo(struct net_device *dev,
-- 
2.5.5

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

* Re: [patch net-next 0/3] mlxsw: small driver update, including switchdev doc update
  2016-04-05  8:20 [patch net-next 0/3] mlxsw: small driver update, including switchdev doc update Jiri Pirko
                   ` (2 preceding siblings ...)
  2016-04-05  8:20 ` [patch net-next 3/3] mlxsw: spectrum: Add support for physical port names Jiri Pirko
@ 2016-04-05 19:08 ` David Miller
  3 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2016-04-05 19:08 UTC (permalink / raw)
  To: jiri
  Cc: netdev, idosch, eladr, yotamg, ogerlitz, roopa, gospo, corbet,
	sfeldma, nicolas.dichtel, vivien.didelot

From: Jiri Pirko <jiri@resnulli.us>
Date: Tue,  5 Apr 2016 10:20:01 +0200

> From: Jiri Pirko <jiri@mellanox.com>
> 
> Ido Schimmel (3):
>   mlxsw: spectrum: Reduce number of supported 802.1D bridges
>   switchdev: Use switch ID in suggested udev rule
>   mlxsw: spectrum: Add support for physical port names

Series applied, thanks Jiri.

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

* Re: [patch net-next 1/3] mlxsw: spectrum: Reduce number of supported 802.1D bridges
  2016-04-05  8:20 ` [patch net-next 1/3] mlxsw: spectrum: Reduce number of supported 802.1D bridges Jiri Pirko
@ 2016-05-18 12:40   ` Jiri Pirko
  2016-05-19  3:50     ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Jiri Pirko @ 2016-05-18 12:40 UTC (permalink / raw)
  To: davem
  Cc: netdev, idosch, eladr, yotamg, ogerlitz, roopa, gospo, corbet,
	sfeldma, nicolas.dichtel, vivien.didelot

Tue, Apr 05, 2016 at 10:20:02AM CEST, jiri@resnulli.us wrote:
>From: Ido Schimmel <idosch@mellanox.com>
>
>Resources allocated for these bridges at init time cannot be later used
>for other purposes. While current number is supported by the device,
>it's mostly theoretical with regards to any real use case, which leads
>to poor utilization of device's resources. Solve that by reducing the
>number.
>
>The long term plan is to make this value (along with others) user
>configurable via devlink and write it to NVRAM, so that it can be used
>during the next init. Until then we must hardcode such values.
>
>Signed-off-by: Ido Schimmel <idosch@mellanox.com>
>Signed-off-by: Jiri Pirko <jiri@mellanox.com>

Hi Dave.

This patch, commit b555cf4a50c17a9714715a2d7c8574dca1a7b356 ("mlxsw: spectrum:
Reduce number of supported 802.1D bridges") reduced the resources the
device allocates during init. Newer firmware versions now force a hard
limit on these resources and thus require this patch.

We would like to ask this commit be backported to stable kernels, so
that they can be used with newer firmware versions.

Thanks!

Jiri

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

* Re: [patch net-next 1/3] mlxsw: spectrum: Reduce number of supported 802.1D bridges
  2016-05-18 12:40   ` Jiri Pirko
@ 2016-05-19  3:50     ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2016-05-19  3:50 UTC (permalink / raw)
  To: jiri
  Cc: netdev, idosch, eladr, yotamg, ogerlitz, roopa, gospo, corbet,
	sfeldma, nicolas.dichtel, vivien.didelot

From: Jiri Pirko <jiri@resnulli.us>
Date: Wed, 18 May 2016 14:40:50 +0200

> This patch, commit b555cf4a50c17a9714715a2d7c8574dca1a7b356 ("mlxsw: spectrum:
> Reduce number of supported 802.1D bridges") reduced the resources the
> device allocates during init. Newer firmware versions now force a hard
> limit on these resources and thus require this patch.
> 
> We would like to ask this commit be backported to stable kernels, so
> that they can be used with newer firmware versions.

Breaking existing working drivers with a firmware update is a terrible
user experience, and in my opinion not a reason to do a -stable
backport.  Fix how you manage this stuff instead.

This new behavior should be requested by drivers that can handle it,
rather than retroactively forced upon existing setups.

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

end of thread, other threads:[~2016-05-19  3:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-05  8:20 [patch net-next 0/3] mlxsw: small driver update, including switchdev doc update Jiri Pirko
2016-04-05  8:20 ` [patch net-next 1/3] mlxsw: spectrum: Reduce number of supported 802.1D bridges Jiri Pirko
2016-05-18 12:40   ` Jiri Pirko
2016-05-19  3:50     ` David Miller
2016-04-05  8:20 ` [patch net-next 2/3] switchdev: Use switch ID in suggested udev rule Jiri Pirko
2016-04-05  8:20 ` [patch net-next 3/3] mlxsw: spectrum: Add support for physical port names Jiri Pirko
2016-04-05 19:08 ` [patch net-next 0/3] mlxsw: small driver update, including switchdev doc update David Miller

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