From: Eric Dumazet <edumazet@google.com>
To: "David S . Miller" <davem@davemloft.net>
Cc: netdev <netdev@vger.kernel.org>,
Eric Dumazet <edumazet@google.com>,
Eric Dumazet <eric.dumazet@gmail.com>
Subject: [PATCH net-next 8/9] ks8695net: add GRO support
Date: Sat, 4 Feb 2017 10:20:37 -0800 [thread overview]
Message-ID: <20170204182038.3752-9-edumazet@google.com> (raw)
In-Reply-To: <20170204182038.3752-1-edumazet@google.com>
Use napi_complete_done() instead of __napi_complete() to :
1) Get support of gro_flush_timeout if opt-in
2) Not rearm interrupts for busy-polling users.
3) use standard NAPI API.
Note that rx_lock seems to be useless, NAPI logic should
not need this extra care.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
drivers/net/ethernet/micrel/ks8695net.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/micrel/ks8695net.c b/drivers/net/ethernet/micrel/ks8695net.c
index 20cb85bc0c5f8660a259dfb8dfd7213df713..f155e21240120061831fecb3537059cf4641 100644
--- a/drivers/net/ethernet/micrel/ks8695net.c
+++ b/drivers/net/ethernet/micrel/ks8695net.c
@@ -519,7 +519,7 @@ static int ks8695_rx(struct ks8695_priv *ksp, int budget)
/* Relinquish the SKB to the network layer */
skb_put(skb, pktlen);
skb->protocol = eth_type_trans(skb, ndev);
- netif_receive_skb(skb);
+ napi_gro_receive(&ksp->napi, skb);
/* Record stats */
ndev->stats.rx_packets++;
@@ -561,18 +561,17 @@ static int ks8695_rx(struct ks8695_priv *ksp, int budget)
static int ks8695_poll(struct napi_struct *napi, int budget)
{
struct ks8695_priv *ksp = container_of(napi, struct ks8695_priv, napi);
- unsigned long work_done;
-
unsigned long isr = readl(KS8695_IRQ_VA + KS8695_INTEN);
unsigned long mask_bit = 1 << ks8695_get_rx_enable_bit(ksp);
+ int work_done;
work_done = ks8695_rx(ksp, budget);
- if (work_done < budget) {
+ if ((work_done < budget) && napi_complete_done(napi, work_done)) {
unsigned long flags;
+
spin_lock_irqsave(&ksp->rx_lock, flags);
- __napi_complete(napi);
- /*enable rx interrupt*/
+ /* enable rx interrupt */
writel(isr | mask_bit, KS8695_IRQ_VA + KS8695_INTEN);
spin_unlock_irqrestore(&ksp->rx_lock, flags);
}
--
2.11.0.483.g087da7b7c-goog
next prev parent reply other threads:[~2017-02-04 18:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-04 18:20 [PATCH net-next 0/9] net: get rid of most __napi_complete() usages Eric Dumazet
2017-02-04 18:20 ` [PATCH net-next 1/9] 8139too: use napi_complete_done() Eric Dumazet
2017-02-04 18:20 ` [PATCH net-next 2/9] 8139cp: " Eric Dumazet
2017-02-04 18:20 ` [PATCH net-next 3/9] epic100: " Eric Dumazet
2017-02-04 18:20 ` [PATCH net-next 4/9] amd8111e: add GRO support Eric Dumazet
2017-02-04 18:20 ` [PATCH net-next 5/9] pcnet32: use napi_complete_done() Eric Dumazet
2017-02-04 18:20 ` [PATCH net-next 6/9] ep93xx_eth: add GRO support Eric Dumazet
2017-02-04 20:47 ` kbuild test robot
2017-02-04 18:20 ` [PATCH net-next 7/9] skge: use napi_complete_done() Eric Dumazet
2017-02-04 21:44 ` Stephen Hemminger
2017-02-04 22:16 ` Eric Dumazet
2017-02-04 18:20 ` Eric Dumazet [this message]
2017-02-04 18:20 ` [PATCH net-next 9/9] qla3xxx: add GRO support Eric Dumazet
2017-02-04 22:17 ` [PATCH net-next 0/9] net: get rid of most __napi_complete() usages Eric Dumazet
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=20170204182038.3752-9-edumazet@google.com \
--to=edumazet@google.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
/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).