qcacld-3.0: Don't use wlan_chan_to_freq

As part of regulatory cleanup, wlan_chan_to_freq() is removed.

Use wlan_reg_legacy_chan_to_freq()/wlan_reg_chan_band_to_freq()
instead of wlan_chan_to_freq().

Change-Id: I9d105863f8d6384c97e8219b89a230c863e29d19
CRs-Fixed: 2933440
This commit is contained in:
Jyoti Kumari
2021-04-24 12:49:36 +05:30
committed by Madan Koyyalamudi
parent c15ffec425
commit 08eb756a51
11 changed files with 100 additions and 51 deletions

View File

@@ -1064,20 +1064,35 @@ static QDF_STATUS p2p_mgmt_tx(struct tx_action_context *tx_ctx,
void *mac_addr;
uint8_t pdev_id;
struct wlan_objmgr_vdev *vdev;
uint16_t chanfreq = 0;
qdf_freq_t chanfreq = 0;
struct wlan_objmgr_pdev *pdev;
psoc = tx_ctx->p2p_soc_obj->soc;
mgmt_param.tx_frame = packet;
mgmt_param.frm_len = buf_len;
mgmt_param.vdev_id = tx_ctx->vdev_id;
mgmt_param.pdata = frame;
vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, tx_ctx->vdev_id,
WLAN_P2P_ID);
if (!vdev)
return QDF_STATUS_E_INVAL;
pdev = wlan_vdev_get_pdev(vdev);
if (!pdev) {
wlan_objmgr_vdev_release_ref(vdev, WLAN_P2P_ID);
return QDF_STATUS_E_INVAL;
}
if (tx_ctx->chan)
chanfreq = (uint16_t)wlan_chan_to_freq(tx_ctx->chan);
chanfreq = wlan_reg_legacy_chan_to_freq(pdev, tx_ctx->chan);
mgmt_param.chanfreq = chanfreq;
mgmt_param.qdf_ctx = wlan_psoc_get_qdf_dev(psoc);
if (!(mgmt_param.qdf_ctx)) {
p2p_err("qdf ctx is null");
wlan_objmgr_vdev_release_ref(vdev, WLAN_P2P_ID);
return QDF_STATUS_E_INVAL;
}
@@ -1092,15 +1107,13 @@ static QDF_STATUS p2p_mgmt_tx(struct tx_action_context *tx_ctx,
WLAN_P2P_ID);
}
if (!peer && tx_ctx->rand_mac_tx) {
vdev = wlan_objmgr_get_vdev_by_id_from_psoc(
psoc, tx_ctx->vdev_id, WLAN_P2P_ID);
if (vdev) {
mac_addr = wlan_vdev_mlme_get_macaddr(vdev);
peer = wlan_objmgr_get_peer(psoc, pdev_id, mac_addr,
WLAN_P2P_ID);
}
}
wlan_objmgr_vdev_release_ref(vdev, WLAN_P2P_ID);
}
}
if (!peer) {
p2p_err("no valid peer");
@@ -2706,7 +2719,8 @@ p2p_request_random_mac(struct wlan_objmgr_psoc *soc, uint32_t vdev_id,
return status;
}
void p2p_rand_mac_tx(struct tx_action_context *tx_action)
void p2p_rand_mac_tx(struct wlan_objmgr_pdev *pdev,
struct tx_action_context *tx_action)
{
struct wlan_objmgr_psoc *soc;
QDF_STATUS status;
@@ -2724,7 +2738,7 @@ void p2p_rand_mac_tx(struct tx_action_context *tx_action)
status = p2p_request_random_mac(
soc, tx_action->vdev_id,
&tx_action->buf[SRC_MAC_ADDR_OFFSET],
wlan_chan_to_freq(tx_action->chan),
wlan_reg_legacy_chan_to_freq(pdev, tx_action->chan),
tx_action->id,
tx_action->duration);
if (status == QDF_STATUS_SUCCESS)

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2019, 2021 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -412,6 +412,7 @@ void p2p_del_all_rand_mac_soc(struct wlan_objmgr_psoc *soc);
/**
* p2p_rand_mac_tx() - handle random mac mgmt tx
* @pdev: pdev object
* @tx_action: tx action context
*
* This function will check whether need to set random mac tx filter for a
@@ -419,7 +420,8 @@ void p2p_del_all_rand_mac_soc(struct wlan_objmgr_psoc *soc);
*
* Return: void
*/
void p2p_rand_mac_tx(struct tx_action_context *tx_action);
void p2p_rand_mac_tx(struct wlan_objmgr_pdev *pdev,
struct tx_action_context *tx_action);
/**
* p2p_init_random_mac_vdev() - Init random mac data for vdev

View File

@@ -82,6 +82,7 @@ static QDF_STATUS p2p_scan_start(struct p2p_roc_context *roc_ctx)
struct wlan_objmgr_vdev *vdev;
struct p2p_soc_priv_obj *p2p_soc_obj = roc_ctx->p2p_soc_obj;
uint32_t go_num;
struct wlan_objmgr_pdev *pdev;
vdev = wlan_objmgr_get_vdev_by_id_from_psoc(
p2p_soc_obj->soc, roc_ctx->vdev_id,
@@ -105,13 +106,16 @@ static QDF_STATUS p2p_scan_start(struct p2p_roc_context *roc_ctx)
P2P_ROC_DEFAULT_DURATION);
}
pdev = wlan_vdev_get_pdev(vdev);
roc_ctx->scan_id = ucfg_scan_get_scan_id(p2p_soc_obj->soc);
req->vdev = vdev;
req->scan_req.scan_id = roc_ctx->scan_id;
req->scan_req.scan_type = SCAN_TYPE_P2P_LISTEN;
req->scan_req.scan_req_id = p2p_soc_obj->scan_req_id;
req->scan_req.chan_list.num_chan = 1;
req->scan_req.chan_list.chan[0].freq = wlan_chan_to_freq(roc_ctx->chan);
req->scan_req.chan_list.chan[0].freq = wlan_reg_legacy_chan_to_freq(
pdev,
roc_ctx->chan);
req->scan_req.dwell_time_passive = roc_ctx->duration;
req->scan_req.dwell_time_active = 0;
req->scan_req.scan_priority = SCAN_PRIORITY_HIGH;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2018,2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2018, 2020-2021 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -248,13 +248,16 @@ QDF_STATUS ucfg_p2p_cleanup_tx_by_psoc(struct wlan_objmgr_psoc *psoc);
* @soc: soc context
* @mgmt_frm: TX mgmt frame parameters
* @cookie: Return the cookie to caller
* @pdev: pdev object
*
* This function delivers mgmt frame tx request to P2P component.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS ucfg_p2p_mgmt_tx(struct wlan_objmgr_psoc *soc,
struct p2p_mgmt_tx *mgmt_frm, uint64_t *cookie);
struct p2p_mgmt_tx *mgmt_frm,
uint64_t *cookie,
struct wlan_objmgr_pdev *pdev);
/**
* ucfg_p2p_mgmt_tx_cancel() - Cancel mgmt frame tx request

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -294,7 +294,8 @@ QDF_STATUS ucfg_p2p_cleanup_tx_by_psoc(struct wlan_objmgr_psoc *psoc)
}
QDF_STATUS ucfg_p2p_mgmt_tx(struct wlan_objmgr_psoc *soc,
struct p2p_mgmt_tx *mgmt_frm, uint64_t *cookie)
struct p2p_mgmt_tx *mgmt_frm, uint64_t *cookie,
struct wlan_objmgr_pdev *pdev)
{
struct scheduler_msg msg = {0};
struct p2p_soc_priv_obj *p2p_soc_obj;
@@ -354,7 +355,7 @@ QDF_STATUS ucfg_p2p_mgmt_tx(struct wlan_objmgr_psoc *soc,
tx_action->nbuf = NULL;
tx_action->id = id;
p2p_rand_mac_tx(tx_action);
p2p_rand_mac_tx(pdev, tx_action);
msg.type = P2P_MGMT_TX;
msg.bodyptr = tx_action;

View File

@@ -431,6 +431,7 @@ pkt_capture_mgmt_rx_data_cb(struct wlan_objmgr_psoc *psoc,
qdf_nbuf_t nbuf;
int buf_len;
struct wlan_objmgr_vdev *vdev;
struct wlan_objmgr_pdev *pdev;
if (!(pkt_capture_get_pktcap_mode(psoc) & PKT_CAPTURE_MODE_MGMT_ONLY)) {
qdf_nbuf_free(wbuf);
@@ -454,14 +455,13 @@ pkt_capture_mgmt_rx_data_cb(struct wlan_objmgr_psoc *psoc,
pfc = (tpSirMacFrameCtl)(qdf_nbuf_data(nbuf));
wh = (struct ieee80211_frame *)qdf_nbuf_data(nbuf);
vdev = pkt_capture_get_vdev();
pdev = wlan_vdev_get_pdev(vdev);
if ((pfc->type == IEEE80211_FC0_TYPE_MGT) &&
(pfc->subType == SIR_MAC_MGMT_DISASSOC ||
pfc->subType == SIR_MAC_MGMT_DEAUTH ||
pfc->subType == SIR_MAC_MGMT_ACTION)) {
struct wlan_objmgr_pdev *pdev;
vdev = pkt_capture_get_vdev();
pdev = wlan_vdev_get_pdev(vdev);
if (pkt_capture_is_rmf_enabled(pdev, psoc, wh->i_addr1)) {
QDF_STATUS status;
@@ -474,7 +474,9 @@ pkt_capture_mgmt_rx_data_cb(struct wlan_objmgr_psoc *psoc,
txrx_status.tsft = (u_int64_t)rx_params->tsf_l32;
txrx_status.chan_num = rx_params->channel;
txrx_status.chan_freq = wlan_chan_to_freq(txrx_status.chan_num);
txrx_status.chan_freq = wlan_reg_legacy_chan_to_freq(
pdev,
txrx_status.chan_num);
/* rx_params->rate is in Kbps, convert into Mbps */
txrx_status.rate = (rx_params->rate / 1000);
txrx_status.ant_signal_db = rx_params->snr;

View File

@@ -706,7 +706,8 @@ void wlan_hdd_two_connections_scenario(struct hdd_context *hdd_ctx,
policy_mgr_incr_connection_count_utfw(
hdd_ctx->psoc, vdevid, tx_stream,
rx_stream, chain_mask, type, dummy_type,
wlan_chan_to_freq(channel_id), mac_id);
wlan_reg_legacy_chan_to_freq(hdd_ctx->pdev, channel_id),
mac_id);
/* validate one connection is created or no */
if (policy_mgr_get_connection_count(hdd_ctx->psoc) != 1) {
hdd_err("Test failed - No. of connection is not 1");
@@ -813,7 +814,8 @@ void wlan_hdd_three_connections_scenario(struct hdd_context *hdd_ctx,
policy_mgr_incr_connection_count_utfw(
hdd_ctx->psoc, vdevid_1, tx_stream_1, rx_stream_1,
chain_mask_1, type_1, dummy_type_1,
wlan_chan_to_freq(channel_id_1), mac_id_1);
wlan_reg_legacy_chan_to_freq(hdd_ctx->pdev,
channel_id_1), mac_id_1);
/* validate one connection is created or no */
if (policy_mgr_get_connection_count(hdd_ctx->psoc) != 1) {
hdd_err("Test fail - No. of connection not 1");
@@ -830,7 +832,9 @@ void wlan_hdd_three_connections_scenario(struct hdd_context *hdd_ctx,
hdd_ctx->psoc, vdevid_2, tx_stream_2,
rx_stream_2, chain_mask_2, type_2,
dummy_type_2,
wlan_chan_to_freq(channel_id_2), mac_id_2);
wlan_reg_legacy_chan_to_freq(hdd_ctx->pdev,
channel_id_2),
mac_id_2);
/* validate two connections are created or no */
if (policy_mgr_get_connection_count(hdd_ctx->psoc)
!= 2) {

View File

@@ -273,6 +273,7 @@ static void hdd_get_band_helper(struct hdd_context *hdd_ctx, int *ui_band)
* hdd_check_and_fill_freq() - to validate chan and convert into freq
* @in_chan: input as channel number or freq to be checked
* @freq: frequency for input in_chan (output parameter)
* @pdev: pdev object
*
* This function checks input "in_chan" is channel number, if yes then fills
* appropriate frequency into "freq" out param. If the "in_param" is greater
@@ -280,10 +281,11 @@ static void hdd_get_band_helper(struct hdd_context *hdd_ctx, int *ui_band)
*
* Return: true if "in_chan" is valid channel/frequency; false otherwise
*/
static bool hdd_check_and_fill_freq(uint32_t in_chan, qdf_freq_t *freq)
static bool hdd_check_and_fill_freq(uint32_t in_chan, qdf_freq_t *freq,
struct wlan_objmgr_pdev *pdev)
{
if (in_chan <= WNI_CFG_CURRENT_CHANNEL_STAMAX)
*freq = wlan_chan_to_freq(in_chan);
*freq = wlan_reg_legacy_chan_to_freq(pdev, in_chan);
else if (WLAN_REG_IS_24GHZ_CH_FREQ(in_chan) ||
WLAN_REG_IS_5GHZ_CH_FREQ(in_chan) ||
WLAN_REG_IS_6GHZ_CHAN_FREQ(in_chan))
@@ -299,12 +301,13 @@ static bool hdd_check_and_fill_freq(uint32_t in_chan, qdf_freq_t *freq)
* @data: input data
* @target_ap_bssid: pointer to bssid (output parameter)
* @freq: pointer to freq (output parameter)
* @pdev: pdev object
*
* Return: 0 if parsing is successful; -EINVAL otherwise
*/
static int _hdd_parse_bssid_and_chan(const uint8_t **data,
uint8_t *bssid,
qdf_freq_t *freq)
uint8_t *bssid, qdf_freq_t *freq,
struct wlan_objmgr_pdev *pdev)
{
const uint8_t *in_ptr;
int v = 0;
@@ -377,7 +380,7 @@ static int _hdd_parse_bssid_and_chan(const uint8_t **data,
v = kstrtos32(temp_buf, 10, &temp_int);
if (v < 0 || temp_int < 0)
goto error;
else if (!hdd_check_and_fill_freq(temp_int, freq))
else if (!hdd_check_and_fill_freq(temp_int, freq, pdev))
goto error;
*data = in_ptr;
@@ -396,6 +399,7 @@ error:
* after transmitting action frame
* @buf: Pointer to data
* @buf_len: Pointer to data length
* @pdev: pdev object
*
* This function parses the send action frame data passed in the format
* SENDACTIONFRAME<space><bssid><space><channel | frequency><space><dwelltime>
@@ -407,7 +411,8 @@ static int
hdd_parse_send_action_frame_v1_data(const uint8_t *command,
uint8_t *bssid,
qdf_freq_t *freq, uint8_t *dwell_time,
uint8_t **buf, uint8_t *buf_len)
uint8_t **buf, uint8_t *buf_len,
struct wlan_objmgr_pdev *pdev)
{
const uint8_t *in_ptr = command;
const uint8_t *end_ptr;
@@ -418,7 +423,7 @@ hdd_parse_send_action_frame_v1_data(const uint8_t *command,
uint8_t temp_buf[32];
uint8_t temp_u8 = 0;
if (_hdd_parse_bssid_and_chan(&in_ptr, bssid, freq))
if (_hdd_parse_bssid_and_chan(&in_ptr, bssid, freq, pdev))
return -EINVAL;
/* point to the next argument */
@@ -504,6 +509,7 @@ hdd_parse_send_action_frame_v1_data(const uint8_t *command,
* @command: Pointer to input data (its a NULL terminated string)
* @bssid: Pointer to target Ap bssid
* @freq: Pointer to the Target AP frequency
* @pdev: pdev object
*
* This function parses the reasoc command data passed in the format
* REASSOC<space><bssid><space><channel/frequency>
@@ -511,12 +517,12 @@ hdd_parse_send_action_frame_v1_data(const uint8_t *command,
* Return: 0 for success non-zero for failure
*/
static int hdd_parse_reassoc_command_v1_data(const uint8_t *command,
uint8_t *bssid,
qdf_freq_t *freq)
uint8_t *bssid, qdf_freq_t *freq,
struct wlan_objmgr_pdev *pdev)
{
const uint8_t *in_ptr = command;
if (_hdd_parse_bssid_and_chan(&in_ptr, bssid, freq))
if (_hdd_parse_bssid_and_chan(&in_ptr, bssid, freq, pdev))
return -EINVAL;
return 0;
@@ -692,9 +698,9 @@ static int hdd_parse_reassoc_v1(struct hdd_adapter *adapter, const char *command
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
QDF_STATUS status;
#endif
struct wlan_objmgr_pdev *pdev = wlan_vdev_get_pdev(adapter->vdev);
ret = hdd_parse_reassoc_command_v1_data(command, bssid, &freq);
ret = hdd_parse_reassoc_command_v1_data(command, bssid, &freq, pdev);
if (ret) {
hdd_err("Failed to parse reassoc command data");
return ret;
@@ -740,7 +746,7 @@ static int hdd_parse_reassoc_v2(struct hdd_adapter *adapter,
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
QDF_STATUS status;
#endif
struct wlan_objmgr_pdev *pdev = wlan_vdev_get_pdev(adapter->vdev);
if (total_len < sizeof(params) + 8) {
hdd_err("Invalid command length");
@@ -760,7 +766,7 @@ static int hdd_parse_reassoc_v2(struct hdd_adapter *adapter,
* is less than WNI_CFG_CURRENT_CHANNEL_STAMAX, then host
* consider this as channel number else frequency.
*/
if (!hdd_check_and_fill_freq(params.channel, &freq))
if (!hdd_check_and_fill_freq(params.channel, &freq, pdev))
return -EINVAL;
#ifdef FEATURE_CM_ENABLE
@@ -999,10 +1005,11 @@ hdd_parse_sendactionframe_v1(struct hdd_adapter *adapter, const char *command)
uint8_t *payload = NULL;
tSirMacAddr bssid;
int ret;
struct wlan_objmgr_pdev *pdev = wlan_vdev_get_pdev(adapter->vdev);
ret = hdd_parse_send_action_frame_v1_data(command, bssid, &freq,
&dwell_time, &payload,
&payload_len);
&payload_len, pdev);
if (ret) {
hdd_nofl_err("Failed to parse send action frame data");
} else {
@@ -1036,6 +1043,7 @@ hdd_parse_sendactionframe_v2(struct hdd_adapter *adapter,
int ret;
int len_wo_payload = 0;
qdf_freq_t freq = 0;
struct wlan_objmgr_pdev *pdev = wlan_vdev_get_pdev(adapter->vdev);
/* The params are located after "SENDACTIONFRAME " */
total_len -= 16;
@@ -1069,7 +1077,7 @@ hdd_parse_sendactionframe_v2(struct hdd_adapter *adapter,
return -EINVAL;
}
if (!hdd_check_and_fill_freq(params->channel, &freq)) {
if (!hdd_check_and_fill_freq(params->channel, &freq, pdev)) {
hdd_err("Invalid channel: %d", params->channel);
return -EINVAL;
}
@@ -4612,7 +4620,7 @@ static int drv_cmd_fast_reassoc(struct hdd_adapter *adapter,
}
ret = hdd_parse_reassoc_command_v1_data(value, bssid,
&freq);
&freq, hdd_ctx->pdev);
if (ret) {
hdd_err("Failed to parse reassoc command data");
goto exit;

View File

@@ -11505,7 +11505,7 @@ void hdd_switch_sap_channel(struct hdd_adapter *adapter, uint8_t channel,
policy_mgr_change_sap_channel_with_csa(
hdd_ctx->psoc, adapter->vdev_id,
wlan_chan_to_freq(channel),
wlan_reg_legacy_chan_to_freq(hdd_ctx->pdev, channel),
hdd_ap_ctx->sap_config.ch_width_orig, forced);
}

View File

@@ -6775,7 +6775,9 @@ static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
hdd_ctx->psoc,
apps_args[0], apps_args[1], apps_args[2], apps_args[3],
apps_args[4], apps_args[5],
wlan_chan_to_freq(apps_args[6]), apps_args[7]);
wlan_reg_legacy_chan_to_freq(hdd_ctx->pdev,
apps_args[6]),
apps_args[7]);
}
break;
@@ -6835,7 +6837,8 @@ static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
}
policy_mgr_current_connections_update(
hdd_ctx->psoc, adapter->vdev_id,
wlan_chan_to_freq(apps_args[0]),
wlan_reg_legacy_chan_to_freq(hdd_ctx->pdev,
apps_args[0]),
POLICY_MGR_UPDATE_REASON_UT, POLICY_MGR_DEF_REQ_ID);
}
break;
@@ -6852,7 +6855,9 @@ static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
}
allow = policy_mgr_allow_concurrency(
hdd_ctx->psoc, apps_args[0],
wlan_chan_to_freq(apps_args[1]), apps_args[2]);
wlan_reg_legacy_chan_to_freq(hdd_ctx->pdev,
apps_args[1]),
apps_args[2]);
hdd_debug("allow %d {0 = don't allow, 1 = allow}", allow);
}
break;

View File

@@ -252,6 +252,7 @@ static void wlan_p2p_event_callback(void *user_data,
struct ieee80211_channel *chan;
struct vdev_osif_priv *osif_priv;
struct wireless_dev *wdev;
struct wlan_objmgr_pdev *pdev;
osif_debug("user data:%pK, vdev id:%d, event type:%d",
user_data, p2p_event->vdev_id, p2p_event->roc_event);
@@ -281,8 +282,11 @@ static void wlan_p2p_event_callback(void *user_data,
goto fail;
}
pdev = wlan_vdev_get_pdev(vdev);
chan = ieee80211_get_channel(wdev->wiphy,
wlan_chan_to_freq(p2p_event->chan));
wlan_reg_legacy_chan_to_freq(
pdev,
p2p_event->chan));
if (!chan) {
osif_err("channel conversion failed");
goto fail;
@@ -442,7 +446,9 @@ int wlan_cfg80211_mgmt_tx(struct wlan_objmgr_vdev *vdev,
bool ok;
ret = policy_mgr_is_chan_ok_for_dnbs(
psoc, wlan_chan_to_freq(channel), &ok);
psoc, wlan_reg_legacy_chan_to_freq(pdev,
channel),
&ok);
if (QDF_IS_STATUS_ERROR(ret)) {
osif_err("policy_mgr_is_chan_ok_for_dnbs():ret:%d",
ret);
@@ -465,7 +471,7 @@ int wlan_cfg80211_mgmt_tx(struct wlan_objmgr_vdev *vdev,
mgmt_tx.buf = buf;
return qdf_status_to_os_return(
ucfg_p2p_mgmt_tx(psoc, &mgmt_tx, cookie));
ucfg_p2p_mgmt_tx(psoc, &mgmt_tx, cookie, pdev));
}
int wlan_cfg80211_mgmt_tx_cancel(struct wlan_objmgr_vdev *vdev,