linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] brcmfmac: Support multiple station interface series
@ 2022-09-29  5:06 Ian Lin
  2022-09-29  5:06 ` [PATCH 1/4] brcmfmac: add creating station interface support Ian Lin
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Ian Lin @ 2022-09-29  5:06 UTC (permalink / raw)
  To: linux-wireless
  Cc: brcm80211-dev-list, brcm80211-dev-list, franky.lin,
	hante.meuleman, kvalo, Double.Lo, ian.lin

Support create multiple station interface.
And fix related issues.

Prasanna Kerekoppa (1):
  brcmfmac: Fix AP interface delete issue

Ting-Ying Li (1):
  brcmfmac: revise SoftAP channel setting

Wright Feng (2):
  brcmfmac: add creating station interface support
  brcmfmac: support station interface creation version 1, 2 and 3

 .../broadcom/brcm80211/brcmfmac/cfg80211.c    | 306 ++++++++++++++++--
 .../broadcom/brcm80211/brcmfmac/core.h        |   1 +
 2 files changed, 272 insertions(+), 35 deletions(-)

-- 
2.25.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/4] brcmfmac: add creating station interface support
  2022-09-29  5:06 [PATCH 0/4] brcmfmac: Support multiple station interface series Ian Lin
@ 2022-09-29  5:06 ` Ian Lin
  2022-10-05  7:42   ` Kalle Valo
  2022-09-29  5:06 ` [PATCH 2/4] brcmfmac: support station interface creation version 1, 2 and 3 Ian Lin
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Ian Lin @ 2022-09-29  5:06 UTC (permalink / raw)
  To: linux-wireless
  Cc: brcm80211-dev-list, brcm80211-dev-list, franky.lin,
	hante.meuleman, kvalo, Double.Lo, ian.lin

From: Wright Feng <wright.feng@cypress.com>

With RSDB device, it is able to control two station interfaces
concurrently. So we add creating station interface support and
allow user to create it via cfg80211.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Chi-hsien Lin <chi-hsien.lin@infineon.com>
Signed-off-by: Ian Lin <ian.lin@infineon.com>
---
 .../broadcom/brcm80211/brcmfmac/cfg80211.c    | 81 ++++++++++++++++---
 .../broadcom/brcm80211/brcmfmac/core.h        |  1 +
 2 files changed, 70 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index dfcfb3333369..e352bc6e015c 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -234,6 +234,19 @@ struct parsed_vndr_ies {
 	struct parsed_vndr_ie_info ie_info[VNDR_IE_PARSE_LIMIT];
 };
 
+#define WL_INTERFACE_MAC_DONT_USE	0x0
+#define WL_INTERFACE_MAC_USE		0x2
+
+#define WL_INTERFACE_CREATE_STA		0x0
+#define WL_INTERFACE_CREATE_AP		0x1
+
+struct wl_interface_create {
+	u16	ver;
+	u32	flags;
+	u8	mac_addr[ETH_ALEN];
+	u8	pad[13];
+};
+
 static u8 nl80211_band_to_fwil(enum nl80211_band band)
 {
 	switch (band) {
@@ -521,6 +534,42 @@ static int brcmf_get_first_free_bsscfgidx(struct brcmf_pub *drvr)
 	return -ENOMEM;
 }
 
+static void brcmf_set_sta_iface_macaddr(struct brcmf_if *ifp,
+					struct wl_interface_create *iface)
+{
+	u8 mac_idx = ifp->drvr->sta_mac_idx;
+
+	/* set difference MAC address with locally administered bit */
+	iface->flags |= WL_INTERFACE_MAC_USE;
+	memcpy(iface->mac_addr, ifp->mac_addr, ETH_ALEN);
+	iface->mac_addr[0] |= 0x02;
+	iface->mac_addr[3] ^= mac_idx ? 0xC0 : 0xA0;
+	mac_idx++;
+	mac_idx = mac_idx % 2;
+	ifp->drvr->sta_mac_idx = mac_idx;
+}
+
+static int brcmf_cfg80211_request_sta_if(struct brcmf_if *ifp, u8 *macaddr)
+{
+	struct wl_interface_create iface;
+	int err;
+
+	memset(&iface, 0, sizeof(iface));
+
+	iface.ver = 0;
+	iface.flags = WL_INTERFACE_CREATE_STA;
+	if (!is_zero_ether_addr(macaddr)) {
+		/* set MAC address in cfg80211 params */
+		memcpy(iface.mac_addr, macaddr, ETH_ALEN);
+	} else {
+		brcmf_set_sta_iface_macaddr(ifp, &iface);
+	}
+
+	err = brcmf_fil_iovar_data_get(ifp, "interface_create", &iface,
+				       sizeof(iface));
+	return err;
+}
+
 static int brcmf_cfg80211_request_ap_if(struct brcmf_if *ifp)
 {
 	struct brcmf_pub *drvr = ifp->drvr;
@@ -546,15 +595,17 @@ static int brcmf_cfg80211_request_ap_if(struct brcmf_if *ifp)
 }
 
 /**
- * brcmf_ap_add_vif() - create a new AP virtual interface for multiple BSS
+ * brcmf_apsta_add_vif() - create a new AP or STA virtual interface
  *
  * @wiphy: wiphy device of new interface.
  * @name: name of the new interface.
- * @params: contains mac address for AP device.
+ * @params: contains mac address for AP or STA device.
+ * @type: interface type.
  */
 static
-struct wireless_dev *brcmf_ap_add_vif(struct wiphy *wiphy, const char *name,
-				      struct vif_params *params)
+struct wireless_dev *brcmf_apsta_add_vif(struct wiphy *wiphy, const char *name,
+					 struct vif_params *params,
+					 enum nl80211_iftype type)
 {
 	struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
 	struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));
