* [patch net-next v2 0/8] mlxsw: add offload support for vlan_filtering option
@ 2016-01-06 12:01 Jiri Pirko
2016-01-06 12:01 ` [patch net-next v2 1/8] bridge: Propagate vlan add failure to user Jiri Pirko
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: Jiri Pirko @ 2016-01-06 12:01 UTC (permalink / raw)
To: netdev; +Cc: davem, idosch, eladr, yotamg, ogerlitz, stephen
From: Jiri Pirko <jiri@mellanox.com>
Elad says:
This patch adds SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING port attribute.
When a bridge is offloaded to hardware, the hardware can learn if the bridge is
.1Q bridge (VLAN-aware) or not VLAN aware bridge.
In order to toggle the mode a user can use sysfs:
$ echo 1 > /sys/devices/virtual/net/br0/bridge/vlan_filtering
or via iproute2:
$ ip link set dev br0 type bridge vlan_filtering 1
---
v1->v2: small fix in patch #1
Elad Raz (8):
bridge: Propagate vlan add failure to user
switchdev: add bridge vlan_filtering attribute
bridge: add vlan filtering change notification
bridge: add vlan filtering change for new bridged device
mlxsw: Fixing vlans init range
mlxsw: Renaming local variable names for consistency
mlxsw: Disable vlan_filtering for non .1D bridge
mlxsw: Remember untagged VLANs
drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 8 +++++
drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 1 +
.../ethernet/mellanox/mlxsw/spectrum_switchdev.c | 39 +++++++++++++++++++---
include/net/switchdev.h | 2 ++
net/bridge/br_if.c | 11 +++++-
net/bridge/br_vlan.c | 29 ++++++++++++++--
6 files changed, 82 insertions(+), 8 deletions(-)
--
1.9.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [patch net-next v2 1/8] bridge: Propagate vlan add failure to user
2016-01-06 12:01 [patch net-next v2 0/8] mlxsw: add offload support for vlan_filtering option Jiri Pirko
@ 2016-01-06 12:01 ` Jiri Pirko
2016-01-06 12:01 ` [patch net-next v2 2/8] switchdev: add bridge vlan_filtering attribute Jiri Pirko
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Jiri Pirko @ 2016-01-06 12:01 UTC (permalink / raw)
To: netdev; +Cc: davem, idosch, eladr, yotamg, ogerlitz, stephen
From: Elad Raz <eladr@mellanox.com>
Disallow adding interfaces to a bridge when vlan filtering operation
failed. Send the failure code to the user.
Signed-off-by: Elad Raz <eladr@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
v1->v2: set err to return value of nbp_vlan_init
---
net/bridge/br_if.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 8d1d4a2..c367b3e 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -511,8 +511,11 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
if (br_fdb_insert(br, p, dev->dev_addr, 0))
netdev_err(dev, "failed insert local address bridge forwarding table\n");
- if (nbp_vlan_init(p))
+ err = nbp_vlan_init(p);
+ if (err) {
netdev_err(dev, "failed to initialize vlan filtering on this port\n");
+ goto err6;
+ }
spin_lock_bh(&br->lock);
changed_addr = br_stp_recalculate_bridge_id(br);
@@ -533,6 +536,12 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
return 0;
+err6:
+ list_del_rcu(&p->list);
+ br_fdb_delete_by_port(br, p, 0, 1);
+ nbp_update_port_count(br);
+ netdev_upper_dev_unlink(dev, br->dev);
+
err5:
dev->priv_flags &= ~IFF_BRIDGE_PORT;
netdev_rx_handler_unregister(dev);
--
1.9.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [patch net-next v2 2/8] switchdev: add bridge vlan_filtering attribute
2016-01-06 12:01 [patch net-next v2 0/8] mlxsw: add offload support for vlan_filtering option Jiri Pirko
2016-01-06 12:01 ` [patch net-next v2 1/8] bridge: Propagate vlan add failure to user Jiri Pirko
@ 2016-01-06 12:01 ` Jiri Pirko
2016-01-06 12:01 ` [patch net-next v2 3/8] bridge: add vlan filtering change notification Jiri Pirko
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Jiri Pirko @ 2016-01-06 12:01 UTC (permalink / raw)
To: netdev; +Cc: davem, idosch, eladr, yotamg, ogerlitz, stephen
From: Elad Raz <eladr@mellanox.com>
Adding vlan_filtering attribute to allow hardware vendor to support
vlan-aware bridges. Vlan_filtering is a per-bridge attribute.
Signed-off-by: Elad Raz <eladr@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
include/net/switchdev.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index 6612946..603ae2f 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -47,6 +47,7 @@ enum switchdev_attr_id {
SWITCHDEV_ATTR_ID_PORT_STP_STATE,
SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS,
SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME,
+ SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING,
};
struct switchdev_attr {
@@ -58,6 +59,7 @@ struct switchdev_attr {
u8 stp_state; /* PORT_STP_STATE */
unsigned long brport_flags; /* PORT_BRIDGE_FLAGS */
u32 ageing_time; /* BRIDGE_AGEING_TIME */
+ bool vlan_filtering; /* BRIDGE_VLAN_FILTERING */
} u;
};
--
1.9.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [patch net-next v2 3/8] bridge: add vlan filtering change notification
2016-01-06 12:01 [patch net-next v2 0/8] mlxsw: add offload support for vlan_filtering option Jiri Pirko
2016-01-06 12:01 ` [patch net-next v2 1/8] bridge: Propagate vlan add failure to user Jiri Pirko
2016-01-06 12:01 ` [patch net-next v2 2/8] switchdev: add bridge vlan_filtering attribute Jiri Pirko
@ 2016-01-06 12:01 ` Jiri Pirko
2016-01-06 12:01 ` [patch net-next v2 4/8] bridge: add vlan filtering change for new bridged device Jiri Pirko
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Jiri Pirko @ 2016-01-06 12:01 UTC (permalink / raw)
To: netdev; +Cc: davem, idosch, eladr, yotamg, ogerlitz, stephen
From: Elad Raz <eladr@mellanox.com>
Notifying hardware about bridge vlan-aware changes.
Signed-off-by: Elad Raz <eladr@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
net/bridge/br_vlan.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index 66c4549..190fb33 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -626,9 +626,21 @@ void br_recalculate_fwd_mask(struct net_bridge *br)
int __br_vlan_filter_toggle(struct net_bridge *br, unsigned long val)
{
+ struct switchdev_attr attr = {
+ .orig_dev = br->dev,
+ .id = SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING,
+ .flags = SWITCHDEV_F_SKIP_EOPNOTSUPP,
+ .u.vlan_filtering = val,
+ };
+ int err;
+
if (br->vlan_enabled == val)
return 0;
+ err = switchdev_port_attr_set(br->dev, &attr);
+ if (err && err != -EOPNOTSUPP)
+ return err;
+
br->vlan_enabled = val;
br_manage_promisc(br);
recalculate_group_addr(br);
@@ -639,13 +651,15 @@ int __br_vlan_filter_toggle(struct net_bridge *br, unsigned long val)
int br_vlan_filter_toggle(struct net_bridge *br, unsigned long val)
{
+ int err;
+
if (!rtnl_trylock())
return restart_syscall();
- __br_vlan_filter_toggle(br, val);
+ err = __br_vlan_filter_toggle(br, val);
rtnl_unlock();
- return 0;
+ return err;
}
int __br_vlan_set_proto(struct net_bridge *br, __be16 proto)
--
1.9.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [patch net-next v2 4/8] bridge: add vlan filtering change for new bridged device
2016-01-06 12:01 [patch net-next v2 0/8] mlxsw: add offload support for vlan_filtering option Jiri Pirko
` (2 preceding siblings ...)
2016-01-06 12:01 ` [patch net-next v2 3/8] bridge: add vlan filtering change notification Jiri Pirko
@ 2016-01-06 12:01 ` Jiri Pirko
2016-01-06 12:01 ` [patch net-next v2 5/8] mlxsw: Fixing vlans init range Jiri Pirko
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Jiri Pirko @ 2016-01-06 12:01 UTC (permalink / raw)
To: netdev; +Cc: davem, idosch, eladr, yotamg, ogerlitz, stephen
From: Elad Raz <eladr@mellanox.com>
Notifying hardware about newly bridged port vlan-aware changes.
Signed-off-by: Elad Raz <eladr@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
net/bridge/br_vlan.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index 190fb33..85e43af 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -907,6 +907,12 @@ err_rhtbl:
int nbp_vlan_init(struct net_bridge_port *p)
{
+ struct switchdev_attr attr = {
+ .orig_dev = p->br->dev,
+ .id = SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING,
+ .flags = SWITCHDEV_F_SKIP_EOPNOTSUPP,
+ .u.vlan_filtering = p->br->vlan_enabled,
+ };
struct net_bridge_vlan_group *vg;
int ret = -ENOMEM;
@@ -914,6 +920,10 @@ int nbp_vlan_init(struct net_bridge_port *p)
if (!vg)
goto out;
+ ret = switchdev_port_attr_set(p->dev, &attr);
+ if (ret && ret != -EOPNOTSUPP)
+ goto err_vlan_enabled;
+
ret = rhashtable_init(&vg->vlan_hash, &br_vlan_rht_params);
if (ret)
goto err_rhtbl;
@@ -933,6 +943,7 @@ err_vlan_add:
RCU_INIT_POINTER(p->vlgrp, NULL);
synchronize_rcu();
rhashtable_destroy(&vg->vlan_hash);
+err_vlan_enabled:
err_rhtbl:
kfree(vg);
--
1.9.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [patch net-next v2 5/8] mlxsw: Fixing vlans init range
2016-01-06 12:01 [patch net-next v2 0/8] mlxsw: add offload support for vlan_filtering option Jiri Pirko
` (3 preceding siblings ...)
2016-01-06 12:01 ` [patch net-next v2 4/8] bridge: add vlan filtering change for new bridged device Jiri Pirko
@ 2016-01-06 12:01 ` Jiri Pirko
2016-01-06 12:01 ` [patch net-next v2 6/8] mlxsw: Renaming local variable names for consistency Jiri Pirko
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Jiri Pirko @ 2016-01-06 12:01 UTC (permalink / raw)
To: netdev; +Cc: davem, idosch, eladr, yotamg, ogerlitz, stephen
From: Elad Raz <eladr@mellanox.com>
Initialize VLANs 0..4095 (Remove init for VID 4096).
Signed-off-by: Elad Raz <eladr@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index 6215954..dcf77c9 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -1201,7 +1201,8 @@ int mlxsw_sp_port_vlan_init(struct mlxsw_sp_port *mlxsw_sp_port)
* with VID 1.
*/
mlxsw_sp_port->pvid = 1;
- err = __mlxsw_sp_port_vlans_del(mlxsw_sp_port, 0, VLAN_N_VID, true);
+ err = __mlxsw_sp_port_vlans_del(mlxsw_sp_port, 0, VLAN_N_VID - 1,
+ true);
if (err) {
netdev_err(dev, "Unable to init VLANs\n");
return err;
--
1.9.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [patch net-next v2 6/8] mlxsw: Renaming local variable names for consistency
2016-01-06 12:01 [patch net-next v2 0/8] mlxsw: add offload support for vlan_filtering option Jiri Pirko
` (4 preceding siblings ...)
2016-01-06 12:01 ` [patch net-next v2 5/8] mlxsw: Fixing vlans init range Jiri Pirko
@ 2016-01-06 12:01 ` Jiri Pirko
2016-01-06 12:01 ` [patch net-next v2 7/8] mlxsw: Disable vlan_filtering for non .1D bridge Jiri Pirko
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Jiri Pirko @ 2016-01-06 12:01 UTC (permalink / raw)
To: netdev; +Cc: davem, idosch, eladr, yotamg, ogerlitz, stephen
From: Elad Raz <eladr@mellanox.com>
Signed-off-by: Elad Raz <eladr@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index dcf77c9..ad1bf7f 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -545,15 +545,15 @@ static int mlxsw_sp_port_vlans_add(struct mlxsw_sp_port *mlxsw_sp_port,
const struct switchdev_obj_port_vlan *vlan,
struct switchdev_trans *trans)
{
- bool untagged_flag = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED;
- bool pvid_flag = vlan->flags & BRIDGE_VLAN_INFO_PVID;
+ bool flag_untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED;
+ bool flag_pvid = vlan->flags & BRIDGE_VLAN_INFO_PVID;
if (switchdev_trans_ph_prepare(trans))
return 0;
return __mlxsw_sp_port_vlans_add(mlxsw_sp_port,
vlan->vid_begin, vlan->vid_end,
- untagged_flag, pvid_flag);
+ flag_untagged, flag_pvid);
}
static enum mlxsw_reg_sfd_rec_policy mlxsw_sp_sfd_rec_policy(bool dynamic)
--
1.9.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [patch net-next v2 7/8] mlxsw: Disable vlan_filtering for non .1D bridge
2016-01-06 12:01 [patch net-next v2 0/8] mlxsw: add offload support for vlan_filtering option Jiri Pirko
` (5 preceding siblings ...)
2016-01-06 12:01 ` [patch net-next v2 6/8] mlxsw: Renaming local variable names for consistency Jiri Pirko
@ 2016-01-06 12:01 ` Jiri Pirko
2016-01-06 12:01 ` [patch net-next v2 8/8] mlxsw: Remember untagged VLANs Jiri Pirko
2016-01-06 19:43 ` [patch net-next v2 0/8] mlxsw: add offload support for vlan_filtering option David Miller
8 siblings, 0 replies; 10+ messages in thread
From: Jiri Pirko @ 2016-01-06 12:01 UTC (permalink / raw)
To: netdev; +Cc: davem, idosch, eladr, yotamg, ogerlitz, stephen
From: Elad Raz <eladr@mellanox.com>
When a port is bridged, the bridge must be vlan aware bridge (.1Q)
or the bridging should be on top of VLAN interfaces (.1D bridge).
Signed-off-by: Elad Raz <eladr@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
.../ethernet/mellanox/mlxsw/spectrum_switchdev.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index ad1bf7f..d6242cf 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -299,6 +299,22 @@ static int mlxsw_sp_port_attr_br_ageing_set(struct mlxsw_sp_port *mlxsw_sp_port,
return mlxsw_sp_ageing_set(mlxsw_sp, ageing_time);
}
+static int mlxsw_sp_port_attr_br_vlan_set(struct mlxsw_sp_port *mlxsw_sp_port,
+ struct switchdev_trans *trans,
+ struct net_device *orig_dev,
+ bool vlan_enabled)
+{
+ struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
+
+ /* SWITCHDEV_TRANS_PREPARE phase */
+ if ((!vlan_enabled) && (mlxsw_sp->master_bridge.dev == orig_dev)) {
+ netdev_err(mlxsw_sp_port->dev, "Bridge must be vlan-aware\n");
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
static int mlxsw_sp_port_attr_set(struct net_device *dev,
const struct switchdev_attr *attr,
struct switchdev_trans *trans)
@@ -323,6 +339,11 @@ static int mlxsw_sp_port_attr_set(struct net_device *dev,
err = mlxsw_sp_port_attr_br_ageing_set(mlxsw_sp_port, trans,
attr->u.ageing_time);
break;
+ case SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING:
+ err = mlxsw_sp_port_attr_br_vlan_set(mlxsw_sp_port, trans,
+ attr->orig_dev,
+ attr->u.vlan_filtering);
+ break;
default:
err = -EOPNOTSUPP;
break;
--
1.9.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [patch net-next v2 8/8] mlxsw: Remember untagged VLANs
2016-01-06 12:01 [patch net-next v2 0/8] mlxsw: add offload support for vlan_filtering option Jiri Pirko
` (6 preceding siblings ...)
2016-01-06 12:01 ` [patch net-next v2 7/8] mlxsw: Disable vlan_filtering for non .1D bridge Jiri Pirko
@ 2016-01-06 12:01 ` Jiri Pirko
2016-01-06 19:43 ` [patch net-next v2 0/8] mlxsw: add offload support for vlan_filtering option David Miller
8 siblings, 0 replies; 10+ messages in thread
From: Jiri Pirko @ 2016-01-06 12:01 UTC (permalink / raw)
To: netdev; +Cc: davem, idosch, eladr, yotamg, ogerlitz, stephen
From: Elad Raz <eladr@mellanox.com>
When a vlan is been configured, remeber the untagged mode of the vlan.
When displaying the list of configured VLANs, show the untagged attribute.
Signed-off-by: Elad Raz <eladr@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 8 ++++++++
drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 1 +
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 9 ++++++++-
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 74ff011..b6f3650 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -1370,6 +1370,11 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port)
err = -ENOMEM;
goto err_port_active_vlans_alloc;
}
+ mlxsw_sp_port->untagged_vlans = kzalloc(bytes, GFP_KERNEL);
+ if (!mlxsw_sp_port->untagged_vlans) {
+ err = -ENOMEM;
+ goto err_port_untagged_vlans_alloc;
+ }
INIT_LIST_HEAD(&mlxsw_sp_port->vports_list);
mlxsw_sp_port->pcpu_stats =
@@ -1472,6 +1477,8 @@ err_port_module_check:
err_dev_addr_init:
free_percpu(mlxsw_sp_port->pcpu_stats);
err_alloc_stats:
+ kfree(mlxsw_sp_port->untagged_vlans);
+err_port_untagged_vlans_alloc:
kfree(mlxsw_sp_port->active_vlans);
err_port_active_vlans_alloc:
free_netdev(dev);
@@ -1505,6 +1512,7 @@ static void mlxsw_sp_port_remove(struct mlxsw_sp *mlxsw_sp, u8 local_port)
mlxsw_sp_port_vports_fini(mlxsw_sp_port);
mlxsw_sp_port_switchdev_fini(mlxsw_sp_port);
free_percpu(mlxsw_sp_port->pcpu_stats);
+ kfree(mlxsw_sp_port->untagged_vlans);
kfree(mlxsw_sp_port->active_vlans);
free_netdev(mlxsw_sp_port->dev);
}
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
index 463ed6d..7601789 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
@@ -144,6 +144,7 @@ struct mlxsw_sp_port {
} vport;
/* 802.1Q bridge VLANs */
unsigned long *active_vlans;
+ unsigned long *untagged_vlans;
/* VLAN interfaces */
struct list_head vports_list;
};
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index d6242cf..614ef57 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -526,8 +526,13 @@ static int __mlxsw_sp_port_vlans_add(struct mlxsw_sp_port *mlxsw_sp_port,
}
/* Changing activity bits only if HW operation succeded */
- for (vid = vid_begin; vid <= vid_end; vid++)
+ for (vid = vid_begin; vid <= vid_end; vid++) {
set_bit(vid, mlxsw_sp_port->active_vlans);
+ if (flag_untagged)
+ set_bit(vid, mlxsw_sp_port->untagged_vlans);
+ else
+ clear_bit(vid, mlxsw_sp_port->untagged_vlans);
+ }
/* STP state change must be done after we set active VLANs */
err = mlxsw_sp_port_stp_state_set(mlxsw_sp_port,
@@ -954,6 +959,8 @@ static int mlxsw_sp_port_vlan_dump(struct mlxsw_sp_port *mlxsw_sp_port,
vlan->flags = 0;
if (vid == mlxsw_sp_port->pvid)
vlan->flags |= BRIDGE_VLAN_INFO_PVID;
+ if (test_bit(vid, mlxsw_sp_port->untagged_vlans))
+ vlan->flags |= BRIDGE_VLAN_INFO_UNTAGGED;
vlan->vid_begin = vid;
vlan->vid_end = vid;
err = cb(&vlan->obj);
--
1.9.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [patch net-next v2 0/8] mlxsw: add offload support for vlan_filtering option
2016-01-06 12:01 [patch net-next v2 0/8] mlxsw: add offload support for vlan_filtering option Jiri Pirko
` (7 preceding siblings ...)
2016-01-06 12:01 ` [patch net-next v2 8/8] mlxsw: Remember untagged VLANs Jiri Pirko
@ 2016-01-06 19:43 ` David Miller
8 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2016-01-06 19:43 UTC (permalink / raw)
To: jiri; +Cc: netdev, idosch, eladr, yotamg, ogerlitz, stephen
From: Jiri Pirko <jiri@resnulli.us>
Date: Wed, 6 Jan 2016 13:01:03 +0100
> From: Jiri Pirko <jiri@mellanox.com>
>
> Elad says:
>
> This patch adds SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING port attribute.
> When a bridge is offloaded to hardware, the hardware can learn if the bridge is
> .1Q bridge (VLAN-aware) or not VLAN aware bridge.
> In order to toggle the mode a user can use sysfs:
> $ echo 1 > /sys/devices/virtual/net/br0/bridge/vlan_filtering
> or via iproute2:
> $ ip link set dev br0 type bridge vlan_filtering 1
>
> ---
> v1->v2: small fix in patch #1
Series applied, thanks Jiri and Elad.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-01-06 19:43 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-06 12:01 [patch net-next v2 0/8] mlxsw: add offload support for vlan_filtering option Jiri Pirko
2016-01-06 12:01 ` [patch net-next v2 1/8] bridge: Propagate vlan add failure to user Jiri Pirko
2016-01-06 12:01 ` [patch net-next v2 2/8] switchdev: add bridge vlan_filtering attribute Jiri Pirko
2016-01-06 12:01 ` [patch net-next v2 3/8] bridge: add vlan filtering change notification Jiri Pirko
2016-01-06 12:01 ` [patch net-next v2 4/8] bridge: add vlan filtering change for new bridged device Jiri Pirko
2016-01-06 12:01 ` [patch net-next v2 5/8] mlxsw: Fixing vlans init range Jiri Pirko
2016-01-06 12:01 ` [patch net-next v2 6/8] mlxsw: Renaming local variable names for consistency Jiri Pirko
2016-01-06 12:01 ` [patch net-next v2 7/8] mlxsw: Disable vlan_filtering for non .1D bridge Jiri Pirko
2016-01-06 12:01 ` [patch net-next v2 8/8] mlxsw: Remember untagged VLANs Jiri Pirko
2016-01-06 19:43 ` [patch net-next v2 0/8] mlxsw: add offload support for vlan_filtering option 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).