aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorKoen Vandeputte <koen.vandeputte@ncentric.com>2018-08-07 11:44:36 +0200
committerKoen Vandeputte <koen.vandeputte@ncentric.com>2018-08-07 12:53:48 +0200
commit0d283c0180a22610ed5bee988902525dee90cc71 (patch)
tree42113f6d5a8eb6b1eac6140b176dc53be16f66cd /target
parent06beefd6d54c9491c93f03dfdd6174fd29dd3ad8 (diff)
downloadupstream-0d283c0180a22610ed5bee988902525dee90cc71.tar.gz
upstream-0d283c0180a22610ed5bee988902525dee90cc71.tar.bz2
upstream-0d283c0180a22610ed5bee988902525dee90cc71.zip
cns3xxx: ethernet: use circular queue checks consistently
Use the same method for setting queue index pointers consistenly throughout the source file. Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Diffstat (limited to 'target')
-rw-r--r--target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c b/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c
index 9397a9e7ab..77a7ab73d5 100644
--- a/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c
+++ b/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c
@@ -595,21 +595,23 @@ static void eth_complete_tx(struct sw *sw)
desc = &(tx_ring)->desc[index];
for (i = 0; i < num_used; i++) {
- if (desc->cown) {
- skb = tx_ring->buff_tab[index];
- tx_ring->buff_tab[index] = 0;
- if (skb)
- dev_kfree_skb_any(skb);
- dma_unmap_single(sw->dev, tx_ring->phys_tab[index],
- desc->sdl, DMA_TO_DEVICE);
- if (++index == TX_DESCS) {
- index = 0;
- desc = &(tx_ring)->desc[index];
- } else {
- desc++;
- }
- } else {
+ if (!desc->cown)
break;
+
+ skb = tx_ring->buff_tab[index];
+ tx_ring->buff_tab[index] = 0;
+
+ if (skb)
+ dev_kfree_skb_any(skb);
+
+ dma_unmap_single(sw->dev, tx_ring->phys_tab[index], desc->sdl, DMA_TO_DEVICE);
+
+ if (index == TX_DESCS - 1) {
+ index = 0;
+ desc = &(tx_ring)->desc[index];
+ } else {
+ index++;
+ desc++;
}
}
@@ -705,10 +707,11 @@ static int eth_poll(struct napi_struct *napi, int budget)
}
received++;
- if (++i == RX_DESCS) {
+ if (i == RX_DESCS - 1) {
i = 0;
desc = &(rx_ring)->desc[i];
} else {
+ i++;
desc++;
}
}