qcacld-3.0: Register callbacks for packet capture

Add callbacks to register pktcapture Rx Ops and
pktcapture adapter context in pdev for packet capture
mode.

Change-Id: Iefbb24c364dfb460788f7512dee1a6ec4d2b29c1
CRs-Fixed: 2528553
This commit is contained in:
Alok Kumar 2019-09-08 20:16:19 +05:30 • committed by nshrivas
commit a71b36fc0a
4 changed files with 86 additions and 6 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2019 The Linux Foundation. All rights reserved.
* Copyright (c) 2013-2020 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
@ -326,6 +326,36 @@ int hdd_set_mon_rx_cb(struct net_device *dev)
}
#endif
#ifdef WLAN_FEATURE_PKT_CAPTURE
/**
* hdd_set_pktcapture_cb() - Set pkt capture mode callback
* @dev: Pointer to net_device structure
* @pdev_id: pdev id
*
* Return: 0 on success; non-zero for failure
*/
int hdd_set_pktcapture_cb(struct net_device *dev, uint8_t pdev_id);
/**
* hdd_reset_pktcapture_cb() - Reset pkt capture mode callback
* @pdev_id: pdev id
*
* Return: None
*/
void hdd_reset_pktcapture_cb(uint8_t pdev_id);
#else
static inline
int hdd_set_pktcapture_cb(struct net_device *dev, uint8_t pdev_id)
{
return -ENOTSUPP;
}
static inline
void hdd_reset_pktcapture_cb(uint8_t pdev_id)
{
}
#endif /* WLAN_FEATURE_PKT_CAPTURE */
void hdd_send_rps_ind(struct hdd_adapter *adapter);
void hdd_send_rps_disable_ind(struct hdd_adapter *adapter);
void wlan_hdd_classify_pkt(struct sk_buff *skb);

View file

@ -2564,6 +2564,8 @@ static int __hdd_pktcapture_open(struct net_device *dev)
hdd_mon_mode_ether_setup(dev);
ret = hdd_set_pktcapture_cb(dev, OL_TXRX_PDEV_ID);
if (!ret)
set_bit(DEVICE_IFACE_OPENED, &adapter->event_flags);
@ -2571,7 +2573,7 @@ static int __hdd_pktcapture_open(struct net_device *dev)
}
/**
* hdd_pktcapture_open() - Wrapper function for __hdd_mon_open to
* hdd_pktcapture_open() - Wrapper function for hdd_pktcapture_open to
* protect it from SSR
* @dev: Pointer to net_device structure
*
@ -3771,10 +3773,12 @@ static int __hdd_stop(struct net_device *dev)
mac_handle = hdd_ctx->mac_handle;
hdd_debug("Disabling Auto Power save timer");
sme_ps_disable_auto_ps_timer(
mac_handle,
adapter->vdev_id);
if (!wlan_hdd_is_session_type_monitor(adapter->device_mode)) {
hdd_debug("Disabling Auto Power save timer");
sme_ps_disable_auto_ps_timer(
mac_handle,
adapter->vdev_id);
}
/*
* Disable TX on the interface, after this hard_start_xmit() will not
@ -3790,6 +3794,9 @@ static int __hdd_stop(struct net_device *dev)
if (adapter->device_mode == QDF_STA_MODE)
hdd_lpass_notify_stop(hdd_ctx);
if (wlan_hdd_is_session_type_monitor(adapter->device_mode))
hdd_reset_pktcapture_cb(OL_TXRX_PDEV_ID);
/*
* NAN data interface is different in some sense. The traffic on NDI is
* bursty in nature and depends on the need to transfer. The service
@ -7148,6 +7155,12 @@ QDF_STATUS hdd_start_all_adapters(struct hdd_context *hdd_ctx)
hdd_delete_sta(adapter);
break;
case QDF_MONITOR_MODE:
if (wlan_hdd_is_session_type_monitor(
QDF_MONITOR_MODE)) {
hdd_set_pktcapture_cb(adapter->dev,
OL_TXRX_PDEV_ID);
break;
}
chan = wlan_reg_freq_to_chan(hdd_ctx->pdev,
adapter->mon_chan_freq);
hdd_start_station_adapter(adapter);
@ -7921,6 +7934,10 @@ void hdd_wlan_exit(struct hdd_context *hdd_ctx)
*/
hdd_abort_mac_scan_all_adapters(hdd_ctx);
hdd_abort_sched_scan_all_adapters(hdd_ctx);
if (wlan_hdd_is_session_type_monitor(QDF_MONITOR_MODE))
hdd_reset_pktcapture_cb(OL_TXRX_PDEV_ID);
hdd_stop_all_adapters(hdd_ctx);
hdd_deinit_all_adapters(hdd_ctx, false);
}

View file

@ -899,6 +899,7 @@ int __wlan_hdd_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)
} else if (wlan_hdd_is_session_type_monitor(
adapter->device_mode)) {
wlan_hdd_del_monitor(hdd_ctx, adapter, TRUE);
hdd_reset_pktcapture_cb(OL_TXRX_PDEV_ID);
} else {
wlan_hdd_release_intf_addr(hdd_ctx,
adapter->mac_addr.bytes);

View file

@ -48,6 +48,7 @@
#include <cdp_txrx_cmn.h>
#include <cdp_txrx_peer_ops.h>
#include <cdp_txrx_flow_ctrl_v2.h>
#include <cdp_txrx_mon.h>
#include "wlan_hdd_nan_datapath.h"
#include "pld_common.h"
#include <cdp_txrx_misc.h>
@ -2710,6 +2711,37 @@ void hdd_print_netdev_txq_status(struct net_device *dev)
}
}
#ifdef WLAN_FEATURE_PKT_CAPTURE
/**
* hdd_set_pktcapture_cb() - Set pkt capture mode callback
* @dev: Pointer to net_device structure
* @pdev_id: pdev id
*
* Return: 0 on success; non-zero for failure
*/
int hdd_set_pktcapture_cb(struct net_device *dev, uint8_t pdev_id)
{
struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
void *soc = cds_get_context(QDF_MODULE_ID_SOC);
return cdp_register_pktcapture_cb(soc, pdev_id, adapter,
hdd_mon_rx_packet_cbk);
}
/**
* hdd_reset_pktcapture_cb() - Reset pkt capture mode callback
* @pdev_id: pdev id
*
* Return: None
*/
void hdd_reset_pktcapture_cb(uint8_t pdev_id)
{
void *soc = cds_get_context(QDF_MODULE_ID_SOC);
cdp_deregister_pktcapture_cb(soc, pdev_id);
}
#endif /* WLAN_FEATURE_PKT_CAPTURE */
#ifdef FEATURE_MONITOR_MODE_SUPPORT
/**
* hdd_set_mon_rx_cb() - Set Monitor mode Rx callback