diff options
author | Harvey Harrison <harvey.harrison@gmail.com> | 2008-06-11 17:21:56 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-06-14 12:18:12 -0400 |
commit | fd7c8a40b2a63863f749e4d17f0d94d2e5ab1331 (patch) | |
tree | 098e07d68b4d1e7a6c02750db480204c0dd469d5 /drivers/net/wireless/iwlwifi/iwl-3945.c | |
parent | e36cfdc9b17fa64245ee6206287e5120e59bbfca (diff) |
mac80211: add helpers for frame control testing
A few general categories:
1) ieee80211_has_* tests if particular fctl bits are set, the helpers are de
in the same order as the fctl defines:
A combined _has_a4 was also added to test when both FROMDS and TODS are set.
2) ieee80211_is_* is meant to test whether the frame control is of a certain
ftype - data, mgmt, ctl, and two special helpers _is_data_qos, _is_data_pres
which also test a subset of the stype space.
When testing for a particular stype applicable only to one ftype, functions
like ieee80211_is_ack have been added. Note that the ftype is also being
checked in these helpers. They have been added for all mgmt and ctl stypes
in the same order as the STYPE defines.
3) ieee80211_get_* is meant to take a struct ieee80211_hdr * and returns a
pointer to somewhere in the struct, see get_SA, get_DA, get_qos_ctl.
The intel wireless drivers had helpers that used this namespace, convert the
all to use the new helpers and remove the byteshifting as they were defined
in cpu-order rather than little-endian.
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-3945.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 0ba6889dfd41..63f20370032d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -388,7 +388,7 @@ static void iwl3945_dbg_report_frame(struct iwl3945_priv *priv, | |||
388 | u32 print_dump = 0; /* set to 1 to dump all frames' contents */ | 388 | u32 print_dump = 0; /* set to 1 to dump all frames' contents */ |
389 | u32 hundred = 0; | 389 | u32 hundred = 0; |
390 | u32 dataframe = 0; | 390 | u32 dataframe = 0; |
391 | u16 fc; | 391 | __le16 fc; |
392 | u16 seq_ctl; | 392 | u16 seq_ctl; |
393 | u16 channel; | 393 | u16 channel; |
394 | u16 phy_flags; | 394 | u16 phy_flags; |
@@ -407,7 +407,7 @@ static void iwl3945_dbg_report_frame(struct iwl3945_priv *priv, | |||
407 | u8 *data = IWL_RX_DATA(pkt); | 407 | u8 *data = IWL_RX_DATA(pkt); |
408 | 408 | ||
409 | /* MAC header */ | 409 | /* MAC header */ |
410 | fc = le16_to_cpu(header->frame_control); | 410 | fc = header->frame_control; |
411 | seq_ctl = le16_to_cpu(header->seq_ctrl); | 411 | seq_ctl = le16_to_cpu(header->seq_ctrl); |
412 | 412 | ||
413 | /* metadata */ | 413 | /* metadata */ |
@@ -431,8 +431,8 @@ static void iwl3945_dbg_report_frame(struct iwl3945_priv *priv, | |||
431 | 431 | ||
432 | /* if data frame is to us and all is good, | 432 | /* if data frame is to us and all is good, |
433 | * (optionally) print summary for only 1 out of every 100 */ | 433 | * (optionally) print summary for only 1 out of every 100 */ |
434 | if (to_us && (fc & ~IEEE80211_FCTL_PROTECTED) == | 434 | if (to_us && (fc & ~cpu_to_le16(IEEE80211_FCTL_PROTECTED)) == |
435 | (IEEE80211_FCTL_FROMDS | IEEE80211_FTYPE_DATA)) { | 435 | cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FTYPE_DATA)) { |
436 | dataframe = 1; | 436 | dataframe = 1; |
437 | if (!group100) | 437 | if (!group100) |
438 | print_summary = 1; /* print each frame */ | 438 | print_summary = 1; /* print each frame */ |
@@ -455,13 +455,13 @@ static void iwl3945_dbg_report_frame(struct iwl3945_priv *priv, | |||
455 | 455 | ||
456 | if (hundred) | 456 | if (hundred) |
457 | title = "100Frames"; | 457 | title = "100Frames"; |
458 | else if (fc & IEEE80211_FCTL_RETRY) | 458 | else if (ieee80211_has_retry(fc)) |
459 | title = "Retry"; | 459 | title = "Retry"; |
460 | else if (ieee80211_is_assoc_response(fc)) | 460 | else if (ieee80211_is_assoc_resp(fc)) |
461 | title = "AscRsp"; | 461 | title = "AscRsp"; |
462 | else if (ieee80211_is_reassoc_response(fc)) | 462 | else if (ieee80211_is_reassoc_resp(fc)) |
463 | title = "RasRsp"; | 463 | title = "RasRsp"; |
464 | else if (ieee80211_is_probe_response(fc)) { | 464 | else if (ieee80211_is_probe_resp(fc)) { |
465 | title = "PrbRsp"; | 465 | title = "PrbRsp"; |
466 | print_dump = 1; /* dump frame contents */ | 466 | print_dump = 1; /* dump frame contents */ |
467 | } else if (ieee80211_is_beacon(fc)) { | 467 | } else if (ieee80211_is_beacon(fc)) { |
@@ -490,14 +490,14 @@ static void iwl3945_dbg_report_frame(struct iwl3945_priv *priv, | |||
490 | if (dataframe) | 490 | if (dataframe) |
491 | IWL_DEBUG_RX("%s: mhd=0x%04x, dst=0x%02x, " | 491 | IWL_DEBUG_RX("%s: mhd=0x%04x, dst=0x%02x, " |
492 | "len=%u, rssi=%d, chnl=%d, rate=%u, \n", | 492 | "len=%u, rssi=%d, chnl=%d, rate=%u, \n", |
493 | title, fc, header->addr1[5], | 493 | title, le16_to_cpu(fc), header->addr1[5], |
494 | length, rssi, channel, rate); | 494 | length, rssi, channel, rate); |
495 | else { | 495 | else { |
496 | /* src/dst addresses assume managed mode */ | 496 | /* src/dst addresses assume managed mode */ |
497 | IWL_DEBUG_RX("%s: 0x%04x, dst=0x%02x, " | 497 | IWL_DEBUG_RX("%s: 0x%04x, dst=0x%02x, " |
498 | "src=0x%02x, rssi=%u, tim=%lu usec, " | 498 | "src=0x%02x, rssi=%u, tim=%lu usec, " |
499 | "phy=0x%02x, chnl=%d\n", | 499 | "phy=0x%02x, chnl=%d\n", |
500 | title, fc, header->addr1[5], | 500 | title, le16_to_cpu(fc), header->addr1[5], |
501 | header->addr3[5], rssi, | 501 | header->addr3[5], rssi, |
502 | tsf_low - priv->scan_start_tsf, | 502 | tsf_low - priv->scan_start_tsf, |
503 | phy_flags, channel); | 503 | phy_flags, channel); |
@@ -971,7 +971,7 @@ void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv, | |||
971 | u8 rts_retry_limit; | 971 | u8 rts_retry_limit; |
972 | u8 data_retry_limit; | 972 | u8 data_retry_limit; |
973 | __le32 tx_flags; | 973 | __le32 tx_flags; |
974 | u16 fc = le16_to_cpu(hdr->frame_control); | 974 | __le16 fc = hdr->frame_control; |
975 | 975 | ||
976 | rate = iwl3945_rates[rate_index].plcp; | 976 | rate = iwl3945_rates[rate_index].plcp; |
977 | tx_flags = cmd->cmd.tx.tx_flags; | 977 | tx_flags = cmd->cmd.tx.tx_flags; |
@@ -996,7 +996,7 @@ void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv, | |||
996 | else | 996 | else |
997 | rts_retry_limit = 7; | 997 | rts_retry_limit = 7; |
998 | 998 | ||
999 | if (ieee80211_is_probe_response(fc)) { | 999 | if (ieee80211_is_probe_resp(fc)) { |
1000 | data_retry_limit = 3; | 1000 | data_retry_limit = 3; |
1001 | if (data_retry_limit < rts_retry_limit) | 1001 | if (data_retry_limit < rts_retry_limit) |
1002 | rts_retry_limit = data_retry_limit; | 1002 | rts_retry_limit = data_retry_limit; |
@@ -1006,12 +1006,12 @@ void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv, | |||
1006 | if (priv->data_retry_limit != -1) | 1006 | if (priv->data_retry_limit != -1) |
1007 | data_retry_limit = priv->data_retry_limit; | 1007 | data_retry_limit = priv->data_retry_limit; |
1008 | 1008 | ||
1009 | if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) { | 1009 | if (ieee80211_is_mgmt(fc)) { |
1010 | switch (fc & IEEE80211_FCTL_STYPE) { | 1010 | switch (fc & cpu_to_le16(IEEE80211_FCTL_STYPE)) { |
1011 | case IEEE80211_STYPE_AUTH: | 1011 | case cpu_to_le16(IEEE80211_STYPE_AUTH): |
1012 | case IEEE80211_STYPE_DEAUTH: | 1012 | case cpu_to_le16(IEEE80211_STYPE_DEAUTH): |
1013 | case IEEE80211_STYPE_ASSOC_REQ: | 1013 | case cpu_to_le16(IEEE80211_STYPE_ASSOC_REQ): |
1014 | case IEEE80211_STYPE_REASSOC_REQ: | 1014 | case cpu_to_le16(IEEE80211_STYPE_REASSOC_REQ): |
1015 | if (tx_flags & TX_CMD_FLG_RTS_MSK) { | 1015 | if (tx_flags & TX_CMD_FLG_RTS_MSK) { |
1016 | tx_flags &= ~TX_CMD_FLG_RTS_MSK; | 1016 | tx_flags &= ~TX_CMD_FLG_RTS_MSK; |
1017 | tx_flags |= TX_CMD_FLG_CTS_MSK; | 1017 | tx_flags |= TX_CMD_FLG_CTS_MSK; |