qcacld-3.0: Fix NULL VDEV pointer during register in monitor mode

After gerrit#2436786(which the Change-ID is
Ie64a05d795660d557d928cb9b874fa5e702f4f55), vdev in monitor mode
is removed from vdev list of pdev. So it is needed to use the new
cdp api, which is cdp_get_mon_vdev_from_pdev instead of
cdp_get_vdev_from_vdev_id in monitor mode to register vdev.

CRs-Fixed: 2350720
Change-Id: Idd36cdb09666783db2042f77708be4dcc6b9d82b
This commit is contained in:
chenguo 2018-11-15 18:07:41 +08:00 • committed by nshrivas
commit 2201c0ae46
5 changed files with 36 additions and 5 deletions

View file

@ -1669,6 +1669,8 @@ ol_txrx_vdev_attach(struct cdp_pdev *ppdev,
qdf_status = qdf_event_create(&vdev->wait_delete_comp);
/* add this vdev into the pdev's list */
TAILQ_INSERT_TAIL(&pdev->vdev_list, vdev, vdev_list_elem);
if (QDF_GLOBAL_MONITOR_MODE == cds_get_conparam())
pdev->monitor_vdev = vdev;
ol_txrx_dbg(
"Created vdev %pK (%02x:%02x:%02x:%02x:%02x:%02x)\n",
@ -5144,6 +5146,23 @@ struct cdp_vdev *ol_txrx_get_vdev_from_vdev_id(uint8_t vdev_id)
return (struct cdp_vdev *)vdev;
}
/**
* ol_txrx_get_mon_vdev_from_pdev() - get monitor mode vdev from pdev
* @ppdev: the physical device the virtual device belongs to
*
* Return: vdev handle
* NULL if not found.
*/
struct cdp_vdev *ol_txrx_get_mon_vdev_from_pdev(struct cdp_pdev *ppdev)
{
struct ol_txrx_pdev_t *pdev = (struct ol_txrx_pdev_t *)ppdev;
if (qdf_unlikely(!pdev))
return NULL;
return (struct cdp_vdev *)pdev->monitor_vdev;
}
/**
* ol_txrx_set_wisa_mode() - set wisa mode
* @vdev: vdev handle
@ -5480,6 +5499,7 @@ static struct cdp_cmn_ops ol_ops_cmn = {
.txrx_get_vdev_mac_addr = ol_txrx_get_vdev_mac_addr,
.txrx_get_vdev_from_vdev_id = ol_txrx_wrapper_get_vdev_from_vdev_id,
.txrx_get_ctrl_pdev_from_vdev = ol_txrx_get_ctrl_pdev_from_vdev,
.txrx_get_mon_vdev_from_pdev = ol_txrx_get_mon_vdev_from_pdev,
.txrx_mgmt_send_ext = ol_txrx_mgmt_send_ext,
.txrx_mgmt_tx_cb_set = ol_txrx_mgmt_tx_cb_set,
.txrx_data_tx_cb_set = ol_txrx_data_tx_cb_set,

View file

@ -148,6 +148,15 @@ ol_txrx_dump_pkt(qdf_nbuf_t nbuf, uint32_t nbuf_paddr, int len);
struct cdp_vdev *ol_txrx_get_vdev_from_vdev_id(uint8_t vdev_id);
/**
* ol_txrx_get_mon_vdev_from_pdev() - get monitor mode vdev from pdev
* @ppdev: the physical device the virtual device belongs to
*
* Return: vdev handle
* NULL if not found.
*/
struct cdp_vdev *ol_txrx_get_mon_vdev_from_pdev(struct cdp_pdev *ppdev);
void *ol_txrx_find_peer_by_addr(struct cdp_pdev *pdev,
uint8_t *peer_addr,
uint8_t *peer_id);

View file

@ -650,6 +650,9 @@ struct ol_txrx_pdev_t {
struct pktlog_dev_t *pl_dev;
#endif /* #ifndef REMOVE_PKT_LOG */
/* Monitor mode interface*/
struct ol_txrx_vdev_t *monitor_vdev;
enum ol_sec_type sec_types[htt_num_sec_types];
/* standard frame type */
enum wlan_frm_fmt frame_format;

View file

@ -121,11 +121,10 @@ int hdd_enable_monitor_mode(struct net_device *dev)
{
void *soc = cds_get_context(QDF_MODULE_ID_SOC);
void *pdev = cds_get_context(QDF_MODULE_ID_TXRX);
struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
hdd_enter_dev(dev);
return cdp_set_monitor_mode(soc,
(struct cdp_vdev *)cdp_get_vdev_from_vdev_id(soc,
(struct cdp_pdev *)pdev, adapter->session_id), false);
(struct cdp_vdev *)cdp_get_mon_vdev_from_pdev(soc,
(struct cdp_pdev *)pdev), false);
}

View file

@ -2457,8 +2457,8 @@ int hdd_set_mon_rx_cb(struct net_device *dev)
txrx_ops.rx.rx = hdd_mon_rx_packet_cbk;
hdd_monitor_set_rx_monitor_cb(&txrx_ops, hdd_rx_monitor_callback);
cdp_vdev_register(soc,
(struct cdp_vdev *)cdp_get_vdev_from_vdev_id(soc,
(struct cdp_pdev *)pdev, adapter->session_id),
(struct cdp_vdev *)cdp_get_mon_vdev_from_pdev(soc,
(struct cdp_pdev *)pdev),
adapter, (struct cdp_ctrl_objmgr_vdev *)adapter->vdev,
&txrx_ops);
/* peer is created wma_vdev_attach->wma_create_peer */