Эх сурвалжийг харах

qcacld-3.0: Replace intf_id with link_id

Replace the usage of dp_intf->intf_id with
link_id from dp_link.

Change-Id: I1885ce300a0373172659ae8c38cb2ca54dda1a9c
CRs-Fixed: 3518898
Rakesh Pillai 2 жил өмнө
parent
commit
09e724c396

+ 4 - 5
components/dp/core/inc/wlan_dp_main.h

@@ -495,9 +495,9 @@ dp_add_latency_critical_client(struct wlan_objmgr_vdev *vdev,
 		qdf_atomic_inc(&dp_intf->dp_ctx->num_latency_critical_clients);
 
 		dp_debug("Adding latency critical connection for vdev %d",
-			 dp_intf->intf_id);
+			 dp_link->link_id);
 		cdp_vdev_inform_ll_conn(cds_get_context(QDF_MODULE_ID_SOC),
-					dp_intf->intf_id,
+					dp_link->link_id,
 					CDP_VDEV_LL_CONN_ADD);
 		break;
 	default:
@@ -541,9 +541,9 @@ dp_del_latency_critical_client(struct wlan_objmgr_vdev *vdev,
 		qdf_atomic_dec(&dp_intf->dp_ctx->num_latency_critical_clients);
 
 		dp_info("Removing latency critical connection for vdev %d",
-			dp_intf->intf_id);
+			dp_link->link_id);
 		cdp_vdev_inform_ll_conn(cds_get_context(QDF_MODULE_ID_SOC),
-					dp_intf->intf_id,
+					dp_link->link_id,
 					CDP_VDEV_LL_CONN_DEL);
 		break;
 	default:
@@ -871,7 +871,6 @@ void dp_direct_link_deinit(struct wlan_dp_psoc_context *dp_ctx, bool is_ssr);
 QDF_STATUS dp_config_direct_link(struct wlan_dp_intf *dp_intf,
 				 bool config_direct_link,
 				 bool enable_low_latency);
-
 #else
 static inline
 QDF_STATUS dp_direct_link_init(struct wlan_dp_psoc_context *dp_ctx)

+ 2 - 4
components/dp/core/inc/wlan_dp_priv.h

