Commit 410e9d8f authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

atm: br2684 internal stats

Now that stats are in net_device, use them.
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6d317482
...@@ -83,7 +83,6 @@ struct br2684_dev { ...@@ -83,7 +83,6 @@ struct br2684_dev {
struct list_head br2684_devs; struct list_head br2684_devs;
int number; int number;
struct list_head brvccs; /* one device <=> one vcc (before xmas) */ struct list_head brvccs; /* one device <=> one vcc (before xmas) */
struct net_device_stats stats;
int mac_was_set; int mac_was_set;
enum br2684_payload payload; enum br2684_payload payload;
}; };
...@@ -148,9 +147,10 @@ static struct net_device *br2684_find_dev(const struct br2684_if_spec *s) ...@@ -148,9 +147,10 @@ static struct net_device *br2684_find_dev(const struct br2684_if_spec *s)
* the way for multiple vcc's per itf. Returns true if we can send, * the way for multiple vcc's per itf. Returns true if we can send,
* otherwise false * otherwise false
*/ */
static int br2684_xmit_vcc(struct sk_buff *skb, struct br2684_dev *brdev, static int br2684_xmit_vcc(struct sk_buff *skb, struct net_device *dev,
struct br2684_vcc *brvcc) struct br2684_vcc *brvcc)
{ {
struct br2684_dev *brdev = BRPRIV(dev);
struct atm_vcc *atmvcc; struct atm_vcc *atmvcc;
int minheadroom = (brvcc->encaps == e_llc) ? 10 : 2; int minheadroom = (brvcc->encaps == e_llc) ? 10 : 2;
...@@ -211,8 +211,8 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct br2684_dev *brdev, ...@@ -211,8 +211,8 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct br2684_dev *brdev,
} }
atomic_add(skb->truesize, &sk_atm(atmvcc)->sk_wmem_alloc); atomic_add(skb->truesize, &sk_atm(atmvcc)->sk_wmem_alloc);
ATM_SKB(skb)->atm_options = atmvcc->atm_options; ATM_SKB(skb)->atm_options = atmvcc->atm_options;
brdev->stats.tx_packets++; dev->stats.tx_packets++;
brdev->stats.tx_bytes += skb->len; dev->stats.tx_bytes += skb->len;
atmvcc->send(atmvcc, skb); atmvcc->send(atmvcc, skb);
return 1; return 1;
} }
...@@ -233,14 +233,14 @@ static int br2684_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -233,14 +233,14 @@ static int br2684_start_xmit(struct sk_buff *skb, struct net_device *dev)
brvcc = pick_outgoing_vcc(skb, brdev); brvcc = pick_outgoing_vcc(skb, brdev);
if (brvcc == NULL) { if (brvcc == NULL) {
pr_debug("no vcc attached to dev %s\n", dev->name); pr_debug("no vcc attached to dev %s\n", dev->name);
brdev->stats.tx_errors++; dev->stats.tx_errors++;
brdev->stats.tx_carrier_errors++; dev->stats.tx_carrier_errors++;
/* netif_stop_queue(dev); */ /* netif_stop_queue(dev); */
dev_kfree_skb(skb); dev_kfree_skb(skb);
read_unlock(&devs_lock); read_unlock(&devs_lock);
return 0; return 0;
} }
if (!br2684_xmit_vcc(skb, brdev, brvcc)) { if (!br2684_xmit_vcc(skb, dev, brvcc)) {
/* /*
* We should probably use netif_*_queue() here, but that * We should probably use netif_*_queue() here, but that
* involves added complication. We need to walk before * involves added complication. We need to walk before
...@@ -248,19 +248,13 @@ static int br2684_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -248,19 +248,13 @@ static int br2684_start_xmit(struct sk_buff *skb, struct net_device *dev)
* *
* Don't free here! this pointer might be no longer valid! * Don't free here! this pointer might be no longer valid!
*/ */
brdev->stats.tx_errors++; dev->stats.tx_errors++;
brdev->stats.tx_fifo_errors++; dev->stats.tx_fifo_errors++;
} }
read_unlock(&devs_lock); read_unlock(&devs_lock);
return 0; return 0;
} }
static struct net_device_stats *br2684_get_stats(struct net_device *dev)
{
pr_debug("br2684_get_stats\n");
return &BRPRIV(dev)->stats;
}
/* /*
* We remember when the MAC gets set, so we don't override it later with * We remember when the MAC gets set, so we don't override it later with
* the ESI of the ATM card of the first VC * the ESI of the ATM card of the first VC
...@@ -430,17 +424,17 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb) ...@@ -430,17 +424,17 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
/* sigh, interface is down? */ /* sigh, interface is down? */
if (unlikely(!(net_dev->flags & IFF_UP))) if (unlikely(!(net_dev->flags & IFF_UP)))
goto dropped; goto dropped;
brdev->stats.rx_packets++; net_dev->stats.rx_packets++;
brdev->stats.rx_bytes += skb->len; net_dev->stats.rx_bytes += skb->len;
memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data)); memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data));
netif_rx(skb); netif_rx(skb);
return; return;
dropped: dropped:
brdev->stats.rx_dropped++; net_dev->stats.rx_dropped++;
goto free_skb; goto free_skb;
error: error:
brdev->stats.rx_errors++; net_dev->stats.rx_errors++;
free_skb: free_skb:
dev_kfree_skb(skb); dev_kfree_skb(skb);
return; return;
...@@ -531,8 +525,8 @@ static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg) ...@@ -531,8 +525,8 @@ static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg)
skb->next = skb->prev = NULL; skb->next = skb->prev = NULL;
br2684_push(atmvcc, skb); br2684_push(atmvcc, skb);
BRPRIV(skb->dev)->stats.rx_bytes -= skb->len; skb->dev->stats.rx_bytes -= skb->len;
BRPRIV(skb->dev)->stats.rx_packets--; skb->dev->stats.rx_packets--;
skb = next; skb = next;
} }
...@@ -554,7 +548,6 @@ static void br2684_setup(struct net_device *netdev) ...@@ -554,7 +548,6 @@ static void br2684_setup(struct net_device *netdev)
my_eth_mac_addr = netdev->set_mac_address; my_eth_mac_addr = netdev->set_mac_address;
netdev->set_mac_address = br2684_mac_addr; netdev->set_mac_address = br2684_mac_addr;
netdev->hard_start_xmit = br2684_start_xmit; netdev->hard_start_xmit = br2684_start_xmit;
netdev->get_stats = br2684_get_stats;
INIT_LIST_HEAD(&brdev->brvccs); INIT_LIST_HEAD(&brdev->brvccs);
} }
...@@ -568,7 +561,6 @@ static void br2684_setup_routed(struct net_device *netdev) ...@@ -568,7 +561,6 @@ static void br2684_setup_routed(struct net_device *netdev)
my_eth_mac_addr = netdev->set_mac_address; my_eth_mac_addr = netdev->set_mac_address;
netdev->set_mac_address = br2684_mac_addr; netdev->set_mac_address = br2684_mac_addr;
netdev->hard_start_xmit = br2684_start_xmit; netdev->hard_start_xmit = br2684_start_xmit;
netdev->get_stats = br2684_get_stats;
netdev->addr_len = 0; netdev->addr_len = 0;
netdev->mtu = 1500; netdev->mtu = 1500;
netdev->type = ARPHRD_PPP; netdev->type = ARPHRD_PPP;
......
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