diff mbox series

[v6,24/24] rtw89: add Kconfig and Makefile

Message ID 20210820043538.12424-25-pkshih@realtek.com
State New
Headers show
Series rtw89: add Realtek 802.11ax driver | expand

Commit Message

Ping-Ke Shih Aug. 20, 2021, 4:35 a.m. UTC
With Kconfig and Makefile, we can build rtw89 and support 8852AE chip.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/Kconfig        |  1 +
 drivers/net/wireless/realtek/Makefile       |  1 +
 drivers/net/wireless/realtek/rtw89/Kconfig  | 50 +++++++++++++++++++++
 drivers/net/wireless/realtek/rtw89/Makefile | 25 +++++++++++
 4 files changed, 77 insertions(+)
 create mode 100644 drivers/net/wireless/realtek/rtw89/Kconfig
 create mode 100644 drivers/net/wireless/realtek/rtw89/Makefile

Comments

kernel test robot Aug. 22, 2021, 3:43 a.m. UTC | #1
Hi Ping-Ke,

I love your patch! Perhaps something to improve:

[auto build test WARNING on wireless-drivers-next/master]
[also build test WARNING on wireless-drivers/master v5.14-rc6 next-20210820]
[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]

url:    https://github.com/0day-ci/linux/commits/Ping-Ke-Shih/rtw89-add-Realtek-802-11ax-driver/20210820-124025
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master
config: i386-randconfig-a015-20210822 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 9e9d70591e72fc6762b4b9a226b68ed1307419bf)
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/0day-ci/linux/commit/6c4e6c23950c253389ad130ffe0367bbca3af99e
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Ping-Ke-Shih/rtw89-add-Realtek-802-11ax-driver/20210820-124025
        git checkout 6c4e6c23950c253389ad130ffe0367bbca3af99e
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 

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

All warnings (new ones prefixed by >>):

>> drivers/net/wireless/realtek/rtw89/phy.c:1522:6: warning: variable 'active_entry' set but not used [-Wunused-but-set-variable]

           u64 active_entry = 0;
               ^
   1 warning generated.


vim +/active_entry +1522 drivers/net/wireless/realtek/rtw89/phy.c

