Message ID | 20231218143645.433356-17-martin.kaistra@linutronix.de (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Kalle Valo |
Headers | show |
Series | wifi: rtl8xxxu: Add concurrent mode for 8188f | expand |
> -----Original Message----- > From: Martin Kaistra <martin.kaistra@linutronix.de> > Sent: Monday, December 18, 2023 10:37 PM > To: linux-wireless@vger.kernel.org > Cc: Jes Sorensen <Jes.Sorensen@gmail.com>; Kalle Valo <kvalo@kernel.org>; Ping-Ke Shih > <pkshih@realtek.com>; Bitterblue Smith <rtl8821cerfe2@gmail.com>; Sebastian Andrzej Siewior > <bigeasy@linutronix.de> > Subject: [PATCH 16/20] wifi: rtl8xxxu: support multiple interfaces in get_macid() > > As sta_info->macid does not get set in station mode, we can simplify > this function by directly returning 0 if sta itself or sta_info is not > set. > > Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de> > --- > drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c > b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c > index 3851fc90339e0..ad76cddef81b2 100644 > --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c > +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c > @@ -4053,10 +4053,13 @@ static inline u8 rtl8xxxu_get_macid(struct rtl8xxxu_priv *priv, > { > struct rtl8xxxu_sta_info *sta_info; > > - if (!priv->vif || priv->vif->type == NL80211_IFTYPE_STATION || !sta) > + if (!sta) > return 0; > > sta_info = (struct rtl8xxxu_sta_info *)sta->drv_priv; > + if (!sta_info) > + return 0; > + > return sta_info->macid; I checked where driver assign macid, and only if (vif->type == NL80211_IFTYPE_AP) { sta_info->macid = rtl8xxxu_acquire_macid(priv); That means STA mode can be macid == 0 always, right? This will be a problem. At least TX rate will be incorrect. Ping-Ke
Am 20.12.23 um 07:14 schrieb Ping-Ke Shih: > > >> -----Original Message----- >> From: Martin Kaistra <martin.kaistra@linutronix.de> >> Sent: Monday, December 18, 2023 10:37 PM >> To: linux-wireless@vger.kernel.org >> Cc: Jes Sorensen <Jes.Sorensen@gmail.com>; Kalle Valo <kvalo@kernel.org>; Ping-Ke Shih >> <pkshih@realtek.com>; Bitterblue Smith <rtl8821cerfe2@gmail.com>; Sebastian Andrzej Siewior >> <bigeasy@linutronix.de> >> Subject: [PATCH 16/20] wifi: rtl8xxxu: support multiple interfaces in get_macid() >> >> As sta_info->macid does not get set in station mode, we can simplify >> this function by directly returning 0 if sta itself or sta_info is not >> set. >> >> Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de> >> --- >> drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 5 ++++- >> 1 file changed, 4 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c >> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c >> index 3851fc90339e0..ad76cddef81b2 100644 >> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c >> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c >> @@ -4053,10 +4053,13 @@ static inline u8 rtl8xxxu_get_macid(struct rtl8xxxu_priv *priv, >> { >> struct rtl8xxxu_sta_info *sta_info; >> >> - if (!priv->vif || priv->vif->type == NL80211_IFTYPE_STATION || !sta) >> + if (!sta) >> return 0; >> >> sta_info = (struct rtl8xxxu_sta_info *)sta->drv_priv; >> + if (!sta_info) >> + return 0; >> + >> return sta_info->macid; > > I checked where driver assign macid, and only > > if (vif->type == NL80211_IFTYPE_AP) { > sta_info->macid = rtl8xxxu_acquire_macid(priv); > > That means STA mode can be macid == 0 always, right? > This will be a problem. At least TX rate will be incorrect. Yes, currently macid for STA mode is always 0. Would it be enough to set macid in STA mode to either 0 or 1 depending on port_num? > > Ping-Ke >
On Wed, 2023-12-20 at 17:40 +0100, Martin Kaistra wrote: > > Am 20.12.23 um 07:14 schrieb Ping-Ke Shih: > > > > > > I checked where driver assign macid, and only > > > > if (vif->type == NL80211_IFTYPE_AP) { > > sta_info->macid = rtl8xxxu_acquire_macid(priv); > > > > That means STA mode can be macid == 0 always, right? > > This will be a problem. At least TX rate will be incorrect. > > Yes, currently macid for STA mode is always 0. Would it be enough to set macid > in STA mode to either 0 or 1 depending on port_num? > I am not very sure if macid 0 plays a special role, but others (macid >= 1) can be dynamically assigned to each stations. I think we can reserve macid 0 and 1 for port 0 and 1 respectively, and dynamically assign macid 2 or larger to TDLS or AP mode peer, like macid port num STA mode AP mode ------ ---------- ------------- --------------------------- 0 0 to/from AP broadcast 1 1 to/from AP X 2~ 0 or 1 to/from TDLS to/from connected station
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 3851fc90339e0..ad76cddef81b2 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -4053,10 +4053,13 @@ static inline u8 rtl8xxxu_get_macid(struct rtl8xxxu_priv *priv, { struct rtl8xxxu_sta_info *sta_info; - if (!priv->vif || priv->vif->type == NL80211_IFTYPE_STATION || !sta) + if (!sta) return 0; sta_info = (struct rtl8xxxu_sta_info *)sta->drv_priv; + if (!sta_info) + return 0; + return sta_info->macid; }
As sta_info->macid does not get set in station mode, we can simplify this function by directly returning 0 if sta itself or sta_info is not set. Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de> --- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)