@@ -562,18 +613,24 @@ struct wireless_dev *brcmf_ap_add_vif(struct wiphy *wiphy, const char *name,
 	struct brcmf_cfg80211_vif *vif;
 	int err;
 
+	if (type != NL80211_IFTYPE_STATION && type != NL80211_IFTYPE_AP)
+		return ERR_PTR(-EINVAL);
+
 	if (brcmf_cfg80211_vif_event_armed(cfg))
 		return ERR_PTR(-EBUSY);
 
 	brcmf_dbg(INFO, "Adding vif \"%s\"\n", name);
 
-	vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_AP);
+	vif = brcmf_alloc_vif(cfg, type);
 	if (IS_ERR(vif))
 		return (struct wireless_dev *)vif;
 
 	brcmf_cfg80211_arm_vif_event(cfg, vif);
 
-	err = brcmf_cfg80211_request_ap_if(ifp);
+	if (type == NL80211_IFTYPE_STATION)
+		err = brcmf_cfg80211_request_sta_if(ifp, params->macaddr);
+	else
+		err = brcmf_cfg80211_request_ap_if(ifp);
 	if (err) {
 		brcmf_cfg80211_arm_vif_event(cfg, NULL);
 		goto fail;
@@ -720,15 +777,15 @@ static struct wireless_dev *brcmf_cfg80211_add_iface(struct wiphy *wiphy,
 	}
 	switch (type) {
 	case NL80211_IFTYPE_ADHOC:
-	case NL80211_IFTYPE_STATION:
 	case NL80211_IFTYPE_AP_VLAN:
 	case NL80211_IFTYPE_WDS:
 	case NL80211_IFTYPE_MESH_POINT:
 		return ERR_PTR(-EOPNOTSUPP);
 	case NL80211_IFTYPE_MONITOR:
 		return brcmf_mon_add_vif(wiphy, name);
+	case NL80211_IFTYPE_STATION:
 	case NL80211_IFTYPE_AP:
-		wdev = brcmf_ap_add_vif(wiphy, name, params);
+		wdev = brcmf_apsta_add_vif(wiphy, name, params, type);
 		break;
 	case NL80211_IFTYPE_P2P_CLIENT:
 	case NL80211_IFTYPE_P2P_GO:
@@ -848,8 +905,8 @@ s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
 	return err;
 }
 
-static int brcmf_cfg80211_del_ap_iface(struct wiphy *wiphy,
-				       struct wireless_dev *wdev)
+static int brcmf_cfg80211_del_apsta_iface(struct wiphy *wiphy,
+					  struct wireless_dev *wdev)
 {
 	struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
 	struct net_device *ndev = wdev->netdev;
@@ -906,15 +963,15 @@ int brcmf_cfg80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev)
 
 	switch (wdev->iftype) {
 	case NL80211_IFTYPE_ADHOC:
-	case NL80211_IFTYPE_STATION:
 	case NL80211_IFTYPE_AP_VLAN:
 	case NL80211_IFTYPE_WDS:
 	case NL80211_IFTYPE_MESH_POINT:
 		return -EOPNOTSUPP;
 	case NL80211_IFTYPE_MONITOR:
 		return brcmf_mon_del_vif(wiphy, wdev);
+	case NL80211_IFTYPE_STATION:
 	case NL80211_IFTYPE_AP:
-		return brcmf_cfg80211_del_ap_iface(wiphy, wdev);
+		return brcmf_cfg80211_del_apsta_iface(wiphy, wdev);
 	case NL80211_IFTYPE_P2P_CLIENT:
 	case NL80211_IFTYPE_P2P_GO:
 	case NL80211_IFTYPE_P2P_DEVICE:
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
index 340346c122d3..2e71b5c2a975 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
@@ -136,6 +136,7 @@ struct brcmf_pub {
 	struct work_struct bus_reset;
 
 	u8 clmver[BRCMF_DCMD_SMLEN];
+	u8 sta_mac_idx;
 };
 
 /* forward declarations */
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/4] brcmfmac: support station interface creation version 1, 2 and 3
  2022-09-29  5:06 [PATCH 0/4] brcmfmac: Support multiple station interface series Ian Lin
  2022-09-29  5:06 ` [PATCH 1/4] brcmfmac: add creating station interface support Ian Lin
@ 2022-09-29  5:06 ` Ian Lin
  2022-09-29  5:06 ` [PATCH 3/4] brcmfmac: Fix AP interface delete issue Ian Lin
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Ian Lin @ 2022-09-29  5:06 UTC (permalink / raw)
  To: linux-wireless
  Cc: brcm80211-dev-list, brcm80211-dev-list, franky.lin,
	hante.meuleman, kvalo, Double.Lo, ian.lin

From: Wright Feng <wright.feng@cypress.com>

To create virtual station interface for RSDB and VSDB, we add interface
creation version 1, 2 and 3 supports
The structures of each version are different and only version 3 and
later version are able to get interface creating version from firmware
side.

The patch has been verified two concurrent stations pings test with
 interface create version 1:
          89342(4359b1)-PCIE: 9.40.100
 interface create version 2:
         4373a0-sdio: 13.10.271
 interface create version 3:
         4373a0-sdio: 13.35.48

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Chi-hsien Lin <chi-hsien.lin@infineon.com>
Signed-off-by: Ian Lin <ian.lin@infineon.com>
---
 .../broadcom/brcm80211/brcmfmac/cfg80211.c    | 148 +++++++++++++++---
 1 file changed, 124 insertions(+), 24 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index e352bc6e015c..2082e255f031 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -234,17 +234,46 @@ struct parsed_vndr_ies {
 	struct parsed_vndr_ie_info ie_info[VNDR_IE_PARSE_LIMIT];
 };
 
+#define WL_INTERFACE_CREATE_VER_1		1
+#define WL_INTERFACE_CREATE_VER_2		2
+#define WL_INTERFACE_CREATE_VER_3		3
+#define WL_INTERFACE_CREATE_VER_MAX		WL_INTERFACE_CREATE_VER_3
+
 #define WL_INTERFACE_MAC_DONT_USE	0x0
 #define WL_INTERFACE_MAC_USE		0x2
 
 #define WL_INTERFACE_CREATE_STA		0x0
 #define WL_INTERFACE_CREATE_AP		0x1
 
-struct wl_interface_create {
-	u16	ver;
-	u32	flags;
-	u8	mac_addr[ETH_ALEN];
-	u8	pad[13];
+struct wl_interface_create_v1 {
+	u16	ver;			/* structure version */
+	u32	flags;			/* flags for operation */
+	u8	mac_addr[ETH_ALEN];	/* MAC address */
+	u32	wlc_index;		/* optional for wlc index */
+};
+
+struct wl_interface_create_v2 {
+	u16	ver;			/* structure version */
+	u8	pad1[2];
+	u32	flags;			/* flags for operation */
+	u8	mac_addr[ETH_ALEN];	/* MAC address */
+	u8	iftype;			/* type of interface created */
+	u8	pad2;
+	u32	wlc_index;		/* optional for wlc index */
+};
+
+struct wl_interface_create_v3 {
+	u16 ver;			/* structure version */
+	u16 len;			/* length of structure + data */
+	u16 fixed_len;			/* length of structure */
+	u8 iftype;			/* type of interface created */
+	u8 wlc_index;			/* optional for wlc index */
+	u32 flags;			/* flags for operation */
+	u8 mac_addr[ETH_ALEN];		/* MAC address */
+	u8 bssid[ETH_ALEN];		/* optional for BSSID */
+	u8 if_index;			/* interface index request */
+	u8 pad[3];
+	u8 data[];			/* Optional for specific data */
 };
 
 static u8 nl80211_band_to_fwil(enum nl80211_band band)
@@ -534,16 +563,14 @@ static int brcmf_get_first_free_bsscfgidx(struct brcmf_pub *drvr)
 	return -ENOMEM;
 }
 
-static void brcmf_set_sta_iface_macaddr(struct brcmf_if *ifp,
-					struct wl_interface_create *iface)
+static void brcmf_set_vif_sta_macaddr(struct brcmf_if *ifp, u8 *mac_addr)
 {
 	u8 mac_idx = ifp->drvr->sta_mac_idx;
 
 	/* set difference MAC address with locally administered bit */
-	iface->flags |= WL_INTERFACE_MAC_USE;
-	memcpy(iface->mac_addr, ifp->mac_addr, ETH_ALEN);
-	iface->mac_addr[0] |= 0x02;
-	iface->mac_addr[3] ^= mac_idx ? 0xC0 : 0xA0;
+	memcpy(mac_addr, ifp->mac_addr, ETH_ALEN);
+	mac_addr[0] |= 0x02;
+	mac_addr[3] ^= mac_idx ? 0xC0 : 0xA0;
 	mac_idx++;
 	mac_idx = mac_idx % 2;
 	ifp->drvr->sta_mac_idx = mac_idx;
@@ -551,23 +578,96 @@ static void brcmf_set_sta_iface_macaddr(struct brcmf_if *ifp,
 
 static int brcmf_cfg80211_request_sta_if(struct brcmf_if *ifp, u8 *macaddr)
 {
-	struct wl_interface_create iface;
+	struct wl_interface_create_v1 iface_v1;
+	struct wl_interface_create_v2 iface_v2;
+	struct wl_interface_create_v3 iface_v3;
+	u32 iface_create_ver;
 	int err;
 
-	memset(&iface, 0, sizeof(iface));
+	/* interface_create version 1 */
+	memset(&iface_v1, 0, sizeof(iface_v1));
+	iface_v1.ver = WL_INTERFACE_CREATE_VER_1;
+	iface_v1.flags = WL_INTERFACE_CREATE_STA |
+			 WL_INTERFACE_MAC_USE;
+	if (!is_zero_ether_addr(macaddr))
+		memcpy(iface_v1.mac_addr, macaddr, ETH_ALEN);
+	else
+		brcmf_set_vif_sta_macaddr(ifp, iface_v1.mac_addr);
 
-	iface.ver = 0;
-	iface.flags = WL_INTERFACE_CREATE_STA;
-	if (!is_zero_ether_addr(macaddr)) {
-		/* set MAC address in cfg80211 params */
-		memcpy(iface.mac_addr, macaddr, ETH_ALEN);
+	err = brcmf_fil_iovar_data_get(ifp, "interface_create",
+				       &iface_v1,
+				       sizeof(iface_v1));
+	if (err) {
+		brcmf_info("failed to create interface(v1), err=%d\n",
+			   err);
 	} else {
-		brcmf_set_sta_iface_macaddr(ifp, &iface);
+		brcmf_dbg(INFO, "interface created(v1)\n");
+		return 0;
 	}
 
-	err = brcmf_fil_iovar_data_get(ifp, "interface_create", &iface,
-				       sizeof(iface));
-	return err;
+	/* interface_create version 2 */
+	memset(&iface_v2, 0, sizeof(iface_v2));
+	iface_v2.ver = WL_INTERFACE_CREATE_VER_2;
+	iface_v2.flags = WL_INTERFACE_MAC_USE;
+	iface_v2.iftype = WL_INTERFACE_CREATE_STA;
+	if (!is_zero_ether_addr(macaddr))
+		memcpy(iface_v2.mac_addr, macaddr, ETH_ALEN);
+	else
+		brcmf_set_vif_sta_macaddr(ifp, iface_v2.mac_addr);
+
+	err = brcmf_fil_iovar_data_get(ifp, "interface_create",
+				       &iface_v2,
+				       sizeof(iface_v2));
+	if (err) {
+		brcmf_info("failed to create interface(v2), err=%d\n",
+			   err);
+	} else {
+		brcmf_dbg(INFO, "interface created(v2)\n");
+		return 0;
+	}
+
+	/* interface_create version 3+ */
+	/* get supported version from firmware side */
+	iface_create_ver = 0;
+	err = brcmf_fil_bsscfg_int_get(ifp, "interface_create",
+				       &iface_create_ver);
+	if (err) {
+		brcmf_err("fail to get supported version, err=%d\n", err);
+		return -EOPNOTSUPP;
+	}
+
+	switch (iface_create_ver) {
+	case WL_INTERFACE_CREATE_VER_3:
+		memset(&iface_v3, 0, sizeof(iface_v3));
+		iface_v3.ver = WL_INTERFACE_CREATE_VER_3;
+		iface_v3.flags = WL_INTERFACE_MAC_USE;
+		iface_v3.iftype = WL_INTERFACE_CREATE_STA;
+		if (!is_zero_ether_addr(macaddr))
+			memcpy(iface_v3.mac_addr, macaddr, ETH_ALEN);
+		else
+			brcmf_set_vif_sta_macaddr(ifp, iface_v3.mac_addr);
+
+		err = brcmf_fil_iovar_data_get(ifp, "interface_create",
+					       &iface_v3,
+					       sizeof(iface_v3));
+
+		if (!err)
+			brcmf_dbg(INFO, "interface created(v3)\n");
+		break;
+	default:
+		brcmf_err("not support interface create(v%d)\n",
+			  iface_create_ver);
+		err = -EOPNOTSUPP;
+		break;
+	}
+
+	if (err) {
+		brcmf_info("station interface creation failed (%d)\n",
+			   err);
+		return -EIO;
+	}
+
+	return 0;
 }
 
 static int brcmf_cfg80211_request_ap_if(struct brcmf_if *ifp)
@@ -7030,7 +7130,7 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] = {
  *
  * p2p, mchan, and mbss:
  *
- *	#STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 2, 3 total
+ *	#STA <= 2, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 2, 3 total
  *	#STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
  *	#AP <= 4, matching BI, channels = 1, 4 total
  *
@@ -7076,7 +7176,7 @@ static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
 		goto err;
 
 	combo[c].num_different_channels = 1 + (rsdb || (p2p && mchan));
-	c0_limits[i].max = 1;
+	c0_limits[i].max = 1 + (p2p && mchan);
 	c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
 	if (mon_flag) {
 		c0_limits[i].max = 1;
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/4] brcmfmac: Fix AP interface delete issue
  2022-09-29  5:06 [PATCH 0/4] brcmfmac: Support multiple station interface series Ian Lin
  2022-09-29  5:06 ` [PATCH 1/4] brcmfmac: add creating station interface support Ian Lin
  2022-09-29  5:06 ` [PATCH 2/4] brcmfmac: support station interface creation version 1, 2 and 3 Ian Lin
@ 2022-09-29  5:06 ` Ian Lin
  2022-09-29  5:06 ` [PATCH 4/4] brcmfmac: revise SoftAP channel setting Ian Lin
  2022-10-10 10:10 ` [PATCH 0/4] brcmfmac: Support multiple station interface series Arend Van Spriel
  4 siblings, 0 replies; 11+ messages in thread
From: Ian Lin @ 2022-09-29  5:06 UTC (permalink / raw)
  To: linux-wireless
  Cc: brcm80211-dev-list, brcm80211-dev-list, franky.lin,
	hante.meuleman, kvalo, Double.Lo, ian.lin

From: Prasanna Kerekoppa <prasanna.kerekoppa@infineon.com>

Fixes the ap interface delete issue. Fix is to make sure interface
is created with supported version.
Patch has been verified by creating and deleting AP interface.

Signed-off-by: Prasanna Kerekoppa <prasanna.kerekoppa@infineon.com>
Signed-off-by: Ian Lin <ian.lin@infineon.com>
---
 .../broadcom/brcm80211/brcmfmac/cfg80211.c    | 101 ++++++++++++++++--
 1 file changed, 90 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 2082e255f031..d0aee6c1aa0d 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -672,24 +672,103 @@ static int brcmf_cfg80211_request_sta_if(struct brcmf_if *ifp, u8 *macaddr)
 
 static int brcmf_cfg80211_request_ap_if(struct brcmf_if *ifp)
 {
+	struct wl_interface_create_v1 iface_v1;
+	struct wl_interface_create_v2 iface_v2;
+	struct wl_interface_create_v3 iface_v3;
+	u32 iface_create_ver;
 	struct brcmf_pub *drvr = ifp->drvr;
 	struct brcmf_mbss_ssid_le mbss_ssid_le;
 	int bsscfgidx;
 	int err;
 
-	memset(&mbss_ssid_le, 0, sizeof(mbss_ssid_le));
-	bsscfgidx = brcmf_get_first_free_bsscfgidx(ifp->drvr);
-	if (bsscfgidx < 0)
-		return bsscfgidx;
+	/* interface_create version 1 */
+	memset(&iface_v1, 0, sizeof(iface_v1));
+	iface_v1.ver = WL_INTERFACE_CREATE_VER_1;
+	iface_v1.flags = WL_INTERFACE_CREATE_AP |
+			 WL_INTERFACE_MAC_USE;
 
-	mbss_ssid_le.bsscfgidx = cpu_to_le32(bsscfgidx);
-	mbss_ssid_le.SSID_len = cpu_to_le32(5);
-	sprintf(mbss_ssid_le.SSID, "ssid%d" , bsscfgidx);
+	brcmf_set_vif_sta_macaddr(ifp, iface_v1.mac_addr);
 
-	err = brcmf_fil_bsscfg_data_set(ifp, "bsscfg:ssid", &mbss_ssid_le,
-					sizeof(mbss_ssid_le));
-	if (err < 0)
-		bphy_err(drvr, "setting ssid failed %d\n", err);
+	err = brcmf_fil_iovar_data_get(ifp, "interface_create",
+				       &iface_v1,
+				       sizeof(iface_v1));
+	if (err) {
+		brcmf_info("failed to create interface(v1), err=%d\n",
+			   err);
+	} else {
+		brcmf_dbg(INFO, "interface created(v1)\n");
+		return 0;
+	}
+
+	/* interface_create version 2 */
+	memset(&iface_v2, 0, sizeof(iface_v2));
+	iface_v2.ver = WL_INTERFACE_CREATE_VER_2;
+	iface_v2.flags = WL_INTERFACE_MAC_USE;
+	iface_v2.iftype = WL_INTERFACE_CREATE_AP;
+
+	brcmf_set_vif_sta_macaddr(ifp, iface_v2.mac_addr);
+
+	err = brcmf_fil_iovar_data_get(ifp, "interface_create",
+				       &iface_v2,
+				       sizeof(iface_v2));
+	if (err) {
+		brcmf_info("failed to create interface(v2), err=%d\n",
+			   err);
+	} else {
+		brcmf_dbg(INFO, "interface created(v2)\n");
+		return 0;
+	}
+
+	/* interface_create version 3+ */
+	/* get supported version from firmware side */
+	iface_create_ver = 0;
+	err = brcmf_fil_bsscfg_int_get(ifp, "interface_create",
+				       &iface_create_ver);
+	if (err) {
+		brcmf_err("fail to get supported version, err=%d\n", err);
+		return -EOPNOTSUPP;
+	}
+
+	switch (iface_create_ver) {
+	case WL_INTERFACE_CREATE_VER_3:
+		memset(&iface_v3, 0, sizeof(iface_v3));
+		iface_v3.ver = WL_INTERFACE_CREATE_VER_3;
+		iface_v3.flags = WL_INTERFACE_MAC_USE;
+		iface_v3.iftype = WL_INTERFACE_CREATE_AP;
+		brcmf_set_vif_sta_macaddr(ifp, iface_v3.mac_addr);
+
+		err = brcmf_fil_iovar_data_get(ifp, "interface_create",
+					       &iface_v3,
+					       sizeof(iface_v3));
+
+		if (!err)
+			brcmf_dbg(INFO, "interface created(v3)\n");
+		break;
+	default:
+		brcmf_err("not support interface create(v%d)\n",
+			  iface_create_ver);
+		err = -EOPNOTSUPP;
+		break;
+	}
+
+	if (err) {
+		brcmf_info("Does not support interface_create (%d)\n",
+			   err);
+		memset(&mbss_ssid_le, 0, sizeof(mbss_ssid_le));
+		bsscfgidx = brcmf_get_first_free_bsscfgidx(ifp->drvr);
+		if (bsscfgidx < 0)
+			return bsscfgidx;
+
+		mbss_ssid_le.bsscfgidx = cpu_to_le32(bsscfgidx);
+		mbss_ssid_le.SSID_len = cpu_to_le32(5);
+		sprintf(mbss_ssid_le.SSID, "ssid%d", bsscfgidx);
+
+		err = brcmf_fil_bsscfg_data_set(ifp, "bsscfg:ssid", &mbss_ssid_le,
+						sizeof(mbss_ssid_le));
+
+		if (err < 0)
+			bphy_err(drvr, "setting ssid failed %d\n", err);
+	}
 
 	return err;
 }
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/4] brcmfmac: revise SoftAP channel setting
  2022-09-29  5:06 [PATCH 0/4] brcmfmac: Support multiple station interface series Ian Lin
                   ` (2 preceding siblings ...)
  2022-09-29  5:06 ` [PATCH 3/4] brcmfmac: Fix AP interface delete issue Ian Lin
