Message ID | 20240813074233.2473876-7-danishanwar@ti.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Introduce HSR offload support for ICSSG | expand |
On 13/08/2024 10:42, MD Danish Anwar wrote: > Add support for multicast filtering in HSR mode > > Signed-off-by: MD Danish Anwar <danishanwar@ti.com> > --- > drivers/net/ethernet/ti/icssg/icssg_prueth.c | 38 +++++++++++++++++++- > 1 file changed, 37 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c > index b32a2bff34dc..521e9f914459 100644 > --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c > +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c > @@ -490,6 +490,36 @@ static int icssg_prueth_del_mcast(struct net_device *ndev, const u8 *addr) > return 0; > } > > +static int icssg_prueth_hsr_add_mcast(struct net_device *ndev, const u8 *addr) > +{ > + struct prueth_emac *emac = netdev_priv(ndev); > + struct prueth *prueth = emac->prueth; > + > + icssg_fdb_add_del(emac, addr, prueth->default_vlan, > + ICSSG_FDB_ENTRY_P0_MEMBERSHIP | > + ICSSG_FDB_ENTRY_P1_MEMBERSHIP | > + ICSSG_FDB_ENTRY_P2_MEMBERSHIP | > + ICSSG_FDB_ENTRY_BLOCK, true); > + > + icssg_vtbl_modify(emac, emac->port_vlan, BIT(emac->port_id), > + BIT(emac->port_id), true); > + return 0; > +} > + > +static int icssg_prueth_hsr_del_mcast(struct net_device *ndev, const u8 *addr) > +{ > + struct prueth_emac *emac = netdev_priv(ndev); > + struct prueth *prueth = emac->prueth; > + > + icssg_fdb_add_del(emac, addr, prueth->default_vlan, > + ICSSG_FDB_ENTRY_P0_MEMBERSHIP | > + ICSSG_FDB_ENTRY_P1_MEMBERSHIP | > + ICSSG_FDB_ENTRY_P2_MEMBERSHIP | > + ICSSG_FDB_ENTRY_BLOCK, false); > + > + return 0; > +} > + > /** > * emac_ndo_open - EMAC device open > * @ndev: network adapter device > @@ -651,6 +681,7 @@ static int emac_ndo_stop(struct net_device *ndev) > icssg_class_disable(prueth->miig_rt, prueth_emac_slice(emac)); > > __dev_mc_unsync(ndev, icssg_prueth_del_mcast); Above unsync call will already remove all MC addresses so nothing is left to unsync in the below unsync call. > + __dev_mc_unsync(ndev, icssg_prueth_hsr_del_mcast); Do you have to use an if/else like you do while calling __dev_mc_sync? > > atomic_set(&emac->tdown_cnt, emac->tx_ch_num); > /* ensure new tdown_cnt value is visible */ > @@ -728,7 +759,12 @@ static void emac_ndo_set_rx_mode_work(struct work_struct *work) > return; > } > > - __dev_mc_sync(ndev, icssg_prueth_add_mcast, icssg_prueth_del_mcast); > + if (emac->prueth->is_hsr_offload_mode) > + __dev_mc_sync(ndev, icssg_prueth_hsr_add_mcast, > + icssg_prueth_hsr_del_mcast); > + else > + __dev_mc_sync(ndev, icssg_prueth_add_mcast, > + icssg_prueth_del_mcast); > } > > /**
On 21/08/24 5:40 pm, Roger Quadros wrote: > > > On 13/08/2024 10:42, MD Danish Anwar wrote: >> Add support for multicast filtering in HSR mode >> >> Signed-off-by: MD Danish Anwar <danishanwar@ti.com> >> --- >> drivers/net/ethernet/ti/icssg/icssg_prueth.c | 38 +++++++++++++++++++- >> 1 file changed, 37 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c >> index b32a2bff34dc..521e9f914459 100644 >> --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c >> +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c >> @@ -490,6 +490,36 @@ static int icssg_prueth_del_mcast(struct net_device *ndev, const u8 *addr) >> return 0; >> } >> >> +static int icssg_prueth_hsr_add_mcast(struct net_device *ndev, const u8 *addr) >> +{ >> + struct prueth_emac *emac = netdev_priv(ndev); >> + struct prueth *prueth = emac->prueth; >> + >> + icssg_fdb_add_del(emac, addr, prueth->default_vlan, >> + ICSSG_FDB_ENTRY_P0_MEMBERSHIP | >> + ICSSG_FDB_ENTRY_P1_MEMBERSHIP | >> + ICSSG_FDB_ENTRY_P2_MEMBERSHIP | >> + ICSSG_FDB_ENTRY_BLOCK, true); >> + >> + icssg_vtbl_modify(emac, emac->port_vlan, BIT(emac->port_id), >> + BIT(emac->port_id), true); >> + return 0; >> +} >> + >> +static int icssg_prueth_hsr_del_mcast(struct net_device *ndev, const u8 *addr) >> +{ >> + struct prueth_emac *emac = netdev_priv(ndev); >> + struct prueth *prueth = emac->prueth; >> + >> + icssg_fdb_add_del(emac, addr, prueth->default_vlan, >> + ICSSG_FDB_ENTRY_P0_MEMBERSHIP | >> + ICSSG_FDB_ENTRY_P1_MEMBERSHIP | >> + ICSSG_FDB_ENTRY_P2_MEMBERSHIP | >> + ICSSG_FDB_ENTRY_BLOCK, false); >> + >> + return 0; >> +} >> + >> /** >> * emac_ndo_open - EMAC device open >> * @ndev: network adapter device >> @@ -651,6 +681,7 @@ static int emac_ndo_stop(struct net_device *ndev) >> icssg_class_disable(prueth->miig_rt, prueth_emac_slice(emac)); >> >> __dev_mc_unsync(ndev, icssg_prueth_del_mcast); > > Above unsync call will already remove all MC addresses so nothing > is left to unsync in the below unsync call. >> + __dev_mc_unsync(ndev, icssg_prueth_hsr_del_mcast); > > Do you have to use an if/else like you do while calling __dev_mc_sync? > Yes Roger, we will need and if/else here and remove MC addresses based on the current mode. if (emac->prueth->is_hsr_offload_mode) __dev_mc_unsync(ndev, icssg_prueth_hsr_del_mcast); else __dev_mc_unsync(ndev, icssg_prueth_del_mcast); I will make this change and update the series. >> >> atomic_set(&emac->tdown_cnt, emac->tx_ch_num); >> /* ensure new tdown_cnt value is visible */ >> @@ -728,7 +759,12 @@ static void emac_ndo_set_rx_mode_work(struct work_struct *work) >> return; >> } >> >> - __dev_mc_sync(ndev, icssg_prueth_add_mcast, icssg_prueth_del_mcast); >> + if (emac->prueth->is_hsr_offload_mode) >> + __dev_mc_sync(ndev, icssg_prueth_hsr_add_mcast, >> + icssg_prueth_hsr_del_mcast); >> + else >> + __dev_mc_sync(ndev, icssg_prueth_add_mcast, >> + icssg_prueth_del_mcast); >> } >> >> /** >
diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c index b32a2bff34dc..521e9f914459 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c @@ -490,6 +490,36 @@ static int icssg_prueth_del_mcast(struct net_device *ndev, const u8 *addr) return 0; } +static int icssg_prueth_hsr_add_mcast(struct net_device *ndev, const u8 *addr) +{ + struct prueth_emac *emac = netdev_priv(ndev); + struct prueth *prueth = emac->prueth; + + icssg_fdb_add_del(emac, addr, prueth->default_vlan, + ICSSG_FDB_ENTRY_P0_MEMBERSHIP | + ICSSG_FDB_ENTRY_P1_MEMBERSHIP | + ICSSG_FDB_ENTRY_P2_MEMBERSHIP | + ICSSG_FDB_ENTRY_BLOCK, true); + + icssg_vtbl_modify(emac, emac->port_vlan, BIT(emac->port_id), + BIT(emac->port_id), true); + return 0; +} + +static int icssg_prueth_hsr_del_mcast(struct net_device *ndev, const u8 *addr) +{ + struct prueth_emac *emac = netdev_priv(ndev); + struct prueth *prueth = emac->prueth; + + icssg_fdb_add_del(emac, addr, prueth->default_vlan, + ICSSG_FDB_ENTRY_P0_MEMBERSHIP | + ICSSG_FDB_ENTRY_P1_MEMBERSHIP | + ICSSG_FDB_ENTRY_P2_MEMBERSHIP | + ICSSG_FDB_ENTRY_BLOCK, false); + + return 0; +} + /** * emac_ndo_open - EMAC device open * @ndev: network adapter device @@ -651,6 +681,7 @@ static int emac_ndo_stop(struct net_device *ndev) icssg_class_disable(prueth->miig_rt, prueth_emac_slice(emac)); __dev_mc_unsync(ndev, icssg_prueth_del_mcast); + __dev_mc_unsync(ndev, icssg_prueth_hsr_del_mcast); atomic_set(&emac->tdown_cnt, emac->tx_ch_num); /* ensure new tdown_cnt value is visible */ @@ -728,7 +759,12 @@ static void emac_ndo_set_rx_mode_work(struct work_struct *work) return; } - __dev_mc_sync(ndev, icssg_prueth_add_mcast, icssg_prueth_del_mcast); + if (emac->prueth->is_hsr_offload_mode) + __dev_mc_sync(ndev, icssg_prueth_hsr_add_mcast, + icssg_prueth_hsr_del_mcast); + else + __dev_mc_sync(ndev, icssg_prueth_add_mcast, + icssg_prueth_del_mcast); } /**
Add support for multicast filtering in HSR mode Signed-off-by: MD Danish Anwar <danishanwar@ti.com> --- drivers/net/ethernet/ti/icssg/icssg_prueth.c | 38 +++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-)