iwlwifi: mvm: refactor beacon template command code

We currently support 3 different versions of the beacon template
command and the code does some tricks in order to reuse what is
possible across these versions.  But it is a bit complicated to read
and soon there will be one more variation that the driver needs
implement, which would complicate it even further.

Refactor the way we send beacon template commands, which increases the
code size a bit, but makes it much easier to read.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
This commit is contained in:
Luca Coelho
2017-06-01 15:19:45 +03:00
szülő 57bcc81d52
commit 09856582bf
2 fájl változott, egészen pontosan 138 új sor hozzáadva és 95 régi sor törölve

Fájl megtekintése

@@ -766,7 +766,8 @@ struct iwl_mac_beacon_cmd_v6 {
} __packed; /* BEACON_TEMPLATE_CMD_API_S_VER_6 */
/**
* struct iwl_mac_beacon_cmd_data - data of beacon template with offloaded CSA
* struct iwl_mac_beacon_cmd_v7 - beacon template command with offloaded CSA
* @tx: the tx commands associated with the beacon frame
* @template_id: currently equal to the mac context id of the coresponding
* mac.
* @tim_idx: the offset of the tim IE in the beacon
@@ -775,23 +776,14 @@ struct iwl_mac_beacon_cmd_v6 {
* @csa_offset: offset to the CSA IE if present
* @frame: the template of the beacon frame
*/
struct iwl_mac_beacon_cmd_data {
struct iwl_mac_beacon_cmd_v7 {
struct iwl_tx_cmd tx;
__le32 template_id;
__le32 tim_idx;
__le32 tim_size;
__le32 ecsa_offset;
__le32 csa_offset;
struct ieee80211_hdr frame[0];
};
/**
* struct iwl_mac_beacon_cmd_v7 - beacon template command with offloaded CSA
* @tx: the tx commands associated with the beacon frame
* @data: see &iwl_mac_beacon_cmd_data
*/
struct iwl_mac_beacon_cmd_v7 {
struct iwl_tx_cmd tx;
struct iwl_mac_beacon_cmd_data data;
} __packed; /* BEACON_TEMPLATE_CMD_API_S_VER_7 */
/**
@@ -799,13 +791,24 @@ struct iwl_mac_beacon_cmd_v7 {
* @byte_cnt: byte count of the beacon frame
* @flags: for future use
* @reserved: reserved
* @data: see &iwl_mac_beacon_cmd_data
* @template_id: currently equal to the mac context id of the coresponding
* mac.
* @tim_idx: the offset of the tim IE in the beacon
* @tim_size: the length of the tim IE
* @ecsa_offset: offset to the ECSA IE if present
* @csa_offset: offset to the CSA IE if present
* @frame: the template of the beacon frame
*/
struct iwl_mac_beacon_cmd {
__le16 byte_cnt;
__le16 flags;
__le64 reserved;
struct iwl_mac_beacon_cmd_data data;
__le32 template_id;
__le32 tim_idx;
__le32 tim_size;
__le32 ecsa_offset;
__le32 csa_offset;
struct ieee80211_hdr frame[0];
} __packed; /* BEACON_TEMPLATE_CMD_API_S_VER_8 */
struct iwl_beacon_notif {