lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 23 Feb 2022 20:04:13 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     Roopa Prabhu <roopa@...dia.com>
Cc:     <davem@...emloft.net>, <netdev@...r.kernel.org>,
        <stephen@...workplumber.org>, <nikolay@...ulusnetworks.com>,
        <idosch@...dia.com>, <dsahern@...il.com>, <bpoirier@...dia.com>
Subject: Re: [PATCH net-next v2 09/12] vxlan: vni filtering support on
 collect metadata device

On Tue, 22 Feb 2022 02:52:27 +0000 Roopa Prabhu wrote:
> diff --git a/drivers/net/vxlan/vxlan_private.h b/drivers/net/vxlan/vxlan_private.h
> index 7a946010a204..d697d6c51cb5 100644
> --- a/drivers/net/vxlan/vxlan_private.h
> +++ b/drivers/net/vxlan/vxlan_private.h
> @@ -7,6 +7,8 @@
>  #ifndef _VXLAN_PRIVATE_H
>  #define _VXLAN_PRIVATE_H
>  
> +#include <linux/rhashtable.h>
> +
>  extern unsigned int vxlan_net_id;
>  extern const u8 all_zeros_mac[ETH_ALEN + 2];
>  
> @@ -92,6 +94,38 @@ bool vxlan_addr_equal(const union vxlan_addr *a, const union vxlan_addr *b)
>  
>  #endif
>  
> +static inline int vxlan_vni_cmp(struct rhashtable_compare_arg *arg,
> +				const void *ptr)
> +{
> +	const struct vxlan_vni_node *vnode = ptr;
> +	__be32 vni = *(__be32 *)arg->key;
> +
> +	return vnode->vni != vni;
> +}

This one is called thru a pointer so can as well move to a C source
with the struct, see below.

> +static const struct rhashtable_params vxlan_vni_rht_params = {
> +	.head_offset = offsetof(struct vxlan_vni_node, vnode),
> +	.key_offset = offsetof(struct vxlan_vni_node, vni),
> +	.key_len = sizeof(__be32),
> +	.nelem_hint = 3,
> +	.max_size = VXLAN_N_VID,
> +	.obj_cmpfn = vxlan_vni_cmp,
> +	.automatic_shrinking = true,
> +};

struct definition in the header? Shouldn't it be an extern and
definition in a C file?

> +static inline struct vxlan_vni_node *
> +vxlan_vnifilter_lookup(struct vxlan_dev *vxlan, __be32 vni)
> +{
> +	struct vxlan_vni_group *vg;
> +
> +	vg = rcu_dereference_rtnl(vxlan->vnigrp);
> +	if (!vg)
> +		return NULL;
> +
> +	return rhashtable_lookup_fast(&vg->vni_hash, &vni,
> +				      vxlan_vni_rht_params);
> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