* [PATCH net-next v3] net: ti: icssg-prueth: Add multicast filtering support
@ 2024-06-05 9:52 MD Danish Anwar
2024-06-05 10:02 ` Wojciech Drewek
2024-06-07 13:32 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: MD Danish Anwar @ 2024-06-05 9:52 UTC (permalink / raw)
To: Dan Carpenter, Jan Kiszka, Diogo Ivo, Andrew Lunn, Simon Horman,
Paolo Abeni, Jakub Kicinski, Eric Dumazet, David S. Miller
Cc: linux-kernel, netdev, linux-arm-kernel, srk, Vignesh Raghavendra,
Roger Quadros, MD Danish Anwar, Wojciech Drewek
Add multicast filtering support for ICSSG Driver. Multicast addresses will
be updated by __dev_mc_sync() API. icssg_prueth_add_macst () and
icssg_prueth_del_mcast() will be sync and unsync APIs for the driver
respectively.
To add a mac_address for a port, driver needs to call icssg_fdb_add_del()
and pass the mac_address and BIT(port_id) to the API. The ICSSG firmware
will then configure the rules and allow filtering.
If a mac_address is added to port0 and the same mac_address needs to be
added for port1, driver needs to pass BIT(port0) | BIT(port1) to the
icssg_fdb_add_del() API. If driver just pass BIT(port1) then the entry for
port0 will be overwritten / lost. This is a design constraint on the
firmware side.
To overcome this in the driver, to add any mac_address for let's say portX
driver first checks if the same mac_address is already added for any other
port. If yes driver calls icssg_fdb_add_del() with BIT(portX) |
BIT(other_existing_port). If not, driver calls icssg_fdb_add_del() with
BIT(portX).
The same thing is applicable for deleting mac_addresses as well. This
logic is in icssg_prueth_add_mcast / icssg_prueth_del_mcast APIs.
Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
---
Cc: Wojciech Drewek <wojciech.drewek@intel.com>
v2 -> v3:
*) Using __dev_mc_sync() instead of __hw_addr_sync_dev().
*) Stopped keeping local copy of multicast list as pointed out by
Wojciech Drewek <wojciech.drewek@intel.com>
v1 -> v2:
*) Rebased on latest net-next/main.
NOTE: This series can be applied cleanly on the tip of net-next/main. This
series doesn't depend on any other ICSSG driver related series that is
floating around in netdev.
v1 https://lore.kernel.org/all/20240516091752.2969092-1-danishanwar@ti.com/
v2 https://lore.kernel.org/all/20240604114402.1835973-1-danishanwar@ti.com/
drivers/net/ethernet/ti/icssg/icssg_prueth.c | 38 +++++++++++++++++---
1 file changed, 34 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
index 6e65aa0977d4..e13835100754 100644
--- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c
+++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
@@ -439,6 +439,37 @@ const struct icss_iep_clockops prueth_iep_clockops = {
.perout_enable = prueth_perout_enable,
};
+static int icssg_prueth_add_mcast(struct net_device *ndev, const u8 *addr)
+{
+ struct prueth_emac *emac = netdev_priv(ndev);
+ int port_mask = BIT(emac->port_id);
+
+ port_mask |= icssg_fdb_lookup(emac, addr, 0);
+ icssg_fdb_add_del(emac, addr, 0, port_mask, true);
+ icssg_vtbl_modify(emac, 0, port_mask, port_mask, true);
+
+ return 0;
+}
+
+static int icssg_prueth_del_mcast(struct net_device *ndev, const u8 *addr)
+{
+ struct prueth_emac *emac = netdev_priv(ndev);
+ int port_mask = BIT(emac->port_id);
+ int other_port_mask;
+
+ other_port_mask = port_mask ^ icssg_fdb_lookup(emac, addr, 0);
+
+ icssg_fdb_add_del(emac, addr, 0, port_mask, false);
+ icssg_vtbl_modify(emac, 0, port_mask, port_mask, false);
+
+ if (other_port_mask) {
+ icssg_fdb_add_del(emac, addr, 0, other_port_mask, true);
+ icssg_vtbl_modify(emac, 0, other_port_mask, other_port_mask, true);
+ }
+
+ return 0;
+}
+
/**
* emac_ndo_open - EMAC device open
* @ndev: network adapter device
@@ -599,6 +630,8 @@ 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);
+
atomic_set(&emac->tdown_cnt, emac->tx_ch_num);
/* ensure new tdown_cnt value is visible */
smp_mb__after_atomic();
@@ -675,10 +708,7 @@ static void emac_ndo_set_rx_mode_work(struct work_struct *work)
return;
}
- if (!netdev_mc_empty(ndev)) {
- emac_set_port_state(emac, ICSSG_EMAC_PORT_MC_FLOODING_ENABLE);
- return;
- }
+ __dev_mc_sync(ndev, icssg_prueth_add_mcast, icssg_prueth_del_mcast);
}
/**
base-commit: fd70f0443e24c3888bf4b7f198df6d705c9b8ab2
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v3] net: ti: icssg-prueth: Add multicast filtering support
2024-06-05 9:52 [PATCH net-next v3] net: ti: icssg-prueth: Add multicast filtering support MD Danish Anwar
@ 2024-06-05 10:02 ` Wojciech Drewek
2024-06-07 13:32 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Wojciech Drewek @ 2024-06-05 10:02 UTC (permalink / raw)
To: MD Danish Anwar, Dan Carpenter, Jan Kiszka, Diogo Ivo,
Andrew Lunn, Simon Horman, Paolo Abeni, Jakub Kicinski,
Eric Dumazet, David S. Miller
Cc: linux-kernel, netdev, linux-arm-kernel, srk, Vignesh Raghavendra,
Roger Quadros
On 05.06.2024 11:52, MD Danish Anwar wrote:
> Add multicast filtering support for ICSSG Driver. Multicast addresses will
> be updated by __dev_mc_sync() API. icssg_prueth_add_macst () and
> icssg_prueth_del_mcast() will be sync and unsync APIs for the driver
> respectively.
>
> To add a mac_address for a port, driver needs to call icssg_fdb_add_del()
> and pass the mac_address and BIT(port_id) to the API. The ICSSG firmware
> will then configure the rules and allow filtering.
>
> If a mac_address is added to port0 and the same mac_address needs to be
> added for port1, driver needs to pass BIT(port0) | BIT(port1) to the
> icssg_fdb_add_del() API. If driver just pass BIT(port1) then the entry for
> port0 will be overwritten / lost. This is a design constraint on the
> firmware side.
>
> To overcome this in the driver, to add any mac_address for let's say portX
> driver first checks if the same mac_address is already added for any other
> port. If yes driver calls icssg_fdb_add_del() with BIT(portX) |
> BIT(other_existing_port). If not, driver calls icssg_fdb_add_del() with
> BIT(portX).
>
> The same thing is applicable for deleting mac_addresses as well. This
> logic is in icssg_prueth_add_mcast / icssg_prueth_del_mcast APIs.
>
> Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
> ---
> Cc: Wojciech Drewek <wojciech.drewek@intel.com>
>
> v2 -> v3:
> *) Using __dev_mc_sync() instead of __hw_addr_sync_dev().
> *) Stopped keeping local copy of multicast list as pointed out by
> Wojciech Drewek <wojciech.drewek@intel.com>
Thank you!
Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
>
> v1 -> v2:
> *) Rebased on latest net-next/main.
>
> NOTE: This series can be applied cleanly on the tip of net-next/main. This
> series doesn't depend on any other ICSSG driver related series that is
> floating around in netdev.
>
> v1 https://lore.kernel.org/all/20240516091752.2969092-1-danishanwar@ti.com/
> v2 https://lore.kernel.org/all/20240604114402.1835973-1-danishanwar@ti.com/
>
> drivers/net/ethernet/ti/icssg/icssg_prueth.c | 38 +++++++++++++++++---
> 1 file changed, 34 insertions(+), 4 deletions(-)
>
<...>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v3] net: ti: icssg-prueth: Add multicast filtering support
2024-06-05 9:52 [PATCH net-next v3] net: ti: icssg-prueth: Add multicast filtering support MD Danish Anwar
2024-06-05 10:02 ` Wojciech Drewek
@ 2024-06-07 13:32 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-06-07 13:32 UTC (permalink / raw)
To: MD Danish Anwar
Cc: dan.carpenter, jan.kiszka, diogo.ivo, andrew, horms, pabeni, kuba,
edumazet, davem, linux-kernel, netdev, linux-arm-kernel, srk,
vigneshr, rogerq, wojciech.drewek
Hello:
This patch was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:
On Wed, 5 Jun 2024 15:22:23 +0530 you wrote:
> Add multicast filtering support for ICSSG Driver. Multicast addresses will
> be updated by __dev_mc_sync() API. icssg_prueth_add_macst () and
> icssg_prueth_del_mcast() will be sync and unsync APIs for the driver
> respectively.
>
> To add a mac_address for a port, driver needs to call icssg_fdb_add_del()
> and pass the mac_address and BIT(port_id) to the API. The ICSSG firmware
> will then configure the rules and allow filtering.
>
> [...]
Here is the summary with links:
- [net-next,v3] net: ti: icssg-prueth: Add multicast filtering support
https://git.kernel.org/netdev/net-next/c/a99997323654
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-06-07 13:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-05 9:52 [PATCH net-next v3] net: ti: icssg-prueth: Add multicast filtering support MD Danish Anwar
2024-06-05 10:02 ` Wojciech Drewek
2024-06-07 13:32 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox