Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f13b5468 authored by Li RongQing's avatar Li RongQing Committed by David S. Miller
Browse files

tun: not use hardcoded mask value



0x3ff in tun_hashfn is mask of TUN_NUM_FLOW_ENTRIES, instead
of hardcode, define a macro to setup the relationship with
TUN_NUM_FLOW_ENTRIES

Signed-off-by: default avatarLi RongQing <lirongqing@baidu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 039b1d5e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -200,6 +200,7 @@ struct tun_flow_entry {
};

#define TUN_NUM_FLOW_ENTRIES 1024
#define TUN_MASK_FLOW_ENTRIES (TUN_NUM_FLOW_ENTRIES - 1)

struct tun_prog {
	struct rcu_head rcu;
@@ -406,7 +407,7 @@ static inline __virtio16 cpu_to_tun16(struct tun_struct *tun, u16 val)

static inline u32 tun_hashfn(u32 rxhash)
{
	return rxhash & 0x3ff;
	return rxhash & TUN_MASK_FLOW_ENTRIES;
}

static struct tun_flow_entry *tun_flow_find(struct hlist_head *head, u32 rxhash)