[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <526bf36a-f0e6-4149-90c9-16f91ff039ce@gmail.com>
Date: Tue, 16 Jan 2024 10:23:30 -0800
From: Florian Fainelli <f.fainelli@...il.com>
To: Vladimir Oltean <olteanv@...il.com>,
Simon Waterer <simon.waterer@...il.com>
Cc: Arun Ramadoss <arun.ramadoss@...rochip.com>, Andrew Lunn
<andrew@...n.ch>, netdev@...r.kernel.org
Subject: Re: DSA switch: VLAN tag not added on packets directed to a
PVID,untagged switchport
On 1/16/24 05:10, Vladimir Oltean wrote:
> On Tue, Jan 16, 2024 at 05:32:57PM +1300, Simon Waterer wrote:
>> So a similar fix to ksz9477.c would be as follows?
>>
>> int ksz9477_port_vlan_del(struct ksz_device *dev, int port,
>> const struct switchdev_obj_port_vlan *vlan)
>> {
>> - bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED;
>> u32 vlan_table[3];
>> u16 pvid;
>>
>> ksz_pread16(dev, port, REG_PORT_DEFAULT_VID, &pvid);
>> pvid = pvid & 0xFFF;
>>
>> if (ksz9477_get_vlan_table(dev, vlan->vid, vlan_table)) {
>> dev_dbg(dev->dev, "Failed to get vlan table\n");
>> return -ETIMEDOUT;
>> }
>>
>> vlan_table[2] &= ~BIT(port);
>>
>> if (pvid == vlan->vid)
>> pvid = 1;
>>
>> - if (untagged)
>> - vlan_table[1] &= ~BIT(port);
>> -
>> if (ksz9477_set_vlan_table(dev, vlan->vid, vlan_table)) {
>> dev_dbg(dev->dev, "Failed to set vlan table\n");
>> return -ETIMEDOUT;
>> }
>>
>> ksz_pwrite16(dev, port, REG_PORT_DEFAULT_VID, pvid);
>>
>> return 0;
>> }
>>
>> I've applied this change to my version of the driver and will test to
>> see if any issues result.
>
> Something like this, yes. It is clearer ("do nothing simpler"), and
> should not result in any behavior change.
>
> int br_switchdev_port_vlan_del(struct net_device *dev, u16 vid)
> {
> struct switchdev_obj_port_vlan v = {
> .obj.orig_dev = dev,
> .obj.id = SWITCHDEV_OBJ_ID_PORT_VLAN,
> .vid = vid,
> /* .flags implicitly zero */
> };
>
> return switchdev_port_obj_del(dev, &v.obj);
> }
>
> If you take care of the ksz driver, I can take care of lantiq_gswip,
> b53 and dsa_loop once net-next reopens, which also have this kind of
> bogus logic.
Since the proposed changes were not in an unified diff format, it was
not clear to me what was being proposed, but what you are suggesting is
that the following should be applied to b53?
diff --git a/drivers/net/dsa/b53/b53_common.c
b/drivers/net/dsa/b53/b53_common.c
index 0d628b35fd5c..354dcfd23da8 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -1556,9 +1556,6 @@ int b53_vlan_del(struct dsa_switch *ds, int port,
if (pvid == vlan->vid)
pvid = b53_default_pvid(dev);
- if (untagged && !b53_vlan_port_needs_forced_tagged(ds, port))
- vl->untag &= ~(BIT(port));
-
b53_set_vlan_entry(dev, vlan->vid, vl);
b53_fast_age_vlan(dev, vlan->vid);
or did I completely miss what was being changed?
--
Florian
Powered by blists - more mailing lists