qcacmn: Initialization of P2P component

Defines main APIs and data structures. Initial basic frame work of
P2P component.

Change-Id: I08d2e2cec734ddc535d88996f7d5ece5ef3d270a
CRs-Fixed: 1099441
This commit is contained in:
Wu Gao
2017-02-16 11:39:12 +08:00
committed by qcabuildsw
parent e764b98096
commit f482dea2a7
15 changed files with 1946 additions and 0 deletions

View File

@@ -286,6 +286,7 @@ typedef void (*qdf_timer_func_t)(void *);
* @QDF_MODULE_ID_MGMT_TXRX : management TX/RX module ID * @QDF_MODULE_ID_MGMT_TXRX : management TX/RX module ID
* @QDF_MODULE_ID_SERIALIZATION : serialization module ID * @QDF_MODULE_ID_SERIALIZATION : serialization module ID
* @QDF_MODULE_ID_PMO : PMO (power manager and offloads) Module ID * @QDF_MODULE_ID_PMO : PMO (power manager and offloads) Module ID
* @QDF_MODULE_ID_P2P : P2P module ID
* @QDF_MODULE_ID_ANY : anything * @QDF_MODULE_ID_ANY : anything
* @QDF_MODULE_ID_MAX : Max place holder module ID * @QDF_MODULE_ID_MAX : Max place holder module ID
*/ */
@@ -367,6 +368,7 @@ typedef enum {
QDF_MODULE_ID_MGMT_TXRX, QDF_MODULE_ID_MGMT_TXRX,
QDF_MODULE_ID_SERIALIZATION, QDF_MODULE_ID_SERIALIZATION,
QDF_MODULE_ID_PMO, QDF_MODULE_ID_PMO,
QDF_MODULE_ID_P2P,
QDF_MODULE_ID_ANY, QDF_MODULE_ID_ANY,
QDF_MODULE_ID_MAX, QDF_MODULE_ID_MAX,
} QDF_MODULE_ID; } QDF_MODULE_ID;

View File

@@ -79,6 +79,7 @@
* @WLAN_UMAC_COMP_MGMT_TXRX: MGMT Tx/Rx * @WLAN_UMAC_COMP_MGMT_TXRX: MGMT Tx/Rx
* @WLAN_UMAC_COMP_SERIALIZATION: Serialization * @WLAN_UMAC_COMP_SERIALIZATION: Serialization
* @WLAN_UMAC_COMP_PMO: PMO component * @WLAN_UMAC_COMP_PMO: PMO component
* @WLAN_UMAC_COMP_P2P: P2P
* @WLAN_UMAC_COMP_ID_MAX: Maximum components in UMAC * @WLAN_UMAC_COMP_ID_MAX: Maximum components in UMAC
* *
* This id is static. * This id is static.
@@ -90,6 +91,7 @@ enum wlan_umac_comp_id {
WLAN_UMAC_COMP_MGMT_TXRX = 2, WLAN_UMAC_COMP_MGMT_TXRX = 2,
WLAN_UMAC_COMP_SERIALIZATION = 3, WLAN_UMAC_COMP_SERIALIZATION = 3,
WLAN_UMAC_COMP_PMO = 4, WLAN_UMAC_COMP_PMO = 4,
WLAN_UMAC_COMP_P2P = 5,
WLAN_UMAC_COMP_ID_MAX, WLAN_UMAC_COMP_ID_MAX,
}; };

View File

@@ -0,0 +1,26 @@
/*
* Copyright (c) 2017 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
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Contains mandatory API from legacy
*/
#ifndef _WLAN_UTILITY_H_
#define _WLAN_UTILITY_H_
#endif /* _WLAN_UTILITY_H_ */

View File

@@ -0,0 +1,24 @@
/*
* Copyright (c) 2017 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
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: This file contains definition for mandatory legacy API
*/
#include "wlan_utility.h"

View File