32d97af0af9324 Ping-Ke Shih 2021-08-20  1507  
32d97af0af9324 Ping-Ke Shih 2021-08-20  1508  static s32 rtw89_phy_multi_sta_cfo_calc(struct rtw89_dev *rtwdev)
32d97af0af9324 Ping-Ke Shih 2021-08-20  1509  {
32d97af0af9324 Ping-Ke Shih 2021-08-20  1510  	struct rtw89_cfo_tracking_info *cfo = &rtwdev->cfo_tracking;
32d97af0af9324 Ping-Ke Shih 2021-08-20  1511  	struct rtw89_traffic_stats *stats = &rtwdev->stats;
32d97af0af9324 Ping-Ke Shih 2021-08-20  1512  	s32 target_cfo = 0;
32d97af0af9324 Ping-Ke Shih 2021-08-20  1513  	s32 cfo_khz_all = 0;
32d97af0af9324 Ping-Ke Shih 2021-08-20  1514  	s32 cfo_khz_all_tp_wgt = 0;
32d97af0af9324 Ping-Ke Shih 2021-08-20  1515  	s32 cfo_avg = 0;
32d97af0af9324 Ping-Ke Shih 2021-08-20  1516  	s32 max_cfo_lb = BIT(31);
32d97af0af9324 Ping-Ke Shih 2021-08-20  1517  	s32 min_cfo_ub = GENMASK(30, 0);
32d97af0af9324 Ping-Ke Shih 2021-08-20  1518  	u16 cfo_cnt_all = 0;
32d97af0af9324 Ping-Ke Shih 2021-08-20  1519  	u8 active_entry_cnt = 0;
32d97af0af9324 Ping-Ke Shih 2021-08-20  1520  	u8 sta_cnt = 0;
32d97af0af9324 Ping-Ke Shih 2021-08-20  1521  	u32 tp_all = 0;
32d97af0af9324 Ping-Ke Shih 2021-08-20 @1522  	u64 active_entry = 0;
32d97af0af9324 Ping-Ke Shih 2021-08-20  1523  	u8 i;
32d97af0af9324 Ping-Ke Shih 2021-08-20  1524  	u8 cfo_tol = 0;
32d97af0af9324 Ping-Ke Shih 2021-08-20  1525  
32d97af0af9324 Ping-Ke Shih 2021-08-20  1526  	rtw89_debug(rtwdev, RTW89_DBG_CFO, "Multi entry cfo_trk\n");
32d97af0af9324 Ping-Ke Shih 2021-08-20  1527  	if (cfo->rtw89_multi_cfo_mode == RTW89_PKT_BASED_AVG_MODE) {
32d97af0af9324 Ping-Ke Shih 2021-08-20  1528  		rtw89_debug(rtwdev, RTW89_DBG_CFO, "Pkt based avg mode\n");
32d97af0af9324 Ping-Ke Shih 2021-08-20  1529  		for (i = 0; i < CFO_TRACK_MAX_USER; i++) {
32d97af0af9324 Ping-Ke Shih 2021-08-20  1530  			if (cfo->cfo_cnt[i] == 0)
32d97af0af9324 Ping-Ke Shih 2021-08-20  1531  				continue;
32d97af0af9324 Ping-Ke Shih 2021-08-20  1532  			cfo_khz_all += cfo->cfo_tail[i];
32d97af0af9324 Ping-Ke Shih 2021-08-20  1533  			cfo_cnt_all += cfo->cfo_cnt[i];
32d97af0af9324 Ping-Ke Shih 2021-08-20  1534  			cfo_avg = phy_div(cfo_khz_all, (s32)cfo_cnt_all);
32d97af0af9324 Ping-Ke Shih 2021-08-20  1535  			rtw89_debug(rtwdev, RTW89_DBG_CFO,
32d97af0af9324 Ping-Ke Shih 2021-08-20  1536  				    "Msta cfo=%d, pkt_cnt=%d, avg_cfo=%d\n",
32d97af0af9324 Ping-Ke Shih 2021-08-20  1537  				    cfo_khz_all, cfo_cnt_all, cfo_avg);
32d97af0af9324 Ping-Ke Shih 2021-08-20  1538  			target_cfo = cfo_avg;
32d97af0af9324 Ping-Ke Shih 2021-08-20  1539  		}
32d97af0af9324 Ping-Ke Shih 2021-08-20  1540  	} else if (cfo->rtw89_multi_cfo_mode == RTW89_ENTRY_BASED_AVG_MODE) {
32d97af0af9324 Ping-Ke Shih 2021-08-20  1541  		rtw89_debug(rtwdev, RTW89_DBG_CFO, "Entry based avg mode\n");
32d97af0af9324 Ping-Ke Shih 2021-08-20  1542  		for (i = 0; i < CFO_TRACK_MAX_USER; i++) {
32d97af0af9324 Ping-Ke Shih 2021-08-20  1543  			if (cfo->cfo_cnt[i] == 0)
32d97af0af9324 Ping-Ke Shih 2021-08-20  1544  				continue;
32d97af0af9324 Ping-Ke Shih 2021-08-20  1545  			active_entry |= BIT_ULL(i);
32d97af0af9324 Ping-Ke Shih 2021-08-20  1546  			cfo->cfo_avg[i] = phy_div(cfo->cfo_tail[i],
32d97af0af9324 Ping-Ke Shih 2021-08-20  1547  						  (s32)cfo->cfo_cnt[i]);
32d97af0af9324 Ping-Ke Shih 2021-08-20  1548  			cfo_khz_all += cfo->cfo_avg[i];
32d97af0af9324 Ping-Ke Shih 2021-08-20  1549  			rtw89_debug(rtwdev, RTW89_DBG_CFO,
32d97af0af9324 Ping-Ke Shih 2021-08-20  1550  				    "Macid=%d, cfo_avg=%d\n", i,
32d97af0af9324 Ping-Ke Shih 2021-08-20  1551  				    cfo->cfo_avg[i]);
32d97af0af9324 Ping-Ke Shih 2021-08-20  1552  		}
32d97af0af9324 Ping-Ke Shih 2021-08-20  1553  		sta_cnt = rtwdev->total_sta_assoc;
32d97af0af9324 Ping-Ke Shih 2021-08-20  1554  		cfo_avg = phy_div(cfo_khz_all, (s32)sta_cnt);
32d97af0af9324 Ping-Ke Shih 2021-08-20  1555  		rtw89_debug(rtwdev, RTW89_DBG_CFO,
32d97af0af9324 Ping-Ke Shih 2021-08-20  1556  			    "Msta cfo_acc=%d, ent_cnt=%d, avg_cfo=%d\n",
32d97af0af9324 Ping-Ke Shih 2021-08-20  1557  			    cfo_khz_all, sta_cnt, cfo_avg);
32d97af0af9324 Ping-Ke Shih 2021-08-20  1558  		target_cfo = cfo_avg;
32d97af0af9324 Ping-Ke Shih 2021-08-20  1559  	} else if (cfo->rtw89_multi_cfo_mode == RTW89_TP_BASED_AVG_MODE) {
32d97af0af9324 Ping-Ke Shih 2021-08-20  1560  		rtw89_debug(rtwdev, RTW89_DBG_CFO, "TP based avg mode\n");
32d97af0af9324 Ping-Ke Shih 2021-08-20  1561  		cfo_tol = cfo->sta_cfo_tolerance;
32d97af0af9324 Ping-Ke Shih 2021-08-20  1562  		for (i = 0; i < CFO_TRACK_MAX_USER; i++) {
32d97af0af9324 Ping-Ke Shih 2021-08-20  1563  			sta_cnt++;
32d97af0af9324 Ping-Ke Shih 2021-08-20  1564  			if (cfo->cfo_cnt[i] != 0) {
32d97af0af9324 Ping-Ke Shih 2021-08-20  1565  				cfo->cfo_avg[i] = phy_div(cfo->cfo_tail[i],
32d97af0af9324 Ping-Ke Shih 2021-08-20  1566  							  (s32)cfo->cfo_cnt[i]);
32d97af0af9324 Ping-Ke Shih 2021-08-20  1567  				active_entry_cnt++;
32d97af0af9324 Ping-Ke Shih 2021-08-20  1568  			} else {
32d97af0af9324 Ping-Ke Shih 2021-08-20  1569  				cfo->cfo_avg[i] = cfo->pre_cfo_avg[i];
32d97af0af9324 Ping-Ke Shih 2021-08-20  1570  			}
32d97af0af9324 Ping-Ke Shih 2021-08-20  1571  			max_cfo_lb = max(cfo->cfo_avg[i] - cfo_tol, max_cfo_lb);
32d97af0af9324 Ping-Ke Shih 2021-08-20  1572  			min_cfo_ub = min(cfo->cfo_avg[i] + cfo_tol, min_cfo_ub);
32d97af0af9324 Ping-Ke Shih 2021-08-20  1573  			cfo_khz_all += cfo->cfo_avg[i];
32d97af0af9324 Ping-Ke Shih 2021-08-20  1574  			/* need tp for each entry */
32d97af0af9324 Ping-Ke Shih 2021-08-20  1575  			rtw89_debug(rtwdev, RTW89_DBG_CFO,
32d97af0af9324 Ping-Ke Shih 2021-08-20  1576  				    "[%d] cfo_avg=%d, tp=tbd\n",
32d97af0af9324 Ping-Ke Shih 2021-08-20  1577  				    i, cfo->cfo_avg[i]);
32d97af0af9324 Ping-Ke Shih 2021-08-20  1578  			if (sta_cnt >= rtwdev->total_sta_assoc)
32d97af0af9324 Ping-Ke Shih 2021-08-20  1579  				break;
32d97af0af9324 Ping-Ke Shih 2021-08-20  1580  		}
32d97af0af9324 Ping-Ke Shih 2021-08-20  1581  		tp_all = stats->rx_throughput; /* need tp for each entry */
32d97af0af9324 Ping-Ke Shih 2021-08-20  1582  		cfo_avg =  phy_div(cfo_khz_all_tp_wgt, (s32)tp_all);
32d97af0af9324 Ping-Ke Shih 2021-08-20  1583  
32d97af0af9324 Ping-Ke Shih 2021-08-20  1584  		rtw89_debug(rtwdev, RTW89_DBG_CFO, "Assoc sta cnt=%d\n",
32d97af0af9324 Ping-Ke Shih 2021-08-20  1585  			    sta_cnt);
32d97af0af9324 Ping-Ke Shih 2021-08-20  1586  		rtw89_debug(rtwdev, RTW89_DBG_CFO, "Active sta cnt=%d\n",
32d97af0af9324 Ping-Ke Shih 2021-08-20  1587  			    active_entry_cnt);
32d97af0af9324 Ping-Ke Shih 2021-08-20  1588  		rtw89_debug(rtwdev, RTW89_DBG_CFO,
32d97af0af9324 Ping-Ke Shih 2021-08-20  1589  			    "Msta cfo with tp_wgt=%d, avg_cfo=%d\n",
32d97af0af9324 Ping-Ke Shih 2021-08-20  1590  			    cfo_khz_all_tp_wgt, cfo_avg);
32d97af0af9324 Ping-Ke Shih 2021-08-20  1591  		rtw89_debug(rtwdev, RTW89_DBG_CFO, "cfo_lb=%d,cfo_ub=%d\n",
32d97af0af9324 Ping-Ke Shih 2021-08-20  1592  			    max_cfo_lb, min_cfo_ub);
32d97af0af9324 Ping-Ke Shih 2021-08-20  1593  		if (max_cfo_lb <= min_cfo_ub) {
32d97af0af9324 Ping-Ke Shih 2021-08-20  1594  			rtw89_debug(rtwdev, RTW89_DBG_CFO,
32d97af0af9324 Ping-Ke Shih 2021-08-20  1595  				    "cfo win_size=%d\n",
32d97af0af9324 Ping-Ke Shih 2021-08-20  1596  				    min_cfo_ub - max_cfo_lb);
32d97af0af9324 Ping-Ke Shih 2021-08-20  1597  			target_cfo = clamp(cfo_avg, max_cfo_lb, min_cfo_ub);
32d97af0af9324 Ping-Ke Shih 2021-08-20  1598  		} else {
32d97af0af9324 Ping-Ke Shih 2021-08-20  1599  			rtw89_debug(rtwdev, RTW89_DBG_CFO,
32d97af0af9324 Ping-Ke Shih 2021-08-20  1600  				    "No intersection of cfo torlence windows\n");
32d97af0af9324 Ping-Ke Shih 2021-08-20  1601  			target_cfo = phy_div(cfo_khz_all, (s32)sta_cnt);
32d97af0af9324 Ping-Ke Shih 2021-08-20  1602  		}
32d97af0af9324 Ping-Ke Shih 2021-08-20  1603  		for (i = 0; i < CFO_TRACK_MAX_USER; i++)
32d97af0af9324 Ping-Ke Shih 2021-08-20  1604  			cfo->pre_cfo_avg[i] = cfo->cfo_avg[i];
32d97af0af9324 Ping-Ke Shih 2021-08-20  1605  	}
32d97af0af9324 Ping-Ke Shih 2021-08-20  1606  	rtw89_debug(rtwdev, RTW89_DBG_CFO, "Target cfo=%d\n", target_cfo);
32d97af0af9324 Ping-Ke Shih 2021-08-20  1607  	return target_cfo;
32d97af0af9324 Ping-Ke Shih 2021-08-20  1608  }
32d97af0af9324 Ping-Ke Shih 2021-08-20  1609  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Ping-Ke Shih Aug. 23, 2021, 1:37 a.m. UTC | #2
> -----Original Message-----

