From: Eric Dumazet <eric.dumazet@gmail.com>
To: "Shimoda, Yoshihiro" <yoshihiro.shimoda.uh@renesas.com>
Cc: netdev <netdev@vger.kernel.org>, SH-Linux <linux-sh@vger.kernel.org>
Subject: Re: [PATCH net-next 5/5] net: sh_eth: use NAPI
Date: Tue, 12 Jun 2012 07:48:35 +0200 [thread overview]
Message-ID: <1339480115.22704.20.camel@edumazet-glaptop> (raw)
In-Reply-To: <4FD6D154.1000000@renesas.com>
On Tue, 2012-06-12 at 14:19 +0900, Shimoda, Yoshihiro wrote:
> This patch modifies the driver to use NAPI.
>
...
> +static int sh_eth_poll(struct napi_struct *napi, int budget)
> +{
> + struct sh_eth_private *mdp = container_of(napi, struct sh_eth_private,
> + napi);
> + struct net_device *ndev = mdp->ndev;
> + struct sh_eth_cpu_data *cd = mdp->cd;
> + int work_done = 0, txfree_num;
> + u32 intr_status = sh_eth_read(ndev, EESR);
> +
> + /* Clear interrupt flags */
> + sh_eth_write(ndev, intr_status, EESR);
> +
> + /* check txdesc */
> + txfree_num = sh_eth_txfree(ndev);
> + if (txfree_num) {
> + netif_tx_lock(ndev);
> + if (netif_queue_stopped(ndev))
> + netif_wake_queue(ndev);
> + netif_tx_unlock(ndev);
> }
...
> @@ -1678,19 +1707,6 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev)
> struct sh_eth_private *mdp = netdev_priv(ndev);
> struct sh_eth_txdesc *txdesc;
> u32 entry;
> - unsigned long flags;
> -
> - spin_lock_irqsave(&mdp->lock, flags);
> - if ((mdp->cur_tx - mdp->dirty_tx) >= (mdp->num_tx_ring - 4)) {
> - if (!sh_eth_txfree(ndev)) {
> - if (netif_msg_tx_queued(mdp))
> - dev_warn(&ndev->dev, "TxFD exhausted.\n");
> - netif_stop_queue(ndev);
> - spin_unlock_irqrestore(&mdp->lock, flags);
> - return NETDEV_TX_BUSY;
> - }
> - }
> - spin_unlock_irqrestore(&mdp->lock, flags);
>
> entry = mdp->cur_tx % mdp->num_tx_ring;
> mdp->tx_skbuff[entry] = skb;
> @@ -1716,6 +1732,13 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev)
> if (!(sh_eth_read(ndev, EDTRR) & sh_eth_get_edtrr_trns(mdp)))
> sh_eth_write(ndev, sh_eth_get_edtrr_trns(mdp), EDTRR);
>
> + if ((mdp->cur_tx - mdp->dirty_tx) >= (mdp->num_tx_ring - 4)) {
> + if (netif_msg_tx_queued(mdp)) {
> + dev_warn(&ndev->dev, "TxFD exhausted.\n");
> + netif_stop_queue(ndev);
> + }
> + }
> +
> return NETDEV_TX_OK;
> }
I have no idea why you call netif_stop_queue() only if
netif_msg_tx_queued(mdp)
You should test your driver under heavy TX load.
next prev parent reply other threads:[~2012-06-12 5:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-12 5:19 [PATCH net-next 5/5] net: sh_eth: use NAPI Shimoda, Yoshihiro
2012-06-12 5:48 ` Eric Dumazet [this message]
2012-06-12 6:47 ` Shimoda, Yoshihiro
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=1339480115.22704.20.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=linux-sh@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yoshihiro.shimoda.uh@renesas.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