aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-03-20 15:36:36 -0400
committerDavid S. Miller <davem@davemloft.net>2009-03-22 01:51:24 -0400
commitbbfc6b788f63f079fb8eeeb8d397bb1c0a8065a1 (patch)
tree65b339dc8a068e21495575a5629f7346213e2306
parent6456fffb09a281af2644e73fda26d1eeec325830 (diff)
libertas: convert to internal net_device_stats
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/wireless/libertas/dev.h1
-rw-r--r--drivers/net/wireless/libertas/if_cs.c2
-rw-r--r--drivers/net/wireless/libertas/main.c26
-rw-r--r--drivers/net/wireless/libertas/rx.c18
-rw-r--r--drivers/net/wireless/libertas/tx.c8
-rw-r--r--drivers/net/wireless/libertas/wext.c2
6 files changed, 16 insertions, 41 deletions
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
index dd682c4cfde8..27e81fd97c94 100644
--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -109,7 +109,6 @@ struct lbs_private {
109 void *card; 109 void *card;
110 struct net_device *dev; 110 struct net_device *dev;
111 111
112 struct net_device_stats stats;
113 struct net_device *mesh_dev; /* Virtual device */ 112 struct net_device *mesh_dev; /* Virtual device */
114 struct net_device *rtap_net_dev; 113 struct net_device *rtap_net_dev;
115 114
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c
index 8f8934a5ba3a..cedeac6322fe 100644
--- a/drivers/net/wireless/libertas/if_cs.c
+++ b/drivers/net/wireless/libertas/if_cs.c
@@ -421,7 +421,7 @@ static struct sk_buff *if_cs_receive_data(struct lbs_private *priv)
421 len = if_cs_read16(priv->card, IF_CS_READ_LEN); 421 len = if_cs_read16(priv->card, IF_CS_READ_LEN);
422 if (len == 0 || len > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE) { 422 if (len == 0 || len > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE) {
423 lbs_pr_err("card data buffer has invalid # of bytes (%d)\n", len); 423 lbs_pr_err("card data buffer has invalid # of bytes (%d)\n", len);
424 priv->stats.rx_dropped++; 424 priv->dev->stats.rx_dropped++;
425 goto dat_err; 425 goto dat_err;
426 } 426 }
427 427
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index d93553f15e91..c27088d0541b 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -582,20 +582,6 @@ void lbs_host_to_card_done(struct lbs_private *priv)
582} 582}
583EXPORT_SYMBOL_GPL(lbs_host_to_card_done); 583EXPORT_SYMBOL_GPL(lbs_host_to_card_done);
584 584
585/**
586 * @brief This function returns the network statistics
587 *
588 * @param dev A pointer to struct lbs_private structure
589 * @return A pointer to net_device_stats structure
590 */
591static struct net_device_stats *lbs_get_stats(struct net_device *dev)
592{
593 struct lbs_private *priv = dev->ml_priv;
594
595 lbs_deb_enter(LBS_DEB_NET);
596 return &priv->stats;
597}
598
599static int lbs_set_mac_address(struct net_device *dev, void *addr) 585static int lbs_set_mac_address(struct net_device *dev, void *addr)
600{ 586{
601 int ret = 0; 587 int ret = 0;
@@ -1201,7 +1187,7 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev)
1201 dev->stop = lbs_eth_stop; 1187 dev->stop = lbs_eth_stop;
1202 dev->set_mac_address = lbs_set_mac_address; 1188 dev->set_mac_address = lbs_set_mac_address;
1203 dev->tx_timeout = lbs_tx_timeout; 1189 dev->tx_timeout = lbs_tx_timeout;
1204 dev->get_stats = lbs_get_stats; 1190
1205 dev->watchdog_timeo = 5 * HZ; 1191 dev->watchdog_timeo = 5 * HZ;
1206 dev->ethtool_ops = &lbs_ethtool_ops; 1192 dev->ethtool_ops = &lbs_ethtool_ops;
1207#ifdef WIRELESS_EXT 1193#ifdef WIRELESS_EXT
@@ -1443,7 +1429,6 @@ static int lbs_add_mesh(struct lbs_private *priv)
1443 mesh_dev->open = lbs_dev_open; 1429 mesh_dev->open = lbs_dev_open;
1444 mesh_dev->hard_start_xmit = lbs_hard_start_xmit; 1430 mesh_dev->hard_start_xmit = lbs_hard_start_xmit;
1445 mesh_dev->stop = lbs_mesh_stop; 1431 mesh_dev->stop = lbs_mesh_stop;
1446 mesh_dev->get_stats = lbs_get_stats;
1447 mesh_dev->set_mac_address = lbs_set_mac_address; 1432 mesh_dev->set_mac_address = lbs_set_mac_address;
1448 mesh_dev->ethtool_ops = &lbs_ethtool_ops; 1433 mesh_dev->ethtool_ops = &lbs_ethtool_ops;
1449 memcpy(mesh_dev->dev_addr, priv->dev->dev_addr, 1434 memcpy(mesh_dev->dev_addr, priv->dev->dev_addr,
@@ -1648,14 +1633,6 @@ static int lbs_rtap_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
1648 return NETDEV_TX_BUSY; 1633 return NETDEV_TX_BUSY;
1649} 1634}
1650 1635
1651static struct net_device_stats *lbs_rtap_get_stats(struct net_device *dev)
1652{
1653 struct lbs_private *priv = dev->ml_priv;
1654 lbs_deb_enter(LBS_DEB_NET);
1655 return &priv->stats;
1656}
1657
1658
1659static void lbs_remove_rtap(struct lbs_private *priv) 1636static void lbs_remove_rtap(struct lbs_private *priv)
1660{ 1637{
1661 lbs_deb_enter(LBS_DEB_MAIN); 1638 lbs_deb_enter(LBS_DEB_MAIN);
@@ -1689,7 +1666,6 @@ static int lbs_add_rtap(struct lbs_private *priv)
1689 rtap_dev->type = ARPHRD_IEEE80211_RADIOTAP; 1666 rtap_dev->type = ARPHRD_IEEE80211_RADIOTAP;
1690 rtap_dev->open = lbs_rtap_open; 1667 rtap_dev->open = lbs_rtap_open;
1691 rtap_dev->stop = lbs_rtap_stop; 1668 rtap_dev->stop = lbs_rtap_stop;
1692 rtap_dev->get_stats = lbs_rtap_get_stats;
1693 rtap_dev->hard_start_xmit = lbs_rtap_hard_start_xmit; 1669 rtap_dev->hard_start_xmit = lbs_rtap_hard_start_xmit;
1694 rtap_dev->ml_priv = priv; 1670 rtap_dev->ml_priv = priv;
1695 SET_NETDEV_DEV(rtap_dev, priv->dev->dev.parent); 1671 SET_NETDEV_DEV(rtap_dev, priv->dev->dev.parent);
diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c
index 079e6aa874dc..4f60948dde9c 100644
--- a/drivers/net/wireless/libertas/rx.c
+++ b/drivers/net/wireless/libertas/rx.c
@@ -168,7 +168,7 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb)
168 168
169 if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) { 169 if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) {
170 lbs_deb_rx("rx err: frame received with bad length\n"); 170 lbs_deb_rx("rx err: frame received with bad length\n");
171 priv->stats.rx_length_errors++; 171 dev->stats.rx_length_errors++;
172 ret = 0; 172 ret = 0;
173 goto done; 173 goto done;
174 } 174 }
@@ -179,7 +179,7 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb)
179 if (!(p_rx_pd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) { 179 if (!(p_rx_pd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) {
180 lbs_deb_rx("rx err: frame received with bad status\n"); 180 lbs_deb_rx("rx err: frame received with bad status\n");
181 lbs_pr_alert("rxpd not ok\n"); 181 lbs_pr_alert("rxpd not ok\n");
182 priv->stats.rx_errors++; 182 dev->stats.rx_errors++;
183 ret = 0; 183 ret = 0;
184 goto done; 184 goto done;
185 } 185 }
@@ -243,8 +243,8 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb)
243 lbs_compute_rssi(priv, p_rx_pd); 243 lbs_compute_rssi(priv, p_rx_pd);
244 244
245 lbs_deb_rx("rx data: size of actual packet %d\n", skb->len); 245 lbs_deb_rx("rx data: size of actual packet %d\n", skb->len);
246 priv->stats.rx_bytes += skb->len; 246 dev->stats.rx_bytes += skb->len;
247 priv->stats.rx_packets++; 247 dev->stats.rx_packets++;
248 248
249 skb->protocol = eth_type_trans(skb, dev); 249 skb->protocol = eth_type_trans(skb, dev);
250 if (in_interrupt()) 250 if (in_interrupt())
@@ -311,7 +311,7 @@ static int process_rxed_802_11_packet(struct lbs_private *priv,
311 struct sk_buff *skb) 311 struct sk_buff *skb)
312{ 312{
313 int ret = 0; 313 int ret = 0;
314 314 struct net_device *dev = priv->dev;
315 struct rx80211packethdr *p_rx_pkt; 315 struct rx80211packethdr *p_rx_pkt;
316 struct rxpd *prxpd; 316 struct rxpd *prxpd;
317 struct rx_radiotap_hdr radiotap_hdr; 317 struct rx_radiotap_hdr radiotap_hdr;
@@ -326,7 +326,7 @@ static int process_rxed_802_11_packet(struct lbs_private *priv,
326 326
327 if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) { 327 if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) {
328 lbs_deb_rx("rx err: frame received with bad length\n"); 328 lbs_deb_rx("rx err: frame received with bad length\n");
329 priv->stats.rx_length_errors++; 329 dev->stats.rx_length_errors++;
330 ret = -EINVAL; 330 ret = -EINVAL;
331 kfree_skb(skb); 331 kfree_skb(skb);
332 goto done; 332 goto done;
@@ -337,7 +337,7 @@ static int process_rxed_802_11_packet(struct lbs_private *priv,
337 */ 337 */
338 if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) { 338 if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) {
339 //lbs_deb_rx("rx err: frame received with bad status\n"); 339 //lbs_deb_rx("rx err: frame received with bad status\n");
340 priv->stats.rx_errors++; 340 dev->stats.rx_errors++;
341 } 341 }
342 342
343 lbs_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n", 343 lbs_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n",
@@ -389,8 +389,8 @@ static int process_rxed_802_11_packet(struct lbs_private *priv,
389 lbs_compute_rssi(priv, prxpd); 389 lbs_compute_rssi(priv, prxpd);
390 390
391 lbs_deb_rx("rx data: size of actual packet %d\n", skb->len); 391 lbs_deb_rx("rx data: size of actual packet %d\n", skb->len);
392 priv->stats.rx_bytes += skb->len; 392 dev->stats.rx_bytes += skb->len;
393 priv->stats.rx_packets++; 393 dev->stats.rx_packets++;
394 394
395 skb->protocol = eth_type_trans(skb, priv->rtap_net_dev); 395 skb->protocol = eth_type_trans(skb, priv->rtap_net_dev);
396 netif_rx(skb); 396 netif_rx(skb);
diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c
index 68bec31ae03b..f10aa39a6b68 100644
--- a/drivers/net/wireless/libertas/tx.c
+++ b/drivers/net/wireless/libertas/tx.c
@@ -82,8 +82,8 @@ int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
82 skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE); 82 skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE);
83 /* We'll never manage to send this one; drop it and return 'OK' */ 83 /* We'll never manage to send this one; drop it and return 'OK' */
84 84
85 priv->stats.tx_dropped++; 85 dev->stats.tx_dropped++;
86 priv->stats.tx_errors++; 86 dev->stats.tx_errors++;
87 goto free; 87 goto free;
88 } 88 }
89 89
@@ -146,8 +146,8 @@ int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
146 146
147 lbs_deb_tx("%s lined up packet\n", __func__); 147 lbs_deb_tx("%s lined up packet\n", __func__);
148 148
149 priv->stats.tx_packets++; 149 dev->stats.tx_packets++;
150 priv->stats.tx_bytes += skb->len; 150 dev->stats.tx_bytes += skb->len;
151 151
152 dev->trans_start = jiffies; 152 dev->trans_start = jiffies;
153 153
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index f16d136ab4bb..8bc1907458b1 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -830,7 +830,7 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
830 quality = rssi_qual; 830 quality = rssi_qual;
831 831
832 /* Quality by TX errors */ 832 /* Quality by TX errors */
833 priv->wstats.discard.retries = priv->stats.tx_errors; 833 priv->wstats.discard.retries = dev->stats.tx_errors;
834 834
835 memset(&log, 0, sizeof(log)); 835 memset(&log, 0, sizeof(log));
836 log.hdr.size = cpu_to_le16(sizeof(log)); 836 log.hdr.size = cpu_to_le16(sizeof(log));