Browse Source

qcacmn: Add soc count for multi-chip mlo

Add soc count for multi-chip mlo

CRs-Fixed: 3370858
Change-Id: I128a378cdf29f03eb4356cd8049aea47e0af7c18
Tallapragada Kalyan 2 years ago
parent
commit
6774796947

+ 1 - 0
dp/wifi3.0/be/dp_be.c

@@ -2528,6 +2528,7 @@ void dp_initialize_arch_ops_be(struct dp_arch_ops *arch_ops)
 	arch_ops->txrx_set_vdev_param = dp_txrx_set_vdev_param_be;
 	dp_initialize_arch_ops_be_mlo(arch_ops);
 	arch_ops->dp_rx_replenish_soc_get = dp_rx_replensih_soc_get;
+	arch_ops->dp_soc_get_num_soc = dp_soc_get_num_soc_be;
 	arch_ops->dp_peer_rx_reorder_queue_setup =
 					dp_peer_rx_reorder_queue_setup_be;
 	arch_ops->txrx_print_peer_stats = dp_print_peer_txrx_stats_be;

+ 9 - 1
dp/wifi3.0/be/dp_be_rx.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. 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
@@ -246,12 +246,20 @@ dp_rx_replensih_soc_get(struct dp_soc *soc, uint8_t chip_id);
 
 struct dp_soc *
 dp_soc_get_by_idle_bm_id(struct dp_soc *soc, uint8_t idle_bm_id);
+
+uint8_t dp_soc_get_num_soc_be(struct dp_soc *soc);
 #else
 static inline struct dp_soc *
 dp_rx_replensih_soc_get(struct dp_soc *soc, uint8_t chip_id)
 {
 	return soc;
 }
+
+static inline uint8_t
+dp_soc_get_num_soc_be(struct dp_soc *soc)
+{
+	return 1;
+}
 #endif
 
 #ifdef WLAN_FEATURE_11BE_MLO

+ 20 - 0
dp/wifi3.0/be/mlo/dp_mlo.c

@@ -98,6 +98,15 @@ void dp_mlo_set_soc_by_chip_id(struct dp_mlo_ctxt *ml_ctxt,
 {
 	qdf_spin_lock_bh(&ml_ctxt->ml_soc_list_lock);
 	ml_ctxt->ml_soc_list[chip_id] = soc;
+
+	/* The same API is called during soc_attach and soc_detach
+	 * soc parameter is non-null or null accordingly.
+	 */
+	if (soc)
+		ml_ctxt->ml_soc_cnt++;
+	else
+		ml_ctxt->ml_soc_cnt--;
+
 	qdf_spin_unlock_bh(&ml_ctxt->ml_soc_list_lock);
 }
 
@@ -810,6 +819,17 @@ dp_rx_replensih_soc_get(struct dp_soc *soc, uint8_t chip_id)
 	return replenish_soc;
 }
 
+uint8_t dp_soc_get_num_soc_be(struct dp_soc *soc)
+{
+	struct dp_soc_be *be_soc = dp_get_be_soc_from_dp_soc(soc);
+	struct dp_mlo_ctxt *mlo_ctxt = be_soc->ml_ctxt;
+
+	if (!be_soc->mlo_enabled || !mlo_ctxt)
+		return 1;
+
+	return mlo_ctxt->ml_soc_cnt;
+}
+
 struct dp_soc *
 dp_soc_get_by_idle_bm_id(struct dp_soc *soc, uint8_t idle_bm_id)
 {

+ 2 - 0
dp/wifi3.0/be/mlo/dp_mlo.h

@@ -34,6 +34,7 @@
  * @ctrl_ctxt: opaque handle of cp mlo mgr
  * @ml_soc_list: list of socs which are mlo enabled. This also maintains
  *               mlo_chip_id to dp_soc mapping
+ * @ml_soc_cnt: number of SOCs
  * @ml_soc_list_lock: lock to protect ml_soc_list
  * @mld_peer_hash: peer hash table for ML peers
  *           Associated peer with this MAC address)
@@ -45,6 +46,7 @@
 struct dp_mlo_ctxt {
 	struct cdp_ctrl_mlo_mgr *ctrl_ctxt;
 	struct dp_soc *ml_soc_list[DP_MAX_MLO_CHIPS];
+	uint8_t ml_soc_cnt;
 	qdf_spinlock_t ml_soc_list_lock;
 	struct {
 		uint32_t mask;

+ 1 - 0
dp/wifi3.0/dp_types.h

@@ -2019,6 +2019,7 @@ struct dp_arch_ops {
 	struct dp_soc * (*dp_rx_replenish_soc_get)(struct dp_soc *soc,
 						   uint8_t chip_id);
 
+	uint8_t (*dp_soc_get_num_soc)(struct dp_soc *soc);
 	void (*dp_reconfig_tx_vdev_mcast_ctrl)(struct dp_soc *soc,
 					       struct dp_vdev *vdev);
 

+ 6 - 0
dp/wifi3.0/li/dp_li.c

@@ -583,6 +583,11 @@ static struct dp_soc *dp_rx_replensih_soc_get_li(struct dp_soc *soc,
 	return soc;
 }
 
+static uint8_t dp_soc_get_num_soc_li(struct dp_soc *soc)
+{
+	return 1;
+}
+
 static QDF_STATUS dp_txrx_get_vdev_mcast_param_li(struct dp_soc *soc,
 						  struct dp_vdev *vdev,
 						  cdp_config_param_type *val)
@@ -653,6 +658,7 @@ void dp_initialize_arch_ops_li(struct dp_arch_ops *arch_ops)
 	arch_ops->peer_get_reo_hash = dp_peer_get_reo_hash_li;
 	arch_ops->reo_remap_config = dp_reo_remap_config_li;
 	arch_ops->dp_rx_replenish_soc_get = dp_rx_replensih_soc_get_li;
+	arch_ops->dp_soc_get_num_soc = dp_soc_get_num_soc_li;
 	arch_ops->get_reo_qdesc_addr = dp_rx_get_reo_qdesc_addr_li;
 	arch_ops->txrx_get_vdev_mcast_param = dp_txrx_get_vdev_mcast_param_li;
 }