linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
To: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Felix Fietkau <nbd@nbd.name>, linux-wireless@vger.kernel.org
Subject: Re: [PATCH 1/7] mt76x02: use mask for vifs
Date: Fri, 25 Jan 2019 11:25:46 +0100	[thread overview]
Message-ID: <20190125102545.GA27731@p1372.fit.wifi.vutbr.cz> (raw)
In-Reply-To: <20190125094757.GA11700@redhat.com>

> On Fri, Jan 25, 2019 at 10:02:38AM +0100, Lorenzo Bianconi wrote:
> > > On Thu, Jan 24, 2019 at 11:20:42PM +0100, Lorenzo Bianconi wrote:
> > > > > > > 
> > > > > > > I guess this does not work if you add 2 vifs and then you remove the first one
> > > > > > > (you will end up with a wrong configuration in MT_MAC_ADDR_DW{0,1}). I guess
> > > > > > > the hw will not work well if MT_MAC_ADDR_DW{0,1} is not properly configured
> > > > > 
> > > > > Maybe I am missing something, but let's assume you add the interface vif0 with address
> > > > > 00:11:22:33:44:55 (MT_MAC_ADDR_DW{0,1} will be set to 00:11:22:33:44:55) and
> > > > > then you add vif1 with address 00:aa:bb:cc:dd:ee. If at some point you remove
> > > > > vif0 MT_MAC_ADDR_DW{0,1} will not be properly reconfigured. The problem will
> > > > > be more complex if you have more interfaces
> > > 
> > > Ok, so in remove_interface extra code can be added to implement that.
> 
> Something like this should address the issue you raised:
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
> index 3880caa0c64a..44b4af928a4e 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
> @@ -320,6 +320,15 @@ void mt76x02_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
>  }
>  EXPORT_SYMBOL_GPL(mt76x02_add_interface);
>  
> +static void mt76x02_setaddr_iterator(void *data, u8 *mac,
> +                                     struct ieee80211_vif *vif)
> +{
> +	struct mt76x02_dev *dev = data;
> +
> +	if (!ether_addr_equal(dev->mt76.macaddr, vif->addr))
> +                mt76x02_mac_setaddr(dev, vif->addr);

This will end-up with multiple configurations if we have more than two
interfaces, right?

> +}
> +
>  void mt76x02_remove_interface(struct ieee80211_hw *hw,
>  			      struct ieee80211_vif *vif)
>  {
> @@ -328,6 +337,10 @@ void mt76x02_remove_interface(struct ieee80211_hw *hw,
>  
>  	mt76_txq_remove(&dev->mt76, vif->txq);
>  	dev->vif_mask &= ~BIT(mvif->idx);
> +
> +	if (hweight16(dev->vif_mask) == 1)
> +		ieee80211_iterate_interfaces(hw, 0, mt76x02_setaddr_iterator,
> +					     dev);

I guess we have the same issue if we have more than two interfaces and we
remove the first one that has been configured.
Moreover I am a little worried about tpt regressions with this patch.
Are you sure that if you use complete different mac addresses on a multivif scenario
you can get the same tpt on all the interfaces? Could you please provide some
tpt results?
Vendor driver relies on a strict scheme for mac addresses in multi-bss. If tpt is
nice I am ok with this patch

Regards,
Lorenzo

>  }
>  EXPORT_SYMBOL_GPL(mt76x02_remove_interface);

  reply	other threads:[~2019-01-25 10:25 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-24 15:44 [PATCH 0/7] mt76x02: Beacon support for USB Stanislaw Gruszka
2019-01-24 15:44 ` [PATCH 1/7] mt76x02: use mask for vifs Stanislaw Gruszka
2019-01-24 16:12   ` Lorenzo Bianconi
2019-01-24 16:20     ` Stanislaw Gruszka
2019-01-24 16:35       ` Lorenzo Bianconi
2019-01-24 22:20         ` Lorenzo Bianconi
2019-01-25  8:25           ` Stanislaw Gruszka
2019-01-25  9:02             ` Lorenzo Bianconi
2019-01-25  9:06               ` Stanislaw Gruszka
2019-01-25  9:47               ` Stanislaw Gruszka
2019-01-25 10:25                 ` Lorenzo Bianconi [this message]
2019-01-25 12:41                   ` Stanislaw Gruszka
2019-01-28  8:41                     ` Felix Fietkau
2019-01-28  9:02                       ` Stanislaw Gruszka
2019-01-28 11:16                         ` Stanislaw Gruszka
2019-01-28 12:29                           ` Felix Fietkau
2019-01-28 13:04                             ` Stanislaw Gruszka
2019-01-24 15:44 ` [PATCH 2/7] mt76x02: use commmon add interface for mt76x2u Stanislaw Gruszka
2019-01-24 15:44 ` [PATCH 3/7] mt76x02: initialize mutli bss mode when set up address Stanislaw Gruszka
2019-01-24 15:44 ` [PATCH 4/7] mt76x02: minor beaconing init changes Stanislaw Gruszka
2019-01-24 22:32   ` Lorenzo Bianconi
2019-01-24 15:44 ` [PATCH 5/7] mt76x02: init beacon config for mt76x2u Stanislaw Gruszka
2019-01-24 22:33   ` Lorenzo Bianconi
2019-01-24 15:44 ` [PATCH 6/7] mt76: beaconing fixes for USB Stanislaw Gruszka
2019-01-24 22:50   ` Lorenzo Bianconi
2019-01-28  8:30     ` Stanislaw Gruszka
2019-01-24 15:44 ` [PATCH 7/7] mt76x02: enable support for IBSS, AP and MESH Stanislaw Gruszka

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=20190125102545.GA27731@p1372.fit.wifi.vutbr.cz \
    --to=lorenzo.bianconi@redhat.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@nbd.name \
    --cc=sgruszka@redhat.com \
    /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 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).