@@ -606,7 +606,6 @@ struct dp_rx_fst {
  * @runtime_disable_rx_thread: Runtime Rx thread flag
  * @rx_stack: function pointer Rx packet handover
  * @tx_fn: function pointer to send Tx packet
- * @conn_info: STA connection information
  * @bss_state: AP BSS state
  * @qdf_sta_eap_frm_done_event: EAP frame event management
  * @traffic_end_ind: store traffic end indication info
@@ -625,8 +624,6 @@ struct wlan_dp_intf {
 
 	enum QDF_OPMODE device_mode;
 
-	uint8_t intf_id;
-
 	qdf_list_node_t node;
 
 	qdf_netdev_t dev;
@@ -666,7 +663,6 @@ struct wlan_dp_intf {
 	uint8_t gro_flushed[DP_MAX_RX_THREADS];
 
 	bool runtime_disable_rx_thread;
-	struct wlan_dp_conn_info conn_info;
 
 	enum bss_intf_state bss_state;
 	qdf_event_t qdf_sta_eap_frm_done_event;
@@ -688,6 +684,7 @@ struct wlan_dp_intf {
  * @dp_intf: Parent DP interface for this DP link
  * @vdev: object manager vdev context
  * @vdev_lock: vdev spin lock
+ * @conn_info: STA connection information
  */
 struct wlan_dp_link {
 	qdf_list_node_t node;
@@ -696,6 +693,7 @@ struct wlan_dp_link {
 	struct wlan_dp_intf *dp_intf;
 	struct wlan_objmgr_vdev *vdev;
 	qdf_spinlock_t vdev_lock;
+	struct wlan_dp_conn_info conn_info;
 };
 
 /**

+ 7 - 7
components/dp/core/inc/wlan_dp_txrx.h

@@ -90,18 +90,18 @@ void dp_softap_check_wait_for_tx_eap_pkt(struct wlan_dp_intf *dp_intf,
 #ifdef SAP_DHCP_FW_IND
 /**
  * dp_post_dhcp_ind() - Send DHCP START/STOP indication to FW
- * @dp_intf: pointer to dp interface
+ * @dp_link: DP link handle
  * @mac_addr: mac address
  * @dhcp_start: true if DHCP start, otherwise DHCP stop
  *
  * Return: error number
  */
-int dp_post_dhcp_ind(struct wlan_dp_intf *dp_intf,
+int dp_post_dhcp_ind(struct wlan_dp_link *dp_link,
 		     uint8_t *mac_addr, bool dhcp_start);
 
 /**
  * dp_softap_inspect_dhcp_packet() - Inspect DHCP packet
- * @dp_intf: pointer to dp interface
+ * @dp_link: DP link handle
  * @nbuf: pointer to OS packet (sk_buff)
  * @dir: direction
  *
@@ -126,19 +126,19 @@ int dp_post_dhcp_ind(struct wlan_dp_intf *dp_intf,
  *
  * Return: error number
  */
-int dp_softap_inspect_dhcp_packet(struct wlan_dp_intf *dp_intf,
+int dp_softap_inspect_dhcp_packet(struct wlan_dp_link *dp_link,
 				  qdf_nbuf_t nbuf,
 				  enum qdf_proto_dir dir);
 #else
 static inline
-int dp_post_dhcp_ind(struct wlan_dp_intf *dp_intf,
+int dp_post_dhcp_ind(struct wlan_dp_link *dp_link,
 		     uint8_t *mac_addr, bool dhcp_start)
 {
 	return 0;
 }
 
 static inline
-int dp_softap_inspect_dhcp_packet(struct wlan_dp_intf *dp_intf,
+int dp_softap_inspect_dhcp_packet(struct wlan_dp_link *dp_link,
 				  qdf_nbuf_t nbuf,
 				  enum qdf_proto_dir dir)
 {
@@ -386,7 +386,7 @@ qdf_nbuf_t dp_nbuf_orphan(struct wlan_dp_intf *dp_intf,
 
 	tx_flow_low_watermark =
 	   dp_ops->dp_get_tx_flow_low_watermark(dp_ops->callback_ctx,
-						dp_intf->intf_id);
+						dp_intf->dev);
 	if (tx_flow_low_watermark > 0) {
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 19, 0))
 		/*

+ 65 - 43
components/dp/core/src/wlan_dp_bus_bandwidth.c

@@ -196,21 +196,18 @@ bbm_get_bus_bw_level_vote(struct wlan_dp_intf *dp_intf,
 	case QDF_STA_MODE:
 	case QDF_P2P_CLIENT_MODE:
 		if (!cb_obj->wlan_dp_sta_get_dot11mode(ctx,
-						       dp_intf->intf_id,
+						       dp_intf->dev,
 						       &dot11_mode))
 			break;
 
-		if (dot11_mode >= QCA_WLAN_802_11_MODE_INVALID) {
-			dp_err("invalid STA/P2P-CLI dot11 modei %d",
-			       dot11_mode);
+		if (dot11_mode >= QCA_WLAN_802_11_MODE_INVALID)
 			break;
-		}
 
 		return (*lkp_table)[dot11_mode][tput_level];
 	case QDF_SAP_MODE:
 	case QDF_P2P_GO_MODE:
 		if (!cb_obj->wlan_dp_get_ap_client_count(ctx,
-							 dp_intf->intf_id,
+							 dp_intf->dev,
 							 client_count))
 			break;
 
@@ -224,7 +221,7 @@ bbm_get_bus_bw_level_vote(struct wlan_dp_intf *dp_intf,
 		return vote_lvl;
 	case QDF_NDI_MODE:
 		if (!cb_obj->wlan_dp_sta_ndi_connected(ctx,
-						       dp_intf->intf_id))
+						       dp_intf->dev))
 			break;
 
 		/*
@@ -242,12 +239,6 @@ bbm_get_bus_bw_level_vote(struct wlan_dp_intf *dp_intf,
 	return vote_lvl;
 }
 
-static inline bool bbm_validate_intf_id(uint8_t intf_id)
-{
-	return !!(intf_id == WLAN_UMAC_VDEV_ID_MAX ||
-				intf_id >= WLAN_MAX_VDEVS);
-}
-
 /**
  * bbm_apply_tput_policy() - Apply tput BBM policy by considering
  *  throughput level and connection modes across adapters
@@ -285,10 +276,9 @@ bbm_apply_tput_policy(struct wlan_dp_psoc_context *dp_ctx,
 	}
 
 	dp_for_each_intf_held_safe(dp_ctx, dp_intf, dp_intf_next) {
-		if (!dp_intf)
-			continue;
-		if (bbm_validate_intf_id(dp_intf->intf_id))
+		if (dp_intf->num_links == 0)
 			continue;
+
 		tmp_vote = bbm_get_bus_bw_level_vote(dp_intf, tput_level);
 		if (tmp_vote > next_vote)
 			next_vote = tmp_vote;
@@ -1091,10 +1081,12 @@ static void wlan_dp_display_txrx_stats(struct wlan_dp_psoc_context *dp_ctx)
 		total_tx_orphaned = 0;
 		stats = &dp_intf->dp_stats.tx_rx_stats;
 
-		if (dp_intf->intf_id == WLAN_INVALID_VDEV_ID)
+		if (!dp_intf->num_links)
 			continue;
 
-		dp_info("dp_intf: %u", dp_intf->intf_id);
+		/* TODO - Print opmode and see if vdev_id can be printed */
+		dp_info("dp_intf: " QDF_MAC_ADDR_FMT,
+			QDF_MAC_ADDR_REF(dp_intf->mac_addr.bytes));
 		for (i = 0; i < NUM_CPUS; i++) {
 			total_rx_pkt += stats->per_cpu[i].rx_packets;
 			total_rx_dropped += stats->per_cpu[i].rx_dropped;
@@ -1119,7 +1111,8 @@ static void wlan_dp_display_txrx_stats(struct wlan_dp_psoc_context *dp_ctx)
 			total_tx_pkt, total_tx_dropped,
 			total_tx_orphaned);
 
-		dp_ctx->dp_ops.wlan_dp_display_tx_multiq_stats(ctx, dp_intf->intf_id);
+		dp_ctx->dp_ops.wlan_dp_display_tx_multiq_stats(ctx,
+							       dp_intf->dev);
 
 		for (i = 0; i < NUM_CPUS; i++) {
 			if (stats->per_cpu[i].rx_packets == 0)
@@ -1778,6 +1771,7 @@ dp_link_monitoring(struct wlan_dp_psoc_context *dp_ctx,
 	uint32_t link_speed;
 	struct wlan_objmgr_psoc *psoc;
 	struct link_monitoring link_mon;
+	struct wlan_dp_link *def_link = dp_intf->def_link;
 
 	/*
 	 *  If throughput is high, link speed should be good,  don't check it
@@ -1804,7 +1798,7 @@ dp_link_monitoring(struct wlan_dp_psoc_context *dp_ctx,
 		if (no_rx_times >= NO_RX_PKT_LINK_SPEED_AGEOUT_COUNT) {
 			no_rx_times = 0;
 			dp_ctx->dp_ops.link_monitoring_cb(psoc,
-							  dp_intf->intf_id,
+							  def_link->link_id,
 							  false);
 			dp_intf->link_monitoring.is_rx_linkspeed_good = false;
 
@@ -1817,13 +1811,17 @@ dp_link_monitoring(struct wlan_dp_psoc_context *dp_ctx,
 		return;
 
 	/* TODO - Temp WAR, check what to do here */
-	bss_peer = wlan_vdev_get_bsspeer(dp_intf->def_link->vdev);
+	/* Peer stats for any link peer is going to return the
+	 * stats from MLD peer, so its okay to query deflink
+	 */
+	bss_peer = wlan_vdev_get_bsspeer(def_link->vdev);
 	if (!bss_peer) {
 		dp_debug("Invalid bss peer");
 		qdf_mem_free(peer_stats);
 		return;
 	}
-	status = cdp_host_get_peer_stats(soc, dp_intf->intf_id,
+
+	status = cdp_host_get_peer_stats(soc, def_link->link_id,
 					 bss_peer->macaddr,
 					 peer_stats);
 	if (QDF_IS_STATUS_ERROR(status)) {
@@ -1842,17 +1840,17 @@ dp_link_monitoring(struct wlan_dp_psoc_context *dp_ctx,
 	 * driver will send rx link speed poor state to firmware.
 	 */
 	if (!link_mon.rx_linkspeed_threshold) {
-		dp_ctx->dp_ops.link_monitoring_cb(psoc, dp_intf->intf_id,
+		dp_ctx->dp_ops.link_monitoring_cb(psoc, def_link->link_id,
 						  false);
 		dp_intf->link_monitoring.is_rx_linkspeed_good = false;
 	} else if (link_speed > link_mon.rx_linkspeed_threshold &&
 	     !link_mon.is_rx_linkspeed_good) {
-		dp_ctx->dp_ops.link_monitoring_cb(psoc, dp_intf->intf_id,
+		dp_ctx->dp_ops.link_monitoring_cb(psoc, def_link->link_id,
 						  true);
 		dp_intf->link_monitoring.is_rx_linkspeed_good = true;
 	} else if (link_speed < link_mon.rx_linkspeed_threshold &&
 		   link_mon.is_rx_linkspeed_good) {
-		dp_ctx->dp_ops.link_monitoring_cb(psoc, dp_intf->intf_id,
+		dp_ctx->dp_ops.link_monitoring_cb(psoc, def_link->link_id,
 						  false);
 		dp_intf->link_monitoring.is_rx_linkspeed_good = false;
 	}
@@ -1873,8 +1871,11 @@ static void __dp_bus_bw_work_handler(struct wlan_dp_psoc_context *dp_ctx)
 	struct wlan_objmgr_vdev *vdev;
 	struct wlan_dp_intf *dp_intf = NULL, *con_sap_dp_intf = NULL;
 	struct wlan_dp_intf *dp_intf_next = NULL;
+	struct wlan_dp_link *dp_link = NULL;
+	struct wlan_dp_link *dp_link_next;
 	uint64_t tx_packets = 0, rx_packets = 0, tx_bytes = 0;
 	uint64_t fwd_tx_packets = 0, fwd_rx_packets = 0;
+	uint64_t fwd_tx_packets_temp = 0, fwd_rx_packets_temp = 0;
 	uint64_t fwd_tx_packets_diff = 0, fwd_rx_packets_diff = 0;
 	uint64_t total_tx = 0, total_rx = 0;
 	A_STATUS ret;
@@ -1915,7 +1916,7 @@ static void __dp_bus_bw_work_handler(struct wlan_dp_psoc_context *dp_ctx)
 		if ((dp_intf->device_mode == QDF_SAP_MODE ||
 		     dp_intf->device_mode == QDF_P2P_GO_MODE) &&
 		     !dp_ctx->dp_ops.dp_is_ap_active(ctx,
-						     dp_intf->intf_id)) {
+						     dp_intf->dev)) {
 			dp_objmgr_put_vdev_by_user(vdev, WLAN_DP_ID);
 			continue;
 		}
@@ -1936,27 +1937,42 @@ static void __dp_bus_bw_work_handler(struct wlan_dp_psoc_context *dp_ctx)
 		if (dp_intf->device_mode == QDF_STA_MODE &&
 		    wlan_cm_is_vdev_active(vdev)) {
 			dp_ctx->dp_ops.dp_send_mscs_action_frame(ctx,
-							dp_intf->intf_id);
+							dp_intf->dev);
 			if (dp_intf->link_monitoring.enabled)
 				dp_link_monitoring(dp_ctx, dp_intf);
 		}
+
+		ret = A_ERROR;
+		fwd_tx_packets = 0;
+		fwd_rx_packets = 0;
 		if (dp_intf->device_mode == QDF_SAP_MODE ||
 		    dp_intf->device_mode == QDF_P2P_GO_MODE ||
 		    dp_intf->device_mode == QDF_NDI_MODE) {
-			ret = cdp_get_intra_bss_fwd_pkts_count(
-				cds_get_context(QDF_MODULE_ID_SOC),
-				dp_intf->intf_id,
-				&fwd_tx_packets, &fwd_rx_packets);
-			if (ret == A_OK) {
-				fwd_tx_packets_diff += DP_BW_GET_DIFF(
-					fwd_tx_packets,
-					dp_intf->prev_fwd_tx_packets);
-				fwd_rx_packets_diff += DP_BW_GET_DIFF(
-					fwd_tx_packets,
-					dp_intf->prev_fwd_rx_packets);
+			dp_for_each_link_held_safe(dp_intf, dp_link,
+						   dp_link_next) {
+				ret = cdp_get_intra_bss_fwd_pkts_count(
+					cds_get_context(QDF_MODULE_ID_SOC),
+					dp_link->link_id,
+					&fwd_tx_packets_temp,
+					&fwd_rx_packets_temp);
+				if (ret == A_OK) {
+					fwd_tx_packets += fwd_tx_packets_temp;
+					fwd_rx_packets += fwd_rx_packets_temp;
+				} else {
+					break;
+				}
 			}
 		}
 
+		if (ret == A_OK) {
+			fwd_tx_packets_diff += DP_BW_GET_DIFF(
+				fwd_tx_packets,
+				dp_intf->prev_fwd_tx_packets);
+			fwd_rx_packets_diff += DP_BW_GET_DIFF(
+				fwd_rx_packets,
+				dp_intf->prev_fwd_rx_packets);
+		}
+
 		if (dp_intf->device_mode == QDF_SAP_MODE) {
 			con_sap_dp_intf = dp_intf;
 			sap_tx_bytes =
@@ -1967,11 +1983,13 @@ static void __dp_bus_bw_work_handler(struct wlan_dp_psoc_context *dp_ctx)
 			sta_tx_bytes =
 				qdf_net_stats_get_tx_bytes(&dp_intf->stats);
 
-		dp_set_driver_del_ack_enable(dp_intf->intf_id, dp_ctx,
-					     rx_packets);
+		dp_for_each_link_held_safe(dp_intf, dp_link, dp_link_next) {
+			dp_set_driver_del_ack_enable(dp_link->link_id, dp_ctx,
+						     rx_packets);
 
-		dp_set_vdev_bundle_require_flag(dp_intf->intf_id, dp_ctx,
-						tx_bytes);
+			dp_set_vdev_bundle_require_flag(dp_link->link_id,
+							dp_ctx, tx_bytes);
+		}
 
 		total_rx += qdf_net_stats_get_rx_pkts(&dp_intf->stats);
 		total_tx += qdf_net_stats_get_tx_pkts(&dp_intf->stats);
@@ -2240,8 +2258,12 @@ void dp_bus_bw_compute_prev_txrx_stats(struct wlan_objmgr_vdev *vdev)
 	dp_intf->prev_rx_packets = qdf_net_stats_get_rx_pkts(&dp_intf->stats);
 	dp_intf->prev_tx_bytes = qdf_net_stats_get_tx_bytes(&dp_intf->stats);
 
+	/*
+	 * TODO - Should the prev_fwd_tx_packets and
+	 * such stats be per link ??
+	 */
 	cdp_get_intra_bss_fwd_pkts_count(cds_get_context(QDF_MODULE_ID_SOC),
-					 dp_intf->intf_id,
+					 dp_link->link_id,
 					 &dp_intf->prev_fwd_tx_packets,
 					 &dp_intf->prev_fwd_rx_packets);
 	qdf_spin_unlock_bh(&dp_ctx->bus_bw_lock);

+ 12 - 8
components/dp/core/src/wlan_dp_main.c

@@ -1034,7 +1034,6 @@ dp_vdev_obj_create_notification(struct wlan_objmgr_vdev *vdev, void *arg)
 
 	qdf_spin_lock_bh(&dp_link->vdev_lock);
 	dp_link->link_id = vdev->vdev_objmgr.vdev_id;
-	dp_intf->intf_id = vdev->vdev_objmgr.vdev_id;
 	dp_link->vdev = vdev;
 	qdf_spin_unlock_bh(&dp_link->vdev_lock);
 
@@ -1109,8 +1108,6 @@ dp_vdev_obj_destroy_notification(struct wlan_objmgr_vdev *vdev, void *arg)
 		dp_nud_reset_tracking(dp_intf);
 		dp_nud_flush_work(dp_intf);
 		dp_mic_flush_work(dp_intf);
-		qdf_mem_zero(&dp_intf->conn_info,
-			     sizeof(struct wlan_dp_conn_info));
 
 		if (dp_intf->device_mode == QDF_SAP_MODE ||
 		    dp_intf->device_mode == QDF_P2P_GO_MODE) {
@@ -1124,6 +1121,8 @@ dp_vdev_obj_destroy_notification(struct wlan_objmgr_vdev *vdev, void *arg)
 		}
 	}
 
+	qdf_mem_zero(&dp_link->conn_info, sizeof(struct wlan_dp_conn_info));
+
 	/*
 	 * Change this to link level, since during link switch,
 	 * it might not go to 0
@@ -1132,7 +1131,6 @@ dp_vdev_obj_destroy_notification(struct wlan_objmgr_vdev *vdev, void *arg)
 	if (QDF_IS_STATUS_ERROR(status))
 		return status;
 
-	dp_intf->intf_id = WLAN_UMAC_VDEV_ID_MAX;
 	qdf_spin_lock_bh(&dp_link->vdev_lock);
 	dp_link->vdev = NULL;
 	qdf_spin_unlock_bh(&dp_link->vdev_lock);
@@ -2203,6 +2201,7 @@ QDF_STATUS dp_config_direct_link(struct wlan_dp_intf *dp_intf,
 {
 	struct wlan_dp_psoc_context *dp_ctx = dp_intf->dp_ctx;
 	struct direct_link_info *config = &dp_intf->direct_link_config;
+	struct wlan_dp_link *dp_link, *dp_link_next;
 	void *htc_handle;
 	bool prev_ll, update_ll, vote_link;
 	cdp_config_param_type vdev_param = {0};
@@ -2230,10 +2229,15 @@ QDF_STATUS dp_config_direct_link(struct wlan_dp_intf *dp_intf,
 	vote_link = config->config_set ^ config_direct_link;
 	config->config_set = config_direct_link;
 	config->low_latency = enable_low_latency;
-	vdev_param.cdp_vdev_tx_to_fw = config_direct_link;
-	status = cdp_txrx_set_vdev_param(wlan_psoc_get_dp_handle(dp_ctx->psoc),
-					 dp_intf->intf_id, CDP_VDEV_TX_TO_FW,
-					 vdev_param);
+	dp_for_each_link_held_safe(dp_intf, dp_link, dp_link_next) {
+		vdev_param.cdp_vdev_tx_to_fw = config_direct_link;
+		status = cdp_txrx_set_vdev_param(
+				wlan_psoc_get_dp_handle(dp_ctx->psoc),
+				dp_link->link_id, CDP_VDEV_TX_TO_FW,
+				vdev_param);
+		if (QDF_IS_STATUS_ERROR(status))
+			break;
+	}
 
 	if (config_direct_link) {
 		if (vote_link)

+ 24 - 10
components/dp/core/src/wlan_dp_nud_tracking.c

@@ -39,8 +39,16 @@
  */
 static uint32_t dp_txrx_get_tx_ack_count(struct wlan_dp_intf *dp_intf)
 {
-	return cdp_get_tx_ack_stats(cds_get_context(QDF_MODULE_ID_SOC),
-				    dp_intf->intf_id);
+	struct cdp_soc_t *soc = cds_get_context(QDF_MODULE_ID_SOC);
+	struct wlan_dp_link *dp_link;
+	struct wlan_dp_link *dp_link_next;
+	uint32_t ack_count = 0;
+
+	dp_for_each_link_held_safe(dp_intf, dp_link, dp_link_next) {
+		ack_count += cdp_get_tx_ack_stats(soc, dp_link->link_id);
+	}
+
+	return ack_count;
 }
 
 void dp_nud_set_gateway_addr(struct wlan_objmgr_vdev *vdev,
@@ -80,11 +88,6 @@ void dp_nud_incr_gw_rx_pkt_cnt(struct wlan_dp_intf *dp_intf,
 void dp_nud_flush_work(struct wlan_dp_intf *dp_intf)
 {
 	struct wlan_dp_psoc_context *dp_ctx = dp_intf->dp_ctx;
-	struct wlan_dp_psoc_callbacks *dp_ops = &dp_ctx->dp_ops;
-
-	if (dp_ops->dp_is_link_adapter(dp_ops->callback_ctx,
-				       dp_intf->intf_id))
-		return;
 
 	if (dp_intf->device_mode == QDF_STA_MODE &&
 	    dp_ctx->dp_cfg.enable_nud_tracking) {
@@ -163,8 +166,9 @@ static void dp_nud_stats_info(struct wlan_dp_intf *dp_intf)
 
 	cb->os_if_dp_nud_stats_info(vdev);
 
+	/* TODO - Again this is also adapter based so pass dev */
 	pause_map = cb->dp_get_pause_map(cb->callback_ctx,
-					 dp_intf->intf_id);
+					 dp_intf->dev);
 	dp_info("Current pause_map value %x", pause_map);
 	dp_objmgr_put_vdev_by_user(vdev, WLAN_DP_ID);
 }
@@ -281,8 +285,12 @@ static void dp_nud_failure_work(void *data)
 		return;
 	}
 
+	/*
+	 * TODO - The handler is totally adapter based,
+	 * so just dev should be fine
+	 */
 	dp_ctx->dp_ops.dp_nud_failure_work(dp_ctx->dp_ops.callback_ctx,
-					   dp_intf->intf_id);
+					   dp_intf->dev);
 }
 
 void dp_nud_init_tracking(struct wlan_dp_intf *dp_intf)
@@ -349,6 +357,7 @@ static void dp_nud_filter_netevent(struct qdf_mac_addr *netdev_addr,
 {
 	int status;
 	struct wlan_dp_intf *dp_intf;
+	struct wlan_dp_link *dp_link;
 	struct wlan_dp_psoc_context *dp_ctx;
 	struct wlan_objmgr_vdev *vdev;
 
@@ -396,7 +405,12 @@ static void dp_nud_filter_netevent(struct qdf_mac_addr *netdev_addr,
 		return;
 	}
 	dp_objmgr_put_vdev_by_user(vdev, WLAN_DP_ID);
-	if (!dp_intf->conn_info.is_authenticated) {
+	dp_link = dp_intf->def_link;
+	/*
+	 * TODO - For now using deflink, have some analysis
+	 * (I think this should be fine)
+	 */
+	if (!dp_link->conn_info.is_authenticated) {
 		dp_info("client " QDF_MAC_ADDR_FMT
 			" is in the middle of WPS/EAPOL exchange.",
 			QDF_MAC_ADDR_REF(dp_intf->mac_addr.bytes));

+ 40 - 33
components/dp/core/src/wlan_dp_softap_txrx.c

@@ -206,15 +206,16 @@ void dp_softap_check_wait_for_tx_eap_pkt(struct wlan_dp_intf *dp_intf,
 #ifdef SAP_DHCP_FW_IND
 /**
  * dp_post_dhcp_ind() - Send DHCP START/STOP indication to FW
- * @dp_intf: pointer to DP interface
+ * @dp_link: DP link handle
  * @mac_addr: mac address
  * @dhcp_start: dhcp start
  *
  * Return: error number
  */
-int dp_post_dhcp_ind(struct wlan_dp_intf *dp_intf, uint8_t *mac_addr,
+int dp_post_dhcp_ind(struct wlan_dp_link *dp_link, uint8_t *mac_addr,
 		     bool dhcp_start)
 {
+	struct wlan_dp_intf *dp_intf;
 	struct dp_dhcp_ind msg;
 	struct wlan_dp_psoc_sb_ops *sb_ops;
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
@@ -222,11 +223,13 @@ int dp_post_dhcp_ind(struct wlan_dp_intf *dp_intf, uint8_t *mac_addr,
 	dp_info("Post DHCP indication,sta_mac=" QDF_MAC_ADDR_FMT
 		 " ,  start=%u", QDF_MAC_ADDR_REF(mac_addr), dhcp_start);
 
-	if (!dp_intf) {
-		dp_err("NULL DP interface");
+	/* TODO - Should we just check is_dp_link_valid(dp_link) */
+	if (!dp_link) {
+		dp_err("NULL DP link");
 		return QDF_STATUS_E_INVAL;
 	}
 
+	dp_intf = dp_link->dp_intf;
 	sb_ops = &dp_intf->dp_ctx->sb_ops;
 	msg.dhcp_start = dhcp_start;
 	msg.device_mode = dp_intf->device_mode;
@@ -237,7 +240,7 @@ int dp_post_dhcp_ind(struct wlan_dp_intf *dp_intf, uint8_t *mac_addr,
 		     mac_addr,
 		     QDF_MAC_ADDR_SIZE);
 
-	status = sb_ops->dp_send_dhcp_ind(dp_intf->intf_id, &msg);
+	status = sb_ops->dp_send_dhcp_ind(dp_link->link_id, &msg);
 	if (!QDF_IS_STATUS_SUCCESS(status)) {
 		dp_err("Post DHCP Ind MSG fail");
 		return QDF_STATUS_E_FAULT;
@@ -250,29 +253,30 @@ int dp_post_dhcp_ind(struct wlan_dp_intf *dp_intf, uint8_t *mac_addr,
 
 /**
  * dp_softap_notify_dhcp_ind() - Notify SAP for DHCP indication for tx desc
- * @intf_context: pointer to DP interface context
+ * @link_context: DP link context
  * @nbuf: pointer to OS packet (sk_buff)
  *
  * Return: None
  */
-static void dp_softap_notify_dhcp_ind(void *intf_context, qdf_nbuf_t nbuf)
+static void dp_softap_notify_dhcp_ind(void *link_context, qdf_nbuf_t nbuf)
 {
 	uint8_t *dest_mac_addr;
-	struct wlan_dp_intf *dp_intf = intf_context;
+	struct wlan_dp_link *dp_link = link_context;
 
-	if (is_dp_intf_valid(dp_intf))
+	if (!is_dp_link_valid(dp_link))
 		return;
 
 	dest_mac_addr = qdf_nbuf_data(nbuf) + DHCP_CLIENT_MAC_ADDR_OFFSET;
 
 	/*stop dhcp indication*/
-	dp_post_dhcp_ind(dp_intf, dest_mac_addr, false);
+	dp_post_dhcp_ind(dp_link, dest_mac_addr, false);
 }
 
-int dp_softap_inspect_dhcp_packet(struct wlan_dp_intf *dp_intf,
+int dp_softap_inspect_dhcp_packet(struct wlan_dp_link *dp_link,
 				  qdf_nbuf_t nbuf,
 				  enum qdf_proto_dir dir)
 {
+	struct wlan_dp_intf *dp_intf = dp_link->dp_intf;
 	enum qdf_proto_subtype subtype = QDF_PROTO_INVALID;
 	struct wlan_objmgr_peer *peer;
 	struct wlan_dp_sta_info *sta_info;
@@ -314,7 +318,8 @@ int dp_softap_inspect_dhcp_packet(struct wlan_dp_intf *dp_intf,
 			if (dir != QDF_RX)
 				break;
 			if (sta_info->dhcp_nego_status == DHCP_NEGO_STOP)
-				errno =	dp_post_dhcp_ind(dp_intf,
+				errno =	dp_post_dhcp_ind(
+						dp_link,
 						sta_info->sta_mac.bytes,
 						true);
 			sta_info->dhcp_phase = DHCP_PHASE_DISCOVER;
@@ -328,7 +333,7 @@ int dp_softap_inspect_dhcp_packet(struct wlan_dp_intf *dp_intf,
 				break;
 			if (sta_info->dhcp_nego_status == DHCP_NEGO_STOP)
 				errno = dp_post_dhcp_ind(
-						dp_intf,
+						dp_link,
 						sta_info->sta_mac.bytes,
 						true);
 			sta_info->dhcp_nego_status = DHCP_NEGO_IN_PROGRESS;
@@ -409,8 +414,8 @@ void dp_softap_get_tx_resource(struct wlan_dp_link *dp_link,
 #endif
 
 #ifdef FEATURE_WDS
-void
-dp_wds_replace_peer_mac(void *soc, struct wlan_dp_intf *dp_intf,
+static void
+dp_wds_replace_peer_mac(void *soc, struct wlan_dp_link *dp_link,
 			uint8_t *mac_addr)
 {
 	struct cdp_ast_entry_info ast_entry_info = {0};
@@ -418,7 +423,7 @@ dp_wds_replace_peer_mac(void *soc, struct wlan_dp_intf *dp_intf,
 	QDF_STATUS status;
 
 	if (!cdp_find_peer_exist(soc, OL_TXRX_PDEV_ID, mac_addr)) {
-		status = cdp_txrx_get_vdev_param(soc, dp_intf->intf_id,
+		status = cdp_txrx_get_vdev_param(soc, dp_link->link_id,
 						 CDP_ENABLE_WDS, &val);
 		if (!QDF_IS_STATUS_SUCCESS(status))
 			return;
@@ -436,13 +441,13 @@ dp_wds_replace_peer_mac(void *soc, struct wlan_dp_intf *dp_intf,
 }
 #else
 static inline
-void dp_wds_replace_peer_mac(void *soc, struct wlan_dp_intf *dp_intf,
+void dp_wds_replace_peer_mac(void *soc, struct wlan_dp_link *dp_link,
 			     uint8_t *mac_addr)
 {
 }
 #endif /* FEATURE_WDS*/
 
-static QDF_STATUS dp_softap_validate_peer_state(struct wlan_dp_intf *dp_intf,
+static QDF_STATUS dp_softap_validate_peer_state(struct wlan_dp_link *dp_link,
 						qdf_nbuf_t nbuf)
 {
 	struct qdf_mac_addr *dest_mac_addr;
@@ -460,8 +465,8 @@ static QDF_STATUS dp_softap_validate_peer_state(struct wlan_dp_intf *dp_intf,
 	qdf_copy_macaddr(&mac_addr, dest_mac_addr);
 	soc = cds_get_context(QDF_MODULE_ID_SOC);
 	QDF_BUG(soc);
-	dp_wds_replace_peer_mac(soc, dp_intf, mac_addr.bytes);
-	peer_state = cdp_peer_state_get(soc, dp_intf->intf_id,
+	dp_wds_replace_peer_mac(soc, dp_link, mac_addr.bytes);
+	peer_state = cdp_peer_state_get(soc, dp_link->link_id,
 					mac_addr.bytes);
 
 	if (peer_state == OL_TXRX_PEER_STATE_INVALID) {
@@ -639,7 +644,7 @@ QDF_STATUS dp_softap_start_xmit(qdf_nbuf_t nbuf, struct wlan_dp_link *dp_link)
 
 	wlan_dp_pkt_add_timestamp(dp_intf, QDF_PKT_TX_DRIVER_ENTRY, nbuf);
 
-	if (QDF_IS_STATUS_ERROR(dp_softap_validate_peer_state(dp_intf, nbuf)))
+	if (QDF_IS_STATUS_ERROR(dp_softap_validate_peer_state(dp_link, nbuf)))
 		goto drop_pkt;
 
 	dp_softap_get_tx_resource(dp_link, nbuf);
@@ -664,7 +669,7 @@ QDF_STATUS dp_softap_start_xmit(qdf_nbuf_t nbuf, struct wlan_dp_link *dp_link)
 
 	if (qdf_unlikely(QDF_NBUF_CB_GET_PACKET_TYPE(nbuf) ==
 			 QDF_NBUF_CB_PACKET_TYPE_DHCP))
-		dp_softap_inspect_dhcp_packet(dp_intf, nbuf, QDF_TX);
+		dp_softap_inspect_dhcp_packet(dp_link, nbuf, QDF_TX);
 
 	if (qdf_unlikely(QDF_NBUF_CB_GET_PACKET_TYPE(nbuf) ==
 			 QDF_NBUF_CB_PACKET_TYPE_EAPOL)) {
@@ -683,7 +688,7 @@ QDF_STATUS dp_softap_start_xmit(qdf_nbuf_t nbuf, struct wlan_dp_link *dp_link)
 		goto drop_pkt_and_release_skb;
 	}
 
-	if (dp_intf->txrx_ops.tx.tx(soc, dp_intf->intf_id, nbuf)) {
+	if (dp_intf->txrx_ops.tx.tx(soc, dp_link->link_id, nbuf)) {
 		dp_debug("Failed to send packet to txrx for sta: "
 			 QDF_MAC_ADDR_FMT,
 			 QDF_MAC_ADDR_REF(dest_mac_addr->bytes));
@@ -739,13 +744,13 @@ void dp_softap_tx_timeout(struct wlan_dp_intf *dp_intf)
 void dp_softap_notify_tx_compl_cbk(qdf_nbuf_t nbuf,
 				   void *context, uint16_t flag)
 {
-	int errno;
-	struct wlan_dp_intf *dp_intf = context;
+	struct wlan_dp_link *dp_link = context;
+	struct wlan_dp_intf *dp_intf;
 
-	errno = is_dp_intf_valid(dp_intf);
-	if (errno)
+	if (!is_dp_link_valid(dp_link))
 		return;
 
+	dp_intf = dp_link->dp_intf;
 	if (QDF_NBUF_CB_PACKET_TYPE_DHCP == QDF_NBUF_CB_GET_PACKET_TYPE(nbuf)) {
 		dp_debug("sending DHCP indication");
 		dp_softap_notify_dhcp_ind(context, nbuf);
@@ -796,9 +801,10 @@ static inline bool dp_nbuf_dst_addr_is_mld_addr(struct wlan_dp_intf *dp_intf,
 }
 #endif
 
-QDF_STATUS dp_softap_rx_packet_cbk(void *intf_ctx, qdf_nbuf_t rx_buf)
+QDF_STATUS dp_softap_rx_packet_cbk(void *link_ctx, qdf_nbuf_t rx_buf)
 {
 	struct wlan_dp_intf *dp_intf = NULL;
+	struct wlan_dp_link *dp_link = NULL;
 	QDF_STATUS qdf_status;
 	unsigned int cpu_index;
 	qdf_nbuf_t nbuf = NULL;
@@ -808,12 +814,13 @@ QDF_STATUS dp_softap_rx_packet_cbk(void *intf_ctx, qdf_nbuf_t rx_buf)
 	struct dp_tx_rx_stats *stats;
 
 	/* Sanity check on inputs */
-	if (unlikely((!intf_ctx) || (!rx_buf))) {
+	if (unlikely(!link_ctx || !rx_buf)) {
 		dp_err("Null params being passed");
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	dp_intf = (struct wlan_dp_intf *)intf_ctx;
+	dp_link = (struct wlan_dp_link *)link_ctx;
+	dp_intf = dp_link->dp_intf;
 	dp_ctx = dp_intf->dp_ctx;
 
 	stats = &dp_intf->dp_stats.tx_rx_stats;
@@ -838,7 +845,7 @@ QDF_STATUS dp_softap_rx_packet_cbk(void *intf_ctx, qdf_nbuf_t rx_buf)
 		qdf_net_stats_add_rx_bytes(&dp_intf->stats,
 					   qdf_nbuf_len(nbuf));
 
-		dp_softap_inspect_dhcp_packet(dp_intf, nbuf, QDF_RX);
+		dp_softap_inspect_dhcp_packet(dp_link, nbuf, QDF_RX);
 
 		if (qdf_nbuf_is_ipv4_eapol_pkt(nbuf))
 			is_eapol = true;
@@ -857,7 +864,7 @@ QDF_STATUS dp_softap_rx_packet_cbk(void *intf_ctx, qdf_nbuf_t rx_buf)
 					  QDF_PKT_RX_DRIVER_EXIT, nbuf);
 
 		dp_event_eapol_log(nbuf, QDF_RX);
-		qdf_dp_trace_log_pkt(dp_intf->intf_id,
+		qdf_dp_trace_log_pkt(dp_link->link_id,
 				     nbuf, QDF_RX, QDF_TRACE_DEFAULT_PDEV_ID,
 				     dp_intf->device_mode);
 		DPTRACE(qdf_dp_trace(nbuf,
@@ -895,7 +902,7 @@ QDF_STATUS dp_softap_rx_packet_cbk(void *intf_ctx, qdf_nbuf_t rx_buf)
 
 		if (is_eapol && dp_ctx->dp_ops.dp_send_rx_pkt_over_nl) {
 			if (dp_ctx->dp_ops.dp_send_rx_pkt_over_nl(dp_intf->dev,
-					(u8 *)&dp_intf->conn_info.peer_macaddr,
+					(u8 *)&dp_link->conn_info.peer_macaddr,
 								  nbuf, false))
 				qdf_status = QDF_STATUS_SUCCESS;
 			else

+ 26 - 20
components/dp/core/src/wlan_dp_txrx.c

@@ -442,7 +442,7 @@ void dp_get_transmit_mac_addr(struct wlan_dp_link *dp_link,
 	case QDF_P2P_CLIENT_MODE:
 		if (wlan_cm_is_vdev_active(dp_link->vdev))
 			qdf_copy_macaddr(mac_addr_tx_allowed,
-					 &dp_intf->conn_info.bssid);
+					 &dp_link->conn_info.bssid);
 		break;
 	default:
 		break;
@@ -452,19 +452,19 @@ void dp_get_transmit_mac_addr(struct wlan_dp_link *dp_link,
 #ifdef HANDLE_BROADCAST_EAPOL_TX_FRAME
 /**
  * dp_fix_broadcast_eapol() - Fix broadcast eapol
- * @dp_intf: pointer to dp interface
+ * @dp_link: pointer to dp link
  * @nbuf: pointer to nbuf
  *
  * Override DA of broadcast eapol with bssid addr.
  *
  * Return: None
  */
-static void dp_fix_broadcast_eapol(struct wlan_dp_intf *dp_intf,
+static void dp_fix_broadcast_eapol(struct wlan_dp_link *dp_link,
 				   qdf_nbuf_t nbuf)
 {
 	qdf_ether_header_t *eth_hdr = (qdf_ether_header_t *)qdf_nbuf_data(nbuf);
 	unsigned char *ap_mac_addr =
-		&dp_intf->conn_info.bssid.bytes[0];
+		&dp_link->conn_info.bssid.bytes[0];
 
 	if (qdf_unlikely((QDF_NBUF_CB_GET_PACKET_TYPE(nbuf) ==
 			  QDF_NBUF_CB_PACKET_TYPE_EAPOL) &&
@@ -479,7 +479,7 @@ static void dp_fix_broadcast_eapol(struct wlan_dp_intf *dp_intf,
 	}
 }
 #else
-static void dp_fix_broadcast_eapol(struct wlan_dp_intf *dp_intf,
+static void dp_fix_broadcast_eapol(struct wlan_dp_link *dp_link,
 				   qdf_nbuf_t nbuf)
 {
 }
@@ -543,7 +543,7 @@ void wlan_dp_pkt_add_timestamp(struct wlan_dp_intf *dp_intf,
 		uint64_t tsf_time;
 
 		dp_ops = &dp_intf->dp_ctx->dp_ops;
-		dp_ops->dp_get_tsf_time(dp_intf->intf_id,
+		dp_ops->dp_get_tsf_time(dp_intf->dev,
 					qdf_get_log_timestamp(),
 					&tsf_time);
 		qdf_add_dp_pkt_timestamp(nbuf, index, tsf_time);
@@ -664,7 +664,7 @@ dp_start_xmit(struct wlan_dp_link *dp_link, qdf_nbuf_t nbuf)
 			     sizeof(qdf_nbuf_data(nbuf)),
 			     QDF_TX));
 
-	if (!dp_intf_is_tx_allowed(nbuf, dp_intf->intf_id, soc,
+	if (!dp_intf_is_tx_allowed(nbuf, dp_link->link_id, soc,
 				   mac_addr_tx_allowed.bytes)) {
 		dp_info("Tx not allowed for sta:" QDF_MAC_ADDR_FMT,
 			QDF_MAC_ADDR_REF(mac_addr_tx_allowed.bytes));
@@ -685,11 +685,11 @@ dp_start_xmit(struct wlan_dp_link *dp_link, qdf_nbuf_t nbuf)
 		goto drop_pkt_and_release_nbuf;
 	}
 
-	dp_fix_broadcast_eapol(dp_intf, nbuf);
+	dp_fix_broadcast_eapol(dp_link, nbuf);
 
-	if (dp_intf->txrx_ops.tx.tx(soc, dp_intf->intf_id, nbuf)) {
+	if (dp_intf->txrx_ops.tx.tx(soc, dp_link->link_id, nbuf)) {
 		dp_debug_rl("Failed to send packet from adapter %u",
-			    dp_intf->intf_id);
+			    dp_link->link_id);
 		goto drop_pkt_and_release_nbuf;
 	}
 
@@ -1438,16 +1438,22 @@ QDF_STATUS wlan_dp_rx_deliver_to_stack(struct wlan_dp_intf *dp_intf,
 	if (gro_disallowed == 0 &&
 	    dp_intf->gro_flushed[rx_ctx_id] != 0) {
 		if (qdf_likely(soc))
-			wlan_dp_set_fisa_disallowed_for_vdev(soc,
-							     dp_intf->intf_id,
-							     rx_ctx_id, 0);
+			/* TODO - Temp WAR to use def_link, till FISA is moved
+			 * to dp_intf
+			 */
+			wlan_dp_set_fisa_disallowed_for_vdev(
+					soc, dp_intf->def_link->link_id,
+					rx_ctx_id, 0);
 		dp_intf->gro_flushed[rx_ctx_id] = 0;
 	} else if (gro_disallowed &&
 		   dp_intf->gro_flushed[rx_ctx_id] == 0) {
 		if (qdf_likely(soc))
-			wlan_dp_set_fisa_disallowed_for_vdev(soc,
-							     dp_intf->intf_id,
-							     rx_ctx_id, 1);
+			/* TODO - Temp WAR to use def_link, till FISA is moved
+			 * to dp_intf
+			 */
+			wlan_dp_set_fisa_disallowed_for_vdev(
+					soc, dp_intf->def_link->link_id,
+					rx_ctx_id, 1);
 	}
 
 	if (nbuf_receive_offload_ok && dp_ctx->receive_offload_cb &&
@@ -1706,7 +1712,7 @@ QDF_STATUS dp_rx_packet_cbk(void *dp_link_context,
 								 PKT_TYPE_RSP,
 								 &pkt_type);
 
-		if ((dp_intf->conn_info.proxy_arp_service) &&
+		if ((dp_link->conn_info.proxy_arp_service) &&
 		    dp_is_gratuitous_arp_unsolicited_na(dp_ctx, nbuf)) {
 			qdf_atomic_inc(&stats->rx_usolict_arp_n_mcast_drp);
 			/* Remove SKB from internal tracking table before
@@ -1717,7 +1723,7 @@ QDF_STATUS dp_rx_packet_cbk(void *dp_link_context,
 		}
 
 		dp_event_eapol_log(nbuf, QDF_RX);
-		qdf_dp_trace_log_pkt(dp_intf->intf_id, nbuf, QDF_RX,
+		qdf_dp_trace_log_pkt(dp_link->link_id, nbuf, QDF_RX,
 				     QDF_TRACE_DEFAULT_PDEV_ID,
 				     dp_intf->device_mode);
 
@@ -1772,7 +1778,7 @@ QDF_STATUS dp_rx_packet_cbk(void *dp_link_context,
 		/* hold configurable wakelock for unicast traffic */
 		if (!dp_is_current_high_throughput(dp_ctx) &&
 		    dp_ctx->dp_cfg.rx_wakelock_timeout &&
-		    dp_intf->conn_info.is_authenticated)
+		    dp_link->conn_info.is_authenticated)
 			wake_lock = dp_is_rx_wake_lock_needed(nbuf);
 
 		if (wake_lock) {
@@ -1792,7 +1798,7 @@ QDF_STATUS dp_rx_packet_cbk(void *dp_link_context,
 
 		if (send_over_nl && dp_ctx->dp_ops.dp_send_rx_pkt_over_nl) {
 			if (dp_ctx->dp_ops.dp_send_rx_pkt_over_nl(dp_intf->dev,
-					(u8 *)&dp_intf->conn_info.peer_macaddr,
+					(u8 *)&dp_link->conn_info.peer_macaddr,
 								  nbuf, false))
 				qdf_status = QDF_STATUS_SUCCESS;
 			else

+ 11 - 12
components/dp/dispatcher/inc/wlan_dp_public_struct.h

@@ -640,12 +640,11 @@ struct wlan_dp_psoc_callbacks {
 
 	qdf_netdev_t (*dp_get_netdev_by_vdev_mac)(struct qdf_mac_addr *mac_addr);
 	unsigned int (*dp_get_tx_flow_low_watermark)(hdd_cb_handle cb_ctx,
-						     uint8_t intf_id);
+						     qdf_netdev_t netdev);
 	void (*dp_get_tx_resource)(uint8_t link_id_id,
 				   struct qdf_mac_addr *mac_addr);
-	void (*dp_get_tsf_time)(uint8_t intf_id,
-				uint64_t input_time, uint64_t *tsf_time);
-
+	void (*dp_get_tsf_time)(qdf_netdev_t netdev, uint64_t input_time,
+				uint64_t *tsf_time);
 	void (*dp_tsf_timestamp_rx)(hdd_cb_handle ctx, qdf_nbuf_t nbuf);
 
 	QDF_STATUS (*dp_nbuf_push_pkt)(qdf_nbuf_t nbuf,
@@ -675,13 +674,13 @@ struct wlan_dp_psoc_callbacks {
 	bool (*dp_send_rx_pkt_over_nl)(qdf_netdev_t dev, uint8_t *addr,
 				       qdf_nbuf_t nbuf, bool unecrypted);
 	bool
-	(*wlan_dp_sta_get_dot11mode)(hdd_cb_handle context, uint8_t vdev_id,
+	(*wlan_dp_sta_get_dot11mode)(hdd_cb_handle context, qdf_netdev_t netdev,
 				     enum qca_wlan_802_11_mode *dot11_mode);
 	bool (*wlan_dp_get_ap_client_count)(hdd_cb_handle context,
-					    uint8_t vdev_id,
+					    qdf_netdev_t netdev,
 					    uint16_t *client_count);
 	bool (*wlan_dp_sta_ndi_connected)(hdd_cb_handle context,
-					  uint8_t vdev_id);
+					  qdf_netdev_t netdev);
 	bool (*dp_any_adapter_connected)(hdd_cb_handle context);
 	void (*dp_send_svc_nlink_msg)(int radio, int type, void *data, int len);
 
@@ -690,7 +689,7 @@ struct wlan_dp_psoc_callbacks {
 					       union wlan_tp_data *data,
 					       uint8_t dir);
 	void (*dp_send_mscs_action_frame)(hdd_cb_handle context,
-					  uint8_t vdev_id);
+					  qdf_netdev_t netdev);
 	void (*dp_pm_qos_add_request)(hdd_cb_handle context);
 	void (*dp_pm_qos_remove_request)(hdd_cb_handle context);
 	void (*dp_pm_qos_update_request)(hdd_cb_handle context,
@@ -701,22 +700,22 @@ struct wlan_dp_psoc_callbacks {
 					bool enable_disable_flag,
 					uint8_t user_triggered, int size);
 	bool (*dp_is_roaming_in_progress)(hdd_cb_handle context);
-	bool (*dp_is_ap_active)(hdd_cb_handle context, uint8_t vdev_id);
+	bool (*dp_is_ap_active)(hdd_cb_handle context, qdf_netdev_t netdev);
 	void (*dp_disable_rx_ol_for_low_tput)(hdd_cb_handle context,
 					      bool disable);
 	int (*dp_napi_apply_throughput_policy)(hdd_cb_handle context,
 					       uint64_t tx_packets,
 					       uint64_t rx_packets);
 	void (*wlan_dp_display_tx_multiq_stats)(hdd_cb_handle context,
-						uint8_t vdev_id);
+						qdf_netdev_t netdev);
 	void (*wlan_dp_display_netif_queue_history)(hdd_cb_handle context,
 				enum qdf_stats_verbosity_level verb_lvl);
 	void (*osif_dp_process_mic_error)(struct dp_mic_error_info *info,
 					  struct wlan_objmgr_vdev *vdev);
 	bool (*dp_is_link_adapter)(hdd_cb_handle context, uint8_t vdev_id);
 	void (*os_if_dp_nud_stats_info)(struct wlan_objmgr_vdev *vdev);
-	uint32_t (*dp_get_pause_map)(hdd_cb_handle context, uint8_t vdev_id);
-	void (*dp_nud_failure_work)(hdd_cb_handle context, uint8_t vdev_id);
+	uint32_t (*dp_get_pause_map)(hdd_cb_handle context, qdf_netdev_t dev);
+	void (*dp_nud_failure_work)(hdd_cb_handle context, qdf_netdev_t dev);
 	void (*link_monitoring_cb)(struct wlan_objmgr_psoc *psoc,
 				   uint8_t vdev_id,
 				   bool is_link_speed_good);

+ 6 - 6
components/dp/dispatcher/inc/wlan_dp_ucfg_api.h

@@ -924,12 +924,12 @@ bool ucfg_dp_get_dad_value(struct wlan_objmgr_vdev *vdev);
 bool ucfg_dp_get_con_status_value(struct wlan_objmgr_vdev *vdev);
 
 /**
- * ucfg_dp_get_intf_id() - Get intf_id
+ * ucfg_dp_get_link_id() - Get link_id
  * @vdev: vdev context
  *
- * Return: intf_id
+ * Return: link_id
  */
-uint8_t ucfg_dp_get_intf_id(struct wlan_objmgr_vdev *vdev);
+uint8_t ucfg_dp_get_link_id(struct wlan_objmgr_vdev *vdev);
 
 /**
  * ucfg_dp_get_arp_stats() - Get ARP stats
@@ -1414,13 +1414,13 @@ void ucfg_dp_wfds_del_server(void);
 
 /**
  * ucfg_dp_config_direct_link() - Set direct link config for vdev
- * @vdev: objmgr Vdev handle
+ * @dev: netdev
  * @config_direct_link: Flag to enable direct link path
  * @enable_low_latency: Flag to enable low link latency
  *
  * Return: QDF Status
  */
-QDF_STATUS ucfg_dp_config_direct_link(struct wlan_objmgr_vdev *vdev,
+QDF_STATUS ucfg_dp_config_direct_link(qdf_netdev_t dev,
 				      bool config_direct_link,
 				      bool enable_low_latency);
 #else
@@ -1457,7 +1457,7 @@ static inline void ucfg_dp_wfds_del_server(void)
 #endif
 
 static inline
-QDF_STATUS ucfg_dp_config_direct_link(struct wlan_objmgr_vdev *vdev,
+QDF_STATUS ucfg_dp_config_direct_link(qdf_netdev_t dev,
 				      bool config_direct_link,
 				      bool enable_low_latency)
 {

+ 54 - 44
components/dp/dispatcher/src/wlan_dp_ucfg_api.c

@@ -53,17 +53,25 @@ static inline
 QDF_STATUS wlan_dp_set_vdev_direct_link_cfg(struct wlan_objmgr_psoc *psoc,
 					    struct wlan_dp_intf *dp_intf)
 {
+	struct wlan_dp_link *dp_link, *dp_link_next;
 	cdp_config_param_type vdev_param = {0};
+	QDF_STATUS status;
 
 	if (dp_intf->device_mode != QDF_SAP_MODE ||
 	    !dp_intf->dp_ctx->dp_direct_link_ctx)
 		return QDF_STATUS_SUCCESS;
 
-	vdev_param.cdp_vdev_tx_to_fw = dp_intf->direct_link_config.config_set;
+	dp_for_each_link_held_safe(dp_intf, dp_link, dp_link_next) {
+		vdev_param.cdp_vdev_tx_to_fw =
+					dp_intf->direct_link_config.config_set;
+		status = cdp_txrx_set_vdev_param(wlan_psoc_get_dp_handle(psoc),
+						 dp_link->link_id,
+						 CDP_VDEV_TX_TO_FW, vdev_param);
+		if (QDF_IS_STATUS_ERROR(status))
+			break;
+	}
 
-	return cdp_txrx_set_vdev_param(wlan_psoc_get_dp_handle(psoc),
-				       dp_intf->intf_id, CDP_VDEV_TX_TO_FW,
-				       vdev_param);
+	return status;
 }
 #else
 static inline
@@ -97,6 +105,11 @@ void ucfg_dp_update_inf_mac(struct wlan_objmgr_psoc *psoc,
 
 	qdf_copy_macaddr(&dp_intf->mac_addr, new_mac);
 
+	/*
+	 * TODO - Expectation here is that
+	 * vdevs will be deleted and created for MLD addr change
+	 * Hence, set the direct link config for all its links
+	 */
 	wlan_dp_set_vdev_direct_link_cfg(psoc, dp_intf);
 }
 
@@ -123,7 +136,6 @@ ucfg_dp_create_intf(struct wlan_objmgr_psoc *psoc,
 	dp_intf->def_link = NULL;
 	dp_intf->dp_ctx = dp_ctx;
 	dp_intf->dev = ndev;
-	dp_intf->intf_id = WLAN_UMAC_VDEV_ID_MAX;
 	qdf_copy_macaddr(&dp_intf->mac_addr, intf_addr);
 
 	qdf_spin_lock_bh(&dp_ctx->intf_list_lock);
@@ -162,8 +174,15 @@ ucfg_dp_destroy_intf(struct wlan_objmgr_psoc *psoc,
 		return QDF_STATUS_E_FAILURE;
 	}
 
+	/*
+	 * TODO - dp_intf is destroyed, so such config is no longer
+	 * required.
+	 * Check and confirm this theory and remove this call
+	 */
+	/*
 	if (dp_intf->device_mode == QDF_SAP_MODE)
 		dp_config_direct_link(dp_intf, false, false);
+	*/
 
 	dp_periodic_sta_stats_mutex_destroy(dp_intf);
 	dp_nud_deinit_tracking(dp_intf);
@@ -591,7 +610,6 @@ void ucfg_dp_wait_complete_tasks(void)
 
 void ucfg_dp_remove_conn_info(struct wlan_objmgr_vdev *vdev)
 {
-	struct wlan_dp_intf *dp_intf;
 	struct wlan_dp_link *dp_link;
 
 	dp_link = dp_get_vdev_priv_obj(vdev);
@@ -600,15 +618,13 @@ void ucfg_dp_remove_conn_info(struct wlan_objmgr_vdev *vdev)
 		return;
 	}
 
-	dp_intf = dp_link->dp_intf;
-	qdf_mem_zero(&dp_intf->conn_info,
+	qdf_mem_zero(&dp_link->conn_info,
 		     sizeof(struct wlan_dp_conn_info));
 }
 
 void ucfg_dp_conn_info_set_bssid(struct wlan_objmgr_vdev *vdev,
 				 struct qdf_mac_addr *bssid)
 {
-	struct wlan_dp_intf *dp_intf;
 	struct wlan_dp_link *dp_link;
 
 	dp_link = dp_get_vdev_priv_obj(vdev);
@@ -617,14 +633,12 @@ void ucfg_dp_conn_info_set_bssid(struct wlan_objmgr_vdev *vdev,
 		return;
 	}
 
-	dp_intf = dp_link->dp_intf;
-	qdf_copy_macaddr(&dp_intf->conn_info.bssid, bssid);
+	qdf_copy_macaddr(&dp_link->conn_info.bssid, bssid);
 }
 
 void ucfg_dp_conn_info_set_arp_service(struct wlan_objmgr_vdev *vdev,
 				       uint8_t proxy_arp_service)
 {
-	struct wlan_dp_intf *dp_intf;
 	struct wlan_dp_link *dp_link;
 
 	dp_link = dp_get_vdev_priv_obj(vdev);
@@ -633,14 +647,12 @@ void ucfg_dp_conn_info_set_arp_service(struct wlan_objmgr_vdev *vdev,
 		return;
 	}
 
-	dp_intf = dp_link->dp_intf;
-	dp_intf->conn_info.proxy_arp_service = proxy_arp_service;
+	dp_link->conn_info.proxy_arp_service = proxy_arp_service;
 }
 
 void ucfg_dp_conn_info_set_peer_authenticate(struct wlan_objmgr_vdev *vdev,
 					     uint8_t is_authenticated)
 {
-	struct wlan_dp_intf *dp_intf;
 	struct wlan_dp_link *dp_link;
 
 	dp_link = dp_get_vdev_priv_obj(vdev);
@@ -649,14 +661,12 @@ void ucfg_dp_conn_info_set_peer_authenticate(struct wlan_objmgr_vdev *vdev,
 		return;
 	}
 
-	dp_intf = dp_link->dp_intf;
-	dp_intf->conn_info.is_authenticated = is_authenticated;
+	dp_link->conn_info.is_authenticated = is_authenticated;
 }
 
 void ucfg_dp_conn_info_set_peer_mac(struct wlan_objmgr_vdev *vdev,
 				    struct qdf_mac_addr *peer_mac)
 {
-	struct wlan_dp_intf *dp_intf;
 	struct wlan_dp_link *dp_link;
 
 	dp_link = dp_get_vdev_priv_obj(vdev);
@@ -665,8 +675,7 @@ void ucfg_dp_conn_info_set_peer_mac(struct wlan_objmgr_vdev *vdev,
 		return;
 	}
 
-	dp_intf = dp_link->dp_intf;
-	qdf_copy_macaddr(&dp_intf->conn_info.peer_macaddr, peer_mac);
+	qdf_copy_macaddr(&dp_link->conn_info.peer_macaddr, peer_mac);
 }
 
 void ucfg_dp_softap_check_wait_for_tx_eap_pkt(struct wlan_objmgr_vdev *vdev,
@@ -718,7 +727,7 @@ void ucfg_dp_update_dhcp_state_on_disassoc(struct wlan_objmgr_vdev *vdev,
 	/* Send DHCP STOP indication to FW */
 	stainfo->dhcp_phase = DHCP_PHASE_ACK;
 	if (stainfo->dhcp_nego_status == DHCP_NEGO_IN_PROGRESS)
-		dp_post_dhcp_ind(dp_intf,
+		dp_post_dhcp_ind(dp_link,
 				 stainfo->sta_mac.bytes,
 				 0);
 	stainfo->dhcp_nego_status = DHCP_NEGO_STOP;
@@ -1006,14 +1015,15 @@ dp_rx_register_fisa_ops(struct ol_txrx_ops *txrx_ops)
 #endif
 
 #ifdef CONFIG_DP_PKT_ADD_TIMESTAMP
-static QDF_STATUS wlan_dp_get_tsf_time(void *dp_intf_ctx,
+static QDF_STATUS wlan_dp_get_tsf_time(void *dp_link_ctx,
 				       uint64_t input_time,
 				       uint64_t *tsf_time)
 {
-	struct wlan_dp_intf *dp_intf = (struct wlan_dp_intf *)dp_intf_ctx;
+	struct wlan_dp_link *dp_link = (struct wlan_dp_link *)dp_link_ctx;
+	struct wlan_dp_intf *dp_intf = dp_link->dp_intf;
 	struct wlan_dp_psoc_callbacks *dp_ops = &dp_intf->dp_ctx->dp_ops;
 
-	dp_ops->dp_get_tsf_time(dp_intf->intf_id,
+	dp_ops->dp_get_tsf_time(dp_intf->dev,
 				input_time,
 				tsf_time);
 	return QDF_STATUS_SUCCESS;
@@ -1151,7 +1161,7 @@ QDF_STATUS ucfg_dp_ocb_register_txrx_ops(struct wlan_objmgr_vdev *vdev)
 	txrx_ops.rx.rx = dp_rx_packet_cbk;
 	txrx_ops.rx.stats_rx = dp_tx_rx_collect_connectivity_stats_info;
 
-	cdp_vdev_register(soc, dp_intf->intf_id, (ol_osif_vdev_handle)dp_intf,
+	cdp_vdev_register(soc, dp_link->link_id, (ol_osif_vdev_handle)dp_link,
 			  &txrx_ops);
 	if (!txrx_ops.tx.tx) {
 		dp_err("vdev register fail");
@@ -1160,8 +1170,8 @@ QDF_STATUS ucfg_dp_ocb_register_txrx_ops(struct wlan_objmgr_vdev *vdev)
 
 	dp_intf->txrx_ops = txrx_ops;
 
-	qdf_copy_macaddr(&dp_intf->conn_info.peer_macaddr,
-			 &dp_intf->mac_addr);
+	qdf_copy_macaddr(&dp_link->conn_info.peer_macaddr,
+			 &dp_link->mac_addr);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -1184,8 +1194,8 @@ QDF_STATUS ucfg_dp_mon_register_txrx_ops(struct wlan_objmgr_vdev *vdev)
 	qdf_mem_zero(&txrx_ops, sizeof(txrx_ops));
 	txrx_ops.rx.rx = dp_mon_rx_packet_cbk;
 	dp_monitor_set_rx_monitor_cb(&txrx_ops, dp_rx_monitor_callback);
-	cdp_vdev_register(soc, dp_intf->intf_id,
-			  (ol_osif_vdev_handle)dp_intf,
+	cdp_vdev_register(soc, dp_link->link_id,
+			  (ol_osif_vdev_handle)dp_link,
 			  &txrx_ops);
 
 	dp_intf->txrx_ops = txrx_ops;
@@ -1225,8 +1235,8 @@ QDF_STATUS ucfg_dp_softap_register_txrx_ops(struct wlan_objmgr_vdev *vdev,
 
 	txrx_ops->get_tsf_time = wlan_dp_get_tsf_time;
 	cdp_vdev_register(soc,
-			  dp_intf->intf_id,
-			  (ol_osif_vdev_handle)dp_intf,
+			  dp_link->link_id,
+			  (ol_osif_vdev_handle)dp_link,
 			  txrx_ops);
 	if (!txrx_ops->tx.tx) {
 		dp_err("vdev register fail");
@@ -1884,18 +1894,16 @@ bool ucfg_dp_get_con_status_value(struct wlan_objmgr_vdev *vdev)
 	return dp_intf->con_status;
 }
 
-uint8_t ucfg_dp_get_intf_id(struct wlan_objmgr_vdev *vdev)
+uint8_t ucfg_dp_get_link_id(struct wlan_objmgr_vdev *vdev)
 {
 	struct wlan_dp_link *dp_link = dp_get_vdev_priv_obj(vdev);
-	struct wlan_dp_intf *dp_intf;
 
 	if (!dp_link) {
 		dp_err("Unable to get DP link");
 		return 0;
 	}
 
-	dp_intf = dp_link->dp_intf;
-	return dp_intf->intf_id;
+	return dp_link->link_id;
 }
 
 struct dp_arp_stats *ucfg_dp_get_arp_stats(struct wlan_objmgr_vdev *vdev)
@@ -2347,15 +2355,13 @@ ucfg_dp_softap_inspect_dhcp_packet(struct wlan_objmgr_vdev *vdev,
 				   qdf_nbuf_t nbuf, enum qdf_proto_dir dir)
 {
 	struct wlan_dp_link *dp_link = dp_get_vdev_priv_obj(vdev);
-	struct wlan_dp_intf *dp_intf;
 
 	if (!dp_link) {
 		dp_err("Unable to get DP link");
 		return QDF_STATUS_E_INVAL;
 	}
 
-	dp_intf = dp_link->dp_intf;
-	return dp_softap_inspect_dhcp_packet(dp_intf, nbuf, dir);
+	return dp_softap_inspect_dhcp_packet(dp_link, nbuf, dir);
 }
 
 void
@@ -2440,7 +2446,7 @@ ucfg_dp_traffic_end_indication_set(struct wlan_objmgr_vdev *vdev,
 
 	vdev_param.cdp_vdev_param_traffic_end_ind = info.enabled;
 	if (cdp_txrx_set_vdev_param(cds_get_context(QDF_MODULE_ID_SOC),
-				    dp_intf->intf_id,
+				    dp_link->link_id,
 				    CDP_ENABLE_TRAFFIC_END_INDICATION,
 				    vdev_param))
 		dp_err("Failed to set traffic end indication param on DP vdev");
@@ -2577,19 +2583,23 @@ void ucfg_dp_wfds_del_server(void)
 	dp_wfds_del_server();
 }
 
-QDF_STATUS ucfg_dp_config_direct_link(struct wlan_objmgr_vdev *vdev,
+QDF_STATUS ucfg_dp_config_direct_link(qdf_netdev_t dev,
 				      bool config_direct_link,
 				      bool enable_low_latency)
 {
-	struct wlan_dp_link *dp_link = dp_get_vdev_priv_obj(vdev);
+	struct wlan_dp_psoc_context *dp_ctx;
 	struct wlan_dp_intf *dp_intf;
 
-	if (!dp_link) {
-		dp_err("Unable to get DP link");
+	dp_ctx = dp_get_context();
+	if (!dp_ctx)
+		return QDF_STATUS_E_FAILURE;
+
+	dp_intf = dp_get_intf_by_netdev(dp_ctx, dev);
+	if (!dp_intf) {
+		dp_err("Unable to get DP interface");
 		return QDF_STATUS_E_INVAL;
 	}
 
-	dp_intf = dp_link->dp_intf;
 	return dp_config_direct_link(dp_intf, config_direct_link,
 				     enable_low_latency);
 }

+ 9 - 7
core/hdd/inc/wlan_hdd_tx_rx.h

@@ -122,21 +122,23 @@ void hdd_tsf_timestamp_rx(hdd_cb_handle ctx, qdf_nbuf_t netbuf);
 
 /**
  * hdd_get_tsf_time_cb() - HDD helper function to get TSF time
- * @vdev_id: vdev id mapped to adapter
+ * @netdev: netdev
  * @input_time: Input time
  * @tsf_time: time from TFS module
  *
  * Return: None
  */
-void hdd_get_tsf_time_cb(uint8_t vdev_id, uint64_t input_time,
+void hdd_get_tsf_time_cb(qdf_netdev_t netdev, uint64_t input_time,
 			 uint64_t *tsf_time);
 #else
 static inline
 void hdd_tsf_timestamp_rx(hdd_cb_handle ctx, qdf_nbuf_t netbuf) { }
 
 static inline
-void hdd_get_tsf_time_cb(uint8_t vdev_id, uint64_t input_time,
-			 uint64_t *tsf_time) { }
+void hdd_get_tsf_time_cb(qdf_netdev_t netdev, uint64_t input_time,
+			 uint64_t *tsf_time)
+{
+}
 #endif
 
 /**
@@ -210,12 +212,12 @@ void hdd_get_tx_resource(uint8_t vdev_id,
 /**
  * hdd_get_tx_flow_low_watermark() - Get TX flow low watermark info
  * @cb_ctx: HDD opaque ctx
- * @intf_id: HDD adapter id
+ * @netdev: netdev
  *
  * Return: flow low watermark value
  */
 unsigned int
-hdd_get_tx_flow_low_watermark(hdd_cb_handle cb_ctx, uint8_t intf_id);
+hdd_get_tx_flow_low_watermark(hdd_cb_handle cb_ctx, qdf_netdev_t netdev);
 #else
 static inline void hdd_tx_resume_cb(void *adapter_context, bool tx_resume)
 {
@@ -246,7 +248,7 @@ void hdd_get_tx_resource(uint8_t vdev_id,
 			 struct qdf_mac_addr *mac_addr) { }
 
 static inline unsigned int
-hdd_get_tx_flow_low_watermark(hdd_cb_handle cb_ctx, uint8_t intf_id)
+hdd_get_tx_flow_low_watermark(hdd_cb_handle cb_ctx, qdf_netdev_t netdev)
 {
 	return 0;
 }

+ 16 - 11
core/hdd/src/wlan_hdd_cfg80211.c

@@ -15327,9 +15327,10 @@ uint8_t hdd_get_sap_operating_band(struct hdd_context *hdd_ctx)
 }
 
 static inline QDF_STATUS
-wlan_hdd_config_dp_direct_link_profile(struct wlan_objmgr_vdev *vdev,
+wlan_hdd_config_dp_direct_link_profile(struct hdd_adapter *adapter,
 				       enum host_concurrent_ap_policy ap_policy)
 {
+	struct wlan_objmgr_vdev *vdev = adapter->deflink->vdev;
 	enum host_concurrent_ap_policy prev_ap_policy;
 
 	prev_ap_policy = ucfg_mlme_get_ap_policy(vdev);
@@ -15341,9 +15342,11 @@ wlan_hdd_config_dp_direct_link_profile(struct wlan_objmgr_vdev *vdev,
 	case HOST_CONCURRENT_AP_POLICY_UNSPECIFIED:
 		switch (ap_policy) {
 		case HOST_CONCURRENT_AP_POLICY_LOSSLESS_AUDIO_STREAMING:
-			return ucfg_dp_config_direct_link(vdev, true, false);
+			return ucfg_dp_config_direct_link(adapter->dev, true,
+							  false);
 		case HOST_CONCURRENT_AP_POLICY_GAMING_AUDIO:
-			return ucfg_dp_config_direct_link(vdev, true, true);
+			return ucfg_dp_config_direct_link(adapter->dev, true,
+							  true);
 		default:
 			break;
 		}
@@ -15352,7 +15355,8 @@ wlan_hdd_config_dp_direct_link_profile(struct wlan_objmgr_vdev *vdev,
 		switch (ap_policy) {
 		case HOST_CONCURRENT_AP_POLICY_UNSPECIFIED:
 		case HOST_CONCURRENT_AP_POLICY_LOSSLESS_AUDIO_STREAMING:
-			return ucfg_dp_config_direct_link(vdev, true, false);
+			return ucfg_dp_config_direct_link(adapter->dev, true,
+							  false);
 		default:
 			break;
 		}
@@ -15360,7 +15364,8 @@ wlan_hdd_config_dp_direct_link_profile(struct wlan_objmgr_vdev *vdev,
 	case HOST_CONCURRENT_AP_POLICY_LOSSLESS_AUDIO_STREAMING:
 		switch (ap_policy) {
 		case HOST_CONCURRENT_AP_POLICY_GAMING_AUDIO:
-			return ucfg_dp_config_direct_link(vdev, true, true);
+			return ucfg_dp_config_direct_link(adapter->dev, true,
+							  true);
 		default:
 			break;
 		}
@@ -15541,14 +15546,14 @@ static int __wlan_hdd_cfg80211_dual_sta_policy(struct hdd_context *hdd_ctx,
 /**
  * __wlan_hdd_cfg80211_ap_policy() - Wrapper to configure the concurrent
  * session policies
- * @vdev: pointer to vdev
+ * @adapter: HDD adapter
  * @tb: parsed attribute array
  *
  * Configure the concurrent session policies when multiple STA ifaces are
  * (getting) active.
  * Return: 0 on success; errno on failure
  */
-static int __wlan_hdd_cfg80211_ap_policy(struct wlan_objmgr_vdev *vdev,
+static int __wlan_hdd_cfg80211_ap_policy(struct hdd_adapter *adapter,
 					 struct nlattr **tb)
 {
 	QDF_STATUS status;
@@ -15560,7 +15565,7 @@ static int __wlan_hdd_cfg80211_ap_policy(struct wlan_objmgr_vdev *vdev,
 	uint8_t ap_config =
 		QCA_WLAN_CONCURRENT_AP_POLICY_LOSSLESS_AUDIO_STREAMING;
 
-	vdev_id = wlan_vdev_get_id(vdev);
+	vdev_id = wlan_vdev_get_id(adapter->deflink->vdev);
 	device_mode = hdd_get_device_mode(vdev_id);
 	if (device_mode != QDF_SAP_MODE) {
 		hdd_err_rl("command not allowed in %d mode, vdev_id: %d",
@@ -15590,12 +15595,12 @@ static int __wlan_hdd_cfg80211_ap_policy(struct wlan_objmgr_vdev *vdev,
 		hdd_err("Failed to set profile %d", profile);
 		return -EINVAL;
 	}
-	status = wlan_hdd_config_dp_direct_link_profile(vdev, ap_cfg_policy);
+	status = wlan_hdd_config_dp_direct_link_profile(adapter, ap_cfg_policy);
 	if (QDF_IS_STATUS_ERROR(status)) {
 		hdd_err("failed to set DP ap config");
 		return -EINVAL;
 	}
-	status = ucfg_mlme_set_ap_policy(vdev, ap_cfg_policy);
+	status = ucfg_mlme_set_ap_policy(adapter->deflink->vdev, ap_cfg_policy);
 	if (QDF_IS_STATUS_ERROR(status)) {
 		hdd_err("failed to set MLME ap config");
 		return -EINVAL;
@@ -15658,7 +15663,7 @@ static int __wlan_hdd_cfg80211_concurrent_session_policy(
 		__wlan_hdd_cfg80211_dual_sta_policy(adapter->hdd_ctx, tb);
 
 	if (tb[QCA_WLAN_VENDOR_ATTR_CONCURRENT_POLICY_AP_CONFIG])
-		__wlan_hdd_cfg80211_ap_policy(adapter->deflink->vdev, tb);
+		__wlan_hdd_cfg80211_ap_policy(adapter, tb);
 
 	return 0;
 }

+ 46 - 45
core/hdd/src/wlan_hdd_main.c

@@ -11436,30 +11436,30 @@ void hdd_send_mscs_action_frame(struct wlan_hdd_link_info *link_info)
 /**
  * wlan_hdd_sta_get_dot11mode() - GET AP client count
  * @context: HDD context
- * @vdev_id: vdev ID
+ * @netdev: netdev
  * @dot11_mode: variable in which mode need to update.
  *
  * Return: true on success else false
  */
 static inline
-bool wlan_hdd_sta_get_dot11mode(hdd_cb_handle context, uint8_t vdev_id,
+bool wlan_hdd_sta_get_dot11mode(hdd_cb_handle context, qdf_netdev_t netdev,
 				enum qca_wlan_802_11_mode *dot11_mode)
 {
 	struct hdd_context *hdd_ctx;
 	struct wlan_hdd_link_info *link_info;
 	struct hdd_station_ctx *sta_ctx;
+	struct hdd_adapter *adapter;
 	enum csr_cfgdot11mode mode;
 
 	hdd_ctx = hdd_cb_handle_to_context(context);
 	if (!hdd_ctx)
 		return false;
 
-	link_info = hdd_get_link_info_by_vdev(hdd_ctx, vdev_id);
-	if (!link_info)
+	adapter = WLAN_HDD_GET_PRIV_PTR(netdev);
+	if (!adapter)
 		return false;
 
-	if (!hdd_cm_is_vdev_associated(link_info))
-		return false;
+	link_info = adapter->deflink;
 
 	sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(link_info);
 	mode = sta_ctx->conn_info.dot11mode;
@@ -11470,17 +11470,18 @@ bool wlan_hdd_sta_get_dot11mode(hdd_cb_handle context, uint8_t vdev_id,
 /**
  * wlan_hdd_get_ap_client_count() - GET AP client count
  * @context: HDD context
- * @vdev_id: vdev ID
+ * @netdev: netdev
  * @client_count: variable in which number of client need to update.
  *
  * Return: true on success else false
  */
 static inline
-bool wlan_hdd_get_ap_client_count(hdd_cb_handle context, uint8_t vdev_id,
+bool wlan_hdd_get_ap_client_count(hdd_cb_handle context, qdf_netdev_t netdev,
 				  uint16_t *client_count)
 {
 	struct hdd_context *hdd_ctx;
 	struct wlan_hdd_link_info *link_info;
+	struct hdd_adapter *adapter;
 	struct hdd_ap_ctx *ap_ctx;
 	enum qca_wlan_802_11_mode i;
 
@@ -11490,31 +11491,35 @@ bool wlan_hdd_get_ap_client_count(hdd_cb_handle context, uint8_t vdev_id,
 		return false;
 	}
 
-	link_info = hdd_get_link_info_by_vdev(hdd_ctx, vdev_id);
-	if (!link_info) {
-		hdd_err("Invalid vdev");
+	adapter = WLAN_HDD_GET_PRIV_PTR(netdev);
+	if (!adapter) {
+		hdd_err("adapter is null");
 		return false;
 	}
 
+	link_info = adapter->deflink;
 	ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(link_info);
 	if (!ap_ctx->ap_active)
 		return false;
+
 	for (i = QCA_WLAN_802_11_MODE_11B; i < QCA_WLAN_802_11_MODE_INVALID;
 	     i++)
 		client_count[i] = ap_ctx->client_count[i];
+
 	return true;
 }
 
 /**
  * wlan_hdd_sta_ndi_connected() - Check if NDI connected
  * @context: HDD context
- * @vdev_id: vdev ID
+ * @netdev: netdev
  *
  * Return: true if NDI connected else false
  */
 static inline
-bool wlan_hdd_sta_ndi_connected(hdd_cb_handle context, uint8_t vdev_id)
+bool wlan_hdd_sta_ndi_connected(hdd_cb_handle context, qdf_netdev_t netdev)
 {
+	struct hdd_adapter *adapter;
 	struct hdd_context *hdd_ctx;
 	struct wlan_hdd_link_info *link_info;
 	struct hdd_station_ctx *sta_ctx;
@@ -11525,12 +11530,14 @@ bool wlan_hdd_sta_ndi_connected(hdd_cb_handle context, uint8_t vdev_id)
 		return false;
 	}
 
-	link_info = hdd_get_link_info_by_vdev(hdd_ctx, vdev_id);
-	if (!link_info) {
-		hdd_err("Invalid vdev");
+	adapter = WLAN_HDD_GET_PRIV_PTR(netdev);
+	if (!adapter) {
+		hdd_err("adapter is null");
 		return false;
 	}
 
+	link_info = adapter->deflink;
+
 	sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(link_info);
 	if (sta_ctx->conn_info.conn_state != eConnectionState_NdiConnected)
 		return false;
@@ -11582,12 +11589,13 @@ static inline bool wlan_hdd_is_roaming_in_progress(hdd_cb_handle context)
 /**
  * hdd_is_ap_active() - Check if AP is active
  * @context: HDD context
- * @vdev_id: Vdev ID
+ * @netdev: netdev
  *
  * Return: true if AP active else false
  */
-static inline bool hdd_is_ap_active(hdd_cb_handle context, uint8_t vdev_id)
+static inline bool hdd_is_ap_active(hdd_cb_handle context, qdf_netdev_t netdev)
 {
+	struct hdd_adapter *adapter;
 	struct hdd_context *hdd_ctx;
 	struct wlan_hdd_link_info *link_info;
 
@@ -11597,11 +11605,13 @@ static inline bool hdd_is_ap_active(hdd_cb_handle context, uint8_t vdev_id)
 		return false;
 	}
 
-	link_info = hdd_get_link_info_by_vdev(hdd_ctx, vdev_id);
-	if (!link_info) {
-		hdd_err("Invalid vdev");
+	adapter = WLAN_HDD_GET_PRIV_PTR(netdev);
+	if (!adapter) {
+		hdd_err("adapter is null");
 		return false;
 	}
+
+	link_info = adapter->deflink;
 	return WLAN_HDD_GET_AP_CTX_PTR(link_info)->ap_active;
 }
 
@@ -11660,27 +11670,22 @@ static inline bool hdd_is_link_adapter(hdd_cb_handle context, uint8_t vdev_id)
 /**
  * hdd_get_pause_map() - Get pause map value
  * @context: HDD context
- * @vdev_id: Vdev ID
+ * @netdev: netdev
  *
  * Return: pause map value
  */
 static inline
-uint32_t hdd_get_pause_map(hdd_cb_handle context, uint8_t vdev_id)
+uint32_t hdd_get_pause_map(hdd_cb_handle context, qdf_netdev_t netdev)
 {
-	struct hdd_context *hdd_ctx = hdd_cb_handle_to_context(context);
-	struct wlan_hdd_link_info *link_info;
+	struct hdd_adapter *adapter;
 
-	if (!hdd_ctx) {
-		hdd_err("hdd_ctx is null");
+	adapter = WLAN_HDD_GET_PRIV_PTR(netdev);
+	if (!adapter) {
+		hdd_err("adapter is null");
 		return 0;
 	}
 
-	link_info = hdd_get_link_info_by_vdev(hdd_ctx, vdev_id);
-	if (!link_info) {
-		hdd_err("Invalid vdev");
-		return 0;
-	}
-	return link_info->adapter->pause_map;
+	return adapter->pause_map;
 }
 
 /**
@@ -11806,27 +11811,23 @@ static inline void wlan_hdd_pm_qos_remove_request(hdd_cb_handle context)
 /**
  * wlan_hdd_send_mscs_action_frame() - Send MSCS action frame
  * @context: HDD context
- * @vdev_id: Vdev ID
+ * @netdev: netdev
  *
  * Return: None
  */
 static inline void wlan_hdd_send_mscs_action_frame(hdd_cb_handle context,
-						   uint8_t vdev_id)
+						   qdf_netdev_t netdev)
 {
-	struct hdd_context *hdd_ctx;
+	struct hdd_adapter *adapter;
 	struct wlan_hdd_link_info *link_info;
 
-	hdd_ctx = hdd_cb_handle_to_context(context);
-	if (!hdd_ctx) {
-		hdd_err("hdd_ctx is null");
+	adapter = WLAN_HDD_GET_PRIV_PTR(netdev);
+	if (!adapter) {
+		hdd_err("adapter is null");
 		return;
 	}
 
-	link_info = hdd_get_link_info_by_vdev(hdd_ctx, vdev_id);
-	if (!link_info) {
-		hdd_err("Invalid vdev");
-		return;
-	}
+	link_info = adapter->deflink;
 	hdd_send_mscs_action_frame(link_info);
 }
 
@@ -11854,7 +11855,7 @@ static inline void wlan_hdd_pm_qos_remove_request(hdd_cb_handle context)
 }
 
 static inline void wlan_hdd_send_mscs_action_frame(hdd_cb_handle context,
-						   uint8_t vdev_id)
+						   qdf_netdev_t netdev)
 {
 }
 #endif

+ 4 - 13
core/hdd/src/wlan_hdd_nud_tracking.c

@@ -125,26 +125,17 @@ __hdd_nud_failure_work(struct hdd_adapter *adapter)
 	hdd_exit();
 }
 
-void hdd_nud_failure_work(hdd_cb_handle context, uint8_t vdev_id)
+void hdd_nud_failure_work(hdd_cb_handle context, qdf_netdev_t netdev)
 {
-	struct hdd_context *hdd_ctx;
 	struct hdd_adapter *adapter;
-	struct wlan_hdd_link_info *link_info;
 	struct osif_vdev_sync *vdev_sync;
 
-	hdd_ctx = hdd_cb_handle_to_context(context);
-	if (!hdd_ctx) {
-		hdd_err("hdd_ctx is null");
-		return;
-	}
-
-	link_info = hdd_get_link_info_by_vdev(hdd_ctx, vdev_id);
-	if (!link_info) {
-		hdd_err("Invalid vdev");
+	adapter = WLAN_HDD_GET_PRIV_PTR(netdev);
+	if (!adapter) {
+		hdd_err("adapter is null");
 		return;
 	}
 
-	adapter = link_info->adapter;
 	if (osif_vdev_sync_op_start(adapter->dev, &vdev_sync))
 		return;
 

+ 4 - 4
core/hdd/src/wlan_hdd_nud_tracking.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-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
@@ -29,14 +29,14 @@
 /**
  * hdd_nud_failure_work() - Handle NUD failuire work
  * @context: HDD context pointer
- * @vdev_id: vdev id
+ * @netdev: netdev
  *
  * Return: None
  */
-void hdd_nud_failure_work(hdd_cb_handle context, uint8_t vdev_id);
+void hdd_nud_failure_work(hdd_cb_handle context, qdf_netdev_t netdev);
 #else
 static inline void
-hdd_nud_failure_work(hdd_cb_handle context, uint8_t vdev_id)
+hdd_nud_failure_work(hdd_cb_handle context, qdf_netdev_t netdev)
 {
 }
 #endif /* WLAN_NUD_TRACKING */

+ 7 - 10
core/hdd/src/wlan_hdd_stats.c

@@ -8727,9 +8727,10 @@ int wlan_hdd_get_temperature(struct hdd_adapter *adapter, int *temperature)
 }
 
 #ifdef TX_MULTIQ_PER_AC
-void wlan_hdd_display_tx_multiq_stats(hdd_cb_handle context, uint8_t vdev_id)
+void wlan_hdd_display_tx_multiq_stats(hdd_cb_handle context,
+				      qdf_netdev_t netdev)
 {
-	struct hdd_context *hdd_ctx;
+	struct hdd_adapter *adapter;
 	struct wlan_hdd_link_info *link_info;
 	struct hdd_tx_rx_stats *stats;
 	uint32_t total_inv_sk_and_skb_hash = 0;
@@ -8738,17 +8739,13 @@ void wlan_hdd_display_tx_multiq_stats(hdd_cb_handle context, uint8_t vdev_id)
 	uint32_t total_qselect_skb_hash = 0;
 	unsigned int i;
 
-	hdd_ctx = hdd_cb_handle_to_context(context);
-	if (!hdd_ctx) {
-		hdd_err("hdd_ctx is null");
+	adapter = WLAN_HDD_GET_PRIV_PTR(netdev);
+	if (!adapter) {
+		hdd_err("adapter is null");
 		return;
 	}
 
-	link_info = hdd_get_link_info_by_vdev(hdd_ctx, vdev_id);
-	if (!link_info) {
-		hdd_err("Invalid vdev");
-		return;
-	}
+	link_info = adapter->deflink;
 
 	stats = &link_info->hdd_stats.tx_rx_stats;
 

+ 5 - 3
core/hdd/src/wlan_hdd_stats.h

@@ -605,14 +605,16 @@ void hdd_get_max_tx_bitrate(struct wlan_hdd_link_info *link_info);
 /**
  * wlan_hdd_display_tx_multiq_stats() - display Tx multi queue stats
  * @context: hdd context
- * @vdev_id: vdev id
+ * @netdev: netdev
  *
  * Return: none
  */
-void wlan_hdd_display_tx_multiq_stats(hdd_cb_handle context, uint8_t vdev_id);
+void wlan_hdd_display_tx_multiq_stats(hdd_cb_handle context,
+				      qdf_netdev_t netdev);
 #else
 static inline
-void wlan_hdd_display_tx_multiq_stats(hdd_cb_handle context, uint8_t vdev_id)
+void wlan_hdd_display_tx_multiq_stats(hdd_cb_handle context,
+				      qdf_netdev_t netdev)
 {
 }
 #endif

+ 10 - 12
core/hdd/src/wlan_hdd_tx_rx.c

@@ -402,16 +402,15 @@ void hdd_get_tx_resource(uint8_t vdev_id,
 }
 
 unsigned int
-hdd_get_tx_flow_low_watermark(hdd_cb_handle cb_ctx, uint8_t intf_id)
+hdd_get_tx_flow_low_watermark(hdd_cb_handle cb_ctx, qdf_netdev_t netdev)
 {
-	struct hdd_context *hdd_ctx = hdd_cb_handle_to_context(cb_ctx);
-	struct wlan_hdd_link_info *link_info;
+	struct hdd_adapter *adapter;
 
-	link_info = hdd_get_link_info_by_vdev(hdd_ctx, intf_id);
-	if (!link_info)
+	adapter = WLAN_HDD_GET_PRIV_PTR(netdev);
+	if (!adapter)
 		return 0;
 
-	return link_info->adapter->tx_flow_low_watermark;
+	return adapter->tx_flow_low_watermark;
 }
 #endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
 
@@ -729,17 +728,16 @@ void hdd_tsf_timestamp_rx(hdd_cb_handle ctx, qdf_nbuf_t netbuf)
 	hdd_rx_timestamp(netbuf, ktime_to_us(netbuf->tstamp));
 }
 
-void hdd_get_tsf_time_cb(uint8_t vdev_id, uint64_t input_time,
+void hdd_get_tsf_time_cb(qdf_netdev_t netdev, uint64_t input_time,
 			 uint64_t *tsf_time)
 {
-	struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
-	struct wlan_hdd_link_info *link_info;
+	struct hdd_adapter *adapter;
 
-	link_info = hdd_get_link_info_by_vdev(hdd_ctx, vdev_id);
-	if (!link_info)
+	adapter = WLAN_HDD_GET_PRIV_PTR(netdev);
+	if (!adapter)
 		return;
 
-	hdd_get_tsf_time(link_info->adapter, input_time, tsf_time);
+	hdd_get_tsf_time(adapter, input_time, tsf_time);
 }
 #endif
 

+ 2 - 2
os_if/dp/src/os_if_dp.c

@@ -1040,7 +1040,7 @@ int osif_dp_get_nud_stats(struct wiphy *wiphy,
 	ucfg_dp_set_nud_stats_cb(psoc, osif_request_cookie(request));
 
 	arp_stats_params.pkt_type = WLAN_NUD_STATS_ARP_PKT_TYPE;
-	arp_stats_params.vdev_id = ucfg_dp_get_intf_id(vdev);
+	arp_stats_params.vdev_id = ucfg_dp_get_link_id(vdev);
 
 	/* send NUD failure event only when ARP tracking is enabled. */
 	if (ucfg_dp_nud_fail_data_stall_evt_enabled() &&
@@ -1207,7 +1207,7 @@ int osif_dp_set_nud_stats(struct wiphy *wiphy,
 
 	dp_info("STATS_SET_START Received flag %d!", arp_stats_params.flag);
 
-	arp_stats_params.vdev_id = ucfg_dp_get_intf_id(vdev);
+	arp_stats_params.vdev_id = ucfg_dp_get_link_id(vdev);
 
 	if (QDF_STATUS_SUCCESS !=
 	    ucfg_dp_req_set_arp_stats(psoc, &arp_stats_params)) {