Re: [PATCH net-next v2] net: mvpp2: Don't use dynamic allocs for local variables

From: Maxime Chevallier
Date: Wed Mar 21 2018 - 17:15:00 EST


Hello Yan,

On Wed, 21 Mar 2018 19:57:47 +0000,
Yan Markman <ymarkman@xxxxxxxxxxx> wrote :

> Hi Maxime

Please avoid top-posting on this list.

> Please check the TWO points:
>
> 1). The mvpp2_prs_flow_find() returns TID if found
> The TID=0 is valid FOUND value
> For Not-found use -ENOENT (just like your mvpp2_prs_vlan_find)

This is actually what is used in this patch. You might be refering to
a previous draft version of this patch.

> 2). The original code always uses "mvpp2_prs_entry *pe" storage
> Zero-Allocated Please check the correctnes of new "mvpp2_prs_entry
> pe" without memset(pe, 0, sizeof(pe));
> in all procedures where pe=kzalloc() has been replaced

I think we're good on that regard. On places where I didn't memset the
prs_entry, the pe.index field is set, and this is followed by a read
from TCAM that will initialize the prs_entry to the correct value :

pe.index = tid;
mvpp2_prs_hw_read(priv, &pe);

> Thanks
> Yan Markman

[...]

Thanks,

Maxime