ChangeSet 1.2199.8.20, 2005/03/22 18:29:23-08:00, [EMAIL PROTECTED]
[NETPOLL]: Filter inlines
Add netpoll rx helpers
Move skb_free for rx into __netpoll_rx
Signed-off-by: Matt Mackall <[EMAIL PROTECTED]>
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
include/linux/netpoll.h | 10 +++++++++-
net/core/dev.c | 16 +++++-----------
net/core/netpoll.c | 10 ++++++++--
3 files changed, 22 insertions(+), 14 deletions(-)
diff -Nru a/include/linux/netpoll.h b/include/linux/netpoll.h
--- a/include/linux/netpoll.h 2005-03-26 17:14:29 -08:00
+++ b/include/linux/netpoll.h 2005-03-26 17:14:29 -08:00
@@ -30,7 +30,15 @@
int netpoll_trap(void);
void netpoll_set_trap(int trap);
void netpoll_cleanup(struct netpoll *np);
-int netpoll_rx(struct sk_buff *skb);
+int __netpoll_rx(struct sk_buff *skb);
+#ifdef CONFIG_NETPOLL
+static inline int netpoll_rx(struct sk_buff *skb)
+{
+ return skb->dev->netpoll_rx && __netpoll_rx(skb);
+}
+#else
+#define netpoll_rx(a) 0
+#endif
#endif
diff -Nru a/net/core/dev.c b/net/core/dev.c
--- a/net/core/dev.c 2005-03-26 17:14:30 -08:00
+++ b/net/core/dev.c 2005-03-26 17:14:30 -08:00
@@ -1427,13 +1427,10 @@
struct softnet_data *queue;
unsigned long flags;
-#ifdef CONFIG_NETPOLL
- if (skb->dev->netpoll_rx && netpoll_rx(skb)) {
- kfree_skb(skb);
+ /* if netpoll wants it, pretend we never saw it */
+ if (netpoll_rx(skb))
return NET_RX_DROP;
- }
-#endif
-
+
if (!skb->stamp.tv_sec)
net_timestamp(&skb->stamp);
@@ -1629,12 +1626,9 @@
int ret = NET_RX_DROP;
unsigned short type;
-#ifdef CONFIG_NETPOLL
- if (skb->dev->netpoll_rx && skb->dev->poll && netpoll_rx(skb)) {
- kfree_skb(skb);
+ /* if we've gotten here through NAPI, check netpoll */
+ if (skb->dev->poll && netpoll_rx(skb))
return NET_RX_DROP;
- }
-#endif
if (!skb->stamp.tv_sec)
net_timestamp(&skb->stamp);
diff -Nru a/net/core/netpoll.c b/net/core/netpoll.c
--- a/net/core/netpoll.c 2005-03-26 17:14:30 -08:00
+++ b/net/core/netpoll.c 2005-03-26 17:14:30 -08:00
@@ -368,7 +368,7 @@
netpoll_send_skb(np, send_skb);
}
-int netpoll_rx(struct sk_buff *skb)
+int __netpoll_rx(struct sk_buff *skb)
{
int proto, len, ulen;
struct iphdr *iph;
@@ -440,12 +440,18 @@
(char *)(uh+1),
ulen - sizeof(struct udphdr));
+ kfree_skb(skb);
return 1;
}
spin_unlock_irqrestore(&rx_list_lock, flags);
out:
- return atomic_read(&trapped);
+ if (atomic_read(&trapped)) {
+ kfree_skb(skb);
+ return 1;
+ }
+
+ return 0;
}
int netpoll_parse_options(struct netpoll *np, char *opt)
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html