> From: kernel test robot [mailto:lkp@intel.com]

> Sent: Sunday, August 22, 2021 11:43 AM

> To: Pkshih; kvalo@codeaurora.org

> Cc: clang-built-linux@googlegroups.com; kbuild-all@lists.01.org; linux-wireless@vger.kernel.org

> Subject: Re: [PATCH v6 24/24] rtw89: add Kconfig and Makefile

> 

> Hi Ping-Ke,

> 

> I love your patch! Perhaps something to improve:

> 

> [auto build test WARNING on wireless-drivers-next/master]

> [also build test WARNING on wireless-drivers/master v5.14-rc6 next-20210820]

> [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]

> 

> url:

> https://github.com/0day-ci/linux/commits/Ping-Ke-Shih/rtw89-add-Realtek-802-11ax-driver/20210820-1

> 24025

> base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master

> config: i386-randconfig-a015-20210822 (attached as .config)

> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project

> 9e9d70591e72fc6762b4b9a226b68ed1307419bf)

> 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/0day-ci/linux/commit/6c4e6c23950c253389ad130ffe0367bbca3af99e

>         git remote add linux-review https://github.com/0day-ci/linux

>         git fetch --no-tags linux-review

> Ping-Ke-Shih/rtw89-add-Realtek-802-11ax-driver/20210820-124025

