浏览代码

qcacmn: Maintain peer object refernce during frame delay

Maintain the peer object reference while delaying the processing
of peer frames.

Change-Id: Ia3df18f1281403c6ed36bfbc307b6928d3db9040
CRs-Fixed: 2769113
Jayachandran Sreekumaran 4 年之前
父节点
当前提交
c886b4c527
共有 3 个文件被更改,包括 51 次插入2 次删除
  1. 28 0
      iot_sim/core/iot_sim_common.c
  2. 1 0
      iot_sim/core/iot_sim_defs_i.h
  3. 22 2
      iot_sim/core/iot_sim_utils.c

+ 28 - 0
iot_sim/core/iot_sim_common.c

@@ -25,6 +25,7 @@
 #include <wmi_unified_param.h>
 #include <wlan_iot_sim_utils_api.h>
 #include <wlan_lmac_if_api.h>
+#include <wlan_objmgr_peer_obj.h>
 
 /*
  * iot_sim_oper_to_str - function to return iot sim operation string
@@ -803,6 +804,11 @@ iot_sim_del_rule(struct iot_sim_rule_per_seq **s_e,
 		qdf_mem_free((*f_e)->dwork);
 		qdf_nbuf_free((*f_e)->nbuf_list[0]);
 		(*f_e)->nbuf_list[0] = NULL;
+		if ((*f_e)->peer) {
+			wlan_objmgr_peer_release_ref((*f_e)->peer,
+						     WLAN_IOT_SIM_ID);
+			(*f_e)->peer = NULL;
+		}
 		qdf_nbuf_free((*f_e)->nbuf_list[1]);
 		(*f_e)->nbuf_list[1] = NULL;
 		(*f_e)->sec_buf = NULL;
@@ -921,6 +927,11 @@ static void iot_sim_delay_cb(void *ctxt)
 {
 	struct wlan_objmgr_psoc *psoc = NULL;
 	struct iot_sim_cb_context *context = ctxt;
+	uint8_t *buf;
+	struct ieee80211_frame *wh;
+	struct qdf_mac_addr *mac_addr;
+	struct mgmt_rx_event_params *param = context->piot_sim_rule->rx_param;
+	struct wlan_objmgr_peer **peer = &context->piot_sim_rule->peer;
 
 	qdf_spin_lock_bh(&context->piot_sim_rule->iot_sim_delay_lock);
 	qdf_spin_lock_bh(&context->isc->iot_sim_lock);
@@ -930,14 +941,30 @@ static void iot_sim_delay_cb(void *ctxt)
 	mgmt_txrx_rx_handler(psoc, context->piot_sim_rule->sec_buf,
 			     context->piot_sim_rule->rx_param);
 	qdf_spin_lock_bh(&context->isc->iot_sim_lock);
+	if (*peer) {
+		wlan_objmgr_peer_release_ref(*peer, WLAN_IOT_SIM_ID);
+		*peer = NULL;
+	}
 	if (context->piot_sim_rule->nbuf_list[1]) {
 		context->piot_sim_rule->nbuf_list[0] =
 					context->piot_sim_rule->nbuf_list[1];
+		buf = qdf_nbuf_data(context->piot_sim_rule->nbuf_list[0]);
+		wh = (struct ieee80211_frame *)buf;
+		mac_addr = (struct qdf_mac_addr *)wh->i_addr2;
+		*peer = wlan_objmgr_get_peer(psoc, param->pdev_id,
+					     (uint8_t *)mac_addr,
+					     WLAN_IOT_SIM_ID);
+
 		if (!qdf_delayed_work_start(context->piot_sim_rule->dwork,
 					    context->
 					    piot_sim_rule->delay_dur)) {
 			iot_sim_err("delayed_work_start failed");
 			qdf_nbuf_free(context->piot_sim_rule->nbuf_list[0]);
+			if (*peer) {
+				wlan_objmgr_peer_release_ref(*peer,
+							     WLAN_IOT_SIM_ID);
+				*peer = NULL;
+			}
 			qdf_mem_free(context->piot_sim_rule->
 				     rx_param->rx_params);
 			qdf_mem_free(context->piot_sim_rule->rx_param);
@@ -1023,6 +1050,7 @@ iot_sim_add_rule(struct iot_sim_rule_per_seq **s_e,
 
 		(*f_e)->nbuf_list[0] = NULL;
 		(*f_e)->nbuf_list[1] = NULL;
+		(*f_e)->peer = NULL;
 		iot_sim_err("delayed_work_created");
 		qdf_spinlock_create(&((*f_e)->iot_sim_delay_lock));
 	}

+ 1 - 0
iot_sim/core/iot_sim_defs_i.h

@@ -123,6 +123,7 @@ struct iot_sim_rule {
 	uint16_t delay_dur;
 	uint8_t rule_bitmap;
 	qdf_nbuf_t nbuf_list[2];
+	struct wlan_objmgr_peer *peer;
 	qdf_nbuf_t sec_buf;
 	struct qdf_delayed_work *dwork;
 	struct mgmt_rx_event_params *rx_param;

+ 22 - 2
iot_sim/core/iot_sim_utils.c

@@ -20,6 +20,7 @@
 #include "../../core/iot_sim_cmn_api_i.h"
 #include <wlan_objmgr_pdev_obj.h>
 #include <wlan_objmgr_vdev_obj.h>
+#include <wlan_objmgr_peer_obj.h>
 
 #define IEEE80211_FRAME_BODY_OFFSET 0x18
 #define IEEE80211_TSF_LEN       (8)
@@ -215,9 +216,13 @@ iot_sim_apply_content_change_rule(struct wlan_objmgr_pdev *pdev,
 QDF_STATUS
 iot_sim_apply_delay_drop_rule(struct iot_sim_rule *piot_sim_rule,
 			      qdf_nbuf_t nbuf,
-			      struct mgmt_rx_event_params *param)
+			      struct mgmt_rx_event_params *param,
+			      struct iot_sim_context *isc,
+			      struct qdf_mac_addr *mac_addr)
 {
 	struct mgmt_rx_event_params *rx_param;
+	struct wlan_objmgr_psoc *psoc = wlan_pdev_get_psoc(isc->pdev_obj);
+	struct wlan_objmgr_peer **peer = &piot_sim_rule->peer;
 
 	if (!piot_sim_rule->drop &&
 	    !piot_sim_rule->delay_dur)
@@ -239,6 +244,12 @@ iot_sim_apply_delay_drop_rule(struct iot_sim_rule *piot_sim_rule,
 				return QDF_STATUS_SUCCESS;
 			}
 
+			if (*peer) {
+				wlan_objmgr_peer_release_ref(*peer,
+							     WLAN_IOT_SIM_ID);
+				*peer = NULL;
+			}
+
 			qdf_nbuf_free(piot_sim_rule->nbuf_list[0]);
 			qdf_mem_free(piot_sim_rule->rx_param->rx_params);
 			qdf_mem_free(piot_sim_rule->rx_param);
@@ -259,6 +270,9 @@ iot_sim_apply_delay_drop_rule(struct iot_sim_rule *piot_sim_rule,
 			return QDF_STATUS_E_NOSUPPORT;
 		}
 
+		*peer = wlan_objmgr_get_peer(psoc, param->pdev_id,
+					     (uint8_t *)mac_addr,
+					     WLAN_IOT_SIM_ID);
 		qdf_mem_copy(rx_param->rx_params,
 			     param->rx_params, RX_STATUS_SIZE);
 		piot_sim_rule->rx_param = rx_param;
@@ -268,6 +282,11 @@ iot_sim_apply_delay_drop_rule(struct iot_sim_rule *piot_sim_rule,
 			iot_sim_err("delayed_work_start failed");
 			qdf_mem_free(rx_param->rx_params);
 			qdf_mem_free(rx_param);
+			if (*peer) {
+				wlan_objmgr_peer_release_ref(*peer,
+							     WLAN_IOT_SIM_ID);
+				*peer = NULL;
+			}
 			return QDF_STATUS_E_NOSUPPORT;
 		}
 
@@ -414,7 +433,8 @@ QDF_STATUS iot_sim_frame_update(struct wlan_objmgr_pdev *pdev, qdf_nbuf_t nbuf,
 		}
 	} else {
 		status = iot_sim_apply_delay_drop_rule(piot_sim_rule,
-						       nbuf, rx_param);
+						       nbuf, rx_param,
+						       isc, mac_addr);
 		if (QDF_IS_STATUS_SUCCESS(status))
 			status = QDF_STATUS_E_NULL_VALUE;
 		else