liquidio: fix insmod failure when multiple NICs are plugged in
authorRick Farrington <ricardo.farrington@cavium.com>
Tue, 16 May 2017 18:14:50 +0000 (11:14 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 17 May 2017 18:48:29 +0000 (14:48 -0400)
commite1e3ce623699d0cd594fa69f69371a9dbc55aa9a
treebe097d666f31a22fb11267bebdbf28cf8ddd0d97
parent8b0d3ea555876533b6aa61479335be2c9bdb47e7
liquidio: fix insmod failure when multiple NICs are plugged in

When multiple liquidio NICs are plugged in, the first insmod of the PF
driver succeeds.  But after an rmmod, a subsequent insmod fails.  Reason is
during rmmod, the PF driver resets the Octeon of only one of the NICs; it
neglects to reset the Octeons of the other NICs.

Fix the insmod failure by adding the missing Octeon resets at rmmod.  Keep
a per-NIC refcount that indicates the number of active PFs in a given NIC.
When the refcount goes to zero, then reset the Octeon of that NIC.

Signed-off-by: Rick Farrington <ricardo.farrington@cavium.com>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cavium/liquidio/lio_main.c
drivers/net/ethernet/cavium/liquidio/octeon_device.c
drivers/net/ethernet/cavium/liquidio/octeon_device.h