2019-06-12 07:43:20

by Ryder Lee

[permalink] [raw]
Subject: [PATCH 1/2] mt76: mt7615: fix incorrect settings in mesh mode

Fix wrong settings that will drop packets due to hardware's RX table
searching flow.

Fixes: f072c7ba2150 ("mt76: mt7615: enable support for mesh")
Signed-off-by: Ryder Lee <[email protected]>
---
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
index 76431d00a8ac..e82086eb8aa4 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
@@ -970,7 +970,7 @@ int mt7615_mcu_add_wtbl(struct mt7615_dev *dev, struct ieee80211_vif *vif,
.rx_wtbl = {
.tag = cpu_to_le16(WTBL_RX),
.len = cpu_to_le16(sizeof(struct wtbl_rx)),
- .rca1 = vif->type == NL80211_IFTYPE_STATION,
+ .rca1 = vif->type != NL80211_IFTYPE_AP,
.rca2 = 1,
.rv = 1,
},
--
2.18.0


2019-06-12 07:43:40

by Ryder Lee

[permalink] [raw]
Subject: [PATCH 2/2] mt76: mt7615: update peer's bssid when state transition changes

Driver should update peer's bssid and bss information when
state transition changes.

Signed-off-by: Ryder Lee <[email protected]>
---
.../net/wireless/mediatek/mt76/mt7615/main.c | 5 +-
.../net/wireless/mediatek/mt76/mt7615/mcu.c | 49 ++++++++++---------
2 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
index d21407ddda31..e0824392c019 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
@@ -283,9 +283,8 @@ static void mt7615_bss_info_changed(struct ieee80211_hw *hw,

mutex_lock(&dev->mt76.mutex);

- /* TODO: sta mode connect/disconnect
- * BSS_CHANGED_ASSOC | BSS_CHANGED_BSSID
- */
+ if (changed & BSS_CHANGED_ASSOC)
+ mt7615_mcu_set_bss_info(dev, vif, info->assoc);

/* TODO: update beacon content
* BSS_CHANGED_BEACON
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
index e82086eb8aa4..8fc12cd37906 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
@@ -741,17 +741,6 @@ int mt7615_mcu_set_bss_info(struct mt7615_dev *dev,
u8 *buf, *data, tx_wlan_idx = 0;
struct req_hdr *hdr;

- if (en) {
- len += sizeof(struct bss_info_omac);
- features |= BIT(BSS_INFO_OMAC);
- if (mvif->omac_idx > EXT_BSSID_START) {
- len += sizeof(struct bss_info_ext_bss);
- features |= BIT(BSS_INFO_EXT_BSS);
- ntlv++;
- }
- ntlv++;
- }
-
switch (vif->type) {
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_MESH_POINT:
@@ -759,22 +748,23 @@ int mt7615_mcu_set_bss_info(struct mt7615_dev *dev,
conn_type = CONNECTION_INFRA_AP;
break;
case NL80211_IFTYPE_STATION: {
- struct ieee80211_sta *sta;
- struct mt7615_sta *msta;
-
- rcu_read_lock();
-
- sta = ieee80211_find_sta(vif, vif->bss_conf.bssid);
- if (!sta) {
+ /* TODO: enable BSS_INFO_UAPSD & BSS_INFO_PM */
+ if (en) {
+ struct ieee80211_sta *sta;
+ struct mt7615_sta *msta;
+
+ rcu_read_lock();
+ sta = ieee80211_find_sta(vif, vif->bss_conf.bssid);
+ if (!sta) {
+ rcu_read_unlock();
+ return -EINVAL;
+ }
+
+ msta = (struct mt7615_sta *)sta->drv_priv;
+ tx_wlan_idx = msta->wcid.idx;
rcu_read_unlock();
- return -EINVAL;
}
-
- msta = (struct mt7615_sta *)sta->drv_priv;
- tx_wlan_idx = msta->wcid.idx;
conn_type = CONNECTION_INFRA_STA;
-
- rcu_read_unlock();
break;
}
default:
@@ -782,6 +772,17 @@ int mt7615_mcu_set_bss_info(struct mt7615_dev *dev,
break;
}

+ if (en) {
+ len += sizeof(struct bss_info_omac);
+ features |= BIT(BSS_INFO_OMAC);
+ if (mvif->omac_idx > EXT_BSSID_START) {
+ len += sizeof(struct bss_info_ext_bss);
+ features |= BIT(BSS_INFO_EXT_BSS);
+ ntlv++;
+ }
+ ntlv++;
+ }
+
buf = kzalloc(len, GFP_KERNEL);
if (!buf)
return -ENOMEM;
--
2.18.0

2019-06-12 08:53:18

by Lorenzo Bianconi

[permalink] [raw]
Subject: Re: [PATCH 2/2] mt76: mt7615: update peer's bssid when state transition changes

> Driver should update peer's bssid and bss information when
> state transition changes.
>
> Signed-off-by: Ryder Lee <[email protected]>
> ---
> .../net/wireless/mediatek/mt76/mt7615/main.c | 5 +-
> .../net/wireless/mediatek/mt76/mt7615/mcu.c | 49 ++++++++++---------
> 2 files changed, 27 insertions(+), 27 deletions(-)
>

[...]

> diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> index e82086eb8aa4..8fc12cd37906 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> @@ -741,17 +741,6 @@ int mt7615_mcu_set_bss_info(struct mt7615_dev *dev,
> u8 *buf, *data, tx_wlan_idx = 0;
> struct req_hdr *hdr;
>
> - if (en) {
> - len += sizeof(struct bss_info_omac);
> - features |= BIT(BSS_INFO_OMAC);
> - if (mvif->omac_idx > EXT_BSSID_START) {
> - len += sizeof(struct bss_info_ext_bss);
> - features |= BIT(BSS_INFO_EXT_BSS);
> - ntlv++;
> - }
> - ntlv++;
> - }
> -
> switch (vif->type) {
> case NL80211_IFTYPE_AP:
> case NL80211_IFTYPE_MESH_POINT:
> @@ -759,22 +748,23 @@ int mt7615_mcu_set_bss_info(struct mt7615_dev *dev,
> conn_type = CONNECTION_INFRA_AP;
> break;
> case NL80211_IFTYPE_STATION: {
> - struct ieee80211_sta *sta;
> - struct mt7615_sta *msta;
> -
> - rcu_read_lock();
> -
> - sta = ieee80211_find_sta(vif, vif->bss_conf.bssid);
> - if (!sta) {
> + /* TODO: enable BSS_INFO_UAPSD & BSS_INFO_PM */
> + if (en) {
> + struct ieee80211_sta *sta;
> + struct mt7615_sta *msta;
> +
> + rcu_read_lock();
> + sta = ieee80211_find_sta(vif, vif->bss_conf.bssid);
> + if (!sta) {
> + rcu_read_unlock();
> + return -EINVAL;
> + }
> +
> + msta = (struct mt7615_sta *)sta->drv_priv;
> + tx_wlan_idx = msta->wcid.idx;
> rcu_read_unlock();
> - return -EINVAL;
> }
> -
> - msta = (struct mt7615_sta *)sta->drv_priv;
> - tx_wlan_idx = msta->wcid.idx;
> conn_type = CONNECTION_INFRA_STA;
> -
> - rcu_read_unlock();
> break;
> }
> default:
> @@ -782,6 +772,17 @@ int mt7615_mcu_set_bss_info(struct mt7615_dev *dev,
> break;
> }
>
> + if (en) {
> + len += sizeof(struct bss_info_omac);
> + features |= BIT(BSS_INFO_OMAC);
> + if (mvif->omac_idx > EXT_BSSID_START) {
> + len += sizeof(struct bss_info_ext_bss);
> + features |= BIT(BSS_INFO_EXT_BSS);
> + ntlv++;
> + }
> + ntlv++;
> + }

What did you move this chunk down?

Regards,
Lorenzo

> +
> buf = kzalloc(len, GFP_KERNEL);
> if (!buf)
> return -ENOMEM;
> --
> 2.18.0
>


Attachments:
(No filename) (2.60 kB)
signature.asc (235.00 B)
Download all attachments

2019-06-12 08:57:16

by Ryder Lee

[permalink] [raw]
Subject: Re: [PATCH 2/2] mt76: mt7615: update peer's bssid when state transition changes

On Wed, 2019-06-12 at 10:26 +0200, Lorenzo Bianconi wrote:
> > Driver should update peer's bssid and bss information when
> > state transition changes.
> >
> > Signed-off-by: Ryder Lee <[email protected]>
> > ---
> > .../net/wireless/mediatek/mt76/mt7615/main.c | 5 +-
> > .../net/wireless/mediatek/mt76/mt7615/mcu.c | 49 ++++++++++---------
> > 2 files changed, 27 insertions(+), 27 deletions(-)
> >
>
> [...]
>
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> > index e82086eb8aa4..8fc12cd37906 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> > +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> > @@ -741,17 +741,6 @@ int mt7615_mcu_set_bss_info(struct mt7615_dev *dev,
> > u8 *buf, *data, tx_wlan_idx = 0;
> > struct req_hdr *hdr;
> >
> > - if (en) {
> > - len += sizeof(struct bss_info_omac);
> > - features |= BIT(BSS_INFO_OMAC);
> > - if (mvif->omac_idx > EXT_BSSID_START) {
> > - len += sizeof(struct bss_info_ext_bss);
> > - features |= BIT(BSS_INFO_EXT_BSS);
> > - ntlv++;
> > - }
> > - ntlv++;
> > - }
> > -
> > switch (vif->type) {
> > case NL80211_IFTYPE_AP:
> > case NL80211_IFTYPE_MESH_POINT:
> > @@ -759,22 +748,23 @@ int mt7615_mcu_set_bss_info(struct mt7615_dev *dev,
> > conn_type = CONNECTION_INFRA_AP;
> > break;
> > case NL80211_IFTYPE_STATION: {
> > - struct ieee80211_sta *sta;
> > - struct mt7615_sta *msta;
> > -
> > - rcu_read_lock();
> > -
> > - sta = ieee80211_find_sta(vif, vif->bss_conf.bssid);
> > - if (!sta) {
> > + /* TODO: enable BSS_INFO_UAPSD & BSS_INFO_PM */
> > + if (en) {
> > + struct ieee80211_sta *sta;
> > + struct mt7615_sta *msta;
> > +
> > + rcu_read_lock();
> > + sta = ieee80211_find_sta(vif, vif->bss_conf.bssid);
> > + if (!sta) {
> > + rcu_read_unlock();
> > + return -EINVAL;
> > + }
> > +
> > + msta = (struct mt7615_sta *)sta->drv_priv;
> > + tx_wlan_idx = msta->wcid.idx;
> > rcu_read_unlock();
> > - return -EINVAL;
> > }
> > -
> > - msta = (struct mt7615_sta *)sta->drv_priv;
> > - tx_wlan_idx = msta->wcid.idx;
> > conn_type = CONNECTION_INFRA_STA;
> > -
> > - rcu_read_unlock();
> > break;
> > }
> > default:
> > @@ -782,6 +772,17 @@ int mt7615_mcu_set_bss_info(struct mt7615_dev *dev,
> > break;
> > }
> >
> > + if (en) {
> > + len += sizeof(struct bss_info_omac);
> > + features |= BIT(BSS_INFO_OMAC);
> > + if (mvif->omac_idx > EXT_BSSID_START) {
> > + len += sizeof(struct bss_info_ext_bss);
> > + features |= BIT(BSS_INFO_EXT_BSS);
> > + ntlv++;
> > + }
> > + ntlv++;
> > + }
>
> What did you move this chunk down?

Ah, my bad. I originally planned to add other conditions and it may
change 'en' so moved these stuff behind them.

Anyway I forgot to remove this part. Will fix it

Ryder.

> Regards,
> Lorenzo
>
> > +
> > buf = kzalloc(len, GFP_KERNEL);
> > if (!buf)
> > return -ENOMEM;
> > --
> > 2.18.0
> >
> _______________________________________________
> Linux-mediatek mailing list
> [email protected]
> http://lists.infradead.org/mailman/listinfo/linux-mediatek