qcacmn: IOT simulation module api

IOT simulation module api registration with umac.

Change-Id: I6f11781f79d5fc9ea28be02470ba288cdcbaa257
CRs-Fixed: 2659680
This commit is contained in:
Jayachandran Sreekumaran
2020-03-31 16:12:42 +05:30
committad av nshrivas
förälder d20fe7aad4
incheckning d281143698
7 ändrade filer med 197 tillägg och 4 borttagningar

Visa fil

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
*
*
* Permission to use, copy, modify, and/or distribute this software for
@@ -81,5 +81,20 @@ QDF_STATUS wlan_global_lmac_if_set_txops_registration_cb(WLAN_DEV_TYPE dev_type,
*/
QDF_STATUS wlan_lmac_if_sptrl_set_rx_ops_register_cb(void (*handler)
(struct wlan_lmac_if_rx_ops *));
#endif /* WLAN_CONV_SPECTRAL_ENABLE */
#ifdef WLAN_IOT_SIM_SUPPORT
/**
* wlan_lmac_if_iot_sim_set_rx_ops_register_cb ()- IOT_SIM LMAC Rx ops
* registration callback assignment
* @handler: Handler to be called for iot sim LMAC rx ops registration
*
* API to assign appropriate iot sim LMAC rx ops registration callback handler
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS wlan_lmac_if_iot_sim_set_rx_ops_register_cb(void (*handler)
(struct wlan_lmac_if_rx_ops *));
#endif
#endif /* _WLAN_LMAC_IF_API_H */

Visa fil

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
*
*
* Permission to use, copy, modify, and/or distribute this software for
@@ -78,6 +78,34 @@ static void wlan_spectral_register_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops)
}
#endif /*WLAN_CONV_SPECTRAL_ENABLE*/
#ifdef WLAN_IOT_SIM_SUPPORT
/* Function pointer for iot_sim rx_ops registration function */
void (*wlan_lmac_if_iot_sim_rx_ops)(struct wlan_lmac_if_rx_ops *rx_ops);
QDF_STATUS wlan_lmac_if_iot_sim_set_rx_ops_register_cb(void (*handler)
(struct wlan_lmac_if_rx_ops *))
{
wlan_lmac_if_iot_sim_rx_ops = handler;
return QDF_STATUS_SUCCESS;
}
qdf_export_symbol(wlan_lmac_if_iot_sim_set_rx_ops_register_cb);
static void wlan_iot_sim_register_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops)
{
if (wlan_lmac_if_iot_sim_rx_ops)
wlan_lmac_if_iot_sim_rx_ops(rx_ops);
else
qdf_print("\n***** IOT SIM MODULE NOT LOADED *****\n");
}
#else
static void wlan_iot_sim_register_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops)
{
}
#endif
/**
* wlan_global_lmac_if_rx_ops_register() - Global lmac_if
* rx handler register
@@ -105,6 +133,9 @@ wlan_global_lmac_if_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
/* spectral rx_ops registration*/
wlan_spectral_register_rx_ops(rx_ops);
/* iot_sim rx_ops registration*/
wlan_iot_sim_register_rx_ops(rx_ops);
return QDF_STATUS_SUCCESS;
}

Visa fil

@@ -33,6 +33,8 @@ static int __init iot_sim_init_module(void)
{
wlan_iot_sim_init();
iot_sim_info("qca_iot_sim module loaded");
wlan_lmac_if_iot_sim_set_rx_ops_register_cb(
wlan_lmac_if_iot_sim_register_rx_ops);
return 0;
}

Visa fil

