Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next v2] net: sparx5: Support offloading of bridge port flooding flags
@ 2022-02-22 14:35 Casper Andersson
  2022-02-22 18:08 ` Horatiu Vultur
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Casper Andersson @ 2022-02-22 14:35 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, Lars Povlsen, Steen Hegelund,
	UNGLinuxDriver
  Cc: netdev

Though the SparX-5i can control IPv4/6 multicasts separately from non-IP
multicasts, these are all muxed onto the bridge's BR_MCAST_FLOOD flag.

Signed-off-by: Casper Andersson <casper.casan@gmail.com>
---
Since Protonmail apparently caused issues with certain email clients
I have now switched to using gmail. Hopefully, there will be no issues
this time.

Changes in v2:
 - Added SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS callback

 .../microchip/sparx5/sparx5_switchdev.c       | 21 ++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c b/drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c
index 649ca609884a..dc79791201d8 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c
@@ -19,11 +19,27 @@ struct sparx5_switchdev_event_work {
 	unsigned long event;
 };
 
+static int sparx5_port_attr_pre_bridge_flags(struct sparx5_port *port,
+					     struct switchdev_brport_flags flags)
+{
+	if (flags.mask & ~(BR_FLOOD | BR_MCAST_FLOOD | BR_BCAST_FLOOD))
+		return -EINVAL;
+
+	return 0;
+}
+
 static void sparx5_port_attr_bridge_flags(struct sparx5_port *port,
 					  struct switchdev_brport_flags flags)
 {
+	int pgid;
+
 	if (flags.mask & BR_MCAST_FLOOD)
-		sparx5_pgid_update_mask(port, PGID_MC_FLOOD, true);
+		for (pgid = PGID_MC_FLOOD; pgid <= PGID_IPV6_MC_CTRL; pgid++)
+			sparx5_pgid_update_mask(port, pgid, !!(flags.val & BR_MCAST_FLOOD));
+	if (flags.mask & BR_FLOOD)
+		sparx5_pgid_update_mask(port, PGID_UC_FLOOD, !!(flags.val & BR_FLOOD));
+	if (flags.mask & BR_BCAST_FLOOD)
+		sparx5_pgid_update_mask(port, PGID_BCAST, !!(flags.val & BR_BCAST_FLOOD));
 }
 
 static void sparx5_attr_stp_state_set(struct sparx5_port *port,
@@ -72,6 +88,9 @@ static int sparx5_port_attr_set(struct net_device *dev, const void *ctx,
 	struct sparx5_port *port = netdev_priv(dev);
 
 	switch (attr->id) {
+	case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS:
+		return sparx5_port_attr_pre_bridge_flags(port, 
+							 attr->u.brport_flags);
 	case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
 		sparx5_port_attr_bridge_flags(port, attr->u.brport_flags);
 		break;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next v2] net: sparx5: Support offloading of bridge port flooding flags
  2022-02-22 14:35 [PATCH net-next v2] net: sparx5: Support offloading of bridge port flooding flags Casper Andersson
@ 2022-02-22 18:08 ` Horatiu Vultur
  2022-02-22 23:47 ` Jakub Kicinski
  2022-02-23  0:06 ` Jakub Kicinski
  2 siblings, 0 replies; 4+ messages in thread
From: Horatiu Vultur @ 2022-02-22 18:08 UTC (permalink / raw)
  To: Casper Andersson
  Cc: David S. Miller, Jakub Kicinski, Lars Povlsen, Steen Hegelund,
	UNGLinuxDriver, netdev

