net: manage napi add/del idempotence explicitly
authorJakub Kicinski <kuba@kernel.org>
Wed, 9 Sep 2020 17:37:52 +0000 (10:37 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 10 Sep 2020 20:08:46 +0000 (13:08 -0700)
commit4d092dd2041a5f328410ad16d63b8606c24e8604
tree453786a03afc9e7c8cfa8cf37af80ee023fb50d0
parent5198d545dba8ad893f5e5a029ca8d43ee7bcf011
net: manage napi add/del idempotence explicitly

To RCUify napi->dev_list we need to replace list_del_init()
with list_del_rcu(). There is no _init() version for RCU for
obvious reasons. Up until now netif_napi_del() was idempotent
so to make sure it remains such add a bit which is set when
NAPI is listed, and cleared when it removed. Since we don't
expect multiple calls to netif_napi_add() to be correct,
add a warning on that side.

Now that napi_hash_add / napi_hash_del are only called by
napi_add / del we can actually steal its bit. We just need
to make sure hash node is initialized correctly.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netdevice.h
net/core/dev.c