Skip to content

Commit 66fa242

Browse files
AyalaBkrlucacoelho
authored andcommitted
iwlwifi: fw api: support the new scan request FW API version
Remove fragmented_dwell_time and add num_of_fragments to support the new API version. Signed-off-by: Ayala Beker <[email protected]> Signed-off-by: Luca Coelho <[email protected]>
1 parent d270e7b commit 66fa242

File tree

4 files changed

+136
-54
lines changed

4 files changed

+136
-54
lines changed

drivers/net/wireless/intel/iwlwifi/fw/api/scan.h

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
3131
* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
3232
* Copyright(c) 2016 - 2017 Intel Deutschland GmbH
33+
* Copyright(c) 2018 Intel Corporation
3334
* All rights reserved.
3435
*
3536
* Redistribution and use in source and binary forms, with or without
@@ -589,6 +590,15 @@ enum iwl_umac_scan_general_flags {
589590
IWL_UMAC_SCAN_GEN_FLAGS_PROB_REQ_HIGH_TX_RATE = BIT(15),
590591
};
591592

593+
/**
594+
* enum iwl_umac_scan_general_flags2 - UMAC scan general flags #2
595+
* @IWL_UMAC_SCAN_GEN_FLAGS2_NOTIF_PER_CHNL: Whether to send a complete
596+
* notification per channel or not.
597+
*/
598+
enum iwl_umac_scan_general_flags2 {
599+
IWL_UMAC_SCAN_GEN_FLAGS2_NOTIF_PER_CHNL = BIT(0),
600+
};
601+
592602
/**
593603
* struct iwl_scan_channel_cfg_umac
594604
* @flags: bitmap - 0-19: directed scan to i'th ssid.
@@ -634,6 +644,18 @@ struct iwl_scan_req_umac_tail {
634644
struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
635645
} __packed;
636646

647+
/**
648+
* struct iwl_scan_umac_chan_param
649+
* @flags: channel flags &enum iwl_scan_channel_flags
650+
* @count: num of channels in scan request
651+
* @reserved: for future use and alignment
652+
*/
653+
struct iwl_scan_umac_chan_param {
654+
u8 flags;
655+
u8 count;
656+
__le16 reserved;
657+
} __packed; /*SCAN_CHANNEL_PARAMS_API_S_VER_1 */
658+
637659
/**
638660
* struct iwl_scan_req_umac
639661
* @flags: &enum iwl_umac_scan_flags
@@ -642,23 +664,24 @@ struct iwl_scan_req_umac_tail {
642664
* @general_flags: &enum iwl_umac_scan_general_flags
643665
* @scan_start_mac_id: report the scan start TSF time according to this mac TSF
644666
* @extended_dwell: dwell time for channels 1, 6 and 11
645-
* @active_dwell: dwell time for active scan
646-
* @passive_dwell: dwell time for passive scan
667+
* @active_dwell: dwell time for active scan per LMAC
668+
* @passive_dwell: dwell time for passive scan per LMAC
647669
* @fragmented_dwell: dwell time for fragmented passive scan
648670
* @adwell_default_n_aps: for adaptive dwell the default number of APs
649671
* per channel
650672
* @adwell_default_n_aps_social: for adaptive dwell the default
651673
* number of APs per social (1,6,11) channel
674+
* @general_flags2: &enum iwl_umac_scan_general_flags2
652675
* @adwell_max_budget: for adaptive dwell the maximal budget of TU to be added
653676
* to total scan time
654677
* @max_out_time: max out of serving channel time, per LMAC - for CDB there
655678
* are 2 LMACs
656679
* @suspend_time: max suspend time, per LMAC - for CDB there are 2 LMACs
657680
* @scan_priority: scan internal prioritization &enum iwl_scan_priority
658-
* @channel_flags: &enum iwl_scan_channel_flags
659-
* @n_channels: num of channels in scan request
681+
* @num_of_fragments: Number of fragments needed for full coverage per band.
682+
* Relevant only for fragmented scan.
683+
* @channel: &struct iwl_scan_umac_chan_param
660684
* @reserved: for future use and alignment
661-
* @reserved2: for future use and alignment
662685
* @reserved3: for future use and alignment
663686
* @data: &struct iwl_scan_channel_cfg_umac and
664687
* &struct iwl_scan_req_umac_tail
@@ -679,10 +702,7 @@ struct iwl_scan_req_umac {
679702
__le32 max_out_time;
680703
__le32 suspend_time;
681704
__le32 scan_priority;
682-
/* SCAN_CHANNEL_PARAMS_API_S_VER_1 */
683-
u8 channel_flags;
684-
u8 n_channels;
685-
__le16 reserved2;
705+
struct iwl_scan_umac_chan_param channel;
686706
u8 data[];
687707
} v1; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_1 */
688708
struct {
@@ -693,10 +713,7 @@ struct iwl_scan_req_umac {
693713
__le32 max_out_time[SCAN_TWO_LMACS];
694714
__le32 suspend_time[SCAN_TWO_LMACS];
695715
__le32 scan_priority;
696-
/* SCAN_CHANNEL_PARAMS_API_S_VER_1 */
697-
u8 channel_flags;
698-
u8 n_channels;
699-
__le16 reserved2;
716+
struct iwl_scan_umac_chan_param channel;
700717
u8 data[];
701718
} v6; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_6 */
702719
struct {
@@ -710,16 +727,30 @@ struct iwl_scan_req_umac {
710727
__le32 max_out_time[SCAN_TWO_LMACS];
711728
__le32 suspend_time[SCAN_TWO_LMACS];
712729
__le32 scan_priority;
713-
/* SCAN_CHANNEL_PARAMS_API_S_VER_1 */
714-
u8 channel_flags;
715-
u8 n_channels;
716-
__le16 reserved2;
730+
struct iwl_scan_umac_chan_param channel;
717731
u8 data[];
718732
} v7; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_7 */
733+
struct {
734+
u8 active_dwell[SCAN_TWO_LMACS];
735+
u8 reserved2;
736+
u8 adwell_default_n_aps;
737+
u8 adwell_default_n_aps_social;
738+
u8 general_flags2;
739+
__le16 adwell_max_budget;
740+
__le32 max_out_time[SCAN_TWO_LMACS];
741+
__le32 suspend_time[SCAN_TWO_LMACS];
742+
__le32 scan_priority;
743+
u8 passive_dwell[SCAN_TWO_LMACS];
744+
u8 num_of_fragments[SCAN_TWO_LMACS];
745+
struct iwl_scan_umac_chan_param channel;
746+
u8 data[];
747+
} v8; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_8 */
719748
};
720749
} __packed;
721750

