Skip to content

Commit 816b02e

Browse files
danish-tiPaolo Abeni
authored andcommitted
net: ti: icssg-prueth: Add VLAN support in EMAC mode
Add support for VLAN filtering in dual EMAC mode. Reviewed-by: Roger Quadros <[email protected]> Signed-off-by: MD Danish Anwar <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent 624d7a8 commit 816b02e

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

drivers/net/ethernet/ti/icssg/icssg_prueth.c

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -907,19 +907,18 @@ static int emac_ndo_vlan_rx_add_vid(struct net_device *ndev,
907907
{
908908
struct prueth_emac *emac = netdev_priv(ndev);
909909
struct prueth *prueth = emac->prueth;
910+
int port_mask = BIT(emac->port_id);
910911
int untag_mask = 0;
911-
int port_mask;
912912

913-
if (prueth->is_hsr_offload_mode) {
914-
port_mask = BIT(PRUETH_PORT_HOST) | BIT(emac->port_id);
915-
untag_mask = 0;
913+
if (prueth->is_hsr_offload_mode)
914+
port_mask |= BIT(PRUETH_PORT_HOST);
916915

917-
netdev_dbg(emac->ndev, "VID add vid:%u port_mask:%X untag_mask %X\n",
918-
vid, port_mask, untag_mask);
916+
netdev_dbg(emac->ndev, "VID add vid:%u port_mask:%X untag_mask %X\n",
917+
vid, port_mask, untag_mask);
918+
919+
icssg_vtbl_modify(emac, vid, port_mask, untag_mask, true);
920+
icssg_set_pvid(emac->prueth, vid, emac->port_id);
919921

920-
icssg_vtbl_modify(emac, vid, port_mask, untag_mask, true);
921-
icssg_set_pvid(emac->prueth, vid, emac->port_id);
922-
}
923922
return 0;
924923
}
925924

@@ -928,18 +927,16 @@ static int emac_ndo_vlan_rx_del_vid(struct net_device *ndev,
928927
{
929928
struct prueth_emac *emac = netdev_priv(ndev);
930929
struct prueth *prueth = emac->prueth;
930+
int port_mask = BIT(emac->port_id);
931931
int untag_mask = 0;
932-
int port_mask;
933932

934-
if (prueth->is_hsr_offload_mode) {
933+
if (prueth->is_hsr_offload_mode)
935934
port_mask = BIT(PRUETH_PORT_HOST);
936-
untag_mask = 0;
937935

938-
netdev_dbg(emac->ndev, "VID del vid:%u port_mask:%X untag_mask %X\n",
939-
vid, port_mask, untag_mask);
936+
netdev_dbg(emac->ndev, "VID del vid:%u port_mask:%X untag_mask %X\n",
937+
vid, port_mask, untag_mask);
938+
icssg_vtbl_modify(emac, vid, port_mask, untag_mask, false);
940939

941-
icssg_vtbl_modify(emac, vid, port_mask, untag_mask, false);
942-
}
943940
return 0;
944941
}
945942

0 commit comments

Comments
 (0)