From patchwork Mon Mar 20 16:43:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maharaja Kennadyrajan X-Patchwork-Id: 13181613 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 191E6C7618A for ; Mon, 20 Mar 2023 16:53:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232852AbjCTQxP (ORCPT ); Mon, 20 Mar 2023 12:53:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232865AbjCTQww (ORCPT ); Mon, 20 Mar 2023 12:52:52 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C27AD9EE3 for ; Mon, 20 Mar 2023 09:44:41 -0700 (PDT) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32KDR1Op001514; Mon, 20 Mar 2023 16:44:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=0pOxAshrO8MW+ZuVucdQMuKT5rrUjP9qJpZO2ARR2iQ=; b=RdRcjUXfSTQLrbCDJC7Qu+HnVNWGDmd9NfJjhhdcdrapOtxFaBHTQMPOAh1rYiXwF3dT AzblROigf2PAmmb0G9/xUCieoGEyFuku70o93R/EfprklYGwRWCxaiE/0fwl6a7lOY4M bLhoUHcG/DlOJiT5NaXsd1Y1/9Y6ALJU3D8I/lJ24s9iwxCyKlMpK1BM0iAqvJKAJvRG gAkbRMhLlR8UIOcHUUrifMGey2fahYJlicItaptXhspkUCpsnS7TVP6owk7RvGQoQjP6 Djbywt7LSwgKzS7ReVxvKfRVnXSgIf1mgVCHARtwWy8+5AraYZR3woIq+zEDQ2B4XgGg Dw== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3perc38hp7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Mar 2023 16:44:04 +0000 Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 32KGi3mA031845 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Mar 2023 16:44:03 GMT Received: from che-siroccolnx03.qualcomm.com (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 20 Mar 2023 09:44:01 -0700 From: Maharaja Kennadyrajan To: CC: , Venkateswara Naralasetty , Maharaja Kennadyrajan Subject: [PATCH v2 1/4] wifi: nl80211: rename NL80211_CMD_SET_BEACON to NL80211_CMD_UDPATE_AP Date: Mon, 20 Mar 2023 22:13:31 +0530 Message-ID: <20230320164334.3325886-2-quic_mkenna@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230320164334.3325886-1-quic_mkenna@quicinc.com> References: <20230320164334.3325886-1-quic_mkenna@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: ui4aKfUm3lujx3wovKppe7Usf7lwyIFL X-Proofpoint-ORIG-GUID: ui4aKfUm3lujx3wovKppe7Usf7lwyIFL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-20_13,2023-03-20_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 mlxscore=0 adultscore=0 priorityscore=1501 bulkscore=0 clxscore=1015 mlxlogscore=999 phishscore=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303150002 definitions=main-2303200141 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Venkateswara Naralasetty Currently NL80211_CMD_SET_BEACON is limited to set only few AP parameters. Renaming NL80211_CMD_SET_BEACON to NL80211_UPDATE_AP would help users to configure more AP parameters which can vary at the runtime of the BSS. Replacing the argument 'struct cfg80211_beacon_data' parameter with 'struct cfg80211_ap_settings' in the callback function for this command, which has more information about AP parameters along with the struct cfg80211_beacon_data. Signed-off-by: Venkateswara Naralasetty Signed-off-by: Maharaja Kennadyrajan --- drivers/net/wireless/ath/ath6kl/cfg80211.c | 11 +-- drivers/net/wireless/ath/wil6210/cfg80211.c | 14 ++-- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 11 +-- .../net/wireless/marvell/mwifiex/cfg80211.c | 15 ++-- .../wireless/microchip/wilc1000/cfg80211.c | 11 +-- .../net/wireless/quantenna/qtnfmac/cfg80211.c | 11 +-- .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 12 +++- include/net/cfg80211.h | 36 ++++++++-- include/uapi/linux/nl80211.h | 19 ++--- net/mac80211/cfg.c | 20 +++--- net/wireless/nl80211.c | 21 +++--- net/wireless/rdev-ops.h | 10 +-- net/wireless/trace.h | 70 ++++++++++--------- 13 files changed, 165 insertions(+), 96 deletions(-) diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c index 0c2b8b1a10d5..126c0c156e77 100644 --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c @@ -2953,8 +2953,8 @@ static int ath6kl_start_ap(struct wiphy *wiphy, struct net_device *dev, return 0; } -static int ath6kl_change_beacon(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_beacon_data *beacon) +static int ath6kl_update_ap(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_ap_update *params) { struct ath6kl_vif *vif = netdev_priv(dev); @@ -2964,7 +2964,10 @@ static int ath6kl_change_beacon(struct wiphy *wiphy, struct net_device *dev, if (vif->next_mode != AP_NETWORK) return -EOPNOTSUPP; - return ath6kl_set_ies(vif, beacon); + if (!test_bit(BEACON_VALID, params->valid)) + return 0; + + return ath6kl_set_ies(vif, ¶ms->settings.beacon); } static int ath6kl_stop_ap(struct wiphy *wiphy, struct net_device *dev, @@ -3456,7 +3459,7 @@ static struct cfg80211_ops ath6kl_cfg80211_ops = { .resume = __ath6kl_cfg80211_resume, #endif .start_ap = ath6kl_start_ap, - .change_beacon = ath6kl_change_beacon, + .update_ap = ath6kl_update_ap, .stop_ap = ath6kl_stop_ap, .del_station = ath6kl_del_station, .change_station = ath6kl_change_station, diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c index 40f9a7ef8980..01838d7ccfe6 100644 --- a/drivers/net/wireless/ath/wil6210/cfg80211.c +++ b/drivers/net/wireless/ath/wil6210/cfg80211.c @@ -2080,17 +2080,21 @@ void wil_cfg80211_ap_recovery(struct wil6210_priv *wil) } } -static int wil_cfg80211_change_beacon(struct wiphy *wiphy, - struct net_device *ndev, - struct cfg80211_beacon_data *bcon) +static int wil_cfg80211_update_ap(struct wiphy *wiphy, + struct net_device *ndev, + struct cfg80211_ap_update *params) { struct wil6210_priv *wil = wiphy_to_wil(wiphy); struct wireless_dev *wdev = ndev->ieee80211_ptr; struct wil6210_vif *vif = ndev_to_vif(ndev); + struct cfg80211_beacon_data *bcon = ¶ms->settings.beacon; int rc; u32 privacy = 0; - wil_dbg_misc(wil, "change_beacon, mid=%d\n", vif->mid); + if (!test_bit(BEACON_VALID, params->valid)) + return 0; + + wil_dbg_misc(wil, "update_ap, mid=%d\n", vif->mid); wil_print_bcon_data(bcon); if (bcon->tail && @@ -2654,7 +2658,7 @@ static const struct cfg80211_ops wil_cfg80211_ops = { .del_key = wil_cfg80211_del_key, .set_default_key = wil_cfg80211_set_default_key, /* AP mode */ - .change_beacon = wil_cfg80211_change_beacon, + .update_ap = wil_cfg80211_update_ap, .start_ap = wil_cfg80211_start_ap, .stop_ap = wil_cfg80211_stop_ap, .add_station = wil_cfg80211_add_station, diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index e0a70a671550..6375f188a879 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -5410,14 +5410,17 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev, } static s32 -brcmf_cfg80211_change_beacon(struct wiphy *wiphy, struct net_device *ndev, - struct cfg80211_beacon_data *info) +brcmf_cfg80211_update_ap(struct wiphy *wiphy, struct net_device *ndev, + struct cfg80211_ap_update *params) { struct brcmf_if *ifp = netdev_priv(ndev); + if (!test_bit(BEACON_VALID, params->valid)) + return 0; + brcmf_dbg(TRACE, "Enter\n"); - return brcmf_config_ap_mgmt_ie(ifp->vif, info); + return brcmf_config_ap_mgmt_ie(ifp->vif, ¶ms->settings.beacon); } static int @@ -5945,7 +5948,7 @@ static struct cfg80211_ops brcmf_cfg80211_ops = { .flush_pmksa = brcmf_cfg80211_flush_pmksa, .start_ap = brcmf_cfg80211_start_ap, .stop_ap = brcmf_cfg80211_stop_ap, - .change_beacon = brcmf_cfg80211_change_beacon, + .update_ap = brcmf_cfg80211_update_ap, .del_station = brcmf_cfg80211_del_station, .change_station = brcmf_cfg80211_change_station, .sched_scan_start = brcmf_cfg80211_sched_scan_start, diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index bcd564dc3554..1d70c5c5ee6a 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -1830,12 +1830,12 @@ static int mwifiex_cfg80211_set_cqm_rssi_config(struct wiphy *wiphy, return 0; } -/* cfg80211 operation handler for change_beacon. +/* cfg80211 operation handler for update_ap. * Function retrieves and sets modified management IEs to FW. */ -static int mwifiex_cfg80211_change_beacon(struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_beacon_data *data) +static int mwifiex_cfg80211_update_ap(struct wiphy *wiphy, + struct net_device *dev, + struct cfg80211_ap_update *params) { struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); struct mwifiex_adapter *adapter = priv->adapter; @@ -1854,7 +1854,10 @@ static int mwifiex_cfg80211_change_beacon(struct wiphy *wiphy, return -EINVAL; } - if (mwifiex_set_mgmt_ies(priv, data)) { + if (!test_bit(BEACON_VALID, params->valid)) + return 0; + + if (mwifiex_set_mgmt_ies(priv, ¶ms->settings.beacon)) { mwifiex_dbg(priv->adapter, ERROR, "%s: setting mgmt ies failed\n", __func__); return -EFAULT; @@ -4230,7 +4233,7 @@ static struct cfg80211_ops mwifiex_cfg80211_ops = { .set_bitrate_mask = mwifiex_cfg80211_set_bitrate_mask, .start_ap = mwifiex_cfg80211_start_ap, .stop_ap = mwifiex_cfg80211_stop_ap, - .change_beacon = mwifiex_cfg80211_change_beacon, + .update_ap = mwifiex_cfg80211_update_ap, .set_cqm_rssi_config = mwifiex_cfg80211_set_cqm_rssi_config, .set_antenna = mwifiex_cfg80211_set_antenna, .get_antenna = mwifiex_cfg80211_get_antenna, diff --git a/drivers/net/wireless/microchip/wilc1000/cfg80211.c b/drivers/net/wireless/microchip/wilc1000/cfg80211.c index b545d93c6e37..c475e874c200 100644 --- a/drivers/net/wireless/microchip/wilc1000/cfg80211.c +++ b/drivers/net/wireless/microchip/wilc1000/cfg80211.c @@ -1440,12 +1440,15 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev, settings->dtim_period, &settings->beacon); } -static int change_beacon(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_beacon_data *beacon) +static int update_ap(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_ap_update *params) { struct wilc_vif *vif = netdev_priv(dev); - return wilc_add_beacon(vif, 0, 0, beacon); + if (!test_bit(BEACON_VALID, params->valid)) + return 0; + + return wilc_add_beacon(vif, 0, 0, ¶ms->settings.beacon); } static int stop_ap(struct wiphy *wiphy, struct net_device *dev, @@ -1724,7 +1727,7 @@ static const struct cfg80211_ops wilc_cfg80211_ops = { .change_virtual_intf = change_virtual_intf, .start_ap = start_ap, - .change_beacon = change_beacon, + .update_ap = update_ap, .stop_ap = stop_ap, .add_station = add_station, .del_station = del_station, diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c index 73e6f9408b51..ad2140849c12 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c @@ -330,12 +330,15 @@ static int qtnf_mgmt_set_appie(struct qtnf_vif *vif, return ret; } -static int qtnf_change_beacon(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_beacon_data *info) +static int qtnf_update_ap(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_ap_update *params) { struct qtnf_vif *vif = qtnf_netdev_get_priv(dev); - return qtnf_mgmt_set_appie(vif, info); + if (!test_bit(BEACON_VALID, params->valid)) + return 0; + + return qtnf_mgmt_set_appie(vif, ¶ms->settings.beacon); } static int qtnf_start_ap(struct wiphy *wiphy, struct net_device *dev, @@ -1003,7 +1006,7 @@ static struct cfg80211_ops qtn_cfg80211_ops = { .change_virtual_intf = qtnf_change_virtual_intf, .del_virtual_intf = qtnf_del_virtual_intf, .start_ap = qtnf_start_ap, - .change_beacon = qtnf_change_beacon, + .update_ap = qtnf_update_ap, .stop_ap = qtnf_stop_ap, .set_wiphy_params = qtnf_set_wiphy_params, .update_mgmt_frame_registrations = diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c index 54004f846cf0..0b76063bd399 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c @@ -2350,10 +2350,16 @@ static int cfg80211_rtw_start_ap(struct wiphy *wiphy, struct net_device *ndev, return ret; } -static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *ndev, - struct cfg80211_beacon_data *info) +static int cfg80211_rtw_update_ap(struct wiphy *wiphy, + struct net_device *ndev, + struct cfg80211_ap_update *params) + { struct adapter *adapter = rtw_netdev_priv(ndev); + struct cfg80211_beacon_data *info = ¶ms->settings.beacon; + + if (!test_bit(BEACON_VALID, params->valid)) + return 0; return rtw_add_beacon(adapter, info->head, info->head_len, info->tail, info->tail_len); } @@ -2759,7 +2765,7 @@ static struct cfg80211_ops rtw_cfg80211_ops = { .del_virtual_intf = cfg80211_rtw_del_virtual_intf, .start_ap = cfg80211_rtw_start_ap, - .change_beacon = cfg80211_rtw_change_beacon, + .update_ap = cfg80211_rtw_update_ap, .stop_ap = cfg80211_rtw_stop_ap, .add_station = cfg80211_rtw_add_station, diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 7cebba1c4135..0d62b5853929 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1368,6 +1368,34 @@ struct cfg80211_ap_settings { u16 punct_bitmap; }; +/** + * enum cfg80211_ap_settings_valid - struct cfg80211_ap_settings +validation flags + * + * These flags are used with the nl80211_update_ap() callback + * to indicate the valid settings in struct cfg80211_ap_settings. + * + * @BEACON_VALID: beacon setting is valid. + */ +enum cfg80211_ap_settings_valid { + BEACON_VALID, + LAST_VALID, +}; + +/** + * struct cfg80211_ap_update - updated AP configuration + * + * Used to update the AP parameters in run time. + * + * @changed: Indicate the valid parameters in struct +cfg80211_ap_settings + * @settings: updated AP settings + */ +struct cfg80211_ap_update { + DECLARE_BITMAP(valid, LAST_VALID); + struct cfg80211_ap_settings settings; +}; + /** * struct cfg80211_csa_settings - channel switch settings * @@ -4024,8 +4052,8 @@ struct mgmt_frame_regs { * @set_rekey_data: give the data necessary for GTK rekeying to the driver * * @start_ap: Start acting in AP mode defined by the parameters. - * @change_beacon: Change the beacon parameters for an access point mode - * interface. This should reject the call when AP mode wasn't started. + * @update_ap: Update parameters for an access point mode interface. + * This should reject the call when AP mode wasn't started. * @stop_ap: Stop being an AP, including stopping beaconing. * * @add_station: Add a new station. @@ -4392,8 +4420,8 @@ struct cfg80211_ops { int (*start_ap)(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_ap_settings *settings); - int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_beacon_data *info); + int (*update_ap)(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_ap_update *params); int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev, unsigned int link_id); diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 9a0ac0363f1f..e7b7d8031582 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -395,13 +395,15 @@ * %NL80211_ATTR_MLO_LINK_ID. * * @NL80211_CMD_GET_BEACON: (not used) - * @NL80211_CMD_SET_BEACON: change the beacon on an access point interface + * @NL80211_CMD_UPDATE_AP: Update AP parameters which can vary at the + * runtime of BSS. change the beacon on an access point interface * using the %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL * attributes. For drivers that generate the beacon and probe responses - * internally, the following attributes must be provided: %NL80211_ATTR_IE, - * %NL80211_ATTR_IE_PROBE_RESP and %NL80211_ATTR_IE_ASSOC_RESP. + * internally, the following attributes must be provided for the + * beacon update: %NL80211_ATTR_IE, %NL80211_ATTR_IE_PROBE_RESP and + * %NL80211_ATTR_IE_ASSOC_RESP. * @NL80211_CMD_START_AP: Start AP operation on an AP interface, parameters - * are like for %NL80211_CMD_SET_BEACON, and additionally parameters that + * are like for %NL80211_CMD_UPDATE_AP, and additionally parameters that * do not change are used, these include %NL80211_ATTR_BEACON_INTERVAL, * %NL80211_ATTR_DTIM_PERIOD, %NL80211_ATTR_SSID, * %NL80211_ATTR_HIDDEN_SSID, %NL80211_ATTR_CIPHERS_PAIRWISE, @@ -1332,7 +1334,8 @@ enum nl80211_commands { NL80211_CMD_DEL_KEY, NL80211_CMD_GET_BEACON, - NL80211_CMD_SET_BEACON, + NL80211_CMD_UPDATE_AP, + NL80211_CMD_SET_BEACON = NL80211_CMD_UPDATE_AP, NL80211_CMD_START_AP, NL80211_CMD_NEW_BEACON = NL80211_CMD_START_AP, NL80211_CMD_STOP_AP, @@ -2050,12 +2053,12 @@ enum nl80211_commands { * &enum nl80211_hidden_ssid, represented as a u32 * * @NL80211_ATTR_IE_PROBE_RESP: Information element(s) for Probe Response frame. - * This is used with %NL80211_CMD_NEW_BEACON and %NL80211_CMD_SET_BEACON to + * This is used with %NL80211_CMD_NEW_BEACON and %NL80211_CMD_UPDATE_AP to * provide extra IEs (e.g., WPS/P2P IE) into Probe Response frames when the * driver (or firmware) replies to Probe Request frames. * @NL80211_ATTR_IE_ASSOC_RESP: Information element(s) for (Re)Association * Response frames. This is used with %NL80211_CMD_NEW_BEACON and - * %NL80211_CMD_SET_BEACON to provide extra IEs (e.g., WPS/P2P IE) into + * %NL80211_CMD_UPDATE_AP to provide extra IEs (e.g., WPS/P2P IE) into * (Re)Association Response frames when the driver (or firmware) replies to * (Re)Association Request frames. * @@ -2581,7 +2584,7 @@ enum nl80211_commands { * only if %NL80211_STA_FLAG_WME is set. * * @NL80211_ATTR_FTM_RESPONDER: nested attribute which user-space can include - * in %NL80211_CMD_START_AP or %NL80211_CMD_SET_BEACON for fine timing + * in %NL80211_CMD_START_AP or %NL80211_CMD_UPDATE_AP for fine timing * measurement (FTM) responder functionality and containing parameters as * possible, see &enum nl80211_ftm_responder_attr * diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 760ad934f9e1..657be3d4dfcd 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1460,8 +1460,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, return err; } -static int ieee80211_change_beacon(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_beacon_data *params) +static int ieee80211_update_ap(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_ap_update *params) { struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_link_data *link; @@ -1471,7 +1471,8 @@ static int ieee80211_change_beacon(struct wiphy *wiphy, struct net_device *dev, sdata_assert_lock(sdata); - link = sdata_dereference(sdata->link[params->link_id], sdata); + link = sdata_dereference(sdata->link[params->settings.beacon.link_id], + sdata); if (!link) return -ENOLINK; @@ -1487,13 +1488,16 @@ static int ieee80211_change_beacon(struct wiphy *wiphy, struct net_device *dev, if (!old) return -ENOENT; - err = ieee80211_assign_beacon(sdata, link, params, NULL, NULL); + err = ieee80211_assign_beacon(sdata, link, ¶ms->settings.beacon, + NULL, NULL); if (err < 0) return err; - if (params->he_bss_color_valid && - params->he_bss_color.enabled != link_conf->he_bss_color.enabled) { - link_conf->he_bss_color.enabled = params->he_bss_color.enabled; + if (params->settings.beacon.he_bss_color_valid && + params->settings.beacon.he_bss_color.enabled != + link_conf->he_bss_color.enabled) { + link_conf->he_bss_color.enabled = + params->settings.beacon.he_bss_color.enabled; err |= BSS_CHANGED_HE_BSS_COLOR; } @@ -4960,7 +4964,7 @@ const struct cfg80211_ops mac80211_config_ops = { .set_default_mgmt_key = ieee80211_config_default_mgmt_key, .set_default_beacon_key = ieee80211_config_default_beacon_key, .start_ap = ieee80211_start_ap, - .change_beacon = ieee80211_change_beacon, + .update_ap = ieee80211_update_ap, .stop_ap = ieee80211_stop_ap, .add_station = ieee80211_add_station, .del_station = ieee80211_del_station, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 0a31b1d2845d..a45bda39d8ab 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -6142,35 +6142,40 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) return err; } -static int nl80211_set_beacon(struct sk_buff *skb, struct genl_info *info) +static int nl80211_update_ap(struct sk_buff *skb, struct genl_info *info) { struct cfg80211_registered_device *rdev = info->user_ptr[0]; unsigned int link_id = nl80211_link_id(info->attrs); struct net_device *dev = info->user_ptr[1]; struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_beacon_data params; + struct cfg80211_ap_update params; int err; if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) return -EOPNOTSUPP; - if (!rdev->ops->change_beacon) + if (!rdev->ops->update_ap) return -EOPNOTSUPP; if (!wdev->links[link_id].ap.beacon_interval) return -EINVAL; - err = nl80211_parse_beacon(rdev, info->attrs, ¶ms); + memset(¶ms, 0, sizeof(params)); + + err = nl80211_parse_beacon(rdev, info->attrs, + ¶ms.settings.beacon); if (err) goto out; + set_bit(BEACON_VALID, params.valid); + wdev_lock(wdev); - err = rdev_change_beacon(rdev, dev, ¶ms); + err = rdev_update_ap(rdev, dev, ¶ms); wdev_unlock(wdev); out: - kfree(params.mbssid_ies); + kfree(params.settings.beacon.mbssid_ies); return err; } @@ -16619,10 +16624,10 @@ static const struct genl_small_ops nl80211_small_ops[] = { .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP), }, { - .cmd = NL80211_CMD_SET_BEACON, + .cmd = NL80211_CMD_UPDATE_AP, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, .flags = GENL_UNS_ADMIN_PERM, - .doit = nl80211_set_beacon, + .doit = nl80211_update_ap, .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP | NL80211_FLAG_MLO_VALID_LINK_ID), }, diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h index 2e497cf26ef2..ac6bdf3434a1 100644 --- a/net/wireless/rdev-ops.h +++ b/net/wireless/rdev-ops.h @@ -171,13 +171,13 @@ static inline int rdev_start_ap(struct cfg80211_registered_device *rdev, return ret; } -static inline int rdev_change_beacon(struct cfg80211_registered_device *rdev, - struct net_device *dev, - struct cfg80211_beacon_data *info) +static inline int rdev_update_ap(struct cfg80211_registered_device *rdev, + struct net_device *dev, + struct cfg80211_ap_update *info) { int ret; - trace_rdev_change_beacon(&rdev->wiphy, dev, info); - ret = rdev->ops->change_beacon(&rdev->wiphy, dev, info); + trace_rdev_update_ap(&rdev->wiphy, dev, &info->settings); + ret = rdev->ops->update_ap(&rdev->wiphy, dev, info); trace_rdev_return_int(&rdev->wiphy, ret); return ret; } diff --git a/net/wireless/trace.h b/net/wireless/trace.h index 716a1fa70069..34f517ab2068 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h @@ -613,54 +613,58 @@ TRACE_EVENT(rdev_start_ap, __entry->inactivity_timeout, __entry->link_id) ); -TRACE_EVENT(rdev_change_beacon, - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, - struct cfg80211_beacon_data *info), - TP_ARGS(wiphy, netdev, info), - TP_STRUCT__entry( +TRACE_EVENT(rdev_update_ap, + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, + struct cfg80211_ap_settings *info), + TP_ARGS(wiphy, netdev, info), + TP_STRUCT__entry( WIPHY_ENTRY NETDEV_ENTRY __field(int, link_id) - __dynamic_array(u8, head, info ? info->head_len : 0) - __dynamic_array(u8, tail, info ? info->tail_len : 0) - __dynamic_array(u8, beacon_ies, info ? info->beacon_ies_len : 0) + __dynamic_array(u8, head, info ? info->beacon.head_len : 0) + __dynamic_array(u8, tail, info ? info->beacon.tail_len : 0) + __dynamic_array(u8, beacon_ies, + info ? info->beacon.beacon_ies_len : 0) __dynamic_array(u8, proberesp_ies, - info ? info->proberesp_ies_len : 0) + info ? info->beacon.proberesp_ies_len : 0) __dynamic_array(u8, assocresp_ies, - info ? info->assocresp_ies_len : 0) - __dynamic_array(u8, probe_resp, info ? info->probe_resp_len : 0) - ), - TP_fast_assign( + info ? info->beacon.assocresp_ies_len : 0) + __dynamic_array(u8, probe_resp, + info ? info->beacon.probe_resp_len : 0) + ), + TP_fast_assign( WIPHY_ASSIGN; NETDEV_ASSIGN; if (info) { - __entry->link_id = info->link_id; - if (info->head) - memcpy(__get_dynamic_array(head), info->head, - info->head_len); - if (info->tail) - memcpy(__get_dynamic_array(tail), info->tail, - info->tail_len); - if (info->beacon_ies) + __entry->link_id = info->beacon.link_id; + if (info->beacon.head) + memcpy(__get_dynamic_array(head), info->beacon.head, + info->beacon.head_len); + if (info->beacon.tail) + memcpy(__get_dynamic_array(tail), info->beacon.tail, + info->beacon.tail_len); + if (info->beacon.beacon_ies) memcpy(__get_dynamic_array(beacon_ies), - info->beacon_ies, info->beacon_ies_len); - if (info->proberesp_ies) + info->beacon.beacon_ies, + info->beacon.beacon_ies_len); + if (info->beacon.proberesp_ies) memcpy(__get_dynamic_array(proberesp_ies), - info->proberesp_ies, - info->proberesp_ies_len); - if (info->assocresp_ies) + info->beacon.proberesp_ies, + info->beacon.proberesp_ies_len); + if (info->beacon.assocresp_ies) memcpy(__get_dynamic_array(assocresp_ies), - info->assocresp_ies, - info->assocresp_ies_len); - if (info->probe_resp) + info->beacon.assocresp_ies, + info->beacon.assocresp_ies_len); + if (info->beacon.probe_resp) memcpy(__get_dynamic_array(probe_resp), - info->probe_resp, info->probe_resp_len); + info->beacon.probe_resp, + info->beacon.probe_resp_len); } else { __entry->link_id = -1; } - ), - TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", link_id:%d", - WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->link_id) + ), + TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", link_id:%d", + WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->link_id) ); TRACE_EVENT(rdev_stop_ap, From patchwork Mon Mar 20 16:43:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maharaja Kennadyrajan X-Patchwork-Id: 13181610 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64811C7618D for ; Mon, 20 Mar 2023 16:53:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232693AbjCTQxL (ORCPT ); Mon, 20 Mar 2023 12:53:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232521AbjCTQwt (ORCPT ); Mon, 20 Mar 2023 12:52:49 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B65B976C for ; Mon, 20 Mar 2023 09:44:39 -0700 (PDT) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32KBtOV7010971; Mon, 20 Mar 2023 16:44:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=GG4Ybmu1C7BBmuwaP1cJXzofotPFLEMeN99cRVZF2n4=; b=NzuXtIo+2D5IQIHjNvBMsB4CgWq6Qz6ejfQPuEDNyfeYykS1/KE7qkCu50BNxvXza6Nl LtltCUQedwwpm1j0XqdCW/aXfwrMJzRM1qXEO3xzj+LNsD2lLdmCYJt69zIEoFmesogM dKZfqBSNDwTzL6LO6N+g5zywgT+w+HtUeWpyKb0jgqBTbw1MPf+NAi2OMU9p5Y1sDGOq 9/KZFczke7yXsHl318qDE1qz/m4PeuSW7Xev2Pu3K59j7m8L8KYHrCliXf86u2k16d8V /wRdsAsB9WWX7wxopTwVzcxVlrmdW1F1sxDw01cSDizqmSLiFv62AapVLpQD6u2SEEpD Sw== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pene1h17h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Mar 2023 16:44:06 +0000 Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 32KGi5X6019290 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Mar 2023 16:44:05 GMT Received: from che-siroccolnx03.qualcomm.com (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 20 Mar 2023 09:44:03 -0700 From: Maharaja Kennadyrajan To: CC: , Venkateswara Naralasetty , Maharaja Kennadyrajan Subject: [PATCH v2 2/4] wifi: nl80211: add configuration support for ap power save Date: Mon, 20 Mar 2023 22:13:32 +0530 Message-ID: <20230320164334.3325886-3-quic_mkenna@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230320164334.3325886-1-quic_mkenna@quicinc.com> References: <20230320164334.3325886-1-quic_mkenna@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: NyNheG7GpddR2tW_wWBm-NjA7DPgbaqp X-Proofpoint-GUID: NyNheG7GpddR2tW_wWBm-NjA7DPgbaqp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-20_14,2023-03-20_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxlogscore=999 spamscore=0 impostorscore=0 priorityscore=1501 suspectscore=0 bulkscore=0 lowpriorityscore=0 clxscore=1015 mlxscore=0 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303150002 definitions=main-2303200141 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Venkateswara Naralasetty Add support to configure AP power save mode from the user space using a new nl80211 attribute NL80211_ATTR_AP_PS through the NL80211_CMD_UPDATE_AP command. This feature will be enabled when the driver advertise the flag SUPPORTS_AP_PS to mac80211. Signed-off-by: Venkateswara Naralasetty Signed-off-by: Maharaja Kennadyrajan --- include/net/cfg80211.h | 6 ++++++ include/uapi/linux/nl80211.h | 11 ++++++++++- net/wireless/nl80211.c | 11 ++++++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 0d62b5853929..31ef11700bad 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1331,6 +1331,7 @@ struct cfg80211_unsol_bcast_probe_resp { * @punct_bitmap: Preamble puncturing bitmap. Each bit represents * a 20 MHz channel, lowest bit corresponding to the lowest channel. * Bit set to 1 indicates that the channel is punctured. + * @ap_ps_enable: enable/disable ap power save. */ struct cfg80211_ap_settings { struct cfg80211_chan_def chandef; @@ -1366,6 +1367,7 @@ struct cfg80211_ap_settings { struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp; struct cfg80211_mbssid_config mbssid_config; u16 punct_bitmap; + bool ap_ps_enable; }; /** @@ -1376,9 +1378,13 @@ validation flags * to indicate the valid settings in struct cfg80211_ap_settings. * * @BEACON_VALID: beacon setting is valid. + * @AP_PS_VALID: AP PS setting is valid. */ enum cfg80211_ap_settings_valid { BEACON_VALID, + AP_PS_VALID, + + /* keep last */ LAST_VALID, }; diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index e7b7d8031582..e2b1e40d3f57 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -401,7 +401,8 @@ * attributes. For drivers that generate the beacon and probe responses * internally, the following attributes must be provided for the * beacon update: %NL80211_ATTR_IE, %NL80211_ATTR_IE_PROBE_RESP and - * %NL80211_ATTR_IE_ASSOC_RESP. + * %NL80211_ATTR_IE_ASSOC_RESP. This following attribute must be + * provided for the ap power save: %NL80211_ATTR_AP_PS. * @NL80211_CMD_START_AP: Start AP operation on an AP interface, parameters * are like for %NL80211_CMD_UPDATE_AP, and additionally parameters that * do not change are used, these include %NL80211_ATTR_BEACON_INTERVAL, @@ -2745,6 +2746,12 @@ enum nl80211_commands { * enumerated in &enum nl80211_ap_settings_flags. This attribute shall be * used with %NL80211_CMD_START_AP request. * + * @NL80211_ATTR_AP_PS: enable/disable AP power save. + * This attribute type is NLA_FLAG and valid input is 0 or 1. + * 0 for disable AP power save mode. + * 1 for enable AP power save mode. + * This attribute shall be used with %%NL80211_CMD_UPDATE_AP. + * * @NL80211_ATTR_EHT_CAPABILITY: EHT Capability information element (from * association request when used with NL80211_CMD_NEW_STATION). Can be set * only if %NL80211_STA_FLAG_WME is set. @@ -3331,6 +3338,8 @@ enum nl80211_attrs { NL80211_ATTR_MAX_HW_TIMESTAMP_PEERS, NL80211_ATTR_HW_TIMESTAMP_ENABLED, + NL80211_ATTR_AP_PS, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index a45bda39d8ab..b3f6dc8e1543 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -809,6 +809,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { [NL80211_ATTR_MAX_HW_TIMESTAMP_PEERS] = { .type = NLA_U16 }, [NL80211_ATTR_HW_TIMESTAMP_ENABLED] = { .type = NLA_FLAG }, + [NL80211_ATTR_AP_PS] = { .type = NLA_FLAG }, }; /* policy for the key attributes */ @@ -6150,6 +6151,7 @@ static int nl80211_update_ap(struct sk_buff *skb, struct genl_info *info) struct wireless_dev *wdev = dev->ieee80211_ptr; struct cfg80211_ap_update params; int err; + bool haveinfo = false; if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) @@ -6163,9 +6165,16 @@ static int nl80211_update_ap(struct sk_buff *skb, struct genl_info *info) memset(¶ms, 0, sizeof(params)); + if (info->attrs[NL80211_ATTR_AP_PS]) { + params.settings.ap_ps_enable = + !!nla_get_flag(info->attrs[NL80211_ATTR_AP_PS]); + set_bit(AP_PS_VALID, params.valid); + haveinfo = true; + } + err = nl80211_parse_beacon(rdev, info->attrs, ¶ms.settings.beacon); - if (err) + if (err && !haveinfo) goto out; set_bit(BEACON_VALID, params.valid); From patchwork Mon Mar 20 16:43:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maharaja Kennadyrajan X-Patchwork-Id: 13181611 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3DCAC76195 for ; Mon, 20 Mar 2023 16:53:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232764AbjCTQxN (ORCPT ); Mon, 20 Mar 2023 12:53:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232820AbjCTQwv (ORCPT ); Mon, 20 Mar 2023 12:52:51 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C320EA5EC for ; Mon, 20 Mar 2023 09:44:41 -0700 (PDT) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32KBusmE014207; Mon, 20 Mar 2023 16:44:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=C8j2QFsaYWezKCdL/4Itq1K9zXukindokHLbX4d7wR4=; b=K0BUkXf8qVC5GQohz/751ytU4YxCiJ950su5/xhoddP+x1YSQpquMxSmvUBceM2g4j6/ dxz5kOiiZsp6Qw6YqyoAB5+vUSr+m0MoTYOeB3ChK5QlDiRXWOxjnqLEwVQvv7wjjnIJ X4NXQl2cFwkpzdSqzMGOzbxYP6Xk0nY29kkoc+CdIP9pWlCBhF4KXJz3pNut63yyRRpC miF5BEjmQewPqR8IyRQ+BbHuLbFQWrgDwlVmi0e9tPXFfGX5XMNPDLG5m1IZSoeySN4Z FrWKUc2tk+Y01ZDSrdY/EEYGJ+7wOQb3ZuNeRtskeFzNE8E2JcH7OfvfF71eNMJBul/0 7A== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pepfbgu5b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Mar 2023 16:44:08 +0000 Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 32KGi7TR008450 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Mar 2023 16:44:07 GMT Received: from che-siroccolnx03.qualcomm.com (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 20 Mar 2023 09:44:05 -0700 From: Maharaja Kennadyrajan To: CC: , Venkateswara Naralasetty , Maharaja Kennadyrajan Subject: [PATCH v2 3/4] wifi: mac80211: notify BSS change upon AP power save change Date: Mon, 20 Mar 2023 22:13:33 +0530 Message-ID: <20230320164334.3325886-4-quic_mkenna@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230320164334.3325886-1-quic_mkenna@quicinc.com> References: <20230320164334.3325886-1-quic_mkenna@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 90zdyRZVhKOYBdSTnk71UIoZ2jDHyn5j X-Proofpoint-ORIG-GUID: 90zdyRZVhKOYBdSTnk71UIoZ2jDHyn5j X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-20_13,2023-03-20_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 lowpriorityscore=0 suspectscore=0 mlxscore=0 spamscore=0 impostorscore=0 mlxlogscore=984 phishscore=0 clxscore=1015 priorityscore=1501 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303150002 definitions=main-2303200141 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Venkateswara Naralasetty Notify BSS change to the drivers upon AP power save changes through ieee80211_vif_cfg_change_notify(). BSS_CHANGED_PS is reused to notify the AP power save change, which is currently used only for STA mode. A new hw flag IEEE80211_HW_SUPPORTS_AP_PS is introduced for backward compatibility and notify the AP power save change to the drivers which support AP power save. Signed-off-by: Venkateswara Naralasetty Signed-off-by: Maharaja Kennadyrajan --- include/net/mac80211.h | 7 ++++++- net/mac80211/cfg.c | 23 +++++++++++++++++------ net/mac80211/debugfs.c | 1 + 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index f12edca660ba..963607b64226 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -318,7 +318,7 @@ struct ieee80211_vif_chanctx_switch { * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface. * @BSS_CHANGED_SSID: SSID changed for this BSS (AP and IBSS mode) * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode) - * @BSS_CHANGED_PS: PS changed for this BSS (STA mode) + * @BSS_CHANGED_PS: PS changed for this BSS (AP and STA mode) * @BSS_CHANGED_TXPOWER: TX power setting changed for this interface * @BSS_CHANGED_P2P_PS: P2P powersave settings (CTWindow, opportunistic PS) * changed @@ -683,6 +683,7 @@ struct ieee80211_fils_discovery { * beamformee * @eht_mu_beamformer: in AP-mode, does this BSS enable operation as an EHT MU * beamformer + * @ap_ps_enable: enable/disable ap power save. */ struct ieee80211_bss_conf { struct ieee80211_vif *vif; @@ -776,6 +777,7 @@ struct ieee80211_bss_conf { bool eht_su_beamformer; bool eht_su_beamformee; bool eht_mu_beamformer; + bool ap_ps_enable; }; /** @@ -2646,6 +2648,8 @@ struct ieee80211_txq { * @IEEE80211_HW_MLO_MCAST_MULTI_LINK_TX: Hardware/driver handles transmitting * multicast frames on all links, mac80211 should not do that. * + * @IEEE80211_HW_SUPPORTS_AP_PS: Hardware supports AP power save. + * * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays */ enum ieee80211_hw_flags { @@ -2703,6 +2707,7 @@ enum ieee80211_hw_flags { IEEE80211_HW_SUPPORTS_CONC_MON_RX_DECAP, IEEE80211_HW_DETECTS_COLOR_COLLISION, IEEE80211_HW_MLO_MCAST_MULTI_LINK_TX, + IEEE80211_HW_SUPPORTS_AP_PS, /* keep last, obviously */ NUM_IEEE80211_HW_FLAGS diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 657be3d4dfcd..a9aec880721a 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1468,6 +1468,7 @@ static int ieee80211_update_ap(struct wiphy *wiphy, struct net_device *dev, struct beacon_data *old; int err; struct ieee80211_bss_conf *link_conf; + u32 changed = 0; sdata_assert_lock(sdata); @@ -1488,20 +1489,30 @@ static int ieee80211_update_ap(struct wiphy *wiphy, struct net_device *dev, if (!old) return -ENOENT; - err = ieee80211_assign_beacon(sdata, link, ¶ms->settings.beacon, - NULL, NULL); - if (err < 0) - return err; + if (test_bit(BEACON_VALID, params->valid)) { + err = ieee80211_assign_beacon(sdata, link, ¶ms->settings.beacon, + NULL, NULL); + if (err < 0) + return err; + + changed |= err; + } + + if (ieee80211_hw_check(&sdata->local->hw, SUPPORTS_AP_PS) && + test_bit(AP_PS_VALID, params->valid)) { + sdata->vif.bss_conf.ap_ps_enable = params->settings.ap_ps_enable; + changed |= BSS_CHANGED_PS; + } if (params->settings.beacon.he_bss_color_valid && params->settings.beacon.he_bss_color.enabled != link_conf->he_bss_color.enabled) { link_conf->he_bss_color.enabled = params->settings.beacon.he_bss_color.enabled; - err |= BSS_CHANGED_HE_BSS_COLOR; + changed |= BSS_CHANGED_HE_BSS_COLOR; } - ieee80211_link_info_change_notify(sdata, link, err); + ieee80211_vif_cfg_change_notify(sdata, changed); return 0; } diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c index dfb9f55e2685..9cf744917a5f 100644 --- a/net/mac80211/debugfs.c +++ b/net/mac80211/debugfs.c @@ -496,6 +496,7 @@ static const char *hw_flag_names[] = { FLAG(SUPPORTS_CONC_MON_RX_DECAP), FLAG(DETECTS_COLOR_COLLISION), FLAG(MLO_MCAST_MULTI_LINK_TX), + FLAG(SUPPORTS_AP_PS), #undef FLAG }; From patchwork Mon Mar 20 16:43:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maharaja Kennadyrajan X-Patchwork-Id: 13181612 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9B35C7619A for ; Mon, 20 Mar 2023 16:53:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233176AbjCTQxO (ORCPT ); Mon, 20 Mar 2023 12:53:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232852AbjCTQwv (ORCPT ); Mon, 20 Mar 2023 12:52:51 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBD38DBD4 for ; Mon, 20 Mar 2023 09:44:43 -0700 (PDT) Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32KCYfRZ012267; Mon, 20 Mar 2023 16:44:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=0mJQqY0oGkzB9jiHI9vvpQXCd8AnpanNOaVldmBt824=; b=EzYLOoqjpXzCxTuH+zjc4ugOGObEcU63OLT3+zrozHTZsVir71aZyax6ceIcMa6tRG6V I4BZJ2b+yUv8stCwwqSVNDxHHKy+lTYkeojvp7z/P7pxGOvTWspxAlt2VTzLIV5Jgtjg ORn0hvVnUTDn+HfPG+n2NVwZV+175+Ni0qsvKt6YWbWFfVyshX7tzFey8IBgPAg8YVDK 4saC7db9ZcLHchC7b3HFze0Efgf0Z18iqhc4RmNripte520ukrP8Xm3Vtaz8Ruyxq+GA mXEbc8V8GVNydtSJvVJuos/uRyHWvgvOCx7XOighk+u+18/DQ9nG3oQGeKb8rYkTxYzS aA== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pek4fhb7t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Mar 2023 16:44:10 +0000 Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 32KGi9aP025236 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Mar 2023 16:44:09 GMT Received: from che-siroccolnx03.qualcomm.com (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 20 Mar 2023 09:44:07 -0700 From: Maharaja Kennadyrajan To: CC: , Venkateswara Naralasetty , Maharaja Kennadyrajan Subject: [PATCH v2 4/4] wifi: ath11k: add AP power save support Date: Mon, 20 Mar 2023 22:13:34 +0530 Message-ID: <20230320164334.3325886-5-quic_mkenna@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230320164334.3325886-1-quic_mkenna@quicinc.com> References: <20230320164334.3325886-1-quic_mkenna@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: KpyhKZLDxuv6TKsvPgH_u8RJjV2-C076 X-Proofpoint-ORIG-GUID: KpyhKZLDxuv6TKsvPgH_u8RJjV2-C076 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-20_14,2023-03-20_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 malwarescore=0 mlxscore=0 priorityscore=1501 adultscore=0 impostorscore=0 spamscore=0 mlxlogscore=999 suspectscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303150002 definitions=main-2303200141 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Venkateswara Naralasetty AP goes into the power save mode if no stations are connected and it will come out of power save as and when any of the station associate to it. Driver will advertise this flag SUPPORTS_AP_PS to enable the AP power save in mac80211. This AP power save capability can be used to save power with the drawback of reduced range or delayed discovery of the AP. This feature is enabled in QCN9074, IPQ8074, IPQ5018, QCN6122. Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 Signed-off-by: Maharaja Kennadyrajan Signed-off-by: Venkateswara Naralasetty --- drivers/net/wireless/ath/ath11k/core.c | 8 ++++ drivers/net/wireless/ath/ath11k/core.h | 8 ++++ drivers/net/wireless/ath/ath11k/hw.h | 1 + drivers/net/wireless/ath/ath11k/mac.c | 58 ++++++++++++++++++++++++++ drivers/net/wireless/ath/ath11k/wmi.c | 32 ++++++++++++++ drivers/net/wireless/ath/ath11k/wmi.h | 8 ++++ 6 files changed, 115 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c index 75fdbe4ef83a..5cf9203b751e 100644 --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c @@ -117,6 +117,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .tx_ring_size = DP_TCL_DATA_RING_SIZE, .smp2p_wow_exit = false, .ftm_responder = true, + .supports_ap_ps = true, }, { .hw_rev = ATH11K_HW_IPQ6018_HW10, @@ -200,6 +201,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .smp2p_wow_exit = false, .support_fw_mac_sequence = false, .ftm_responder = true, + .supports_ap_ps = true, }, { .name = "qca6390 hw2.0", @@ -285,6 +287,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .smp2p_wow_exit = false, .support_fw_mac_sequence = true, .ftm_responder = false, + .supports_ap_ps = false, }, { .name = "qcn9074 hw1.0", @@ -367,6 +370,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .smp2p_wow_exit = false, .support_fw_mac_sequence = false, .ftm_responder = true, + .supports_ap_ps = true, }, { .name = "wcn6855 hw2.0", @@ -452,6 +456,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .smp2p_wow_exit = false, .support_fw_mac_sequence = true, .ftm_responder = false, + .supports_ap_ps = false, }, { .name = "wcn6855 hw2.1", @@ -535,6 +540,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .smp2p_wow_exit = false, .support_fw_mac_sequence = true, .ftm_responder = false, + .supports_ap_ps = false, }, { .name = "wcn6750 hw1.0", @@ -616,6 +622,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .smp2p_wow_exit = true, .support_fw_mac_sequence = true, .ftm_responder = false, + .supports_ap_ps = false, }, { .hw_rev = ATH11K_HW_IPQ5018_HW10, @@ -696,6 +703,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .smp2p_wow_exit = false, .support_fw_mac_sequence = false, .ftm_responder = true, + .supports_ap_ps = true, }, }; diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h index 0830276e5028..fefb1fb5220d 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -363,6 +363,7 @@ struct ath11k_vif { struct ieee80211_chanctx_conf chanctx; struct ath11k_arp_ns_offload arp_ns_offload; struct ath11k_rekey_data rekey_data; + bool vif_ap_ps_enabled; #ifdef CONFIG_ATH11K_DEBUGFS struct dentry *debugfs_twt; @@ -589,6 +590,11 @@ struct ath11k_per_peer_tx_stats { #define ATH11K_FLUSH_TIMEOUT (5 * HZ) #define ATH11K_VDEV_DELETE_TIMEOUT_HZ (5 * HZ) +enum ath11k_ap_ps_state { + ATH11K_AP_PS_STATE_OFF, + ATH11K_AP_PS_STATE_ON, +}; + struct ath11k { struct ath11k_base *ab; struct ath11k_pdev *pdev; @@ -732,6 +738,8 @@ struct ath11k { /* protected by conf_mutex */ bool ps_state_enable; bool ps_timekeeper_enable; + bool ap_ps_enabled; + enum ath11k_ap_ps_state ap_ps_state; }; struct ath11k_band_cap { diff --git a/drivers/net/wireless/ath/ath11k/hw.h b/drivers/net/wireless/ath/ath11k/hw.h index 0be4e1232384..40953e117cc5 100644 --- a/drivers/net/wireless/ath/ath11k/hw.h +++ b/drivers/net/wireless/ath/ath11k/hw.h @@ -225,6 +225,7 @@ struct ath11k_hw_params { bool smp2p_wow_exit; bool support_fw_mac_sequence; bool ftm_responder; + bool supports_ap_ps; }; struct ath11k_hw_ops { diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index cad832e0e6b8..db0d772ff7c7 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -3215,6 +3215,43 @@ static int ath11k_mac_config_obss_pd(struct ath11k *ar, return 0; } +void ath11k_mac_ap_ps_recalc(struct ath11k *ar) +{ + struct ath11k_vif *arvif; + enum ath11k_ap_ps_state state = ATH11K_AP_PS_STATE_OFF; + int ret; + bool allow_ap_ps = true; + + lockdep_assert_held(&ar->conf_mutex); + + list_for_each_entry(arvif, &ar->arvifs, list) { + if (arvif->vdev_type == WMI_VDEV_TYPE_STA || + !arvif->vif_ap_ps_enabled) { + allow_ap_ps = false; + break; + } + } + + if (!allow_ap_ps) + ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "ap ps is not allowed\n"); + + if (allow_ap_ps && !ar->num_stations && ar->ap_ps_enabled) + state = ATH11K_AP_PS_STATE_ON; + + if (ar->ap_ps_state == state) + return; + + ret = ath11k_wmi_pdev_ap_ps_cmd_send(ar, ar->pdev->pdev_id, state); + if (ret) { + ath11k_dbg(ar->ab, ATH11K_DBG_MAC, + "failed to send ap ps command pdev_id %u state %u\n", + ar->pdev->pdev_id, state); + return; + } + + ar->ap_ps_state = state; +} + static void ath11k_mac_op_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_bss_conf *info, @@ -3567,6 +3604,16 @@ static void ath11k_mac_op_bss_info_changed(struct ieee80211_hw *hw, vif->addr, arvif->arp_ns_offload.ipv4_addr); } + if ((changed & BSS_CHANGED_PS) && vif->type == NL80211_IFTYPE_AP) { + if (!info->ap_ps_enable) + arvif->vif_ap_ps_enabled = false; + else + arvif->vif_ap_ps_enabled = true; + + ar->ap_ps_enabled = info->ap_ps_enable; + ath11k_mac_ap_ps_recalc(ar); + } + mutex_unlock(&ar->conf_mutex); } @@ -4651,6 +4698,8 @@ static int ath11k_mac_station_add(struct ath11k *ar, ath11k_dbg(ab, ATH11K_DBG_MAC, "Added peer: %pM for VDEV: %d\n", sta->addr, arvif->vdev_id); + ath11k_mac_ap_ps_recalc(ar); + if (ath11k_debugfs_is_extd_tx_stats_enabled(ar)) { arsta->tx_stats = kzalloc(sizeof(*arsta->tx_stats), GFP_KERNEL); if (!arsta->tx_stats) { @@ -4810,6 +4859,8 @@ static int ath11k_mac_op_sta_state(struct ieee80211_hw *hw, kfree(arsta->rx_stats); arsta->rx_stats = NULL; + + ath11k_mac_ap_ps_recalc(ar); } else if (old_state == IEEE80211_STA_AUTH && new_state == IEEE80211_STA_ASSOC && (vif->type == NL80211_IFTYPE_AP || @@ -6599,6 +6650,8 @@ static int ath11k_mac_op_add_interface(struct ieee80211_hw *hw, ret); } + ath11k_mac_ap_ps_recalc(ar); + mutex_unlock(&ar->conf_mutex); return 0; @@ -6703,6 +6756,8 @@ static void ath11k_mac_op_remove_interface(struct ieee80211_hw *hw, ath11k_debugfs_remove_interface(arvif); + ath11k_mac_ap_ps_recalc(ar); + /* TODO: recal traffic pause state based on the available vdevs */ mutex_unlock(&ar->conf_mutex); @@ -9122,6 +9177,9 @@ static int __ath11k_mac_register(struct ath11k *ar) ieee80211_hw_set(ar->hw, USES_RSS); } + if (ar->ab->hw_params.supports_ap_ps) + ieee80211_hw_set(ar->hw, SUPPORTS_AP_PS); + ar->hw->wiphy->features |= NL80211_FEATURE_STATIC_SMPS; ar->hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index 27f3fceb33c5..02b14ba6ad45 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -1290,6 +1290,38 @@ ath11k_wmi_rx_reord_queue_remove(struct ath11k *ar, return ret; } +int ath11k_wmi_pdev_ap_ps_cmd_send(struct ath11k *ar, u32 pdev_id, + u32 param_value) +{ + struct ath11k_pdev_wmi *wmi = ar->wmi; + struct wmi_pdev_ap_ps_cmd *cmd; + struct sk_buff *skb; + int ret; + + skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd)); + if (!skb) + return -ENOMEM; + + cmd = (struct wmi_pdev_ap_ps_cmd *)skb->data; + cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, + WMI_TAG_PDEV_GREEN_AP_PS_ENABLE_CMD) | + FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE); + cmd->pdev_id = pdev_id; + cmd->param_value = param_value; + + ret = ath11k_wmi_cmd_send(wmi, skb, WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID); + if (ret) { + ath11k_warn(ar->ab, "failed to send ap ps enable/disable cmd\n"); + dev_kfree_skb(skb); + } + + ath11k_dbg(ar->ab, ATH11K_DBG_WMI, + "wmi pdev ap ps set pdev id %d value %d\n", + pdev_id, param_value); + + return ret; +} + int ath11k_wmi_pdev_set_param(struct ath11k *ar, u32 param_id, u32 param_value, u8 pdev_id) { diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h index b23b7a22bc9a..8b37dd935a95 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.h +++ b/drivers/net/wireless/ath/ath11k/wmi.h @@ -3037,6 +3037,12 @@ struct wmi_fwtest_set_param_cmd_param { u32 param_value; }; +struct wmi_pdev_ap_ps_cmd { + u32 tlv_header; + u32 pdev_id; + u32 param_value; +} __packed; + struct wmi_pdev_set_param_cmd { u32 tlv_header; u32 pdev_id; @@ -6445,5 +6451,7 @@ int ath11k_wmi_pdev_set_bios_sar_table_param(struct ath11k *ar, const u8 *sar_va int ath11k_wmi_pdev_set_bios_geo_table_param(struct ath11k *ar); int ath11k_wmi_sta_keepalive(struct ath11k *ar, const struct wmi_sta_keepalive_arg *arg); +int ath11k_wmi_pdev_ap_ps_cmd_send(struct ath11k *ar, u32 pdev_id, + u32 value); #endif