722-
#define IWL_SCAN_REQ_UMAC_SIZE_V7 sizeof(struct iwl_scan_req_umac)
751+
#define IWL_SCAN_REQ_UMAC_SIZE_V8 sizeof(struct iwl_scan_req_umac)
752+
#define IWL_SCAN_REQ_UMAC_SIZE_V7 (sizeof(struct iwl_scan_req_umac) - \
753+
4 * sizeof(u8))
723754
#define IWL_SCAN_REQ_UMAC_SIZE_V6 (sizeof(struct iwl_scan_req_umac) - \
724755
2 * sizeof(u8) - sizeof(__le16))
725756
#define IWL_SCAN_REQ_UMAC_SIZE_V1 (sizeof(struct iwl_scan_req_umac) - \

drivers/net/wireless/intel/iwlwifi/fw/file.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ typedef unsigned int __bitwise iwl_ucode_tlv_api_t;
250250
* indicating low latency direction.
251251
* @IWL_UCODE_TLV_API_DEPRECATE_TTAK: RX status flag TTAK ok (bit 7) is
252252
* deprecated.
253+
* @IWL_UCODE_TLV_API_ADAPTIVE_DWELL_V2: This ucode supports version 8
254+
* of scan request: SCAN_REQUEST_CMD_UMAC_API_S_VER_8
253255
*
254256
* @NUM_IWL_UCODE_TLV_API: number of bits used
255257
*/
@@ -270,6 +272,7 @@ enum iwl_ucode_tlv_api {
270272
IWL_UCODE_TLV_API_NEW_RX_STATS = (__force iwl_ucode_tlv_api_t)35,
271273
IWL_UCODE_TLV_API_QUOTA_LOW_LATENCY = (__force iwl_ucode_tlv_api_t)38,
272274
IWL_UCODE_TLV_API_DEPRECATE_TTAK = (__force iwl_ucode_tlv_api_t)41,
275+
IWL_UCODE_TLV_API_ADAPTIVE_DWELL_V2 = (__force iwl_ucode_tlv_api_t)42,
273276

274277
NUM_IWL_UCODE_TLV_API
275278
#ifdef __CHECKER__

drivers/net/wireless/intel/iwlwifi/mvm/mvm.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,6 +1155,12 @@ static inline bool iwl_mvm_is_adaptive_dwell_supported(struct iwl_mvm *mvm)
11551155
IWL_UCODE_TLV_API_ADAPTIVE_DWELL);
11561156
}
11571157

