Martin Rodriguez Reboredo <yakoyoku@xxxxxxxxx> 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@xxxxxxxxx> > --- > 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); [...]