nfp: reset local locks on init
authorJakub Kicinski <jakub.kicinski@netronome.com>
Wed, 25 Apr 2018 04:17:01 +0000 (21:17 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 25 Apr 2018 18:07:04 +0000 (14:07 -0400)
commit3e3e9fd8b6f0dd2d387d0dc666b770fe0dc36b33
tree2c224ad747e799472ce88c6c0dee3deb6f293db1
parentc77bbc648faf4a6647c4f4446ca82e231475ffb5
nfp: reset local locks on init

NFP locks record the owner when held, for PCIe devices the owner
ID will be the PCIe link number.  When driver loads it should scan
known locks and if they indicate that they are held by local
endpoint but the driver doesn't hold them - release them.

Locks can be left taken for instance when kernel gets kexec-ed or
after a crash.  Management FW tries to clean up stale locks too,
but it currently depends on PCIe link going down which doesn't
always happen.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/nfp_main.c
drivers/net/ethernet/netronome/nfp/nfpcore/nfp.h
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cpp.h
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_mutex.c
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_resource.c