From patchwork Fri Aug 24 11:15:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislaw Gruszka X-Patchwork-Id: 10575635 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 09153174C for ; Fri, 24 Aug 2018 16:42:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBA252CA10 for ; Fri, 24 Aug 2018 16:42:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DFEAC2CA12; Fri, 24 Aug 2018 16:42:21 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable 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 39D582CA11 for ; Fri, 24 Aug 2018 16:42:21 +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:References: In-Reply-To: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:List-Owner; bh=w5D/t9ZTS6hTCBat2jhc6u7JF353A/px2OfXOrf0LZ4=; b=J0Pg5S7b+CWsVv0N+EEUx8b+v9 dRu+OtAL3OCAYBba41ptkFtd6hiHyue6kmsfT9JaWO3GDpIgm2OqwbdyMcDy5cUylWAtBTLENBiiO UhIswxVFfJdnZZEb9bm69XxpSzQV3QEFmxdU110Ct17SP5IEfcyTCohZcFEVscGRyKm5bNR7m9wKh 7unSzRupIVFMe5ZqshnuItoJ02+VGZMxT0UX4GT7g8GCP27JhYRT/M9Un+lGW3R2T8ocjNMY731me QX9eSTymHgz/qDBT0iSUFxyGt7jSGDlpbDSjAR0ykghd5dpUQybdtD0Cry3XXwgEsPG9HIhBEzmcA 9ZN5N0Mg==; 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 1ftFAC-0008Nt-7x for patchwork-linux-mediatek@patchwork.kernel.org; Fri, 24 Aug 2018 16:42:20 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ftBeR-0005du-8o for linux-mediatek@bombadil.infradead.org; Fri, 24 Aug 2018 12:57:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=GxkW739HwyDPFS7ITg4kncJdQsaDYrDtZMH4JLd+Khk=; b=A3JGkUzI0gdhjO48nStVH6Rhu i1r1jrm53UkoxZa+YKE08md/QSHWh6IA2Y4yrh0C+aXEhWRQTlQU7xoRNqAFbFFVu1mLXxPj8f5NC tq3wDQf0OUc5gXb40jPmONjnE6aodsFp8fDZvJzm1HkFP+n3IVKNJgK+T+UClrhRGjsmuUNiAOXLL zb6tOurWOStK7HhLw6dgevjJQ/Lr1mUZ+jI+UPYLnNVefuxMt+bpptz2bSXs1aBQT8SYgaWdUf7g6 y5Oo4X2e3ZeClquYmH9uzkfMRf+r10whOeyy5IRqTHb268FFqE+7CJ5ecBabbikMGICYeCDUbbbO5 1j3QqMdPg==; Received: from mx3-rdu2.redhat.com ([66.187.233.73] helo=mx1.redhat.com) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ftA4o-0000U2-1e for linux-mediatek@lists.infradead.org; Fri, 24 Aug 2018 11:16:26 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5A7A3401DEB3; Fri, 24 Aug 2018 11:16:01 +0000 (UTC) Received: from localhost (unknown [10.43.2.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3C7BC2157F49; Fri, 24 Aug 2018 11:15:59 +0000 (UTC) From: Stanislaw Gruszka To: linux-wireless@vger.kernel.org Subject: [PATCH 13/17] mt76: unify mt76xx_vif struct Date: Fri, 24 Aug 2018 13:15:17 +0200 Message-Id: <1535109321-17126-14-git-send-email-sgruszka@redhat.com> In-Reply-To: <1535109321-17126-1-git-send-email-sgruszka@redhat.com> References: <1535109321-17126-1-git-send-email-sgruszka@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 24 Aug 2018 11:16:01 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 24 Aug 2018 11:16:01 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'sgruszka@redhat.com' RCPT:'' X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180824_071626_178098_BA48C868 X-CRM114-Status: GOOD ( 14.76 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stanislaw Gruszka , Lorenzo Bianconi , linux-mediatek@lists.infradead.org, Felix Fietkau MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Private vif structures definitions are the same for mt76x2 and mt76x0. Signed-off-by: Stanislaw Gruszka --- drivers/net/wireless/mediatek/mt76/mt76x0/init.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76x0/main.c | 8 ++++---- drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h | 6 ------ drivers/net/wireless/mediatek/mt76/mt76x0/tx.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76x2.h | 8 +------- drivers/net/wireless/mediatek/mt76/mt76x2_common.c | 8 ++++---- drivers/net/wireless/mediatek/mt76/mt76x2_init_common.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76x2_mac.h | 2 +- drivers/net/wireless/mediatek/mt76/mt76x2_main.c | 4 ++-- drivers/net/wireless/mediatek/mt76/mt76x2_tx.c | 6 +++--- drivers/net/wireless/mediatek/mt76/mt76x2_tx_common.c | 4 ++-- drivers/net/wireless/mediatek/mt76/mt76x2u_main.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76xx_mac.h | 6 ++++++ 13 files changed, 27 insertions(+), 33 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c index 5be6854c40d7..3bc16f3a66f9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c @@ -689,7 +689,7 @@ int mt76x0_register_device(struct mt76x0_dev *dev) hw->max_rate_tries = 1; hw->sta_data_size = sizeof(struct mt76_sta); - hw->vif_data_size = sizeof(struct mt76_vif); + hw->vif_data_size = sizeof(struct mt76xx_vif); SET_IEEE80211_PERM_ADDR(hw, dev->macaddr); diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/main.c b/drivers/net/wireless/mediatek/mt76/mt76x0/main.c index 79e236d814c1..2d655e715ee8 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/main.c @@ -56,7 +56,7 @@ static int mt76x0_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { struct mt76x0_dev *dev = hw->priv; - struct mt76_vif *mvif = (struct mt76_vif *) vif->drv_priv; + struct mt76xx_vif *mvif = (struct mt76xx_vif *) vif->drv_priv; unsigned int idx; idx = ffs(~dev->vif_mask); @@ -77,7 +77,7 @@ static void mt76x0_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { struct mt76x0_dev *dev = hw->priv; - struct mt76_vif *mvif = (struct mt76_vif *) vif->drv_priv; + struct mt76xx_vif *mvif = (struct mt76xx_vif *) vif->drv_priv; unsigned int wcid = mvif->group_wcid.idx; dev->wcid_mask[wcid / BITS_PER_LONG] &= ~BIT(wcid % BITS_PER_LONG); @@ -160,7 +160,7 @@ static int mt76x0_config(struct ieee80211_hw *hw, u32 changed) { struct mt76x0_dev *dev = hw->priv; struct mt76_sta *msta = (struct mt76_sta *) sta->drv_priv; - struct mt76_vif *mvif = (struct mt76_vif *) vif->drv_priv; + struct mt76xx_vif *mvif = (struct mt76xx_vif *) vif->drv_priv; int ret = 0; int idx = 0; @@ -242,7 +242,7 @@ static int mt76x0_config(struct ieee80211_hw *hw, u32 changed) struct ieee80211_key_conf *key) { struct mt76x0_dev *dev = hw->priv; - struct mt76_vif *mvif = (struct mt76_vif *) vif->drv_priv; + struct mt76xx_vif *mvif = (struct mt76xx_vif *) vif->drv_priv; struct mt76_sta *msta = sta ? (struct mt76_sta *) sta->drv_priv : NULL; struct mt76_wcid *wcid = msta ? &msta->wcid : &mvif->group_wcid; int idx = key->keyidx; diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h index 68f1d5535e5e..87579338e27e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h @@ -219,12 +219,6 @@ struct mt76x0_wcid { u8 tx_rate_nss; }; -struct mt76_vif { - u8 idx; - - struct mt76_wcid group_wcid; -}; - struct mt76_tx_status { u8 valid:1; u8 success:1; diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/tx.c b/drivers/net/wireless/mediatek/mt76/mt76x0/tx.c index c45d05d5aab1..82114dd0cbb9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/tx.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/tx.c @@ -167,7 +167,7 @@ void mt76x0_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, msta = (struct mt76_sta *) sta->drv_priv; wcid = &msta->wcid; } else if (vif && (!info->control.hw_key && wcid->hw_key_idx != 0xff)) { - struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv; + struct mt76xx_vif *mvif = (struct mt76xx_vif *)vif->drv_priv; wcid = &mvif->group_wcid; } diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2.h b/drivers/net/wireless/mediatek/mt76/mt76x2.h index 2b90d5847b9d..5d27d399bd16 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x2.h @@ -144,16 +144,10 @@ struct mt76x2_dev { struct mt76x2_dfs_pattern_detector dfs_pd; }; -struct mt76x2_vif { - u8 idx; - - struct mt76_wcid group_wcid; -}; - struct mt76x2_sta { struct mt76_wcid wcid; /* must be first */ - struct mt76x2_vif *vif; + struct mt76xx_vif *vif; struct mt76x2_tx_status status; int n_frames; diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_common.c b/drivers/net/wireless/mediatek/mt76/mt76x2_common.c index 30baa03f4789..fcd9b31d3c56 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_common.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_common.c @@ -32,9 +32,9 @@ void mt76x2_txq_init(struct mt76x2_dev *dev, struct ieee80211_txq *txq) sta = (struct mt76x2_sta *) txq->sta->drv_priv; mtxq->wcid = &sta->wcid; } else { - struct mt76x2_vif *mvif; + struct mt76xx_vif *mvif; - mvif = (struct mt76x2_vif *) txq->vif->drv_priv; + mvif = (struct mt76xx_vif *) txq->vif->drv_priv; mtxq->wcid = &mvif->group_wcid; } @@ -98,7 +98,7 @@ int mt76x2_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, { struct mt76x2_dev *dev = hw->priv; struct mt76x2_sta *msta = (struct mt76x2_sta *) sta->drv_priv; - struct mt76x2_vif *mvif = (struct mt76x2_vif *) vif->drv_priv; + struct mt76xx_vif *mvif = (struct mt76xx_vif *) vif->drv_priv; int ret = 0; int idx = 0; int i; @@ -169,7 +169,7 @@ int mt76x2_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, struct ieee80211_key_conf *key) { struct mt76x2_dev *dev = hw->priv; - struct mt76x2_vif *mvif = (struct mt76x2_vif *) vif->drv_priv; + struct mt76xx_vif *mvif = (struct mt76xx_vif *) vif->drv_priv; struct mt76x2_sta *msta; struct mt76_wcid *wcid; int idx = key->keyidx; diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_init_common.c b/drivers/net/wireless/mediatek/mt76/mt76x2_init_common.c index 324b2a4b8b67..2a1ff7248d6b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_init_common.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_init_common.c @@ -209,7 +209,7 @@ void mt76x2_init_device(struct mt76x2_dev *dev) hw->extra_tx_headroom = 2; hw->sta_data_size = sizeof(struct mt76x2_sta); - hw->vif_data_size = sizeof(struct mt76x2_vif); + hw->vif_data_size = sizeof(struct mt76xx_vif); ieee80211_hw_set(hw, SUPPORTS_HT_CCK_RATES); ieee80211_hw_set(hw, SUPPORTS_REORDERING_BUFFER); diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_mac.h b/drivers/net/wireless/mediatek/mt76/mt76x2_mac.h index a2ab36f764c0..bd85792e0717 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_mac.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_mac.h @@ -22,7 +22,7 @@ struct mt76x2_dev; struct mt76x2_sta; -struct mt76x2_vif; +struct mt76xx_vif; struct mt76x2_txwi; struct mt76x2_tx_status { diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2_main.c index 96ff5620c74c..6d25d8209c0b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_main.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_main.c @@ -58,7 +58,7 @@ mt76x2_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { struct mt76x2_dev *dev = hw->priv; - struct mt76x2_vif *mvif = (struct mt76x2_vif *) vif->drv_priv; + struct mt76xx_vif *mvif = (struct mt76xx_vif *) vif->drv_priv; unsigned int idx = 0; if (vif->addr[0] & BIT(1)) @@ -167,7 +167,7 @@ struct ieee80211_bss_conf *info, u32 changed) { struct mt76x2_dev *dev = hw->priv; - struct mt76x2_vif *mvif = (struct mt76x2_vif *) vif->drv_priv; + struct mt76xx_vif *mvif = (struct mt76xx_vif *) vif->drv_priv; mutex_lock(&dev->mt76.mutex); diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_tx.c b/drivers/net/wireless/mediatek/mt76/mt76x2_tx.c index c6550fd912dd..cf653ab74dc3 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_tx.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_tx.c @@ -58,7 +58,7 @@ int mt76x2_tx_prepare_skb(struct mt76_dev *mdev, void *txwi, mt76x2_update_beacon_iter(void *priv, u8 *mac, struct ieee80211_vif *vif) { struct mt76x2_dev *dev = (struct mt76x2_dev *) priv; - struct mt76x2_vif *mvif = (struct mt76x2_vif *) vif->drv_priv; + struct mt76xx_vif *mvif = (struct mt76xx_vif *) vif->drv_priv; struct sk_buff *skb = NULL; if (!(dev->beacon_mask & BIT(mvif->idx))) @@ -76,7 +76,7 @@ int mt76x2_tx_prepare_skb(struct mt76_dev *mdev, void *txwi, { struct beacon_bc_data *data = priv; struct mt76x2_dev *dev = data->dev; - struct mt76x2_vif *mvif = (struct mt76x2_vif *) vif->drv_priv; + struct mt76xx_vif *mvif = (struct mt76xx_vif *) vif->drv_priv; struct ieee80211_tx_info *info; struct sk_buff *skb; @@ -164,7 +164,7 @@ void mt76x2_pre_tbtt_tasklet(unsigned long arg) while ((skb = __skb_dequeue(&data.q)) != NULL) { struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); struct ieee80211_vif *vif = info->control.vif; - struct mt76x2_vif *mvif = (struct mt76x2_vif *) vif->drv_priv; + struct mt76xx_vif *mvif = (struct mt76xx_vif *) vif->drv_priv; mt76_dma_tx_queue_skb(&dev->mt76, q, skb, &mvif->group_wcid, NULL); diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_tx_common.c b/drivers/net/wireless/mediatek/mt76/mt76x2_tx_common.c index c0ca0df84ed8..fb716f182d78 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_tx_common.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_tx_common.c @@ -37,9 +37,9 @@ void mt76x2_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, } if (vif && !control->sta) { - struct mt76x2_vif *mvif; + struct mt76xx_vif *mvif; - mvif = (struct mt76x2_vif *)vif->drv_priv; + mvif = (struct mt76xx_vif *)vif->drv_priv; wcid = &mvif->group_wcid; } diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2u_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2u_main.c index aa0fa254fa0b..b3aa2404575c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2u_main.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2u_main.c @@ -49,7 +49,7 @@ static int mt76x2u_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { struct mt76x2_dev *dev = hw->priv; - struct mt76x2_vif *mvif = (struct mt76x2_vif *)vif->drv_priv; + struct mt76xx_vif *mvif = (struct mt76xx_vif *)vif->drv_priv; unsigned int idx = 0; if (!ether_addr_equal(dev->mt76.macaddr, vif->addr)) diff --git a/drivers/net/wireless/mediatek/mt76/mt76xx_mac.h b/drivers/net/wireless/mediatek/mt76/mt76xx_mac.h index 5767b630719b..e110448d4f5e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76xx_mac.h +++ b/drivers/net/wireless/mediatek/mt76/mt76xx_mac.h @@ -18,6 +18,12 @@ #ifndef __MT76XX_MAC_H #define __MT76XX_MAC_H +struct mt76xx_vif { + u8 idx; + + struct mt76_wcid group_wcid; +}; + static inline bool mt76xx_wait_for_mac(struct mt76_dev *dev) { const u32 MAC_CSR0 = 0x1000;