From: Jakub Kicinski Date: Mon, 29 May 2017 00:53:03 +0000 (-0700) Subject: nfp: don't add ring size to index calculations X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=770f0cea19510098cb01ac87370e800b53a6bf5d;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git nfp: don't add ring size to index calculations Adding ring size to index calculation is pointless, since index will be masked with ring size - 1. Suggested-by: David Laight Signed-off-by: Jakub Kicinski Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c index 9312a737fbc9..68013d048e9d 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c @@ -928,7 +928,7 @@ static void nfp_net_tx_complete(struct nfp_net_tx_ring *tx_ring) if (qcp_rd_p == tx_ring->qcp_rd_p) return; - todo = D_IDX(tx_ring, qcp_rd_p + tx_ring->cnt - tx_ring->qcp_rd_p); + todo = D_IDX(tx_ring, qcp_rd_p - tx_ring->qcp_rd_p); while (todo--) { idx = D_IDX(tx_ring, tx_ring->rd_p++); @@ -999,7 +999,7 @@ static bool nfp_net_xdp_complete(struct nfp_net_tx_ring *tx_ring) if (qcp_rd_p == tx_ring->qcp_rd_p) return true; - todo = D_IDX(tx_ring, qcp_rd_p + tx_ring->cnt - tx_ring->qcp_rd_p); + todo = D_IDX(tx_ring, qcp_rd_p - tx_ring->qcp_rd_p); done_all = todo <= NFP_NET_XDP_MAX_COMPLETE; todo = min(todo, NFP_NET_XDP_MAX_COMPLETE);