Commit a3961789 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

ep93xx_eth: add GRO support

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.
4) get rid of baroque code and ease maintenance.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5b2ec6f2
...@@ -228,9 +228,10 @@ static void ep93xx_mdio_write(struct net_device *dev, int phy_id, int reg, int d ...@@ -228,9 +228,10 @@ static void ep93xx_mdio_write(struct net_device *dev, int phy_id, int reg, int d
pr_info("mdio write timed out\n"); pr_info("mdio write timed out\n");
} }
static int ep93xx_rx(struct net_device *dev, int processed, int budget) static int ep93xx_rx(struct net_device *dev, int budget)
{ {
struct ep93xx_priv *ep = netdev_priv(dev); struct ep93xx_priv *ep = netdev_priv(dev);
int processed = 0;
while (processed < budget) { while (processed < budget) {
int entry; int entry;
...@@ -294,7 +295,7 @@ static int ep93xx_rx(struct net_device *dev, int processed, int budget) ...@@ -294,7 +295,7 @@ static int ep93xx_rx(struct net_device *dev, int processed, int budget)
skb_put(skb, length); skb_put(skb, length);
skb->protocol = eth_type_trans(skb, dev); skb->protocol = eth_type_trans(skb, dev);
netif_receive_skb(skb); napi_gro_receive(&ep->napi, skb);
dev->stats.rx_packets++; dev->stats.rx_packets++;
dev->stats.rx_bytes += length; dev->stats.rx_bytes += length;
...@@ -310,35 +311,17 @@ static int ep93xx_rx(struct net_device *dev, int processed, int budget) ...@@ -310,35 +311,17 @@ static int ep93xx_rx(struct net_device *dev, int processed, int budget)
return processed; return processed;
} }
static int ep93xx_have_more_rx(struct ep93xx_priv *ep)
{
struct ep93xx_rstat *rstat = ep->descs->rstat + ep->rx_pointer;
return !!((rstat->rstat0 & RSTAT0_RFP) && (rstat->rstat1 & RSTAT1_RFP));
}
static int ep93xx_poll(struct napi_struct *napi, int budget) static int ep93xx_poll(struct napi_struct *napi, int budget)
{ {
struct ep93xx_priv *ep = container_of(napi, struct ep93xx_priv, napi); struct ep93xx_priv *ep = container_of(napi, struct ep93xx_priv, napi);
struct net_device *dev = ep->dev; struct net_device *dev = ep->dev;
int rx = 0; int rx;
poll_some_more:
rx = ep93xx_rx(dev, rx, budget);
if (rx < budget) {
int more = 0;
rx = ep93xx_rx(dev, budget);
if (rx < budget && napi_complete_done(napi, rx)) {
spin_lock_irq(&ep->rx_lock); spin_lock_irq(&ep->rx_lock);
__napi_complete(napi);
wrl(ep, REG_INTEN, REG_INTEN_TX | REG_INTEN_RX); wrl(ep, REG_INTEN, REG_INTEN_TX | REG_INTEN_RX);
if (ep93xx_have_more_rx(ep)) {
wrl(ep, REG_INTEN, REG_INTEN_TX);
wrl(ep, REG_INTSTSP, REG_INTSTS_RX);
more = 1;
}
spin_unlock_irq(&ep->rx_lock); spin_unlock_irq(&ep->rx_lock);
if (more && napi_reschedule(napi))
goto poll_some_more;
} }
if (rx) { if (rx) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment