linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mt76: fix determining multicast frame in sta mode
@ 2021-08-09 21:13 sean.wang
  2021-08-13 10:33 ` Felix Fietkau
  0 siblings, 1 reply; 3+ messages in thread
From: sean.wang @ 2021-08-09 21:13 UTC (permalink / raw)
  To: nbd, lorenzo.bianconi
  Cc: sean.wang, Soul.Huang, YN.Chen, Leon.Yen, Eric-SY.Chang,
	Deren.Wu, km.lin, robin.chiu, ch.yeh, posh.sun, Eric.Liang,
	Stella.Chang, jemele, yenlinlai, linux-wireless, linux-mediatek

From: Sean Wang <sean.wang@mediatek.com>

We should use hdr->addr3 as the destination address to determine the frame
is multicast frame or not when the device is running in sta mode.

We can simply use ieee80211_get_DA for ap mode and sta mode both cases.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Tested-by: Joshua Emele <jemele@chromium.org>
Tested-by: YN Chen <YN.Chen@mediatek.com>
---
v1: patch is generated on the top of mt76 with the additional patches
    [1/2] mt76: mt7915: send EAPOL frames at lowest rate
    [2/2] mt76: mt7921: send EAPOL frames at lowest rate
    [v2] mt76: add support for setting mcast rate
---
 drivers/net/wireless/mediatek/mt76/mt7603/mac.c | 2 +-
 drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 2 +-
 drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 2 +-
 drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c
index 3972c56136a2..be5f68485337 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c
@@ -965,7 +965,7 @@ mt7603_mac_write_txwi(struct mt7603_dev *dev, __le32 *txwi,
 	val = FIELD_PREP(MT_TXD2_FRAME_TYPE, frame_type) |
 	      FIELD_PREP(MT_TXD2_SUB_TYPE, frame_subtype) |
 	      FIELD_PREP(MT_TXD2_MULTICAST,
-			 is_multicast_ether_addr(hdr->addr1));
+			 is_multicast_ether_addr(ieee80211_get_DA(hdr)));
 	txwi[2] = cpu_to_le32(val);
 
 	if (!(info->flags & IEEE80211_TX_CTL_AMPDU))
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
index 5455231f5188..756b7c283a57 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
@@ -617,7 +617,7 @@ int mt7615_mac_write_txwi(struct mt7615_dev *dev, __le32 *txwi,
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 	struct ieee80211_tx_rate *rate = &info->control.rates[0];
 	bool ext_phy = info->hw_queue & MT_TX_HW_QUEUE_EXT_PHY;
-	bool multicast = is_multicast_ether_addr(hdr->addr1);
+	bool multicast = is_multicast_ether_addr(ieee80211_get_DA(hdr));
 	struct ieee80211_vif *vif = info->control.vif;
 	bool is_mmio = mt76_is_mmio(&dev->mt76);
 	u32 val, sz_txd = is_mmio ? MT_TXD_SIZE : MT_USB_TXD_SIZE;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
index 975e81e09a70..8b9dd77968fa 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
@@ -918,7 +918,7 @@ mt7915_mac_write_txwi_80211(struct mt7915_dev *dev, __le32 *txwi,
 	u8 fc_type, fc_stype;
 	u32 val;
 
-	*mcast = is_multicast_ether_addr(hdr->addr1);
+	*mcast = is_multicast_ether_addr(ieee80211_get_DA(hdr));
 
 	if (ieee80211_is_action(fc) &&
 	    mgmt->u.action.category == WLAN_CATEGORY_BACK &&
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
index 7c95189cf8cf..755a8777e47e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
@@ -663,7 +663,7 @@ mt7921_mac_write_txwi_80211(struct mt7921_dev *dev, __le32 *txwi,
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
 	struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data;
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
-	bool multicast = is_multicast_ether_addr(hdr->addr1);
+	bool multicast = is_multicast_ether_addr(ieee80211_get_DA(hdr));
 	u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK;
 	__le16 fc = hdr->frame_control;
 	u8 fc_type, fc_stype;
-- 
2.25.1
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mt76: fix determining multicast frame in sta mode
  2021-08-09 21:13 [PATCH] mt76: fix determining multicast frame in sta mode sean.wang
@ 2021-08-13 10:33 ` Felix Fietkau
  0 siblings, 0 replies; 3+ messages in thread
From: Felix Fietkau @ 2021-08-13 10:33 UTC (permalink / raw)
  To: sean.wang, lorenzo.bianconi
  Cc: Soul.Huang, YN.Chen, Leon.Yen, Eric-SY.Chang, Deren.Wu, km.lin,
	robin.chiu, ch.yeh, posh.sun, Eric.Liang, Stella.Chang, jemele,
	yenlinlai, linux-wireless, linux-mediatek


On 2021-08-09 23:13, sean.wang@mediatek.com wrote:
> From: Sean Wang <sean.wang@mediatek.com>
> 
> We should use hdr->addr3 as the destination address to determine the frame
> is multicast frame or not when the device is running in sta mode.
> 
> We can simply use ieee80211_get_DA for ap mode and sta mode both cases.
That does not make any sense to me. When a sta sends a packet with DA
set to a multicast address, it will be sent as unicast to the AP. Why
should it be treated as multicast by the driver?

- Felix

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mt76: fix determining multicast frame in sta mode
       [not found] <6c6ba2fd-3952-3c44-6c6d-51f77eb66828@nbd.name--annotate>
@ 2021-08-13 16:44 ` sean.wang
  0 siblings, 0 replies; 3+ messages in thread
From: sean.wang @ 2021-08-13 16:44 UTC (permalink / raw)
  To: nbd
  Cc: lorenzo.bianconi, sean.wang, Soul.Huang, YN.Chen, Leon.Yen,
	Deren.Wu, km.lin, robin.chiu, ch.yeh, posh.sun, Eric.Liang,
	Stella.Chang, jemele, yenlinlai, linux-wireless, linux-mediatek

From: Sean Wang <sean.wang@mediatek.com>

>>On 2021-08-09 23:13, sean.wang@mediatek.com wrote:
>> From: Sean Wang <sean.wang@mediatek.com>
>>
>> We should use hdr->addr3 as the destination address to determine the
>> frame is multicast frame or not when the device is running in sta mode.
>>
>> We can simply use ieee80211_get_DA for ap mode and sta mode both cases.
>That does not make any sense to me. When a sta sends a packet with DA set to a multicast address, it will be sent as unicast to the AP. Why should it be treated as multicast by the driver?

You're right. I should drop the patch earlier. Sorry for the noise.

Eventually, I have found the cause, it is possible to some unicast frame picking up a wrong legacy rate
to send out because the current driver doesn't program the legacy rate information well.
The fix have been provided with ("mt76: mt7921: fix firmware usage of RA info using legacy rates") in [1].

	Sean

[1]
https://patchwork.kernel.org/project/linux-wireless/patch/4be4378630c93ae32a4db8bc3e0871c7b15150a6.1628661185.git.objelf@gmail.com/

>
>- Felix
>
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-13 16:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-09 21:13 [PATCH] mt76: fix determining multicast frame in sta mode sean.wang
2021-08-13 10:33 ` Felix Fietkau
     [not found] <6c6ba2fd-3952-3c44-6c6d-51f77eb66828@nbd.name--annotate>
2021-08-13 16:44 ` sean.wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).