1158+
static inline bool iwl_mvm_is_adaptive_dwell_v2_supported(struct iwl_mvm *mvm)
1159+
{
1160+
return fw_has_api(&mvm->fw->ucode_capa,
1161+
IWL_UCODE_TLV_API_ADAPTIVE_DWELL_V2);
1162+
}
1163+
11581164
static inline bool iwl_mvm_is_oce_supported(struct iwl_mvm *mvm)
11591165
{
11601166
/* OCE should never be enabled for LMAC scan FWs */

drivers/net/wireless/intel/iwlwifi/mvm/scan.c

Lines changed: 78 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
3636
* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
3737
* Copyright(c) 2016 - 2017 Intel Deutschland GmbH
38+
* Copyright(c) 2018 Intel Corporation
3839
* All rights reserved.
3940
*
4041
* Redistribution and use in source and binary forms, with or without
@@ -85,6 +86,8 @@ enum iwl_mvm_traffic_load {
8586
#define IWL_SCAN_DWELL_PASSIVE 110
8687
#define IWL_SCAN_DWELL_FRAGMENTED 44
8788
#define IWL_SCAN_DWELL_EXTENDED 90
89+
#define IWL_SCAN_NUM_OF_FRAGS 3
90+
8891

8992
/* adaptive dwell max budget time [TU] for full scan */
9093
#define IWL_SCAN_ADWELL_MAX_BUDGET_FULL_SCAN 300
@@ -143,6 +146,9 @@ static inline void *iwl_mvm_get_scan_req_umac_data(struct iwl_mvm *mvm)
143146
{
144147
struct iwl_scan_req_umac *cmd = mvm->scan_cmd;
145148

149+
if (iwl_mvm_is_adaptive_dwell_v2_supported(mvm))
150+
return (void *)&cmd->v8.data;
151+
146152
if (iwl_mvm_is_adaptive_dwell_supported(mvm))
147153
return (void *)&cmd->v7.data;
148154

@@ -152,6 +158,23 @@ static inline void *iwl_mvm_get_scan_req_umac_data(struct iwl_mvm *mvm)
152158
return (void *)&cmd->v1.data;
153159
}
154160

161+
static inline struct iwl_scan_umac_chan_param *
162+
iwl_mvm_get_scan_req_umac_channel(struct iwl_mvm *mvm)
163+
{
164+
struct iwl_scan_req_umac *cmd = mvm->scan_cmd;
165+
166+
if (iwl_mvm_is_adaptive_dwell_v2_supported(mvm))
167+
return &cmd->v8.channel;
168+
169+
if (iwl_mvm_is_adaptive_dwell_supported(mvm))
170+
return &cmd->v7.channel;
171+
172+
if (iwl_mvm_has_new_tx_api(mvm))
173+
return &cmd->v6.channel;
174+
175+
return &cmd->v1.channel;
176+
}
177+
155178
static u8 iwl_mvm_scan_rx_ant(struct iwl_mvm *mvm)
156179
{
157180
if (mvm->scan_rx_ant != ANT_NONE)
@@ -1122,17 +1145,16 @@ static void iwl_mvm_scan_umac_dwell(struct iwl_mvm *mvm,
11221145
struct iwl_scan_req_umac *cmd,
11231146
struct iwl_mvm_scan_params *params)
11241147
{
1125-
struct iwl_mvm_scan_timing_params *timing = &scan_timing[params->type];
1148+
struct iwl_mvm_scan_timing_params *timing, *hb_timing;
1149+
u8 active_dwell, passive_dwell;
1150+
1151+
timing = &scan_timing[params->type];
1152+
active_dwell = params->measurement_dwell ?
1153+
params->measurement_dwell : IWL_SCAN_DWELL_ACTIVE;
1154+
passive_dwell = params->measurement_dwell ?
1155+
params->measurement_dwell : IWL_SCAN_DWELL_PASSIVE;
11261156

11271157
if (iwl_mvm_is_adaptive_dwell_supported(mvm)) {
1128-
if (params->measurement_dwell) {
1129-
cmd->v7.active_dwell = params->measurement_dwell;
1130-
cmd->v7.passive_dwell = params->measurement_dwell;
1131-
} else {
1132-
cmd->v7.active_dwell = IWL_SCAN_DWELL_ACTIVE;
1133-
cmd->v7.passive_dwell = IWL_SCAN_DWELL_PASSIVE;
1134-
}
1135-
cmd->v7.fragmented_dwell = IWL_SCAN_DWELL_FRAGMENTED;
11361158
cmd->v7.adwell_default_n_aps_social =
11371159
IWL_SCAN_ADWELL_DEFAULT_N_APS_SOCIAL;
11381160
cmd->v7.adwell_default_n_aps =
@@ -1154,26 +1176,39 @@ static void iwl_mvm_scan_umac_dwell(struct iwl_mvm *mvm,
11541176
cpu_to_le32(timing->max_out_time);
11551177
cmd->v7.suspend_time[SCAN_LB_LMAC_IDX] =
11561178
cpu_to_le32(timing->suspend_time);
1179+
11571180
if (iwl_mvm_is_cdb_supported(mvm)) {
1158-
cmd->v6.max_out_time[SCAN_HB_LMAC_IDX] =
1159-
cpu_to_le32(timing->max_out_time);
1160-
cmd->v6.suspend_time[SCAN_HB_LMAC_IDX] =
1161-
cpu_to_le32(timing->suspend_time);
1181+
hb_timing = &scan_timing[params->type];
1182+
1183+
cmd->v7.max_out_time[SCAN_HB_LMAC_IDX] =
1184+
cpu_to_le32(hb_timing->max_out_time);
1185+
cmd->v7.suspend_time[SCAN_HB_LMAC_IDX] =
1186+
cpu_to_le32(hb_timing->suspend_time);
11621187
}
1163-
} else {
1164-
if (params->measurement_dwell) {
1165-
cmd->v1.active_dwell = params->measurement_dwell;
1166-
cmd->v1.passive_dwell = params->measurement_dwell;
1167-
cmd->v1.extended_dwell = params->measurement_dwell;
1188+
1189+
if (!iwl_mvm_is_adaptive_dwell_v2_supported(mvm)) {
1190+
cmd->v7.active_dwell = active_dwell;
1191+
cmd->v7.passive_dwell = passive_dwell;
1192+
cmd->v7.fragmented_dwell = IWL_SCAN_DWELL_FRAGMENTED;
11681193
} else {
1169-
cmd->v1.active_dwell = IWL_SCAN_DWELL_ACTIVE;
1170-
cmd->v1.passive_dwell = IWL_SCAN_DWELL_PASSIVE;
1171-
cmd->v1.extended_dwell = IWL_SCAN_DWELL_EXTENDED;
1194+
cmd->v8.active_dwell[SCAN_LB_LMAC_IDX] = active_dwell;
1195+
cmd->v8.passive_dwell[SCAN_LB_LMAC_IDX] = passive_dwell;
1196+
if (iwl_mvm_is_cdb_supported(mvm)) {
1197+
cmd->v8.active_dwell[SCAN_HB_LMAC_IDX] =
1198+
active_dwell;
1199+
cmd->v8.passive_dwell[SCAN_HB_LMAC_IDX] =
1200+
passive_dwell;
1201+
}
11721202
}
1203+
} else {
1204+
cmd->v1.extended_dwell = params->measurement_dwell ?
1205+
params->measurement_dwell : IWL_SCAN_DWELL_EXTENDED;
1206+
cmd->v1.active_dwell = active_dwell;
1207+
cmd->v1.passive_dwell = passive_dwell;
11731208
cmd->v1.fragmented_dwell = IWL_SCAN_DWELL_FRAGMENTED;
1209+
11741210
if (iwl_mvm_is_cdb_supported(mvm)) {
1175-
struct iwl_mvm_scan_timing_params *hb_timing =
1176-
&scan_timing[params->type];
1211+
hb_timing = &scan_timing[params->type];
11771212

11781213
cmd->v6.max_out_time[SCAN_HB_LMAC_IDX] =
11791214
cpu_to_le32(hb_timing->max_out_time);
@@ -1298,15 +1333,19 @@ static int iwl_mvm_scan_umac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
12981333
int type)
12991334
{
13001335
struct iwl_scan_req_umac *cmd = mvm->scan_cmd;
1336+
struct iwl_scan_umac_chan_param *chan_param;
13011337
void *cmd_data = iwl_mvm_get_scan_req_umac_data(mvm);
13021338
struct iwl_scan_req_umac_tail *sec_part = cmd_data +
13031339
sizeof(struct iwl_scan_channel_cfg_umac) *
13041340
mvm->fw->ucode_capa.n_scan_channels;
13051341
int uid, i;
13061342
u32 ssid_bitmap = 0;
13071343
u8 channel_flags = 0;
1344+
u16 gen_flags;
13081345
struct iwl_mvm_vif *scan_vif = iwl_mvm_vif_from_mac80211(vif);
13091346

1347+
chan_param = iwl_mvm_get_scan_req_umac_channel(mvm);
1348+
13101349
lockdep_assert_held(&mvm->mutex);
13111350

13121351
if (WARN_ON(params->n_scan_plans > IWL_MAX_SCHED_SCAN_PLANS))
@@ -1323,8 +1362,17 @@ static int iwl_mvm_scan_umac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
13231362
mvm->scan_uid_status[uid] = type;
13241363

13251364
cmd->uid = cpu_to_le32(uid);
1326-
cmd->general_flags = cpu_to_le16(iwl_mvm_scan_umac_flags(mvm, params,
1327-
vif));
1365+
gen_flags = iwl_mvm_scan_umac_flags(mvm, params, vif);
1366+
cmd->general_flags = cpu_to_le16(gen_flags);
1367+
if (iwl_mvm_is_adaptive_dwell_v2_supported(mvm)) {
1368+
if (gen_flags & IWL_UMAC_SCAN_GEN_FLAGS_FRAGMENTED)
1369+
cmd->v8.num_of_fragments[SCAN_LB_LMAC_IDX] =
1370+
IWL_SCAN_NUM_OF_FRAGS;
1371+
if (gen_flags & IWL_UMAC_SCAN_GEN_FLAGS_LMAC2_FRAGMENTED)
1372+
cmd->v8.num_of_fragments[SCAN_HB_LMAC_IDX] =
1373+
IWL_SCAN_NUM_OF_FRAGS;
1374+
}
1375+
13281376
cmd->scan_start_mac_id = scan_vif->id;
13291377

13301378
if (type == IWL_MVM_SCAN_SCHED || type == IWL_MVM_SCAN_NETDETECT)
@@ -1335,16 +1383,8 @@ static int iwl_mvm_scan_umac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
13351383
IWL_SCAN_CHANNEL_FLAG_EBS_ACCURATE |
13361384
IWL_SCAN_CHANNEL_FLAG_CACHE_ADD;
13371385

1338-
if (iwl_mvm_is_adaptive_dwell_supported(mvm)) {
1339-
cmd->v7.channel_flags = channel_flags;
1340-
cmd->v7.n_channels = params->n_channels;
1341-
} else if (iwl_mvm_has_new_tx_api(mvm)) {
1342-
cmd->v6.channel_flags = channel_flags;
1343-
cmd->v6.n_channels = params->n_channels;
1344-
} else {
1345-
cmd->v1.channel_flags = channel_flags;
1346-
cmd->v1.n_channels = params->n_channels;
1347-
}
1386+
chan_param->flags = channel_flags;
1387+
chan_param->count = params->n_channels;
13481388

13491389
iwl_scan_build_ssids(params, sec_part->direct_scan, &ssid_bitmap);
13501390

@@ -1783,7 +1823,9 @@ int iwl_mvm_scan_size(struct iwl_mvm *mvm)
17831823
{
17841824
int base_size = IWL_SCAN_REQ_UMAC_SIZE_V1;
17851825

1786-
if (iwl_mvm_is_adaptive_dwell_supported(mvm))
1826+
if (iwl_mvm_is_adaptive_dwell_v2_supported(mvm))
1827+
base_size = IWL_SCAN_REQ_UMAC_SIZE_V8;
1828+
else if (iwl_mvm_is_adaptive_dwell_supported(mvm))
17871829
base_size = IWL_SCAN_REQ_UMAC_SIZE_V7;
17881830
else if (iwl_mvm_has_new_tx_api(mvm))
17891831
base_size = IWL_SCAN_REQ_UMAC_SIZE_V6;

0 commit comments

Comments
 (0)