diff options
author | Paulius Zaleckas <paulius.zaleckas@teltonika.lt> | 2008-05-05 15:38:34 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-05-14 16:29:47 -0400 |
commit | 5d9276daa4c489e9c37c0f0cda915ece632f3cf1 (patch) | |
tree | 17bd26539c3f198f143ca50ed303e9aa7b8f02b8 /drivers/net/wireless/airo.c | |
parent | 1b73af8284c3fcbb65eefb9141237b7e45cedd21 (diff) |
airo: use netstats in net_device structure
Use net_device_stats from net_device structure instead of local.
Changed airo_read_stats function parameter to net_device.
Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/airo.c')
-rw-r--r-- | drivers/net/wireless/airo.c | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 45f47c1c0a35..8a78283e8607 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -1148,7 +1148,6 @@ static u8 airo_dbm_to_pct (tdsRssiEntry *rssi_rid, u8 dbm); | |||
1148 | static void airo_networks_free(struct airo_info *ai); | 1148 | static void airo_networks_free(struct airo_info *ai); |
1149 | 1149 | ||
1150 | struct airo_info { | 1150 | struct airo_info { |
1151 | struct net_device_stats stats; | ||
1152 | struct net_device *dev; | 1151 | struct net_device *dev; |
1153 | struct list_head dev_list; | 1152 | struct list_head dev_list; |
1154 | /* Note, we can have MAX_FIDS outstanding. FIDs are 16-bits, so we | 1153 | /* Note, we can have MAX_FIDS outstanding. FIDs are 16-bits, so we |
@@ -1924,7 +1923,7 @@ static int mpi_start_xmit(struct sk_buff *skb, struct net_device *dev) { | |||
1924 | if (npacks >= MAXTXQ - 1) { | 1923 | if (npacks >= MAXTXQ - 1) { |
1925 | netif_stop_queue (dev); | 1924 | netif_stop_queue (dev); |
1926 | if (npacks > MAXTXQ) { | 1925 | if (npacks > MAXTXQ) { |
1927 | ai->stats.tx_fifo_errors++; | 1926 | dev->stats.tx_fifo_errors++; |
1928 | return 1; | 1927 | return 1; |
1929 | } | 1928 | } |
1930 | skb_queue_tail (&ai->txq, skb); | 1929 | skb_queue_tail (&ai->txq, skb); |
@@ -2044,13 +2043,13 @@ static void get_tx_error(struct airo_info *ai, s32 fid) | |||
2044 | bap_read(ai, &status, 2, BAP0); | 2043 | bap_read(ai, &status, 2, BAP0); |
2045 | } | 2044 | } |
2046 | if (le16_to_cpu(status) & 2) /* Too many retries */ | 2045 | if (le16_to_cpu(status) & 2) /* Too many retries */ |
2047 | ai->stats.tx_aborted_errors++; | 2046 | ai->dev->stats.tx_aborted_errors++; |
2048 | if (le16_to_cpu(status) & 4) /* Transmit lifetime exceeded */ | 2047 | if (le16_to_cpu(status) & 4) /* Transmit lifetime exceeded */ |
2049 | ai->stats.tx_heartbeat_errors++; | 2048 | ai->dev->stats.tx_heartbeat_errors++; |
2050 | if (le16_to_cpu(status) & 8) /* Aid fail */ | 2049 | if (le16_to_cpu(status) & 8) /* Aid fail */ |
2051 | { } | 2050 | { } |
2052 | if (le16_to_cpu(status) & 0x10) /* MAC disabled */ | 2051 | if (le16_to_cpu(status) & 0x10) /* MAC disabled */ |
2053 | ai->stats.tx_carrier_errors++; | 2052 | ai->dev->stats.tx_carrier_errors++; |
2054 | if (le16_to_cpu(status) & 0x20) /* Association lost */ | 2053 | if (le16_to_cpu(status) & 0x20) /* Association lost */ |
2055 | { } | 2054 | { } |
2056 | /* We produce a TXDROP event only for retry or lifetime | 2055 | /* We produce a TXDROP event only for retry or lifetime |
@@ -2102,7 +2101,7 @@ static void airo_end_xmit(struct net_device *dev) { | |||
2102 | for (; i < MAX_FIDS / 2 && (priv->fids[i] & 0xffff0000); i++); | 2101 | for (; i < MAX_FIDS / 2 && (priv->fids[i] & 0xffff0000); i++); |
2103 | } else { | 2102 | } else { |
2104 | priv->fids[fid] &= 0xffff; | 2103 | priv->fids[fid] &= 0xffff; |
2105 | priv->stats.tx_window_errors++; | 2104 | dev->stats.tx_window_errors++; |
2106 | } | 2105 | } |
2107 | if (i < MAX_FIDS / 2) | 2106 | if (i < MAX_FIDS / 2) |
2108 | netif_wake_queue(dev); | 2107 | netif_wake_queue(dev); |
@@ -2128,7 +2127,7 @@ static int airo_start_xmit(struct sk_buff *skb, struct net_device *dev) { | |||
2128 | netif_stop_queue(dev); | 2127 | netif_stop_queue(dev); |
2129 | 2128 | ||
2130 | if (i == MAX_FIDS / 2) { | 2129 | if (i == MAX_FIDS / 2) { |
2131 | priv->stats.tx_fifo_errors++; | 2130 | dev->stats.tx_fifo_errors++; |
2132 | return 1; | 2131 | return 1; |
2133 | } | 2132 | } |
2134 | } | 2133 | } |
@@ -2167,7 +2166,7 @@ static void airo_end_xmit11(struct net_device *dev) { | |||
2167 | for (; i < MAX_FIDS && (priv->fids[i] & 0xffff0000); i++); | 2166 | for (; i < MAX_FIDS && (priv->fids[i] & 0xffff0000); i++); |
2168 | } else { | 2167 | } else { |
2169 | priv->fids[fid] &= 0xffff; | 2168 | priv->fids[fid] &= 0xffff; |
2170 | priv->stats.tx_window_errors++; | 2169 | dev->stats.tx_window_errors++; |
2171 | } | 2170 | } |
2172 | if (i < MAX_FIDS) | 2171 | if (i < MAX_FIDS) |
2173 | netif_wake_queue(dev); | 2172 | netif_wake_queue(dev); |
@@ -2199,7 +2198,7 @@ static int airo_start_xmit11(struct sk_buff *skb, struct net_device *dev) { | |||
2199 | netif_stop_queue(dev); | 2198 | netif_stop_queue(dev); |
2200 | 2199 | ||
2201 | if (i == MAX_FIDS) { | 2200 | if (i == MAX_FIDS) { |
2202 | priv->stats.tx_fifo_errors++; | 2201 | dev->stats.tx_fifo_errors++; |
2203 | return 1; | 2202 | return 1; |
2204 | } | 2203 | } |
2205 | } | 2204 | } |
@@ -2219,8 +2218,9 @@ static int airo_start_xmit11(struct sk_buff *skb, struct net_device *dev) { | |||
2219 | return 0; | 2218 | return 0; |
2220 | } | 2219 | } |
2221 | 2220 | ||
2222 | static void airo_read_stats(struct airo_info *ai) | 2221 | static void airo_read_stats(struct net_device *dev) |
2223 | { | 2222 | { |
2223 | struct airo_info *ai = dev->priv; | ||
2224 | StatsRid stats_rid; | 2224 | StatsRid stats_rid; |
2225 | __le32 *vals = stats_rid.vals; | 2225 | __le32 *vals = stats_rid.vals; |
2226 | 2226 | ||
@@ -2232,23 +2232,24 @@ static void airo_read_stats(struct airo_info *ai) | |||
2232 | readStatsRid(ai, &stats_rid, RID_STATS, 0); | 2232 | readStatsRid(ai, &stats_rid, RID_STATS, 0); |
2233 | up(&ai->sem); | 2233 | up(&ai->sem); |
2234 | 2234 | ||
2235 | ai->stats.rx_packets = le32_to_cpu(vals[43]) + le32_to_cpu(vals[44]) + | 2235 | dev->stats.rx_packets = le32_to_cpu(vals[43]) + le32_to_cpu(vals[44]) + |
2236 | le32_to_cpu(vals[45]); | 2236 | le32_to_cpu(vals[45]); |
2237 | ai->stats.tx_packets = le32_to_cpu(vals[39]) + le32_to_cpu(vals[40]) + | 2237 | dev->stats.tx_packets = le32_to_cpu(vals[39]) + le32_to_cpu(vals[40]) + |
2238 | le32_to_cpu(vals[41]); | 2238 | le32_to_cpu(vals[41]); |
2239 | ai->stats.rx_bytes = le32_to_cpu(vals[92]); | 2239 | dev->stats.rx_bytes = le32_to_cpu(vals[92]); |
2240 | ai->stats.tx_bytes = le32_to_cpu(vals[91]); | 2240 | dev->stats.tx_bytes = le32_to_cpu(vals[91]); |
2241 | ai->stats.rx_errors = le32_to_cpu(vals[0]) + le32_to_cpu(vals[2]) + | 2241 | dev->stats.rx_errors = le32_to_cpu(vals[0]) + le32_to_cpu(vals[2]) + |
2242 | le32_to_cpu(vals[3]) + le32_to_cpu(vals[4]); | 2242 | le32_to_cpu(vals[3]) + le32_to_cpu(vals[4]); |
2243 | ai->stats.tx_errors = le32_to_cpu(vals[42]) + ai->stats.tx_fifo_errors; | 2243 | dev->stats.tx_errors = le32_to_cpu(vals[42]) + |
2244 | ai->stats.multicast = le32_to_cpu(vals[43]); | 2244 | dev->stats.tx_fifo_errors; |
2245 | ai->stats.collisions = le32_to_cpu(vals[89]); | 2245 | dev->stats.multicast = le32_to_cpu(vals[43]); |
2246 | dev->stats.collisions = le32_to_cpu(vals[89]); | ||
2246 | 2247 | ||
2247 | /* detailed rx_errors: */ | 2248 | /* detailed rx_errors: */ |
2248 | ai->stats.rx_length_errors = le32_to_cpu(vals[3]); | 2249 | dev->stats.rx_length_errors = le32_to_cpu(vals[3]); |
2249 | ai->stats.rx_crc_errors = le32_to_cpu(vals[4]); | 2250 | dev->stats.rx_crc_errors = le32_to_cpu(vals[4]); |
2250 | ai->stats.rx_frame_errors = le32_to_cpu(vals[2]); | 2251 | dev->stats.rx_frame_errors = le32_to_cpu(vals[2]); |
2251 | ai->stats.rx_fifo_errors = le32_to_cpu(vals[0]); | 2252 | dev->stats.rx_fifo_errors = le32_to_cpu(vals[0]); |
2252 | } | 2253 | } |
2253 | 2254 | ||
2254 | static struct net_device_stats *airo_get_stats(struct net_device *dev) | 2255 | static struct net_device_stats *airo_get_stats(struct net_device *dev) |
@@ -2261,10 +2262,10 @@ static struct net_device_stats *airo_get_stats(struct net_device *dev) | |||
2261 | set_bit(JOB_STATS, &local->jobs); | 2262 | set_bit(JOB_STATS, &local->jobs); |
2262 | wake_up_interruptible(&local->thr_wait); | 2263 | wake_up_interruptible(&local->thr_wait); |
2263 | } else | 2264 | } else |
2264 | airo_read_stats(local); | 2265 | airo_read_stats(dev); |
2265 | } | 2266 | } |
2266 | 2267 | ||
2267 | return &local->stats; | 2268 | return &dev->stats; |
2268 | } | 2269 | } |
2269 | 2270 | ||
2270 | static void airo_set_promisc(struct airo_info *ai) { | 2271 | static void airo_set_promisc(struct airo_info *ai) { |
@@ -3092,7 +3093,7 @@ static int airo_thread(void *data) { | |||
3092 | else if (test_bit(JOB_XMIT11, &ai->jobs)) | 3093 | else if (test_bit(JOB_XMIT11, &ai->jobs)) |
3093 | airo_end_xmit11(dev); | 3094 | airo_end_xmit11(dev); |
3094 | else if (test_bit(JOB_STATS, &ai->jobs)) | 3095 | else if (test_bit(JOB_STATS, &ai->jobs)) |
3095 | airo_read_stats(ai); | 3096 | airo_read_stats(dev); |
3096 | else if (test_bit(JOB_WSTATS, &ai->jobs)) | 3097 | else if (test_bit(JOB_WSTATS, &ai->jobs)) |
3097 | airo_read_wireless_stats(ai); | 3098 | airo_read_wireless_stats(ai); |
3098 | else if (test_bit(JOB_PROMISC, &ai->jobs)) | 3099 | else if (test_bit(JOB_PROMISC, &ai->jobs)) |
@@ -3288,7 +3289,7 @@ static irqreturn_t airo_interrupt(int irq, void *dev_id) | |||
3288 | 3289 | ||
3289 | skb = dev_alloc_skb( len + hdrlen + 2 + 2 ); | 3290 | skb = dev_alloc_skb( len + hdrlen + 2 + 2 ); |
3290 | if ( !skb ) { | 3291 | if ( !skb ) { |
3291 | apriv->stats.rx_dropped++; | 3292 | dev->stats.rx_dropped++; |
3292 | goto badrx; | 3293 | goto badrx; |
3293 | } | 3294 | } |
3294 | skb_reserve(skb, 2); /* This way the IP header is aligned */ | 3295 | skb_reserve(skb, 2); /* This way the IP header is aligned */ |
@@ -3556,7 +3557,7 @@ static void mpi_receive_802_3(struct airo_info *ai) | |||
3556 | 3557 | ||
3557 | skb = dev_alloc_skb(len); | 3558 | skb = dev_alloc_skb(len); |
3558 | if (!skb) { | 3559 | if (!skb) { |
3559 | ai->stats.rx_dropped++; | 3560 | ai->dev->stats.rx_dropped++; |
3560 | goto badrx; | 3561 | goto badrx; |
3561 | } | 3562 | } |
3562 | buffer = skb_put(skb,len); | 3563 | buffer = skb_put(skb,len); |
@@ -3649,7 +3650,7 @@ void mpi_receive_802_11 (struct airo_info *ai) | |||
3649 | 3650 | ||
3650 | skb = dev_alloc_skb( len + hdrlen + 2 ); | 3651 | skb = dev_alloc_skb( len + hdrlen + 2 ); |
3651 | if ( !skb ) { | 3652 | if ( !skb ) { |
3652 | ai->stats.rx_dropped++; | 3653 | ai->dev->stats.rx_dropped++; |
3653 | goto badrx; | 3654 | goto badrx; |
3654 | } | 3655 | } |
3655 | buffer = (u16*)skb_put (skb, len + hdrlen); | 3656 | buffer = (u16*)skb_put (skb, len + hdrlen); |