netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: Zhu Yanjun <yanjun.zhu@oracle.com>
Cc: rain.1986.08.12@gmail.com, davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCHv4 1/1] net: forcedeth: add xmit_more support
Date: Tue, 5 Nov 2019 09:48:41 -0800	[thread overview]
Message-ID: <20191105094841.623b498e@cakuba.netronome.com> (raw)
In-Reply-To: <1572928001-6915-1-git-send-email-yanjun.zhu@oracle.com>

On Mon,  4 Nov 2019 23:26:41 -0500, Zhu Yanjun wrote:
> diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c
> index 05d2b47..0d21ddd 100644
> --- a/drivers/net/ethernet/nvidia/forcedeth.c
> +++ b/drivers/net/ethernet/nvidia/forcedeth.c
> @@ -2259,7 +2265,12 @@ static netdev_tx_t nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
>  			u64_stats_update_begin(&np->swstats_tx_syncp);
>  			nv_txrx_stats_inc(stat_tx_dropped);
>  			u64_stats_update_end(&np->swstats_tx_syncp);
> -			return NETDEV_TX_OK;
> +
> +			writel(NVREG_TXRXCTL_KICK | np->txrxctl_bits,
> +			       get_hwbase(dev) + NvRegTxRxControl);
> +			ret = NETDEV_TX_OK;
> +
> +			goto dma_error;

You could goto the middle of the txkick if statement here, instead of
duplicating the writel()? Actually the txkick label could be in the
middle of the if statement to begin with, TXBUSY case above stops the
queue so it will always go into the if.

>  		}
>  		np->put_tx_ctx->dma_len = bcnt;
>  		np->put_tx_ctx->dma_single = 1;
> @@ -2305,7 +2316,12 @@ static netdev_tx_t nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
>  				u64_stats_update_begin(&np->swstats_tx_syncp);
>  				nv_txrx_stats_inc(stat_tx_dropped);
>  				u64_stats_update_end(&np->swstats_tx_syncp);
> -				return NETDEV_TX_OK;
> +
> +				writel(NVREG_TXRXCTL_KICK | np->txrxctl_bits,
> +				       get_hwbase(dev) + NvRegTxRxControl);
> +				ret = NETDEV_TX_OK;
> +
> +				goto dma_error;

And here.

>  			}
>  
>  			np->put_tx_ctx->dma_len = bcnt;
> @@ -2357,8 +2373,15 @@ static netdev_tx_t nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
>  
>  	spin_unlock_irqrestore(&np->lock, flags);
>  
> -	writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl);
> -	return NETDEV_TX_OK;
> +txkick:
> +	if (netif_queue_stopped(dev) || !netdev_xmit_more()) {
> +		u32 txrxctl_kick = NVREG_TXRXCTL_KICK | np->txrxctl_bits;
> +
> +		writel(txrxctl_kick, get_hwbase(dev) + NvRegTxRxControl);
> +	}
> +
> +dma_error:
> +	return ret;
>  }

But otherwise looks correct to me now, thanks!

  reply	other threads:[~2019-11-05 17:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-05  4:26 [PATCHv4 1/1] net: forcedeth: add xmit_more support Zhu Yanjun
2019-11-05 17:48 ` Jakub Kicinski [this message]
2019-11-06  4:47   ` Zhu Yanjun
2019-11-06  4:48     ` Jakub Kicinski
2019-11-06  5:50       ` Zhu Yanjun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191105094841.623b498e@cakuba.netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=rain.1986.08.12@gmail.com \
    --cc=yanjun.zhu@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).