* [PATCH] include: net: add dsa_cpu_ports function
@ 2021-04-06 3:49 Ansuel Smith
2021-04-07 0:16 ` Andrew Lunn
0 siblings, 1 reply; 2+ messages in thread
From: Ansuel Smith @ 2021-04-06 3:49 UTC (permalink / raw)
To: Andrew Lunn
Cc: Ansuel Smith, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
David S. Miller, Jakub Kicinski, netdev, linux-kernel
In preparation for the future when dsa will support multi cpu port,
dsa_cpu_ports can be useful for switch that has multiple cpu port to
retrieve the cpu mask for ACL and bridge table.
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
---
include/net/dsa.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 83a933e563fe..d71b1acd9c3e 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -446,6 +446,18 @@ static inline u32 dsa_user_ports(struct dsa_switch *ds)
return mask;
}
+static inline u32 dsa_cpu_ports(struct dsa_switch *ds)
+{
+ u32 mask = 0;
+ int p;
+
+ for (p = 0; p < ds->num_ports; p++)
+ if (dsa_is_cpu_port(ds, p))
+ mask |= BIT(p);
+
+ return mask;
+}
+
/* Return the local port used to reach an arbitrary switch device */
static inline unsigned int dsa_routing_port(struct dsa_switch *ds, int device)
{
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] include: net: add dsa_cpu_ports function
2021-04-06 3:49 [PATCH] include: net: add dsa_cpu_ports function Ansuel Smith
@ 2021-04-07 0:16 ` Andrew Lunn
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Lunn @ 2021-04-07 0:16 UTC (permalink / raw)
To: Ansuel Smith
Cc: Vivien Didelot, Florian Fainelli, Vladimir Oltean,
David S. Miller, Jakub Kicinski, netdev, linux-kernel
On Tue, Apr 06, 2021 at 05:49:03AM +0200, Ansuel Smith wrote:
> In preparation for the future when dsa will support multi cpu port,
> dsa_cpu_ports can be useful for switch that has multiple cpu port to
> retrieve the cpu mask for ACL and bridge table.
>
> Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
> ---
> include/net/dsa.h | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/include/net/dsa.h b/include/net/dsa.h
> index 83a933e563fe..d71b1acd9c3e 100644
> --- a/include/net/dsa.h
> +++ b/include/net/dsa.h
> @@ -446,6 +446,18 @@ static inline u32 dsa_user_ports(struct dsa_switch *ds)
> return mask;
> }
>
> +static inline u32 dsa_cpu_ports(struct dsa_switch *ds)
> +{
> + u32 mask = 0;
> + int p;
> +
> + for (p = 0; p < ds->num_ports; p++)
> + if (dsa_is_cpu_port(ds, p))
> + mask |= BIT(p);
> +
> + return mask;
> +}
Hi Ansuel
We don't add a function unless it has a user. Please call it from somewhere.
Andrew
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-07 0:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-06 3:49 [PATCH] include: net: add dsa_cpu_ports function Ansuel Smith
2021-04-07 0:16 ` Andrew Lunn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).