lkml.org 
[lkml]   [2021]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH net-next 1/3] net: prestera: acl: migrate to new vTCAM api
Date
Hi Jakub,

Thanks for reviewing the changes.

> On Tue, 23 Nov 2021 18:58:00 +0200 Volodymyr Mytnyk wrote:
> > From: Volodymyr Mytnyk <vmytnyk@marvell.com>
> >
> > - Add new vTCAM HW API to configure HW ACLs.
> > - Migrate acl to use new vTCAM HW API.
> > - No counter support in this patch-set.
> >
> > Co-developed-by: Yevhen Orlov <yevhen.orlov@plvision.eu>
> > Signed-off-by: Yevhen Orlov <yevhen.orlov@plvision.eu>
> > Signed-off-by: Volodymyr Mytnyk <vmytnyk@marvell.com>
>
> > struct prestera_acl_ruleset {
> > + struct rhash_head ht_node; /* Member of acl HT */
> > + struct prestera_acl_ruleset_ht_key ht_key;
> > struct rhashtable rule_ht;
> > - struct prestera_switch *sw;
> > - u16 id;
> > + struct prestera_acl *acl;
> > + unsigned long rule_count;
> > + refcount_t refcount;
> > + void *keymask;
> > + bool offload;
> > + u32 vtcam_id;
> > + u16 pcl_id;
>
> put the pcl_id earlier for better packing?

Fixed in v2, checked in all places, uploaded the changes today.

>
> > };
>
> > +struct prestera_acl_vtcam {
> > + struct list_head list;
> > + __be32 keymask[__PRESTERA_ACL_RULE_MATCH_TYPE_MAX];
> > + bool is_keymask_set;
> > + refcount_t refcount;
> > + u8 lookup;
>
> same here, 1B types together

Fixed

>
> > u32 id;
> > };
>
> > +int prestera_acl_ruleset_keymask_set(struct prestera_acl_ruleset *ruleset,
> > + void *keymask)
> > {
> > - prestera_hw_acl_ruleset_del(ruleset->sw, ruleset->id);
> > - rhashtable_destroy(&ruleset->rule_ht);
> > - kfree(ruleset);
> > + void *__keymask;
> > +
> > + if (!keymask || !ruleset)
>
> Can this legitimately happen? No defensive programming, please.

This function is unused here, so just removed from this patch.

>
> > + return -EINVAL;
> > +
> > + __keymask = kmalloc(ACL_KEYMASK_SIZE, GFP_KERNEL);
> > + if (!__keymask)
> > + return -ENOMEM;
> > +
> > + memcpy(__keymask, keymask, ACL_KEYMASK_SIZE);
>
> kmemdup()
>
> > + ruleset->keymask = __keymask;
> > +
> > + return 0;
> > }

Regards,
Volodymyr
\
 
 \ /
  Last update: 2021-11-30 13:27    [W:1.862 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site