diff options
Diffstat (limited to 'drivers/net/wireless/mwifiex/sta_cmd.c')
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_cmd.c | 77 |
1 files changed, 73 insertions, 4 deletions
diff --git a/drivers/net/wireless/mwifiex/sta_cmd.c b/drivers/net/wireless/mwifiex/sta_cmd.c index 8ece48580642..c0268b597748 100644 --- a/drivers/net/wireless/mwifiex/sta_cmd.c +++ b/drivers/net/wireless/mwifiex/sta_cmd.c | |||
@@ -707,8 +707,9 @@ mwifiex_cmd_802_11_key_material(struct mwifiex_private *priv, | |||
707 | if (priv->bss_type == MWIFIEX_BSS_TYPE_UAP) { | 707 | if (priv->bss_type == MWIFIEX_BSS_TYPE_UAP) { |
708 | tlv_mac = (void *)((u8 *)&key_material->key_param_set + | 708 | tlv_mac = (void *)((u8 *)&key_material->key_param_set + |
709 | key_param_len); | 709 | key_param_len); |
710 | tlv_mac->tlv.type = cpu_to_le16(TLV_TYPE_STA_MAC_ADDR); | 710 | tlv_mac->header.type = |
711 | tlv_mac->tlv.len = cpu_to_le16(ETH_ALEN); | 711 | cpu_to_le16(TLV_TYPE_STA_MAC_ADDR); |
712 | tlv_mac->header.len = cpu_to_le16(ETH_ALEN); | ||
712 | memcpy(tlv_mac->mac_addr, enc_key->mac_addr, ETH_ALEN); | 713 | memcpy(tlv_mac->mac_addr, enc_key->mac_addr, ETH_ALEN); |
713 | cmd_size = key_param_len + S_DS_GEN + | 714 | cmd_size = key_param_len + S_DS_GEN + |
714 | sizeof(key_material->action) + | 715 | sizeof(key_material->action) + |
@@ -1069,7 +1070,7 @@ mwifiex_cmd_append_rpn_expression(struct mwifiex_private *priv, | |||
1069 | int i, byte_len; | 1070 | int i, byte_len; |
1070 | u8 *stack_ptr = *buffer; | 1071 | u8 *stack_ptr = *buffer; |
1071 | 1072 | ||
1072 | for (i = 0; i < MWIFIEX_MAX_FILTERS; i++) { | 1073 | for (i = 0; i < MWIFIEX_MEF_MAX_FILTERS; i++) { |
1073 | filter = &mef_entry->filter[i]; | 1074 | filter = &mef_entry->filter[i]; |
1074 | if (!filter->filt_type) | 1075 | if (!filter->filt_type) |
1075 | break; | 1076 | break; |
@@ -1078,7 +1079,7 @@ mwifiex_cmd_append_rpn_expression(struct mwifiex_private *priv, | |||
1078 | *stack_ptr = TYPE_DNUM; | 1079 | *stack_ptr = TYPE_DNUM; |
1079 | stack_ptr += 1; | 1080 | stack_ptr += 1; |
1080 | 1081 | ||
1081 | byte_len = filter->byte_seq[MAX_BYTESEQ]; | 1082 | byte_len = filter->byte_seq[MWIFIEX_MEF_MAX_BYTESEQ]; |
1082 | memcpy(stack_ptr, filter->byte_seq, byte_len); | 1083 | memcpy(stack_ptr, filter->byte_seq, byte_len); |
1083 | stack_ptr += byte_len; | 1084 | stack_ptr += byte_len; |
1084 | *stack_ptr = byte_len; | 1085 | *stack_ptr = byte_len; |
@@ -1183,6 +1184,70 @@ static int mwifiex_cmd_cfg_data(struct mwifiex_private *priv, | |||
1183 | return 0; | 1184 | return 0; |
1184 | } | 1185 | } |
1185 | 1186 | ||
1187 | static int | ||
1188 | mwifiex_cmd_coalesce_cfg(struct mwifiex_private *priv, | ||
1189 | struct host_cmd_ds_command *cmd, | ||
1190 | u16 cmd_action, void *data_buf) | ||
1191 | { | ||
1192 | struct host_cmd_ds_coalesce_cfg *coalesce_cfg = | ||
1193 | &cmd->params.coalesce_cfg; | ||
1194 | struct mwifiex_ds_coalesce_cfg *cfg = data_buf; | ||
1195 | struct coalesce_filt_field_param *param; | ||
1196 | u16 cnt, idx, length; | ||
1197 | struct coalesce_receive_filt_rule *rule; | ||
1198 | |||
1199 | cmd->command = cpu_to_le16(HostCmd_CMD_COALESCE_CFG); | ||
1200 | cmd->size = cpu_to_le16(S_DS_GEN); | ||
1201 | |||
1202 | coalesce_cfg->action = cpu_to_le16(cmd_action); | ||
1203 | coalesce_cfg->num_of_rules = cpu_to_le16(cfg->num_of_rules); | ||
1204 | rule = coalesce_cfg->rule; | ||
1205 | |||
1206 | for (cnt = 0; cnt < cfg->num_of_rules; cnt++) { | ||
1207 | rule->header.type = cpu_to_le16(TLV_TYPE_COALESCE_RULE); | ||
1208 | rule->max_coalescing_delay = | ||
1209 | cpu_to_le16(cfg->rule[cnt].max_coalescing_delay); | ||
1210 | rule->pkt_type = cfg->rule[cnt].pkt_type; | ||
1211 | rule->num_of_fields = cfg->rule[cnt].num_of_fields; | ||
1212 | |||
1213 | length = 0; | ||
1214 | |||
1215 | param = rule->params; | ||
1216 | for (idx = 0; idx < cfg->rule[cnt].num_of_fields; idx++) { | ||
1217 | param->operation = cfg->rule[cnt].params[idx].operation; | ||
1218 | param->operand_len = | ||
1219 | cfg->rule[cnt].params[idx].operand_len; | ||
1220 | param->offset = | ||
1221 | cpu_to_le16(cfg->rule[cnt].params[idx].offset); | ||
1222 | memcpy(param->operand_byte_stream, | ||
1223 | cfg->rule[cnt].params[idx].operand_byte_stream, | ||
1224 | param->operand_len); | ||
1225 | |||
1226 | length += sizeof(struct coalesce_filt_field_param); | ||
1227 | |||
1228 | param++; | ||
1229 | } | ||
1230 | |||
1231 | /* Total rule length is sizeof max_coalescing_delay(u16), | ||
1232 | * num_of_fields(u8), pkt_type(u8) and total length of the all | ||
1233 | * params | ||
1234 | */ | ||
1235 | rule->header.len = cpu_to_le16(length + sizeof(u16) + | ||
1236 | sizeof(u8) + sizeof(u8)); | ||
1237 | |||
1238 | /* Add the rule length to the command size*/ | ||
1239 | le16_add_cpu(&cmd->size, le16_to_cpu(rule->header.len) + | ||
1240 | sizeof(struct mwifiex_ie_types_header)); | ||
1241 | |||
1242 | rule = (void *)((u8 *)rule->params + length); | ||
1243 | } | ||
1244 | |||
1245 | /* Add sizeof action, num_of_rules to total command length */ | ||
1246 | le16_add_cpu(&cmd->size, sizeof(u16) + sizeof(u16)); | ||
1247 | |||
1248 | return 0; | ||
1249 | } | ||
1250 | |||
1186 | /* | 1251 | /* |
1187 | * This function prepares the commands before sending them to the firmware. | 1252 | * This function prepares the commands before sending them to the firmware. |
1188 | * | 1253 | * |
@@ -1406,6 +1471,10 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no, | |||
1406 | case HostCmd_CMD_MEF_CFG: | 1471 | case HostCmd_CMD_MEF_CFG: |
1407 | ret = mwifiex_cmd_mef_cfg(priv, cmd_ptr, data_buf); | 1472 | ret = mwifiex_cmd_mef_cfg(priv, cmd_ptr, data_buf); |
1408 | break; | 1473 | break; |
1474 | case HostCmd_CMD_COALESCE_CFG: | ||
1475 | ret = mwifiex_cmd_coalesce_cfg(priv, cmd_ptr, cmd_action, | ||
1476 | data_buf); | ||
1477 | break; | ||
1409 | default: | 1478 | default: |
1410 | dev_err(priv->adapter->dev, | 1479 | dev_err(priv->adapter->dev, |
1411 | "PREP_CMD: unknown cmd- %#x\n", cmd_no); | 1480 | "PREP_CMD: unknown cmd- %#x\n", cmd_no); |