nfp: core: allow 4-byte aligned accesses to Memory Units
authorJakub Kicinski <jakub.kicinski@netronome.com>
Tue, 22 May 2018 05:12:46 +0000 (22:12 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 23 May 2018 18:26:18 +0000 (14:26 -0400)
commitb586c77b3c657a87e5a754c69b9a40c2301416dc
treee1108b1a400ec293164b59016f596086fe3e19ba
parenta0d163f4327febeae2c98c4b1aaff3552e5b1667
nfp: core: allow 4-byte aligned accesses to Memory Units

Current code doesn't enforce length requirements on 32bit accesses
with action NFP_CPP_ACTION_RW to memory units, but if the access
is only aligned to 4 bytes as well we will fall into the explicit
access case and error out.  Such accesses are correct, allow them
by lowering the width earlier.

While at it use a switch statement to improve readability.

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/nfpcore/nfp6000_pcie.c