All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stanislaw Gruszka <sgruszka@redhat.com>
To: linux-wireless@vger.kernel.org
Cc: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>,
	Felix Fietkau <nbd@nbd.name>,
	linux-mediatek@lists.infradead.org
Subject: [PATCH 13/22] mt76: unify add_interface
Date: Tue,  4 Sep 2018 16:41:06 +0200	[thread overview]
Message-ID: <1536072075-6990-14-git-send-email-sgruszka@redhat.com> (raw)
In-Reply-To: <1536072075-6990-1-git-send-email-sgruszka@redhat.com>

Make common add_interface for mt76x0 and mt76x2e. This change behavior
for mt76x0, but it should work with the new implementation.

mt76x2u has different implementation. Maybe it can use common one,
but for now leave it as is.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/mediatek/mt76/mt76x0/main.c  | 13 +---------
 drivers/net/wireless/mediatek/mt76/mt76x02_util.c | 30 ++++++++++++++++++++++
 drivers/net/wireless/mediatek/mt76/mt76x02_util.h |  2 ++
 drivers/net/wireless/mediatek/mt76/mt76x2_main.c  | 31 +----------------------
 4 files changed, 34 insertions(+), 42 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/main.c b/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
index d8efa009126c..809ee41e7121 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
@@ -51,17 +51,6 @@ static void mt76x0_stop(struct ieee80211_hw *hw)
 	mutex_unlock(&dev->mt76.mutex);
 }
 
