Message ID | 20201020072321.36921-3-xiaoliang.yang_1@nxp.com |
---|---|
State | New |
Headers | show |
Series | net: dsa: felix: psfp support on | expand |
On Tue, Oct 20, 2020 at 03:23:18PM +0800, Xiaoliang Yang wrote: > VSC9959 supports Per-Stream Filtering and Policing(PSFP), which is > processing after VCAP blocks. We set this block on chain 30000 and > set vcap IS2 chain to goto PSFP chain if hardware support. > > An example set is: > > tc filter add dev swp0 ingress chain 21000 flower > skip_sw action goto chain 30000 > > Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com> > --- I will defer to Microchip people whether 30000 is a good chain number for TSN offloads. Do you have other ingress VCAPs that you would like to number 30000?
The 10/20/2020 23:27, Vladimir Oltean wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > On Tue, Oct 20, 2020 at 03:23:18PM +0800, Xiaoliang Yang wrote: > > VSC9959 supports Per-Stream Filtering and Policing(PSFP), which is > > processing after VCAP blocks. We set this block on chain 30000 and > > set vcap IS2 chain to goto PSFP chain if hardware support. > > > > An example set is: > > > tc filter add dev swp0 ingress chain 21000 flower > > skip_sw action goto chain 30000 > > > > Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com> > > --- > > I will defer to Microchip people whether 30000 is a good chain number > for TSN offloads. Do you have other ingress VCAPs that you would like to > number 30000? We see no problems with using ingress chain 30000 for PSFP.
diff --git a/drivers/net/ethernet/mscc/ocelot_flower.c b/drivers/net/ethernet/mscc/ocelot_flower.c index 729495a1a77e..89f35aecbda7 100644 --- a/drivers/net/ethernet/mscc/ocelot_flower.c +++ b/drivers/net/ethernet/mscc/ocelot_flower.c @@ -11,15 +11,14 @@ /* Arbitrarily chosen constants for encoding the VCAP block and lookup number * into the chain number. This is UAPI. */ -#define VCAP_BLOCK 10000 #define VCAP_LOOKUP 1000 #define VCAP_IS1_NUM_LOOKUPS 3 #define VCAP_IS2_NUM_LOOKUPS 2 #define VCAP_IS2_NUM_PAG 256 #define VCAP_IS1_CHAIN(lookup) \ - (1 * VCAP_BLOCK + (lookup) * VCAP_LOOKUP) + (OCELOT_INGRESS_IS1 * OCELOT_HW_BLOCK + (lookup) * VCAP_LOOKUP) #define VCAP_IS2_CHAIN(lookup, pag) \ - (2 * VCAP_BLOCK + (lookup) * VCAP_LOOKUP + (pag)) + (OCELOT_INGRESS_IS2 * OCELOT_HW_BLOCK + (lookup) * VCAP_LOOKUP + (pag)) static int ocelot_chain_to_block(int chain, bool ingress) { @@ -84,7 +83,8 @@ static bool ocelot_is_goto_target_valid(int goto_target, int chain, goto_target == VCAP_IS1_CHAIN(1) || goto_target == VCAP_IS1_CHAIN(2) || goto_target == VCAP_IS2_CHAIN(0, 0) || - goto_target == VCAP_IS2_CHAIN(1, 0)); + goto_target == VCAP_IS2_CHAIN(1, 0) || + goto_target == OCELOT_PSFP_CHAIN); if (chain == VCAP_IS1_CHAIN(0)) return (goto_target == VCAP_IS1_CHAIN(1)); @@ -111,7 +111,11 @@ static bool ocelot_is_goto_target_valid(int goto_target, int chain, if (chain == VCAP_IS2_CHAIN(0, pag)) return (goto_target == VCAP_IS2_CHAIN(1, pag)); - /* VCAP IS2 lookup 1 cannot jump anywhere */ + /* VCAP IS2 lookup 1 can goto to PSFP block if hardware support */ + for (pag = 0; pag < VCAP_IS2_NUM_PAG; pag++) + if (chain == VCAP_IS2_CHAIN(1, pag)) + return (goto_target == OCELOT_PSFP_CHAIN); + return false; } diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 31da33fdb7ac..67e71d75fc97 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -556,6 +556,16 @@ enum ocelot_tag_prefix { OCELOT_TAG_PREFIX_LONG, }; +enum ocelot_ingress_blocks { + OCELOT_INGRESS_DEFAULT = 0, + OCELOT_INGRESS_IS1, + OCELOT_INGRESS_IS2, + OCELOT_INGRESS_PSFP, +}; + +#define OCELOT_HW_BLOCK 10000 +#define OCELOT_PSFP_CHAIN (OCELOT_INGRESS_PSFP * OCELOT_HW_BLOCK) + struct ocelot; struct ocelot_ops {