aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wan/hdlc_fr.c
diff options
context:
space:
mode:
authorKrzysztof Halasa <khc@pm.waw.pl>2008-06-30 17:26:53 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-07-04 08:47:41 -0400
commit198191c4a7ce4daba379608fb38b9bc5a4eedc61 (patch)
tree3229362a45a15af42628553926bc040e44c39ce0 /drivers/net/wan/hdlc_fr.c
parent844290e56067aed0a54142d756565abb9614136c (diff)
WAN: convert drivers to use built-in netdev_stats
There is no point in using separate net_device_stats structs when the one in struct net_device is present. Compiles. Signed-off-by: Krzysztof HaƂasa <khc@pm.waw.pl> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/wan/hdlc_fr.c')
-rw-r--r--drivers/net/wan/hdlc_fr.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c
index 520bb0b1a9a..cb1b415053e 100644
--- a/drivers/net/wan/hdlc_fr.c
+++ b/drivers/net/wan/hdlc_fr.c
@@ -136,7 +136,6 @@ typedef struct pvc_device_struct {
136}pvc_device; 136}pvc_device;
137 137
138struct pvc_desc { 138struct pvc_desc {
139 struct net_device_stats stats;
140 pvc_device *pvc; 139 pvc_device *pvc;
141}; 140};
142 141
@@ -184,11 +183,6 @@ static inline struct pvc_desc* pvcdev_to_desc(struct net_device *dev)
184 return dev->priv; 183 return dev->priv;
185} 184}
186 185
187static inline struct net_device_stats* pvc_get_stats(struct net_device *dev)
188{
189 return &pvcdev_to_desc(dev)->stats;
190}
191
192static inline pvc_device* find_pvc(hdlc_device *hdlc, u16 dlci) 186static inline pvc_device* find_pvc(hdlc_device *hdlc, u16 dlci)
193{ 187{
194 pvc_device *pvc = state(hdlc)->first_pvc; 188 pvc_device *pvc = state(hdlc)->first_pvc;
@@ -425,7 +419,6 @@ static int pvc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
425static int pvc_xmit(struct sk_buff *skb, struct net_device *dev) 419static int pvc_xmit(struct sk_buff *skb, struct net_device *dev)
426{ 420{
427 pvc_device *pvc = pvcdev_to_desc(dev)->pvc; 421 pvc_device *pvc = pvcdev_to_desc(dev)->pvc;
428 struct net_device_stats *stats = pvc_get_stats(dev);
429 422
430 if (pvc->state.active) { 423 if (pvc->state.active) {
431 if (dev->type == ARPHRD_ETHER) { 424 if (dev->type == ARPHRD_ETHER) {
@@ -435,7 +428,7 @@ static int pvc_xmit(struct sk_buff *skb, struct net_device *dev)
435 if (skb_tailroom(skb) < pad) 428 if (skb_tailroom(skb) < pad)
436 if (pskb_expand_head(skb, 0, pad, 429 if (pskb_expand_head(skb, 0, pad,
437 GFP_ATOMIC)) { 430 GFP_ATOMIC)) {
438 stats->tx_dropped++; 431 dev->stats.tx_dropped++;
439 dev_kfree_skb(skb); 432 dev_kfree_skb(skb);
440 return 0; 433 return 0;
441 } 434 }
@@ -445,17 +438,17 @@ static int pvc_xmit(struct sk_buff *skb, struct net_device *dev)
445 skb->protocol = __constant_htons(ETH_P_802_3); 438 skb->protocol = __constant_htons(ETH_P_802_3);
446 } 439 }
447 if (!fr_hard_header(&skb, pvc->dlci)) { 440 if (!fr_hard_header(&skb, pvc->dlci)) {
448 stats->tx_bytes += skb->len; 441 dev->stats.tx_bytes += skb->len;
449 stats->tx_packets++; 442 dev->stats.tx_packets++;
450 if (pvc->state.fecn) /* TX Congestion counter */ 443 if (pvc->state.fecn) /* TX Congestion counter */
451 stats->tx_compressed++; 444 dev->stats.tx_compressed++;
452 skb->dev = pvc->frad; 445 skb->dev = pvc->frad;
453 dev_queue_xmit(skb); 446 dev_queue_xmit(skb);
454 return 0; 447 return 0;
455 } 448 }
456 } 449 }
457 450
458 stats->tx_dropped++; 451 dev->stats.tx_dropped++;
459 dev_kfree_skb(skb); 452 dev_kfree_skb(skb);
460 return 0; 453 return 0;
461} 454}
@@ -955,7 +948,7 @@ static int fr_rx(struct sk_buff *skb)
955 948
956 949
957 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) { 950 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) {
958 dev_to_hdlc(frad)->stats.rx_dropped++; 951 frad->stats.rx_dropped++;
959 return NET_RX_DROP; 952 return NET_RX_DROP;
960 } 953 }
961 954
@@ -1003,11 +996,10 @@ static int fr_rx(struct sk_buff *skb)
1003 } 996 }
1004 997
1005 if (dev) { 998 if (dev) {
1006 struct net_device_stats *stats = pvc_get_stats(dev); 999 dev->stats.rx_packets++; /* PVC traffic */
1007 stats->rx_packets++; /* PVC traffic */ 1000 dev->stats.rx_bytes += skb->len;
1008 stats->rx_bytes += skb->len;
1009 if (pvc->state.becn) 1001 if (pvc->state.becn)
1010 stats->rx_compressed++; 1002 dev->stats.rx_compressed++;
1011 netif_rx(skb); 1003 netif_rx(skb);
1012 return NET_RX_SUCCESS; 1004 return NET_RX_SUCCESS;
1013 } else { 1005 } else {
@@ -1016,7 +1008,7 @@ static int fr_rx(struct sk_buff *skb)
1016 } 1008 }
1017 1009
1018 rx_error: 1010 rx_error:
1019 dev_to_hdlc(frad)->stats.rx_errors++; /* Mark error */ 1011 frad->stats.rx_errors++; /* Mark error */
1020 dev_kfree_skb_any(skb); 1012 dev_kfree_skb_any(skb);
1021 return NET_RX_DROP; 1013 return NET_RX_DROP;
1022} 1014}
@@ -1122,7 +1114,6 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type)
1122 dlci_to_q922(dev->broadcast, dlci); 1114 dlci_to_q922(dev->broadcast, dlci);
1123 } 1115 }
1124 dev->hard_start_xmit = pvc_xmit; 1116 dev->hard_start_xmit = pvc_xmit;
1125 dev->get_stats = pvc_get_stats;
1126 dev->open = pvc_open; 1117 dev->open = pvc_open;
1127 dev->stop = pvc_close; 1118 dev->stop = pvc_close;
1128 dev->do_ioctl = pvc_ioctl; 1119 dev->do_ioctl = pvc_ioctl;