diff mbox series

[v4,net-next,2/5] net: dsa: Don't offload port attributes on standalone ports

Message ID 20201216160056.27526-3-tobias@waldekranz.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series net: dsa: Link aggregation support | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Tobias Waldekranz Dec. 16, 2020, 4 p.m. UTC
In a situation where a standalone port is indirectly attached to a
bridge (e.g. via a LAG) which is not offloaded, do not offload any
port attributes either. The port should behave as a standard NIC.

Previously, on mv88e6xxx, this meant that in the following setup:

     br0
     /
  team0
   / \
swp0 swp1

If vlan filtering was enabled on br0, swp0's and swp1's QMode was set
to "secure". This caused all untagged packets to be dropped, as their
default VID (0) was not loaded into the VTU.

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
---
 net/dsa/slave.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Vladimir Oltean Dec. 16, 2020, 4:27 p.m. UTC | #1
On Wed, Dec 16, 2020 at 05:00:53PM +0100, Tobias Waldekranz wrote:
> In a situation where a standalone port is indirectly attached to a
> bridge (e.g. via a LAG) which is not offloaded, do not offload any
> port attributes either. The port should behave as a standard NIC.
> 
> Previously, on mv88e6xxx, this meant that in the following setup:
> 
>      br0
>      /
>   team0
>    / \
> swp0 swp1
> 
> If vlan filtering was enabled on br0, swp0's and swp1's QMode was set
> to "secure". This caused all untagged packets to be dropped, as their
> default VID (0) was not loaded into the VTU.
> 
> Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
> ---
>  net/dsa/slave.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/net/dsa/slave.c b/net/dsa/slave.c
> index 4a0498bf6c65..faae8dcc0849 100644
> --- a/net/dsa/slave.c
> +++ b/net/dsa/slave.c
> @@ -274,6 +274,9 @@ static int dsa_slave_port_attr_set(struct net_device *dev,
>  	struct dsa_port *dp = dsa_slave_to_port(dev);
>  	int ret;
>  
> +	if (attr->orig_dev != dev)
> +		return -EOPNOTSUPP;
> +

Should this not be:

	if (!dsa_port_offloads_netdev(dp, attr->orig_dev))
		return -EOPNOTSUPP;

?

>  	switch (attr->id) {
>  	case SWITCHDEV_ATTR_ID_PORT_STP_STATE:
>  		ret = dsa_port_set_state(dp, attr->u.stp_state, trans);
> -- 
> 2.17.1
>
Tobias Waldekranz Dec. 16, 2020, 7:32 p.m. UTC | #2
On Wed, Dec 16, 2020 at 18:27, Vladimir Oltean <olteanv@gmail.com> wrote:
> On Wed, Dec 16, 2020 at 05:00:53PM +0100, Tobias Waldekranz wrote:
>> In a situation where a standalone port is indirectly attached to a
>> bridge (e.g. via a LAG) which is not offloaded, do not offload any
>> port attributes either. The port should behave as a standard NIC.
>> 
>> Previously, on mv88e6xxx, this meant that in the following setup:
>> 
>>      br0
>>      /
>>   team0
>>    / \
>> swp0 swp1
>> 
>> If vlan filtering was enabled on br0, swp0's and swp1's QMode was set
>> to "secure". This caused all untagged packets to be dropped, as their
>> default VID (0) was not loaded into the VTU.
>> 
>> Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
>> ---
>>  net/dsa/slave.c | 3 +++
>>  1 file changed, 3 insertions(+)
>> 
>> diff --git a/net/dsa/slave.c b/net/dsa/slave.c
>> index 4a0498bf6c65..faae8dcc0849 100644
>> --- a/net/dsa/slave.c
>> +++ b/net/dsa/slave.c
>> @@ -274,6 +274,9 @@ static int dsa_slave_port_attr_set(struct net_device *dev,
>>  	struct dsa_port *dp = dsa_slave_to_port(dev);
>>  	int ret;
>>  
>> +	if (attr->orig_dev != dev)
>> +		return -EOPNOTSUPP;
>> +
>
> Should this not be:
>
> 	if (!dsa_port_offloads_netdev(dp, attr->orig_dev))
> 		return -EOPNOTSUPP;
>
> ?

That function is born in the following patch. So here I just align the
filtering with how switchdev objects were handled before this
series. Then in the next patch, all instances are converted to the exact
statement you suggest.

>>  	switch (attr->id) {
>>  	case SWITCHDEV_ATTR_ID_PORT_STP_STATE:
>>  		ret = dsa_port_set_state(dp, attr->u.stp_state, trans);
>> -- 
>> 2.17.1
>>
diff mbox series

Patch

diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 4a0498bf6c65..faae8dcc0849 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -274,6 +274,9 @@  static int dsa_slave_port_attr_set(struct net_device *dev,
 	struct dsa_port *dp = dsa_slave_to_port(dev);
 	int ret;
 
+	if (attr->orig_dev != dev)
+		return -EOPNOTSUPP;
+
 	switch (attr->id) {
 	case SWITCHDEV_ATTR_ID_PORT_STP_STATE:
 		ret = dsa_port_set_state(dp, attr->u.stp_state, trans);