The 02/22/2022 15:35, Casper Andersson wrote:
> [Some people who received this message don't often get email from casper.casan@gmail.com. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
> 
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Though the SparX-5i can control IPv4/6 multicasts separately from non-IP
> multicasts, these are all muxed onto the bridge's BR_MCAST_FLOOD flag.
> 
> Signed-off-by: Casper Andersson <casper.casan@gmail.com>

Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com>

> ---
> Since Protonmail apparently caused issues with certain email clients
> I have now switched to using gmail. Hopefully, there will be no issues
> this time.
> 
> Changes in v2:
>  - Added SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS callback
> 
>  .../microchip/sparx5/sparx5_switchdev.c       | 21 ++++++++++++++++++-
>  1 file changed, 20 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c b/drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c
> index 649ca609884a..dc79791201d8 100644
> --- a/drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c
> +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c
> @@ -19,11 +19,27 @@ struct sparx5_switchdev_event_work {
>         unsigned long event;
>  };
> 
> +static int sparx5_port_attr_pre_bridge_flags(struct sparx5_port *port,
> +                                            struct switchdev_brport_flags flags)
> +{
> +       if (flags.mask & ~(BR_FLOOD | BR_MCAST_FLOOD | BR_BCAST_FLOOD))
> +               return -EINVAL;
> +
> +       return 0;
> +}
> +
>  static void sparx5_port_attr_bridge_flags(struct sparx5_port *port,
>                                           struct switchdev_brport_flags flags)
>  {
> +       int pgid;
> +
>         if (flags.mask & BR_MCAST_FLOOD)
> -               sparx5_pgid_update_mask(port, PGID_MC_FLOOD, true);
> +               for (pgid = PGID_MC_FLOOD; pgid <= PGID_IPV6_MC_CTRL; pgid++)
> +                       sparx5_pgid_update_mask(port, pgid, !!(flags.val & BR_MCAST_FLOOD));
> +       if (flags.mask & BR_FLOOD)
> +               sparx5_pgid_update_mask(port, PGID_UC_FLOOD, !!(flags.val & BR_FLOOD));
> +       if (flags.mask & BR_BCAST_FLOOD)
> +               sparx5_pgid_update_mask(port, PGID_BCAST, !!(flags.val & BR_BCAST_FLOOD));
>  }
> 
>  static void sparx5_attr_stp_state_set(struct sparx5_port *port,
> @@ -72,6 +88,9 @@ static int sparx5_port_attr_set(struct net_device *dev, const void *ctx,
>         struct sparx5_port *port = netdev_priv(dev);
> 
>         switch (attr->id) {
> +       case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS:
> +               return sparx5_port_attr_pre_bridge_flags(port,
> +                                                        attr->u.brport_flags);
>         case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
>                 sparx5_port_attr_bridge_flags(port, attr->u.brport_flags);
>                 break;
> --
> 2.30.2
> 

-- 
/Horatiu

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next v2] net: sparx5: Support offloading of bridge port flooding flags
  2022-02-22 14:35 [PATCH net-next v2] net: sparx5: Support offloading of bridge port flooding flags Casper Andersson
  2022-02-22 18:08 ` Horatiu Vultur
@ 2022-02-22 23:47 ` Jakub Kicinski
  2022-02-23  0:06 ` Jakub Kicinski
  2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2022-02-22 23:47 UTC (permalink / raw)
  To: Casper Andersson
  Cc: David S. Miller, Lars Povlsen, Steen Hegelund, UNGLinuxDriver,
	netdev

On Tue, 22 Feb 2022 15:35:25 +0100 Casper Andersson wrote:
> Though the SparX-5i can control IPv4/6 multicasts separately from non-IP
> multicasts, these are all muxed onto the bridge's BR_MCAST_FLOOD flag.
> 
> Signed-off-by: Casper Andersson <casper.casan@gmail.com>
> ---
> Since Protonmail apparently caused issues with certain email clients
> I have now switched to using gmail. Hopefully, there will be no issues
> this time.

Yup, I can see it just fine now, thanks!

> Changes in v2:
>  - Added SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS callback

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next v2] net: sparx5: Support offloading of bridge port flooding flags
  2022-02-22 14:35 [PATCH net-next v2] net: sparx5: Support offloading of bridge port flooding flags Casper Andersson
  2022-02-22 18:08 ` Horatiu Vultur
  2022-02-22 23:47 ` Jakub Kicinski
@ 2022-02-23  0:06 ` Jakub Kicinski
  2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2022-02-23  0:06 UTC (permalink / raw)
  To: Casper Andersson
  Cc: David S. Miller, Lars Povlsen, Steen Hegelund, UNGLinuxDriver,
	netdev

On Tue, 22 Feb 2022 15:35:25 +0100 Casper Andersson wrote:
>  static void sparx5_attr_stp_state_set(struct sparx5_port *port,
> @@ -72,6 +88,9 @@ static int sparx5_port_attr_set(struct net_device *dev, const void *ctx,
>  	struct sparx5_port *port = netdev_priv(dev);
>  
>  	switch (attr->id) {
> +	case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS:
> +		return sparx5_port_attr_pre_bridge_flags(port, 

nit: trailing white space here, please keep Horatiu's review tag when
reposting

> +							 attr->u.brport_flags);

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-23  0:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-22 14:35 [PATCH net-next v2] net: sparx5: Support offloading of bridge port flooding flags Casper Andersson
2022-02-22 18:08 ` Horatiu Vultur
2022-02-22 23:47 ` Jakub Kicinski
2022-02-23  0:06 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox