From bdba1fa76d0b103a237e638d7bbab8f05f65bccf Mon Sep 17 00:00:00 2001 From: Min Liu Date: Fri, 23 Oct 2020 15:30:51 +0800 Subject: [PATCH] qcacld-3.0: Report congestion to the correct interface Only report congestion vendor event to the interface that request it. Change-Id: I3c6d4fca116f65a9ae930d428e45716d544f9806 CRs-Fixed: 2803920 --- .../cp_stats/dispatcher/inc/wlan_cp_stats_mc_defs.h | 3 ++- .../dispatcher/src/wlan_cp_stats_mc_tgt_api.c | 2 +- core/hdd/src/wlan_hdd_medium_assess.c | 12 ++++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/components/cp_stats/dispatcher/inc/wlan_cp_stats_mc_defs.h b/components/cp_stats/dispatcher/inc/wlan_cp_stats_mc_defs.h index 1c7be63efa..07b002de90 100644 --- a/components/cp_stats/dispatcher/inc/wlan_cp_stats_mc_defs.h +++ b/components/cp_stats/dispatcher/inc/wlan_cp_stats_mc_defs.h @@ -193,7 +193,8 @@ struct request_info { void *cookie); void (*get_peer_stats_cb)(struct stats_event *ev, void *cookie); - void (*congestion_notif_cb)(uint8_t congestion); + void (*congestion_notif_cb)(uint8_t vdev_id, + uint8_t congestion); } u; uint32_t vdev_id; uint32_t pdev_id; diff --git a/components/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c b/components/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c index 037b1ccc20..91142f14e3 100644 --- a/components/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c +++ b/components/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c @@ -704,7 +704,7 @@ tgt_mc_cp_stats_extract_congestion_stats(struct wlan_objmgr_psoc *psoc, wlan_cp_stats_pdev_obj_unlock(pdev_cp_stats_priv); if (last_req.u.congestion_notif_cb && is_congested) - last_req.u.congestion_notif_cb(congestion); + last_req.u.congestion_notif_cb(last_req.vdev_id, congestion); out: wlan_objmgr_pdev_release_ref(pdev, WLAN_CP_STATS_ID); diff --git a/core/hdd/src/wlan_hdd_medium_assess.c b/core/hdd/src/wlan_hdd_medium_assess.c index e6e2acb536..795d3b0933 100644 --- a/core/hdd/src/wlan_hdd_medium_assess.c +++ b/core/hdd/src/wlan_hdd_medium_assess.c @@ -92,19 +92,27 @@ static int get_congestion_report_len(void) /** * hdd_congestion_notification_cb() - congestion notification callback function + * @vdev_id: vdev id * @congestion: congestion percentage * * Return: None */ -static void hdd_congestion_notification_cb(uint8_t congestion) +static void hdd_congestion_notification_cb(uint8_t vdev_id, uint8_t congestion) { struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); + struct hdd_adapter *adapter; struct sk_buff *event; if (wlan_hdd_validate_context(hdd_ctx)) return; - event = cfg80211_vendor_event_alloc(hdd_ctx->wiphy, NULL, + adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id); + if (!adapter) { + hdd_err("Failed to find adapter of vdev %d", vdev_id); + return; + } + + event = cfg80211_vendor_event_alloc(hdd_ctx->wiphy, &(adapter->wdev), get_congestion_report_len(), QCA_NL80211_VENDOR_SUBCMD_MEDIUM_ASSESS_INDEX, GFP_KERNEL);