[PATCH 3/6] net/ncsi: Enable VLAN filtering when callback is registered

From: Jiaqing Zhao
Date: Fri Jun 10 2022 - 12:48:13 EST


Sets NETIF_F_HW_VLAN_CTAG_FILTER flag to enable hardware VLAN filtering
of NCSI when the ndo_vlan_rx_{add,kill}_vid callbacks are registered to
the NCSI handlers. Previously it was done in the mac driver, this patch
puts it to the NCSI drvier to make it more general.

Signed-off-by: Jiaqing Zhao <jiaqing.zhao@xxxxxxxxxxxxxxx>
---
net/ncsi/ncsi-manage.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c
index a8f7a2ff52a0..3fb95f29e3e2 100644
--- a/net/ncsi/ncsi-manage.c
+++ b/net/ncsi/ncsi-manage.c
@@ -1807,6 +1807,11 @@ struct ncsi_dev *ncsi_register_dev(struct net_device *dev,
ndp->mlx_multi_host = true;
}

+ /* Enable hardware VLAN filtering */
+ if (dev->netdev_ops->ndo_vlan_rx_add_vid == ncsi_vlan_rx_add_vid &&
+ dev->netdev_ops->ndo_vlan_rx_kill_vid == ncsi_vlan_rx_kill_vid)
+ dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER;
+
return nd;
}
EXPORT_SYMBOL_GPL(ncsi_register_dev);
--
2.34.1