ath6kl: Use net_device_stats from struct net_device
authorTobias Klauser <tklauser@distanz.ch>
Thu, 9 Feb 2017 11:21:17 +0000 (12:21 +0100)
committerKalle Valo <kvalo@qca.qualcomm.com>
Tue, 14 Feb 2017 17:57:19 +0000 (19:57 +0200)
Instead of using a private copy of struct net_device_stats in struct
ath6kl_vif, use stats from struct net_device. Also remove the now
unnecessary .ndo_get_stats function.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath6kl/core.h
drivers/net/wireless/ath/ath6kl/main.c
drivers/net/wireless/ath/ath6kl/txrx.c

index ac25f17..87e99c1 100644 (file)
@@ -641,7 +641,6 @@ struct ath6kl_vif {
        u32 txe_intvl;
        u16 bg_scan_period;
        u8 assoc_bss_dtim_period;
-       struct net_device_stats net_stats;
        struct target_stats target_stats;
        struct wmi_connect_cmd profile;
        u16 rsn_capab;
index 1af3fed..91ee542 100644 (file)
@@ -1113,13 +1113,6 @@ static int ath6kl_close(struct net_device *dev)
        return 0;
 }
 
-static struct net_device_stats *ath6kl_get_stats(struct net_device *dev)
-{
-       struct ath6kl_vif *vif = netdev_priv(dev);
-
-       return &vif->net_stats;
-}
-
 static int ath6kl_set_features(struct net_device *dev,
                               netdev_features_t features)
 {
@@ -1285,7 +1278,6 @@ static const struct net_device_ops ath6kl_netdev_ops = {
        .ndo_open               = ath6kl_open,
        .ndo_stop               = ath6kl_close,
        .ndo_start_xmit         = ath6kl_data_tx,
-       .ndo_get_stats          = ath6kl_get_stats,
        .ndo_set_features       = ath6kl_set_features,
        .ndo_set_rx_mode        = ath6kl_set_multicast_list,
 };
index 9df41d5..a531e0c 100644 (file)
@@ -405,7 +405,7 @@ int ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev)
                        skb = skb_realloc_headroom(skb, dev->needed_headroom);
                        kfree_skb(tmp_skb);
                        if (skb == NULL) {
-                               vif->net_stats.tx_dropped++;
+                               dev->stats.tx_dropped++;
                                return 0;
                        }
                }
@@ -520,8 +520,8 @@ int ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev)
 fail_tx:
        dev_kfree_skb(skb);
 
-       vif->net_stats.tx_dropped++;
-       vif->net_stats.tx_aborted_errors++;
+       dev->stats.tx_dropped++;
+       dev->stats.tx_aborted_errors++;
 
        return 0;
 }
@@ -767,7 +767,7 @@ void ath6kl_tx_complete(struct htc_target *target,
                                /* a packet was flushed  */
                                flushing[if_idx] = true;
 
-                       vif->net_stats.tx_errors++;
+                       vif->ndev->stats.tx_errors++;
 
                        if (status != -ENOSPC && status != -ECANCELED)
                                ath6kl_warn("tx complete error: %d\n", status);
@@ -783,8 +783,8 @@ void ath6kl_tx_complete(struct htc_target *target,
                                   eid, "OK");
 
                        flushing[if_idx] = false;
-                       vif->net_stats.tx_packets++;
-                       vif->net_stats.tx_bytes += skb->len;
+                       vif->ndev->stats.tx_packets++;
+                       vif->ndev->stats.tx_bytes += skb->len;
                }
 
                ath6kl_tx_clear_node_map(vif, eid, map_no);
@@ -1365,8 +1365,8 @@ void ath6kl_rx(struct htc_target *target, struct htc_packet *packet)
         */
        spin_lock_bh(&vif->if_lock);
 
-       vif->net_stats.rx_packets++;
-       vif->net_stats.rx_bytes += packet->act_len;
+       vif->ndev->stats.rx_packets++;
+       vif->ndev->stats.rx_bytes += packet->act_len;
 
        spin_unlock_bh(&vif->if_lock);
 
@@ -1395,8 +1395,8 @@ void ath6kl_rx(struct htc_target *target, struct htc_packet *packet)
            ((packet->act_len < min_hdr_len) ||
             (packet->act_len > WMI_MAX_AMSDU_RX_DATA_FRAME_LENGTH))) {
                ath6kl_info("frame len is too short or too long\n");
-               vif->net_stats.rx_errors++;
-               vif->net_stats.rx_length_errors++;
+               vif->ndev->stats.rx_errors++;
+               vif->ndev->stats.rx_length_errors++;
                dev_kfree_skb(skb);
                return;
        }
@@ -1619,7 +1619,7 @@ void ath6kl_rx(struct htc_target *target, struct htc_packet *packet)
                        return;
                }
        } else if (!is_broadcast_ether_addr(datap->h_dest)) {
-               vif->net_stats.multicast++;
+               vif->ndev->stats.multicast++;
        }
 
        ath6kl_deliver_frames_to_nw_stack(vif->ndev, skb);