@@ -0,0 +1,293 @@
/*
* Copyright (c) 2017 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
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Defines main P2P functions & structures
*/
#ifndef _WLAN_P2P_MAIN_H_
#define _WLAN_P2P_MAIN_H_
#include <qdf_trace.h>
#include <qdf_types.h>
#include <qdf_event.h>
#define P2P_MAX_NOA_DESC 4
#define MAX_QUEUE_LENGTH 20
#define p2p_log(level, args...) \
QDF_TRACE(QDF_MODULE_ID_P2P, level, ## args)
#define p2p_logl(level, format, args...) \
p2p_log(level, FL(format), ## args)
#define p2p_debug(format, args ...) \
p2p_logl(QDF_TRACE_LEVEL_DEBUG, format, ## args)
#define p2p_info(format, args ...) \
p2p_logl(QDF_TRACE_LEVEL_INFO, format, ## args)
#define p2p_warn(format, args ...) \
p2p_logl(QDF_TRACE_LEVEL_WARN, format, ## args)
#define p2p_err(format, args ...) \
p2p_logl(QDF_TRACE_LEVEL_ERROR, format, ## args)
#define p2p_alert(format, args ...) \
p2p_logl(QDF_TRACE_LEVEL_FATAL, format, ## args)
struct scheduler_msg;
struct p2p_tx_cnf;
struct p2p_rx_mgmt_frame;
struct p2p_lo_event;
struct p2p_start_param;
/**
* enum p2p_cmd_type - P2P request type
* @P2P_ROC_REQ: P2P roc request
* @P2P_CANCEL_ROC_REQ: Cancel P2P roc request
* @P2P_MGMT_TX: P2P tx action frame request
* @P2P_MGMT_TX_CANCEL: Cancel tx action frame request
*/
enum p2p_cmd_type {
P2P_ROC_REQ = 0,
P2P_CANCEL_ROC_REQ,
P2P_MGMT_TX,
P2P_MGMT_TX_CANCEL,
};
/**
* enum p2p_event_type - P2P event type
* @P2P_EVENT_SCAN_EVENT: P2P scan event
* @P2P_EVENT_MGMT_TX_ACK_CNF: P2P mgmt tx confirm frame
* @P2P_EVENT_RX_MGMT: P2P rx mgmt frame
* @P2P_EVENT_LO_STOPPED: P2P listen offload stopped event
* @P2P_EVENT_NOA: P2P noa event
*/
enum p2p_event_type {
P2P_EVENT_SCAN_EVENT = 0,
P2P_EVENT_MGMT_TX_ACK_CNF,
P2P_EVENT_RX_MGMT,
P2P_EVENT_LO_STOPPED,
P2P_EVENT_NOA,
};
/**
* struct noa_descriptor - noa descriptor
* @type_count: 255: continuous schedule, 0: reserved
* @duration: Absent period duration in micro seconds
* @interval: Absent period interval in micro seconds
* @start_time: 32 bit tsf time when in starts
*/
struct noa_descriptor {
uint8_t type_count;
uint32_t duration;
uint32_t interval;
uint32_t start_time;
};
/**
* struct p2p_noa_info - p2p noa information
* @index: Identifies instance of NOA su element
* @opps_ps: Opps ps state of the AP
* @ct_window: Ct window in TUs
* @num_descriptors: Number of NOA descriptors
* @noa_desc: Noa descriptors
* @vdev_id: Vdev id
*/
struct p2p_noa_info {
uint8_t index;
uint8_t opps_ps;
uint8_t ct_window;
uint8_t num_desc;
struct noa_descriptor noa_desc[P2P_MAX_NOA_DESC];
uint32_t vdev_id;
};
/**
* struct p2p_tx_conf_event - p2p tx confirm event
* @p2p_soc_obj: p2p soc private object
* @tx_cnf: p2p tx confirm structure
*/
struct p2p_tx_conf_event {
struct p2p_soc_priv_obj *p2p_soc_obj;
struct p2p_tx_cnf *tx_cnf;
};
/**
* struct p2p_rx_mgmt_event - p2p rx mgmt frame event
* @p2p_soc_obj: p2p soc private object
* @rx_mgmt: p2p rx mgmt frame structure
*/
struct p2p_rx_mgmt_event {
struct p2p_soc_priv_obj *p2p_soc_obj;
struct p2p_rx_mgmt_frame *rx_mgmt;
};
/**
* struct p2p_lo_stop_event - p2p listen offload stop event
* @p2p_soc_obj: p2p soc private object
* @lo_event: p2p lo stop structure
*/
struct p2p_lo_stop_event {
struct p2p_soc_priv_obj *p2p_soc_obj;
struct p2p_lo_event *lo_event;
};
/**
* struct p2p_noa_event - p2p noa event
* @p2p_soc_obj: p2p soc private object
* @noa_info: p2p noa information structure
*/
struct p2p_noa_event {
struct p2p_soc_priv_obj *p2p_soc_obj;
struct p2p_noa_info *noa_info;
};
/**
* struct p2p_soc_priv_obj - Per SoC p2p private object
* @soc: Pointer to SoC context
* @roc_q: Queue for pending roc requests
* @tx_q_roc: Queue for tx frames waiting for RoC
* @tx_q_ack: Queue for tx frames waiting for ack
* @scan_req_id: Scan requestor id
* @start_param: Start parameters, include callbacks and user
* data to HDD
* @cancel_roc_done: Cancel roc done event
*/
struct p2p_soc_priv_obj {
struct wlan_objmgr_psoc *soc;
qdf_list_t roc_q;
qdf_list_t tx_q_roc;
qdf_list_t tx_q_ack;
uint16_t scan_req_id;
struct p2p_start_param *start_param;
qdf_event_t cancel_roc_done;
};
/**
* struct p2p_vdev_priv_obj - Per vdev p2p private object
* @vdev: Pointer to vdev context
* @noa_info: NoA information
*/
struct p2p_vdev_priv_obj {
struct wlan_objmgr_vdev *vdev;
struct p2p_noa_info *noa_info;
};
/**
* p2p_component_init() - P2P component initialization
*
* This function registers psoc/vdev create/delete handler.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS p2p_component_init(void);
/**
* p2p_component_deinit() - P2P component de-init
*
* This function deregisters psoc/vdev create/delete handler.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS p2p_component_deinit(void);
/**
* p2p_psoc_open() - Open P2P component
* @soc: soc context
*
* This function initialize p2p psoc object
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS p2p_psoc_open(struct wlan_objmgr_psoc *soc);
/**
* p2p_psoc_close() - Close P2P component
* @soc: soc context
*
* This function de-init p2p psoc object.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS p2p_psoc_close(struct wlan_objmgr_psoc *soc);
/**
* p2p_psoc_start() - Start P2P component
* @soc: soc context
* @req: P2P start parameters
*
* This function sets up layer call back in p2p psoc object
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS p2p_psoc_start(struct wlan_objmgr_psoc *soc,
struct p2p_start_param *req);
/**
* p2p_psoc_stop() - Stop P2P component
* @soc: soc context
*
* This function clears up layer call back in p2p psoc object.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS p2p_psoc_stop(struct wlan_objmgr_psoc *soc);
/**
* p2p_process_cmd() - Process P2P messages in OS interface queue
* @msg: message information
*
* This function is main handler for P2P messages in OS interface
* queue, it gets called by message scheduler.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS p2p_process_cmd(struct scheduler_msg *msg);
/**
* p2p_process_evt() - Process P2P messages in target interface queue
* @msg: message information
*
* This function is main handler for P2P messages in target interface
* queue, it gets called by message scheduler.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS p2p_process_evt(struct scheduler_msg *msg);
/**
* p2p_process_lo_stop() - Process lo stop event
* @lo_stop_event: listen offload stop event information
*
* This function handles listen offload stop event and deliver this
* event to HDD layer by registered callback.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS p2p_process_lo_stop(
struct p2p_lo_stop_event *lo_stop_event);
/**
* p2p_process_noa() - Process noa event
* @noa_event: noa event information
*
* This function handles noa event and save noa information in p2p
* vdev object.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS p2p_process_noa(struct p2p_noa_event *noa_event);
#endif /* _WLAN_P2P_MAIN_H_ */

View File

@@ -0,0 +1,112 @@
/*
* Copyright (c) 2017 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
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Defines off channel tx API & structures
*/
#ifndef _WLAN_P2P_OFF_CHAN_TX_H_
#define _WLAN_P2P_OFF_CHAN_TX_H_
#include <qdf_types.h>
#include <qdf_mc_timer.h>
struct p2p_soc_priv_obj;
struct cancel_roc_context;
struct p2p_tx_conf_event;
struct p2p_rx_mgmt_event;
/**
* struct tx_action_context - tx action frame context
* @node: Node for next element in the list
* @p2p_soc_obj: Pointer to SoC global p2p private object
* @vdev_id: Vdev id on which this request has come
* @scan_id: Scan id given by scan component for this roc req
* @action_cookie: Action cookie
* @chan: Chan for which this tx has been requested
* @buf: tx buffer
* @buf_len: Length of tx buffer
* @off_chan: Is this off channel tx
* @no_cck: Required cck or not
* @no_ack: Required ack or not
* @duration: Duration for the RoC
* @tx_timer: RoC timer
*/
struct tx_action_context {
qdf_list_node_t node;
struct p2p_soc_priv_obj *p2p_soc_obj;
int vdev_id;
int scan_id;
uint64_t action_cookie;
uint8_t chan;
uint8_t *buf;
int buf_len;
bool off_chan;
bool no_cck;
bool no_ack;
uint32_t duration;
qdf_mc_timer_t tx_timer;
};
/**
* p2p_process_mgmt_tx() - Process mgmt frame tx request
* @tx_ctx: tx context
*
* This function handles mgmt frame tx request. It will call API from
* mgmt txrx component.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS p2p_process_mgmt_tx(struct tx_action_context *tx_ctx);
/**
* p2p_process_mgmt_tx_cancel() - Process cancel mgmt frame tx request
* @cancel_tx: cancel tx context
*
* This function cancel mgmt frame tx request by cookie.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS p2p_process_mgmt_tx_cancel(
struct cancel_roc_context *cancel_tx);
/**
* p2p_process_mgmt_tx_ack_cnf() - Process tx ack event
* @tx_cnf_event: tx confirmation event information
*
* This function mgmt frame tx confirmation. It will deliver this
* event to HDD
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS p2p_process_mgmt_tx_ack_cnf(
struct p2p_tx_conf_event *tx_cnf_event);
/**
* p2p_process_rx_mgmt() - Process rx mgmt frame event
* @rx_mgmt_event: rx mgmt frame event information
*
* This function mgmt frame rx mgmt frame event. It will deliver this
* event to HDD
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS p2p_process_rx_mgmt(
struct p2p_rx_mgmt_event *rx_mgmt_event);
#endif /* _WLAN_P2P_OFF_CHAN_TX_H_ */

View File

@@ -0,0 +1,136 @@
/*
* Copyright (c) 2017 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
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Defines RoC API & structures
*/
#ifndef _WLAN_P2P_ROC_H_
#define _WLAN_P2P_ROC_H_
#include <qdf_types.h>
#include <qdf_mc_timer.h>
#define P2P_EVENT_PROPOGATE_TIME 10
struct wlan_objmgr_vdev;
struct scan_event;
/**
* enum roc_type - user requested or off channel tx
* @USER_REQUESTED: Requested by supplicant
* @OFF_CHANNEL_TX: Issued internally for off channel tx
*/
enum roc_type {
USER_REQUESTED,
OFF_CHANNEL_TX,
};
/**
* enum roc_state - P2P RoC state
* @ROC_STATE_IDLE: RoC not yet started or completed
* @ROC_STATE_REQUESTED: Sent scan command to scan manager
* @ROC_STATE_STARTED: Got started event from scan manager
* @ROC_STATE_ON_CHAN: Got foreign channel event from SCM
* @ROC_STATE_CANCEL_IN_PROG: Requested abort scan to SCM
* @ROC_STATE_INVALID: We should not come to this state
*/
enum roc_state {
ROC_STATE_IDLE = 0,
ROC_STATE_REQUESTED,
ROC_STATE_STARTED,
ROC_STATE_ON_CHAN,
ROC_STATE_CANCEL_IN_PROG,
ROC_STATE_INVALID,
};
/**
* struct p2p_roc_context - RoC request context
* @node: Node for next element in the list
* @p2p_soc_obj: Pointer to SoC global p2p private object
* @vdev_id: Vdev id on which this request has come
* @scan_id: Scan id given by scan component for this roc req
* @cookie: Cookie which is given to supplicant for this roc req
* @chan: Chan for which this RoC has been requested
* @phy_mode: PHY mode
* @duration: Duration for the RoC
* @roc_type: RoC type User requested or internal
* @roc_timer: RoC timer
* @roc_state: Roc state
*/
struct p2p_roc_context {
qdf_list_node_t node;
struct p2p_soc_priv_obj *p2p_soc_obj;
uint32_t vdev_id;
uint32_t scan_id;
uint64_t cookie;
uint8_t chan;
uint8_t phy_mode;
uint32_t duration;
enum roc_type roc_type;
qdf_mc_timer_t roc_timer;
enum roc_state roc_state;
};
/**
* struct cancel_roc_context - p2p cancel roc context
* @p2p_soc_obj: Pointer to SoC global p2p private object
* @cookie: Cookie which is given by supplicant
*/
struct cancel_roc_context {
struct p2p_soc_priv_obj *p2p_soc_obj;
uint64_t cookie;
};
/**
* p2p_process_roc_req() - Process roc request
* @roc_ctx: roc request context
*
* This function handles roc request. It will call API from scan/mgmt
* txrx component.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS p2p_process_roc_req(struct p2p_roc_context *roc_ctx);
/**
* p2p_process_cancel_roc_req() - Process cancel roc request
* @cancel_roc_ctx: cancel roc request context
*
* This function cancel roc request by cookie.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS p2p_process_cancel_roc_req(
struct cancel_roc_context *cancel_roc_ctx);
/**
* p2p_scan_event_cb() - Process scan event
* @vdev: vdev associated to this scan event
* @event: event type
* @arg: registered arguments
*
* This function handles P2P scan event and deliver P2P event to HDD
* layer by registered callback.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
void p2p_scan_event_cb(struct wlan_objmgr_vdev *vdev,
struct scan_event *event, void *arg);
#endif /* _WLAN_P2P_ROC_H_ */

View File

@@ -0,0 +1,526 @@
/*
* Copyright (c) 2017 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
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: This file contains main P2P function definitions
*/
#include <scheduler_api.h>
#include <wlan_objmgr_psoc_obj.h>
#include <wlan_objmgr_global_obj.h>
#include <wlan_objmgr_pdev_obj.h>
#include <wlan_objmgr_vdev_obj.h>
#include <wlan_objmgr_peer_obj.h>
#include "wlan_p2p_public_struct.h"
#include "wlan_p2p_ucfg_api.h"
#include "wlan_p2p_tgt_api.h"
#include "../inc/wlan_p2p_main.h"
#include "../inc/wlan_p2p_roc.h"
#include "../inc/wlan_p2p_off_chan_tx.h"
/**
* p2p_psoc_obj_create_notification() - Function to allocate per P2P
* soc private object
* @soc: soc context
* @data: Pointer to data
*
* This function gets called from object manager when psoc is being
* created and creates p2p soc context.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
static QDF_STATUS p2p_psoc_obj_create_notification(
struct wlan_objmgr_psoc *soc, void *data)
{
struct p2p_soc_priv_obj *p2p_soc_obj;
QDF_STATUS status;
if (soc == NULL) {
p2p_err("psoc context passed is NULL");
return QDF_STATUS_E_INVAL;
}
p2p_soc_obj = qdf_mem_malloc(sizeof(*p2p_soc_obj));
if (p2p_soc_obj == NULL) {
p2p_err("Failed to allocate p2p soc private object");
return QDF_STATUS_E_NOMEM;
}
p2p_soc_obj->soc = soc;
status = wlan_objmgr_psoc_component_obj_attach(soc,
WLAN_UMAC_COMP_P2P, p2p_soc_obj,
QDF_STATUS_SUCCESS);
if (status != QDF_STATUS_SUCCESS) {
qdf_mem_free(p2p_soc_obj);
p2p_err("Failed to attach p2p component, %d", status);
return status;
}
return QDF_STATUS_SUCCESS;
}
/**
* p2p_psoc_obj_destroy_notification() - Free soc private object
* @soc: soc context
* @data: Pointer to data
*
* This function gets called from object manager when psoc is being
* deleted and delete p2p soc context.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
static QDF_STATUS p2p_psoc_obj_destroy_notification(
struct wlan_objmgr_psoc *soc, void *data)
{
struct p2p_soc_priv_obj *p2p_soc_obj;
QDF_STATUS status;
if (soc == NULL) {
p2p_err("psoc context passed is NULL");
return QDF_STATUS_E_INVAL;
}
p2p_soc_obj = wlan_objmgr_psoc_get_comp_private_obj(soc,
WLAN_UMAC_COMP_P2P);
if (p2p_soc_obj == NULL) {
p2p_err("p2p soc private object is NULL");
return QDF_STATUS_E_FAILURE;
}
status = wlan_objmgr_psoc_component_obj_detach(soc,
WLAN_UMAC_COMP_P2P, p2p_soc_obj);
if (status != QDF_STATUS_SUCCESS) {
p2p_err("Failed to detach p2p component, %d", status);
return status;
}
qdf_mem_free(p2p_soc_obj);
return QDF_STATUS_SUCCESS;
}
/**
* p2p_vdev_obj_create_notification() - Allocate per p2p vdev object
* @vdev: vdev context
* @data: Pointer to data
*
* This function gets called from object manager when vdev is being
* created and creates p2p vdev context.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
static QDF_STATUS p2p_vdev_obj_create_notification(
struct wlan_objmgr_vdev *vdev, void *data)
{
struct p2p_vdev_priv_obj *p2p_vdev_obj;
QDF_STATUS status;
if (vdev == NULL) {
p2p_err("vdev context passed is NULL");
return QDF_STATUS_E_INVAL;
}
p2p_vdev_obj = qdf_mem_malloc(sizeof(*p2p_vdev_obj));
if (p2p_vdev_obj == NULL) {
p2p_err("Failed to allocate p2p vdev object");
return QDF_STATUS_E_NOMEM;
}
p2p_vdev_obj->vdev = vdev;
status = wlan_objmgr_vdev_component_obj_attach(vdev,
WLAN_UMAC_COMP_P2P, p2p_vdev_obj,
QDF_STATUS_SUCCESS);
if (status != QDF_STATUS_SUCCESS) {
qdf_mem_free(p2p_vdev_obj);
p2p_err("Failed to attach p2p component to vdev, %d",
status);
return status;
}
return QDF_STATUS_SUCCESS;
}
/**
* p2p_vdev_obj_destroy_notification() - Free per P2P vdev object
* @vdev: vdev context
* @data: Pointer to data
*
* This function gets called from object manager when vdev is being
* deleted and delete p2p vdev context.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
static QDF_STATUS p2p_vdev_obj_destroy_notification(
struct wlan_objmgr_vdev *vdev, void *data)
{
struct p2p_vdev_priv_obj *p2p_vdev_obj;
QDF_STATUS status;
if (vdev == NULL) {
p2p_err("vdev context passed is NULL");
return QDF_STATUS_E_INVAL;
}
p2p_vdev_obj = wlan_objmgr_vdev_get_comp_private_obj(vdev,
WLAN_UMAC_COMP_P2P);
if (p2p_vdev_obj == NULL) {
p2p_err("p2p vdev object is NULL");
return QDF_STATUS_E_FAILURE;
}
status = wlan_objmgr_vdev_component_obj_detach(vdev,
WLAN_UMAC_COMP_P2P, p2p_vdev_obj);
if (status != QDF_STATUS_SUCCESS) {
p2p_err("Failed to detach p2p component, %d", status);
return status;
}
qdf_mem_free(p2p_vdev_obj);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS p2p_component_init(void)
{
QDF_STATUS status;
status = wlan_objmgr_register_psoc_create_handler(
WLAN_UMAC_COMP_P2P,
p2p_psoc_obj_create_notification,
NULL);
if (status != QDF_STATUS_SUCCESS) {
p2p_err("Failed to register p2p obj create handler");
goto err_reg_psoc_create;
}
status = wlan_objmgr_register_psoc_delete_handler(
WLAN_UMAC_COMP_P2P,
p2p_psoc_obj_destroy_notification,
NULL);
if (status != QDF_STATUS_SUCCESS) {
p2p_err("Failed to register p2p obj delete handler");
goto err_reg_psoc_delete;
}
status = wlan_objmgr_register_vdev_create_handler(
WLAN_UMAC_COMP_P2P,
p2p_vdev_obj_create_notification,
NULL);
if (status != QDF_STATUS_SUCCESS) {
p2p_err("Failed to register p2p vdev create handler");
goto err_reg_vdev_create;
}
status = wlan_objmgr_register_vdev_delete_handler(
WLAN_UMAC_COMP_P2P,
p2p_vdev_obj_destroy_notification,
NULL);
if (status != QDF_STATUS_SUCCESS) {
p2p_err("Failed to register p2p vdev delete handler");
goto err_reg_vdev_delete;
}
p2p_debug("Register p2p obj handler successful");
return QDF_STATUS_SUCCESS;
err_reg_vdev_delete:
wlan_objmgr_unregister_vdev_create_handler(WLAN_UMAC_COMP_P2P,
p2p_vdev_obj_create_notification, NULL);
err_reg_vdev_create:
wlan_objmgr_unregister_psoc_delete_handler(WLAN_UMAC_COMP_P2P,
p2p_psoc_obj_destroy_notification, NULL);
err_reg_psoc_delete:
wlan_objmgr_unregister_psoc_create_handler(WLAN_UMAC_COMP_P2P,
p2p_psoc_obj_create_notification, NULL);
err_reg_psoc_create:
return status;
}
QDF_STATUS p2p_component_deinit(void)
{
QDF_STATUS status;
QDF_STATUS ret_status = QDF_STATUS_SUCCESS;
status = wlan_objmgr_unregister_vdev_create_handler(
WLAN_UMAC_COMP_P2P,
p2p_vdev_obj_create_notification,
NULL);
if (status != QDF_STATUS_SUCCESS) {
p2p_err("Failed to unregister p2p vdev create handler, %d",
status);
ret_status = status;
}
status = wlan_objmgr_unregister_vdev_delete_handler(
WLAN_UMAC_COMP_P2P,
p2p_vdev_obj_destroy_notification,
NULL);
if (status != QDF_STATUS_SUCCESS) {
p2p_err("Failed to unregister p2p vdev delete handler, %d",
status);
ret_status = status;
}
status = wlan_objmgr_unregister_psoc_create_handler(
WLAN_UMAC_COMP_P2P,
p2p_psoc_obj_create_notification,
NULL);
if (status != QDF_STATUS_SUCCESS) {
p2p_err("Failed to unregister p2p obj create handler, %d",
status);
ret_status = status;
}
status = wlan_objmgr_unregister_psoc_delete_handler(
WLAN_UMAC_COMP_P2P,
p2p_psoc_obj_destroy_notification,
NULL);
if (status != QDF_STATUS_SUCCESS) {
p2p_err("Failed to unregister p2p obj delete handler, %d",
status);
ret_status = status;
}
p2p_debug("Unregister p2p obj handler complete");
return ret_status;
}
QDF_STATUS p2p_psoc_open(struct wlan_objmgr_psoc *soc)
{
struct p2p_soc_priv_obj *p2p_soc_obj;
if (soc == NULL) {
p2p_err("psoc context passed is NULL");
return QDF_STATUS_E_INVAL;
}
p2p_soc_obj = wlan_objmgr_psoc_get_comp_private_obj(soc,
WLAN_UMAC_COMP_P2P);
if (p2p_soc_obj == NULL) {
p2p_err("p2p soc priviate object is NULL");
return QDF_STATUS_E_FAILURE;
}
qdf_list_create(&p2p_soc_obj->roc_q, MAX_QUEUE_LENGTH);
qdf_list_create(&p2p_soc_obj->tx_q_roc, MAX_QUEUE_LENGTH);
qdf_list_create(&p2p_soc_obj->tx_q_ack, MAX_QUEUE_LENGTH);
qdf_event_create(&p2p_soc_obj->cancel_roc_done);
/*TODO, register scan event, wmi lo and noa event */
p2p_debug("p2p psoc object open successful");
return QDF_STATUS_SUCCESS;
}
QDF_STATUS p2p_psoc_close(struct wlan_objmgr_psoc *soc)
{
struct p2p_soc_priv_obj *p2p_soc_obj;
if (soc == NULL) {
p2p_err("psoc context passed is NULL");
return QDF_STATUS_E_INVAL;
}
p2p_soc_obj = wlan_objmgr_psoc_get_comp_private_obj(soc,
WLAN_UMAC_COMP_P2P);
if (p2p_soc_obj == NULL) {
p2p_err("p2p soc object is NULL");
return QDF_STATUS_E_FAILURE;
}
qdf_list_destroy(&p2p_soc_obj->roc_q);
qdf_list_destroy(&p2p_soc_obj->tx_q_roc);
qdf_list_destroy(&p2p_soc_obj->tx_q_ack);
/*TODO, ucfg_scan_clear_requestor_id(soc, p2p_soc_obj->scan_req_id);*/
p2p_debug("p2p psoc object close successful");
return QDF_STATUS_SUCCESS;
}
QDF_STATUS p2p_psoc_start(struct wlan_objmgr_psoc *soc,
struct p2p_start_param *req)
{
struct p2p_soc_priv_obj *p2p_soc_obj;
struct p2p_start_param *start_param;
if (soc == NULL) {
p2p_err("psoc context passed is NULL");
return QDF_STATUS_E_INVAL;
}
p2p_soc_obj = wlan_objmgr_psoc_get_comp_private_obj(soc,
WLAN_UMAC_COMP_P2P);
if (p2p_soc_obj == NULL) {
p2p_err("P2P soc object is NULL");
return QDF_STATUS_E_FAILURE;
}
start_param = qdf_mem_malloc(sizeof(*start_param));
if (start_param == NULL) {
p2p_err("Failed to allocate start params");
return QDF_STATUS_E_NOMEM;
}
start_param->rx_cb = req->rx_cb;
start_param->rx_cb_data = req->rx_cb_data;
start_param->event_cb = req->event_cb;
start_param->event_cb_data = req->event_cb_data;
start_param->tx_cnf_cb = req->tx_cnf_cb;
start_param->tx_cnf_cb_data = req->tx_cnf_cb_data;
start_param->lo_event_cb = req->lo_event_cb;
start_param->lo_event_cb_data = req->lo_event_cb_data;
p2p_soc_obj->start_param = start_param;
p2p_debug("p2p psoc start successful");
return QDF_STATUS_SUCCESS;
}
QDF_STATUS p2p_psoc_stop(struct wlan_objmgr_psoc *soc)
{
struct p2p_soc_priv_obj *p2p_soc_obj;
struct p2p_start_param *start_param;
if (soc == NULL) {
p2p_err("psoc context passed is NULL");
return QDF_STATUS_E_INVAL;
}
p2p_soc_obj = wlan_objmgr_psoc_get_comp_private_obj(soc,
WLAN_UMAC_COMP_P2P);
if (p2p_soc_obj == NULL) {
p2p_err("P2P soc object is NULL");
return QDF_STATUS_E_FAILURE;
}
start_param = p2p_soc_obj->start_param;
p2p_soc_obj->start_param = NULL;
if (start_param == NULL) {
p2p_err("start parameters is NULL");
return QDF_STATUS_E_FAILURE;
}
start_param->rx_cb = NULL;
start_param->rx_cb_data = NULL;
start_param->event_cb = NULL;
start_param->event_cb_data = NULL;
start_param->tx_cnf_cb = NULL;
start_param->tx_cnf_cb_data = NULL;
qdf_mem_free(start_param);
p2p_debug("p2p psoc stop successful");
return QDF_STATUS_SUCCESS;
}
QDF_STATUS p2p_process_cmd(struct scheduler_msg *msg)
{
QDF_STATUS status;
p2p_info("msg type %d", msg->type);
if (msg->bodyptr == NULL) {
p2p_err("Invalid message body");
return QDF_STATUS_E_INVAL;
}
switch (msg->type) {
case P2P_ROC_REQ:
status = p2p_process_roc_req(
(struct p2p_roc_context *)
msg->bodyptr);
break;
case P2P_CANCEL_ROC_REQ:
status = p2p_process_cancel_roc_req(
(struct cancel_roc_context *)
msg->bodyptr);
break;
case P2P_MGMT_TX:
status = p2p_process_mgmt_tx(
(struct tx_action_context *)
msg->bodyptr);
break;
case P2P_MGMT_TX_CANCEL:
status = p2p_process_mgmt_tx_cancel(
(struct cancel_roc_context *)
msg->bodyptr);
break;
default:
p2p_err("drop unexpected message received %d",
msg->type);
status = QDF_STATUS_E_INVAL;
break;
}
qdf_mem_free(msg->bodyptr);
msg->bodyptr = NULL;
return status;
}
QDF_STATUS p2p_process_evt(struct scheduler_msg *msg)
{
QDF_STATUS status;
p2p_info("msg type %d", msg->type);
if (msg->bodyptr == NULL) {
p2p_err("Invalid message body");
return QDF_STATUS_E_INVAL;
}
switch (msg->type) {
case P2P_EVENT_MGMT_TX_ACK_CNF:
status = p2p_process_mgmt_tx_ack_cnf(
(struct p2p_tx_conf_event *)
msg->bodyptr);
break;
case P2P_EVENT_RX_MGMT:
status = p2p_process_rx_mgmt(
(struct p2p_rx_mgmt_event *)
msg->bodyptr);
break;
case P2P_EVENT_LO_STOPPED:
status = p2p_process_lo_stop(
(struct p2p_lo_stop_event *)
msg->bodyptr);
break;
case P2P_EVENT_NOA:
status = p2p_process_noa(
(struct p2p_noa_event *)
msg->bodyptr);
break;
default:
p2p_err("Drop unexpected message received %d",
msg->type);
status = QDF_STATUS_E_INVAL;
break;
}
qdf_mem_free(msg->bodyptr);
msg->bodyptr = NULL;
return status;
}
QDF_STATUS p2p_process_lo_stop(
struct p2p_lo_stop_event *lo_stop_event)
{
return QDF_STATUS_SUCCESS;
}
QDF_STATUS p2p_process_noa(struct p2p_noa_event *noa_event)
{
return QDF_STATUS_SUCCESS;
}

View File

@@ -0,0 +1,47 @@
/*
* Copyright (c) 2017 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
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: This file contains off channel tx API definitions
*/
#include <wlan_utility.h>
#include "../inc/wlan_p2p_off_chan_tx.h"
QDF_STATUS p2p_process_mgmt_tx(struct tx_action_context *tx_ctx)
{
return QDF_STATUS_SUCCESS;
}
QDF_STATUS p2p_process_mgmt_tx_cancel(
struct cancel_roc_context *cancel_tx)
{
return QDF_STATUS_SUCCESS;
}
QDF_STATUS p2p_process_mgmt_tx_ack_cnf(
struct p2p_tx_conf_event *tx_cnf_event)
{
return QDF_STATUS_SUCCESS;
}
QDF_STATUS p2p_process_rx_mgmt(
struct p2p_rx_mgmt_event *rx_mgmt_event)
{
return QDF_STATUS_SUCCESS;
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright (c) 2017 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
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: This file contains RoC API definitions
*/
#include "../inc/wlan_p2p_roc.h"
QDF_STATUS p2p_process_roc_req(struct p2p_roc_context *roc_ctx)
{
return QDF_STATUS_SUCCESS;
}
QDF_STATUS p2p_process_cancel_roc_req(
struct cancel_roc_context *cancel_roc_ctx)
{
return QDF_STATUS_SUCCESS;
}
void p2p_scan_event_cb(struct wlan_objmgr_vdev *vdev,
struct scan_event *event, void *arg)
{
}

View File

@@ -0,0 +1,182 @@
/*
* Copyright (c) 2011-2017 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
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Contains p2p public data structure definations
*/
#ifndef _WLAN_P2P_PUBLIC_STRUCT_H_
#define _WLAN_P2P_PUBLIC_STRUCT_H_
#include <qdf_types.h>
/**
* struct p2p_roc_req - P2P roc request
* @vdev_id: Vdev id on which this request has come
* @chan: Chan for which this RoC has been requested
* @phy_mode: PHY mode
* @duration: Duration for the RoC
*/
struct p2p_roc_req {
uint32_t vdev_id;
uint32_t chan;
uint32_t phy_mode;
uint32_t duration;
};
/**
* enum p2p_roc_event - P2P RoC event
* @ROC_EVENT_READY_ON_CHAN: RoC has started now
* @ROC_EVENT_COMPLETED: RoC has been completed
* @ROC_EVENT_INAVLID: Invalid event
*/
enum p2p_roc_event {
ROC_EVENT_READY_ON_CHAN = 0,
ROC_EVENT_COMPLETED,
ROC_EVENT_INAVLID,
};
/**
* struct p2p_event - p2p event
* @vdev_id: Vdev id
* @roc_event: RoC event
* @cookie: Cookie which is given to supplicant for this roc req
* @chan: Chan for which this RoC has been requested
* @duration: Duration for the RoC
*/
struct p2p_event {
uint32_t vdev_id;
enum p2p_roc_event roc_event;
uint64_t cookie;
uint32_t chan;
uint32_t duration;
};
/**
* struct p2p_rx_mgmt_frame - rx mgmt frame structure
* @frame_len: Frame length
* @rx_chan: RX channel
* @vdev_id: Vdev id
* @frm_type: Frame type
* @rx_rssi: RX rssi
* @buf: Buffer address
*/
struct p2p_rx_mgmt_frame {
uint32_t frame_len;
uint32_t rx_chan;
uint32_t vdev_id;
uint32_t frm_type;
uint32_t rx_rssi;
uint8_t buf[1];
};
/**
* struct p2p_tx_cnf - tx confirm structure
* @vdev_id: Vdev id
* @action_cookie: TX cookie for this action frame
* @buf_len: Frame length
* @status: TX status
* @buf: Buffer address
*/
struct p2p_tx_cnf {
uint32_t vdev_id;
uint64_t action_cookie;
uint32_t buf_len;
uint32_t status;
uint8_t *buf;
};
/**
* struct p2p_mgmt_tx - p2p mgmt tx structure
* @vdev_id: Vdev id
* @chan: Chan for which this RoC has been requested
* @wait: Duration for the RoC
* @len: Length of tx buffer
* @no_cck: Required cck or not
* @dont_wait_for_ack: Wait for ack or not
* @buf: TX buffer
*/
struct p2p_mgmt_tx {
uint32_t vdev_id;
uint32_t chan;
uint32_t wait;
uint32_t len;
uint32_t no_cck;
uint32_t dont_wait_for_ack;
const uint8_t *buf;
};
/**
* struct p2p_ps_config
* @vdev_id: Vdev id
* @opp_ps: Opportunistic power save
* @ct_window: CT window
* @count: Count
* @duration: Duration
* @interval: Interval
* @single_noa_duration: Single shot noa duration
* @ps_selection: power save selection
*/
struct p2p_ps_config {
uint32_t vdev_id;
uint32_t opp_ps;
uint32_t ct_window;
uint32_t count;
uint32_t duration;
uint32_t interval;
uint32_t single_noa_duration;
uint32_t ps_selection;
};
/**
* struct p2p_lo_start - p2p listen offload start
* @vdev_id: Vdev id
* @ctl_flags: Control flag
* @freq: P2P listen frequency
* @period: Listen offload period
* @interval: Listen offload interval
* @count: Number listen offload intervals
* @dev_types_len: Device types length
* @probe_resp_len: Probe response template length
* @device_types: Device types
* @probe_resp_tmplt: Probe response template
*/
struct p2p_lo_start {
uint32_t vdev_id;
uint32_t ctl_flags;
uint32_t freq;
uint32_t period;
uint32_t interval;
uint32_t count;
uint32_t dev_types_len;
uint32_t probe_resp_len;
uint8_t *device_types;
uint8_t *probe_resp_tmplt;
};
/**
* struct p2p_lo_event
* @vdev_id: Vdev id
* @reason_code: reason code
*/
struct p2p_lo_event {
uint32_t vdev_id;
uint32_t reason_code;
};
#endif /* _WLAN_P2P_PUBLIC_STRUCT_H_ */

View File

@@ -0,0 +1,125 @@
/*
* Copyright (c) 2017 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
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Contains p2p south bound interface definitions
*/
#ifndef _WLAN_P2P_TGT_API_H_
#define _WLAN_P2P_TGT_API_H_
#include <qdf_types.h>
struct scan_event;
struct wlan_objmgr_psoc;
struct wlan_objmgr_peer;
enum mgmt_frame_type;
/**
* tgt_p2p_scan_event_cb() - Callback for scan event
* @vdev: vdev id
* @event: event type
* @arg: registered arguments
*
* This function gets called from scan component when getting P2P
* scan event.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS tgt_p2p_scan_event_cb(uint8_t vdev,
struct scan_event *event, void *arg);
/**
* tgt_p2p_mgmt_download_comp_cb() - Callback for mgmt frame tx
* complete
* @context: tx context
* @buf: buffer address
* @free: need to free or not
*
* This function gets called from mgmt tx/rx component when mgmt
* frame tx complete.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS tgt_p2p_mgmt_download_comp_cb(void *context,
qdf_nbuf_t buf, bool free);
/**
* tgt_p2p_mgmt_ota_comp_cb() - Callback for mgmt frame tx ack
* @context: tx context
* @buf: buffer address
* @status: tx status
* @tx_compl_params: tx complete parameters
*
* This function gets called from mgmt tx/rx component when getting
* mgmt frame tx ack.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS tgt_p2p_mgmt_ota_comp_cb(void *context, qdf_nbuf_t buf,
uint32_t status, void *tx_compl_params);
/**
* tgt_p2p_mgmt_frame_rx_cb() - Callback for rx mgmt frame
* @psoc: soc context
* @peer: peer context
* @buf: rx buffer
* @params: rx parameters
* @frm_type: frame type
*
* This function gets called from mgmt tx/rx component when rx mgmt
* frame.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS tgt_p2p_mgmt_frame_rx_cb(
struct wlan_objmgr_psoc *psoc,
struct wlan_objmgr_peer *peer,
qdf_nbuf_t buf, void *params,
enum mgmt_frame_type frm_type);
/**
* tgt_p2p_noa_event_cb() - Callback for noa event
* @data:
* @event_buf: event buffer
* @len: buffer length
*
* This function gets called from WMI when triggered WMI event
* WMI_P2P_NOA_EVENTID.
*
* Return: 0 - success
* others - failure
*/
int tgt_p2p_noa_event_cb(void *data, uint8_t *event_buf,
uint32_t len);
/**
* tgt_p2p_lo_event_cb() - Listen offload stop request
* @data:
* @event_buf: event buffer
* @len: buffer length
*
* This function gets called from WMI when triggered WMI event
* WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID.
*
* Return: 0 - success
* others - failure
*/
int tgt_p2p_lo_event_cb(void *data, uint8_t *event_buf, uint32_t len);
#endif /* _WLAN_P2P_TGT_API_H_ */

View File

@@ -0,0 +1,265 @@
/*
* Copyright (c) 2017 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
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Contains p2p north bound interface definitions
*/
#ifndef _WLAN_P2P_UCFG_API_H_
#define _WLAN_P2P_UCFG_API_H_
#include <qdf_types.h>
struct wlan_objmgr_psoc;
struct p2p_roc_req;
struct p2p_event;
struct p2p_rx_mgmt_frame;
struct p2p_tx_cnf;
struct p2p_mgmt_tx;
struct p2p_ps_config;
struct p2p_lo_start;
struct p2p_lo_event;
/**
* p2p_rx_callback() - Callback for rx mgmt frame
* @user_data: user data associated to this rx mgmt frame.
* @rx_frame: RX mgmt frame
*
* This callback will be used to give rx frames to hdd.
*
* Return: None
*/
typedef void (*p2p_rx_callback)(void *user_data,
struct p2p_rx_mgmt_frame *rx_frame);
/**
* p2p_action_tx_cnf_callback() - Callback for tx confirmation
* @user_data: user data associated to this tx confirmation
* @tx_cnf: tx confirmation information
*
* This callback will be used to give tx mgmt frame confirmation to
* hdd.
*
* Return: None
*/
typedef void (*p2p_action_tx_cnf_callback)(void *user_data,
struct p2p_tx_cnf *tx_cnf);
/**
* p2p_lo_event_callback() - Callback for listen offload event
* @user_data: user data associated to this lo event
* @p2p_lo_event: listen offload event information
*
* This callback will be used to give listen offload event to hdd.
*
* Return: None
*/
typedef void (*p2p_lo_event_callback)(void *user_data,
struct p2p_lo_event *p2p_lo_event);
/**
* p2p_event_callback() - Callback for P2P event
* @user_data: user data associated to this p2p event
* @p2p_event: p2p event information
*
* This callback will be used to give p2p event to hdd.
*
* Return: None
*/
typedef void (*p2p_event_callback)(void *user_data,
struct p2p_event *p2p_event);
/**
* struct p2p_start_param - p2p soc start parameters. Below callbacks
* will be registered by the HDD
* @rx_callback: Function pointer to hdd rx callback. This
* function will be used to give rx frames to hdd
* @rx_cb_data: RX callback user data
* @event_cb: Founction pointer to hdd p2p event callback.
* This function will be used to give p2p event
* to hdd
* @event_cb_data: Pointer to p2p event callback user data
* @tx_cnf_cb: Function pointer to hdd tx confirm callback.
* This function will be used to give tx confirm
* to hdd
* @tx_cnf_cb_data: Pointer to p2p tx confirm callback user data
* @lo_event_cb: Founction pointer to p2p listen offload
* callback. This function will be used to give
* listen offload stopped event to hdd
* @lo_event_cb_data: Pointer to p2p listen offload callback user data
*/
struct p2p_start_param {
p2p_rx_callback rx_cb;
void *rx_cb_data;
p2p_event_callback event_cb;
void *event_cb_data;
p2p_action_tx_cnf_callback tx_cnf_cb;
void *tx_cnf_cb_data;
p2p_lo_event_callback lo_event_cb;
void *lo_event_cb_data;
};
/**
* ucfg_p2p_init() - P2P component initialization
*
* This function gets called when dispatcher initializing.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS ucfg_p2p_init(void);
/**
* ucfg_p2p_deinit() - P2P component de-init
*
* This function gets called when dispatcher de-init.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS ucfg_p2p_deinit(void);
/**
* ucfg_p2p_psoc_open() - Open P2P component
* @soc: soc context
*
* This function gets called when dispatcher opening.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS ucfg_p2p_psoc_open(struct wlan_objmgr_psoc *soc);
/**
* ucfg_p2p_psoc_close() - Close P2P component
* @soc: soc context
*
* This function gets called when dispatcher closing.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS ucfg_p2p_psoc_close(struct wlan_objmgr_psoc *soc);
/**
* ucfg_p2p_psoc_start() - Start P2P component
* @soc: soc context
* @req: P2P start parameters
*
* This function gets called when up layer starting up.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS ucfg_p2p_psoc_start(struct wlan_objmgr_psoc *soc,
struct p2p_start_param *req);
/**
* ucfg_p2p_psoc_stop() - Stop P2P component
* @soc: soc context
*
* This function gets called when up layer exit.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS ucfg_p2p_psoc_stop(struct wlan_objmgr_psoc *soc);
/**
* ucfg_p2p_roc_req() - Roc request
* @soc: soc context
* @roc_req: Roc request parameters
* @cookie: return cookie to caller
*
* This function delivers roc request to P2P component.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS ucfg_p2p_roc_req(struct wlan_objmgr_psoc *soc,
struct p2p_roc_req *roc_req, uint64_t *cookie);
/**
* ucfg_p2p_roc_cancel_req() - Cancel roc request
* @soc: soc context
* @cookie: Find out the roc request by cookie
*
* This function delivers cancel roc request to P2P component.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS ucfg_p2p_roc_cancel_req(struct wlan_objmgr_psoc *soc,
uint64_t cookie);
/**
* ucfg_p2p_mgmt_tx() - Mgmt frame tx request
* @soc: soc context
* @mgmt_frm: TX mgmt frame parameters
* @cookie: Return the cookie to caller
*
* This function delivers mgmt frame tx request to P2P component.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS ucfg_p2p_mgmt_tx(struct wlan_objmgr_psoc *soc,
struct p2p_mgmt_tx *mgmt_frm, uint64_t *cookie);
/**
* ucfg_p2p_mgmt_tx_cancel() - Cancel mgmt frame tx request
* @soc: soc context
* @cookie: Find out the mgmt tx request by cookie
*
* This function delivers cancel mgmt frame tx request request to P2P
* component.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS ucfg_p2p_mgmt_tx_cancel(struct wlan_objmgr_psoc *soc,
uint64_t cookie);
/**
* ucfg_p2p_set_ps() - P2P set power save
* @soc: soc context
* @ps_config: power save configure
*
* This function delivers p2p power save request to P2P component.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS ucfg_p2p_set_ps(struct wlan_objmgr_psoc *soc,
struct p2p_ps_config *ps_config);
/**
* ucfg_p2p_lo_start() - Listen offload start request
* @soc: soc context
* @p2p_lo_start: lo start parameters
*
* This function delivers listen offload start request to P2P
* component.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS ucfg_p2p_lo_start(struct wlan_objmgr_psoc *soc,
struct p2p_lo_start *p2p_lo_start);
/**
* ucfg_p2p_lo_stop() - Listen offload stop request
* @soc: soc context
* @vdev_id: vdev id
*
* This function delivers listen offload stop request to P2P component.
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS ucfg_p2p_lo_stop(struct wlan_objmgr_psoc *soc,
uint32_t vdev_id);
#endif /* _WLAN_P2P_UCFG_API_H_ */

View File

@@ -0,0 +1,66 @@
/*
* Copyright (c) 2017 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
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: This file contains p2p south bound interface definitions
*/
#include <wlan_objmgr_psoc_obj.h>
#include <wlan_mgmt_txrx_utils_api.h>
#include "wlan_p2p_tgt_api.h"
#include "../../core/inc/wlan_p2p_main.h"
QDF_STATUS tgt_p2p_scan_event_cb(uint8_t vdev,
struct scan_event *event, void *arg)
{
/* call p2p_process_scan_event directly*/
/* since this is from target thread */
return QDF_STATUS_SUCCESS;
}
QDF_STATUS tgt_p2p_mgmt_download_comp_cb(void *context,
qdf_nbuf_t buf, bool free)
{
return QDF_STATUS_SUCCESS;
}
QDF_STATUS tgt_p2p_mgmt_ota_comp_cb(void *context, qdf_nbuf_t buf,
uint32_t status, void *tx_compl_params)
{
return QDF_STATUS_SUCCESS;
}
QDF_STATUS tgt_p2p_mgmt_frame_rx_cb(
struct wlan_objmgr_psoc *psoc,
struct wlan_objmgr_peer *peer,
qdf_nbuf_t buf, void *params,
enum mgmt_frame_type frm_type)
{
return QDF_STATUS_SUCCESS;
}
int tgt_p2p_noa_event_cb(void *data, uint8_t *event_buf,
uint32_t len)
{
return 0;
}
int tgt_p2p_lo_event_cb(void *data, uint8_t *event_buf, uint32_t len)
{
return 0;
}

View File

@@ -0,0 +1,101 @@
/*
* Copyright (c) 2017 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
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: This file contains p2p north bound interface definitions
*/
#include <wlan_objmgr_psoc_obj.h>
#include "wlan_p2p_ucfg_api.h"
#include "wlan_p2p_public_struct.h"
#include "../../core/inc/wlan_p2p_main.h"
#include "../../core/inc/wlan_p2p_roc.h"
#include "../../core/inc/wlan_p2p_off_chan_tx.h"
QDF_STATUS ucfg_p2p_init(void)
{
return p2p_component_init();
}
QDF_STATUS ucfg_p2p_deinit(void)
{
return p2p_component_deinit();
}
QDF_STATUS ucfg_p2p_psoc_open(struct wlan_objmgr_psoc *soc)
{
return p2p_psoc_open(soc);
}
QDF_STATUS ucfg_p2p_psoc_close(struct wlan_objmgr_psoc *soc)
{
return p2p_psoc_close(soc);
}
QDF_STATUS ucfg_p2p_psoc_start(struct wlan_objmgr_psoc *soc,
struct p2p_start_param *req)
{
return p2p_psoc_start(soc, req);
}
QDF_STATUS ucfg_p2p_psoc_stop(struct wlan_objmgr_psoc *soc)
{
return p2p_psoc_stop(soc);
}
QDF_STATUS ucfg_p2p_roc_req(struct wlan_objmgr_psoc *soc,
struct p2p_roc_req *roc_req, uint64_t *cookie)
{
return QDF_STATUS_SUCCESS;
}
QDF_STATUS ucfg_p2p_roc_cancel_req(struct wlan_objmgr_psoc *soc,
uint64_t cookie)
{
return QDF_STATUS_SUCCESS;
}
QDF_STATUS ucfg_p2p_mgmt_tx(struct wlan_objmgr_psoc *soc,
struct p2p_mgmt_tx *mgmt_frm, uint64_t *cookie)
{
return QDF_STATUS_SUCCESS;
}
QDF_STATUS ucfg_p2p_mgmt_tx_cancel(struct wlan_objmgr_psoc *soc,
uint64_t cookie)
{
return QDF_STATUS_SUCCESS;
}
QDF_STATUS ucfg_p2p_set_ps(struct wlan_objmgr_psoc *soc,
struct p2p_ps_config *ps_config)
{
return QDF_STATUS_SUCCESS;
}
QDF_STATUS ucfg_p2p_lo_start(struct wlan_objmgr_psoc *soc,
struct p2p_lo_start *p2p_lo_start)
{
return QDF_STATUS_SUCCESS;
}
QDF_STATUS ucfg_p2p_lo_stop(struct wlan_objmgr_psoc *soc,
uint32_t vdev_id)
{
return QDF_STATUS_SUCCESS;
}