netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Troy Kisky <troy.kisky@boundarydevices.com>
To: netdev@vger.kernel.org, davem@davemloft.net, fugang.duan@nxp.com,
	lznuaa@gmail.com
Cc: fabio.estevam@nxp.com, l.stach@pengutronix.de, andrew@lunn.ch,
	tremyfr@gmail.com, gerg@uclinux.org,
	linux-arm-kernel@lists.infradead.org, johannes@sipsolutions.net,
	stillcompiling@gmail.com, sergei.shtylyov@cogentembedded.com,
	arnd@arndb.de, Troy Kisky <troy.kisky@boundarydevices.com>
Subject: [PATCH net-next V3 06/16] net: fec: split off napi routine with 3 queues
Date: Tue,  5 Apr 2016 19:25:52 -0700	[thread overview]
Message-ID: <1459909562-22865-7-git-send-email-troy.kisky@boundarydevices.com> (raw)
In-Reply-To: <1459909562-22865-1-git-send-email-troy.kisky@boundarydevices.com>

If we only have 1 tx/rx queue, we need not check
the other queues.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>

---
v3: rebase changes only, fep is no longer passed as a parameter to
fec_rxq/fec_txq
---
 drivers/net/ethernet/freescale/fec_main.c | 39 +++++++++++++++++++++++++++++--
 1 file changed, 37 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 918ac82..17140ea 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1524,7 +1524,7 @@ fec_enet_interrupt(int irq, void *dev_id)
 	return ret;
 }
 
-static int fec_enet_rx_napi(struct napi_struct *napi, int budget)
+static int fec_enet_napi_q3(struct napi_struct *napi, int budget)
 {
 	struct net_device *ndev = napi->dev;
 	struct fec_enet_private *fep = netdev_priv(ndev);
@@ -1564,6 +1564,39 @@ static int fec_enet_rx_napi(struct napi_struct *napi, int budget)
 	return pkts;
 }
 
