summaryrefslogtreecommitdiff
path: root/drivers/net/dsa/bcm_sf2_regs.h
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2017-10-20 14:39:45 -0700
committerDavid S. Miller <davem@davemloft.net>2017-10-23 03:06:47 +0100
commit5d80bcbb631ce035f37bce1924fe73ed0d77b546 (patch)
treeb193ea4c80ebbf26d0ac22a7cf9f309cc8da3537 /drivers/net/dsa/bcm_sf2_regs.h
parent3306145866b62ff9087b4fde489df4b3ee8755c1 (diff)
net: dsa: bcm_sf2: Make UDF slices more configurable
In preparation for introducing IPv6 rules support, make the cfp_udf_layout more flexible and match more accurately how the HW is designed: we have 3 + 1 slices per protocol, but we may not be using all of them and we are relative to a particular base offset (slice A for IPv4 for instance). Also populate the slice number that should be used (slice 1 for IPv4) based on the lookup function. Finally, we introduce two helper functions: udf_upper_bits() and udf_lower_bits() to help setting the UDF_n_* valid bits based on the number of UDFs valid within a slice. Update the IPv4 rule setting to make use of it to be more robust wrt. change in number of User Defined Fields being programmed. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/bcm_sf2_regs.h')
-rw-r--r--drivers/net/dsa/bcm_sf2_regs.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/dsa/bcm_sf2_regs.h b/drivers/net/dsa/bcm_sf2_regs.h
index 61bc9729383f..263e4c758795 100644
--- a/drivers/net/dsa/bcm_sf2_regs.h
+++ b/drivers/net/dsa/bcm_sf2_regs.h
@@ -409,7 +409,8 @@ enum bcm_sf2_reg_offs {
#define CFG_UDF_EOL3 (3 << CFG_UDF_OFFSET_BASE_SHIFT)
/* Number of slices for IPv4, IPv6 and non-IP */
-#define UDF_NUM_SLICES 9
+#define UDF_NUM_SLICES 4
+#define UDFS_PER_SLICE 9
/* Spacing between different slices */
#define UDF_SLICE_OFFSET 0x40