X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=linux-2.6-525-sknid-elevator.patch;h=1b42d92284208a2792a3c104081fca9f18ec26bb;hb=refs%2Fheads%2F22;hp=e600ccabfb7d901bd80bf76076cb2956011f22e1;hpb=c51d327ab1251ace4c7793f70e26c4eccf02c95d;p=linux-2.6.git diff --git a/linux-2.6-525-sknid-elevator.patch b/linux-2.6-525-sknid-elevator.patch index e600ccabf..1b42d9228 100644 --- a/linux-2.6-525-sknid-elevator.patch +++ b/linux-2.6-525-sknid-elevator.patch @@ -1,6 +1,17 @@ +diff -Nurb linux-2.6.22-524/include/linux/netdevice.h linux-2.6.22-525/include/linux/netdevice.h +--- linux-2.6.22-524/include/linux/netdevice.h 2008-07-27 22:06:14.000000000 -0400 ++++ linux-2.6.22-525/include/linux/netdevice.h 2008-07-27 22:17:30.000000000 -0400 +@@ -562,6 +562,7 @@ + struct packet_type { + __be16 type; /* This is really htons(ether_type). */ + struct net_device *dev; /* NULL is wildcarded here */ ++ unsigned char sknid_elevator; + int (*func) (struct sk_buff *, + struct net_device *, + struct packet_type *, diff -Nurb linux-2.6.22-524/net/core/dev.c linux-2.6.22-525/net/core/dev.c ---- linux-2.6.22-524/net/core/dev.c 2008-07-21 16:44:33.000000000 -0400 -+++ linux-2.6.22-525/net/core/dev.c 2008-07-27 22:02:10.000000000 -0400 +--- linux-2.6.22-524/net/core/dev.c 2008-07-27 22:06:20.000000000 -0400 ++++ linux-2.6.22-525/net/core/dev.c 2008-07-28 09:26:45.000000000 -0400 @@ -97,6 +97,8 @@ #include #include @@ -27,7 +38,7 @@ diff -Nurb linux-2.6.22-524/net/core/dev.c linux-2.6.22-525/net/core/dev.c static int ing_filter(struct sk_buff *skb) { struct Qdisc *q; -@@ -1832,13 +1835,21 @@ +@@ -1832,13 +1835,20 @@ } #endif @@ -41,7 +52,6 @@ diff -Nurb linux-2.6.22-524/net/core/dev.c linux-2.6.22-525/net/core/dev.c struct net_device *orig_dev; int ret = NET_RX_DROP; + int *cur_elevator=&__get_cpu_var(sknid_elevator); -+ struct sk_buff *skb2; __be16 type; + *cur_elevator = 0; @@ -49,11 +59,8 @@ diff -Nurb linux-2.6.22-524/net/core/dev.c linux-2.6.22-525/net/core/dev.c /* if we've gotten here through NAPI, check netpoll */ if (skb->dev->poll && netpoll_rx(skb)) return NET_RX_DROP; -@@ -1871,10 +1882,12 @@ - } - #endif +@@ -1873,8 +1883,9 @@ -+ skb2 = skb_clone(skb, GFP_ATOMIC); list_for_each_entry_rcu(ptype, &ptype_all, list) { if (!ptype->dev || ptype->dev == skb->dev) { - if (pt_prev) @@ -63,72 +70,35 @@ diff -Nurb linux-2.6.22-524/net/core/dev.c linux-2.6.22-525/net/core/dev.c pt_prev = ptype; } } -@@ -1891,6 +1904,7 @@ - - if (ret == TC_ACT_SHOT || (ret == TC_ACT_STOLEN)) { - kfree_skb(skb); -+ kfree_skb(skb2); - goto out; +@@ -1913,7 +1924,27 @@ } -@@ -1899,8 +1913,17 @@ - #endif - - skb = handle_bridge(skb, &pt_prev, &ret, orig_dev); -- if (!skb) -+ if (!skb) { -+ kfree_skb(skb2); - goto out; -+ } -+ -+ /* We don't want the packet handlers to throw the packet away -+ * if we want the taps to treat it again - Sapan */ -+ if (!skb2) { -+ *cur_elevator = 0; -+ } -+ - - type = skb->protocol; - list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type)&15], list) { -@@ -1914,6 +1937,7 @@ - if (pt_prev) { - ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev); -+ - } else { - kfree_skb(skb); - /* Jamal, now you will not able to escape explaining -@@ -1922,6 +1946,29 @@ - ret = NET_RX_DROP; - } - -+ if ((*cur_elevator)>0) { -+ skb2->skb_tag = *cur_elevator; -+ list_for_each_entry_rcu(ptype, &ptype_all, list) { -+ if ((!ptype->dev || ptype->dev == skb2->dev) && (ptype->sknid_elevator)) { -+ ret = deliver_skb(skb2, ptype, orig_dev); -+ } ++ /* At this point, cur_elevator may be -2 or a positive value, in ++ * case a previous protocol handler marked it */ ++ if (*cur_elevator) { ++ atomic_inc(&skb->users); + } -+ type = skb2->protocol; -+ list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type)&15], list) { -+ if (ptype->type == type && -+ (!ptype->dev || ptype->dev == skb2->dev) && (ptype->sknid_elevator)) { -+ ret = deliver_skb(skb2, ptype, orig_dev); ++ + ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev); ++ ++ if ((*cur_elevator)>0) { ++ skb->skb_tag = *cur_elevator; ++ list_for_each_entry_rcu(ptype, &ptype_all, list) { ++ if ((!ptype->dev || ptype->dev == skb->dev) && (ptype->sknid_elevator)) { ++ ret = deliver_skb(skb, ptype, orig_dev); ++ } + } + } -+ } -+ -+ if (skb2) { -+ /* We have a packet */ -+ kfree_skb(skb2); -+ } -+ -+ *cur_elevator=0; + - out: - rcu_read_unlock(); - return ret; -@@ -3780,6 +3827,7 @@ ++ if (*cur_elevator) { ++ /* We have a packet */ ++ kfree_skb(skb); ++ } + } else { + kfree_skb(skb); + /* Jamal, now you will not able to escape explaining +@@ -3780,6 +3811,7 @@ EXPORT_SYMBOL(net_enable_timestamp); EXPORT_SYMBOL(net_disable_timestamp); EXPORT_SYMBOL(dev_get_flags); @@ -138,7 +108,7 @@ diff -Nurb linux-2.6.22-524/net/core/dev.c linux-2.6.22-525/net/core/dev.c EXPORT_SYMBOL(br_handle_frame_hook); diff -Nurb linux-2.6.22-524/net/packet/af_packet.c linux-2.6.22-525/net/packet/af_packet.c --- linux-2.6.22-524/net/packet/af_packet.c 2007-07-08 19:32:17.000000000 -0400 -+++ linux-2.6.22-525/net/packet/af_packet.c 2008-07-27 22:02:22.000000000 -0400 ++++ linux-2.6.22-525/net/packet/af_packet.c 2008-07-27 22:06:27.000000000 -0400 @@ -78,6 +78,7 @@ #include #include