summaryrefslogtreecommitdiff
path: root/target/linux/generic/patches-3.18/077-04-bgmac-simplify-tx-ring-index-handling.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/generic/patches-3.18/077-04-bgmac-simplify-tx-ring-index-handling.patch')
-rw-r--r--target/linux/generic/patches-3.18/077-04-bgmac-simplify-tx-ring-index-handling.patch16
1 files changed, 9 insertions, 7 deletions
diff --git a/target/linux/generic/patches-3.18/077-04-bgmac-simplify-tx-ring-index-handling.patch b/target/linux/generic/patches-3.18/077-04-bgmac-simplify-tx-ring-index-handling.patch
index cf62a50..241a308 100644
--- a/target/linux/generic/patches-3.18/077-04-bgmac-simplify-tx-ring-index-handling.patch
+++ b/target/linux/generic/patches-3.18/077-04-bgmac-simplify-tx-ring-index-handling.patch
@@ -25,22 +25,24 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
int i;
if (skb->len > BGMAC_DESC_CTL1_LEN) {
-@@ -158,13 +157,7 @@ static netdev_tx_t bgmac_dma_tx_add(stru
- skb_checksum_help(skb);
+@@ -159,12 +158,10 @@ static netdev_tx_t bgmac_dma_tx_add(stru
nr_frags = skb_shinfo(skb)->nr_frags;
--
+
- if (ring->start <= ring->end)
- free_slots = ring->start - ring->end + BGMAC_TX_RING_SLOTS;
- else
- free_slots = ring->start - ring->end;
-
- if (free_slots <= nr_frags + 1) {
++ /* ring->end - ring->start will return the number of valid slots,
++ * even when ring->end overflows
++ */
+ if (ring->end - ring->start + nr_frags + 1 >= BGMAC_TX_RING_SLOTS) {
bgmac_err(bgmac, "TX ring is full, queue should be stopped!\n");
netif_stop_queue(net_dev);
return NETDEV_TX_BUSY;
-@@ -200,7 +193,7 @@ static netdev_tx_t bgmac_dma_tx_add(stru
+@@ -200,7 +197,7 @@ static netdev_tx_t bgmac_dma_tx_add(stru
}
slot->skb = skb;
@@ -49,7 +51,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
netdev_sent_queue(net_dev, skb->len);
wmb();
-@@ -208,13 +201,12 @@ static netdev_tx_t bgmac_dma_tx_add(stru
+@@ -208,13 +205,12 @@ static netdev_tx_t bgmac_dma_tx_add(stru
/* Increase ring->end to point empty slot. We tell hardware the first
* slot it should *not* read.
*/
@@ -66,7 +68,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
netif_stop_queue(net_dev);
return NETDEV_TX_OK;
-@@ -256,17 +248,17 @@ static void bgmac_dma_tx_free(struct bgm
+@@ -256,17 +252,17 @@ static void bgmac_dma_tx_free(struct bgm
empty_slot &= BGMAC_DMA_TX_STATDPTR;
empty_slot /= sizeof(struct bgmac_dma_desc);
@@ -93,7 +95,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
if (ctl1 & BGMAC_DESC_CTL0_SOF)
/* Unmap no longer used buffer */
dma_unmap_single(dma_dev, slot->dma_addr, len,
-@@ -284,10 +276,8 @@ static void bgmac_dma_tx_free(struct bgm
+@@ -284,10 +280,8 @@ static void bgmac_dma_tx_free(struct bgm
slot->skb = NULL;
}