nfp: add a helper for wrapping descriptor index
authorJakub Kicinski <jakub.kicinski@netronome.com>
Tue, 16 May 2017 00:55:22 +0000 (17:55 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 16 May 2017 16:59:04 +0000 (12:59 -0400)
commit4aa3b7660aa79bb030aaa887dc16a60e02fa4348
tree1a96f186c151530f5c6b24bdb071934b34566418
parentabeeec4adf6a6fe71a6a4d8199ff0a533d73a57f
nfp: add a helper for wrapping descriptor index

We have a number of places where we calculate the descriptor
index based on a value which may have overflown.  Create a
macro for masking with the ring size.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/nfp_net.h
drivers/net/ethernet/netronome/nfp/nfp_net_common.c