Skip to content

Commit

Permalink
libertas: convert to internal net_device_stats
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Mar 22, 2009
1 parent 6456fff commit bbfc6b7
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 41 deletions.
1 change: 0 additions & 1 deletion drivers/net/wireless/libertas/dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ struct lbs_private {
void *card;
struct net_device *dev;

struct net_device_stats stats;
struct net_device *mesh_dev; /* Virtual device */
struct net_device *rtap_net_dev;

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/libertas/if_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ static struct sk_buff *if_cs_receive_data(struct lbs_private *priv)
len = if_cs_read16(priv->card, IF_CS_READ_LEN);
if (len == 0 || len > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE) {
lbs_pr_err("card data buffer has invalid # of bytes (%d)\n", len);
priv->stats.rx_dropped++;
priv->dev->stats.rx_dropped++;
goto dat_err;
}

Expand Down
26 changes: 1 addition & 25 deletions drivers/net/wireless/libertas/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,20 +582,6 @@ void lbs_host_to_card_done(struct lbs_private *priv)
}
EXPORT_SYMBOL_GPL(lbs_host_to_card_done);

/**
* @brief This function returns the network statistics
*
* @param dev A pointer to struct lbs_private structure
* @return A pointer to net_device_stats structure
*/
static struct net_device_stats *lbs_get_stats(struct net_device *dev)
{
struct lbs_private *priv = dev->ml_priv;

lbs_deb_enter(LBS_DEB_NET);
return &priv->stats;
}

static int lbs_set_mac_address(struct net_device *dev, void *addr)
{
int ret = 0;
Expand Down Expand Up @@ -1201,7 +1187,7 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev)
dev->stop = lbs_eth_stop;
dev->set_mac_address = lbs_set_mac_address;
dev->tx_timeout = lbs_tx_timeout;
dev->get_stats = lbs_get_stats;

dev->watchdog_timeo = 5 * HZ;
dev->ethtool_ops = &lbs_ethtool_ops;
#ifdef WIRELESS_EXT
Expand Down Expand Up @@ -1443,7 +1429,6 @@ static int lbs_add_mesh(struct lbs_private *priv)
mesh_dev->open = lbs_dev_open;
mesh_dev->hard_start_xmit = lbs_hard_start_xmit;
mesh_dev->stop = lbs_mesh_stop;
mesh_dev->get_stats = lbs_get_stats;
mesh_dev->set_mac_address = lbs_set_mac_address;
mesh_dev->ethtool_ops = &lbs_ethtool_ops;
memcpy(mesh_dev->dev_addr, priv->dev->dev_addr,
Expand Down Expand Up @@ -1648,14 +1633,6 @@ static int lbs_rtap_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
return NETDEV_TX_BUSY;
}

static struct net_device_stats *lbs_rtap_get_stats(struct net_device *dev)
{
struct lbs_private *priv = dev->ml_priv;
lbs_deb_enter(LBS_DEB_NET);
return &priv->stats;
}


static void lbs_remove_rtap(struct lbs_private *priv)
{
lbs_deb_enter(LBS_DEB_MAIN);
Expand Down Expand Up @@ -1689,7 +1666,6 @@ static int lbs_add_rtap(struct lbs_private *priv)
rtap_dev->type = ARPHRD_IEEE80211_RADIOTAP;
rtap_dev->open = lbs_rtap_open;
rtap_dev->stop = lbs_rtap_stop;
rtap_dev->get_stats = lbs_rtap_get_stats;
rtap_dev->hard_start_xmit = lbs_rtap_hard_start_xmit;
rtap_dev->ml_priv = priv;
SET_NETDEV_DEV(rtap_dev, priv->dev->dev.parent);
Expand Down
18 changes: 9 additions & 9 deletions drivers/net/wireless/libertas/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb)

if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) {
lbs_deb_rx("rx err: frame received with bad length\n");
priv->stats.rx_length_errors++;
dev->stats.rx_length_errors++;
ret = 0;
goto done;
}
Expand All @@ -179,7 +179,7 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb)
if (!(p_rx_pd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) {
lbs_deb_rx("rx err: frame received with bad status\n");
lbs_pr_alert("rxpd not ok\n");
priv->stats.rx_errors++;
dev->stats.rx_errors++;
ret = 0;
goto done;
}
Expand Down Expand Up @@ -243,8 +243,8 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb)
lbs_compute_rssi(priv, p_rx_pd);

lbs_deb_rx("rx data: size of actual packet %d\n", skb->len);
priv->stats.rx_bytes += skb->len;
priv->stats.rx_packets++;
dev->stats.rx_bytes += skb->len;
dev->stats.rx_packets++;

skb->protocol = eth_type_trans(skb, dev);
if (in_interrupt())
Expand Down Expand Up @@ -311,7 +311,7 @@ static int process_rxed_802_11_packet(struct lbs_private *priv,
struct sk_buff *skb)
{
int ret = 0;

struct net_device *dev = priv->dev;
struct rx80211packethdr *p_rx_pkt;
struct rxpd *prxpd;
struct rx_radiotap_hdr radiotap_hdr;
Expand All @@ -326,7 +326,7 @@ static int process_rxed_802_11_packet(struct lbs_private *priv,

if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) {
lbs_deb_rx("rx err: frame received with bad length\n");
priv->stats.rx_length_errors++;
dev->stats.rx_length_errors++;
ret = -EINVAL;
kfree_skb(skb);
goto done;
Expand All @@ -337,7 +337,7 @@ static int process_rxed_802_11_packet(struct lbs_private *priv,
*/
if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) {
//lbs_deb_rx("rx err: frame received with bad status\n");
priv->stats.rx_errors++;
dev->stats.rx_errors++;
}

lbs_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n",
Expand Down Expand Up @@ -389,8 +389,8 @@ static int process_rxed_802_11_packet(struct lbs_private *priv,
lbs_compute_rssi(priv, prxpd);

lbs_deb_rx("rx data: size of actual packet %d\n", skb->len);
priv->stats.rx_bytes += skb->len;
priv->stats.rx_packets++;
dev->stats.rx_bytes += skb->len;
dev->stats.rx_packets++;

skb->protocol = eth_type_trans(skb, priv->rtap_net_dev);
netif_rx(skb);
Expand Down
8 changes: 4 additions & 4 deletions drivers/net/wireless/libertas/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE);
/* We'll never manage to send this one; drop it and return 'OK' */

priv->stats.tx_dropped++;
priv->stats.tx_errors++;
dev->stats.tx_dropped++;
dev->stats.tx_errors++;
goto free;
}

Expand Down Expand Up @@ -146,8 +146,8 @@ int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)

lbs_deb_tx("%s lined up packet\n", __func__);

priv->stats.tx_packets++;
priv->stats.tx_bytes += skb->len;
dev->stats.tx_packets++;
dev->stats.tx_bytes += skb->len;

dev->trans_start = jiffies;

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/libertas/wext.c
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
quality = rssi_qual;

/* Quality by TX errors */
priv->wstats.discard.retries = priv->stats.tx_errors;
priv->wstats.discard.retries = dev->stats.tx_errors;

memset(&log, 0, sizeof(log));
log.hdr.size = cpu_to_le16(sizeof(log));
Expand Down

0 comments on commit bbfc6b7

Please sign in to comment.