diff mbox series

[RFC,01/14] wifi: rtl8xxxu: Add start_ap() callback

Message ID 20230322171905.492855-2-martin.kaistra@linutronix.de (mailing list archive)
State RFC
Delegated to: Kalle Valo
Headers show
Series wifi: rtl8xxxu: Add AP mode support for 8188f | expand

Commit Message

Martin Kaistra March 22, 2023, 5:18 p.m. UTC
This gets called at the start of AP mode operation. Set bssid, beacon
interval and send a connect report to the HW.

Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
---
 .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Ping-Ke Shih March 27, 2023, 12:46 a.m. UTC | #1
> -----Original Message-----
> From: Martin Kaistra <martin.kaistra@linutronix.de>
> Sent: Thursday, March 23, 2023 1:19 AM
> 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: [RFC PATCH 01/14] wifi: rtl8xxxu: Add start_ap() callback
> 
> This gets called at the start of AP mode operation. Set bssid, beacon
> interval and send a connect report to the HW.
> 
> Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>

Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>

> ---
>  .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> index c152b228606f1..90b98b9dcbd9d 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> @@ -4899,6 +4899,20 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>         return;
>  }
> 
> +static int rtl8xxxu_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
> +                            struct ieee80211_bss_conf *link_conf)
> +{
> +       struct rtl8xxxu_priv *priv = hw->priv;
> +       struct device *dev = &priv->udev->dev;
> +
> +       dev_dbg(dev, "Start AP mode\n");
> +       rtl8xxxu_set_bssid(priv, vif->bss_conf.bssid);
> +       rtl8xxxu_write16(priv, REG_BCN_INTERVAL, vif->bss_conf.beacon_int);
> +       priv->fops->report_connect(priv, 0, true);
> +
> +       return 0;
> +}
> +
>  static u32 rtl8xxxu_80211_to_rtl_queue(u32 queue)
>  {
>         u32 rtlqueue;
> @@ -7026,6 +7040,7 @@ static const struct ieee80211_ops rtl8xxxu_ops = {
>         .config = rtl8xxxu_config,
>         .conf_tx = rtl8xxxu_conf_tx,
>         .bss_info_changed = rtl8xxxu_bss_info_changed,
> +       .start_ap = rtl8xxxu_start_ap,
>         .configure_filter = rtl8xxxu_configure_filter,
>         .set_rts_threshold = rtl8xxxu_set_rts_threshold,
>         .start = rtl8xxxu_start,
> --
> 2.30.2
Bitterblue Smith March 27, 2023, 1:10 p.m. UTC | #2
On 22/03/2023 19:18, Martin Kaistra wrote:
> This gets called at the start of AP mode operation. Set bssid, beacon
> interval and send a connect report to the HW.
> 

Hmm, but why send a connect report when you don't have anything
connected yet?

> Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
> ---
>  .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> index c152b228606f1..90b98b9dcbd9d 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> @@ -4899,6 +4899,20 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>  	return;
>  }
>  
> +static int rtl8xxxu_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
> +			     struct ieee80211_bss_conf *link_conf)
> +{
> +	struct rtl8xxxu_priv *priv = hw->priv;
> +	struct device *dev = &priv->udev->dev;
> +
> +	dev_dbg(dev, "Start AP mode\n");
> +	rtl8xxxu_set_bssid(priv, vif->bss_conf.bssid);
> +	rtl8xxxu_write16(priv, REG_BCN_INTERVAL, vif->bss_conf.beacon_int);
> +	priv->fops->report_connect(priv, 0, true);
> +
> +	return 0;
> +}
> +
>  static u32 rtl8xxxu_80211_to_rtl_queue(u32 queue)
>  {
>  	u32 rtlqueue;
> @@ -7026,6 +7040,7 @@ static const struct ieee80211_ops rtl8xxxu_ops = {
>  	.config = rtl8xxxu_config,
>  	.conf_tx = rtl8xxxu_conf_tx,
>  	.bss_info_changed = rtl8xxxu_bss_info_changed,
> +	.start_ap = rtl8xxxu_start_ap,
>  	.configure_filter = rtl8xxxu_configure_filter,
>  	.set_rts_threshold = rtl8xxxu_set_rts_threshold,
>  	.start = rtl8xxxu_start,
Martin Kaistra March 27, 2023, 4:08 p.m. UTC | #3
Am 27.03.23 um 15:10 schrieb Bitterblue Smith:
> On 22/03/2023 19:18, Martin Kaistra wrote:
>> This gets called at the start of AP mode operation. Set bssid, beacon
>> interval and send a connect report to the HW.
>>
> 
> Hmm, but why send a connect report when you don't have anything
> connected yet?

I tried following the vendor driver here, I don't know what exactly 
happens in the firmware.
I can test, though, if there is any difference, if I remove it.

> 
>> Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
>> ---
>>   .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 15 +++++++++++++++
>>   1 file changed, 15 insertions(+)
>>
>> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>> index c152b228606f1..90b98b9dcbd9d 100644
>> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>> @@ -4899,6 +4899,20 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>>   	return;
>>   }
>>   
>> +static int rtl8xxxu_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>> +			     struct ieee80211_bss_conf *link_conf)
>> +{
>> +	struct rtl8xxxu_priv *priv = hw->priv;
>> +	struct device *dev = &priv->udev->dev;
>> +
>> +	dev_dbg(dev, "Start AP mode\n");
>> +	rtl8xxxu_set_bssid(priv, vif->bss_conf.bssid);
>> +	rtl8xxxu_write16(priv, REG_BCN_INTERVAL, vif->bss_conf.beacon_int);
>> +	priv->fops->report_connect(priv, 0, true);
>> +
>> +	return 0;
>> +}
>> +
>>   static u32 rtl8xxxu_80211_to_rtl_queue(u32 queue)
>>   {
>>   	u32 rtlqueue;
>> @@ -7026,6 +7040,7 @@ static const struct ieee80211_ops rtl8xxxu_ops = {
>>   	.config = rtl8xxxu_config,
>>   	.conf_tx = rtl8xxxu_conf_tx,
>>   	.bss_info_changed = rtl8xxxu_bss_info_changed,
>> +	.start_ap = rtl8xxxu_start_ap,
>>   	.configure_filter = rtl8xxxu_configure_filter,
>>   	.set_rts_threshold = rtl8xxxu_set_rts_threshold,
>>   	.start = rtl8xxxu_start,
>
Bitterblue Smith March 27, 2023, 6:29 p.m. UTC | #4
On 27/03/2023 19:08, Martin Kaistra wrote:
> Am 27.03.23 um 15:10 schrieb Bitterblue Smith:
>> On 22/03/2023 19:18, Martin Kaistra wrote:
>>> This gets called at the start of AP mode operation. Set bssid, beacon
>>> interval and send a connect report to the HW.
>>>
>>
>> Hmm, but why send a connect report when you don't have anything
>> connected yet?
> 
> I tried following the vendor driver here, I don't know what exactly happens in the firmware.
> I can test, though, if there is any difference, if I remove it.
> 
Ah, okay. I was just wondering.

>>
>>> Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
>>> ---
>>>   .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 15 +++++++++++++++
>>>   1 file changed, 15 insertions(+)
>>>
>>> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>>> index c152b228606f1..90b98b9dcbd9d 100644
>>> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>>> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>>> @@ -4899,6 +4899,20 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>>>       return;
>>>   }
>>>   +static int rtl8xxxu_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>>> +                 struct ieee80211_bss_conf *link_conf)
>>> +{
>>> +    struct rtl8xxxu_priv *priv = hw->priv;
>>> +    struct device *dev = &priv->udev->dev;
>>> +
>>> +    dev_dbg(dev, "Start AP mode\n");
>>> +    rtl8xxxu_set_bssid(priv, vif->bss_conf.bssid);
>>> +    rtl8xxxu_write16(priv, REG_BCN_INTERVAL, vif->bss_conf.beacon_int);
>>> +    priv->fops->report_connect(priv, 0, true);
>>> +
>>> +    return 0;
>>> +}
>>> +
>>>   static u32 rtl8xxxu_80211_to_rtl_queue(u32 queue)
>>>   {
>>>       u32 rtlqueue;
>>> @@ -7026,6 +7040,7 @@ static const struct ieee80211_ops rtl8xxxu_ops = {
>>>       .config = rtl8xxxu_config,
>>>       .conf_tx = rtl8xxxu_conf_tx,
>>>       .bss_info_changed = rtl8xxxu_bss_info_changed,
>>> +    .start_ap = rtl8xxxu_start_ap,
>>>       .configure_filter = rtl8xxxu_configure_filter,
>>>       .set_rts_threshold = rtl8xxxu_set_rts_threshold,
>>>       .start = rtl8xxxu_start,
>>
Ping-Ke Shih March 29, 2023, 12:18 a.m. UTC | #5
> -----Original Message-----
> From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
> Sent: Tuesday, March 28, 2023 2:29 AM
> To: Martin Kaistra <martin.kaistra@linutronix.de>; linux-wireless@vger.kernel.org
> Cc: Jes Sorensen <Jes.Sorensen@gmail.com>; Kalle Valo <kvalo@kernel.org>; Ping-Ke Shih
> <pkshih@realtek.com>; Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Subject: Re: [RFC PATCH 01/14] wifi: rtl8xxxu: Add start_ap() callback
> 
> On 27/03/2023 19:08, Martin Kaistra wrote:
> > Am 27.03.23 um 15:10 schrieb Bitterblue Smith:
> >> On 22/03/2023 19:18, Martin Kaistra wrote:
> >>> This gets called at the start of AP mode operation. Set bssid, beacon
> >>> interval and send a connect report to the HW.
> >>>
> >>
> >> Hmm, but why send a connect report when you don't have anything
> >> connected yet?
> >
> > I tried following the vendor driver here, I don't know what exactly happens in the firmware.
> > I can test, though, if there is any difference, if I remove it.
> >
> Ah, okay. I was just wondering.

This is to tell firmware we are going to use the entry of mac_id = 0,
please allocate this entry and set it as valid.

> 
> >>
> >>> Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
> >>> ---
> >>>   .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 15 +++++++++++++++
> >>>   1 file changed, 15 insertions(+)
> >>>
> >>> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> >>> index c152b228606f1..90b98b9dcbd9d 100644
> >>> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> >>> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> >>> @@ -4899,6 +4899,20 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
> >>>       return;
> >>>   }
> >>>   +static int rtl8xxxu_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
> >>> +                 struct ieee80211_bss_conf *link_conf)
> >>> +{
> >>> +    struct rtl8xxxu_priv *priv = hw->priv;
> >>> +    struct device *dev = &priv->udev->dev;
> >>> +
> >>> +    dev_dbg(dev, "Start AP mode\n");
> >>> +    rtl8xxxu_set_bssid(priv, vif->bss_conf.bssid);
> >>> +    rtl8xxxu_write16(priv, REG_BCN_INTERVAL, vif->bss_conf.beacon_int);
> >>> +    priv->fops->report_connect(priv, 0, true);
> >>> +
> >>> +    return 0;
> >>> +}
> >>> +
> >>>   static u32 rtl8xxxu_80211_to_rtl_queue(u32 queue)
> >>>   {
> >>>       u32 rtlqueue;
> >>> @@ -7026,6 +7040,7 @@ static const struct ieee80211_ops rtl8xxxu_ops = {
> >>>       .config = rtl8xxxu_config,
> >>>       .conf_tx = rtl8xxxu_conf_tx,
> >>>       .bss_info_changed = rtl8xxxu_bss_info_changed,
> >>> +    .start_ap = rtl8xxxu_start_ap,
> >>>       .configure_filter = rtl8xxxu_configure_filter,
> >>>       .set_rts_threshold = rtl8xxxu_set_rts_threshold,
> >>>       .start = rtl8xxxu_start,
> >>
> 
> 
> ------Please consider the environment before printing this e-mail.
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index c152b228606f1..90b98b9dcbd9d 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -4899,6 +4899,20 @@  rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 	return;
 }
 
+static int rtl8xxxu_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+			     struct ieee80211_bss_conf *link_conf)
+{
+	struct rtl8xxxu_priv *priv = hw->priv;
+	struct device *dev = &priv->udev->dev;
+
+	dev_dbg(dev, "Start AP mode\n");
+	rtl8xxxu_set_bssid(priv, vif->bss_conf.bssid);
+	rtl8xxxu_write16(priv, REG_BCN_INTERVAL, vif->bss_conf.beacon_int);
+	priv->fops->report_connect(priv, 0, true);
+
+	return 0;
+}
+
 static u32 rtl8xxxu_80211_to_rtl_queue(u32 queue)
 {
 	u32 rtlqueue;
@@ -7026,6 +7040,7 @@  static const struct ieee80211_ops rtl8xxxu_ops = {
 	.config = rtl8xxxu_config,
 	.conf_tx = rtl8xxxu_conf_tx,
 	.bss_info_changed = rtl8xxxu_bss_info_changed,
+	.start_ap = rtl8xxxu_start_ap,
 	.configure_filter = rtl8xxxu_configure_filter,
 	.set_rts_threshold = rtl8xxxu_set_rts_threshold,
 	.start = rtl8xxxu_start,