summaryrefslogtreecommitdiff
path: root/include/soc
diff options
context:
space:
mode:
authorVladimir Oltean <vladimir.oltean@nxp.com>2020-06-21 14:46:02 +0300
committerDavid S. Miller <davem@davemloft.net>2020-06-22 20:41:05 -0700
commit96b029b004942ecdb50e40d3e45cdc8a3aec9135 (patch)
tree8344fe871515b6c0064b1c72c543172aa1604b21 /include/soc
parent209edf95da63a0ad19750769f473f4ea1553d21d (diff)
net: mscc: ocelot: introduce macros for iterating over PGIDs
The current iterators are impossible to understand at first glance without switching back and forth between the definitions and their actual use in the for loops. So introduce some convenience names to help readability. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/soc')
-rw-r--r--include/soc/mscc/ocelot.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h
index 80415b63ccfa..e050f8121ba2 100644
--- a/include/soc/mscc/ocelot.h
+++ b/include/soc/mscc/ocelot.h
@@ -65,6 +65,21 @@
#define PGID_MCIPV4 62
#define PGID_MCIPV6 63
+#define for_each_unicast_dest_pgid(ocelot, pgid) \
+ for ((pgid) = 0; \
+ (pgid) < (ocelot)->num_phys_ports; \
+ (pgid)++)
+
+#define for_each_nonreserved_multicast_dest_pgid(ocelot, pgid) \
+ for ((pgid) = (ocelot)->num_phys_ports + 1; \
+ (pgid) < PGID_CPU; \
+ (pgid)++)
+
+#define for_each_aggr_pgid(ocelot, pgid) \
+ for ((pgid) = PGID_AGGR; \
+ (pgid) < PGID_SRC; \
+ (pgid)++)
+
/* Aggregation PGIDs, one per Link Aggregation Code */
#define PGID_AGGR 64