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

Vladimir Oltean
2021-09-22T13:18:44Z

On Wed, Sep 22, 2021 at 06:52:01PM +0800, Xiaoliang Yang 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@nxp.com>
> ---
> +#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?

Also, FWIW, Seville has this policer allocation:

0 ----+----------------------+
| Port Policers (11) |
11 ----+----------------------+
| VCAP Policers (21) |
32 ----+----------------------+
| QoS Policers (88) |
120 ----+----------------------+
| VCAP Policers (43) |
162 ----+----------------------+