>         git checkout 6c4e6c23950c253389ad130ffe0367bbca3af99e

>         # save the attached .config to linux build tree

>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386

> 

> If you fix the issue, kindly add following tag as appropriate

> Reported-by: kernel test robot <lkp@intel.com>

> 

> All warnings (new ones prefixed by >>):

> 

> >> drivers/net/wireless/realtek/rtw89/phy.c:1522:6: warning: variable 'active_entry' set but not used

> [-Wunused-but-set-variable]

>            u64 active_entry = 0;

>                ^

>    1 warning generated.

> 


[...]

Thanks for the finding. I'll remove this variable.

Ping-Ke
Kalle Valo Oct. 1, 2021, 3:57 p.m. UTC | #3
Ping-Ke Shih <pkshih@realtek.com> writes:

> With Kconfig and Makefile, we can build rtw89 and support 8852AE chip.

>

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


[...]

> --- /dev/null

> +++ b/drivers/net/wireless/realtek/rtw89/Kconfig

> @@ -0,0 +1,50 @@

> +# SPDX-License-Identifier: GPL-2.0-only


All other files are:

SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause

Only exception is this Kconfig file, any reason for that? I prefer that
a driver has consistent license.

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

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

Patch

diff --git a/drivers/net/wireless/realtek/Kconfig b/drivers/net/wireless/realtek/Kconfig
index 474843277fa1..4a1f0e64df03 100644
--- a/drivers/net/wireless/realtek/Kconfig
+++ b/drivers/net/wireless/realtek/Kconfig
@@ -16,5 +16,6 @@  source "drivers/net/wireless/realtek/rtl818x/Kconfig"
 source "drivers/net/wireless/realtek/rtlwifi/Kconfig"
 source "drivers/net/wireless/realtek/rtl8xxxu/Kconfig"
 source "drivers/net/wireless/realtek/rtw88/Kconfig"
