From patchwork Mon Jun 3 11:37:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sriram R X-Patchwork-Id: 10972787 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 43B8976 for ; Mon, 3 Jun 2019 11:38:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 311EC287E5 for ; Mon, 3 Jun 2019 11:38:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 253DA288B8; Mon, 3 Jun 2019 11:38:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B2434288B9 for ; Mon, 3 Jun 2019 11:38:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=TOEAXux4Mo5xSbRN7keQzUhKyu9ZkVaHHMUosrSvYUQ=; b=ej+ 5TtnOaFClJRWia3toZJi9MYr7P0nOQuqGXK7lBx0jSlOEQCUF6XYO4LSb13uA6yuKR28f1Dh0KntA FAgm0Bm7fbJcn2GS+J2Pd5E2T1DlU3gVvrhFtH4tXhrTfVzoA9x7mz2RMEivrBG0oSr9d3TFHMYJ7 /gH9Ab6+TJcw37bgYBe9P0Bm1QbGQ0IEcFbV/t6ETa2EX7BgzVCvDvS5ETmfz4tugUQPOi+4rsVj7 TkaWrJn4uGUpKH3lQE1RuvWXaaLl6i48TmOypYuwGOdevzxX8FTIvwFFUxzACZUeAHhhszxSx1qQT ujwoHfd32xK+eZZs4eYaeJHOTpG+KAA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hXlHt-0003jv-Ph; Mon, 03 Jun 2019 11:38:01 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hXlHr-0003jL-54 for ath11k@lists.infradead.org; Mon, 03 Jun 2019 11:38:00 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 79FCD60DB3; Mon, 3 Jun 2019 11:37:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1559561878; bh=HwLFImlMwldYOc4eLQcDYnv2aWt4WttoEyhoppUEzRo=; h=From:To:Cc:Subject:Date:From; b=gAAA+6XS8Z7OoKsqFh+JWId8RccYuZRMfdZO3btoNXipS0B2b9teEoQBKsW64Swf5 W7n7QeVaMyEsRAiAozkuLINaRKyeiIcWQMTQ8qBSEOC3/HVUYEW2aHIodSxDekn34n XlSBbpTqaN6c9Bm7ns0gf6seu0LptQrg6HHjPBFg= Received: from checstp253621-lin.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: srirrama@codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id B83F660ADE; Mon, 3 Jun 2019 11:37:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1559561877; bh=HwLFImlMwldYOc4eLQcDYnv2aWt4WttoEyhoppUEzRo=; h=From:To:Cc:Subject:Date:From; b=Q2O/TgjnFVoxSPGMgrTOLBCheBRBcAFjUKuLF6tiuf2x2KWY0wPzSZq61vUsYS5Om Li5nAgnWQdQCQ7sLxXk2K4AGv2df6AmXwROR/jJ5fuI2SMSYBJzz5AdpXrr14A/DLd p1yx+fIbhlp1MBiCJEjEZs6K27zai7nVa9M8vNTU= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org B83F660ADE Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=srirrama@codeaurora.org From: Sriram R To: ath11k@lists.infradead.org Subject: [PATCH] ath11k: Fix vdev start failure when operating in CN, KR regdomain Date: Mon, 3 Jun 2019 17:07:45 +0530 Message-Id: <1559561865-27928-1-git-send-email-srirrama@codeaurora.org> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190603_043759_230207_C7F9643C X-CRM114-Status: GOOD ( 13.39 ) X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sriram R MIME-Version: 1.0 Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, firmware expects the correct regdomain to be set in vdev start command. As firmware supports regulatory offload, it can track the current regdomain. This info is received from firmware via REG_CHAN_LIST_CC event during bringup or after setting country code. Currently the dfs_region received is mapped to nl80211_dfs_regions and stored in default_regd or new_regd and is used for vdev start. But since nl80211_dfs_regions doesn't have a value enumerated for CN KR, the firmware rejects VDEV start with an 'invalid regdomain' error. Hence, send the appropriate regdomain received from firmware during REG_CHAN_LIST_CC event in vdev start to avoid vdev start failure. Signed-off-by: Sriram R --- drivers/net/wireless/ath/ath11k/core.h | 13 +++++++++++++ drivers/net/wireless/ath/ath11k/mac.c | 10 +--------- drivers/net/wireless/ath/ath11k/wmi.c | 3 +++ drivers/net/wireless/ath/ath11k/wmi.h | 1 + 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h index 148c9a4..f7d2d96 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -302,6 +302,16 @@ enum ath11k_stats_type { ATH11K_STATS_TYPE_MAX, }; +enum ath11k_dfs_region { + ATH11K_DFS_REG_UNSET, + ATH11K_DFS_REG_FCC, + ATH11K_DFS_REG_ETSI, + ATH11K_DFS_REG_MKK, + ATH11K_DFS_REG_CN, + ATH11K_DFS_REG_KR, + ATH11K_DFS_REG_UNDEF, +}; + struct ath11k_htt_data_stats { u64 legacy[ATH11K_COUNTER_TYPE_MAX][ATH11K_LEGACY_NUM]; u64 ht[ATH11K_COUNTER_TYPE_MAX][ATH11K_HT_MCS_NUM]; @@ -622,6 +632,9 @@ struct ath11k_base { * This may or may not be used during the runtime */ struct ieee80211_regdomain *new_regd[MAX_RADIOS]; + + /* Current DFS Regulatory */ + enum ath11k_dfs_region dfs_region; #ifdef CONFIG_ATH11K_DEBUGFS struct dentry *debugfs_soc; #endif diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index cb0de8e..87a420e 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -3915,15 +3915,7 @@ ath11k_mac_vdev_start_restart(struct ath11k_vif *arvif, arg.channel.passive = arg.channel.chan_radar; spin_lock_bh(&ab->data_lock); - - /* Use the new reg info if available */ - if (ar->ab->new_regd[ar->pdev_idx]) - arg.regdomain = - ar->ab->new_regd[ar->pdev_idx]->dfs_region; - else - arg.regdomain = - ar->ab->default_regd[ar->pdev_idx]->dfs_region; - + arg.regdomain = ar->ab->dfs_region; spin_unlock_bh(&ab->data_lock); /* TODO: Notify if secondary 80Mhz also needs radar detection */ diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index 9ca44c4..3ac1e1c 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -4645,6 +4645,7 @@ static int ath11k_reg_chan_list_event(struct ath11k_base *ab, u8 *evt_buf, u32 l /* This regd would be applied during mac registration */ ab->default_regd[pdev_idx] = regd; } + ab->dfs_region = reg_info->dfs_region; spin_unlock(&ab->data_lock); goto mem_free; @@ -4748,6 +4749,8 @@ static inline const char *ath11k_wmi_vdev_resp_print(u32 vdev_resp_status) return "not supported"; case WMI_VDEV_START_RESPONSE_DFS_VIOLATION: return "dfs violation"; + case WMI_VDEV_START_RESPONSE_INVALID_REGDOMAIN: + return "invalid regdomain"; default: return "unknown"; } diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h index 366a136..0d36c8a 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.h +++ b/drivers/net/wireless/ath/ath11k/wmi.h @@ -4221,6 +4221,7 @@ enum wmi_vdev_start_resp_status_code { WMI_VDEV_START_RESPONSE_INVALID_VDEVID = 1, WMI_VDEV_START_RESPONSE_NOT_SUPPORTED = 2, WMI_VDEV_START_RESPONSE_DFS_VIOLATION = 3, + WMI_VDEV_START_RESPONSE_INVALID_REGDOMAIN = 4, }; ;