qcacmn: cdp: Implement API cdp_set_key_sec_type

Peer key security type is set in cdp_set_pn_check,
this API is called in key install step, but only
update Ucast field even if in Mcast key install.
This may be set wrongly if Ucast and Mcast security
modes are different. Add a new API to set security
modes of differ key types separately.

Change-Id: Icaa63139d117de75633ca1f81eb618c6b9294b53
CRs-Fixed: 2617461
This commit is contained in:
Yu Tian
2020-02-10 12:54:10 +08:00
committed by nshrivas
szülő 09815803eb
commit 0c6d94dd3e
6 fájl változott, egészen pontosan 92 új sor hozzáadva és 0 régi sor törölve

Fájl megtekintése

@@ -1677,6 +1677,36 @@ static inline int cdp_set_pn_check(ol_txrx_soc_handle soc,
return 0; return 0;
} }
/**
* cdp_set_key_sec_type(): function to set sec mode of key
* @soc: soc handle
* @vdev_id: id of virtual device
* @peer_mac: mac address of peer
* @sec_type: security type
* #is_unicast: ucast or mcast
*/
static inline int cdp_set_key_sec_type(ol_txrx_soc_handle soc,
uint8_t vdev_id,
uint8_t *peer_mac,
enum cdp_sec_type sec_type,
bool is_unicast)
{
if (!soc || !soc->ops) {
QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
"%s: Invalid Instance:", __func__);
QDF_BUG(0);
return 0;
}
if (!soc->ops->cmn_drv_ops ||
!soc->ops->cmn_drv_ops->set_key_sec_type)
return 0;
soc->ops->cmn_drv_ops->set_key_sec_type(soc, vdev_id,
peer_mac, sec_type, is_unicast);
return 0;
}
static inline QDF_STATUS static inline QDF_STATUS
cdp_set_key(ol_txrx_soc_handle soc, cdp_set_key(ol_txrx_soc_handle soc,
uint8_t vdev_id, uint8_t vdev_id,

Fájl megtekintése

@@ -437,6 +437,12 @@ struct cdp_cmn_ops {
uint8_t vdev_id, uint8_t *peermac, uint8_t vdev_id, uint8_t *peermac,
enum cdp_sec_type sec_type, enum cdp_sec_type sec_type,
uint32_t *rx_pn); uint32_t *rx_pn);
QDF_STATUS(*set_key_sec_type)(struct cdp_soc_t *soc_handle,
uint8_t vdev_id, uint8_t *peermac,
enum cdp_sec_type sec_type,
bool is_unicast);
QDF_STATUS (*update_config_parameters)(struct cdp_soc *psoc, QDF_STATUS (*update_config_parameters)(struct cdp_soc *psoc,
struct cdp_config_params *params); struct cdp_config_params *params);

Fájl megtekintése

@@ -1140,6 +1140,11 @@ dp_set_pn_check_wifi3(struct cdp_soc_t *soc, uint8_t vdev_id,
uint8_t *peer_mac, enum cdp_sec_type sec_type, uint8_t *peer_mac, enum cdp_sec_type sec_type,
uint32_t *rx_pn); uint32_t *rx_pn);
QDF_STATUS
dp_set_key_sec_type_wifi3(struct cdp_soc_t *soc, uint8_t vdev_id,
uint8_t *peer_mac, enum cdp_sec_type sec_type,
bool is_unicast);
void *dp_get_pdev_for_mac_id(struct dp_soc *soc, uint32_t mac_id); void *dp_get_pdev_for_mac_id(struct dp_soc *soc, uint32_t mac_id);
QDF_STATUS QDF_STATUS

Fájl megtekintése

@@ -9964,6 +9964,7 @@ static struct cdp_cmn_ops dp_ops_cmn = {
.txrx_intr_attach = dp_soc_interrupt_attach_wrapper, .txrx_intr_attach = dp_soc_interrupt_attach_wrapper,
.txrx_intr_detach = dp_soc_interrupt_detach, .txrx_intr_detach = dp_soc_interrupt_detach,
.set_pn_check = dp_set_pn_check_wifi3, .set_pn_check = dp_set_pn_check_wifi3,
.set_key_sec_type = dp_set_key_sec_type_wifi3,
.update_config_parameters = dp_update_config_parameters, .update_config_parameters = dp_update_config_parameters,
/* TODO: Add other functions */ /* TODO: Add other functions */
.txrx_data_tx_cb_set = dp_txrx_data_tx_cb_set, .txrx_data_tx_cb_set = dp_txrx_data_tx_cb_set,

Fájl megtekintése

@@ -3097,6 +3097,52 @@ fail:
} }
/**
* dp_set_key_sec_type_wifi3() - set security mode of key
* @soc: Datapath soc handle
* @peer_mac: Datapath peer mac address
* @vdev_id: id of atapath vdev
* @vdev: Datapath vdev
* @pdev - data path device instance
* @sec_type - security type
* #is_unicast - key type
*
*/
QDF_STATUS
dp_set_key_sec_type_wifi3(struct cdp_soc_t *soc, uint8_t vdev_id,
uint8_t *peer_mac, enum cdp_sec_type sec_type,
bool is_unicast)
{
struct dp_peer *peer = dp_peer_find_hash_find((struct dp_soc *)soc,
peer_mac, 0, vdev_id);
QDF_STATUS status = QDF_STATUS_SUCCESS;
int sec_index;
if (!peer || peer->delete_in_progress) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
"%s: Peer is NULL!\n", __func__);
status = QDF_STATUS_E_FAILURE;
goto fail;
}
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH,
"key sec spec for peer %pK %pM: %s key of type %d",
peer,
peer->mac_addr.raw,
is_unicast ? "ucast" : "mcast",
sec_type);
sec_index = is_unicast ? dp_sec_ucast : dp_sec_mcast;
peer->security[sec_index].sec_type = sec_type;
fail:
if (peer)
dp_peer_unref_delete(peer);
return status;
}
void void
dp_rx_sec_ind_handler(struct dp_soc *soc, uint16_t peer_id, dp_rx_sec_ind_handler(struct dp_soc *soc, uint16_t peer_id,
enum cdp_sec_type sec_type, int is_unicast, enum cdp_sec_type sec_type, int is_unicast,

Fájl megtekintése

@@ -200,6 +200,10 @@ QDF_STATUS target_if_crypto_set_key(struct wlan_objmgr_vdev *vdev,
qdf_mem_copy(&pn[0], &params.key_rsc_ctr, sizeof(pn)); qdf_mem_copy(&pn[0], &params.key_rsc_ctr, sizeof(pn));
cdp_set_pn_check(soc, vdev->vdev_objmgr.vdev_id, req->macaddr, cdp_set_pn_check(soc, vdev->vdev_objmgr.vdev_id, req->macaddr,
sec_type, pn); sec_type, pn);
cdp_set_key_sec_type(soc, vdev->vdev_objmgr.vdev_id, req->macaddr,
sec_type, pairwise);
cdp_set_key(soc, vdev->vdev_objmgr.vdev_id, req->macaddr, pairwise, cdp_set_key(soc, vdev->vdev_objmgr.vdev_id, req->macaddr, pairwise,
(uint32_t *)(req->keyval + WLAN_CRYPTO_IV_SIZE + (uint32_t *)(req->keyval + WLAN_CRYPTO_IV_SIZE +
WLAN_CRYPTO_MIC_LEN)); WLAN_CRYPTO_MIC_LEN));