qcacmn: cdp: Converge cdp_pmf_ops

Currently the cdp apis are given 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 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.

- get_pn_info

Change-Id: I410938ed4c3878baa725b6fe3a785cbb99d5fdf4
CRs-Fixed: 2540837
This commit is contained in:
Vevek Venkatesan
2019-09-16 23:52:28 +05:30
committed by nshrivas
parent d295d1e81d
commit dc1517ec8c
2 changed files with 15 additions and 9 deletions

View File

@@ -1216,10 +1216,13 @@ struct cdp_mob_stats_ops {
/** /**
* struct cdp_pmf_ops - mcl protected management frame ops * struct cdp_pmf_ops - mcl protected management frame ops
* @get_pn_info: * @get_pn_info: handler to get pn info from peer
*
* Function pointers for pmf related operations.
*/ */
struct cdp_pmf_ops { struct cdp_pmf_ops {
void (*get_pn_info)(void *peer, uint8_t **last_pn_valid, void (*get_pn_info)(struct cdp_soc_t *soc, uint8_t *peer_mac,
uint8_t vdev_id, uint8_t **last_pn_valid,
uint64_t **last_pn, uint32_t **rmf_pn_replays); uint64_t **last_pn, uint32_t **rmf_pn_replays);
}; };
#endif #endif

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2016 The Linux Foundation. All rights reserved. * Copyright (c) 2016, 2019 The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -22,7 +22,8 @@
/** /**
* cdp_get_pn_info() - Returns pn info from peer * cdp_get_pn_info() - Returns pn info from peer
* @soc - data path soc handle * @soc - data path soc handle
* @peer: handle to peer * @peer_mac: peer mac address
* @vdev_id: virtual device/interface id
* @last_pn_valid: return last_rmf_pn_valid value from peer. * @last_pn_valid: return last_rmf_pn_valid value from peer.
* @last_pn: return last_rmf_pn value from peer. * @last_pn: return last_rmf_pn value from peer.
* @rmf_pn_replays: return rmf_pn_replays value from peer. * @rmf_pn_replays: return rmf_pn_replays value from peer.
@@ -30,8 +31,9 @@
* Return: NONE * Return: NONE
*/ */
static inline void static inline void
cdp_get_pn_info(ol_txrx_soc_handle soc, void *peer, uint8_t **last_pn_valid, cdp_get_pn_info(ol_txrx_soc_handle soc, uint8_t *peer_mac, uint8_t vdev_id,
uint64_t **last_pn, uint32_t **rmf_pn_replays) uint8_t **last_pn_valid, uint64_t **last_pn,
uint32_t **rmf_pn_replays)
{ {
if (!soc || !soc->ops || !soc->ops->pmf_ops) { if (!soc || !soc->ops || !soc->ops->pmf_ops) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
@@ -40,8 +42,9 @@ cdp_get_pn_info(ol_txrx_soc_handle soc, void *peer, uint8_t **last_pn_valid,
} }
if (soc->ops->pmf_ops->get_pn_info) if (soc->ops->pmf_ops->get_pn_info)
return soc->ops->pmf_ops->get_pn_info( return soc->ops->pmf_ops->get_pn_info(soc, peer_mac, vdev_id,
peer, last_pn_valid, last_pn, rmf_pn_replays); last_pn_valid,
last_pn, rmf_pn_replays);
return; return;
} }