+static int fec_enet_napi_q1(struct napi_struct *napi, int budget)
+{
+	struct net_device *ndev = napi->dev;
+	struct fec_enet_private *fep = netdev_priv(ndev);
+	int pkts = 0;
+	uint events;
+
+	do {
+		events = readl(fep->hwp + FEC_IEVENT);
+		if (fep->events) {
+			events |= fep->events;
+			fep->events = 0;
+		}
+		events &= FEC_ENET_RXF_0 | FEC_ENET_TXF_0;
+		if (!events) {
+			if (budget) {
+				napi_complete(napi);
+				writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
+			}
+			return pkts;
+		}
+
+		writel(events, fep->hwp + FEC_IEVENT);
+		if (events & FEC_ENET_RXF_0)
+			pkts += fec_rxq(ndev, fep->rx_queue[0],
+					budget - pkts);
+		if (events & FEC_ENET_TXF_0)
+			fec_txq(ndev, fep->tx_queue[0]);
+	} while (pkts < budget);
+	fep->events |= FEC_ENET_RXF_0;	/* save for next callback */
+	return pkts;
+}
+
 /* ------------------------------------------------------------------------- */
 static void fec_get_mac(struct net_device *ndev)
 {
@@ -3123,7 +3156,9 @@ static int fec_enet_init(struct net_device *ndev)
 	ndev->ethtool_ops = &fec_enet_ethtool_ops;
 
 	writel(FEC_RX_DISABLED_IMASK, fep->hwp + FEC_IMASK);
-	netif_napi_add(ndev, &fep->napi, fec_enet_rx_napi, NAPI_POLL_WEIGHT);
+	netif_napi_add(ndev, &fep->napi, (fep->num_rx_queues |
+		       fep->num_tx_queues) == 1 ? fec_enet_napi_q1 :
+		       fec_enet_napi_q3, NAPI_POLL_WEIGHT);
 
 	if (fep->quirks & FEC_QUIRK_HAS_VLAN)
 		/* enable hw VLAN support */
-- 
2.5.0

  parent reply	other threads:[~2016-04-06  2:28 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-06  2:25 [PATCH net-next V3 00/16] net: fec: cleanup and fixes Troy Kisky
2016-04-06  2:25 ` [PATCH net-next V3 01/16] net: fec: only check queue 0 if RXF_0/TXF_0 interrupt is set Troy Kisky
2016-04-06  2:25 ` [PATCH net-next V3 02/16] net: fec: remove unused interrupt FEC_ENET_TS_TIMER Troy Kisky
2016-04-06  9:10   ` Fugang Duan
2016-04-06  2:25 ` [PATCH net-next V3 03/16] net: fec: return IRQ_HANDLED if fec_ptp_check_pps_event handled it Troy Kisky
2016-04-06  9:12   ` Fugang Duan
2016-04-06  2:25 ` [PATCH net-next V3 04/16] net: fec: pass rxq/txq to fec_enet_rx/tx_queue instead of queue_id Troy Kisky
2016-04-06  2:25 ` [PATCH net-next V3 05/16] net: fec: reduce interrupts Troy Kisky
2016-04-06 10:06   ` Fugang Duan
2016-04-06 21:20   ` David Miller
2016-04-07  0:42     ` Troy Kisky
2016-04-07  3:57       ` David Miller
2016-04-07 15:50         ` Troy Kisky
2016-04-06  2:25 ` Troy Kisky [this message]
2016-04-06  2:25 ` [PATCH net-next V3 07/16] net: fec: don't clear all rx queue bits when just one is being checked Troy Kisky
2016-04-06  2:25 ` [PATCH net-next V3 08/16] net: fec: set cbd_sc without relying on previous value Troy Kisky
2016-04-06  9:51   ` Fugang Duan
2016-04-06  2:25 ` [PATCH net-next V3 09/16] net: fec: eliminate calls to fec_enet_get_prevdesc Troy Kisky
2016-04-06  2:25 ` [PATCH net-next V3 10/16] net: fec: move restart test for efficiency Troy Kisky
2016-04-06  2:25 ` [PATCH net-next V3 11/16] net: fec: clear cbd_sc after transmission to help with debugging Troy Kisky
2016-04-06  2:25 ` [PATCH net-next V3 12/16] net: fec: dump all tx queues in fec_dump Troy Kisky
2016-04-06  2:25 ` [PATCH net-next V3 13/16] net: fec: detect tx int lost Troy Kisky
2016-04-06  2:26 ` [PATCH net-next V3 14/16] net: fec: create subroutine reset_tx_queue Troy Kisky
2016-04-06  2:26 ` [PATCH net-next V3 15/16] net: fec: call dma_unmap_single on mapped tx buffers at restart Troy Kisky
2016-04-06  2:26 ` [PATCH net-next V3 16/16] net: fec: don't set cbd_bufaddr unless no mapping error Troy Kisky
2016-04-06  8:51 ` [PATCH net-next V3 00/16] net: fec: cleanup and fixes Fugang Duan
2016-04-06 16:43   ` Troy Kisky
2016-04-06 16:47     ` Troy Kisky
2016-04-07  1:23     ` Fugang Duan
2016-04-06 21:20 ` David Miller
2016-04-07  1:09   ` Troy Kisky
2016-04-07  3:58     ` David Miller
2016-04-07 15:35       ` Troy Kisky
2016-04-14 10:13 ` Holger Schurig
2016-04-14 15:39   ` Troy Kisky
2016-04-15  8:33     ` Holger Schurig

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=1459909562-22865-7-git-send-email-troy.kisky@boundarydevices.com \
    --to=troy.kisky@boundarydevices.com \
    --cc=andrew@lunn.ch \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=fabio.estevam@nxp.com \
    --cc=fugang.duan@nxp.com \
    --cc=gerg@uclinux.org \
    --cc=johannes@sipsolutions.net \
    --cc=l.stach@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=lznuaa@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=sergei.shtylyov@cogentembedded.com \
    --cc=stillcompiling@gmail.com \
    --cc=tremyfr@gmail.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).