From patchwork Mon Mar 20 16:35:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maharaja Kennadyrajan X-Patchwork-Id: 13181593 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 07C58C6FD1D for ; Mon, 20 Mar 2023 16:41:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231862AbjCTQlw (ORCPT ); Mon, 20 Mar 2023 12:41:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231912AbjCTQlV (ORCPT ); Mon, 20 Mar 2023 12:41:21 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16D092CC79 for ; Mon, 20 Mar 2023 09:35:47 -0700 (PDT) Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32KFR4G7016937; Mon, 20 Mar 2023 16:35:42 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=k71qA0XiEUeBxodj50GZNzSULtYmUR0m9thofYSQvpMKJTXT3oPY2ulRUR9qAfdg5xNg YHZa2PS0HkKJBGCVL7LZjStiqsyVCecEMJzkOHq+sJSXkRxef1I3hqbI57WoKO6M88pz UdK7O09Bn1im0B0oSmDFFNkd+/BvkrcmFqWtuGAtcBKmSaX8AFWckQQUah7pMAAAHepW bvTdLmu8W0JubiW0s61ZntbZNDMlvY+humK9DSE31YxbDMgNyLgwOtxXYRI+ABef0YXI oWOJ8mVGZ+ayvyvi9u8xAz+t2PYqeWL1NdDS/gfj5vOSpP4kfLEWuda4LCwNiDAxJNja xA== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pejxc9bp3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Mar 2023 16:35:42 +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 32KGZfLb028098 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Mar 2023 16:35:41 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:35:39 -0700 From: Maharaja Kennadyrajan To: CC: , Venkateswara Naralasetty , Maharaja Kennadyrajan Subject: [PATCH 1/4] wifi: nl80211: rename NL80211_CMD_SET_BEACON to NL80211_CMD_UDPATE_AP Date: Mon, 20 Mar 2023 22:05:19 +0530 Message-ID: <20230320163522.3325587-2-quic_mkenna@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230320163522.3325587-1-quic_mkenna@quicinc.com> References: <20230320163522.3325587-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: 9HAJG-qITbuy-gY4nQ0JpoxKsKD3GzBP X-Proofpoint-ORIG-GUID: 9HAJG-qITbuy-gY4nQ0JpoxKsKD3GzBP 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 suspectscore=0 priorityscore=1501 mlxscore=0 phishscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 bulkscore=0 malwarescore=0 impostorscore=0 mlxlogscore=999 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:35:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maharaja Kennadyrajan X-Patchwork-Id: 13181591 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 0A696C6FD1D for ; Mon, 20 Mar 2023 16:41:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231994AbjCTQlt (ORCPT ); Mon, 20 Mar 2023 12:41:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229793AbjCTQlI (ORCPT ); Mon, 20 Mar 2023 12:41:08 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7A552B62E for ; Mon, 20 Mar 2023 09:35:48 -0700 (PDT) Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32KE7s4O023072; Mon, 20 Mar 2023 16:35:44 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=Qt5dSUmC/Ue7Dzksd4ITXtJsJkWGEH51rbdePHbz9WubMZpMpPLz/wqjJ3caleMSdJpy b9OqSFCMwBiLuDb1Cw17kHR+jzw/BwDwJba4VkFJReAgN8xXZJNvlH0Wjp1PPx/aioBn qIg3x9wkxLk88h0zOtnRGs4EkTHSI8ffGJc+Cu6c9jNwklO9pFSnabmO7H1RiStDXks4 YSAd5kiXQYL0+bj+iGca2T5uI7plrKdmJa05cfoXszZ7qy+9Mok1++O3g1irsC4VNex9 r01QEh0FyppxwSGCnwfguGErVHZX9j6EPgkz3x6g5KwyUbdvdhpAQ26kBhYoDGTwFF6L Bw== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3peryx0e3q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Mar 2023 16:35:44 +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 32KGZhei028121 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Mar 2023 16:35:43 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:35:41 -0700 From: Maharaja Kennadyrajan To: CC: , Venkateswara Naralasetty , Maharaja Kennadyrajan Subject: [PATCH 2/4] wifi: nl80211: add configuration support for ap power save Date: Mon, 20 Mar 2023 22:05:20 +0530 Message-ID: <20230320163522.3325587-3-quic_mkenna@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230320163522.3325587-1-quic_mkenna@quicinc.com> References: <20230320163522.3325587-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: wTGkVXTg56j2LOLY7rwox3LYpoxT76Ct X-Proofpoint-ORIG-GUID: wTGkVXTg56j2LOLY7rwox3LYpoxT76Ct 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 mlxscore=0 suspectscore=0 clxscore=1015 impostorscore=0 malwarescore=0 spamscore=0 adultscore=0 priorityscore=1501 phishscore=0 mlxlogscore=999 bulkscore=0 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 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:35:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maharaja Kennadyrajan X-Patchwork-Id: 13181589 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 1D047C6FD1D for ; Mon, 20 Mar 2023 16:41:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229971AbjCTQlq (ORCPT ); Mon, 20 Mar 2023 12:41:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232484AbjCTQlD (ORCPT ); Mon, 20 Mar 2023 12:41:03 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8734D26CC6 for ; Mon, 20 Mar 2023 09:35:51 -0700 (PDT) Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32KER7U1007436; Mon, 20 Mar 2023 16:35:46 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=k0PNn2YpRbLDJHUk564knOCr4D5w2Z56Cebh46bkwspExA+xsZrm+LgaP6f3kca5XW7k y//VI1IuFs4zXw6WhLSFoo0lwJZeV3b+7zpDKUJwCwV6npohb7FpbNQ86tWy53FrYXM/ tPMxyvDcJzJaGiuaTVyIAILF0ynTfH1e3Kk9MKg6fcqbV6weIi1NiqYUwW9wAfxlsp09 eR8VEbWNaoP3Cj3degOw1+fvVfr0vYY3Wsu+XJir2I7b08PbKzaF/rnukiz512e7GCF6 3Mh5azGdf++dUkirpydhYWYwYj0ThPT/Wl+DTf4uHHXIz5y52aydawSs298mZmm2Awq7 rg== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pes8p0cr2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Mar 2023 16:35:46 +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 32KGZjdt012160 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Mar 2023 16:35:45 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:35:43 -0700 From: Maharaja Kennadyrajan To: CC: , Venkateswara Naralasetty , Maharaja Kennadyrajan Subject: [PATCH 3/4] wifi: mac80211: notify BSS change upon AP power save change Date: Mon, 20 Mar 2023 22:05:21 +0530 Message-ID: <20230320163522.3325587-4-quic_mkenna@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230320163522.3325587-1-quic_mkenna@quicinc.com> References: <20230320163522.3325587-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: IKemyL6kDjBQweUzIYIYNnTBCkP1mEJh X-Proofpoint-ORIG-GUID: IKemyL6kDjBQweUzIYIYNnTBCkP1mEJh 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 priorityscore=1501 mlxscore=0 mlxlogscore=984 impostorscore=0 malwarescore=0 phishscore=0 clxscore=1015 adultscore=0 bulkscore=0 spamscore=0 suspectscore=0 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 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:35:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maharaja Kennadyrajan X-Patchwork-Id: 13181592 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 E243DC7618A for ; Mon, 20 Mar 2023 16:41:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231786AbjCTQlv (ORCPT ); Mon, 20 Mar 2023 12:41:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230218AbjCTQlG (ORCPT ); Mon, 20 Mar 2023 12:41:06 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FD592BEE7 for ; Mon, 20 Mar 2023 09:35:54 -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 32KBtUNF031669; Mon, 20 Mar 2023 16:35:48 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=Wd1ouWFn22uuUjZM/AJdyOjuurDqGtr20LPXum2Llr4=; b=nFaWgiCvitGSBoaOKFE6LRm2qqNZ4DhpB+NJsR+f5LR3u9ckLj5ugEJc2vjZRpOC940y eE6rE46caoDYrVL2we0up89GL+KyjQDDwbU0eFN/3MutI6xUdZYm/o43y6G0JLE2Kak/ eWRxiaveqVk/kzJX437aTSNZZsE2vwb7fMPy4oUGSc0J337V7GH3K+c3sbbEw1Rb0UkH eFZiKalPuSHVNw3TBVHH20dQRUCFnB5ejuYQYxlScFrfUA9NZjHWCLoCdk3UBM6c3TM+ t1SnZ8Ea5mAL89/lhHU8OlC5hgHYHhsUz1sOc82Ig1j5NN6p0pe8Pp7IVsv/A5aBkni3 QQ== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pek4fhakw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Mar 2023 16:35:48 +0000 Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 32KGZlQc017963 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Mar 2023 16:35:47 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:35:45 -0700 From: Maharaja Kennadyrajan To: CC: , Venkateswara Naralasetty , Maharaja Kennadyrajan Subject: [PATCH 4/4] wifi: ath11k: add AP power save support Date: Mon, 20 Mar 2023 22:05:22 +0530 Message-ID: <20230320163522.3325587-5-quic_mkenna@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230320163522.3325587-1-quic_mkenna@quicinc.com> References: <20230320163522.3325587-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: PEWOEhl7G5zw3W_g3jKsqd5wcWT56jN0 X-Proofpoint-ORIG-GUID: PEWOEhl7G5zw3W_g3jKsqd5wcWT56jN0 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 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. 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