From 1d0a7af8575eb01c5f356d79466124a515b7f00c Mon Sep 17 00:00:00 2001 From: Amit Mehta Date: Thu, 8 Feb 2024 14:53:42 +0530 Subject: [PATCH] qcacld-3.0: Export new API to update default link Currently default link update is only done in link switch or dynamic mac address update case. There is other scenario also where default link case become inactive and update to DP will not happen. So, to handle those scenarios, expert new API to update DP default link. CRs-Fixed: 3733584 Change-Id: Iab24c38c454cc5cb9f568de680531b38e4d3da45 --- components/dp/core/inc/wlan_dp_main.h | 10 ++++ components/dp/core/src/wlan_dp_main.c | 47 +++++++++++++++++++ components/dp/dispatcher/inc/wlan_dp_api.h | 13 ++++- .../dp/dispatcher/inc/wlan_dp_ucfg_api.h | 13 ++++- components/dp/dispatcher/src/wlan_dp_api.c | 9 +++- .../dp/dispatcher/src/wlan_dp_ucfg_api.c | 8 ++++ 6 files changed, 97 insertions(+), 3 deletions(-) diff --git a/components/dp/core/inc/wlan_dp_main.h b/components/dp/core/inc/wlan_dp_main.h index f3d4a7e9f4..1dfd32bc1c 100644 --- a/components/dp/core/inc/wlan_dp_main.h +++ b/components/dp/core/inc/wlan_dp_main.h @@ -1017,4 +1017,14 @@ bool wlan_dp_cfg_is_rx_fisa_lru_del_enabled(struct wlan_dp_psoc_cfg *dp_cfg) /* DP CFG APIs - END */ +/** + * __wlan_dp_update_def_link() - update DP interface default link + * @psoc: psoc handle + * @intf_mac: interface MAC address + * @vdev: objmgr vdev handle to set the def_link in dp_intf + * + */ +void __wlan_dp_update_def_link(struct wlan_objmgr_psoc *psoc, + struct qdf_mac_addr *intf_mac, + struct wlan_objmgr_vdev *vdev); #endif diff --git a/components/dp/core/src/wlan_dp_main.c b/components/dp/core/src/wlan_dp_main.c index 48b58fc50b..3d613cf1ba 100644 --- a/components/dp/core/src/wlan_dp_main.c +++ b/components/dp/core/src/wlan_dp_main.c @@ -2770,3 +2770,50 @@ void wlan_dp_pdev_cfg_sync_profile(struct cdp_soc_t *cdp_soc, uint8_t pdev_id) dp_err("pdev based config item not found in profile table"); } #endif + +void __wlan_dp_update_def_link(struct wlan_objmgr_psoc *psoc, + struct qdf_mac_addr *intf_mac, + struct wlan_objmgr_vdev *vdev) +{ + struct wlan_dp_intf *dp_intf; + struct wlan_dp_link *dp_link; + struct wlan_dp_psoc_context *dp_ctx; + struct qdf_mac_addr zero_addr = QDF_MAC_ADDR_ZERO_INIT; + + dp_ctx = dp_psoc_get_priv(psoc); + + dp_intf = dp_get_intf_by_macaddr(dp_ctx, intf_mac); + if (!dp_intf) { + dp_err("DP interface not found addr:" QDF_MAC_ADDR_FMT, + QDF_MAC_ADDR_REF(intf_mac->bytes)); + QDF_BUG(0); + return; + } + + dp_link = dp_get_vdev_priv_obj(vdev); + if (dp_link && dp_link->dp_intf == dp_intf) { + dp_info("change dp_intf %pK(" QDF_MAC_ADDR_FMT + ") def_link %d(" QDF_MAC_ADDR_FMT ") -> %d(" + QDF_MAC_ADDR_FMT ")", + dp_intf, QDF_MAC_ADDR_REF(dp_intf->mac_addr.bytes), + dp_intf->def_link->link_id, + QDF_MAC_ADDR_REF(dp_intf->def_link->mac_addr.bytes), + dp_link->link_id, + QDF_MAC_ADDR_REF(dp_link->mac_addr.bytes)); + dp_intf->def_link = dp_link; + return; + } + + dp_info("Update failed dp_intf %pK(" QDF_MAC_ADDR_FMT ") from %pK(" + QDF_MAC_ADDR_FMT ") to %pK(" QDF_MAC_ADDR_FMT ") (intf %pK(" + QDF_MAC_ADDR_FMT ") id %d) ", + dp_intf, QDF_MAC_ADDR_REF(dp_intf->mac_addr.bytes), + dp_intf->def_link, + QDF_MAC_ADDR_REF(dp_intf->def_link->mac_addr.bytes), + dp_link, dp_link ? QDF_MAC_ADDR_REF(dp_link->mac_addr.bytes) : + QDF_MAC_ADDR_REF(zero_addr.bytes), + dp_link ? dp_link->dp_intf : NULL, + dp_link ? QDF_MAC_ADDR_REF(dp_link->dp_intf->mac_addr.bytes) : + QDF_MAC_ADDR_REF(zero_addr.bytes), + dp_link ? dp_link->link_id : WLAN_INVALID_LINK_ID); +} diff --git a/components/dp/dispatcher/inc/wlan_dp_api.h b/components/dp/dispatcher/inc/wlan_dp_api.h index 8a099e4d7a..477229d6fd 100644 --- a/components/dp/dispatcher/inc/wlan_dp_api.h +++ b/components/dp/dispatcher/inc/wlan_dp_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2023-2024, 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 above @@ -91,4 +91,15 @@ wlan_dp_is_local_pkt_capture_enabled(struct wlan_objmgr_psoc *psoc) return false; } #endif /* WLAN_FEATURE_LOCAL_PKT_CAPTURE */ + +/** + * wlan_dp_update_def_link() - update DP interface default link + * @psoc: psoc handle + * @intf_mac: interface MAC address + * @vdev: objmgr vdev handle to set the def_link in dp_intf + * + */ +void wlan_dp_update_def_link(struct wlan_objmgr_psoc *psoc, + struct qdf_mac_addr *intf_mac, + struct wlan_objmgr_vdev *vdev); #endif diff --git a/components/dp/dispatcher/inc/wlan_dp_ucfg_api.h b/components/dp/dispatcher/inc/wlan_dp_ucfg_api.h index bd01d71008..ac37ddd57e 100644 --- a/components/dp/dispatcher/inc/wlan_dp_ucfg_api.h +++ b/components/dp/dispatcher/inc/wlan_dp_ucfg_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2024 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 @@ -75,6 +75,17 @@ QDF_STATUS ucfg_dp_update_link_mac_addr(struct wlan_objmgr_vdev *vdev, struct qdf_mac_addr *new_mac_addr, bool is_link_switch); +/** + * ucfg_dp_update_def_link() - update DP interface default link + * @psoc: psoc handle + * @intf_mac: interface MAC address + * @vdev: objmgr vdev handle to set the def_link in dp_intf + * + */ +void ucfg_dp_update_def_link(struct wlan_objmgr_psoc *psoc, + struct qdf_mac_addr *intf_mac, + struct wlan_objmgr_vdev *vdev); + /** * ucfg_dp_update_intf_mac() - update DP interface MAC address * @psoc: psoc handle diff --git a/components/dp/dispatcher/src/wlan_dp_api.c b/components/dp/dispatcher/src/wlan_dp_api.c index 56d34e4dc9..8a598e657f 100644 --- a/components/dp/dispatcher/src/wlan_dp_api.c +++ b/components/dp/dispatcher/src/wlan_dp_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2023-2024, 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 above @@ -60,3 +60,10 @@ bool wlan_dp_is_local_pkt_capture_enabled(struct wlan_objmgr_psoc *psoc) return cdp_cfg_get(soc, cfg_dp_local_pkt_capture); } #endif + +void wlan_dp_update_def_link(struct wlan_objmgr_psoc *psoc, + struct qdf_mac_addr *intf_mac, + struct wlan_objmgr_vdev *vdev) +{ + __wlan_dp_update_def_link(psoc, intf_mac, vdev); +} diff --git a/components/dp/dispatcher/src/wlan_dp_ucfg_api.c b/components/dp/dispatcher/src/wlan_dp_ucfg_api.c index 965b793fb7..276d88e651 100644 --- a/components/dp/dispatcher/src/wlan_dp_ucfg_api.c +++ b/components/dp/dispatcher/src/wlan_dp_ucfg_api.c @@ -159,6 +159,14 @@ QDF_STATUS ucfg_dp_update_link_mac_addr(struct wlan_objmgr_vdev *vdev, return status; } +void ucfg_dp_update_def_link(struct wlan_objmgr_psoc *psoc, + struct qdf_mac_addr *intf_mac, + struct wlan_objmgr_vdev *vdev) + +{ + __wlan_dp_update_def_link(psoc, intf_mac, vdev); +} + void ucfg_dp_update_intf_mac(struct wlan_objmgr_psoc *psoc, struct qdf_mac_addr *cur_mac, struct qdf_mac_addr *new_mac,