@ 2022-09-29  5:06 ` Ian Lin
  2022-10-05  7:35   ` Kalle Valo
  2022-10-10 10:10 ` [PATCH 0/4] brcmfmac: Support multiple station interface series Arend Van Spriel
  4 siblings, 1 reply; 11+ messages in thread
From: Ian Lin @ 2022-09-29  5:06 UTC (permalink / raw)
  To: linux-wireless
  Cc: brcm80211-dev-list, brcm80211-dev-list, franky.lin,
	hante.meuleman, kvalo, Double.Lo, ian.lin

From: Ting-Ying Li <tingying.li@cypress.com>

We need to update "chanspec" iovar for each SoftAP creation
because firmware will update the chanspec to current bsscfg
for each bss. If we do not update it then the wrong chanspec
will be shown on the result of 'wl -i [interface] status'
command. No need to handle channel resource reusing for mbss
mode by the host driver, it should be covered by firmware.

Signed-off-by: Ting-Ying Li <tingying.li@cypress.com>
Signed-off-by: Ian Lin <ian.lin@infineon.com>
---
 .../broadcom/brcm80211/brcmfmac/cfg80211.c    | 20 +++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index d0aee6c1aa0d..67cb1f568e7e 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -5061,17 +5061,17 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
 				 err);
 			goto exit;
 		}
-		if (!mbss) {
-			/* Firmware 10.x requires setting channel after enabling
-			 * AP and before bringing interface up.
-			 */
-			err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
-			if (err < 0) {
-				bphy_err(drvr, "Set Channel failed: chspec=%d, %d\n",
-					 chanspec, err);
-				goto exit;
-			}
+
+		/* Firmware 10.x requires setting channel after enabling
+		 * AP and before bringing interface up.
+		 */
+		err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
+		if (err < 0) {
+			bphy_err(drvr, "Set Channel failed: chspec=%d, %d\n",
+				 chanspec, err);
+			goto exit;
 		}
+
 		err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
 		if (err < 0) {
 			bphy_err(drvr, "BRCMF_C_UP error (%d)\n", err);
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/4] brcmfmac: revise SoftAP channel setting
  2022-09-29  5:06 ` [PATCH 4/4] brcmfmac: revise SoftAP channel setting Ian Lin
