On Sat, Sep 07, 2019 at 05:25:10PM -0400, Vivien Didelot wrote: > Hi Andrew, > > On Sat, 7 Sep 2019 22:32:56 +0200, Andrew Lunn <and...@lunn.ch> wrote: > > > + policy = devm_kzalloc(chip->dev, sizeof(*policy), GFP_KERNEL); > > > + if (!policy) > > > + return -ENOMEM; > > > > I think this might be the first time we have done dynamic memory > > allocation in the mv88e6xxx driver. It might even be a first for a DSA > > driver? > > > > I'm not saying it is wrong, but maybe we should discuss it. > > > > I assume you are doing this because the ATU entry itself is not > > sufficient? > > > > How much memory is involved here, worst case? I assume one struct > > mv88e6xxx_policy per ATU entry? Which you think is too much to > > allocate as part of chip? I guess most users will never use this > > feature, so for most users it would be wasted memory. So i do see the > > point for dynamically allocating it. > > A layer 2 policy is not limited to the ATU. It can also be based on a VTU > entry, on the port's Etype, or frame's Etype. We can have 0, 1 or literally > thousands of policies programmed by the user.
O.K, then it has to by dynamic memory. Reviewed-by: Andrew Lunn <and...@lunn.ch> Andrew