mirror of
https://github.com/torvalds/linux.git
synced 2026-07-31 19:47:08 +02:00
nfp: calculate ring masks without conditionals
Ring enable masks are 64bit long. Replace mask calculation from: block_cnt == 64 ? 0xffffffffffffffffULL : (1 << block_cnt) - 1 with: (U64_MAX >> (64 - block_cnt)) to simplify the code. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Fei Qin <fei.qin@corigine.com> Signed-off-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
4b45e07907
commit
fc9769f62e
|
|
@ -2959,11 +2959,11 @@ static int nfp_net_set_config_and_enable(struct nfp_net *nn)
|
|||
for (r = 0; r < nn->dp.num_rx_rings; r++)
|
||||
nfp_net_rx_ring_hw_cfg_write(nn, &nn->dp.rx_rings[r], r);
|
||||
|
||||
nn_writeq(nn, NFP_NET_CFG_TXRS_ENABLE, nn->dp.num_tx_rings == 64 ?
|
||||
0xffffffffffffffffULL : ((u64)1 << nn->dp.num_tx_rings) - 1);
|
||||
nn_writeq(nn, NFP_NET_CFG_TXRS_ENABLE,
|
||||
U64_MAX >> (64 - nn->dp.num_tx_rings));
|
||||
|
||||
nn_writeq(nn, NFP_NET_CFG_RXRS_ENABLE, nn->dp.num_rx_rings == 64 ?
|
||||
0xffffffffffffffffULL : ((u64)1 << nn->dp.num_rx_rings) - 1);
|
||||
nn_writeq(nn, NFP_NET_CFG_RXRS_ENABLE,
|
||||
U64_MAX >> (64 - nn->dp.num_rx_rings));
|
||||
|
||||
if (nn->dp.netdev)
|
||||
nfp_net_write_mac_addr(nn, nn->dp.netdev->dev_addr);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user