@ 2022-10-05  7:35   ` Kalle Valo
  2022-10-05 10:41     ` Arend Van Spriel
  0 siblings, 1 reply; 11+ messages in thread
From: Kalle Valo @ 2022-10-05  7:35 UTC (permalink / raw)
  To: Ian Lin
  Cc: linux-wireless, brcm80211-dev-list, brcm80211-dev-list,
	franky.lin, hante.meuleman, Double.Lo, ian.lin

Ian Lin <ian.lin@infineon.com> wrote:

> From: Ting-Ying Li <tingying.li@cypress.com>
> 
> We need to update "chanspec" iovar for each SoftAP creation
> because firmware will update the chanspec to current bsscfg
> for each bss. If we do not update it then the wrong chanspec
> will be shown on the result of 'wl -i [interface] status'
> command. No need to handle channel resource reusing for mbss
> mode by the host driver, it should be covered by firmware.
> 
> Signed-off-by: Ting-Ying Li <tingying.li@cypress.com>
> Signed-off-by: Ian Lin <ian.lin@infineon.com>

The term "SoftAP" is a bit confusing. From an upstream driver point of view
it's just AP mode, right?

What's wl? Is that some proprietary tool or what?

Patch set to Changes Requested.

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20220929050614.31518-5-ian.lin@infineon.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/4] brcmfmac: add creating station interface support
  2022-09-29  5:06 ` [PATCH 1/4] brcmfmac: add creating station interface support Ian Lin
@ 2022-10-05  7:42   ` Kalle Valo
  2022-10-05  7:45     ` Kalle Valo
  0 siblings, 1 reply; 11+ messages in thread
From: Kalle Valo @ 2022-10-05  7:42 UTC (permalink / raw)
  To: Ian Lin
  Cc: linux-wireless, brcm80211-dev-list, brcm80211-dev-list,
	franky.lin, hante.meuleman, Double.Lo, ian.lin

Ian Lin <ian.lin@infineon.com> wrote:

> From: Wright Feng <wright.feng@cypress.com>
> 
> With RSDB device, it is able to control two station interfaces
> concurrently. So we add creating station interface support and
> allow user to create it via cfg80211.
> 
> Signed-off-by: Wright Feng <wright.feng@cypress.com>
> Signed-off-by: Chi-hsien Lin <chi-hsien.lin@infineon.com>
> Signed-off-by: Ian Lin <ian.lin@infineon.com>

3 patches applied to wireless-next.git, thanks.

2b5fb30f8ff5 brcmfmac: add creating station interface support
4388827b87d8 brcmfmac: support station interface creation version 1, 2 and 3
1562bdef9251 brcmfmac: Fix AP interface delete issue

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20220929050614.31518-2-ian.lin@infineon.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/4] brcmfmac: add creating station interface support
  2022-10-05  7:42   ` Kalle Valo
