]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
octeontx2-pf: Don't install VLAN offload rule if netdev is down
authorSunil Goutham <sgoutham@marvell.com>
Sun, 22 Aug 2021 12:02:25 +0000 (17:32 +0530)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 15 Oct 2021 09:27:45 +0000 (11:27 +0200)
BugLink: https://bugs.launchpad.net/bugs/1946788
[ Upstream commit 05209e3570e452cdaa644e8398a8875b6a91051d ]

Whenever user changes interface MAC address both default DMAC based
MCAM rule and VLAN offload (for strip) rules are updated with new
MAC address. To update or install VLAN offload rule PF driver needs
interface's receive channel info, which is retrieved from admin
function at the time of NIXLF initialization.

If user changes MAC address before interface is UP, VLAN offload rule
installation will fail and throw error as receive channel is not valid.
To avoid this, skip VLAN offload rule installation if netdev is not UP.
This rule will anyway be reinslatted as part of open() call.

Fixes: fd9d7859db6c ("octeontx2-pf: Implement ingress/egress VLAN offload")
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c

index e6869435e1f323041dd73c40e0ddf27aef27ba93..bcab6dbce69128135e2fd5c00c5365a9f73f6b58 100644 (file)
@@ -194,7 +194,8 @@ int otx2_set_mac_address(struct net_device *netdev, void *p)
        if (!otx2_hw_set_mac_addr(pfvf, addr->sa_data)) {
                memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
                /* update dmac field in vlan offload rule */
-               if (pfvf->flags & OTX2_FLAG_RX_VLAN_SUPPORT)
+               if (netif_running(netdev) &&
+                   pfvf->flags & OTX2_FLAG_RX_VLAN_SUPPORT)
                        otx2_install_rxvlan_offload_flow(pfvf);
        } else {
                return -EPERM;