lkml.org 
[lkml]   [2021]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH net 5/6] net: dsa: ksz: fix wrong pvid
    Date
    A logical 'or' was performed until now.
    So if vlan 1 is the current pvid and vlan 20 is set as the new one,
    vlan 21 is the new pvid.
    This commit fixes this by setting the right mask to set the new pvid.

    Signed-off-by: Gilles DOFFE <gilles.doffe@savoirfairelinux.com>
    ---
    drivers/net/dsa/microchip/ksz8795.c | 4 ++--
    1 file changed, 2 insertions(+), 2 deletions(-)

    diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
    index b55fb2761993..44306a7e297a 100644
    --- a/drivers/net/dsa/microchip/ksz8795.c
    +++ b/drivers/net/dsa/microchip/ksz8795.c
    @@ -868,8 +868,8 @@ static void ksz8795_port_vlan_add(struct dsa_switch *ds, int port,

    if (new_pvid) {
    ksz_pread16(dev, port, REG_PORT_CTRL_VID, &vid);
    - vid &= 0xfff;
    - vid |= new_pvid;
    + vid &= ~0xfff;
    + vid |= (new_pvid & 0xfff);
    ksz_pwrite16(dev, port, REG_PORT_CTRL_VID, vid);
    }

    --
    2.25.1
    \
     
     \ /
      Last update: 2021-01-13 13:58    [W:4.241 / U:0.120 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site