[PATCH 4/5] netpoll: move drop hook inline

From: Stephen Hemminger
Date: Mon Oct 23 2006 - 15:05:30 EST


Rather than have separate drop callback hook, just put
the logic inline in netpoll. The code is cleaner and netconsole
is the only user of netpoll.

Signed-off-by: Stephen Hemminger <shemminger@xxxxxxxx>

--- netpoll.orig/drivers/net/netconsole.c
+++ netpoll/drivers/net/netconsole.c
@@ -60,7 +60,6 @@ static struct netpoll np = {
.local_port = 6665,
.remote_port = 6666,
.remote_mac = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
- .drop = netpoll_queue,
};
static int configured = 0;

--- netpoll.orig/include/linux/netpoll.h
+++ netpoll/include/linux/netpoll.h
@@ -18,7 +18,6 @@ struct netpoll {
struct net_device *dev;
char dev_name[16], *name;
void (*rx_hook)(struct netpoll *, int, char *, int);
- void (*drop)(struct sk_buff *skb);
u32 local_ip, remote_ip;
u16 local_port, remote_port;
unsigned char local_mac[6], remote_mac[6];
--- netpoll.orig/net/core/netpoll.c
+++ netpoll/net/core/netpoll.c
@@ -91,13 +91,6 @@ static void queue_purge(struct net_devic
spin_unlock_irqrestore(&netpoll_txq.lock, flags);
}

-void netpoll_queue(struct sk_buff *skb)
-{
- skb_queue_tail(&netpoll_txq, skb);
-
- schedule_work(&send_queue);
-}
-
static int checksum_udp(struct sk_buff *skb, struct udphdr *uh,
unsigned short ulen, u32 saddr, u32 daddr)
{
@@ -282,10 +275,10 @@ static void netpoll_send_skb(struct netp
udelay(50);
} while (--tries > 0);

- if (np->drop)
- np->drop(skb);
- else
- __kfree_skb(skb);
+ /* if transmitter is busy, try send later. */
+ skb_queue_tail(&netpoll_txq, skb);
+
+ schedule_work(&send_queue);
}

void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
@@ -784,4 +777,3 @@ EXPORT_SYMBOL(netpoll_setup);
EXPORT_SYMBOL(netpoll_cleanup);
EXPORT_SYMBOL(netpoll_send_udp);
EXPORT_SYMBOL(netpoll_poll);
-EXPORT_SYMBOL(netpoll_queue);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/