@ 2022-10-05  7:45     ` Kalle Valo
  2022-10-05  7:47       ` Kalle Valo
  0 siblings, 1 reply; 11+ messages in thread
From: Kalle Valo @ 2022-10-05  7:45 UTC (permalink / raw)
  To: Ian Lin
  Cc: linux-wireless, brcm80211-dev-list, brcm80211-dev-list,
	franky.lin, hante.meuleman, Double.Lo

Kalle Valo <kvalo@kernel.org> writes:

> Ian Lin <ian.lin@infineon.com> wrote:
>
>> From: Wright Feng <wright.feng@cypress.com>
>> 
>> With RSDB device, it is able to control two station interfaces
>> concurrently. So we add creating station interface support and
>> allow user to create it via cfg80211.
>> 
>> Signed-off-by: Wright Feng <wright.feng@cypress.com>
>> Signed-off-by: Chi-hsien Lin <chi-hsien.lin@infineon.com>
>> Signed-off-by: Ian Lin <ian.lin@infineon.com>
>
> 3 patches applied to wireless-next.git, thanks.
>
> 2b5fb30f8ff5 brcmfmac: add creating station interface support
> 4388827b87d8 brcmfmac: support station interface creation version 1, 2 and 3
> 1562bdef9251 brcmfmac: Fix AP interface delete issue

