]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[BRIDGE]: Kill clone argument to br_flood_*
authorHerbert Xu <herbert@gondor.apana.org.au>
Sun, 16 Sep 2007 23:20:48 +0000 (16:20 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 16 Sep 2007 23:20:48 +0000 (16:20 -0700)
The clone argument is only used by one caller and that caller can clone
the packet itself.  This patch moves the clone call into the caller and
kills the clone argument.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_device.c
net/bridge/br_forward.c
net/bridge/br_input.c
net/bridge/br_private.h

index 0eded176ce99bfa0aa3dd352d8e676b3067d257b..99292e8e1d0f05f2f813d85b08c8497e31c1d98d 100644 (file)
@@ -41,11 +41,11 @@ int br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
        skb_pull(skb, ETH_HLEN);
 
        if (dest[0] & 1)
-               br_flood_deliver(br, skb, 0);
+               br_flood_deliver(br, skb);
        else if ((dst = __br_fdb_get(br, dest)) != NULL)
                br_deliver(dst->dst, skb);
        else
-               br_flood_deliver(br, skb, 0);
+               br_flood_deliver(br, skb);
 
        return 0;
 }
index ada7f495445c5ae24e1495df005c5411430a6f14..bdd7c35c3c7ba870a618f359733a19197e61e758 100644 (file)
@@ -100,24 +100,13 @@ void br_forward(const struct net_bridge_port *to, struct sk_buff *skb)
 }
 
 /* called under bridge lock */
-static void br_flood(struct net_bridge *br, struct sk_buff *skb, int clone,
+static void br_flood(struct net_bridge *br, struct sk_buff *skb,
        void (*__packet_hook)(const struct net_bridge_port *p,
                              struct sk_buff *skb))
 {
        struct net_bridge_port *p;
        struct net_bridge_port *prev;
 
-       if (clone) {
-               struct sk_buff *skb2;
-
-               if ((skb2 = skb_clone(skb, GFP_ATOMIC)) == NULL) {
-                       br->statistics.tx_dropped++;
-                       return;
-               }
-
-               skb = skb2;
-       }
-
        prev = NULL;
 
        list_for_each_entry_rcu(p, &br->port_list, list) {
@@ -148,13 +137,13 @@ static void br_flood(struct net_bridge *br, struct sk_buff *skb, int clone,
 
 
 /* called with rcu_read_lock */
-void br_flood_deliver(struct net_bridge *br, struct sk_buff *skb, int clone)
+void br_flood_deliver(struct net_bridge *br, struct sk_buff *skb)
 {
-       br_flood(br, skb, clone, __br_deliver);
+       br_flood(br, skb, __br_deliver);
 }
 
 /* called under bridge lock */
-void br_flood_forward(struct net_bridge *br, struct sk_buff *skb, int clone)
+void br_flood_forward(struct net_bridge *br, struct sk_buff *skb)
 {
-       br_flood(br, skb, clone, __br_forward);
+       br_flood(br, skb, __br_forward);
 }
index 6f468fc3357a08f9c04bcbf4b22d93004521b3ac..3a8a015c92e0d49a29d7e0b4e686fb78135529b7 100644 (file)
@@ -43,7 +43,7 @@ int br_handle_frame_finish(struct sk_buff *skb)
        struct net_bridge_port *p = rcu_dereference(skb->dev->br_port);
        struct net_bridge *br;
        struct net_bridge_fdb_entry *dst;
-       int passedup = 0;
+       struct sk_buff *skb2;
 
        if (!p || p->state == BR_STATE_DISABLED)
                goto drop;
@@ -55,39 +55,35 @@ int br_handle_frame_finish(struct sk_buff *skb)
        if (p->state == BR_STATE_LEARNING)
                goto drop;
 
-       if (br->dev->flags & IFF_PROMISC) {
-               struct sk_buff *skb2;
+       /* The packet skb2 goes to the local host (NULL to skip). */
+       skb2 = NULL;
 
-               skb2 = skb_clone(skb, GFP_ATOMIC);
-               if (skb2 != NULL) {
-                       passedup = 1;
-                       br_pass_frame_up(br, skb2);
-               }
-       }
+       if (br->dev->flags & IFF_PROMISC)
+               skb2 = skb;
+
+       dst = NULL;
 
        if (is_multicast_ether_addr(dest)) {
                br->statistics.multicast++;
-               br_flood_forward(br, skb, !passedup);
-               if (!passedup)
-                       br_pass_frame_up(br, skb);
-               goto out;
+               skb2 = skb;
+       } else if ((dst = __br_fdb_get(br, dest)) && dst->is_local) {
+               skb2 = skb;
+               /* Do not forward the packet since it's local. */
+               skb = NULL;
        }
 
-       dst = __br_fdb_get(br, dest);
-       if (dst != NULL && dst->is_local) {
-               if (!passedup)
-                       br_pass_frame_up(br, skb);
-               else
-                       kfree_skb(skb);
-               goto out;
-       }
+       if (skb2 == skb)
+               skb2 = skb_clone(skb, GFP_ATOMIC);
 
-       if (dst != NULL) {
-               br_forward(dst->dst, skb);
-               goto out;
-       }
+       if (skb2)
+               br_pass_frame_up(br, skb2);
 
-       br_flood_forward(br, skb, 0);
+       if (skb) {
+               if (dst)
+                       br_forward(dst->dst, skb);
+               else
+                       br_flood_forward(br, skb);
+       }
 
 out:
        return 0;
index 21bf3a9a03fde363fff8a8e02bc99bac5ad870d1..e6dc6f52990d1946d083ea7a254453a244b7306c 100644 (file)
@@ -170,12 +170,8 @@ extern int br_dev_queue_push_xmit(struct sk_buff *skb);
 extern void br_forward(const struct net_bridge_port *to,
                struct sk_buff *skb);
 extern int br_forward_finish(struct sk_buff *skb);
-extern void br_flood_deliver(struct net_bridge *br,
-                     struct sk_buff *skb,
-                     int clone);
-extern void br_flood_forward(struct net_bridge *br,
-                     struct sk_buff *skb,
-                     int clone);
+extern void br_flood_deliver(struct net_bridge *br, struct sk_buff *skb);
+extern void br_flood_forward(struct net_bridge *br, struct sk_buff *skb);
 
 /* br_if.c */
 extern void br_port_carrier_check(struct net_bridge_port *p);