Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 290639
b: refs/heads/master
c: 288f995
h: refs/heads/master
i:
  290637: 5ac6478
  290635: 724a2bf
  290631: 00e40b5
  290623: 4fd50bf
v: v3
  • Loading branch information
Stanislaw Gruszka authored and John W. Linville committed Feb 22, 2012
1 parent 97bb3c1 commit d01f9b8
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 424 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c936355172a7e4aeadbbdcaae48f10e31f604899
refs/heads/master: 288f9954132cd64f60fbb8051e31d62d8c35875f
12 changes: 2 additions & 10 deletions trunk/drivers/net/wireless/iwlegacy/3945-mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,6 @@ il3945_tx_skb(struct il_priv *il, struct sk_buff *skb)
len = (u16) skb->len;
tx_cmd->len = cpu_to_le16(len);

il_dbg_log_tx_data_frame(il, len, hdr);
il_update_stats(il, true, fc, len);
tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK;
tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK;
Expand Down Expand Up @@ -3098,11 +3097,9 @@ il3945_store_debug_level(struct device *d, struct device_attribute *attr,
ret = strict_strtoul(buf, 0, &val);
if (ret)
IL_INFO("%s is not in hex or decimal form.\n", buf);
else {
else
il->debug_level = val;
if (il_alloc_traffic_mem(il))
IL_ERR("Not enough memory to generate traffic log\n");
}

return strnlen(buf, count);
}

Expand Down Expand Up @@ -3625,9 +3622,6 @@ il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
il->pci_dev = pdev;
il->inta_mask = CSR_INI_SET_MASK;

if (il_alloc_traffic_mem(il))
IL_ERR("Not enough memory to generate traffic log\n");

/***************************
* 2. Initializing PCI bus
* *************************/
Expand Down Expand Up @@ -3790,7 +3784,6 @@ il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_set_drvdata(pdev, NULL);
pci_disable_device(pdev);
out_ieee80211_free_hw:
il_free_traffic_mem(il);
ieee80211_free_hw(il->hw);
out:
return err;
Expand Down Expand Up @@ -3858,7 +3851,6 @@ il3945_pci_remove(struct pci_dev *pdev)
* until now... */
destroy_workqueue(il->workqueue);
il->workqueue = NULL;
il_free_traffic_mem(il);

free_irq(pdev->irq, il);
pci_disable_msi(pdev);
Expand Down
2 changes: 0 additions & 2 deletions trunk/drivers/net/wireless/iwlegacy/3945.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,8 +573,6 @@ il3945_hdl_rx(struct il_priv *il, struct il_rx_buf *rxb)
network_packet ? '*' : ' ', le16_to_cpu(rx_hdr->channel),
rx_status.signal, rx_status.signal, rx_status.rate_idx);

il_dbg_log_rx_data_frame(il, le16_to_cpu(rx_hdr->len), header);

if (network_packet) {
il->_3945.last_beacon_time =
le32_to_cpu(rx_end->beacon_timestamp);
Expand Down
13 changes: 2 additions & 11 deletions trunk/drivers/net/wireless/iwlegacy/4965-mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,6 @@ il4965_hdl_rx(struct il_priv *il, struct il_rx_buf *rxb)
/* Find max signal strength (dBm) among 3 antenna/receiver chains */
rx_status.signal = il4965_calc_rssi(il, phy_res);

il_dbg_log_rx_data_frame(il, len, header);
D_STATS("Rssi %d, TSF %llu\n", rx_status.signal,
(unsigned long long)rx_status.mactime);

Expand Down Expand Up @@ -1781,7 +1780,6 @@ il4965_tx_skb(struct il_priv *il, struct sk_buff *skb)

/* TODO need this for burst mode later on */
il4965_tx_cmd_build_basic(il, skb, tx_cmd, info, hdr, sta_id);
il_dbg_log_tx_data_frame(il, len, hdr);

il4965_tx_cmd_build_rate(il, tx_cmd, info, fc);

Expand Down Expand Up @@ -4541,11 +4539,9 @@ il4965_store_debug_level(struct device *d, struct device_attribute *attr,
ret = strict_strtoul(buf, 0, &val);
if (ret)
IL_ERR("%s is not in hex or decimal form.\n", buf);
else {
else
il->debug_level = val;
if (il_alloc_traffic_mem(il))
IL_ERR("Not enough memory to generate traffic log\n");
}

return strnlen(buf, count);
}

Expand Down Expand Up @@ -6483,9 +6479,6 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
il->pci_dev = pdev;
il->inta_mask = CSR_INI_SET_MASK;

if (il_alloc_traffic_mem(il))
IL_ERR("Not enough memory to generate traffic log\n");

/**************************
* 2. Initializing PCI bus
**************************/
Expand Down Expand Up @@ -6663,7 +6656,6 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
out_pci_disable_device:
pci_disable_device(pdev);
out_ieee80211_free_hw:
il_free_traffic_mem(il);
ieee80211_free_hw(il->hw);
out:
return err;
Expand Down Expand Up @@ -6734,7 +6726,6 @@ il4965_pci_remove(struct pci_dev *pdev)
* until now... */
destroy_workqueue(il->workqueue);
il->workqueue = NULL;
il_free_traffic_mem(il);

free_irq(il->pci_dev->irq, il);
pci_disable_msi(il->pci_dev);
Expand Down
247 changes: 0 additions & 247 deletions trunk/drivers/net/wireless/iwlegacy/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -4574,253 +4574,6 @@ il_txq_mem(struct il_priv *il)
}
EXPORT_SYMBOL(il_txq_mem);

