qcacmn: cdp: Converge cdp_peer_ops

Currently cdp ops are given pdev/vdev/peer
handle as its arguments, which is directly
accessed in those APIs. This can cause a
race-condition in access of the respective
handles if it has been deleted in parallel.

Hence as a part of cdp convergence, pass only
the pdev_id or vdev_id or peer mac address,
which will be used to get the respective handles,
and hence avoiding the unwanted access of the
handles if it has been deleted.

Also remove the ops which are used to store
and retrieve such handles, that no more needed.

- register_peer
- clear_peer
- change_peer_state
- peer_get_ref_by_addr
- peer_release_ref
- peer_state_update
- get_vdev_by_sta_id
- register_ocb_peer
- get_peer_state
- get_vdev_for_peer
- update_ibss_add_peer_num_of_vdev
- remove_peers_for_vdev
- remove_peers_for_vdev_no_lock
- copy_mac_addr_raw
- add_last_real_peer
- is_vdev_restore_last_peer
- update_last_real_peer
- peer_detach_force_delete

Change-Id: I4a41211464a30e018e8b73b8e9b91c7a509327b4
CRs-Fixed: 2541711
This commit is contained in:
Vevek Venkatesan
2019-09-12 03:43:08 +05:30
committad av nshrivas
förälder 7b81f682b0
incheckning af776988bf
6 ändrade filer med 371 tillägg och 358 borttagningar

Visa fil

@@ -113,9 +113,8 @@ QDF_STATUS target_if_crypto_set_key(struct wlan_objmgr_vdev *vdev,
struct wlan_objmgr_pdev *pdev;
enum cdp_sec_type sec_type = cdp_sec_type_none;
void *soc = cds_get_context(QDF_MODULE_ID_SOC);
struct cdp_pdev *txrx_pdev = cds_get_context(QDF_MODULE_ID_TXRX);
uint32_t pn[4] = {0, 0, 0, 0};
struct cdp_peer *peer = NULL;
bool peer_exist = false;
uint8_t def_tx_idx;
wmi_unified_t pdev_wmi_handle;
bool pairwise;
@@ -157,13 +156,14 @@ QDF_STATUS target_if_crypto_set_key(struct wlan_objmgr_vdev *vdev,
qdf_mem_copy(&params.key_rsc_ctr,
&req->keyrsc[0], sizeof(uint64_t));
peer = cdp_peer_find_by_addr(soc, txrx_pdev, req->macaddr);
peer_exist = cdp_find_peer_exist(soc, pdev->pdev_objmgr.wlan_pdev_id,
req->macaddr);
target_if_debug("key_type %d, mac: %02x:%02x:%02x:%02x:%02x:%02x",
key_type, req->macaddr[0], req->macaddr[1],
req->macaddr[2], req->macaddr[3], req->macaddr[4],
req->macaddr[5]);
if ((key_type == WLAN_CRYPTO_KEY_TYPE_UNICAST) && !peer) {
if ((key_type == WLAN_CRYPTO_KEY_TYPE_UNICAST) && !peer_exist) {
target_if_err("Invalid peer");
return QDF_STATUS_E_FAILURE;
}