提交 b95907a7 编写于 作者: V Vasanthakumar Thiagarajan 提交者: Kalle Valo

ath6kl: Make net and target stats vif specific

Signed-off-by: NVasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: NKalle Valo <kvalo@qca.qualcomm.com>
上级 cf5333d7
...@@ -1414,7 +1414,7 @@ static int ath6kl_get_station(struct wiphy *wiphy, struct net_device *dev, ...@@ -1414,7 +1414,7 @@ static int ath6kl_get_station(struct wiphy *wiphy, struct net_device *dev,
if (down_interruptible(&ar->sem)) if (down_interruptible(&ar->sem))
return -EBUSY; return -EBUSY;
set_bit(STATS_UPDATE_PEND, &ar->flag); set_bit(STATS_UPDATE_PEND, &vif->flags);
ret = ath6kl_wmi_get_stats_cmd(ar->wmi); ret = ath6kl_wmi_get_stats_cmd(ar->wmi);
...@@ -1425,7 +1425,7 @@ static int ath6kl_get_station(struct wiphy *wiphy, struct net_device *dev, ...@@ -1425,7 +1425,7 @@ static int ath6kl_get_station(struct wiphy *wiphy, struct net_device *dev,
left = wait_event_interruptible_timeout(ar->event_wq, left = wait_event_interruptible_timeout(ar->event_wq,
!test_bit(STATS_UPDATE_PEND, !test_bit(STATS_UPDATE_PEND,
&ar->flag), &vif->flags),
WMI_TIMEOUT); WMI_TIMEOUT);
up(&ar->sem); up(&ar->sem);
...@@ -1435,24 +1435,24 @@ static int ath6kl_get_station(struct wiphy *wiphy, struct net_device *dev, ...@@ -1435,24 +1435,24 @@ static int ath6kl_get_station(struct wiphy *wiphy, struct net_device *dev,
else if (left < 0) else if (left < 0)
return left; return left;
if (ar->target_stats.rx_byte) { if (vif->target_stats.rx_byte) {
sinfo->rx_bytes = ar->target_stats.rx_byte; sinfo->rx_bytes = vif->target_stats.rx_byte;
sinfo->filled |= STATION_INFO_RX_BYTES; sinfo->filled |= STATION_INFO_RX_BYTES;
sinfo->rx_packets = ar->target_stats.rx_pkt; sinfo->rx_packets = vif->target_stats.rx_pkt;
sinfo->filled |= STATION_INFO_RX_PACKETS; sinfo->filled |= STATION_INFO_RX_PACKETS;
} }
if (ar->target_stats.tx_byte) { if (vif->target_stats.tx_byte) {
sinfo->tx_bytes = ar->target_stats.tx_byte; sinfo->tx_bytes = vif->target_stats.tx_byte;
sinfo->filled |= STATION_INFO_TX_BYTES; sinfo->filled |= STATION_INFO_TX_BYTES;
sinfo->tx_packets = ar->target_stats.tx_pkt; sinfo->tx_packets = vif->target_stats.tx_pkt;
sinfo->filled |= STATION_INFO_TX_PACKETS; sinfo->filled |= STATION_INFO_TX_PACKETS;
} }
sinfo->signal = ar->target_stats.cs_rssi; sinfo->signal = vif->target_stats.cs_rssi;
sinfo->filled |= STATION_INFO_SIGNAL; sinfo->filled |= STATION_INFO_SIGNAL;
rate = ar->target_stats.tx_ucast_rate; rate = vif->target_stats.tx_ucast_rate;
if (is_rate_legacy(rate)) { if (is_rate_legacy(rate)) {
sinfo->txrate.legacy = rate / 100; sinfo->txrate.legacy = rate / 100;
......
...@@ -391,6 +391,7 @@ enum ath6kl_vif_state { ...@@ -391,6 +391,7 @@ enum ath6kl_vif_state {
CLEAR_BSSFILTER_ON_BEACON, CLEAR_BSSFILTER_ON_BEACON,
DTIM_PERIOD_AVAIL, DTIM_PERIOD_AVAIL,
WLAN_ENABLED, WLAN_ENABLED,
STATS_UPDATE_PEND,
}; };
struct ath6kl_vif { struct ath6kl_vif {
...@@ -425,6 +426,8 @@ struct ath6kl_vif { ...@@ -425,6 +426,8 @@ struct ath6kl_vif {
u16 next_chan; u16 next_chan;
u16 assoc_bss_beacon_int; u16 assoc_bss_beacon_int;
u8 assoc_bss_dtim_period; u8 assoc_bss_dtim_period;
struct net_device_stats net_stats;
struct target_stats target_stats;
}; };
/* Flag info */ /* Flag info */
...@@ -435,7 +438,6 @@ enum ath6kl_dev_state { ...@@ -435,7 +438,6 @@ enum ath6kl_dev_state {
TESTMODE, TESTMODE,
DESTROY_IN_PROGRESS, DESTROY_IN_PROGRESS,
SKIP_SCAN, SKIP_SCAN,
STATS_UPDATE_PEND,
ROAM_TBL_PEND, ROAM_TBL_PEND,
}; };
...@@ -459,8 +461,6 @@ struct ath6kl { ...@@ -459,8 +461,6 @@ struct ath6kl {
struct ath6kl_version version; struct ath6kl_version version;
u32 target_type; u32 target_type;
u8 tx_pwr; u8 tx_pwr;
struct net_device_stats net_stats;
struct target_stats target_stats;
struct ath6kl_node_mapping node_map[MAX_NODE_NUM]; struct ath6kl_node_mapping node_map[MAX_NODE_NUM];
u8 ibss_ps_enable; u8 ibss_ps_enable;
u8 node_num; u8 node_num;
......
...@@ -397,7 +397,9 @@ static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf, ...@@ -397,7 +397,9 @@ static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct ath6kl *ar = file->private_data; struct ath6kl *ar = file->private_data;
struct target_stats *tgt_stats = &ar->target_stats; /* TODO: Findout vif */
struct ath6kl_vif *vif = ar->vif;
struct target_stats *tgt_stats = &vif->target_stats;
char *buf; char *buf;
unsigned int len = 0, buf_len = 1500; unsigned int len = 0, buf_len = 1500;
int i; int i;
...@@ -413,7 +415,7 @@ static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf, ...@@ -413,7 +415,7 @@ static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf,
return -EBUSY; return -EBUSY;
} }
set_bit(STATS_UPDATE_PEND, &ar->flag); set_bit(STATS_UPDATE_PEND, &vif->flags);
if (ath6kl_wmi_get_stats_cmd(ar->wmi)) { if (ath6kl_wmi_get_stats_cmd(ar->wmi)) {
up(&ar->sem); up(&ar->sem);
...@@ -423,7 +425,7 @@ static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf, ...@@ -423,7 +425,7 @@ static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf,
left = wait_event_interruptible_timeout(ar->event_wq, left = wait_event_interruptible_timeout(ar->event_wq,
!test_bit(STATS_UPDATE_PEND, !test_bit(STATS_UPDATE_PEND,
&ar->flag), WMI_TIMEOUT); &vif->flags), WMI_TIMEOUT);
up(&ar->sem); up(&ar->sem);
......
...@@ -1119,7 +1119,9 @@ static void ath6kl_update_target_stats(struct ath6kl *ar, u8 *ptr, u32 len) ...@@ -1119,7 +1119,9 @@ static void ath6kl_update_target_stats(struct ath6kl *ar, u8 *ptr, u32 len)
{ {
struct wmi_target_stats *tgt_stats = struct wmi_target_stats *tgt_stats =
(struct wmi_target_stats *) ptr; (struct wmi_target_stats *) ptr;
struct target_stats *stats = &ar->target_stats; /* TODO: Findout vif */
struct ath6kl_vif *vif = ar->vif;
struct target_stats *stats = &vif->target_stats;
struct tkip_ccmp_stats *ccmp_stats; struct tkip_ccmp_stats *ccmp_stats;
u8 ac; u8 ac;
...@@ -1215,8 +1217,8 @@ static void ath6kl_update_target_stats(struct ath6kl *ar, u8 *ptr, u32 len) ...@@ -1215,8 +1217,8 @@ static void ath6kl_update_target_stats(struct ath6kl *ar, u8 *ptr, u32 len)
stats->wow_evt_discarded += stats->wow_evt_discarded +=
le16_to_cpu(tgt_stats->wow_stats.wow_evt_discarded); le16_to_cpu(tgt_stats->wow_stats.wow_evt_discarded);
if (test_bit(STATS_UPDATE_PEND, &ar->flag)) { if (test_bit(STATS_UPDATE_PEND, &vif->flags)) {
clear_bit(STATS_UPDATE_PEND, &ar->flag); clear_bit(STATS_UPDATE_PEND, &vif->flags);
wake_up(&ar->event_wq); wake_up(&ar->event_wq);
} }
} }
...@@ -1483,9 +1485,9 @@ static int ath6kl_close(struct net_device *dev) ...@@ -1483,9 +1485,9 @@ static int ath6kl_close(struct net_device *dev)
static struct net_device_stats *ath6kl_get_stats(struct net_device *dev) static struct net_device_stats *ath6kl_get_stats(struct net_device *dev)
{ {
struct ath6kl *ar = ath6kl_priv(dev); struct ath6kl_vif *vif = netdev_priv(dev);
return &ar->net_stats; return &vif->net_stats;
} }
static struct net_device_ops ath6kl_netdev_ops = { static struct net_device_ops ath6kl_netdev_ops = {
......
...@@ -357,8 +357,8 @@ int ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev) ...@@ -357,8 +357,8 @@ int ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev)
fail_tx: fail_tx:
dev_kfree_skb(skb); dev_kfree_skb(skb);
ar->net_stats.tx_dropped++; vif->net_stats.tx_dropped++;
ar->net_stats.tx_aborted_errors++; vif->net_stats.tx_aborted_errors++;
return 0; return 0;
} }
...@@ -583,7 +583,7 @@ void ath6kl_tx_complete(void *context, struct list_head *packet_queue) ...@@ -583,7 +583,7 @@ void ath6kl_tx_complete(void *context, struct list_head *packet_queue)
/* a packet was flushed */ /* a packet was flushed */
flushing = true; flushing = true;
ar->net_stats.tx_errors++; vif->net_stats.tx_errors++;
if (status != -ENOSPC) if (status != -ENOSPC)
ath6kl_err("tx error, status: 0x%x\n", status); ath6kl_err("tx error, status: 0x%x\n", status);
...@@ -598,8 +598,8 @@ void ath6kl_tx_complete(void *context, struct list_head *packet_queue) ...@@ -598,8 +598,8 @@ void ath6kl_tx_complete(void *context, struct list_head *packet_queue)
eid, "OK"); eid, "OK");
flushing = false; flushing = false;
ar->net_stats.tx_packets++; vif->net_stats.tx_packets++;
ar->net_stats.tx_bytes += skb->len; vif->net_stats.tx_bytes += skb->len;
} }
ath6kl_tx_clear_node_map(ar, eid, map_no); ath6kl_tx_clear_node_map(ar, eid, map_no);
...@@ -1061,7 +1061,7 @@ void ath6kl_rx(struct htc_target *target, struct htc_packet *packet) ...@@ -1061,7 +1061,7 @@ void ath6kl_rx(struct htc_target *target, struct htc_packet *packet)
packet->act_len, status); packet->act_len, status);
if (status || !(skb->data + HTC_HDR_LENGTH)) { if (status || !(skb->data + HTC_HDR_LENGTH)) {
ar->net_stats.rx_errors++; vif->net_stats.rx_errors++;
dev_kfree_skb(skb); dev_kfree_skb(skb);
return; return;
} }
...@@ -1072,8 +1072,8 @@ void ath6kl_rx(struct htc_target *target, struct htc_packet *packet) ...@@ -1072,8 +1072,8 @@ void ath6kl_rx(struct htc_target *target, struct htc_packet *packet)
*/ */
spin_lock_bh(&ar->lock); spin_lock_bh(&ar->lock);
ar->net_stats.rx_packets++; vif->net_stats.rx_packets++;
ar->net_stats.rx_bytes += packet->act_len; vif->net_stats.rx_bytes += packet->act_len;
spin_unlock_bh(&ar->lock); spin_unlock_bh(&ar->lock);
...@@ -1111,8 +1111,8 @@ void ath6kl_rx(struct htc_target *target, struct htc_packet *packet) ...@@ -1111,8 +1111,8 @@ void ath6kl_rx(struct htc_target *target, struct htc_packet *packet)
((packet->act_len < min_hdr_len) || ((packet->act_len < min_hdr_len) ||
(packet->act_len > WMI_MAX_AMSDU_RX_DATA_FRAME_LENGTH))) { (packet->act_len > WMI_MAX_AMSDU_RX_DATA_FRAME_LENGTH))) {
ath6kl_info("frame len is too short or too long\n"); ath6kl_info("frame len is too short or too long\n");
ar->net_stats.rx_errors++; vif->net_stats.rx_errors++;
ar->net_stats.rx_length_errors++; vif->net_stats.rx_length_errors++;
dev_kfree_skb(skb); dev_kfree_skb(skb);
return; return;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册