I didn't notice that "wifi:" prefix was missing, please always add that
in future patches. More info in the wiki below.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/4] brcmfmac: add creating station interface support
  2022-10-05  7:45     ` Kalle Valo
@ 2022-10-05  7:47       ` Kalle Valo
  0 siblings, 0 replies; 11+ messages in thread
From: Kalle Valo @ 2022-10-05  7:47 UTC (permalink / raw)
  To: Ian Lin
  Cc: linux-wireless, brcm80211-dev-list, franky.lin, hante.meuleman,
	Double.Lo

Kalle Valo <kvalo@kernel.org> writes:

> Kalle Valo <kvalo@kernel.org> writes:
>
>> Ian Lin <ian.lin@infineon.com> wrote:
>>
>>> From: Wright Feng <wright.feng@cypress.com>
>>> 
>>> With RSDB device, it is able to control two station interfaces
>>> concurrently. So we add creating station interface support and
>>> allow user to create it via cfg80211.
>>> 
>>> Signed-off-by: Wright Feng <wright.feng@cypress.com>
>>> Signed-off-by: Chi-hsien Lin <chi-hsien.lin@infineon.com>
>>> Signed-off-by: Ian Lin <ian.lin@infineon.com>
>>
>> 3 patches applied to wireless-next.git, thanks.
>>
>> 2b5fb30f8ff5 brcmfmac: add creating station interface support
>> 4388827b87d8 brcmfmac: support station interface creation version 1, 2 and 3
>> 1562bdef9251 brcmfmac: Fix AP interface delete issue
>
> I didn't notice that "wifi:" prefix was missing, please always add that
> in future patches. More info in the wiki below.

