nfp: add async version of mailbox communication
authorJakub Kicinski <jakub.kicinski@netronome.com>
Tue, 11 Jun 2019 04:40:05 +0000 (21:40 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 11 Jun 2019 19:22:27 +0000 (12:22 -0700)
commite2c7114a12363eef7c3104ce223a0084d1800458
treed102f6667eb44ca335afd468b0947beef210edab
parentd7053e0433c2f6a53c049548500f6037c955b2c9
nfp: add async version of mailbox communication

Some control messages must be sent from atomic context.  The mailbox
takes sleeping locks and uses a waitqueue so add a "posted" version
of communication.

Trylock the semaphore and if that's successful kick of the device
communication.  The device communication will be completed from
a workqueue, which will also release the semaphore.

If locks are taken queue the message and return.  Schedule a
different workqueue to take the semaphore and run the communication.
Note that the there are currently no atomic users which would actually
need the return value, so all replies to posted messages are just
freed.

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/ccm.h
drivers/net/ethernet/netronome/nfp/ccm_mbox.c
drivers/net/ethernet/netronome/nfp/nfp_net.h
drivers/net/ethernet/netronome/nfp/nfp_net_common.c