static void slsi_mlme_nan_enable_fapi_data(struct sk_buff *req, struct slsi_hal_nan_enable_req *hal_req)
{
- u8 nan_config_fields_header[] = {0xdd, 0x00, 0x00, 0x16, 0x32, 0x0b, 0x01};
- u8 *header_ptr;
- u16 attribute;
- u8 band_usage = BIT(0) | BIT(1);
- u8 scan_param[] = {0, 0, 0};
- int len = 0;
-
- header_ptr = fapi_append_data(req, nan_config_fields_header, sizeof(nan_config_fields_header));
- len += sizeof(nan_config_fields_header);
-
- if (hal_req->config_2dot4g_beacons && !hal_req->beacon_2dot4g_val)
- band_usage &= ~BIT(0);
- if (hal_req->config_2dot4g_sdf && !hal_req->sdf_2dot4g_val)
- band_usage &= ~BIT(1);
- if (hal_req->config_5g_beacons && hal_req->beacon_5g_val)
- band_usage |= BIT(2);
- if (hal_req->config_5g_sdf && hal_req->sdf_5g_val)
- band_usage |= BIT(3);
-
- attribute = SLSI_FAPI_NAN_CONFIG_PARAM_BAND_USAGE;
- SLSI_FAPI_NAN_ATTRIBUTE_PUT_U8(req, attribute, band_usage);
- attribute = SLSI_FAPI_NAN_CONFIG_PARAM_MASTER_PREFERENCE;
- SLSI_FAPI_NAN_ATTRIBUTE_PUT_U16(req, attribute, hal_req->master_pref);
- len += 11; /* 5 for band_usage, 6 for master preference */
-
- if (hal_req->config_sid_beacon) {
- attribute = SLSI_FAPI_NAN_CONFIG_PARAM_SID_BEACON;
- SLSI_FAPI_NAN_ATTRIBUTE_PUT_U8(req, attribute, hal_req->sid_beacon_val);
- len += 5;
- }
-
- if (hal_req->config_2dot4g_rssi_close) {
- attribute = SLSI_FAPI_NAN_CONFIG_PARAM_2_4_RSSI_CLOSE;
- SLSI_FAPI_NAN_ATTRIBUTE_PUT_U8(req, attribute, hal_req->rssi_close_2dot4g_val);
- len += 5;
- }
-
- if (hal_req->config_2dot4g_rssi_middle) {
- attribute = SLSI_FAPI_NAN_CONFIG_PARAM_2_4_RSSI_MIDDLE;
- SLSI_FAPI_NAN_ATTRIBUTE_PUT_U8(req, attribute, hal_req->rssi_middle_2dot4g_val);
- len += 5;
- }
-
- if (hal_req->config_2dot4g_rssi_proximity) {
- attribute = SLSI_FAPI_NAN_CONFIG_PARAM_2_4_RSSI_PROXIMITY;
- SLSI_FAPI_NAN_ATTRIBUTE_PUT_U8(req, attribute, hal_req->rssi_proximity_2dot4g_val);
- len += 5;
- }
-
- if (hal_req->config_5g_rssi_close) {
- attribute = SLSI_FAPI_NAN_CONFIG_PARAM_5_RSSI_CLOSE;
- SLSI_FAPI_NAN_ATTRIBUTE_PUT_U8(req, attribute, hal_req->rssi_close_5g_val);
- len += 5;
- }
-
- if (hal_req->config_5g_rssi_middle) {
- attribute = SLSI_FAPI_NAN_CONFIG_PARAM_5_RSSI_MIDDLE;
- SLSI_FAPI_NAN_ATTRIBUTE_PUT_U8(req, attribute, hal_req->rssi_middle_5g_val);
- len += 5;
- }
-
- if (hal_req->config_5g_rssi_close_proximity) {
- attribute = SLSI_FAPI_NAN_CONFIG_PARAM_5_RSSI_PROXIMITY;
- SLSI_FAPI_NAN_ATTRIBUTE_PUT_U8(req, attribute, hal_req->rssi_close_proximity_5g_val);
- len += 5;
- }
-
- if (hal_req->config_hop_count_limit) {
- attribute = SLSI_FAPI_NAN_CONFIG_PARAM_HOP_COUNT_LIMIT;
- SLSI_FAPI_NAN_ATTRIBUTE_PUT_U8(req, attribute, hal_req->hop_count_limit_val);
- len += 5;
- }
-
- if (hal_req->config_rssi_window_size) {
- attribute = SLSI_FAPI_NAN_CONFIG_PARAM_RSSI_WINDOW_SIZE;
- SLSI_FAPI_NAN_ATTRIBUTE_PUT_U8(req, attribute, hal_req->rssi_window_size_val);
- len += 5;
- }
-
- if (hal_req->config_scan_params) {
- attribute = SLSI_FAPI_NAN_CONFIG_PARAM_SCAN_PARAMETER_2_4;
- scan_param[0] = hal_req->scan_params_val.dwell_time[0];
- scan_param[1] = hal_req->scan_params_val.scan_period[0] & 0x00FF;
- scan_param[2] = (hal_req->scan_params_val.scan_period[0] & 0xFF00) >> 8;
- SLSI_FAPI_NAN_ATTRIBUTE_PUT_DATA(req, attribute, scan_param, 3);
- attribute = SLSI_FAPI_NAN_CONFIG_PARAM_SCAN_PARAMETER_5;
- scan_param[0] = hal_req->scan_params_val.dwell_time[1];
- scan_param[1] = hal_req->scan_params_val.scan_period[1] & 0x00FF;
- scan_param[2] = (hal_req->scan_params_val.scan_period[1] & 0xFF00) >> 8;
- SLSI_FAPI_NAN_ATTRIBUTE_PUT_DATA(req, attribute, scan_param, 3);
- len += 7 * 2;
- }
-
- /* update len */
- header_ptr[1] = len - 2;
+ u8 nan_config_fields_header[] = {0xdd, 0x24, 0x00, 0x16, 0x32, 0x0b, 0x01};
+ u16 fapi_bool;
+ u8 fapi_u8 = 0;
+ u16 rssi_window = hal_req->config_rssi_window_size ? hal_req->rssi_window_size_val : 8;
+
+ fapi_append_data(req, nan_config_fields_header, sizeof(nan_config_fields_header));
+
+ fapi_append_data(req, &hal_req->master_pref, 1);
+
+ /* publish service ID inclusion in beacon */
+ fapi_bool = hal_req->config_sid_beacon && (hal_req->sid_beacon_val & 0x01);
+ fapi_append_data(req, (u8 *)&fapi_bool, 2);
+ if (fapi_bool)
+ fapi_u8 = hal_req->sid_beacon_val >> 1;
+ fapi_append_data(req, &fapi_u8, 1);
+
+ /* subscribe service ID inclusion in beacon */
+ fapi_bool = hal_req->config_subscribe_sid_beacon && (hal_req->subscribe_sid_beacon_val & 0x01);
+ fapi_append_data(req, (u8 *)&fapi_bool, 2);
+ if (fapi_bool)
+ fapi_u8 = hal_req->subscribe_sid_beacon_val >> 1;
+ fapi_append_data(req, &fapi_u8, 1);
+
+ fapi_append_data(req, (u8 *)&rssi_window, 2);
+ fapi_append_data(req, (u8 *)&hal_req->disc_mac_addr_rand_interval_sec, 4);
+
+ /* 2.4G NAN band specific config*/
+ fapi_u8 = hal_req->config_2dot4g_rssi_close ? hal_req->rssi_close_2dot4g_val : 0;
+ fapi_append_data(req, &fapi_u8, 1);
+ fapi_u8 = hal_req->config_2dot4g_rssi_middle ? hal_req->rssi_middle_2dot4g_val : 0;
+ fapi_append_data(req, &fapi_u8, 1);
+ fapi_u8 = hal_req->config_2dot4g_rssi_proximity ? hal_req->rssi_proximity_2dot4g_val : 0;
+ fapi_append_data(req, &fapi_u8, 1);
+ fapi_append_data(req, &hal_req->scan_params_val.dwell_time[0], 1);
+ fapi_append_data(req, (u8 *)&hal_req->scan_params_val.scan_period[0], 2);
+ fapi_bool = hal_req->config_2dot4g_dw_band;
+ fapi_append_data(req, (u8 *)&fapi_bool, 2);
+ fapi_append_data(req, (u8 *)&hal_req->dw_2dot4g_interval_val, 1);
+
+ /* 5G NAN band specific config*/
+ fapi_u8 = hal_req->config_5g_rssi_close ? hal_req->rssi_close_5g_val : 0;
+ fapi_append_data(req, &fapi_u8, 1);
+ fapi_u8 = hal_req->config_5g_rssi_middle ? hal_req->rssi_middle_5g_val : 0;
+ fapi_append_data(req, &fapi_u8, 1);
+ fapi_u8 = hal_req->config_5g_rssi_close_proximity ? hal_req->rssi_close_proximity_5g_val : 0;
+ fapi_append_data(req, &fapi_u8, 1);
+ fapi_append_data(req, &hal_req->scan_params_val.dwell_time[1], 1);
+ fapi_append_data(req, (u8 *)&hal_req->scan_params_val.scan_period[1], 2);
+ fapi_bool = hal_req->config_5g_dw_band;
+ fapi_append_data(req, (u8 *)&fapi_bool, 2);
+ fapi_append_data(req, (u8 *)&hal_req->dw_5g_interval_val, 1);
}
int slsi_mlme_nan_enable(struct slsi_dev *sdev, struct net_device *dev, struct slsi_hal_nan_enable_req *hal_req)
struct sk_buff *cfm;
int r = 0;
u16 nan_oper_ctrl = 0;
+ u16 operatein5gband = hal_req->config_support_5g && hal_req->support_5g_val;
+ u16 hopcountmax = hal_req->config_hop_count_limit ? hal_req->hop_count_limit_val : 0;
SLSI_NET_DBG3(dev, SLSI_MLME, "\n");
- /* max mbulk data for mlme-nan-start.req is about 87 bytes but
- * allocate 100 bytes
- */
- req = fapi_alloc(mlme_nan_start_req, MLME_NAN_START_REQ, ndev_vif->ifnum, 100);
+ /* max mbulk data IE info length is 0x24. So need 0x26 bytes */
+ req = fapi_alloc(mlme_nan_start_req, MLME_NAN_START_REQ, ndev_vif->ifnum, 0x26);
if (!req) {
SLSI_NET_ERR(dev, "fapi alloc failure\n");
return -ENOMEM;
}
- /* if (hal_req->config_cluster_attribute_val)
- * nan_oper_ctrl |= FAPI_NANOPERATIONCONTROL_CLUSTER_SDF;
- */
nan_oper_ctrl |= FAPI_NANOPERATIONCONTROL_MAC_ADDRESS_EVENT | FAPI_NANOPERATIONCONTROL_START_CLUSTER_EVENT |
FAPI_NANOPERATIONCONTROL_JOINED_CLUSTER_EVENT;
- //fapi_set_u16(req, u.mlme_nan_start_req.cluster_low, hal_req->cluster_low);
- //fapi_set_u16(req, u.mlme_nan_start_req.cluster_high, hal_req->cluster_high);
+ fapi_set_u16(req, u.mlme_nan_start_req.operatein5gband, operatein5gband);
+ fapi_set_u16(req, u.mlme_nan_start_req.hopcountmax, hopcountmax);
fapi_set_u16(req, u.mlme_nan_start_req.nan_operation_control_flags, nan_oper_ctrl);
slsi_mlme_nan_enable_fapi_data(req, hal_req);
u8 nan_publish_fields_header[] = {0xdd, 0x00, 0x00, 0x16, 0x32, 0x0b, 0x02};
u8 *header_ptr, *end_ptr;
__le16 le16val;
- u32 binding_mask = 0;
+ u8 u8val;
header_ptr = fapi_append_data(req, nan_publish_fields_header, sizeof(nan_publish_fields_header));
+ fapi_append_data(req, &hal_req->publish_type, 1);
+ fapi_append_data(req, &hal_req->tx_type, 1);
+
le16val = cpu_to_le16(hal_req->ttl);
fapi_append_data(req, (u8 *)&le16val, 2);
le16val = cpu_to_le16(hal_req->period);
fapi_append_data(req, (u8 *)&le16val, 2);
- fapi_append_data(req, &hal_req->publish_type, 1);
- fapi_append_data(req, &hal_req->tx_type, 1);
fapi_append_data(req, &hal_req->publish_count, 1);
fapi_append_data(req, &hal_req->publish_match_indicator, 1);
- fapi_append_data(req, &hal_req->rssi_threshold_flag, 1);
- end_ptr = fapi_append_data(req, (u8 *)&binding_mask, 4);
- end_ptr += 4;
+ le16val = cpu_to_le16(hal_req->rssi_threshold_flag);
+ fapi_append_data(req, (u8 *)&le16val, 2);
+ u8val = 0;
+ fapi_append_data(req, (u8 *)&u8val, 1); /* Ranging required */
+ fapi_append_data(req, (u8 *)&u8val, 1); /* Data path required */
+
+ end_ptr = header_ptr + sizeof(nan_publish_fields_header) + 12;
if (hal_req->service_name_len)
slsi_mlme_nan_append_tlv(req, cpu_to_le16 (SLSI_FAPI_NAN_SERVICE_NAME),
hal_req->service_specific_info, &header_ptr,
sizeof(nan_publish_fields_header), &end_ptr);
+ if (hal_req->sdea_service_specific_info_len)
+ slsi_mlme_nan_append_tlv(req, cpu_to_le16 (SLSI_FAPI_NAN_SDEA),
+ cpu_to_le16 (hal_req->sdea_service_specific_info_len),
+ hal_req->sdea_service_specific_info,
+ &header_ptr, sizeof(nan_publish_fields_header), &end_ptr);
+
if (hal_req->rx_match_filter_len)
slsi_mlme_nan_append_tlv(req, cpu_to_le16 (SLSI_FAPI_NAN_RX_MATCH_FILTER),
cpu_to_le16 (hal_req->rx_match_filter_len), hal_req->rx_match_filter,
SLSI_NET_DBG3(dev, SLSI_MLME, "\n");
if (hal_req) {
- /* max possible length for publish attributes : 8*255 */
- req = fapi_alloc(mlme_nan_publish_req, MLME_NAN_PUBLISH_REQ, ndev_vif->ifnum, 8 * 255);
+ u16 max_mbulk_data_len;
+ u16 length = 17; /* non tlv info in fapi publish IE */
+
+ length += hal_req->service_name_len ? hal_req->service_name_len + 4 : 0;
+ length += hal_req->service_specific_info_len ? hal_req->service_specific_info_len + 4 : 0;
+ length += hal_req->rx_match_filter_len ? hal_req->rx_match_filter_len + 4 : 0;
+ length += hal_req->tx_match_filter_len ? hal_req->tx_match_filter_len + 4 : 0;
+ length += hal_req->sdea_service_specific_info_len ? hal_req->sdea_service_specific_info_len + 4 : 0;
+ if (length > 255)
+ /* 2 = ie_id _ie_len, 5 = oui+type+sub_type*/
+ max_mbulk_data_len = (255 + 2) * (length / (255 - (2 + 5)) + 1);
+ else
+ max_mbulk_data_len = length + 2;
+
+ req = fapi_alloc(mlme_nan_publish_req, MLME_NAN_PUBLISH_REQ, ndev_vif->ifnum, max_mbulk_data_len);
if (!req) {
SLSI_NET_ERR(dev, "fapi alloc failure\n");
return -ENOMEM;
u8 nan_subscribe_fields_header[] = {0xdd, 0x00, 0x00, 0x16, 0x32, 0x0b, 0x03};
u8 *header_ptr, *end_ptr;
__le16 le16val;
- u32 binding_mask = 0;
+ u8 u8val = 0;
header_ptr = fapi_append_data(req, nan_subscribe_fields_header, sizeof(nan_subscribe_fields_header));
- le16val = cpu_to_le16(hal_req->ttl);
- fapi_append_data(req, (u8 *)&le16val, 2);
- le16val = cpu_to_le16(hal_req->period);
- fapi_append_data(req, (u8 *)&le16val, 2);
fapi_append_data(req, &hal_req->subscribe_type, 1);
fapi_append_data(req, &hal_req->service_response_filter, 1);
fapi_append_data(req, &hal_req->service_response_include, 1);
fapi_append_data(req, &hal_req->use_service_response_filter, 1);
fapi_append_data(req, &hal_req->ssi_required_for_match_indication, 1);
- fapi_append_data(req, &hal_req->subscribe_match_indicator, 1);
+
+ le16val = cpu_to_le16(hal_req->ttl);
+ fapi_append_data(req, (u8 *)&le16val, 2);
+ le16val = cpu_to_le16(hal_req->period);
+ fapi_append_data(req, (u8 *)&le16val, 2);
fapi_append_data(req, &hal_req->subscribe_count, 1);
- fapi_append_data(req, &hal_req->rssi_threshold_flag, 1);
- end_ptr = fapi_append_data(req, (u8 *)&binding_mask, 4);
- end_ptr += 4;
+ fapi_append_data(req, &hal_req->subscribe_match_indicator, 1);
+ le16val = cpu_to_le16(hal_req->rssi_threshold_flag);
+ fapi_append_data(req, (u8 *)&le16val, 2);
+ fapi_append_data(req, &u8val, 1); /* ranging required */
+ end_ptr = fapi_append_data(req, &u8val, 1); /* datapath required */
+ end_ptr += 1;
if (hal_req->service_name_len)
slsi_mlme_nan_append_tlv(req, cpu_to_le16 (SLSI_FAPI_NAN_SERVICE_NAME),
cpu_to_le16 (hal_req->tx_match_filter_len), hal_req->tx_match_filter,
&header_ptr, sizeof(nan_subscribe_fields_header), &end_ptr);
+ if (hal_req->sdea_service_specific_info_len)
+ slsi_mlme_nan_append_tlv(req, cpu_to_le16 (SLSI_FAPI_NAN_SDEA),
+ cpu_to_le16 (hal_req->sdea_service_specific_info_len),
+ hal_req->sdea_service_specific_info,
+ &header_ptr, sizeof(nan_subscribe_fields_header), &end_ptr);
+
/* update len */
header_ptr[1] = end_ptr - header_ptr - 2;
}
SLSI_NET_DBG3(dev, SLSI_MLME, "\n");
if (hal_req) {
/*max possible length for publish attributes: 8*255 */
- req = fapi_alloc(mlme_nan_subscribe_req, MLME_NAN_SUBSCRIBE_REQ, ndev_vif->ifnum, 8 * 255);
+ u16 max_mbulk_data_len;
+ u16 length = 17; /* non tlv info in fapi publish IE */
+
+ length += hal_req->service_name_len ? hal_req->service_name_len + 4 : 0;
+ length += hal_req->service_specific_info_len ? hal_req->service_specific_info_len + 4 : 0;
+ length += hal_req->rx_match_filter_len ? hal_req->rx_match_filter_len + 4 : 0;
+ length += hal_req->tx_match_filter_len ? hal_req->tx_match_filter_len + 4 : 0;
+ length += hal_req->sdea_service_specific_info_len ? hal_req->sdea_service_specific_info_len + 4 : 0;
+ if (length > 255)
+ /* 2 = ie_id _ie_len, 5 = oui+type+sub_type*/
+ max_mbulk_data_len = (255 + 2) * (length / (255 - (2 + 5)) + 1);
+ else
+ max_mbulk_data_len = length + 2;
+
+ req = fapi_alloc(mlme_nan_subscribe_req, MLME_NAN_SUBSCRIBE_REQ, ndev_vif->ifnum, max_mbulk_data_len);
if (!req) {
SLSI_NET_ERR(dev, "fapi alloc failure\n");
return -ENOMEM;
cpu_to_le16 (hal_req->service_specific_info_len),
hal_req->service_specific_info, &header_ptr,
sizeof(nan_followup_fields_header), &end_ptr);
+ if (hal_req->sdea_service_specific_info_len)
+ slsi_mlme_nan_append_tlv(req, cpu_to_le16 (SLSI_FAPI_NAN_SDEA),
+ cpu_to_le16 (hal_req->sdea_service_specific_info_len),
+ hal_req->sdea_service_specific_info, &header_ptr,
+ sizeof(nan_followup_fields_header), &end_ptr);
/* update len */
header_ptr[1] = end_ptr - header_ptr - 2;
return -ENOMEM;
}
- /* Set/Enable corresponding bits to disable responses after followUp.
- * BIT0 - Disable followUp response from FW.
- */
- /* if (hal_req->recv_indication_cfg & BIT(0))
- * nan_sdf_flags |= FAPI_NANSDFCONTROL_DISABLE_RESPONSES_AFTER_FOLLOWUP;
- */
-
fapi_set_u16(req, u.mlme_nan_followup_req.publish_subscribe_id, hal_req->publish_subscribe_id);
fapi_set_u16(req, u.mlme_nan_followup_req.peer_id, hal_req->requestor_instance_id);
- /*fapi_set_u16(req, u.mlme_nan_followup_req.requestor_instance_id, hal_req->requestor_instance_id);*/
fapi_set_u16(req, u.mlme_nan_subscribe_req.nan_sdf_flags, nan_sdf_flags);
slsi_mlme_nan_followup_fapi_data(req, hal_req);
static void slsi_mlme_nan_config_fapi_data(struct sk_buff *req, struct slsi_hal_nan_config_req *hal_req)
{
- u8 nan_config_fields_header[] = {0xdd, 0x00, 0x00, 0x16, 0x32, 0x0b, 0x01};
- u8 *header_ptr;
- u16 attribute;
- u8 scan_param[] = {0, 0, 0};
- int len = 0;
-
- header_ptr = fapi_append_data(req, nan_config_fields_header, sizeof(nan_config_fields_header));
- attribute = SLSI_FAPI_NAN_CONFIG_PARAM_MASTER_PREFERENCE;
- SLSI_FAPI_NAN_ATTRIBUTE_PUT_U16(req, attribute, hal_req->master_pref);
- len += sizeof(nan_config_fields_header) + 5;
-
- if (hal_req->config_sid_beacon) {
- attribute = SLSI_FAPI_NAN_CONFIG_PARAM_SID_BEACON;
- SLSI_FAPI_NAN_ATTRIBUTE_PUT_U8(req, attribute, hal_req->sid_beacon);
- len += 5;
- }
-
- if (hal_req->config_rssi_proximity) {
- attribute = SLSI_FAPI_NAN_CONFIG_PARAM_2_4_RSSI_PROXIMITY;
- SLSI_FAPI_NAN_ATTRIBUTE_PUT_U8(req, attribute, hal_req->rssi_proximity);
- len += 5;
- }
-
- if (hal_req->config_5g_rssi_close_proximity) {
- attribute = SLSI_FAPI_NAN_CONFIG_PARAM_5_RSSI_PROXIMITY;
- SLSI_FAPI_NAN_ATTRIBUTE_PUT_U8(req, attribute, hal_req->rssi_close_proximity_5g_val);
- len += 5;
- }
-
- if (hal_req->config_rssi_window_size) {
- attribute = SLSI_FAPI_NAN_CONFIG_PARAM_RSSI_WINDOW_SIZE;
- SLSI_FAPI_NAN_ATTRIBUTE_PUT_U8(req, attribute, hal_req->rssi_window_size_val);
- len += 5;
- }
-
- if (hal_req->config_scan_params) {
- attribute = SLSI_FAPI_NAN_CONFIG_PARAM_SCAN_PARAMETER_2_4;
- scan_param[0] = hal_req->scan_params_val.dwell_time[0];
- scan_param[1] = hal_req->scan_params_val.scan_period[0] & 0x00FF;
- scan_param[2] = (hal_req->scan_params_val.scan_period[0] & 0xFF00) >> 8;
- SLSI_FAPI_NAN_ATTRIBUTE_PUT_DATA(req, attribute, scan_param, 3);
- attribute = SLSI_FAPI_NAN_CONFIG_PARAM_SCAN_PARAMETER_5;
- scan_param[0] = hal_req->scan_params_val.dwell_time[1];
- scan_param[1] = hal_req->scan_params_val.scan_period[1] & 0x00FF;
- scan_param[2] = (hal_req->scan_params_val.scan_period[1] & 0xFF00) >> 8;
- SLSI_FAPI_NAN_ATTRIBUTE_PUT_DATA(req, attribute, scan_param, 3);
- len += 7 * 2;
- }
-
- if (hal_req->config_conn_capability) {
- u8 con_cap = 0;
-
- if (hal_req->conn_capability_val.is_wfd_supported)
- con_cap |= BIT(0);
- if (hal_req->conn_capability_val.is_wfds_supported)
- con_cap |= BIT(1);
- if (hal_req->conn_capability_val.is_tdls_supported)
- con_cap |= BIT(2);
- if (hal_req->conn_capability_val.wlan_infra_field)
- con_cap |= BIT(3);
- attribute = SLSI_FAPI_NAN_CONFIG_PARAM_CONNECTION_CAPAB;
- SLSI_FAPI_NAN_ATTRIBUTE_PUT_U8(req, attribute, hal_req->rssi_window_size_val);
- len += 5;
- }
- /* update len */
- header_ptr[1] = len - 2;
+ u8 nan_config_fields_header[] = {0xdd, 0x24, 0x00, 0x16, 0x32, 0x0b, 0x01};
+ u16 fapi_bool;
+ u8 fapi_u8 = 0;
+ u16 rssi_window = hal_req->config_rssi_window_size ? hal_req->rssi_window_size_val : 8;
+
+ fapi_append_data(req, nan_config_fields_header, sizeof(nan_config_fields_header));
+
+ fapi_append_data(req, &hal_req->master_pref, 1);
+
+ /* publish service ID inclusion in beacon */
+ fapi_bool = hal_req->config_sid_beacon && (hal_req->sid_beacon & 0x01);
+ fapi_append_data(req, (u8 *)&fapi_bool, 2);
+
+ fapi_u8 = fapi_bool ? hal_req->sid_beacon >> 1 : 0;
+ fapi_append_data(req, &fapi_u8, 1);
+
+ /* subscribe service ID inclusion in beacon */
+ fapi_bool = hal_req->config_subscribe_sid_beacon && (hal_req->subscribe_sid_beacon_val & 0x01);
+ fapi_append_data(req, (u8 *)&fapi_bool, 2);
+
+ fapi_u8 = fapi_bool ? hal_req->subscribe_sid_beacon_val >> 1 : 0;
+ fapi_append_data(req, &fapi_u8, 1);
+
+ fapi_append_data(req, (u8 *)&rssi_window, 2);
+ fapi_append_data(req, (u8 *)&hal_req->disc_mac_addr_rand_interval_sec, 4);
+
+ /* 2.4G NAN band specific config*/
+ fapi_u8 = 0;
+ fapi_append_data(req, &fapi_u8, 1);
+ fapi_append_data(req, &fapi_u8, 1);
+ fapi_u8 = hal_req->config_rssi_proximity ? hal_req->rssi_proximity : 0;
+ fapi_append_data(req, &fapi_u8, 1);
+ fapi_append_data(req, &hal_req->scan_params_val.dwell_time[0], 1);
+ fapi_append_data(req, (u8 *)&hal_req->scan_params_val.scan_period[0], 2);
+ fapi_bool = hal_req->config_2dot4g_dw_band;
+ fapi_append_data(req, (u8 *)&fapi_bool, 2);
+ fapi_append_data(req, (u8 *)&hal_req->dw_2dot4g_interval_val, 1);
+
+ /* 5G NAN band specific config*/
+ fapi_u8 = 0;
+ fapi_append_data(req, &fapi_u8, 1);
+ fapi_append_data(req, &fapi_u8, 1);
+ fapi_u8 = hal_req->config_5g_rssi_close_proximity ? hal_req->rssi_close_proximity_5g_val : 0;
+ fapi_append_data(req, &fapi_u8, 1);
+ fapi_append_data(req, &hal_req->scan_params_val.dwell_time[1], 1);
+ fapi_append_data(req, (u8 *)&hal_req->scan_params_val.scan_period[1], 2);
+ fapi_bool = hal_req->config_5g_dw_band;
+ fapi_append_data(req, (u8 *)&fapi_bool, 2);
+ fapi_append_data(req, (u8 *)&hal_req->dw_5g_interval_val, 1);
}
int slsi_mlme_nan_set_config(struct slsi_dev *sdev, struct net_device *dev, struct slsi_hal_nan_config_req *hal_req)
return -ENOMEM;
}
- /* if (hal_req->config_cluster_attribute_val)
- * nan_oper_ctrl |= FAPI_NANOPERATIONCONTROL_CLUSTER_SDF;
- */
nan_oper_ctrl |= FAPI_NANOPERATIONCONTROL_MAC_ADDRESS_EVENT | FAPI_NANOPERATIONCONTROL_START_CLUSTER_EVENT |
FAPI_NANOPERATIONCONTROL_JOINED_CLUSTER_EVENT;
fapi_set_u16(req, u.mlme_nan_config_req.nan_operation_control_flags, nan_oper_ctrl);
hal_req->config_5g_channel = 1;
break;
+ case NAN_REQ_ATTR_SUBSCRIBE_SID_BEACON_VAL:
+ hal_req->subscribe_sid_beacon_val = nla_get_u8(iter);
+ hal_req->config_subscribe_sid_beacon = 1;
+ break;
+
+ case NAN_REQ_ATTR_DW_2G4_INTERVAL:
+ hal_req->dw_2dot4g_interval_val = nla_get_u8(iter);
+ /* valid range for 2.4G is 1-5 */
+ if (hal_req->dw_2dot4g_interval_val > 0 && hal_req->dw_2dot4g_interval_val < 5)
+ hal_req->config_2dot4g_dw_band = 1;
+ break;
+
+ case NAN_REQ_ATTR_DW_5G_INTERVAL:
+ hal_req->dw_5g_interval_val = nla_get_u8(iter);
+ /* valid range for 5g is 0-5 */
+ if (hal_req->dw_5g_interval_val < 5)
+ hal_req->config_5g_dw_band = 1;
+ break;
+
+ case NAN_REQ_ATTR_DISC_MAC_ADDR_RANDOM_INTERVAL:
+ hal_req->disc_mac_addr_rand_interval_sec = nla_get_u8(iter);
+ break;
+
default:
SLSI_ERR(sdev, "Unexpected NAN enable attribute TYPE:%d\n", type);
return SLSI_HAL_NAN_STATUS_INVALID_PARAM;
hal_req->recv_indication_cfg = nla_get_u8(iter);
break;
+ case NAN_REQ_ATTR_PUBLISH_SDEA_LEN:
+ hal_req->sdea_service_specific_info_len = nla_get_u16(iter);
+ break;
+
+ case NAN_REQ_ATTR_PUBLISH_SDEA:
+ memcpy(hal_req->sdea_service_specific_info, nla_data(iter),
+ hal_req->sdea_service_specific_info_len);
+ break;
+
default:
SLSI_ERR(sdev, "Unexpected NAN publish attribute TYPE:%d\n", type);
return SLSI_HAL_NAN_STATUS_INVALID_PARAM;
hal_req->recv_indication_cfg = nla_get_u8(iter);
break;
+ case NAN_REQ_ATTR_PUBLISH_SDEA_LEN:
+ hal_req->sdea_service_specific_info_len = nla_get_u16(iter);
+ break;
+
+ case NAN_REQ_ATTR_PUBLISH_SDEA:
+ memcpy(hal_req->sdea_service_specific_info, nla_data(iter),
+ hal_req->sdea_service_specific_info_len);
+ break;
+
default:
SLSI_ERR(sdev, "Unexpected NAN subscribe attribute TYPE:%d\n", type);
return SLSI_HAL_NAN_STATUS_INVALID_PARAM;
hal_req->recv_indication_cfg = nla_get_u8(iter);
break;
+ case NAN_REQ_ATTR_PUBLISH_SDEA_LEN:
+ hal_req->sdea_service_specific_info_len = nla_get_u16(iter);
+ break;
+
+ case NAN_REQ_ATTR_PUBLISH_SDEA:
+ memcpy(hal_req->sdea_service_specific_info, nla_data(iter),
+ hal_req->sdea_service_specific_info_len);
+ break;
+
default:
SLSI_ERR(sdev, "Unexpected NAN followup attribute TYPE:%d\n", type);
return SLSI_HAL_NAN_STATUS_INVALID_PARAM;
}
}
break;
+
+ case NAN_REQ_ATTR_SUBSCRIBE_SID_BEACON_VAL:
+ hal_req->subscribe_sid_beacon_val = nla_get_u8(iter);
+ hal_req->config_subscribe_sid_beacon = 1;
+ break;
+
+ case NAN_REQ_ATTR_DW_2G4_INTERVAL:
+ hal_req->dw_2dot4g_interval_val = nla_get_u8(iter);
+ /* valid range for 2.4G is 1-5 */
+ if (hal_req->dw_2dot4g_interval_val > 0 && hal_req->dw_2dot4g_interval_val < 6)
+ hal_req->config_2dot4g_dw_band = 1;
+ break;
+
+ case NAN_REQ_ATTR_DW_5G_INTERVAL:
+ hal_req->dw_5g_interval_val = nla_get_u8(iter);
+ /* valid range for 5g is 0-5 */
+ if (hal_req->dw_5g_interval_val < 6)
+ hal_req->config_5g_dw_band = 1;
+ break;
+
+ case NAN_REQ_ATTR_DISC_MAC_ADDR_RANDOM_INTERVAL:
+ hal_req->disc_mac_addr_rand_interval_sec = nla_get_u8(iter);
+ break;
+
default:
SLSI_ERR(sdev, "Unexpected NAN config attribute TYPE:%d\n", type);
return SLSI_HAL_NAN_STATUS_INVALID_PARAM;
if (tag_id == SLSI_FAPI_NAN_SERVICE_SPECIFIC_INFO) {
hal_evt->service_specific_info_len = tag_len;
memcpy(hal_evt->service_specific_info, ptr, tag_len);
+ } else if (tag_id == SLSI_FAPI_NAN_SDEA) {
+ hal_evt->sdea_service_specific_info_len = tag_len;
+ memcpy(hal_evt->sdea_service_specific_info, ptr, tag_len);
}
ptr += tag_len;
}
if (hal_evt->service_specific_info_len)
res |= nla_put(nl_skb, NAN_EVT_ATTR_FOLLOWUP_SERVICE_SPECIFIC_INFO, hal_evt->service_specific_info_len,
hal_evt->service_specific_info);
+ res |= nla_put_u16(nl_skb, NAN_EVT_ATTR_SDEA_LEN, hal_evt->sdea_service_specific_info_len);
+ if (hal_evt->sdea_service_specific_info_len)
+ res |= nla_put(nl_skb, NAN_EVT_ATTR_SDEA, hal_evt->sdea_service_specific_info_len,
+ hal_evt->sdea_service_specific_info);
if (res) {
SLSI_ERR(sdev, "Error in nla_put*:%x\n", res);
int stitched_ie_len;
struct slsi_hal_nan_match_ind *hal_evt;
struct sk_buff *nl_skb;
- int res, i;
- struct slsi_hal_nan_receive_post_discovery *discovery_attr;
- struct slsi_hal_nan_further_availability_channel *famchan;
- struct nlattr *nlattr_nested;
+ int res;
SLSI_DBG3(sdev, SLSI_GSCAN, "\n");
return;
}
hal_evt->publish_subscribe_id = fapi_get_u16(skb, u.mlme_nan_service_ind.publish_subscribe_id);
- hal_evt->requestor_instance_id = fapi_get_u32(skb, u.mlme_nan_service_ind.peer_id);
+ hal_evt->requestor_instance_id = fapi_get_u16(skb, u.mlme_nan_service_ind.peer_id);
/* 7 = ie_id(1), ie_len(1), oui(3) type/subtype(2)*/
ptr = stitched_ie_p + 7;
hal_evt->out_of_resource_flag = *ptr;
ptr += 1;
hal_evt->rssi_value = *ptr;
- ptr += 1;
+ ptr += 1 + 8; /* skip 8 bytes related to datapath and ranging*/
while (stitched_ie_len > (ptr - stitched_ie_p) + 4) {
tag_id = *(u16 *)ptr;
ptr += 2;
hal_evt->service_specific_info_len = tag_len;
memcpy(hal_evt->service_specific_info, ptr, tag_len);
break;
- case SLSI_FAPI_NAN_CONFIG_PARAM_CONNECTION_CAPAB:
- hal_evt->is_conn_capability_valid = 1;
- if (*ptr & BIT(0))
- hal_evt->conn_capability.is_wfd_supported = 1;
- if (*ptr & BIT(1))
- hal_evt->conn_capability.is_wfds_supported = 1;
- if (*ptr & BIT(2))
- hal_evt->conn_capability.is_tdls_supported = 1;
- if (*ptr & BIT(3))
- hal_evt->conn_capability.wlan_infra_field = 1;
- break;
- case SLSI_FAPI_NAN_CONFIG_PARAM_POST_DISCOVER_PARAM:
- discovery_attr = &hal_evt->discovery_attr[hal_evt->num_rx_discovery_attr];
- discovery_attr->type = ptr[0];
- discovery_attr->role = ptr[1];
- discovery_attr->duration = ptr[2];
- discovery_attr->avail_interval_bitmap = le32_to_cpu(*(__le32 *)&ptr[3]);
- ether_addr_copy(discovery_attr->addr, &ptr[7]);
- discovery_attr->infrastructure_ssid_len = ptr[13];
- if (discovery_attr->infrastructure_ssid_len)
- memcpy(discovery_attr->infrastructure_ssid_val, &ptr[14],
- discovery_attr->infrastructure_ssid_len);
- hal_evt->num_rx_discovery_attr++;
- break;
- case SLSI_FAPI_NAN_CONFIG_PARAM_FURTHER_AVAIL_CHANNEL_MAP:
- famchan = &hal_evt->famchan[hal_evt->num_chans];
- famchan->entry_control = ptr[0];
- famchan->class_val = ptr[1];
- famchan->channel = ptr[2];
- famchan->mapid = ptr[3];
- famchan->avail_interval_bitmap = le32_to_cpu(*(__le32 *)&ptr[4]);
- hal_evt->num_chans++;
- break;
- case SLSI_FAPI_NAN_CLUSTER_ATTRIBUTE:
+
+ case SLSI_FAPI_NAN_SDEA:
+ hal_evt->sdea_service_specific_info_len = tag_len;
+ memcpy(hal_evt->sdea_service_specific_info, ptr, tag_len);
+ break;
+
+ case SLSI_FAPI_NAN_SDF_MATCH_FILTER:
+ hal_evt->sdf_match_filter_len = tag_len;
+ memcpy(hal_evt->sdf_match_filter, ptr, tag_len);
break;
}
ptr += tag_len;
if (hal_evt->sdf_match_filter_len)
res |= nla_put(nl_skb, NAN_EVT_ATTR_MATCH_SDF_MATCH_FILTER, hal_evt->sdf_match_filter_len,
hal_evt->sdf_match_filter);
+ res |= nla_put_u16(nl_skb, NAN_EVT_ATTR_SDEA_LEN, hal_evt->sdea_service_specific_info_len);
+ if (hal_evt->sdea_service_specific_info_len)
+ res |= nla_put(nl_skb, NAN_EVT_ATTR_SDEA, hal_evt->sdea_service_specific_info_len,
+ hal_evt->sdea_service_specific_info);
res |= nla_put_u8(nl_skb, NAN_EVT_ATTR_MATCH_MATCH_OCCURRED_FLAG, hal_evt->match_occurred_flag);
res |= nla_put_u8(nl_skb, NAN_EVT_ATTR_MATCH_OUT_OF_RESOURCE_FLAG, hal_evt->out_of_resource_flag);
res |= nla_put_u8(nl_skb, NAN_EVT_ATTR_MATCH_RSSI_VALUE, hal_evt->rssi_value);
- res |= nla_put_u8(nl_skb, NAN_EVT_ATTR_MATCH_CONN_CAPABILITY_IS_IBSS_SUPPORTED,
- hal_evt->is_conn_capability_valid);
- if (hal_evt->is_conn_capability_valid) {
- res |= nla_put_u8(nl_skb, NAN_EVT_ATTR_MATCH_CONN_CAPABILITY_IS_IBSS_SUPPORTED,
- hal_evt->conn_capability.is_ibss_supported);
- res |= nla_put_u8(nl_skb, NAN_EVT_ATTR_MATCH_CONN_CAPABILITY_IS_WFD_SUPPORTED,
- hal_evt->conn_capability.is_wfd_supported);
- res |= nla_put_u8(nl_skb, NAN_EVT_ATTR_MATCH_CONN_CAPABILITY_IS_WFDS_SUPPORTED,
- hal_evt->conn_capability.is_wfds_supported);
- res |= nla_put_u8(nl_skb, NAN_EVT_ATTR_MATCH_CONN_CAPABILITY_IS_TDLS_SUPPORTED,
- hal_evt->conn_capability.is_tdls_supported);
- res |= nla_put_u8(nl_skb, NAN_EVT_ATTR_MATCH_CONN_CAPABILITY_IS_MESH_SUPPORTED,
- hal_evt->conn_capability.is_mesh_supported);
- res |= nla_put_u8(nl_skb, NAN_EVT_ATTR_MATCH_CONN_CAPABILITY_WLAN_INFRA_FIELD,
- hal_evt->conn_capability.wlan_infra_field);
- }
-
- res |= nla_put_u8(nl_skb, NAN_EVT_ATTR_MATCH_NUM_RX_DISCOVERY_ATTR, hal_evt->num_rx_discovery_attr);
- for (i = 0; i < hal_evt->num_rx_discovery_attr; i++) {
- nlattr_nested = nla_nest_start(nl_skb, NAN_EVT_ATTR_MATCH_RX_DISCOVERY_ATTR);
- if (!nlattr_nested) {
- SLSI_ERR(sdev, "Error in nla_nest_start\n");
- /* Dont use slsi skb wrapper for this free */
- kfree_skb(nl_skb);
- kfree(hal_evt);
- kfree(stitched_ie_p);
- return;
- }
- discovery_attr = &hal_evt->discovery_attr[i];
- res |= nla_put_u8(nl_skb, NAN_EVT_ATTR_MATCH_DISC_ATTR_TYPE, discovery_attr->type);
- res |= nla_put_u8(nl_skb, NAN_EVT_ATTR_MATCH_DISC_ATTR_ROLE, discovery_attr->role);
- res |= nla_put_u8(nl_skb, NAN_EVT_ATTR_MATCH_DISC_ATTR_DURATION, discovery_attr->duration);
- res |= nla_put_u32(nl_skb, NAN_EVT_ATTR_MATCH_DISC_ATTR_AVAIL_INTERVAL_BITMAP,
- discovery_attr->avail_interval_bitmap);
- res |= nla_put_u8(nl_skb, NAN_EVT_ATTR_MATCH_DISC_ATTR_MAPID, discovery_attr->mapid);
- res |= nla_put(nl_skb, NAN_EVT_ATTR_MATCH_DISC_ATTR_ADDR, ETH_ALEN, discovery_attr->addr);
- res |= nla_put_u8(nl_skb, NAN_EVT_ATTR_MATCH_DISC_ATTR_MESH_ID_LEN, discovery_attr->mesh_id_len);
- if (discovery_attr->mesh_id_len)
- res |= nla_put(nl_skb, NAN_EVT_ATTR_MATCH_DISC_ATTR_MESH_ID, discovery_attr->mesh_id_len,
- discovery_attr->mesh_id);
- res |= nla_put_u8(nl_skb, NAN_EVT_ATTR_MATCH_DISC_ATTR_INFRASTRUCTURE_SSID_LEN,
- discovery_attr->infrastructure_ssid_len);
- if (discovery_attr->infrastructure_ssid_len)
- res |= nla_put(nl_skb, NAN_EVT_ATTR_MATCH_DISC_ATTR_INFRASTRUCTURE_SSID_VAL,
- discovery_attr->infrastructure_ssid_len, discovery_attr->infrastructure_ssid_val);
- nla_nest_end(nl_skb, nlattr_nested);
- }
-
- res |= nla_put_u8(nl_skb, NAN_EVT_ATTR_MATCH_NUM_CHANS, hal_evt->num_chans);
- for (i = 0; i < hal_evt->num_chans; i++) {
- nlattr_nested = nla_nest_start(nl_skb, NAN_EVT_ATTR_MATCH_FAMCHAN);
- if (!nlattr_nested) {
- SLSI_ERR(sdev, "Error in nla_nest_start\n");
- /* Dont use slsi skb wrapper for this free */
- kfree_skb(nl_skb);
- kfree(hal_evt);
- kfree(stitched_ie_p);
- return;
- }
- famchan = &hal_evt->famchan[i];
- res |= nla_put_u8(nl_skb, NAN_EVT_ATTR_MATCH_FAM_ENTRY_CONTROL, famchan->entry_control);
- res |= nla_put_u8(nl_skb, NAN_EVT_ATTR_MATCH_FAM_CLASS_VAL, famchan->class_val);
- res |= nla_put_u8(nl_skb, NAN_EVT_ATTR_MATCH_FAM_CHANNEL, famchan->channel);
- res |= nla_put_u8(nl_skb, NAN_EVT_ATTR_MATCH_FAM_MAPID, famchan->mapid);
- res |= nla_put_u32(nl_skb, NAN_EVT_ATTR_MATCH_FAM_AVAIL_INTERVAL_BITMAP,
- famchan->avail_interval_bitmap);
- }
-
- res |= nla_put_u8(nl_skb, NAN_EVT_ATTR_MATCH_CLUSTER_ATTRIBUTE_LEN, hal_evt->cluster_attribute_len);
- if (hal_evt->cluster_attribute_len)
- res |= nla_put(nl_skb, NAN_EVT_ATTR_MATCH_CLUSTER_ATTRIBUTE, hal_evt->cluster_attribute_len,
- hal_evt->cluster_attribute);
if (res) {
SLSI_ERR(sdev, "Error in nla_put*:%x\n", res);