And please stop CCing brcm80211-dev-list@cypress.com, the bounce
messages are really annoying.

<brcm80211-dev-list@cypress.com>: host smtp2.infineon.com[217.10.52.18] said:
    550 #5.1.0 Address rejected. (in reply to RCPT TO command)
    
-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/4] brcmfmac: revise SoftAP channel setting
  2022-10-05  7:35   ` Kalle Valo
@ 2022-10-05 10:41     ` Arend Van Spriel
  0 siblings, 0 replies; 11+ messages in thread
From: Arend Van Spriel @ 2022-10-05 10:41 UTC (permalink / raw)
  To: Kalle Valo, Ian Lin
  Cc: linux-wireless, brcm80211-dev-list, brcm80211-dev-list,
	franky.lin, hante.meuleman, Double.Lo

On 10/5/2022 9:35 AM, Kalle Valo wrote:
> Ian Lin <ian.lin@infineon.com> wrote:
> 
>> From: Ting-Ying Li <tingying.li@cypress.com>
>>
>> We need to update "chanspec" iovar for each SoftAP creation
>> because firmware will update the chanspec to current bsscfg
>> for each bss. If we do not update it then the wrong chanspec
>> will be shown on the result of 'wl -i [interface] status'
>> command. No need to handle channel resource reusing for mbss
>> mode by the host driver, it should be covered by firmware.
>>
>> Signed-off-by: Ting-Ying Li <tingying.li@cypress.com>
>> Signed-off-by: Ian Lin <ian.lin@infineon.com>
> 
> The term "SoftAP" is a bit confusing. From an upstream driver point of view
> it's just AP mode, right?

