Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1419287 > unrolled thread
| Started by | John Crispin <john@phrozen.org> |
|---|---|
| First post | 2016-06-10 13:40 +0200 |
| Last post | 2016-06-11 08:40 +0200 |
| Articles | 10 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH V2 00/11] net: mediatek: various small fixes John Crispin <john@phrozen.org> - 2016-06-10 13:40 +0200
[PATCH V2 05/11] net: mediatek: add next data pointer coherency protection John Crispin <john@phrozen.org> - 2016-06-10 13:40 +0200
[PATCH V2 06/11] net: mediatek: disable all interrupts during probe John Crispin <john@phrozen.org> - 2016-06-10 13:40 +0200
Re: [PATCH V2 00/11] net: mediatek: various small fixes John Crispin <john@phrozen.org> - 2016-06-10 13:40 +0200
Re: [PATCH V2 00/11] net: mediatek: various small fixes David Miller <davem@davemloft.net> - 2016-06-10 19:50 +0200
Re: [PATCH V2 00/11] net: mediatek: various small fixes John Crispin <john@phrozen.org> - 2016-06-10 20:00 +0200
[PATCH V2 10/11] net: mediatek: only wake the queue if it is stopped John Crispin <john@phrozen.org> - 2016-06-10 13:40 +0200
[PATCH V2 01/11] net: mediatek: add missing return code check John Crispin <john@phrozen.org> - 2016-06-10 13:40 +0200
[PATCH V2 04/11] net: mediatek: dropped rx packets are not being counted properly John Crispin <john@phrozen.org> - 2016-06-10 13:40 +0200
Re: [PATCH V2 00/11] net: mediatek: various small fixes David Miller <davem@davemloft.net> - 2016-06-11 08:40 +0200
| From | John Crispin <john@phrozen.org> |
|---|---|
| Date | 2016-06-10 13:40 +0200 |
| Subject | [PATCH V2 00/11] net: mediatek: various small fixes |
| Message-ID | <rIsNs-3Vg-5@gated-at.bofh.it> |
This series contains various small fixes that we stumbled across while doing thorough testing and code level reviewing of the driver. The only patch that sticks out is the first one, which addresses a DQL related issue. The rest are just minor fixes. Changes in V2: * drop the DQL patch from the list until a better solution is found John Crispin (11): net: mediatek: add missing return code check net: mediatek: fix missing free of scratch memory net: mediatek: invalid buffer lookup in mtk_tx_map() net: mediatek: dropped rx packets are not being counted properly net: mediatek: add next data pointer coherency protection net: mediatek: disable all interrupts during probe net: mediatek: fix threshold value net: mediatek: increase watchdog_timeo net: mediatek: fix off by one in the TX ring allocation net: mediatek: only wake the queue if it is stopped net: mediatek: remove superfluous queue wake up call drivers/net/ethernet/mediatek/mtk_eth_soc.c | 61 ++++++++++++++++++--------- drivers/net/ethernet/mediatek/mtk_eth_soc.h | 3 ++ 2 files changed, 45 insertions(+), 19 deletions(-) -- 1.7.10.4
[toc] | [next] | [standalone]
| From | John Crispin <john@phrozen.org> |
|---|---|
| Date | 2016-06-10 13:40 +0200 |
| Subject | [PATCH V2 05/11] net: mediatek: add next data pointer coherency protection |
| Message-ID | <rIsX8-3Yr-15@gated-at.bofh.it> |
| In reply to | #1419287 |
The QDMA engine can fail to update the register pointing to the next TX descriptor if this bit does not get set in the QDMA configuration register. Not setting this bit can result in invalid values inside the TX rings registers which will causes TX stalls. Signed-off-by: John Crispin <john@phrozen.org> --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 +- drivers/net/ethernet/mediatek/mtk_eth_soc.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 0610262..bfac376 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -1261,7 +1261,7 @@ static int mtk_start_dma(struct mtk_eth *eth) mtk_w32(eth, MTK_TX_WB_DDONE | MTK_RX_DMA_EN | MTK_TX_DMA_EN | MTK_RX_2B_OFFSET | MTK_DMA_SIZE_16DWORDS | - MTK_RX_BT_32DWORDS, + MTK_RX_BT_32DWORDS | MTK_NDP_CO_PRO, MTK_QDMA_GLO_CFG); return 0; diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h index 57f7e8a..a5eb7c6 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h @@ -91,6 +91,7 @@ #define MTK_QDMA_GLO_CFG 0x1A04 #define MTK_RX_2B_OFFSET BIT(31) #define MTK_RX_BT_32DWORDS (3 << 11) +#define MTK_NDP_CO_PRO BIT(10) #define MTK_TX_WB_DDONE BIT(6) #define MTK_DMA_SIZE_16DWORDS (2 << 4) #define MTK_RX_DMA_BUSY BIT(3) -- 1.7.10.4
[toc] | [prev] | [next] | [standalone]
| From | John Crispin <john@phrozen.org> |
|---|---|
| Date | 2016-06-10 13:40 +0200 |
| Subject | [PATCH V2 06/11] net: mediatek: disable all interrupts during probe |
| Message-ID | <rIsX7-3Yr-5@gated-at.bofh.it> |
| In reply to | #1419287 |
The current code only disables those IRQs that we will later use. To ensure that we have a predefined state, we really want to disable all IRQs. Change the code to disable all IRQs to achieve this. Signed-off-by: John Crispin <john@phrozen.org> --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index bfac376..93af4e3 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -1375,7 +1375,7 @@ static int __init mtk_hw_init(struct mtk_eth *eth) /* disable delay and normal interrupt */ mtk_w32(eth, 0, MTK_QDMA_DELAY_INT); - mtk_irq_disable(eth, MTK_TX_DONE_INT | MTK_RX_DONE_INT); + mtk_irq_disable(eth, ~0); mtk_w32(eth, RST_GL_PSE, MTK_RST_GL); mtk_w32(eth, 0, MTK_RST_GL); -- 1.7.10.4
[toc] | [prev] | [next] | [standalone]
| From | John Crispin <john@phrozen.org> |
|---|---|
| Date | 2016-06-10 13:40 +0200 |
| Message-ID | <rIsX8-3Yr-9@gated-at.bofh.it> |
| In reply to | #1419287 |
On 10/06/2016 13:27, John Crispin wrote: > This series contains various small fixes that we stumbled across while > doing thorough testing and code level reviewing of the driver. The only > patch that sticks out is the first one, which addresses a DQL related > issue. The rest are just minor fixes. > Hi David, i forgot to remove the last sentence here. can you live with that as it wont end up in the git history or do you want me to send a V3 with this line removed. John > Changes in V2: > * drop the DQL patch from the list until a better solution is found > > John Crispin (11): > net: mediatek: add missing return code check > net: mediatek: fix missing free of scratch memory > net: mediatek: invalid buffer lookup in mtk_tx_map() > net: mediatek: dropped rx packets are not being counted properly > net: mediatek: add next data pointer coherency protection > net: mediatek: disable all interrupts during probe > net: mediatek: fix threshold value > net: mediatek: increase watchdog_timeo > net: mediatek: fix off by one in the TX ring allocation > net: mediatek: only wake the queue if it is stopped > net: mediatek: remove superfluous queue wake up call > > drivers/net/ethernet/mediatek/mtk_eth_soc.c | 61 ++++++++++++++++++--------- > drivers/net/ethernet/mediatek/mtk_eth_soc.h | 3 ++ > 2 files changed, 45 insertions(+), 19 deletions(-) >
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2016-06-10 19:50 +0200 |
| Message-ID | <rIyJc-7Ck-33@gated-at.bofh.it> |
| In reply to | #1419290 |
From: John Crispin <john@phrozen.org> Date: Fri, 10 Jun 2016 13:30:15 +0200 > > > On 10/06/2016 13:27, John Crispin wrote: >> This series contains various small fixes that we stumbled across while >> doing thorough testing and code level reviewing of the driver. The only >> patch that sticks out is the first one, which addresses a DQL related >> issue. The rest are just minor fixes. >> > > Hi David, > > i forgot to remove the last sentence here. can you live with that as it > wont end up in the git history or do you want me to send a V3 with this > line removed. What do you mean it won't end up in the GIT history? I always put this introductory text into the merge commit for the patch series. Now, I can remove it for you, which I will do.
[toc] | [prev] | [next] | [standalone]
| From | John Crispin <john@phrozen.org> |
|---|---|
| Date | 2016-06-10 20:00 +0200 |
| Message-ID | <rIySR-7H3-11@gated-at.bofh.it> |
| In reply to | #1419626 |
On 10/06/2016 19:46, David Miller wrote: > From: John Crispin <john@phrozen.org> > Date: Fri, 10 Jun 2016 13:30:15 +0200 > >> >> >> On 10/06/2016 13:27, John Crispin wrote: >>> This series contains various small fixes that we stumbled across while >>> doing thorough testing and code level reviewing of the driver. The only >>> patch that sticks out is the first one, which addresses a DQL related >>> issue. The rest are just minor fixes. >>> >> >> Hi David, >> >> i forgot to remove the last sentence here. can you live with that as it >> wont end up in the git history or do you want me to send a V3 with this >> line removed. > > What do you mean it won't end up in the GIT history? I always put this > introductory text into the merge commit for the patch series. > > Now, I can remove it for you, which I will do. > cool, thanks a lot ! John
[toc] | [prev] | [next] | [standalone]
| From | John Crispin <john@phrozen.org> |
|---|---|
| Date | 2016-06-10 13:40 +0200 |
| Subject | [PATCH V2 10/11] net: mediatek: only wake the queue if it is stopped |
| Message-ID | <rIsX8-3Yr-25@gated-at.bofh.it> |
| In reply to | #1419287 |
The current code unconditionally wakes up the queue at the end of each
tx_poll action. Change the code to only wake up the queues if any of
them have actually been stopped before.
Signed-off-by: John Crispin <john@phrozen.org>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 6daf48b..40d3cfd 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -685,6 +685,20 @@ static inline int mtk_cal_txd_req(struct sk_buff *skb)
return nfrags;
}
+static int mtk_queue_stopped(struct mtk_eth *eth)
+{
+ int i;
+
+ for (i = 0; i < MTK_MAC_COUNT; i++) {
+ if (!eth->netdev[i])
+ continue;
+ if (netif_queue_stopped(eth->netdev[i]))
+ return 1;
+ }
+
+ return 0;
+}
+
static void mtk_wake_queue(struct mtk_eth *eth)
{
int i;
@@ -929,7 +943,8 @@ static int mtk_poll_tx(struct mtk_eth *eth, int budget, bool *tx_again)
if (!total)
return 0;
- if (atomic_read(&ring->free_count) > ring->thresh)
+ if (mtk_queue_stopped(eth) &&
+ (atomic_read(&ring->free_count) > ring->thresh))
mtk_wake_queue(eth);
return total;
--
1.7.10.4
[toc] | [prev] | [next] | [standalone]
| From | John Crispin <john@phrozen.org> |
|---|---|
| Date | 2016-06-10 13:40 +0200 |
| Subject | [PATCH V2 01/11] net: mediatek: add missing return code check |
| Message-ID | <rIsX8-3Yr-31@gated-at.bofh.it> |
| In reply to | #1419287 |
The code fails to check if the scratch memory was properly allocated. Add this check and return with an error if the allocation failed. Signed-off-by: John Crispin <john@phrozen.org> --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 45f8dbf..6780886 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -467,6 +467,9 @@ static int mtk_init_fq_dma(struct mtk_eth *eth) eth->scratch_head = kcalloc(cnt, MTK_QDMA_PAGE_SIZE, GFP_KERNEL); + if (unlikely(!eth->scratch_head)) + return -ENOMEM; + dma_addr = dma_map_single(eth->dev, eth->scratch_head, cnt * MTK_QDMA_PAGE_SIZE, DMA_FROM_DEVICE); -- 1.7.10.4
[toc] | [prev] | [next] | [standalone]
| From | John Crispin <john@phrozen.org> |
|---|---|
| Date | 2016-06-10 13:40 +0200 |
| Subject | [PATCH V2 04/11] net: mediatek: dropped rx packets are not being counted properly |
| Message-ID | <rIsX8-3Yr-35@gated-at.bofh.it> |
| In reply to | #1419287 |
There are two places inside mtk_poll_rx where rx_dropped is not being
incremented properly. Fix this by adding the missing code to increment
the counter.
Signed-off-by: John Crispin <john@phrozen.org>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 4f22ee9..0610262 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -810,6 +810,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
DMA_FROM_DEVICE);
if (unlikely(dma_mapping_error(&netdev->dev, dma_addr))) {
skb_free_frag(new_data);
+ netdev->stats.rx_dropped++;
goto release_desc;
}
@@ -817,6 +818,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
skb = build_skb(data, ring->frag_size);
if (unlikely(!skb)) {
put_page(virt_to_head_page(new_data));
+ netdev->stats.rx_dropped++;
goto release_desc;
}
skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN);
--
1.7.10.4
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2016-06-11 08:40 +0200 |
| Message-ID | <rIKKl-7ZH-3@gated-at.bofh.it> |
| In reply to | #1419287 |
From: John Crispin <john@phrozen.org> Date: Fri, 10 Jun 2016 13:27:57 +0200 > This series contains various small fixes that we stumbled across while > doing thorough testing and code level reviewing of the driver. The only > patch that sticks out is the first one, which addresses a DQL related > issue. The rest are just minor fixes. > > Changes in V2: > * drop the DQL patch from the list until a better solution is found Series applied, thanks.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web