netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] hip04_eth: fix missing error handle for build_skb failed
@ 2016-01-13  3:11 Weidong Wang
  2016-01-13  3:48 ` Ding Tianhong
  2016-01-13 20:48 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Weidong Wang @ 2016-01-13  3:11 UTC (permalink / raw)
  To: David Miller, Ding Tianhong, arnd, zhangfei.gao, dan.carpenter,
	tglx
  Cc: netdev, linux-kernel

when build_skb failed, we should goto refill the buffer.

Signed-off-by: Weidong Wang <wangweidong1@huawei.com>
---
 drivers/net/ethernet/hisilicon/hip04_eth.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c
index 3b39fdd..417f131 100644
--- a/drivers/net/ethernet/hisilicon/hip04_eth.c
+++ b/drivers/net/ethernet/hisilicon/hip04_eth.c
@@ -500,8 +500,10 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget)
 	while (cnt && !last) {
 		buf = priv->rx_buf[priv->rx_head];
 		skb = build_skb(buf, priv->rx_buf_size);
-		if (unlikely(!skb))
+		if (unlikely(!skb)) {
 			net_dbg_ratelimited("build_skb failed\n");
+			goto refill;
+		}

 		dma_unmap_single(&ndev->dev, priv->rx_phys[priv->rx_head],
 				 RX_BUF_SIZE, DMA_FROM_DEVICE);
@@ -528,6 +530,7 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget)
 			rx++;
 		}

+refill:
 		buf = netdev_alloc_frag(priv->rx_buf_size);
 		if (!buf)
 			goto done;
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] hip04_eth: fix missing error handle for build_skb failed
  2016-01-13  3:11 [PATCH net-next] hip04_eth: fix missing error handle for build_skb failed Weidong Wang
@ 2016-01-13  3:48 ` Ding Tianhong
  2016-01-13 20:48 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Ding Tianhong @ 2016-01-13  3:48 UTC (permalink / raw)
  To: Weidong Wang, David Miller, arnd, zhangfei.gao, dan.carpenter,
	tglx
  Cc: netdev, linux-kernel

On 2016/1/13 11:11, Weidong Wang wrote:
> when build_skb failed, we should goto refill the buffer.
> 
> Signed-off-by: Weidong Wang <wangweidong1@huawei.com>
> ---

Acked-by: Ding Tainhong <dingtianhong@huawei.com>

>  drivers/net/ethernet/hisilicon/hip04_eth.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c
> index 3b39fdd..417f131 100644
> --- a/drivers/net/ethernet/hisilicon/hip04_eth.c
> +++ b/drivers/net/ethernet/hisilicon/hip04_eth.c
> @@ -500,8 +500,10 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget)
>  	while (cnt && !last) {
>  		buf = priv->rx_buf[priv->rx_head];
>  		skb = build_skb(buf, priv->rx_buf_size);
> -		if (unlikely(!skb))
> +		if (unlikely(!skb)) {
>  			net_dbg_ratelimited("build_skb failed\n");
> +			goto refill;
> +		}
> 
>  		dma_unmap_single(&ndev->dev, priv->rx_phys[priv->rx_head],
>  				 RX_BUF_SIZE, DMA_FROM_DEVICE);
> @@ -528,6 +530,7 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget)
>  			rx++;
>  		}
> 
> +refill:
>  		buf = netdev_alloc_frag(priv->rx_buf_size);
>  		if (!buf)
>  			goto done;
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] hip04_eth: fix missing error handle for build_skb failed
  2016-01-13  3:11 [PATCH net-next] hip04_eth: fix missing error handle for build_skb failed Weidong Wang
  2016-01-13  3:48 ` Ding Tianhong
@ 2016-01-13 20:48 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-01-13 20:48 UTC (permalink / raw)
  To: wangweidong1
  Cc: dingtianhong, arnd, zhangfei.gao, dan.carpenter, tglx, netdev,
	linux-kernel

From: Weidong Wang <wangweidong1@huawei.com>
Date: Wed, 13 Jan 2016 11:11:09 +0800

> when build_skb failed, we should goto refill the buffer.
> 
> Signed-off-by: Weidong Wang <wangweidong1@huawei.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-01-13 20:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-13  3:11 [PATCH net-next] hip04_eth: fix missing error handle for build_skb failed Weidong Wang
2016-01-13  3:48 ` Ding Tianhong
2016-01-13 20:48 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).