#ifdef CONFIG_IWLEGACY_DEBUGFS

#define IL_TRAFFIC_DUMP_SIZE (IL_TRAFFIC_ENTRY_SIZE * IL_TRAFFIC_ENTRIES)

void
il_reset_traffic_log(struct il_priv *il)
{
il->tx_traffic_idx = 0;
il->rx_traffic_idx = 0;
if (il->tx_traffic)
memset(il->tx_traffic, 0, IL_TRAFFIC_DUMP_SIZE);
if (il->rx_traffic)
memset(il->rx_traffic, 0, IL_TRAFFIC_DUMP_SIZE);
}

int
il_alloc_traffic_mem(struct il_priv *il)
{
u32 traffic_size = IL_TRAFFIC_DUMP_SIZE;

if (il_debug_level & IL_DL_TX) {
if (!il->tx_traffic) {
il->tx_traffic = kzalloc(traffic_size, GFP_KERNEL);
if (!il->tx_traffic)
return -ENOMEM;
}
}
if (il_debug_level & IL_DL_RX) {
if (!il->rx_traffic) {
il->rx_traffic = kzalloc(traffic_size, GFP_KERNEL);
if (!il->rx_traffic)
return -ENOMEM;
}
}
il_reset_traffic_log(il);
return 0;
}
EXPORT_SYMBOL(il_alloc_traffic_mem);

void
il_free_traffic_mem(struct il_priv *il)
{
kfree(il->tx_traffic);
il->tx_traffic = NULL;

kfree(il->rx_traffic);
il->rx_traffic = NULL;
}
EXPORT_SYMBOL(il_free_traffic_mem);

void
il_dbg_log_tx_data_frame(struct il_priv *il, u16 length,
struct ieee80211_hdr *header)
{
__le16 fc;
u16 len;

if (likely(!(il_debug_level & IL_DL_TX)))
return;

if (!il->tx_traffic)
return;

fc = header->frame_control;
if (ieee80211_is_data(fc)) {
len =
(length >
IL_TRAFFIC_ENTRY_SIZE) ? IL_TRAFFIC_ENTRY_SIZE : length;
memcpy((il->tx_traffic +
(il->tx_traffic_idx * IL_TRAFFIC_ENTRY_SIZE)), header,
len);
il->tx_traffic_idx =
(il->tx_traffic_idx + 1) % IL_TRAFFIC_ENTRIES;
}
}
EXPORT_SYMBOL(il_dbg_log_tx_data_frame);

void
il_dbg_log_rx_data_frame(struct il_priv *il, u16 length,
struct ieee80211_hdr *header)
{
__le16 fc;
u16 len;

if (likely(!(il_debug_level & IL_DL_RX)))
return;

if (!il->rx_traffic)
return;

fc = header->frame_control;
if (ieee80211_is_data(fc)) {
len =
(length >
IL_TRAFFIC_ENTRY_SIZE) ? IL_TRAFFIC_ENTRY_SIZE : length;
memcpy((il->rx_traffic +
(il->rx_traffic_idx * IL_TRAFFIC_ENTRY_SIZE)), header,
len);
il->rx_traffic_idx =
(il->rx_traffic_idx + 1) % IL_TRAFFIC_ENTRIES;
}
}
EXPORT_SYMBOL(il_dbg_log_rx_data_frame);

const char *
il_get_mgmt_string(int cmd)
{
switch (cmd) {
IL_CMD(MANAGEMENT_ASSOC_REQ);
IL_CMD(MANAGEMENT_ASSOC_RESP);
IL_CMD(MANAGEMENT_REASSOC_REQ);
IL_CMD(MANAGEMENT_REASSOC_RESP);
IL_CMD(MANAGEMENT_PROBE_REQ);
IL_CMD(MANAGEMENT_PROBE_RESP);
IL_CMD(MANAGEMENT_BEACON);
IL_CMD(MANAGEMENT_ATIM);
IL_CMD(MANAGEMENT_DISASSOC);
IL_CMD(MANAGEMENT_AUTH);
IL_CMD(MANAGEMENT_DEAUTH);
IL_CMD(MANAGEMENT_ACTION);
default:
return "UNKNOWN";

}
}

