]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
net: ti: icssg-prueth: Add VLAN support in EMAC mode
authorMD Danish Anwar <danishanwar@ti.com>
Fri, 10 Jan 2025 08:28:49 +0000 (13:58 +0530)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 14 Jan 2025 11:17:27 +0000 (12:17 +0100)
Add support for VLAN filtering in dual EMAC mode.

Reviewed-by: Roger Quadros <rogerq@kernel.org>
Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/ti/icssg/icssg_prueth.c

index d76fe6d05e10a41ca42cbe3eef3a5f7aa9c8179c..1d510c9dabff1574205968c4e1570e2308220872 100644 (file)
@@ -907,19 +907,18 @@ static int emac_ndo_vlan_rx_add_vid(struct net_device *ndev,
 {
        struct prueth_emac *emac = netdev_priv(ndev);
        struct prueth *prueth = emac->prueth;
+       int port_mask = BIT(emac->port_id);
        int untag_mask = 0;
-       int port_mask;
 
-       if (prueth->is_hsr_offload_mode) {
-               port_mask = BIT(PRUETH_PORT_HOST) | BIT(emac->port_id);
-               untag_mask = 0;
+       if (prueth->is_hsr_offload_mode)
+               port_mask |= BIT(PRUETH_PORT_HOST);
 
-               netdev_dbg(emac->ndev, "VID add vid:%u port_mask:%X untag_mask %X\n",
-                          vid, port_mask, untag_mask);
+       netdev_dbg(emac->ndev, "VID add vid:%u port_mask:%X untag_mask %X\n",
+                  vid, port_mask, untag_mask);
+
+       icssg_vtbl_modify(emac, vid, port_mask, untag_mask, true);
+       icssg_set_pvid(emac->prueth, vid, emac->port_id);
 
-               icssg_vtbl_modify(emac, vid, port_mask, untag_mask, true);
-               icssg_set_pvid(emac->prueth, vid, emac->port_id);
-       }
        return 0;
 }
 
@@ -928,18 +927,16 @@ static int emac_ndo_vlan_rx_del_vid(struct net_device *ndev,
 {
        struct prueth_emac *emac = netdev_priv(ndev);
        struct prueth *prueth = emac->prueth;
+       int port_mask = BIT(emac->port_id);
        int untag_mask = 0;
-       int port_mask;
 
-       if (prueth->is_hsr_offload_mode) {
+       if (prueth->is_hsr_offload_mode)
                port_mask = BIT(PRUETH_PORT_HOST);
-               untag_mask = 0;
 
-               netdev_dbg(emac->ndev, "VID del vid:%u port_mask:%X untag_mask  %X\n",
-                          vid, port_mask, untag_mask);
+       netdev_dbg(emac->ndev, "VID del vid:%u port_mask:%X untag_mask  %X\n",
+                  vid, port_mask, untag_mask);
+       icssg_vtbl_modify(emac, vid, port_mask, untag_mask, false);
 
-               icssg_vtbl_modify(emac, vid, port_mask, untag_mask, false);
-       }
        return 0;
 }