@@ -23,7 +23,16 @@
/* Forward Declarations */
struct wmi_iot_sim_cmd_ops;
/*
/**
* iot_sim_cmd_handler() - IOT SIM frame handler function
* @vdev - vdev object.
* @buf - skb
*
* Return : QDF_STATUS_E_SUCCESS/QDF_STATUS_E_FAILURE.
*/
QDF_STATUS iot_sim_cmd_handler(struct wlan_objmgr_vdev *vdev, qdf_nbuf_t buf);
/**
* wlan_iot_sim_init() - API to init iot_sim component
*
* This API is invoked from dispatcher init during all component init.
@@ -47,7 +56,18 @@ QDF_STATUS wlan_iot_sim_init(void);
*/
QDF_STATUS wlan_iot_sim_deinit(void);
/*
/**
* wlan_lmac_if_iot_sim_register_rx_ops() - Register lmac interface Rx
* operations
* @rx_ops: Pointer to lmac interface Rx operations structure
*
* API to register iot_sim related lmac interface Rx operations
*
* Return: None
*/
void wlan_lmac_if_iot_sim_register_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops);
/**
* wlan_register_wmi_iot_sim_cmd_ops() - Register operations related to wmi
* commands on iot_sim parameters
* @pdev - the physical device object

Visa fil

@@ -18,6 +18,103 @@
#include <qdf_module.h>
#include "../../core/iot_sim_cmn_api_i.h"
#include <wlan_iot_sim_tgt_api.h>
#include <wlan_objmgr_pdev_obj.h>
#include <wlan_objmgr_vdev_obj.h>
#define IEEE80211_FRAME_BODY_OFFSET 0x18
QDF_STATUS iot_sim_cmd_handler(struct wlan_objmgr_vdev *vdev, qdf_nbuf_t nbuf)
{
struct wlan_objmgr_pdev *pdev = vdev->vdev_objmgr.wlan_pdev;
u8 type, subtype, seq = 0;
struct iot_sim_context *isc;
u8 *buf = qdf_nbuf_data(nbuf);
type = (buf[0] & IEEE80211_FC0_TYPE_MASK) >> IEEE80211_FC0_TYPE_SHIFT;
subtype = (buf[0] & IEEE80211_FC0_SUBTYPE_MASK);
subtype >>= IEEE80211_FC0_SUBTYPE_SHIFT;
isc = wlan_objmgr_pdev_get_comp_private_obj(pdev, WLAN_IOT_SIM_COMP);
if (!isc) {
iot_sim_err("pdev IOT_SIM object is NULL!");
return QDF_STATUS_SUCCESS;
}
if (type == 0x00 && subtype == 0xb0) {
/* Authentication frame */
int auth_seq_index = IEEE80211_FRAME_BODY_OFFSET + 2;
seq = le16toh(*(u_int16_t *)(buf + auth_seq_index));
}
/* Only broadcast peer is getting handled right now.
* Need to add support for peer based content modification
*/
if ((isc->bcast_peer.rule_per_seq[seq]) &&
(isc->bcast_peer.rule_per_seq[seq]->rule_per_type[type][subtype])) {
if (isc->bcast_peer.rule_per_seq[seq]->
rule_per_type[type][subtype]) {
struct iot_sim_rule *piot_sim_rule =
isc->bcast_peer.rule_per_seq[seq]->
rule_per_type[type][subtype];
qdf_size_t buf_len = qdf_nbuf_len(nbuf);
if (piot_sim_rule->frm_content && piot_sim_rule->len) {
int offset;
if (piot_sim_rule->offset ==
IEEE80211_FRAME_BODY_OFFSET) {
offset = IEEE80211_FRAME_BODY_OFFSET;
} else if (buf[piot_sim_rule->offset] ==
piot_sim_rule->frm_content[0]) {
offset = piot_sim_rule->offset;
} else if (piot_sim_rule->offset == 0) {
offset = 0;
} else {
offset = IEEE80211_FRAME_BODY_OFFSET;
while (((offset + 1) < buf_len) &&
(buf[offset] <
piot_sim_rule->frm_content[0])) {
offset += buf[offset + 1] + 2;
}
}
if (offset <= buf_len) {
buf += offset;
qdf_mem_copy(buf,
piot_sim_rule->
frm_content,
piot_sim_rule->len);
qdf_nbuf_set_pktlen(nbuf,
offset +
piot_sim_rule->len);
iot_sim_err("Content updated for peer");
iot_sim_err("frame type:%d, subtype:%d",
type, subtype);
iot_sim_err("seq:%d", seq);
} else {
iot_sim_err("Failed to modify content");
iot_sim_err("type:%d, subtype:%d",
type, subtype);
iot_sim_err("seq:%d", seq);
}
} else {
iot_sim_err("Content update rule not set");
iot_sim_err("frame type:%d, subtype:%d, seq:%d",
type, subtype, seq);
}
} else {
iot_sim_err("Content update rule not set");
iot_sim_err("frame type:%d, subtype:%d, seq:%d",
type, subtype, seq);
}
} else {
iot_sim_err("Content update rule not set for peer frame");
iot_sim_err("type:%d, subtype:%d, seq:%d", type, subtype, seq);
}
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
wlan_iot_sim_init(void)
@@ -60,3 +157,11 @@ wlan_iot_sim_deinit(void)
return QDF_STATUS_SUCCESS;
}
void wlan_lmac_if_iot_sim_register_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops)
{
struct wlan_lmac_if_iot_sim_rx_ops *iot_sim_ops =
&rx_ops->iot_sim_rx_ops;
iot_sim_ops->iot_sim_cmd_handler = iot_sim_cmd_handler;
}

Visa fil

@@ -428,6 +428,15 @@ QDF_STATUS wlan_mgmt_txrx_mgmt_frame_tx(struct wlan_objmgr_peer *peer,
desc->vdev_id = wlan_vdev_get_id(vdev);
desc->context = context;
if (psoc->soc_cb.rx_ops.iot_sim_rx_ops.iot_sim_cmd_handler) {
status = psoc->soc_cb.rx_ops.iot_sim_rx_ops.iot_sim_cmd_handler(
vdev, buf);
if (status) {
mgmt_txrx_err("iot_sim_cmd_handler returned failure, dropping the frame");
return QDF_STATUS_E_FAILURE;
}
}
if (!psoc->soc_cb.tx_ops.mgmt_txrx_tx_ops.mgmt_tx_send) {
mgmt_txrx_err(
"mgmt txrx txop to send mgmt frame is NULL for psoc: %pK",

Visa fil

@@ -1382,6 +1382,13 @@ struct wlan_lmac_if_sptrl_rx_ops {
};
#endif /* WLAN_CONV_SPECTRAL_ENABLE */
#ifdef WLAN_IOT_SIM_SUPPORT
struct wlan_lmac_if_iot_sim_rx_ops {
QDF_STATUS (*iot_sim_cmd_handler)(struct wlan_objmgr_vdev *vdev,
qdf_nbuf_t n_buf);
};
#endif
#ifdef WIFI_POS_CONVERGED
/**
* struct wlan_lmac_if_wifi_pos_rx_ops - structure of rx function
@@ -1726,6 +1733,10 @@ struct wlan_lmac_if_rx_ops {
struct wlan_lmac_if_p2p_rx_ops p2p;
#endif
#ifdef WLAN_IOT_SIM_SUPPORT
struct wlan_lmac_if_iot_sim_rx_ops iot_sim_rx_ops;
#endif
#ifdef WLAN_ATF_ENABLE
struct wlan_lmac_if_atf_rx_ops atf_rx_ops;
#endif