RE: [PATCH v4 net-next 7/8] net: mscc: ocelot: use index to set vcap policer

From: Xiaoliang Yang
Date: Wed Sep 22 2021 - 21:52:45 EST



On Wed, Sep 22, 2021 at 13:18:37 +0000, Vladimir Oltean wrote:
> > Policer was previously automatically assigned from the highest index
> > to the lowest index from policer pool. But police action of tc flower
> > now uses index to set an police entry. This patch uses the police
> > index to set vcap policers, so that one policer can be shared by multiple
> rules.
> >
> > Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@xxxxxxx>
> > ---
> > +#define VSC9959_VCAP_POLICER_BASE 63
> > +#define VSC9959_VCAP_POLICER_MAX 383
> >
>
> > +#define VSC7514_VCAP_POLICER_BASE 128
> > +#define VSC7514_VCAP_POLICER_MAX 191
>
> I think this deserves an explanation.
>
> The VSC7514 driver uses the max number of policers as 383 (0x17f) ever since
> commit b596229448dd ("net: mscc: ocelot: Add support for tcam"), aka the
> very beginning.
>
> Yet, the documentation at "3.10.1 Policer Allocation"
> https://ww1.microchip.com/downloads/en/DeviceDoc/VMDS-10491.pdf
> says very clearly that there are only 192 policers indeed.
>
> What's going on?

In commit commit b596229448dd ("net: mscc: ocelot: Add support for tcam"), Horatiu Vultur define the max number of policers as 383:
+#define OCELOT_POLICER_DISCARD 0x17f
VCAP IS2 use this policer to set drop action. I did not change this and set the VCAP policers with 128-191 according to the VSC7514 document.

I don't know why 383 was used as the maximum value of policer in the original code. Can Microchip people check the code or the documentation for errors?

>
> Also, FWIW, Seville has this policer allocation:
>
> 0 ----+----------------------+
> | Port Policers (11) |
> 11 ----+----------------------+
> | VCAP Policers (21) |
> 32 ----+----------------------+
> | QoS Policers (88) |
> 120 ----+----------------------+
> | VCAP Policers (43) |
> 162 ----+----------------------+

I didn't find Seville's document, if this allocation is right, I will add it in Seville driver.

Thanks,
Xiaoliang