Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

staging: dpaa2-switch: make sure that the VLAN is not already configured

When in the PREPARE state of a switchdev transaction, check if the
requested VLAN is not already configured on the switch port. This keeps
us from getting into a WARNING as below.

[ 1389.683296] dpaa2_ethsw dpsw.0 eth0: VLAN 2 already configured
[ 1389.689125] ------------[ cut here ]------------
[ 1389.694084] eth0: Commit of object (id=1) failed.
[ 1389.698863] WARNING: CPU: 0 PID: 613 at net/switchdev/switchdev.c:277 switchdev_port_obj_add_now+0xcc/0x110
[ 1389.708589] Modules linked in:
[ 1389.711634] CPU: 0 PID: 613 Comm: bridge Not tainted 5.9.0-rc2-next-20200828-00112-g7172078477c5 #59
[ 1389.720753] Hardware name: NXP Layerscape LX2160ARDB (DT)
[ 1389.726139] pstate: 40000005 (nZcv daif -PAN -UAO BTYPE=--)
[ 1389.731698] pc : switchdev_port_obj_add_now+0xcc/0x110
[ 1389.736824] lr : switchdev_port_obj_add_now+0xcc/0x110

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/20201119165017.806696-3-ciorneiioana@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Ioana Ciornei and committed by
Greg Kroah-Hartman
dab48127 54289aad

+8 -1
+8 -1
drivers/staging/fsl-dpaa2/ethsw/ethsw.c
··· 984 984 int vid, err = 0, new_vlans = 0; 985 985 986 986 if (switchdev_trans_ph_prepare(trans)) { 987 - for (vid = vlan->vid_begin; vid <= vlan->vid_end; vid++) 987 + for (vid = vlan->vid_begin; vid <= vlan->vid_end; vid++) { 988 988 if (!port_priv->ethsw_data->vlans[vid]) 989 989 new_vlans++; 990 + 991 + /* Make sure that the VLAN is not already configured 992 + * on the switch port 993 + */ 994 + if (port_priv->vlans[vid] & ETHSW_VLAN_MEMBER) 995 + return -EEXIST; 996 + } 990 997 991 998 /* Check if there is space for a new VLAN */ 992 999 err = dpsw_get_attributes(ethsw->mc_io, 0, ethsw->dpsw_handle,