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>
This commit is contained in:
parent
06beefd6d5
commit
0d283c0180
1 changed files with 18 additions and 15 deletions
|
@ -595,21 +595,23 @@ static void eth_complete_tx(struct sw *sw)
|
||||||
desc = &(tx_ring)->desc[index];
|
desc = &(tx_ring)->desc[index];
|
||||||
|
|
||||||
for (i = 0; i < num_used; i++) {
|
for (i = 0; i < num_used; i++) {
|
||||||
if (desc->cown) {
|
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 {
|
|
||||||
break;
|
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++;
|
received++;
|
||||||
if (++i == RX_DESCS) {
|
if (i == RX_DESCS - 1) {
|
||||||
i = 0;
|
i = 0;
|
||||||
desc = &(rx_ring)->desc[i];
|
desc = &(rx_ring)->desc[i];
|
||||||
} else {
|
} else {
|
||||||
|
i++;
|
||||||
desc++;
|
desc++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue