From: Lucas Stach <l.stach@pengutronix.de>
To: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: David Miller <davem@davemloft.net>,
Frank Li <Frank.Li@freescale.com>,
Fabio Estevam <festevam@gmail.com>,
Shawn Guo <shawn.guo@linaro.org>,
Lucas Stach <l.stach@pengutronix.de>
Subject: [PATCH resend 3/3] Revert "net: fec: add napi support to improve proformance"
Date: Fri, 26 Apr 2013 10:52:10 +0200 [thread overview]
Message-ID: <1366966330-5181-3-git-send-email-l.stach@pengutronix.de> (raw)
In-Reply-To: <1366966330-5181-1-git-send-email-l.stach@pengutronix.de>
This reverts commit dc975382d2ef36be7e78fac3717927de1a5abcd8.
This change caused trouble up to kernel OOPSes with NULL-ptr
dereferences. The only sane way to get back to a working state
is this revert.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
drivers/net/ethernet/freescale/fec.c | 41 ++++++------------------------------
drivers/net/ethernet/freescale/fec.h | 2 --
2 files changed, 7 insertions(+), 36 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index fa6a999..3d51163 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -67,7 +67,6 @@
#endif
#define DRIVER_NAME "fec"
-#define FEC_NAPI_WEIGHT 64
/* Pause frame feild and FIFO threshold */
#define FEC_ENET_FCE (1 << 5)
@@ -169,7 +168,6 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address");
#define FEC_ENET_EBERR ((uint)0x00400000) /* SDMA bus error */
#define FEC_DEFAULT_IMASK (FEC_ENET_TXF | FEC_ENET_RXF | FEC_ENET_MII)
-#define FEC_RX_DISABLED_IMASK (FEC_DEFAULT_IMASK & (~FEC_ENET_RXF))
/* The FEC stores dest/src/type, data, and checksum for receive packets.
*/
@@ -703,8 +701,8 @@ fec_enet_tx(struct net_device *ndev)
* not been given to the system, we just set the empty indicator,
* effectively tossing the packet.
*/
-static int
-fec_enet_rx(struct net_device *ndev, int budget)
+static void
+fec_enet_rx(struct net_device *ndev)
{
struct fec_enet_private *fep = netdev_priv(ndev);
const struct platform_device_id *id_entry =
@@ -714,12 +712,13 @@ fec_enet_rx(struct net_device *ndev, int budget)
struct sk_buff *skb;
ushort pkt_len;
__u8 *data;
- int pkt_received = 0;
#ifdef CONFIG_M532x
flush_cache_all();
#endif
+ spin_lock(&fep->hw_lock);
+
/* First, grab all of the stats for the incoming packet.
* These get messed up if we get called due to a busy condition.
*/
@@ -727,10 +726,6 @@ fec_enet_rx(struct net_device *ndev, int budget)
while (!((status = bdp->cbd_sc) & BD_ENET_RX_EMPTY)) {
- if (pkt_received >= budget)
- break;
- pkt_received++;
-
/* Since we have allocated space to hold a complete frame,
* the last indicator should be set.
*/
@@ -812,7 +807,7 @@ fec_enet_rx(struct net_device *ndev, int budget)
}
if (!skb_defer_rx_timestamp(skb))
- napi_gro_receive(&fep->napi, skb);
+ netif_rx(skb);
}
bdp->cbd_bufaddr = dma_map_single(&fep->pdev->dev, data,
@@ -846,7 +841,7 @@ rx_processing_done:
}
fep->cur_rx = bdp;
- return pkt_received;
+ spin_unlock(&fep->hw_lock);
}
static irqreturn_t
@@ -863,13 +858,7 @@ fec_enet_interrupt(int irq, void *dev_id)
if (int_events & FEC_ENET_RXF) {
ret = IRQ_HANDLED;
-
- /* Disable the RX interrupt */
- if (napi_schedule_prep(&fep->napi)) {
- writel(FEC_RX_DISABLED_IMASK,
- fep->hwp + FEC_IMASK);
- __napi_schedule(&fep->napi);
- }
+ fec_enet_rx(ndev);
}
/* Transmit OK, or non-fatal error. Update the buffer
@@ -890,18 +879,7 @@ fec_enet_interrupt(int irq, void *dev_id)
return ret;
}
-static int fec_enet_rx_napi(struct napi_struct *napi, int budget)
-{
- struct net_device *ndev = napi->dev;
- int pkts = fec_enet_rx(ndev, budget);
- struct fec_enet_private *fep = netdev_priv(ndev);
- if (pkts < budget) {
- napi_complete(napi);
- writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
- }
- return pkts;
-}
/* ------------------------------------------------------------------------- */
static void fec_get_mac(struct net_device *ndev)
@@ -1464,8 +1442,6 @@ fec_enet_open(struct net_device *ndev)
struct fec_enet_private *fep = netdev_priv(ndev);
int ret;
- napi_enable(&fep->napi);
-
/* I should reset the ring buffers here, but I don't yet know
* a simple way to do that.
*/
@@ -1677,9 +1653,6 @@ static int fec_enet_init(struct net_device *ndev)
ndev->netdev_ops = &fec_netdev_ops;
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, FEC_NAPI_WEIGHT);
-
fec_restart(ndev, 0);
return 0;
diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
index b70c3cd..ff79610 100644
--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -249,8 +249,6 @@ struct fec_enet_private {
int bufdesc_ex;
int pause_flag;
- struct napi_struct napi;
-
struct ptp_clock *ptp_clock;
struct ptp_clock_info ptp_caps;
unsigned long last_overflow_check;
--
1.8.2.rc2
next prev parent reply other threads:[~2013-04-26 8:53 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-26 8:52 [PATCH resend 1/3] Revert "net: fec: fix missing napi_disable call" Lucas Stach
2013-04-26 8:52 ` [PATCH resend 2/3] Revert "net: fec: put tx to napi poll function to fix dead lock" Lucas Stach
2013-04-26 8:52 ` Lucas Stach [this message]
2013-04-26 9:32 ` [PATCH resend 1/3] Revert "net: fec: fix missing napi_disable call" Frank Li
2013-04-26 13:44 ` Robert Schwebel
2013-04-26 18:33 ` David Miller
2013-04-27 9:05 ` Robert Schwebel
2013-04-27 10:26 ` Frank Li
2013-04-27 12:06 ` Francois Romieu
2013-04-27 12:43 ` Frank Li
2013-04-27 19:16 ` Francois Romieu
2013-04-28 3:09 ` Frank Li
2013-04-28 4:31 ` Frank Li
2013-04-28 9:40 ` Francois Romieu
2013-04-28 10:03 ` Frank Li
2013-04-28 9:39 ` Francois Romieu
2013-04-28 10:05 ` Frank Li
2013-04-28 17:57 ` Francois Romieu
2013-04-28 23:45 ` Frank Li
2013-04-29 13:46 ` Lucas Stach
2013-05-02 1:51 ` Frank Li
2013-04-28 5:11 ` David Miller
2013-04-28 17:27 ` Robert Schwebel
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=1366966330-5181-3-git-send-email-l.stach@pengutronix.de \
--to=l.stach@pengutronix.de \
--cc=Frank.Li@freescale.com \
--cc=davem@davemloft.net \
--cc=festevam@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=shawn.guo@linaro.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).