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

- From: Horatiu Vultur \<horatiu.vultur@microchip.com\>
- Date: 2021-09-23 14:06:03 
- List: netdev
- Page: https://ratatoskr.run/netdev/2021/09/1519603
- Thread: https://ratatoskr.run/netdev/2021/09/1518123/t.md

```text
The 09/23/2021 09:22, Vladimir Oltean wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On Thu, Sep 23, 2021 at 09:30:59AM +0200, Horatiu Vultur wrote:
> > > 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?
> >
> > It was defined as 383 because the HW actually support this number of
> > policers. But for this SKU it is recomended to use 191, but no one will
> > stop you from using 383.
> 
> So if it is recommended to use 191, why did you use 383? Should Xiaoliang
> change that to 191, or leave it alone?

I think is better to leave it alone. I am not aware of doing any hard if
the value is 383.

> 
> > > > 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.
> 
> Strange enough, I don't remember having reports about the VCAP IS2
> policers on Seville not working, and of course being in the common code,
> we'd start with a count of 384 policers for that hardware too, and
> counting from the end. I think I even tested the policers when adding
> the VCAP IS2 constants, and they worked. Is there any sort of index
> wraparound that takes place?

I don't think there is any wraparound.

-- 
/Horatiu
```
