aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Cahill <ben.m.cahill@intel.com>2007-11-28 22:10:11 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:05:34 -0500
commit529699815b79f15a6644786dc4d6e9dd5153a447 (patch)
tree434b6493483bc5cb8075cc8c1529e59b369a8ea8
parent2054a00bb83409345d14a944e25c15e6ea317651 (diff)
iwlwifi: add comments to Tx commands
Add comments to Tx commands Clean up unused definitions in iwl-3945-commands.h Signed-off-by: Ben Cahill <ben.m.cahill@intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-commands.h161
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-commands.h201
2 files changed, 267 insertions, 95 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-commands.h b/drivers/net/wireless/iwlwifi/iwl-3945-commands.h
index 4885971a1536..3cac2c8ccf60 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-commands.h
@@ -743,36 +743,86 @@ struct iwl4965_rx_mpdu_res_start {
743 * (5) 743 * (5)
744 * Tx Commands & Responses: 744 * Tx Commands & Responses:
745 * 745 *
746 * Driver must place each REPLY_TX command into one of the prioritized Tx
747 * queues in host DRAM, shared between driver and device. When the device's
748 * Tx scheduler and uCode are preparing to transmit, the device pulls the
749 * Tx command over the PCI bus via one of the device's Tx DMA channels,
750 * to fill an internal FIFO from which data will be transmitted.
751 *
752 * uCode handles all timing and protocol related to control frames
753 * (RTS/CTS/ACK), based on flags in the Tx command.
754 *
755 * uCode handles retrying Tx when an ACK is expected but not received.
756 * This includes trying lower data rates than the one requested in the Tx
757 * command, as set up by the REPLY_RATE_SCALE (for 3945) or
758 * REPLY_TX_LINK_QUALITY_CMD (4965).
759 *
760 * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD.
761 * This command must be executed after every RXON command, before Tx can occur.
746 *****************************************************************************/ 762 *****************************************************************************/
747 763
748/* Tx flags */ 764/* REPLY_TX Tx flags field */
765
766/* 1: Use Request-To-Send protocol before this frame.
767 * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK. */
749#define TX_CMD_FLG_RTS_MSK __constant_cpu_to_le32(1 << 1) 768#define TX_CMD_FLG_RTS_MSK __constant_cpu_to_le32(1 << 1)
769
770/* 1: Transmit Clear-To-Send to self before this frame.
771 * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames.
772 * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK. */
750#define TX_CMD_FLG_CTS_MSK __constant_cpu_to_le32(1 << 2) 773#define TX_CMD_FLG_CTS_MSK __constant_cpu_to_le32(1 << 2)
774
775/* 1: Expect ACK from receiving station
776 * 0: Don't expect ACK (MAC header's duration field s/b 0)
777 * Set this for unicast frames, but not broadcast/multicast. */
751#define TX_CMD_FLG_ACK_MSK __constant_cpu_to_le32(1 << 3) 778#define TX_CMD_FLG_ACK_MSK __constant_cpu_to_le32(1 << 3)
779
780/* 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD).
781 * Tx command's initial_rate_index indicates first rate to try;
782 * uCode walks through table for additional Tx attempts.
783 * 0: Use Tx rate/MCS from Tx command's rate_n_flags field.
784 * This rate will be used for all Tx attempts; it will not be scaled. */
752#define TX_CMD_FLG_STA_RATE_MSK __constant_cpu_to_le32(1 << 4) 785#define TX_CMD_FLG_STA_RATE_MSK __constant_cpu_to_le32(1 << 4)
786
787/* 1: Expect immediate block-ack.
788 * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */
753#define TX_CMD_FLG_IMM_BA_RSP_MASK __constant_cpu_to_le32(1 << 6) 789#define TX_CMD_FLG_IMM_BA_RSP_MASK __constant_cpu_to_le32(1 << 6)
790
791/* 1: Frame requires full Tx-Op protection.
792 * Set this if either RTS or CTS Tx Flag gets set. */
754#define TX_CMD_FLG_FULL_TXOP_PROT_MSK __constant_cpu_to_le32(1 << 7) 793#define TX_CMD_FLG_FULL_TXOP_PROT_MSK __constant_cpu_to_le32(1 << 7)
794
795/* Tx antenna selection field; used only for 3945, reserved (0) for 4965.
796 * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */
755#define TX_CMD_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0xf00) 797#define TX_CMD_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0xf00)
756#define TX_CMD_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8) 798#define TX_CMD_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8)
757#define TX_CMD_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9) 799#define TX_CMD_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9)
758 800
759/* ucode ignores BT priority for this frame */ 801/* 1: Ignore Bluetooth priority for this frame.
802 * 0: Delay Tx until Bluetooth device is done (normal usage). */
760#define TX_CMD_FLG_BT_DIS_MSK __constant_cpu_to_le32(1 << 12) 803#define TX_CMD_FLG_BT_DIS_MSK __constant_cpu_to_le32(1 << 12)
761 804
762/* ucode overrides sequence control */ 805/* 1: uCode overrides sequence control field in MAC header.
806 * 0: Driver provides sequence control field in MAC header.
807 * Set this for management frames, non-QOS data frames, non-unicast frames,
808 * and also in Tx command embedded in REPLY_SCAN_CMD for active scans. */
763#define TX_CMD_FLG_SEQ_CTL_MSK __constant_cpu_to_le32(1 << 13) 809#define TX_CMD_FLG_SEQ_CTL_MSK __constant_cpu_to_le32(1 << 13)
764 810
765/* signal that this frame is non-last MPDU */ 811/* 1: This frame is non-last MPDU; more fragments are coming.
812 * 0: Last fragment, or not using fragmentation. */
766#define TX_CMD_FLG_MORE_FRAG_MSK __constant_cpu_to_le32(1 << 14) 813#define TX_CMD_FLG_MORE_FRAG_MSK __constant_cpu_to_le32(1 << 14)
767 814
768/* calculate TSF in outgoing frame */ 815/* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame.
816 * 0: No TSF required in outgoing frame.
817 * Set this for transmitting beacons and probe responses. */
769#define TX_CMD_FLG_TSF_MSK __constant_cpu_to_le32(1 << 16) 818#define TX_CMD_FLG_TSF_MSK __constant_cpu_to_le32(1 << 16)
770 819
771/* activate TX calibration. */ 820/* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword
772#define TX_CMD_FLG_CALIB_MSK __constant_cpu_to_le32(1 << 17) 821 * alignment of frame's payload data field.
773 822 * 0: No pad
774/* signals that 2 bytes pad was inserted 823 * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4
775 after the MAC header */ 824 * field (but not both). Driver must align frame data (i.e. data following
825 * MAC header) to DWORD boundary. */
776#define TX_CMD_FLG_MH_PAD_MSK __constant_cpu_to_le32(1 << 20) 826#define TX_CMD_FLG_MH_PAD_MSK __constant_cpu_to_le32(1 << 20)
777 827
778/* HCCA-AP - disable duration overwriting. */ 828/* HCCA-AP - disable duration overwriting. */
@@ -789,23 +839,33 @@ struct iwl4965_rx_mpdu_res_start {
789#define TX_CMD_SEC_KEY128 0x08 839#define TX_CMD_SEC_KEY128 0x08
790 840
791/* 841/*
792 * TX command Frame life time
793 */
794
795struct iwl3945_dram_scratch {
796 u8 try_cnt;
797 u8 bt_kill_cnt;
798 __le16 reserved;
799} __attribute__ ((packed));
800
801/*
802 * REPLY_TX = 0x1c (command) 842 * REPLY_TX = 0x1c (command)
803 */ 843 */
804struct iwl3945_tx_cmd { 844struct iwl3945_tx_cmd {
845 /*
846 * MPDU byte count:
847 * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
848 * + 8 byte IV for CCM or TKIP (not used for WEP)
849 * + Data payload
850 * + 8-byte MIC (not used for CCM/WEP)
851 * NOTE: Does not include Tx command bytes, post-MAC pad bytes,
852 * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
853 * Range: 14-2342 bytes.
854 */
805 __le16 len; 855 __le16 len;
856
857 /*
858 * MPDU or MSDU byte count for next frame.
859 * Used for fragmentation and bursting, but not 11n aggregation.
860 * Same as "len", but for next frame. Set to 0 if not applicable.
861 */
806 __le16 next_frame_len; 862 __le16 next_frame_len;
807 __le32 tx_flags; 863
864 __le32 tx_flags; /* TX_CMD_FLG_* */
865
808 u8 rate; 866 u8 rate;
867
868 /* Index of recipient station in uCode's station table */
809 u8 sta_id; 869 u8 sta_id;
810 u8 tid_tspec; 870 u8 tid_tspec;
811 u8 sec_ctl; 871 u8 sec_ctl;
@@ -827,7 +887,17 @@ struct iwl3945_tx_cmd {
827 __le16 pm_frame_timeout; 887 __le16 pm_frame_timeout;
828 __le16 attempt_duration; 888 __le16 attempt_duration;
829 } timeout; 889 } timeout;
890
891 /*
892 * Duration of EDCA burst Tx Opportunity, in 32-usec units.
893 * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
894 */
830 __le16 driver_txop; 895 __le16 driver_txop;
896
897 /*
898 * MAC header goes here, followed by 2 bytes padding if MAC header
899 * length is 26 or 30 bytes, followed by payload data
900 */
831 u8 payload[0]; 901 u8 payload[0];
832 struct ieee80211_hdr hdr[0]; 902 struct ieee80211_hdr hdr[0];
833} __attribute__ ((packed)); 903} __attribute__ ((packed));
@@ -899,37 +969,6 @@ enum {
899 TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */ 969 TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */
900}; 970};
901 971
902/* *******************************
903 * TX aggregation state
904 ******************************* */
905
906enum {
907 AGG_TX_STATE_TRANSMITTED = 0x00,
908 AGG_TX_STATE_UNDERRUN_MSK = 0x01,
909 AGG_TX_STATE_BT_PRIO_MSK = 0x02,
910 AGG_TX_STATE_FEW_BYTES_MSK = 0x04,
911 AGG_TX_STATE_ABORT_MSK = 0x08,
912 AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10,
913 AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20,
914 AGG_TX_STATE_LAST_SENT_BT_KILL_MSK = 0x40,
915 AGG_TX_STATE_SCD_QUERY_MSK = 0x80,
916 AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100,
917 AGG_TX_STATE_RESPONSE_MSK = 0x1ff,
918 AGG_TX_STATE_DUMP_TX_MSK = 0x200,
919 AGG_TX_STATE_DELAY_TX_MSK = 0x400
920};
921
922#define AGG_TX_STATE_LAST_SENT_MSK \
923(AGG_TX_STATE_LAST_SENT_TTL_MSK | \
924 AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \
925 AGG_TX_STATE_LAST_SENT_BT_KILL_MSK)
926
927#define AGG_TX_STATE_TRY_CNT_POS 12
928#define AGG_TX_STATE_TRY_CNT_MSK 0xf000
929
930#define AGG_TX_STATE_SEQ_NUM_POS 16
931#define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000
932
933/* 972/*
934 * REPLY_TX = 0x1c (response) 973 * REPLY_TX = 0x1c (response)
935 */ 974 */
@@ -939,23 +978,7 @@ struct iwl3945_tx_resp {
939 u8 bt_kill_count; 978 u8 bt_kill_count;
940 u8 rate; 979 u8 rate;
941 __le32 wireless_media_time; 980 __le32 wireless_media_time;
942 __le32 status; /* TX status (for aggregation status of 1st frame) */ 981 __le32 status; /* TX status */
943} __attribute__ ((packed));
944
945/*
946 * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command)
947 */
948struct iwl3945_compressed_ba_resp {
949 __le32 sta_addr_lo32;
950 __le16 sta_addr_hi16;
951 __le16 reserved;
952 u8 sta_id;
953 u8 tid;
954 __le16 ba_seq_ctl;
955 __le32 ba_bitmap0;
956 __le32 ba_bitmap1;
957 __le16 scd_flow;
958 __le16 scd_ssn;
959} __attribute__ ((packed)); 982} __attribute__ ((packed));
960 983
961/* 984/*
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-commands.h b/drivers/net/wireless/iwlwifi/iwl-4965-commands.h
index 44addea5062b..cbe91dbe760c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-commands.h
@@ -937,8 +937,8 @@ struct iwl4965_rx_phy_res {
937 __le16 channel; /* channel number */ 937 __le16 channel; /* channel number */
938 __le16 non_cfg_phy[RX_RES_PHY_CNT]; /* upto 14 phy entries */ 938 __le16 non_cfg_phy[RX_RES_PHY_CNT]; /* upto 14 phy entries */
939 __le32 reserved2; 939 __le32 reserved2;
940 __le32 rate_n_flags; 940 __le32 rate_n_flags; /* RATE_MCS_* */
941 __le16 byte_count; /* frame's byte-count */ 941 __le16 byte_count; /* frame's byte-count */
942 __le16 reserved3; 942 __le16 reserved3;
943} __attribute__ ((packed)); 943} __attribute__ ((packed));
944 944
@@ -952,41 +952,96 @@ struct iwl4965_rx_mpdu_res_start {
952 * (5) 952 * (5)
953 * Tx Commands & Responses: 953 * Tx Commands & Responses:
954 * 954 *
955 * Driver must place each REPLY_TX command into one of the prioritized Tx
956 * queues in host DRAM, shared between driver and device (see comments for
957 * SCD registers and Tx/Rx Queues). When the device's Tx scheduler and uCode
958 * are preparing to transmit, the device pulls the Tx command over the PCI
959 * bus via one of the device's Tx DMA channels, to fill an internal FIFO
960 * from which data will be transmitted.
961 *
962 * uCode handles all timing and protocol related to control frames
963 * (RTS/CTS/ACK), based on flags in the Tx command. uCode and Tx scheduler
964 * handle reception of block-acks; uCode updates the host driver via
965 * REPLY_COMPRESSED_BA (4965).
966 *
967 * uCode handles retrying Tx when an ACK is expected but not received.
968 * This includes trying lower data rates than the one requested in the Tx
969 * command, as set up by the REPLY_RATE_SCALE (for 3945) or
970 * REPLY_TX_LINK_QUALITY_CMD (4965).
971 *
972 * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD.
973 * This command must be executed after every RXON command, before Tx can occur.
955 *****************************************************************************/ 974 *****************************************************************************/
956 975
957/* Tx flags */ 976/* REPLY_TX Tx flags field */
977
978/* 1: Use Request-To-Send protocol before this frame.
979 * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK. */
958#define TX_CMD_FLG_RTS_MSK __constant_cpu_to_le32(1 << 1) 980#define TX_CMD_FLG_RTS_MSK __constant_cpu_to_le32(1 << 1)
981
982/* 1: Transmit Clear-To-Send to self before this frame.
983 * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames.
984 * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK. */
959#define TX_CMD_FLG_CTS_MSK __constant_cpu_to_le32(1 << 2) 985#define TX_CMD_FLG_CTS_MSK __constant_cpu_to_le32(1 << 2)
986
987/* 1: Expect ACK from receiving station
988 * 0: Don't expect ACK (MAC header's duration field s/b 0)
989 * Set this for unicast frames, but not broadcast/multicast. */
960#define TX_CMD_FLG_ACK_MSK __constant_cpu_to_le32(1 << 3) 990#define TX_CMD_FLG_ACK_MSK __constant_cpu_to_le32(1 << 3)
991
992/* For 4965:
993 * 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD).
994 * Tx command's initial_rate_index indicates first rate to try;
995 * uCode walks through table for additional Tx attempts.
996 * 0: Use Tx rate/MCS from Tx command's rate_n_flags field.
997 * This rate will be used for all Tx attempts; it will not be scaled. */
961#define TX_CMD_FLG_STA_RATE_MSK __constant_cpu_to_le32(1 << 4) 998#define TX_CMD_FLG_STA_RATE_MSK __constant_cpu_to_le32(1 << 4)
999
1000/* 1: Expect immediate block-ack.
1001 * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */
962#define TX_CMD_FLG_IMM_BA_RSP_MASK __constant_cpu_to_le32(1 << 6) 1002#define TX_CMD_FLG_IMM_BA_RSP_MASK __constant_cpu_to_le32(1 << 6)
1003
1004/* 1: Frame requires full Tx-Op protection.
1005 * Set this if either RTS or CTS Tx Flag gets set. */
963#define TX_CMD_FLG_FULL_TXOP_PROT_MSK __constant_cpu_to_le32(1 << 7) 1006#define TX_CMD_FLG_FULL_TXOP_PROT_MSK __constant_cpu_to_le32(1 << 7)
1007
1008/* Tx antenna selection field; used only for 3945, reserved (0) for 4965.
1009 * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */
964#define TX_CMD_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0xf00) 1010#define TX_CMD_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0xf00)
965#define TX_CMD_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8) 1011#define TX_CMD_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8)
966#define TX_CMD_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9) 1012#define TX_CMD_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9)
967 1013
968/* ucode ignores BT priority for this frame */ 1014/* 1: Ignore Bluetooth priority for this frame.
1015 * 0: Delay Tx until Bluetooth device is done (normal usage). */
969#define TX_CMD_FLG_BT_DIS_MSK __constant_cpu_to_le32(1 << 12) 1016#define TX_CMD_FLG_BT_DIS_MSK __constant_cpu_to_le32(1 << 12)
970 1017
971/* ucode overrides sequence control */ 1018/* 1: uCode overrides sequence control field in MAC header.
1019 * 0: Driver provides sequence control field in MAC header.
1020 * Set this for management frames, non-QOS data frames, non-unicast frames,
1021 * and also in Tx command embedded in REPLY_SCAN_CMD for active scans. */
972#define TX_CMD_FLG_SEQ_CTL_MSK __constant_cpu_to_le32(1 << 13) 1022#define TX_CMD_FLG_SEQ_CTL_MSK __constant_cpu_to_le32(1 << 13)
973 1023
974/* signal that this frame is non-last MPDU */ 1024/* 1: This frame is non-last MPDU; more fragments are coming.
1025 * 0: Last fragment, or not using fragmentation. */
975#define TX_CMD_FLG_MORE_FRAG_MSK __constant_cpu_to_le32(1 << 14) 1026#define TX_CMD_FLG_MORE_FRAG_MSK __constant_cpu_to_le32(1 << 14)
976 1027
977/* calculate TSF in outgoing frame */ 1028/* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame.
1029 * 0: No TSF required in outgoing frame.
1030 * Set this for transmitting beacons and probe responses. */
978#define TX_CMD_FLG_TSF_MSK __constant_cpu_to_le32(1 << 16) 1031#define TX_CMD_FLG_TSF_MSK __constant_cpu_to_le32(1 << 16)
979 1032
980/* activate TX calibration. */ 1033/* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword
981#define TX_CMD_FLG_CALIB_MSK __constant_cpu_to_le32(1 << 17) 1034 * alignment of frame's payload data field.
982 1035 * 0: No pad
983/* signals that 2 bytes pad was inserted 1036 * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4
984 after the MAC header */ 1037 * field (but not both). Driver must align frame data (i.e. data following
1038 * MAC header) to DWORD boundary. */
985#define TX_CMD_FLG_MH_PAD_MSK __constant_cpu_to_le32(1 << 20) 1039#define TX_CMD_FLG_MH_PAD_MSK __constant_cpu_to_le32(1 << 20)
986 1040
987/* HCCA-AP - disable duration overwriting. */ 1041/* HCCA-AP - disable duration overwriting. */
988#define TX_CMD_FLG_DUR_MSK __constant_cpu_to_le32(1 << 25) 1042#define TX_CMD_FLG_DUR_MSK __constant_cpu_to_le32(1 << 25)
989 1043
1044
990/* 1045/*
991 * TX command security control 1046 * TX command security control
992 */ 1047 */
@@ -998,12 +1053,13 @@ struct iwl4965_rx_mpdu_res_start {
998#define TX_CMD_SEC_KEY128 0x08 1053#define TX_CMD_SEC_KEY128 0x08
999 1054
1000/* 1055/*
1001 * TX command Frame life time 1056 * 4965 uCode updates these Tx attempt count values in host DRAM.
1057 * Used for managing Tx retries when expecting block-acks.
1058 * Driver should set these fields to 0.
1002 */ 1059 */
1003
1004struct iwl4965_dram_scratch { 1060struct iwl4965_dram_scratch {
1005 u8 try_cnt; 1061 u8 try_cnt; /* Tx attempts */
1006 u8 bt_kill_cnt; 1062 u8 bt_kill_cnt; /* Tx attempts blocked by Bluetooth device */
1007 __le16 reserved; 1063 __le16 reserved;
1008} __attribute__ ((packed)); 1064} __attribute__ ((packed));
1009 1065
@@ -1011,13 +1067,47 @@ struct iwl4965_dram_scratch {
1011 * REPLY_TX = 0x1c (command) 1067 * REPLY_TX = 0x1c (command)
1012 */ 1068 */
1013struct iwl4965_tx_cmd { 1069struct iwl4965_tx_cmd {
1070 /*
1071 * MPDU byte count:
1072 * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
1073 * + 8 byte IV for CCM or TKIP (not used for WEP)
1074 * + Data payload
1075 * + 8-byte MIC (not used for CCM/WEP)
1076 * NOTE: Does not include Tx command bytes, post-MAC pad bytes,
1077 * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
1078 * Range: 14-2342 bytes.
1079 */
1014 __le16 len; 1080 __le16 len;
1081
1082 /*
1083 * MPDU or MSDU byte count for next frame.
1084 * Used for fragmentation and bursting, but not 11n aggregation.
1085 * Same as "len", but for next frame. Set to 0 if not applicable.
1086 */
1015 __le16 next_frame_len; 1087 __le16 next_frame_len;
1016 __le32 tx_flags; 1088
1089 __le32 tx_flags; /* TX_CMD_FLG_* */
1090
1091 /* 4965's uCode may modify this field of the Tx command (in host DRAM!).
1092 * Driver must also set dram_lsb_ptr and dram_msb_ptr in this cmd. */
1017 struct iwl4965_dram_scratch scratch; 1093 struct iwl4965_dram_scratch scratch;
1018 __le32 rate_n_flags; 1094
1095 /* Rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is cleared. */
1096 __le32 rate_n_flags; /* RATE_MCS_* */
1097
1098 /* Index of destination station in uCode's station table */
1019 u8 sta_id; 1099 u8 sta_id;
1020 u8 sec_ctl; 1100
1101 /* Type of security encryption: CCM or TKIP */
1102 u8 sec_ctl; /* TX_CMD_SEC_* */
1103
1104 /*
1105 * Index into rate table (see REPLY_TX_LINK_QUALITY_CMD) for initial
1106 * Tx attempt, if TX_CMD_FLG_STA_RATE_MSK is set. Normally "0" for
1107 * data frames, this field may be used to selectively reduce initial
1108 * rate (via non-0 value) for special frames (e.g. management), while
1109 * still supporting rate scaling for all frames.
1110 */
1021 u8 initial_rate_index; 1111 u8 initial_rate_index;
1022 u8 reserved; 1112 u8 reserved;
1023 u8 key[16]; 1113 u8 key[16];
@@ -1027,8 +1117,12 @@ struct iwl4965_tx_cmd {
1027 __le32 life_time; 1117 __le32 life_time;
1028 __le32 attempt; 1118 __le32 attempt;
1029 } stop_time; 1119 } stop_time;
1120
1121 /* Host DRAM physical address pointer to "scratch" in this command.
1122 * Must be dword aligned. "0" in dram_lsb_ptr disables usage. */
1030 __le32 dram_lsb_ptr; 1123 __le32 dram_lsb_ptr;
1031 u8 dram_msb_ptr; 1124 u8 dram_msb_ptr;
1125
1032 u8 rts_retry_limit; /*byte 50 */ 1126 u8 rts_retry_limit; /*byte 50 */
1033 u8 data_retry_limit; /*byte 51 */ 1127 u8 data_retry_limit; /*byte 51 */
1034 u8 tid_tspec; 1128 u8 tid_tspec;
@@ -1036,7 +1130,17 @@ struct iwl4965_tx_cmd {
1036 __le16 pm_frame_timeout; 1130 __le16 pm_frame_timeout;
1037 __le16 attempt_duration; 1131 __le16 attempt_duration;
1038 } timeout; 1132 } timeout;
1133
1134 /*
1135 * Duration of EDCA burst Tx Opportunity, in 32-usec units.
1136 * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
1137 */
1039 __le16 driver_txop; 1138 __le16 driver_txop;
1139
1140 /*
1141 * MAC header goes here, followed by 2 bytes padding if MAC header
1142 * length is 26 or 30 bytes, followed by payload data
1143 */
1040 u8 payload[0]; 1144 u8 payload[0];
1041 struct ieee80211_hdr hdr[0]; 1145 struct ieee80211_hdr hdr[0];
1042} __attribute__ ((packed)); 1146} __attribute__ ((packed));
@@ -1109,7 +1213,7 @@ enum {
1109}; 1213};
1110 1214
1111/* ******************************* 1215/* *******************************
1112 * TX aggregation state 1216 * TX aggregation status
1113 ******************************* */ 1217 ******************************* */
1114 1218
1115enum { 1219enum {
@@ -1133,35 +1237,80 @@ enum {
1133 AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \ 1237 AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \
1134 AGG_TX_STATE_LAST_SENT_BT_KILL_MSK) 1238 AGG_TX_STATE_LAST_SENT_BT_KILL_MSK)
1135 1239
1240/* # tx attempts for first frame in aggregation */
1136#define AGG_TX_STATE_TRY_CNT_POS 12 1241#define AGG_TX_STATE_TRY_CNT_POS 12
1137#define AGG_TX_STATE_TRY_CNT_MSK 0xf000 1242#define AGG_TX_STATE_TRY_CNT_MSK 0xf000
1138 1243
1244/* Command ID and sequence number of Tx command for this frame */
1139#define AGG_TX_STATE_SEQ_NUM_POS 16 1245#define AGG_TX_STATE_SEQ_NUM_POS 16
1140#define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000 1246#define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000
1141 1247
1142/* 1248/*
1143 * REPLY_TX = 0x1c (response) 1249 * REPLY_TX = 0x1c (response)
1250 *
1251 * This response may be in one of two slightly different formats, indicated
1252 * by the frame_count field:
1253 *
1254 * 1) No aggregation (frame_count == 1). This reports Tx results for
1255 * a single frame. Multiple attempts, at various bit rates, may have
1256 * been made for this frame.
1257 *
1258 * 2) Aggregation (frame_count > 1). This reports Tx results for
1259 * 2 or more frames that used block-acknowledge. All frames were
1260 * transmitted at same rate. Rate scaling may have been used if first
1261 * frame in this new agg block failed in previous agg block(s).
1262 *
1263 * Note that, for aggregation, ACK (block-ack) status is not delivered here;
1264 * block-ack has not been received by the time the 4965 records this status.
1265 * This status relates to reasons the tx might have been blocked or aborted
1266 * within the sending station (this 4965), rather than whether it was
1267 * received successfully by the destination station.
1144 */ 1268 */
1145struct iwl4965_tx_resp { 1269struct iwl4965_tx_resp {
1146 u8 frame_count; /* 1 no aggregation, >1 aggregation */ 1270 u8 frame_count; /* 1 no aggregation, >1 aggregation */
1147 u8 bt_kill_count; 1271 u8 bt_kill_count; /* # blocked by bluetooth (unused for agg) */
1148 u8 failure_rts; 1272 u8 failure_rts; /* # failures due to unsuccessful RTS */
1149 u8 failure_frame; 1273 u8 failure_frame; /* # failures due to no ACK (unused for agg) */
1150 __le32 rate_n_flags; 1274
1151 __le16 wireless_media_time; 1275 /* For non-agg: Rate at which frame was successful.
1276 * For agg: Rate at which all frames were transmitted. */
1277 __le32 rate_n_flags; /* RATE_MCS_* */
1278
1279 /* For non-agg: RTS + CTS + frame tx attempts time + ACK.
1280 * For agg: RTS + CTS + aggregation tx time + block-ack time. */
1281 __le16 wireless_media_time; /* uSecs */
1282
1152 __le16 reserved; 1283 __le16 reserved;
1153 __le32 pa_power1; 1284 __le32 pa_power1; /* RF power amplifier measurement (not used) */
1154 __le32 pa_power2; 1285 __le32 pa_power2;
1286
1287 /*
1288 * For non-agg: frame status TX_STATUS_*
1289 * For agg: status of 1st frame, AGG_TX_STATE_*; other frame status
1290 * fields follow this one, up to frame_count.
1291 * Bit fields:
1292 * 11- 0: AGG_TX_STATE_* status code
1293 * 15-12: Retry count for 1st frame in aggregation (retries
1294 * occur if tx failed for this frame when it was a
1295 * member of a previous aggregation block). If rate
1296 * scaling is used, retry count indicates the rate
1297 * table entry used for all frames in the new agg.
1298 * 31-16: Sequence # for this frame's Tx cmd (not SSN!)
1299 */
1155 __le32 status; /* TX status (for aggregation status of 1st frame) */ 1300 __le32 status; /* TX status (for aggregation status of 1st frame) */
1156} __attribute__ ((packed)); 1301} __attribute__ ((packed));
1157 1302
1158/* 1303/*
1159 * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command) 1304 * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command)
1305 *
1306 * Reports Block-Acknowledge from recipient station
1160 */ 1307 */
1161struct iwl4965_compressed_ba_resp { 1308struct iwl4965_compressed_ba_resp {
1162 __le32 sta_addr_lo32; 1309 __le32 sta_addr_lo32;
1163 __le16 sta_addr_hi16; 1310 __le16 sta_addr_hi16;
1164 __le16 reserved; 1311 __le16 reserved;
1312
1313 /* Index of recipient (BA-sending) station in uCode's station table */
1165 u8 sta_id; 1314 u8 sta_id;
1166 u8 tid; 1315 u8 tid;
1167 __le16 ba_seq_ctl; 1316 __le16 ba_seq_ctl;