+source "drivers/net/wireless/realtek/rtw89/Kconfig"
 
 endif # WLAN_VENDOR_REALTEK
diff --git a/drivers/net/wireless/realtek/Makefile b/drivers/net/wireless/realtek/Makefile
index 888b5d594e79..ab25419f56c6 100644
--- a/drivers/net/wireless/realtek/Makefile
+++ b/drivers/net/wireless/realtek/Makefile
@@ -8,4 +8,5 @@  obj-$(CONFIG_RTL8187)		+= rtl818x/
 obj-$(CONFIG_RTLWIFI)		+= rtlwifi/
 obj-$(CONFIG_RTL8XXXU)		+= rtl8xxxu/
 obj-$(CONFIG_RTW88)		+= rtw88/
+obj-$(CONFIG_RTW89)		+= rtw89/
 
diff --git a/drivers/net/wireless/realtek/rtw89/Kconfig b/drivers/net/wireless/realtek/rtw89/Kconfig
new file mode 100644
index 000000000000..055d45103a4b
--- /dev/null
+++ b/drivers/net/wireless/realtek/rtw89/Kconfig
@@ -0,0 +1,50 @@ 
+# SPDX-License-Identifier: GPL-2.0-only
+menuconfig RTW89
+	tristate "Realtek 802.11ax wireless chips support"
+	depends on MAC80211
+	help
+	  This module adds support for mac80211-based wireless drivers that
+	  enables Realtek IEEE 802.11ax wireless chipsets.
+
+	  If you choose to build a module, it'll be called rtw89.
+
+if RTW89
+
+config RTW89_CORE
+	tristate
+
+config RTW89_PCI
+	tristate
+
+config RTW89_8852AE
+	tristate "Realtek 8852AE PCI wireless network adapter"
+	depends on PCI
+	select RTW89_CORE
+	select RTW89_PCI
+	help
+	  Select this option will enable support for 8852AE chipset
+
+	  802.11ax PCIe wireless network adapter
+
+config RTW89_DEBUG
+	bool
+
+config RTW89_DEBUGMSG
+	bool "Realtek rtw89 debug message support"
+	depends on RTW89_CORE
+	select RTW89_DEBUG
+	help
+	  Enable debug message support
+
+	  If unsure, say Y to simplify debug problems
+
+config RTW89_DEBUGFS
+	bool "Realtek rtw89 debugfs support"
+	depends on RTW89_CORE
+	select RTW89_DEBUG
+	help
+	  Enable debugfs support
+
+	  If unsure, say Y to simplify debug problems
+
+endif
diff --git a/drivers/net/wireless/realtek/rtw89/Makefile b/drivers/net/wireless/realtek/rtw89/Makefile
new file mode 100644
index 000000000000..077e8fe23f60
--- /dev/null
+++ b/drivers/net/wireless/realtek/rtw89/Makefile
@@ -0,0 +1,25 @@ 
+# SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
+
+obj-$(CONFIG_RTW89_CORE) += rtw89_core.o
+rtw89_core-y += core.o \
+		mac80211.o \
+		mac.o \
+		phy.o \
+		fw.o \
+		rtw8852a.o \
+		rtw8852a_table.o \
+		rtw8852a_rfk.o \
+		rtw8852a_rfk_table.o \
+		cam.o \
+		efuse.o \
+		regd.o \
+		sar.o \
+		coex.o \
+		ps.o \
+		ser.o
+
+rtw89_core-$(CONFIG_RTW89_DEBUG) += debug.o
+
+obj-$(CONFIG_RTW89_PCI) += rtw89_pci.o
+rtw89_pci-y := pci.o
+