diff mbox

[RESEND,net,01/10] net: ethernet: mediatek: fix fails from TX housekeeping due to incorrect port setup

Message ID 1472121901-15629-2-git-send-email-sean.wang@mediatek.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sean Wang Aug. 25, 2016, 10:44 a.m. UTC
which net device the SKB is complete for depends on the forward port
on txd4 on the corresponding TX descriptor, but the information isn't
set up well in case of  SKB fragments that would lead to watchdog timeout
from the upper layer, so fix it up.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

John Crispin Aug. 25, 2016, 12:19 p.m. UTC | #1
On 25/08/2016 12:44, Sean Wang wrote:
> which net device the SKB is complete for depends on the forward port
> on txd4 on the corresponding TX descriptor, but the information isn't
> set up well in case of  SKB fragments that would lead to watchdog timeout
> from the upper layer, so fix it up.
> 
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>

Acked-by: John Crispin <john@phrozen.org>
> ---
>  drivers/net/ethernet/mediatek/mtk_eth_soc.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> index 1801fd8..6e4a6ca 100644
> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> @@ -587,14 +587,15 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev,
>  	dma_addr_t mapped_addr;
>  	unsigned int nr_frags;
>  	int i, n_desc = 1;
> -	u32 txd4 = 0;
> +	u32 txd4 = 0, fport;
>  
>  	itxd = ring->next_free;
>  	if (itxd == ring->last_free)
>  		return -ENOMEM;
>  
>  	/* set the forward port */
> -	txd4 |= (mac->id + 1) << TX_DMA_FPORT_SHIFT;
> +	fport = (mac->id + 1) << TX_DMA_FPORT_SHIFT;
> +	txd4 |= fport;
>  
>  	tx_buf = mtk_desc_to_tx_buf(ring, itxd);
>  	memset(tx_buf, 0, sizeof(*tx_buf));
> @@ -652,7 +653,7 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev,
>  			WRITE_ONCE(txd->txd3, (TX_DMA_SWC |
>  					       TX_DMA_PLEN0(frag_map_size) |
>  					       last_frag * TX_DMA_LS0));
> -			WRITE_ONCE(txd->txd4, 0);
> +			WRITE_ONCE(txd->txd4, fport);
>  
>  			tx_buf->skb = (struct sk_buff *)MTK_DMA_DUMMY_DESC;
>  			tx_buf = mtk_desc_to_tx_buf(ring, txd);
>
diff mbox

Patch

diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 1801fd8..6e4a6ca 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -587,14 +587,15 @@  static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev,
 	dma_addr_t mapped_addr;
 	unsigned int nr_frags;
 	int i, n_desc = 1;
-	u32 txd4 = 0;
+	u32 txd4 = 0, fport;
 
 	itxd = ring->next_free;
 	if (itxd == ring->last_free)
 		return -ENOMEM;
 
 	/* set the forward port */
-	txd4 |= (mac->id + 1) << TX_DMA_FPORT_SHIFT;
+	fport = (mac->id + 1) << TX_DMA_FPORT_SHIFT;
+	txd4 |= fport;
 
 	tx_buf = mtk_desc_to_tx_buf(ring, itxd);
 	memset(tx_buf, 0, sizeof(*tx_buf));
@@ -652,7 +653,7 @@  static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev,
 			WRITE_ONCE(txd->txd3, (TX_DMA_SWC |
 					       TX_DMA_PLEN0(frag_map_size) |
 					       last_frag * TX_DMA_LS0));
-			WRITE_ONCE(txd->txd4, 0);
+			WRITE_ONCE(txd->txd4, fport);
 
 			tx_buf->skb = (struct sk_buff *)MTK_DMA_DUMMY_DESC;
 			tx_buf = mtk_desc_to_tx_buf(ring, txd);