Commit e081e1e3 authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller

[BRIDGE]: Kill clone argument to br_flood_*

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: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9355ec23
...@@ -41,11 +41,11 @@ int br_dev_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -41,11 +41,11 @@ int br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
skb_pull(skb, ETH_HLEN); skb_pull(skb, ETH_HLEN);
if (dest[0] & 1) if (dest[0] & 1)
br_flood_deliver(br, skb, 0); br_flood_deliver(br, skb);
else if ((dst = __br_fdb_get(br, dest)) != NULL) else if ((dst = __br_fdb_get(br, dest)) != NULL)
br_deliver(dst->dst, skb); br_deliver(dst->dst, skb);
else else
br_flood_deliver(br, skb, 0); br_flood_deliver(br, skb);
return 0; return 0;
} }
......
...@@ -100,24 +100,13 @@ void br_forward(const struct net_bridge_port *to, struct sk_buff *skb) ...@@ -100,24 +100,13 @@ void br_forward(const struct net_bridge_port *to, struct sk_buff *skb)
} }
/* called under bridge lock */ /* 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, void (*__packet_hook)(const struct net_bridge_port *p,
struct sk_buff *skb)) struct sk_buff *skb))
{ {
struct net_bridge_port *p; struct net_bridge_port *p;
struct net_bridge_port *prev; 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; prev = NULL;
list_for_each_entry_rcu(p, &br->port_list, list) { 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, ...@@ -148,13 +137,13 @@ static void br_flood(struct net_bridge *br, struct sk_buff *skb, int clone,
/* called with rcu_read_lock */ /* 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 */ /* 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);
} }
...@@ -43,7 +43,7 @@ int br_handle_frame_finish(struct sk_buff *skb) ...@@ -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_port *p = rcu_dereference(skb->dev->br_port);
struct net_bridge *br; struct net_bridge *br;
struct net_bridge_fdb_entry *dst; struct net_bridge_fdb_entry *dst;
int passedup = 0; struct sk_buff *skb2;
if (!p || p->state == BR_STATE_DISABLED) if (!p || p->state == BR_STATE_DISABLED)
goto drop; goto drop;
...@@ -55,39 +55,35 @@ int br_handle_frame_finish(struct sk_buff *skb) ...@@ -55,39 +55,35 @@ int br_handle_frame_finish(struct sk_buff *skb)
if (p->state == BR_STATE_LEARNING) if (p->state == BR_STATE_LEARNING)
goto drop; goto drop;
if (br->dev->flags & IFF_PROMISC) { /* The packet skb2 goes to the local host (NULL to skip). */
struct sk_buff *skb2; skb2 = NULL;
skb2 = skb_clone(skb, GFP_ATOMIC); if (br->dev->flags & IFF_PROMISC)
if (skb2 != NULL) { skb2 = skb;
passedup = 1;
br_pass_frame_up(br, skb2); dst = NULL;
}
}
if (is_multicast_ether_addr(dest)) { if (is_multicast_ether_addr(dest)) {
br->statistics.multicast++; br->statistics.multicast++;
br_flood_forward(br, skb, !passedup); skb2 = skb;
if (!passedup) } else if ((dst = __br_fdb_get(br, dest)) && dst->is_local) {
br_pass_frame_up(br, skb); skb2 = skb;
goto out; /* Do not forward the packet since it's local. */
skb = NULL;
} }
dst = __br_fdb_get(br, dest); if (skb2 == skb)
if (dst != NULL && dst->is_local) { skb2 = skb_clone(skb, GFP_ATOMIC);
if (!passedup)
br_pass_frame_up(br, skb);
else
kfree_skb(skb);
goto out;
}
if (dst != NULL) { if (skb2)
br_forward(dst->dst, skb); br_pass_frame_up(br, skb2);
goto out;
}
br_flood_forward(br, skb, 0); if (skb) {
if (dst)
br_forward(dst->dst, skb);
else
br_flood_forward(br, skb);
}
out: out:
return 0; return 0;
......
...@@ -170,12 +170,8 @@ extern int br_dev_queue_push_xmit(struct sk_buff *skb); ...@@ -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, extern void br_forward(const struct net_bridge_port *to,
struct sk_buff *skb); struct sk_buff *skb);
extern int br_forward_finish(struct sk_buff *skb); extern int br_forward_finish(struct sk_buff *skb);
extern void br_flood_deliver(struct net_bridge *br, extern void br_flood_deliver(struct net_bridge *br, struct sk_buff *skb);
struct sk_buff *skb, extern void br_flood_forward(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);
/* br_if.c */ /* br_if.c */
extern void br_port_carrier_check(struct net_bridge_port *p); extern void br_port_carrier_check(struct net_bridge_port *p);
......
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