const char *
il_get_ctrl_string(int cmd)
{
switch (cmd) {
IL_CMD(CONTROL_BACK_REQ);
IL_CMD(CONTROL_BACK);
IL_CMD(CONTROL_PSPOLL);
IL_CMD(CONTROL_RTS);
IL_CMD(CONTROL_CTS);
IL_CMD(CONTROL_ACK);
IL_CMD(CONTROL_CFEND);
IL_CMD(CONTROL_CFENDACK);
default:
return "UNKNOWN";

}
}

void
il_clear_traffic_stats(struct il_priv *il)
{
memset(&il->tx_stats, 0, sizeof(struct traffic_stats));
memset(&il->rx_stats, 0, sizeof(struct traffic_stats));
}

/*
* if CONFIG_IWLEGACY_DEBUGFS defined,
* il_update_stats function will
* record all the MGMT, CTRL and DATA pkt for both TX and Rx pass
* Use debugFs to display the rx/rx_stats
* if CONFIG_IWLEGACY_DEBUGFS not being defined, then no MGMT and CTRL
* information will be recorded, but DATA pkt still will be recorded
* for the reason of il_led.c need to control the led blinking based on
* number of tx and rx data.
*
*/
void
il_update_stats(struct il_priv *il, bool is_tx, __le16 fc, u16 len)
{
struct traffic_stats *stats;

if (is_tx)
stats = &il->tx_stats;
else
stats = &il->rx_stats;

if (ieee80211_is_mgmt(fc)) {
switch (fc & cpu_to_le16(IEEE80211_FCTL_STYPE)) {
case cpu_to_le16(IEEE80211_STYPE_ASSOC_REQ):
stats->mgmt[MANAGEMENT_ASSOC_REQ]++;
break;
case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP):
stats->mgmt[MANAGEMENT_ASSOC_RESP]++;
break;
case cpu_to_le16(IEEE80211_STYPE_REASSOC_REQ):
stats->mgmt[MANAGEMENT_REASSOC_REQ]++;
break;
case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP):
stats->mgmt[MANAGEMENT_REASSOC_RESP]++;
break;
case cpu_to_le16(IEEE80211_STYPE_PROBE_REQ):
stats->mgmt[MANAGEMENT_PROBE_REQ]++;
break;
case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP):
stats->mgmt[MANAGEMENT_PROBE_RESP]++;
break;
case cpu_to_le16(IEEE80211_STYPE_BEACON):
stats->mgmt[MANAGEMENT_BEACON]++;
break;
case cpu_to_le16(IEEE80211_STYPE_ATIM):
stats->mgmt[MANAGEMENT_ATIM]++;
break;
case cpu_to_le16(IEEE80211_STYPE_DISASSOC):
stats->mgmt[MANAGEMENT_DISASSOC]++;
break;
case cpu_to_le16(IEEE80211_STYPE_AUTH):
stats->mgmt[MANAGEMENT_AUTH]++;
break;
case cpu_to_le16(IEEE80211_STYPE_DEAUTH):
stats->mgmt[MANAGEMENT_DEAUTH]++;
break;
case cpu_to_le16(IEEE80211_STYPE_ACTION):
stats->mgmt[MANAGEMENT_ACTION]++;
break;
}
} else if (ieee80211_is_ctl(fc)) {
switch (fc & cpu_to_le16(IEEE80211_FCTL_STYPE)) {
case cpu_to_le16(IEEE80211_STYPE_BACK_REQ):
stats->ctrl[CONTROL_BACK_REQ]++;
break;
case cpu_to_le16(IEEE80211_STYPE_BACK):
stats->ctrl[CONTROL_BACK]++;
break;
case cpu_to_le16(IEEE80211_STYPE_PSPOLL):
stats->ctrl[CONTROL_PSPOLL]++;
break;
case cpu_to_le16(IEEE80211_STYPE_RTS):
stats->ctrl[CONTROL_RTS]++;
break;
case cpu_to_le16(IEEE80211_STYPE_CTS):
stats->ctrl[CONTROL_CTS]++;
break;
case cpu_to_le16(IEEE80211_STYPE_ACK):
stats->ctrl[CONTROL_ACK]++;
break;
case cpu_to_le16(IEEE80211_STYPE_CFEND):
stats->ctrl[CONTROL_CFEND]++;
break;
case cpu_to_le16(IEEE80211_STYPE_CFENDACK):
stats->ctrl[CONTROL_CFENDACK]++;
break;
}
} else {
/* data */
stats->data_cnt++;
stats->data_bytes += len;
}
}
EXPORT_SYMBOL(il_update_stats);
#endif

int
il_force_reset(struct il_priv *il, bool external)
{
Expand Down
Loading

0 comments on commit d01f9b8

Please sign in to comment.