-
-static int mt76x0_add_interface(struct ieee80211_hw *hw,
-				 struct ieee80211_vif *vif)
-{
-	struct mt76x0_dev *dev = hw->priv;
-	unsigned int idx = 0;
-
-	mt76x02_vif_init(&dev->mt76, vif, idx);
-	return 0;
-}
-
 static int mt76x0_config(struct ieee80211_hw *hw, u32 changed)
 {
 	struct mt76x0_dev *dev = hw->priv;
@@ -194,7 +183,7 @@ const struct ieee80211_ops mt76x0_ops = {
 	.tx = mt76x0_tx,
 	.start = mt76x0_start,
 	.stop = mt76x0_stop,
-	.add_interface = mt76x0_add_interface,
+	.add_interface = mt76x02_add_interface,
 	.remove_interface = mt76x02_remove_interface,
 	.config = mt76x0_config,
 	.configure_filter = mt76x02_configure_filter,
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
index 69f19ef361a1..04cd4dc394d5 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
@@ -127,6 +127,36 @@ void mt76x02_vif_init(struct mt76_dev *dev, struct ieee80211_vif *vif,
 }
 EXPORT_SYMBOL_GPL(mt76x02_vif_init);
 
+int
+mt76x02_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
+{
+	struct mt76_dev *dev = hw->priv;
+	unsigned int idx = 0;
+
+	if (vif->addr[0] & BIT(1))
+		idx = 1 + (((dev->macaddr[0] ^ vif->addr[0]) >> 2) & 7);
+
+	/*
+	 * Client mode typically only has one configurable BSSID register,
+	 * which is used for bssidx=0. This is linked to the MAC address.
+	 * Since mac80211 allows changing interface types, and we cannot
+	 * force the use of the primary MAC address for a station mode
+	 * interface, we need some other way of configuring a per-interface
+	 * remote BSSID.
+	 * The hardware provides an AP-Client feature, where bssidx 0-7 are
+	 * used for AP mode and bssidx 8-15 for client mode.
+	 * We shift the station interface bss index by 8 to force the
+	 * hardware to recognize the BSSID.
+	 * The resulting bssidx mismatch for unicast frames is ignored by hw.
+	 */
+	if (vif->type == NL80211_IFTYPE_STATION)
+		idx += 8;
+
+	mt76x02_vif_init(dev, vif, idx);
+	return 0;
+}
+EXPORT_SYMBOL_GPL(mt76x02_add_interface);
+
 void mt76x02_remove_interface(struct ieee80211_hw *hw,
 			     struct ieee80211_vif *vif)
 {
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.h b/drivers/net/wireless/mediatek/mt76/mt76x02_util.h
index a61c9f2b9a62..f8890ab7b04e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.h
@@ -28,6 +28,8 @@ int mt76x02_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 
 void mt76x02_vif_init(struct mt76_dev *dev, struct ieee80211_vif *vif,
 		     unsigned int idx);
+int mt76x02_add_interface(struct ieee80211_hw *hw,
+			 struct ieee80211_vif *vif);
 void mt76x02_remove_interface(struct ieee80211_hw *hw,
 			     struct ieee80211_vif *vif);
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2_main.c
index 128a1c1c0f64..99d9033efa15 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_main.c
@@ -55,35 +55,6 @@ mt76x2_stop(struct ieee80211_hw *hw)
 }
 
 static int
-mt76x2_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
-{
-	struct mt76x2_dev *dev = hw->priv;
-	unsigned int idx = 0;
-
-	if (vif->addr[0] & BIT(1))
-		idx = 1 + (((dev->mt76.macaddr[0] ^ vif->addr[0]) >> 2) & 7);
-
-	/*
-	 * Client mode typically only has one configurable BSSID register,
-	 * which is used for bssidx=0. This is linked to the MAC address.
-	 * Since mac80211 allows changing interface types, and we cannot
-	 * force the use of the primary MAC address for a station mode
-	 * interface, we need some other way of configuring a per-interface
-	 * remote BSSID.
-	 * The hardware provides an AP-Client feature, where bssidx 0-7 are
-	 * used for AP mode and bssidx 8-15 for client mode.
-	 * We shift the station interface bss index by 8 to force the
-	 * hardware to recognize the BSSID.
-	 * The resulting bssidx mismatch for unicast frames is ignored by hw.
-	 */
-	if (vif->type == NL80211_IFTYPE_STATION)
-		idx += 8;
-
-	mt76x02_vif_init(&dev->mt76, vif, idx);
-	return 0;
-}
-
-static int
 mt76x2_set_channel(struct mt76x2_dev *dev, struct cfg80211_chan_def *chandef)
 {
 	int ret;
@@ -313,7 +284,7 @@ const struct ieee80211_ops mt76x2_ops = {
 	.tx = mt76x2_tx,
 	.start = mt76x2_start,
 	.stop = mt76x2_stop,
-	.add_interface = mt76x2_add_interface,
+	.add_interface = mt76x02_add_interface,
 	.remove_interface = mt76x02_remove_interface,
 	.config = mt76x2_config,
 	.configure_filter = mt76x02_configure_filter,
-- 
2.7.5

WARNING: multiple messages have this Message-ID (diff)
From: Stanislaw Gruszka <sgruszka-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Lorenzo Bianconi
	<lorenzo.bianconi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Felix Fietkau <nbd-Vt+b4OUoWG0@public.gmane.org>,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: [PATCH 13/22] mt76: unify add_interface
Date: Tue,  4 Sep 2018 16:41:06 +0200	[thread overview]
Message-ID: <1536072075-6990-14-git-send-email-sgruszka@redhat.com> (raw)
In-Reply-To: <1536072075-6990-1-git-send-email-sgruszka-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

Make common add_interface for mt76x0 and mt76x2e. This change behavior
for mt76x0, but it should work with the new implementation.

mt76x2u has different implementation. Maybe it can use common one,
but for now leave it as is.

Signed-off-by: Stanislaw Gruszka <sgruszka-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 drivers/net/wireless/mediatek/mt76/mt76x0/main.c  | 13 +---------
 drivers/net/wireless/mediatek/mt76/mt76x02_util.c | 30 ++++++++++++++++++++++
 drivers/net/wireless/mediatek/mt76/mt76x02_util.h |  2 ++
 drivers/net/wireless/mediatek/mt76/mt76x2_main.c  | 31 +----------------------
 4 files changed, 34 insertions(+), 42 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/main.c b/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
index d8efa009126c..809ee41e7121 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
@@ -51,17 +51,6 @@ static void mt76x0_stop(struct ieee80211_hw *hw)
 	mutex_unlock(&dev->mt76.mutex);
 }
 
-
-static int mt76x0_add_interface(struct ieee80211_hw *hw,
-				 struct ieee80211_vif *vif)
-{
-	struct mt76x0_dev *dev = hw->priv;
-	unsigned int idx = 0;
-
-	mt76x02_vif_init(&dev->mt76, vif, idx);
-	return 0;
-}
-
 static int mt76x0_config(struct ieee80211_hw *hw, u32 changed)
 {
 	struct mt76x0_dev *dev = hw->priv;
@@ -194,7 +183,7 @@ const struct ieee80211_ops mt76x0_ops = {
 	.tx = mt76x0_tx,
 	.start = mt76x0_start,
 	.stop = mt76x0_stop,
-	.add_interface = mt76x0_add_interface,
+	.add_interface = mt76x02_add_interface,
 	.remove_interface = mt76x02_remove_interface,
 	.config = mt76x0_config,
 	.configure_filter = mt76x02_configure_filter,
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
index 69f19ef361a1..04cd4dc394d5 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
@@ -127,6 +127,36 @@ void mt76x02_vif_init(struct mt76_dev *dev, struct ieee80211_vif *vif,
 }
 EXPORT_SYMBOL_GPL(mt76x02_vif_init);
 
+int
+mt76x02_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
+{
+	struct mt76_dev *dev = hw->priv;
+	unsigned int idx = 0;
+
+	if (vif->addr[0] & BIT(1))
+		idx = 1 + (((dev->macaddr[0] ^ vif->addr[0]) >> 2) & 7);
+
+	/*
+	 * Client mode typically only has one configurable BSSID register,
+	 * which is used for bssidx=0. This is linked to the MAC address.
+	 * Since mac80211 allows changing interface types, and we cannot
+	 * force the use of the primary MAC address for a station mode
+	 * interface, we need some other way of configuring a per-interface
+	 * remote BSSID.
+	 * The hardware provides an AP-Client feature, where bssidx 0-7 are
+	 * used for AP mode and bssidx 8-15 for client mode.
+	 * We shift the station interface bss index by 8 to force the
+	 * hardware to recognize the BSSID.
+	 * The resulting bssidx mismatch for unicast frames is ignored by hw.
+	 */
+	if (vif->type == NL80211_IFTYPE_STATION)
+		idx += 8;
+
+	mt76x02_vif_init(dev, vif, idx);
+	return 0;
+}
+EXPORT_SYMBOL_GPL(mt76x02_add_interface);
+
 void mt76x02_remove_interface(struct ieee80211_hw *hw,
 			     struct ieee80211_vif *vif)
 {
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.h b/drivers/net/wireless/mediatek/mt76/mt76x02_util.h
index a61c9f2b9a62..f8890ab7b04e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.h
@@ -28,6 +28,8 @@ int mt76x02_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 
 void mt76x02_vif_init(struct mt76_dev *dev, struct ieee80211_vif *vif,
 		     unsigned int idx);
+int mt76x02_add_interface(struct ieee80211_hw *hw,
+			 struct ieee80211_vif *vif);
 void mt76x02_remove_interface(struct ieee80211_hw *hw,
 			     struct ieee80211_vif *vif);
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2_main.c
index 128a1c1c0f64..99d9033efa15 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_main.c
@@ -55,35 +55,6 @@ mt76x2_stop(struct ieee80211_hw *hw)
 }
 
 static int
-mt76x2_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
-{
-	struct mt76x2_dev *dev = hw->priv;
-	unsigned int idx = 0;
-
-	if (vif->addr[0] & BIT(1))
-		idx = 1 + (((dev->mt76.macaddr[0] ^ vif->addr[0]) >> 2) & 7);
-
-	/*
-	 * Client mode typically only has one configurable BSSID register,
-	 * which is used for bssidx=0. This is linked to the MAC address.
-	 * Since mac80211 allows changing interface types, and we cannot
-	 * force the use of the primary MAC address for a station mode
-	 * interface, we need some other way of configuring a per-interface
-	 * remote BSSID.
-	 * The hardware provides an AP-Client feature, where bssidx 0-7 are
-	 * used for AP mode and bssidx 8-15 for client mode.
-	 * We shift the station interface bss index by 8 to force the
-	 * hardware to recognize the BSSID.
-	 * The resulting bssidx mismatch for unicast frames is ignored by hw.
-	 */
-	if (vif->type == NL80211_IFTYPE_STATION)
-		idx += 8;
-
-	mt76x02_vif_init(&dev->mt76, vif, idx);
-	return 0;
-}

  parent reply	other threads:[~2018-09-04 19:07 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-04 14:40 [PATCH 00/22] mt76 patches 2018-09-04 Stanislaw Gruszka
2018-09-04 14:40 ` Stanislaw Gruszka
2018-09-04 14:40 ` [PATCH 01/22] mt76: move wcid fields to common mt76_dev struct Stanislaw Gruszka
2018-09-04 14:40   ` Stanislaw Gruszka
2018-09-04 14:40 ` [PATCH 02/22] mt76: unify sta_add / sta_remove Stanislaw Gruszka
2018-09-04 14:40   ` Stanislaw Gruszka
2018-09-04 14:40 ` [PATCH 03/22] mt76: pratially unify add_interface Stanislaw Gruszka
2018-09-04 14:40   ` Stanislaw Gruszka
2018-09-04 14:40 ` [PATCH 04/22] mt76x0: fix wrong usage of wcid_mask in remove_interface Stanislaw Gruszka
2018-09-04 14:40   ` Stanislaw Gruszka
2018-09-04 14:40 ` [PATCH 05/22] mt76: unify ampdu_action Stanislaw Gruszka
2018-09-04 14:40   ` Stanislaw Gruszka
2018-09-04 14:40 ` [PATCH 06/22] mt76: unify set_key Stanislaw Gruszka
2018-09-04 14:40   ` Stanislaw Gruszka
2018-09-04 14:41 ` [PATCH 07/22] mt76x0: remove empty sta_notify Stanislaw Gruszka
2018-09-04 14:41   ` Stanislaw Gruszka
2018-09-04 14:41 ` [PATCH 08/22] mt76: unify AC to hw queue mapping Stanislaw Gruszka
2018-09-04 14:41   ` Stanislaw Gruszka
2018-09-04 14:41 ` [PATCH 09/22] mt76: remove q->hw_idx Stanislaw Gruszka
2018-09-04 14:41   ` Stanislaw Gruszka
2018-09-10  9:19   ` Felix Fietkau
2018-09-10  9:19     ` Felix Fietkau
2018-09-04 14:41 ` [PATCH 10/22] mt76: unify conf_tx Stanislaw Gruszka
2018-09-04 14:41   ` Stanislaw Gruszka
2018-09-04 14:41 ` [PATCH 11/22] mt76x0: remove vif_mask Stanislaw Gruszka
2018-09-04 14:41   ` Stanislaw Gruszka
2018-09-04 14:41 ` [PATCH 12/22] mt76: unify remove_interface Stanislaw Gruszka
2018-09-04 14:41   ` Stanislaw Gruszka
2018-09-04 14:41 ` Stanislaw Gruszka [this message]
2018-09-04 14:41   ` [PATCH 13/22] mt76: unify add_interface Stanislaw Gruszka
2018-09-04 14:41 ` [PATCH 14/22] mt76: unify sta_rate_tbl_update and related helpers Stanislaw Gruszka
2018-09-04 14:41   ` Stanislaw Gruszka
2018-09-04 14:41 ` [PATCH 15/22] mt76: unify txwi and rxwi structures Stanislaw Gruszka
2018-09-04 14:41   ` Stanislaw Gruszka
2018-09-04 14:41 ` [PATCH 16/22] mt76: unify load_tx_status Stanislaw Gruszka
2018-09-04 14:41   ` Stanislaw Gruszka
2018-09-04 14:41 ` [PATCH 17/22] mt76: unify send_tx_status and related helpers Stanislaw Gruszka
2018-09-04 14:41   ` Stanislaw Gruszka
2018-09-04 14:41 ` [PATCH 18/22] mt76: use mt76_rx_status in mt76x0 Stanislaw Gruszka
2018-09-04 14:41   ` Stanislaw Gruszka
2018-09-04 14:41 ` [PATCH 19/22] mt76: unify mac_process_rate Stanislaw Gruszka
2018-09-04 14:41   ` Stanislaw Gruszka
2018-09-04 14:41 ` [PATCH 20/22] mt76x0: reserve enough space in mac80211 Stanislaw Gruszka
2018-09-04 14:41   ` Stanislaw Gruszka
2018-09-04 14:41 ` [PATCH 21/22] mt76: unify {insert/remove}_hdr_pad Stanislaw Gruszka
2018-09-04 14:41   ` Stanislaw Gruszka
2018-09-04 14:41 ` [PATCH 22/22] mt76: partially unify filling txwi fields Stanislaw Gruszka
2018-09-04 14:41   ` Stanislaw Gruszka
2018-09-11 14:19 ` [PATCH 00/22] mt76 patches 2018-09-04 Kalle Valo
2018-09-11 14:19   ` Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1536072075-6990-14-git-send-email-sgruszka@redhat.com \
    --to=sgruszka@redhat.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=nbd@nbd.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.