It is. If I have understood things the term is used for using AP 
interface on a non-router platform. To me it always has been a vague term.

> What's wl? Is that some proprietary tool or what?

Yup. Please avoid such references. Same for the term "current bsscfg".

I think I will need to take a closer look at this patch.

Thanks,
Arend

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/4] brcmfmac: Support multiple station interface series
  2022-09-29  5:06 [PATCH 0/4] brcmfmac: Support multiple station interface series Ian Lin
                   ` (3 preceding siblings ...)
  2022-09-29  5:06 ` [PATCH 4/4] brcmfmac: revise SoftAP channel setting Ian Lin
@ 2022-10-10 10:10 ` Arend Van Spriel
  4 siblings, 0 replies; 11+ messages in thread
From: Arend Van Spriel @ 2022-10-10 10:10 UTC (permalink / raw)
  To: Ian Lin, linux-wireless
  Cc: brcm80211-dev-list, brcm80211-dev-list, franky.lin,
	hante.meuleman, kvalo, Double.Lo

On 9/29/2022 7:06 AM, Ian Lin wrote:
> Support create multiple station interface.
> And fix related issues.

These patches surely break things for older chips. Also the firmware API 
definitions should not be place in cfg80211.c but in fwil_types.h.

Regards,
Arend

> Prasanna Kerekoppa (1):
>    brcmfmac: Fix AP interface delete issue
> 
> Ting-Ying Li (1):
>    brcmfmac: revise SoftAP channel setting
> 
> Wright Feng (2):
>    brcmfmac: add creating station interface support
>    brcmfmac: support station interface creation version 1, 2 and 3
> 
>   .../broadcom/brcm80211/brcmfmac/cfg80211.c    | 306 ++++++++++++++++--
>   .../broadcom/brcm80211/brcmfmac/core.h        |   1 +
>   2 files changed, 272 insertions(+), 35 deletions(-)
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-10-10 10:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-29  5:06 [PATCH 0/4] brcmfmac: Support multiple station interface series Ian Lin
2022-09-29  5:06 ` [PATCH 1/4] brcmfmac: add creating station interface support Ian Lin
2022-10-05  7:42   ` Kalle Valo
2022-10-05  7:45     ` Kalle Valo
2022-10-05  7:47       ` Kalle Valo
2022-09-29  5:06 ` [PATCH 2/4] brcmfmac: support station interface creation version 1, 2 and 3 Ian Lin
2022-09-29  5:06 ` [PATCH 3/4] brcmfmac: Fix AP interface delete issue Ian Lin
2022-09-29  5:06 ` [PATCH 4/4] brcmfmac: revise SoftAP channel setting Ian Lin
2022-10-05  7:35   ` Kalle Valo
2022-10-05 10:41     ` Arend Van Spriel
2022-10-10 10:10 ` [PATCH 0/4] brcmfmac: Support multiple station interface series Arend Van Spriel

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).