Commit 6088a539 authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller
Browse files

bridge: Use BR_INPUT_SKB_CB on xmit path



this patch makes BR_INPUT_SKB_CB available on the xmit path so
that we could avoid passing the br pointer around for the purpose
of collecting device statistics.

Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b33084be
...@@ -26,6 +26,8 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -26,6 +26,8 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
const unsigned char *dest = skb->data; const unsigned char *dest = skb->data;
struct net_bridge_fdb_entry *dst; struct net_bridge_fdb_entry *dst;
BR_INPUT_SKB_CB(skb)->brdev = dev;
dev->stats.tx_packets++; dev->stats.tx_packets++;
dev->stats.tx_bytes += skb->len; dev->stats.tx_bytes += skb->len;
......
...@@ -111,6 +111,7 @@ static void br_flood(struct net_bridge *br, struct sk_buff *skb, ...@@ -111,6 +111,7 @@ static void br_flood(struct net_bridge *br, struct sk_buff *skb,
{ {
struct net_bridge_port *p; struct net_bridge_port *p;
struct net_bridge_port *prev; struct net_bridge_port *prev;
struct net_device *dev = BR_INPUT_SKB_CB(skb)->brdev;
prev = NULL; prev = NULL;
...@@ -120,7 +121,7 @@ static void br_flood(struct net_bridge *br, struct sk_buff *skb, ...@@ -120,7 +121,7 @@ static void br_flood(struct net_bridge *br, struct sk_buff *skb,
struct sk_buff *skb2; struct sk_buff *skb2;
if ((skb2 = skb_clone(skb, GFP_ATOMIC)) == NULL) { if ((skb2 = skb_clone(skb, GFP_ATOMIC)) == NULL) {
br->dev->stats.tx_dropped++; dev->stats.tx_dropped++;
goto out; goto out;
} }
...@@ -137,7 +138,7 @@ static void br_flood(struct net_bridge *br, struct sk_buff *skb, ...@@ -137,7 +138,7 @@ static void br_flood(struct net_bridge *br, struct sk_buff *skb,
if (skb0) { if (skb0) {
skb = skb_clone(skb, GFP_ATOMIC); skb = skb_clone(skb, GFP_ATOMIC);
if (!skb) { if (!skb) {
br->dev->stats.tx_dropped++; dev->stats.tx_dropped++;
goto out; goto out;
} }
} }
......
Supports Markdown
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