Skip to content

Commit

Permalink
iwlwifi: mvm: update iwl_wowlan_patterns_cmd
Browse files Browse the repository at this point in the history
We need to pass the station id to tell the firmware
on which station we want to configure the patterns.

Signed-off-by: Emmanuel Grumbach <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
Link: https://lore.kernel.org/r/iwlwifi.20210621103449.73eceb822890.I37347afbc01497a8a9e4d4afe4fa9a965abd31ac@changeid
Signed-off-by: Luca Coelho <[email protected]>
  • Loading branch information
egrumbach authored and lucacoelho committed Jun 22, 2021
1 parent b60bc71 commit 0b35991
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
14 changes: 12 additions & 2 deletions drivers/net/wireless/intel/iwlwifi/fw/api/d3.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,13 +318,23 @@ struct iwl_wowlan_patterns_cmd {
/**
* @n_patterns: number of patterns
*/
__le32 n_patterns;
u8 n_patterns;

/**
* @n_patterns: sta_id
*/
u8 sta_id;

/**
* @reserved: reserved for alignment
*/
__le16 reserved;

/**
* @patterns: the patterns, array length in @n_patterns
*/
struct iwl_wowlan_pattern_v2 patterns[];
} __packed; /* WOWLAN_PATTERN_ARRAY_API_S_VER_2 */
} __packed; /* WOWLAN_PATTERN_ARRAY_API_S_VER_3 */

enum iwl_wowlan_wakeup_filters {
IWL_WOWLAN_WAKEUP_MAGIC_PACKET = BIT(0),
Expand Down
13 changes: 10 additions & 3 deletions drivers/net/wireless/intel/iwlwifi/mvm/d3.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,26 +393,33 @@ static int iwl_mvm_send_patterns_v1(struct iwl_mvm *mvm,
}

static int iwl_mvm_send_patterns(struct iwl_mvm *mvm,
struct ieee80211_vif *vif,
struct cfg80211_wowlan *wowlan)
{
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
struct iwl_wowlan_patterns_cmd *pattern_cmd;
struct iwl_host_cmd cmd = {
.id = WOWLAN_PATTERNS,
.dataflags[0] = IWL_HCMD_DFL_NOCOPY,
};
int i, err;
int ver = iwl_fw_lookup_cmd_ver(mvm->fw, LONG_GROUP,
WOWLAN_PATTERNS,
IWL_FW_CMD_VER_UNKNOWN);

if (!wowlan->n_patterns)
return 0;

cmd.len[0] = sizeof(*pattern_cmd) +
wowlan->n_patterns * sizeof(struct iwl_wowlan_pattern_v2);

pattern_cmd = kmalloc(cmd.len[0], GFP_KERNEL);
pattern_cmd = kzalloc(cmd.len[0], GFP_KERNEL);
if (!pattern_cmd)
return -ENOMEM;

pattern_cmd->n_patterns = cpu_to_le32(wowlan->n_patterns);
pattern_cmd->n_patterns = wowlan->n_patterns;
if (ver >= 3)
pattern_cmd->sta_id = mvmvif->ap_sta_id;

for (i = 0; i < wowlan->n_patterns; i++) {
int mask_len = DIV_ROUND_UP(wowlan->patterns[i].pattern_len, 8);
Expand Down Expand Up @@ -887,7 +894,7 @@ iwl_mvm_wowlan_config(struct iwl_mvm *mvm,

if (fw_has_api(&mvm->fw->ucode_capa,
IWL_UCODE_TLV_API_WOWLAN_TCP_SYN_WAKE))
ret = iwl_mvm_send_patterns(mvm, wowlan);
ret = iwl_mvm_send_patterns(mvm, vif, wowlan);
else
ret = iwl_mvm_send_patterns_v1(mvm, wowlan);
if (ret)
Expand Down

0 comments on commit 0b35991

Please sign in to comment.