public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: Martin Rodriguez Reboredo <yakoyoku@gmail.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: Jes Sorensen <Jes.Sorensen@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [RFC PATCH] wifi: rtl8xxxu: toggle P2P for supported devices
Date: Thu, 24 Apr 2025 02:50:03 +0000	[thread overview]
Message-ID: <ea405158f1c7453dba2b3e2c7c3a0e03@realtek.com> (raw)
In-Reply-To: <20250423201826.1054254-1-yakoyoku@gmail.com>

Martin Rodriguez Reboredo <yakoyoku@gmail.com> wrote:
> This is an RFC to see if rtl8xxxu can be made to support P2P.
> 
> Theoretically this should be handled by mac80211 but it seems that
> drivers may have to take some extra steps depending on which device we
> are talking about. I know that this patch is so basic that it might be
> missing some H2C commands or similar for this to work on Realtek chips
> but I don't have the required knowledge for me to implement it, so if
> you know a place to read about I'll be glad to hear.
> 
> As of now only rtl8192ex devices will have their P2P_CLIENT, P2P_GO
> and P2P_DEVICE wiphy interface modes set because those are the only
> ones I can test on my rtl8192eu card.
> 
> Signed-off-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
> ---
>  drivers/net/wireless/realtek/rtl8xxxu/8192e.c |  3 ++
>  drivers/net/wireless/realtek/rtl8xxxu/core.c  | 34 ++++++++++++++++++-
>  .../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h  |  3 ++
>  3 files changed, 39 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/8192e.c
> b/drivers/net/wireless/realtek/rtl8xxxu/8192e.c
> index 8e123bbfc665..3e78c5b73726 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/8192e.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/8192e.c
> @@ -1752,6 +1752,9 @@ struct rtl8xxxu_fileops rtl8192eu_fops = {
>         .gen2_thermal_meter = 1,
>         .needs_full_init = 1,
>         .supports_ap = 1,
> +       .supports_p2p_client = 1,
> +       .supports_p2p_go = 1,
> +       .supports_p2p_device = 1,

I think no any device supports either GO or GC only. Combine three to one
supports_p2p. 

To prevent messed up the order for every chip_fops. Please define 
'supports_p2p = 0' for the chips that don't support p2p yet. 

>         .max_macid_num = 128,
>         .max_sec_cam_num = 64,
>         .adda_1t_init = 0x0fc01616,
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c
> b/drivers/net/wireless/realtek/rtl8xxxu/core.c
> index 569856ca677f..a86c4a9083b2 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
> @@ -1600,9 +1600,11 @@ static void rtl8xxxu_set_linktype(struct rtl8xxxu_priv *priv,
>         case NL80211_IFTYPE_ADHOC:
>                 type = MSR_LINKTYPE_ADHOC;
>                 break;
> +       case NL80211_IFTYPE_P2P_CLIENT:
>         case NL80211_IFTYPE_STATION:
>                 type = MSR_LINKTYPE_STATION;
>                 break;
> +       case NL80211_IFTYPE_P2P_GO:
>         case NL80211_IFTYPE_AP:
>                 type = MSR_LINKTYPE_AP;
>                 break;
> @@ -6780,6 +6782,8 @@ static int rtl8xxxu_add_interface(struct ieee80211_hw *hw,
>                 return -EOPNOTSUPP;
> 
>         switch (vif->type) {
> +       case NL80211_IFTYPE_P2P_CLIENT:
> +               fallthrough;

Just like rtl8xxxu_set_linktype(). No need fallthrough.

The fallthrough is needed, only if you do something in the case, but
still want to fall through to next case.

>         case NL80211_IFTYPE_STATION:
>                 if (port_num == 0) {
>                         rtl8xxxu_stop_tx_beacon(priv);
> @@ -6790,6 +6794,8 @@ static int rtl8xxxu_add_interface(struct ieee80211_hw *hw,
>                         rtl8xxxu_write8(priv, REG_BEACON_CTRL, val8);
>                 }
>                 break;
> +       case NL80211_IFTYPE_P2P_GO:
> +               fallthrough;

ditto.

>         case NL80211_IFTYPE_AP:
>                 if (port_num == 1) {
>                         rtl8xxxu_switch_ports(priv);

[...]


      reply	other threads:[~2025-04-24  2:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-23 20:18 [RFC PATCH] wifi: rtl8xxxu: toggle P2P for supported devices Martin Rodriguez Reboredo
2025-04-24  2:50 ` Ping-Ke Shih [this message]

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=ea405158f1c7453dba2b3e2c7c3a0e03@realtek.com \
    --to=pkshih@realtek.com \
    --cc=Jes.Sorensen@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=yakoyoku@gmail.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