Message ID | 1541758814-2046-2-git-send-email-sgruszka@redhat.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Kalle Valo |
Headers | show |
Series | mt76x02: bssid setup corrections for STA | expand |
> Use MT_MAC_APC_BSSID0_H_EN bit to indicatate we are > setting BSSID for STA. > > Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> > --- > drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c > index 59b336e34cb5..cfeae5586897 100644 > --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c > +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c > @@ -826,10 +826,16 @@ void mt76x02_mac_work(struct work_struct *work) > > void mt76x02_mac_set_bssid(struct mt76x02_dev *dev, u8 idx, const u8 *addr) > { > + u32 bssid_h = FIELD_PREP(MT_MAC_APC_BSSID_H_ADDR, > + get_unaligned_le16(addr + 4)); > + u32 bssid_l = get_unaligned_le32(addr); > + > + if (idx > 7) > + bssid_h |= MT_MAC_APC_BSSID0_H_EN; This bit is to enable APClient mode and it is valid just for register 0x1094 (MT_MAC_APC_BSSID_{L,h}(0)). Moreover IIRC APClient has been disabled because it causes a performance degradation. > + > idx &= 7; > - mt76_wr(dev, MT_MAC_APC_BSSID_L(idx), get_unaligned_le32(addr)); > - mt76_rmw_field(dev, MT_MAC_APC_BSSID_H(idx), MT_MAC_APC_BSSID_H_ADDR, > - get_unaligned_le16(addr + 4)); > + mt76_wr(dev, MT_MAC_APC_BSSID_L(idx), bssid_l); > + mt76_wr(dev, MT_MAC_APC_BSSID_H(idx), bssid_h); > } > > static int > -- > 1.9.3 >
On Fri, Nov 09, 2018 at 12:09:50PM +0100, Lorenzo Bianconi wrote: > > Use MT_MAC_APC_BSSID0_H_EN bit to indicatate we are > > setting BSSID for STA. > > > > Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> > > --- > > drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 12 +++++++++--- > > 1 file changed, 9 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c > > index 59b336e34cb5..cfeae5586897 100644 > > --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c > > +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c > > @@ -826,10 +826,16 @@ void mt76x02_mac_work(struct work_struct *work) > > > > void mt76x02_mac_set_bssid(struct mt76x02_dev *dev, u8 idx, const u8 *addr) > > { > > + u32 bssid_h = FIELD_PREP(MT_MAC_APC_BSSID_H_ADDR, > > + get_unaligned_le16(addr + 4)); > > + u32 bssid_l = get_unaligned_le32(addr); > > + > > + if (idx > 7) > > + bssid_h |= MT_MAC_APC_BSSID0_H_EN; > > This bit is to enable APClient mode and it is valid just for register 0x1094 > (MT_MAC_APC_BSSID_{L,h}(0)). Moreover IIRC APClient has been disabled because > it causes a performance degradation. IIRC MT_MAC_APC_BSSID0_H_EN bit enable BSSID8-15 for STA usage, how we then can program to device those BSSIDs ? And if this bit is disabled, shouldn't we use MAC_BSSID_DW for setting BSSID in STA mode ? Thanks Stanislaw
On 2018-11-09 12:09, Lorenzo Bianconi wrote: >> Use MT_MAC_APC_BSSID0_H_EN bit to indicatate we are >> setting BSSID for STA. >> >> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> >> --- >> drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 12 +++++++++--- >> 1 file changed, 9 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c >> index 59b336e34cb5..cfeae5586897 100644 >> --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c >> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c >> @@ -826,10 +826,16 @@ void mt76x02_mac_work(struct work_struct *work) >> >> void mt76x02_mac_set_bssid(struct mt76x02_dev *dev, u8 idx, const u8 *addr) >> { >> + u32 bssid_h = FIELD_PREP(MT_MAC_APC_BSSID_H_ADDR, >> + get_unaligned_le16(addr + 4)); >> + u32 bssid_l = get_unaligned_le32(addr); >> + >> + if (idx > 7) >> + bssid_h |= MT_MAC_APC_BSSID0_H_EN; > > This bit is to enable APClient mode and it is valid just for register 0x1094 > (MT_MAC_APC_BSSID_{L,h}(0)). Moreover IIRC APClient has been disabled because > it causes a performance degradation. The performance degradation was with MAC_ADDR_EXT, not AP-Client. This patch should be fine. - Felix
> On 2018-11-09 12:09, Lorenzo Bianconi wrote: > >> Use MT_MAC_APC_BSSID0_H_EN bit to indicatate we are > >> setting BSSID for STA. > >> > >> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> > >> --- > >> drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 12 +++++++++--- > >> 1 file changed, 9 insertions(+), 3 deletions(-) > >> > >> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c > >> index 59b336e34cb5..cfeae5586897 100644 > >> --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c > >> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c > >> @@ -826,10 +826,16 @@ void mt76x02_mac_work(struct work_struct *work) > >> > >> void mt76x02_mac_set_bssid(struct mt76x02_dev *dev, u8 idx, const u8 *addr) > >> { > >> + u32 bssid_h = FIELD_PREP(MT_MAC_APC_BSSID_H_ADDR, > >> + get_unaligned_le16(addr + 4)); > >> + u32 bssid_l = get_unaligned_le32(addr); > >> + > >> + if (idx > 7) > >> + bssid_h |= MT_MAC_APC_BSSID0_H_EN; > > > > This bit is to enable APClient mode and it is valid just for register 0x1094 > > (MT_MAC_APC_BSSID_{L,h}(0)). Moreover IIRC APClient has been disabled because > > it causes a performance degradation. > The performance degradation was with MAC_ADDR_EXT, not AP-Client. > This patch should be fine. Ah, now I remember sorry, you are right :) Anyway IIRC MT_MAC_APC_BSSID0_H_EN is just for AP_CLIENT_BSSID0 (at least for 76x2), for others we need to use BIT(31) but just if APClient is disabled, right? Moreover BSSID filter is currently disabled (BIT(3) in RX_FILTER_CFG). # echo 0x1400 > /sys/kernel/debug/ieee80211/phy0/mt76/regidx # cat /sys/kernel/debug/ieee80211/phy0/mt76/regval 0x00017f97 Have you tried to enabled it? Regards, Lorenzo > > - Felix
On Fri, Nov 09, 2018 at 01:50:51PM +0100, Lorenzo Bianconi wrote: > > On 2018-11-09 12:09, Lorenzo Bianconi wrote: > > >> Use MT_MAC_APC_BSSID0_H_EN bit to indicatate we are > > >> setting BSSID for STA. > > >> > > >> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> > > >> --- > > >> drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 12 +++++++++--- > > >> 1 file changed, 9 insertions(+), 3 deletions(-) > > >> > > >> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c > > >> index 59b336e34cb5..cfeae5586897 100644 > > >> --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c > > >> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c > > >> @@ -826,10 +826,16 @@ void mt76x02_mac_work(struct work_struct *work) > > >> > > >> void mt76x02_mac_set_bssid(struct mt76x02_dev *dev, u8 idx, const u8 *addr) > > >> { > > >> + u32 bssid_h = FIELD_PREP(MT_MAC_APC_BSSID_H_ADDR, > > >> + get_unaligned_le16(addr + 4)); > > >> + u32 bssid_l = get_unaligned_le32(addr); > > >> + > > >> + if (idx > 7) > > >> + bssid_h |= MT_MAC_APC_BSSID0_H_EN; > > > > > > This bit is to enable APClient mode and it is valid just for register 0x1094 > > > (MT_MAC_APC_BSSID_{L,h}(0)). Moreover IIRC APClient has been disabled because > > > it causes a performance degradation. > > The performance degradation was with MAC_ADDR_EXT, not AP-Client. > > This patch should be fine. > > Ah, now I remember sorry, you are right :) > Anyway IIRC MT_MAC_APC_BSSID0_H_EN is just for AP_CLIENT_BSSID0 (at least for > 76x2), for others we need to use BIT(31) but just if APClient is disabled, right? > Moreover BSSID filter is currently disabled (BIT(3) in RX_FILTER_CFG). > > # echo 0x1400 > /sys/kernel/debug/ieee80211/phy0/mt76/regidx > # cat /sys/kernel/debug/ieee80211/phy0/mt76/regval > 0x00017f97 > > Have you tried to enabled it? I didn't try this yet, but I think it should be enabled to support mulit BSS and MAC address change. However I still don't know how to set multiple bssid for STA, Use BIT(31) or BIT(16) as indicator or maybe just write BSSID to MT_MAC_APC_BSSID_{H,L} and hardware will recognize this is not AP BSSID ? Thanks Stanislaw
> On Fri, Nov 09, 2018 at 01:50:51PM +0100, Lorenzo Bianconi wrote: > > > On 2018-11-09 12:09, Lorenzo Bianconi wrote: > > > >> Use MT_MAC_APC_BSSID0_H_EN bit to indicatate we are > > > >> setting BSSID for STA. > > > >> > > > >> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> > > > >> --- > > > >> drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 12 +++++++++--- > > > >> 1 file changed, 9 insertions(+), 3 deletions(-) > > > >> > > > >> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c > > > >> index 59b336e34cb5..cfeae5586897 100644 > > > >> --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c > > > >> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c > > > >> @@ -826,10 +826,16 @@ void mt76x02_mac_work(struct work_struct *work) > > > >> > > > >> void mt76x02_mac_set_bssid(struct mt76x02_dev *dev, u8 idx, const u8 *addr) > > > >> { > > > >> + u32 bssid_h = FIELD_PREP(MT_MAC_APC_BSSID_H_ADDR, > > > >> + get_unaligned_le16(addr + 4)); > > > >> + u32 bssid_l = get_unaligned_le32(addr); > > > >> + > > > >> + if (idx > 7) > > > >> + bssid_h |= MT_MAC_APC_BSSID0_H_EN; > > > > > > > > This bit is to enable APClient mode and it is valid just for register 0x1094 > > > > (MT_MAC_APC_BSSID_{L,h}(0)). Moreover IIRC APClient has been disabled because > > > > it causes a performance degradation. > > > The performance degradation was with MAC_ADDR_EXT, not AP-Client. > > > This patch should be fine. > > > > Ah, now I remember sorry, you are right :) > > Anyway IIRC MT_MAC_APC_BSSID0_H_EN is just for AP_CLIENT_BSSID0 (at least for > > 76x2), for others we need to use BIT(31) but just if APClient is disabled, right? > > Moreover BSSID filter is currently disabled (BIT(3) in RX_FILTER_CFG). > > > > # echo 0x1400 > /sys/kernel/debug/ieee80211/phy0/mt76/regidx > > # cat /sys/kernel/debug/ieee80211/phy0/mt76/regval > > 0x00017f97 > > > > Have you tried to enabled it? > > I didn't try this yet, but I think it should be enabled to support > mulit BSS and MAC address change. I agree we can use multi-BSS for mac filtering in AP mode but my gut feeling in STA the hw uses the value in MT_MAC_ADDR_DW{0,1} for unicast packet filtering (BIT(2) in RX_FILTER_CFG). Moreover I think there is a relation between MT_MAC_ADDR_DW and BSSID values in multiAP mode. Regards, Lorenzo > > However I still don't know how to set multiple bssid for STA, > Use BIT(31) or BIT(16) as indicator or maybe > just write BSSID to MT_MAC_APC_BSSID_{H,L} and hardware will > recognize this is not AP BSSID ? > > Thanks > Stanislaw
On 2018-11-09 14:42, Lorenzo Bianconi wrote: >> On Fri, Nov 09, 2018 at 01:50:51PM +0100, Lorenzo Bianconi wrote: >> > > On 2018-11-09 12:09, Lorenzo Bianconi wrote: >> > > >> Use MT_MAC_APC_BSSID0_H_EN bit to indicatate we are >> > > >> setting BSSID for STA. >> > > >> >> > > >> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> >> > > >> --- >> > > >> drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 12 +++++++++--- >> > > >> 1 file changed, 9 insertions(+), 3 deletions(-) >> > > >> >> > > >> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c >> > > >> index 59b336e34cb5..cfeae5586897 100644 >> > > >> --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c >> > > >> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c >> > > >> @@ -826,10 +826,16 @@ void mt76x02_mac_work(struct work_struct *work) >> > > >> >> > > >> void mt76x02_mac_set_bssid(struct mt76x02_dev *dev, u8 idx, const u8 *addr) >> > > >> { >> > > >> + u32 bssid_h = FIELD_PREP(MT_MAC_APC_BSSID_H_ADDR, >> > > >> + get_unaligned_le16(addr + 4)); >> > > >> + u32 bssid_l = get_unaligned_le32(addr); >> > > >> + >> > > >> + if (idx > 7) >> > > >> + bssid_h |= MT_MAC_APC_BSSID0_H_EN; >> > > > >> > > > This bit is to enable APClient mode and it is valid just for register 0x1094 >> > > > (MT_MAC_APC_BSSID_{L,h}(0)). Moreover IIRC APClient has been disabled because >> > > > it causes a performance degradation. >> > > The performance degradation was with MAC_ADDR_EXT, not AP-Client. >> > > This patch should be fine. >> > >> > Ah, now I remember sorry, you are right :) >> > Anyway IIRC MT_MAC_APC_BSSID0_H_EN is just for AP_CLIENT_BSSID0 (at least for >> > 76x2), for others we need to use BIT(31) but just if APClient is disabled, right? >> > Moreover BSSID filter is currently disabled (BIT(3) in RX_FILTER_CFG). >> > >> > # echo 0x1400 > /sys/kernel/debug/ieee80211/phy0/mt76/regidx >> > # cat /sys/kernel/debug/ieee80211/phy0/mt76/regval >> > 0x00017f97 >> > >> > Have you tried to enabled it? >> >> I didn't try this yet, but I think it should be enabled to support >> mulit BSS and MAC address change. > > I agree we can use multi-BSS for mac filtering in AP mode but my gut feeling in > STA the hw uses the value in MT_MAC_ADDR_DW{0,1} for unicast packet filtering > (BIT(2) in RX_FILTER_CFG). Moreover I think there is a relation between > MT_MAC_ADDR_DW and BSSID values in multiAP mode. I'm pretty sure that value also gets used for local ACK/BA filtering. We definitely need to set it up properly. In the past, I observed cases where a misconfigured MAC address led to no tx status being reported anymore. - Felix
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c index 59b336e34cb5..cfeae5586897 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c @@ -826,10 +826,16 @@ void mt76x02_mac_work(struct work_struct *work) void mt76x02_mac_set_bssid(struct mt76x02_dev *dev, u8 idx, const u8 *addr) { + u32 bssid_h = FIELD_PREP(MT_MAC_APC_BSSID_H_ADDR, + get_unaligned_le16(addr + 4)); + u32 bssid_l = get_unaligned_le32(addr); + + if (idx > 7) + bssid_h |= MT_MAC_APC_BSSID0_H_EN; + idx &= 7; - mt76_wr(dev, MT_MAC_APC_BSSID_L(idx), get_unaligned_le32(addr)); - mt76_rmw_field(dev, MT_MAC_APC_BSSID_H(idx), MT_MAC_APC_BSSID_H_ADDR, - get_unaligned_le16(addr + 4)); + mt76_wr(dev, MT_MAC_APC_BSSID_L(idx), bssid_l); + mt76_wr(dev, MT_MAC_APC_BSSID_H(idx), bssid_h); } static int
Use MT_MAC_APC_BSSID0_H_EN bit to indicatate we are setting BSSID for STA. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> --- drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)