diff mbox series

wifi: mt76: mt7921: enable p2p support

Message ID 50e02e7d0c0bfe083596ad5b71bfa6297a8b4110.1672687461.git.objelf@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Felix Fietkau
Headers show
Series wifi: mt76: mt7921: enable p2p support | expand

Commit Message

Sean Wang Jan. 2, 2023, 7:29 p.m. UTC
From: Sean Wang <sean.wang@mediatek.com>

Introduce p2p-go/p2p-client support to mt7921 driver

CONNECTION_P2P_GC/GO is not supported with the current firmware
so we added mt76_dev to mt76_connac_mcu_sta_basic_tlv signature to
use CONNECTION_INFRA_STA/AP instead for p2p-client and p2p-go
respectively to make it work.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/mt7615/mcu.c      |  3 ++-
 drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c |  8 ++++----
 drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h |  2 +-
 drivers/net/wireless/mediatek/mt76/mt7915/mcu.c      |  4 ++--
 drivers/net/wireless/mediatek/mt76/mt7921/init.c     | 10 +++++++---
 5 files changed, 16 insertions(+), 11 deletions(-)

Comments

kernel test robot Jan. 3, 2023, 1:18 a.m. UTC | #1
Hi,

I love your patch! Yet something to improve:

[auto build test ERROR on wireless-next/main]
[also build test ERROR on wireless/main linus/master v6.2-rc2 next-20221226]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/sean-wang-mediatek-com/wifi-mt76-mt7921-enable-p2p-support/20230103-033002
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
patch link:    https://lore.kernel.org/r/50e02e7d0c0bfe083596ad5b71bfa6297a8b4110.1672687461.git.objelf%40gmail.com
patch subject: [PATCH] wifi: mt76: mt7921: enable p2p support
config: arc-allyesconfig
compiler: arceb-elf-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/67f0fc2d663c8d3910978b31ae0d61e5d8e4e5ec
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review sean-wang-mediatek-com/wifi-mt76-mt7921-enable-p2p-support/20230103-033002
        git checkout 67f0fc2d663c8d3910978b31ae0d61e5d8e4e5ec
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arc olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/net/wireless/mediatek/mt76/mt7996/mcu.c: In function 'mt7996_mcu_add_sta':
>> drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:1597:39: error: passing argument 1 of 'mt76_connac_mcu_sta_basic_tlv' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1597 |         mt76_connac_mcu_sta_basic_tlv(skb, vif, sta, enable,
         |                                       ^~~
         |                                       |
         |                                       struct sk_buff *
   In file included from drivers/net/wireless/mediatek/mt76/mt7996/mcu.h:9,
                    from drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:9:
   drivers/net/wireless/mediatek/mt76/mt7996/../mt76_connac_mcu.h:1774:53: note: expected 'struct mt76_dev *' but argument is of type 'struct sk_buff *'
    1774 | void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
         |                                    ~~~~~~~~~~~~~~~~~^~~
   drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:1597:44: error: passing argument 2 of 'mt76_connac_mcu_sta_basic_tlv' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1597 |         mt76_connac_mcu_sta_basic_tlv(skb, vif, sta, enable,
         |                                            ^~~
         |                                            |
         |                                            struct ieee80211_vif *
   drivers/net/wireless/mediatek/mt76/mt7996/../mt76_connac_mcu.h:1774:74: note: expected 'struct sk_buff *' but argument is of type 'struct ieee80211_vif *'
    1774 | void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
         |                                                          ~~~~~~~~~~~~~~~~^~~
   drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:1597:49: error: passing argument 3 of 'mt76_connac_mcu_sta_basic_tlv' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1597 |         mt76_connac_mcu_sta_basic_tlv(skb, vif, sta, enable,
         |                                                 ^~~
         |                                                 |
         |                                                 struct ieee80211_sta *
   drivers/net/wireless/mediatek/mt76/mt7996/../mt76_connac_mcu.h:1775:58: note: expected 'struct ieee80211_vif *' but argument is of type 'struct ieee80211_sta *'
    1775 |                                    struct ieee80211_vif *vif,
         |                                    ~~~~~~~~~~~~~~~~~~~~~~^~~
>> drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:1597:54: error: incompatible type for argument 4 of 'mt76_connac_mcu_sta_basic_tlv'
    1597 |         mt76_connac_mcu_sta_basic_tlv(skb, vif, sta, enable,
         |                                                      ^~~~~~
         |                                                      |
         |                                                      bool {aka _Bool}
   drivers/net/wireless/mediatek/mt76/mt7996/../mt76_connac_mcu.h:1776:58: note: expected 'struct ieee80211_sta *' but argument is of type 'bool' {aka '_Bool'}
    1776 |                                    struct ieee80211_sta *sta, bool enable,
         |                                    ~~~~~~~~~~~~~~~~~~~~~~^~~
>> drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:1597:9: error: too few arguments to function 'mt76_connac_mcu_sta_basic_tlv'
    1597 |         mt76_connac_mcu_sta_basic_tlv(skb, vif, sta, enable,
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/wireless/mediatek/mt76/mt7996/../mt76_connac_mcu.h:1774:6: note: declared here
    1774 | void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +/mt76_connac_mcu_sta_basic_tlv +1597 drivers/net/wireless/mediatek/mt76/mt7996/mcu.c

98686cd21624c7 Shayne Chen 2022-11-22  1579  
98686cd21624c7 Shayne Chen 2022-11-22  1580  int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
98686cd21624c7 Shayne Chen 2022-11-22  1581  		       struct ieee80211_sta *sta, bool enable)
98686cd21624c7 Shayne Chen 2022-11-22  1582  {
98686cd21624c7 Shayne Chen 2022-11-22  1583  	struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
98686cd21624c7 Shayne Chen 2022-11-22  1584  	struct mt7996_sta *msta;
98686cd21624c7 Shayne Chen 2022-11-22  1585  	struct sk_buff *skb;
98686cd21624c7 Shayne Chen 2022-11-22  1586  	int ret;
98686cd21624c7 Shayne Chen 2022-11-22  1587  
98686cd21624c7 Shayne Chen 2022-11-22  1588  	msta = sta ? (struct mt7996_sta *)sta->drv_priv : &mvif->sta;
98686cd21624c7 Shayne Chen 2022-11-22  1589  
98686cd21624c7 Shayne Chen 2022-11-22  1590  	skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->mt76,
98686cd21624c7 Shayne Chen 2022-11-22  1591  					      &msta->wcid,
98686cd21624c7 Shayne Chen 2022-11-22  1592  					      MT7996_STA_UPDATE_MAX_SIZE);
98686cd21624c7 Shayne Chen 2022-11-22  1593  	if (IS_ERR(skb))
98686cd21624c7 Shayne Chen 2022-11-22  1594  		return PTR_ERR(skb);
98686cd21624c7 Shayne Chen 2022-11-22  1595  
98686cd21624c7 Shayne Chen 2022-11-22  1596  	/* starec basic */
98686cd21624c7 Shayne Chen 2022-11-22 @1597  	mt76_connac_mcu_sta_basic_tlv(skb, vif, sta, enable,
98686cd21624c7 Shayne Chen 2022-11-22  1598  			!rcu_access_pointer(dev->mt76.wcid[msta->wcid.idx]));
98686cd21624c7 Shayne Chen 2022-11-22  1599  	if (!enable)
98686cd21624c7 Shayne Chen 2022-11-22  1600  		goto out;
98686cd21624c7 Shayne Chen 2022-11-22  1601  
98686cd21624c7 Shayne Chen 2022-11-22  1602  	/* tag order is in accordance with firmware dependency. */
98686cd21624c7 Shayne Chen 2022-11-22  1603  	if (sta) {
98686cd21624c7 Shayne Chen 2022-11-22  1604  		/* starec phy */
98686cd21624c7 Shayne Chen 2022-11-22  1605  		mt7996_mcu_sta_phy_tlv(dev, skb, vif, sta);
98686cd21624c7 Shayne Chen 2022-11-22  1606  		/* starec hdrt mode */
98686cd21624c7 Shayne Chen 2022-11-22  1607  		mt7996_mcu_sta_hdrt_tlv(dev, skb);
98686cd21624c7 Shayne Chen 2022-11-22  1608  		/* starec bfer */
98686cd21624c7 Shayne Chen 2022-11-22  1609  		mt7996_mcu_sta_bfer_tlv(dev, skb, vif, sta);
98686cd21624c7 Shayne Chen 2022-11-22  1610  		/* starec ht */
98686cd21624c7 Shayne Chen 2022-11-22  1611  		mt7996_mcu_sta_ht_tlv(skb, sta);
98686cd21624c7 Shayne Chen 2022-11-22  1612  		/* starec vht */
98686cd21624c7 Shayne Chen 2022-11-22  1613  		mt7996_mcu_sta_vht_tlv(skb, sta);
98686cd21624c7 Shayne Chen 2022-11-22  1614  		/* starec uapsd */
98686cd21624c7 Shayne Chen 2022-11-22  1615  		mt76_connac_mcu_sta_uapsd(skb, vif, sta);
98686cd21624c7 Shayne Chen 2022-11-22  1616  		/* starec amsdu */
98686cd21624c7 Shayne Chen 2022-11-22  1617  		mt7996_mcu_sta_amsdu_tlv(dev, skb, vif, sta);
98686cd21624c7 Shayne Chen 2022-11-22  1618  		/* starec he */
98686cd21624c7 Shayne Chen 2022-11-22  1619  		mt7996_mcu_sta_he_tlv(skb, sta);
98686cd21624c7 Shayne Chen 2022-11-22  1620  		/* starec he 6g*/
98686cd21624c7 Shayne Chen 2022-11-22  1621  		mt7996_mcu_sta_he_6g_tlv(skb, sta);
98686cd21624c7 Shayne Chen 2022-11-22  1622  		/* TODO: starec muru */
98686cd21624c7 Shayne Chen 2022-11-22  1623  		/* starec bfee */
98686cd21624c7 Shayne Chen 2022-11-22  1624  		mt7996_mcu_sta_bfee_tlv(dev, skb, vif, sta);
98686cd21624c7 Shayne Chen 2022-11-22  1625  		/* starec hdr trans */
98686cd21624c7 Shayne Chen 2022-11-22  1626  		mt7996_mcu_sta_hdr_trans_tlv(dev, skb, vif, sta);
98686cd21624c7 Shayne Chen 2022-11-22  1627  	}
98686cd21624c7 Shayne Chen 2022-11-22  1628  
98686cd21624c7 Shayne Chen 2022-11-22  1629  	ret = mt7996_mcu_add_group(dev, vif, sta);
98686cd21624c7 Shayne Chen 2022-11-22  1630  	if (ret) {
98686cd21624c7 Shayne Chen 2022-11-22  1631  		dev_kfree_skb(skb);
98686cd21624c7 Shayne Chen 2022-11-22  1632  		return ret;
98686cd21624c7 Shayne Chen 2022-11-22  1633  	}
98686cd21624c7 Shayne Chen 2022-11-22  1634  out:
98686cd21624c7 Shayne Chen 2022-11-22  1635  	return mt76_mcu_skb_send_msg(&dev->mt76, skb,
98686cd21624c7 Shayne Chen 2022-11-22  1636  				     MCU_WMWA_UNI_CMD(STA_REC_UPDATE), true);
98686cd21624c7 Shayne Chen 2022-11-22  1637  }
98686cd21624c7 Shayne Chen 2022-11-22  1638
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
index 83f30305414d..98a60df11702 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
@@ -861,7 +861,8 @@  mt7615_mcu_wtbl_sta_add(struct mt7615_phy *phy, struct ieee80211_vif *vif,
 		else
 			mvif->sta_added = true;
 	}
-	mt76_connac_mcu_sta_basic_tlv(sskb, vif, sta, enable, new_entry);
+	mt76_connac_mcu_sta_basic_tlv(&dev->mt76, sskb, vif, sta, enable,
+				      new_entry);
 	if (enable && sta)
 		mt76_connac_mcu_sta_tlv(phy->mt76, sskb, sta, vif, 0,
 					MT76_STA_INFO_STATE_ASSOC);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
index 5a047e630860..d28ff322a6db 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
@@ -363,7 +363,7 @@  void mt76_connac_mcu_bss_omac_tlv(struct sk_buff *skb,
 }
 EXPORT_SYMBOL_GPL(mt76_connac_mcu_bss_omac_tlv);
 
-void mt76_connac_mcu_sta_basic_tlv(struct sk_buff *skb,
+void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
 				   struct ieee80211_vif *vif,
 				   struct ieee80211_sta *sta,
 				   bool enable, bool newly)
@@ -394,7 +394,7 @@  void mt76_connac_mcu_sta_basic_tlv(struct sk_buff *skb,
 	switch (vif->type) {
 	case NL80211_IFTYPE_MESH_POINT:
 	case NL80211_IFTYPE_AP:
-		if (vif->p2p)
+		if (vif->p2p && !is_mt7921(dev))
 			conn_type = CONNECTION_P2P_GC;
 		else
 			conn_type = CONNECTION_INFRA_STA;
@@ -402,7 +402,7 @@  void mt76_connac_mcu_sta_basic_tlv(struct sk_buff *skb,
 		basic->aid = cpu_to_le16(sta->aid);
 		break;
 	case NL80211_IFTYPE_STATION:
-		if (vif->p2p)
+		if (vif->p2p && !is_mt7921(dev))
 			conn_type = CONNECTION_P2P_GO;
 		else
 			conn_type = CONNECTION_INFRA_AP;
@@ -1029,7 +1029,7 @@  int mt76_connac_mcu_sta_cmd(struct mt76_phy *phy,
 		return PTR_ERR(skb);
 
 	if (info->sta || !info->offload_fw)
-		mt76_connac_mcu_sta_basic_tlv(skb, info->vif, info->sta,
+		mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif, info->sta,
 					      info->enable, info->newly);
 	if (info->sta && info->enable)
 		mt76_connac_mcu_sta_tlv(phy, skb, info->sta,
diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
index f1e942b9a887..8bf8a1a8f5e5 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
@@ -1771,7 +1771,7 @@  mt76_connac_mcu_add_tlv(struct sk_buff *skb, int tag, int len)
 
 int mt76_connac_mcu_set_channel_domain(struct mt76_phy *phy);
 int mt76_connac_mcu_set_vif_ps(struct mt76_dev *dev, struct ieee80211_vif *vif);
-void mt76_connac_mcu_sta_basic_tlv(struct sk_buff *skb,
+void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
 				   struct ieee80211_vif *vif,
 				   struct ieee80211_sta *sta, bool enable,
 				   bool newly);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
index 37a3c1f082d9..051ffb38342c 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
@@ -1657,8 +1657,8 @@  int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif,
 		return PTR_ERR(skb);
 
 	/* starec basic */
-	mt76_connac_mcu_sta_basic_tlv(skb, vif, sta, enable,
-			!rcu_access_pointer(dev->mt76.wcid[msta->wcid.idx]));
+	mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, vif, sta, enable,
+				      !rcu_access_pointer(dev->mt76.wcid[msta->wcid.idx]));
 	if (!enable)
 		goto out;
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
index d4b681d7e1d2..25eca0d40f2d 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
@@ -32,11 +32,13 @@  static const struct ieee80211_iface_combination if_comb[] = {
 static const struct ieee80211_iface_limit if_limits_chanctx[] = {
 	{
 		.max = 2,
-		.types = BIT(NL80211_IFTYPE_STATION),
+		.types = BIT(NL80211_IFTYPE_STATION) |
+			 BIT(NL80211_IFTYPE_P2P_CLIENT)
 	},
 	{
 		.max = 1,
-		.types = BIT(NL80211_IFTYPE_AP),
+		.types = BIT(NL80211_IFTYPE_AP) |
+			 BIT(NL80211_IFTYPE_P2P_GO)
 	}
 };
 
@@ -100,7 +102,9 @@  mt7921_init_wiphy(struct ieee80211_hw *hw)
 	wiphy->flags &= ~(WIPHY_FLAG_IBSS_RSN | WIPHY_FLAG_4ADDR_AP |
 			  WIPHY_FLAG_4ADDR_STATION);
 	wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
-				 BIT(NL80211_IFTYPE_AP);
+				 BIT(NL80211_IFTYPE_AP) |
+				 BIT(NL80211_IFTYPE_P2P_CLIENT) |
+				 BIT(NL80211_IFTYPE_P2P_GO);
 	wiphy->max_remain_on_channel_duration = 5000;
 	wiphy->max_scan_ie_len = MT76_CONNAC_SCAN_IE_LEN;
 	wiphy->max_scan_ssids = 4;