@@ -778,7 +778,7 @@ static int nfp_net_tx(struct sk_buff *skb, struct net_device *netdev)
778
778
if (dma_mapping_error (& nn -> pdev -> dev , dma_addr ))
779
779
goto err_free ;
780
780
781
- wr_idx = tx_ring -> wr_p % tx_ring -> cnt ;
781
+ wr_idx = tx_ring -> wr_p & ( tx_ring -> cnt - 1 ) ;
782
782
783
783
/* Stash the soft descriptor of the head then initialize it */
784
784
txbuf = & tx_ring -> txbufs [wr_idx ];
@@ -822,7 +822,7 @@ static int nfp_net_tx(struct sk_buff *skb, struct net_device *netdev)
822
822
if (dma_mapping_error (& nn -> pdev -> dev , dma_addr ))
823
823
goto err_unmap ;
824
824
825
- wr_idx = (wr_idx + 1 ) % tx_ring -> cnt ;
825
+ wr_idx = (wr_idx + 1 ) & ( tx_ring -> cnt - 1 ) ;
826
826
tx_ring -> txbufs [wr_idx ].skb = skb ;
827
827
tx_ring -> txbufs [wr_idx ].dma_addr = dma_addr ;
828
828
tx_ring -> txbufs [wr_idx ].fidx = f ;
@@ -917,7 +917,7 @@ static void nfp_net_tx_complete(struct nfp_net_tx_ring *tx_ring)
917
917
todo = qcp_rd_p + tx_ring -> cnt - tx_ring -> qcp_rd_p ;
918
918
919
919
while (todo -- ) {
920
- idx = tx_ring -> rd_p % tx_ring -> cnt ;
920
+ idx = tx_ring -> rd_p & ( tx_ring -> cnt - 1 ) ;
921
921
tx_ring -> rd_p ++ ;
922
922
923
923
skb = tx_ring -> txbufs [idx ].skb ;
@@ -992,7 +992,7 @@ nfp_net_tx_ring_reset(struct nfp_net *nn, struct nfp_net_tx_ring *tx_ring)
992
992
int nr_frags , fidx , idx ;
993
993
struct sk_buff * skb ;
994
994
995
- idx = tx_ring -> rd_p % tx_ring -> cnt ;
995
+ idx = tx_ring -> rd_p & ( tx_ring -> cnt - 1 ) ;
996
996
skb = tx_ring -> txbufs [idx ].skb ;
997
997
nr_frags = skb_shinfo (skb )-> nr_frags ;
998
998
fidx = tx_ring -> txbufs [idx ].fidx ;
@@ -1129,7 +1129,7 @@ static void nfp_net_rx_give_one(struct nfp_net_rx_ring *rx_ring,
1129
1129
{
1130
1130
unsigned int wr_idx ;
1131
1131
1132
- wr_idx = rx_ring -> wr_p % rx_ring -> cnt ;
1132
+ wr_idx = rx_ring -> wr_p & ( rx_ring -> cnt - 1 ) ;
1133
1133
1134
1134
/* Stash SKB and DMA address away */
1135
1135
rx_ring -> rxbufs [wr_idx ].frag = frag ;
@@ -1164,7 +1164,7 @@ static void nfp_net_rx_ring_reset(struct nfp_net_rx_ring *rx_ring)
1164
1164
unsigned int wr_idx , last_idx ;
1165
1165
1166
1166
/* Move the empty entry to the end of the list */
1167
- wr_idx = rx_ring -> wr_p % rx_ring -> cnt ;
1167
+ wr_idx = rx_ring -> wr_p & ( rx_ring -> cnt - 1 ) ;
1168
1168
last_idx = rx_ring -> cnt - 1 ;
1169
1169
rx_ring -> rxbufs [wr_idx ].dma_addr = rx_ring -> rxbufs [last_idx ].dma_addr ;
1170
1170
rx_ring -> rxbufs [wr_idx ].frag = rx_ring -> rxbufs [last_idx ].frag ;
@@ -1413,7 +1413,7 @@ static int nfp_net_rx(struct nfp_net_rx_ring *rx_ring, int budget)
1413
1413
int idx ;
1414
1414
1415
1415
while (pkts_polled < budget ) {
1416
- idx = rx_ring -> rd_p % rx_ring -> cnt ;
1416
+ idx = rx_ring -> rd_p & ( rx_ring -> cnt - 1 ) ;
1417
1417
1418
1418
rxd = & rx_ring -> rxds [idx ];
1419
1419
if (!(rxd -> rxd .meta_len_dd & PCIE_DESC_RX_DD ))
0 commit comments