From patchwork Mon Jun 10 09:43:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karthikeyan periyasamy X-Patchwork-Id: 10984583 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 40E2214E5 for ; Mon, 10 Jun 2019 09:43:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FE53205FC for ; Mon, 10 Jun 2019 09:43:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 23D1F27FA8; Mon, 10 Jun 2019 09:43:49 +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 A4D0C205FC for ; Mon, 10 Jun 2019 09:43:48 +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=nOB1vOAhFftV8QTQ6ZN/7kESGULTVhzzHfUPhDoVOfs=; b=X6M uCiXasQKGnFARo1lcakbaxpv5zyesF6O3gtd1h0QBNLZlraJTmau7ksge+xsYMRHYx6iURhI/K+9I Og8PM0Z9Quhixora2Vn5hQubq5DYOyj72sFWeMHjDNV6r90xzqA44Dmj29E//pzmJIetIdbL8TWnw gYv83H0h0suV0it6EFRy969ENGuxoaPkoqxiwNLy36YcZ7lOF/vnZF0Ma0kHK6VRIe2flUfpMYajE bXXAAclPX+7KUrZleizXbu5Te9+GkmBzQaWssM1hzEFe14MDmX8Ea2QzpOw/l3lH1T7ms9zeulnYX 7ufMpxx3mGQR5pHJSUeh6vuOfluYStg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1haGqB-0007Wx-Ro; Mon, 10 Jun 2019 09:43:47 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1haGq5-0007WS-Vj for ath11k@lists.infradead.org; Mon, 10 Jun 2019 09:43:46 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 662FA60790; Mon, 10 Jun 2019 09:43:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1560159821; bh=BJnA7So0y3Qq3s7wWXmXOJI97aZSRoOi2LZK/NW0zeQ=; h=From:To:Cc:Subject:Date:From; b=kZydyTrQPGyXfIx28O3FGeSdfmvLxngQX7y/8cLR7TYCkOJzO15vZmtTYMIQjPfF0 k+nC8Hw2IU/UyvQ9KwmTPZc72HAjNa5FDWDQrWKB/fBktHb9P+GKN8sYxRvuJcx3MK 8aCW1Kk8dyW65rzwzqBxWyIL6C7QcAE3zv1/49Ec= Received: from CHECSTP284781-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: periyasa@codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 2D62F60314; Mon, 10 Jun 2019 09:43:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1560159820; bh=BJnA7So0y3Qq3s7wWXmXOJI97aZSRoOi2LZK/NW0zeQ=; h=From:To:Cc:Subject:Date:From; b=lEabO6QBrmGFCi1EuuH6RnM7dXHdL9JgHXWgUrObmETiHeUpv9PNh259Gyb3DM1Jb rzhzeZEi4pQpgO00XxBPFdyynqK14HlVuHEbkQcbziZw5hTj4oJBAyjH1DYMRU5Ch9 r8xdUg67eWvaiVqDZAsGIoiTf/k9BfrhWGpzUnB0= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2D62F60314 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=periyasa@codeaurora.org From: Karthikeyan Periyasamy To: ath11k@lists.infradead.org Subject: [PATCH] ath11k: Cleanup the access code of hw mac_id mapping Date: Mon, 10 Jun 2019 15:13:15 +0530 Message-Id: <1560159795-5931-1-git-send-email-periyasa@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190610_024345_436777_AD9F09F4 X-CRM114-Status: GOOD ( 11.53 ) X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Karthikeyan Periyasamy MIME-Version: 1.0 Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Added separate function call to get the hw mac id from the pdev index. Signed-off-by: Karthikeyan Periyasamy --- drivers/net/wireless/ath/ath11k/ahb.c | 8 ++++---- drivers/net/wireless/ath/ath11k/core.c | 23 +++++++++++++++++++++++ drivers/net/wireless/ath/ath11k/core.h | 4 ++-- drivers/net/wireless/ath/ath11k/mac.c | 2 +- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/ahb.c b/drivers/net/wireless/ath/ath11k/ahb.c index c3e487a..a2c697b 100644 --- a/drivers/net/wireless/ath/ath11k/ahb.c +++ b/drivers/net/wireless/ath/ath11k/ahb.c @@ -803,22 +803,22 @@ static int ath11k_ahb_ext_irq_config(struct ath11k_base *sc) if (ath11k_rxdma2host_ring_mask[i] & BIT(j)) { irq_grp->irqs[num_irq++] = rxdma2host_destination_ring_mac1 - - hw_mac_id_map[j]; + - ath11k_core_get_hw_mac_id(sc, j); } if (ath11k_host2rxdma_ring_mask[i] & BIT(j)) { irq_grp->irqs[num_irq++] = host2rxdma_host_buf_ring_mac1 - - hw_mac_id_map[j]; + - ath11k_core_get_hw_mac_id(sc, j); } if (rx_mon_status_ring_mask[i] & BIT(j)) { irq_grp->irqs[num_irq++] = ppdu_end_interrupts_mac1 - - hw_mac_id_map[j]; + ath11k_core_get_hw_mac_id(sc, j); irq_grp->irqs[num_irq++] = rxdma2host_monitor_status_ring_mac1 - - hw_mac_id_map[j]; + ath11k_core_get_hw_mac_id(sc, j); } } } diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c index 928d47b..5655df3 100644 --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c @@ -27,6 +27,29 @@ }, }; +/* Map from pdev index to hw mac index */ +u8 ath11k_core_get_hw_mac_id(struct ath11k_base *ab, int pdev_idx) +{ + u8 mac_id; + + switch (pdev_idx) { + case 0: + mac_id = 0; + break; + case 1: + mac_id = 2; + break; + case 2: + mac_id = 1; + break; + default: + mac_id = ATH11K_INVALID_HW_MAC_ID; + ath11k_warn(ab, "Invalid pdev idx %d\n", pdev_idx); + break; + } + return mac_id; +} + static int ath11k_core_create_board_name(struct ath11k_base *sc, char *name, size_t name_len) { diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h index 7ebb5a4..038f905 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -24,8 +24,7 @@ #define ATH11K_TX_MGMT_NUM_PENDING_MAX 512 -/* Map from pdev index to hw mac index */ -static const u8 hw_mac_id_map[MAX_RADIOS] = { 0, 2, 1, }; +#define ATH11K_INVALID_HW_MAC_ID 0xFF enum ath11k_supported_bw { ATH11K_BW_20 = 0, @@ -828,6 +827,7 @@ struct ieee80211_regdomain * int ath11k_regd_update(struct ath11k *ar, bool init); int ath11k_reg_update_chan_list(struct ath11k *ar); void ath11k_core_halt(struct ath11k *ar); +u8 ath11k_core_get_hw_mac_id(struct ath11k_base *ab, int pdev_idx); static inline const char *ath11k_scan_state_str(enum ath11k_scan_state state) { diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index 13da2e8..ab4670f 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -5570,7 +5570,7 @@ int ath11k_mac_create(struct ath11k_base *ab) ar->ab = ab; ar->pdev = pdev; ar->pdev_idx = i; - ar->lmac_id = hw_mac_id_map[i]; + ar->lmac_id = ath11k_core_get_hw_mac_id(ab, i); ar->wmi = &ab->wmi_sc.wmi[i]; /* FIXME wmi[0] is already initialized during attach,