diff mbox series

[42/43] wifi: nxpwifi: add Makefile and Kconfig files for nxpwifi compilation

Message ID 20240621075208.513497-43-yu-hao.lin@nxp.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series wifi: nxpwifi: create nxpwifi to support iw61x | expand

Commit Message

David Lin June 21, 2024, 7:52 a.m. UTC
Signed-off-by: David Lin <yu-hao.lin@nxp.com>
---
 drivers/net/wireless/Kconfig              |  1 +
 drivers/net/wireless/Makefile             |  1 +
 drivers/net/wireless/nxp/Kconfig          | 17 ++++++++++
 drivers/net/wireless/nxp/Makefile         |  3 ++
 drivers/net/wireless/nxp/nxpwifi/Kconfig  | 22 +++++++++++++
 drivers/net/wireless/nxp/nxpwifi/Makefile | 38 +++++++++++++++++++++++
 6 files changed, 82 insertions(+)
 create mode 100644 drivers/net/wireless/nxp/Kconfig
 create mode 100644 drivers/net/wireless/nxp/Makefile
 create mode 100644 drivers/net/wireless/nxp/nxpwifi/Kconfig
 create mode 100644 drivers/net/wireless/nxp/nxpwifi/Makefile

Comments

kernel test robot June 26, 2024, 12:19 a.m. UTC | #1
Hi David,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 238d636723a30311e20fde0a361662e829fe488b]

url:    https://github.com/intel-lab-lkp/linux/commits/David-Lin/wifi-nxpwifi-add-11ac-c/20240625-161306
base:   238d636723a30311e20fde0a361662e829fe488b
patch link:    https://lore.kernel.org/r/20240621075208.513497-43-yu-hao.lin%40nxp.com
patch subject: [PATCH 42/43] wifi: nxpwifi: add Makefile and Kconfig files for nxpwifi compilation
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20240626/202406260755.fqLnsFhr-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240626/202406260755.fqLnsFhr-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406260755.fqLnsFhr-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/net/wireless/nxp/nxpwifi/11h.c:208:7: warning: variable 'chan2_offset' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
     208 |         case NL80211_CHAN_WIDTH_80P80:
         |              ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/wireless/nxp/nxpwifi/11h.c:214:16: note: uninitialized use occurs here
     214 |         *band_cfg = ((chan2_offset << BAND_CFG_CHAN2_SHIFT_BIT) &
         |                       ^~~~~~~~~~~~
   drivers/net/wireless/nxp/nxpwifi/11h.c:209:7: warning: variable 'chan2_offset' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
     209 |         case NL80211_CHAN_WIDTH_160:
         |              ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net/wireless/nxp/nxpwifi/11h.c:214:16: note: uninitialized use occurs here
     214 |         *band_cfg = ((chan2_offset << BAND_CFG_CHAN2_SHIFT_BIT) &
         |                       ^~~~~~~~~~~~
   drivers/net/wireless/nxp/nxpwifi/11h.c:192:7: warning: variable 'chan2_offset' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
     192 |         case NL80211_CHAN_WIDTH_20_NOHT:
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/wireless/nxp/nxpwifi/11h.c:214:16: note: uninitialized use occurs here
     214 |         *band_cfg = ((chan2_offset << BAND_CFG_CHAN2_SHIFT_BIT) &
         |                       ^~~~~~~~~~~~
   drivers/net/wireless/nxp/nxpwifi/11h.c:193:7: warning: variable 'chan2_offset' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
     193 |         case NL80211_CHAN_WIDTH_20:
         |              ^~~~~~~~~~~~~~~~~~~~~
   drivers/net/wireless/nxp/nxpwifi/11h.c:214:16: note: uninitialized use occurs here
     214 |         *band_cfg = ((chan2_offset << BAND_CFG_CHAN2_SHIFT_BIT) &
         |                       ^~~~~~~~~~~~
>> drivers/net/wireless/nxp/nxpwifi/11h.c:210:2: warning: variable 'chan2_offset' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
     210 |         default:
         |         ^~~~~~~
   drivers/net/wireless/nxp/nxpwifi/11h.c:214:16: note: uninitialized use occurs here
     214 |         *band_cfg = ((chan2_offset << BAND_CFG_CHAN2_SHIFT_BIT) &
         |                       ^~~~~~~~~~~~
   drivers/net/wireless/nxp/nxpwifi/11h.c:178:40: note: initialize the variable 'chan2_offset' to silence this warning
     178 |         u8 chan_band, chan_width, chan2_offset;
         |                                               ^
         |                                                = '\0'
>> drivers/net/wireless/nxp/nxpwifi/11h.c:208:7: warning: variable 'chan_width' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
     208 |         case NL80211_CHAN_WIDTH_80P80:
         |              ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/wireless/nxp/nxpwifi/11h.c:216:9: note: uninitialized use occurs here
     216 |                     ((chan_width << BAND_CFG_CHAN_WIDTH_SHIFT_BIT) &
         |                       ^~~~~~~~~~
   drivers/net/wireless/nxp/nxpwifi/11h.c:209:7: warning: variable 'chan_width' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
     209 |         case NL80211_CHAN_WIDTH_160:
         |              ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net/wireless/nxp/nxpwifi/11h.c:216:9: note: uninitialized use occurs here
     216 |                     ((chan_width << BAND_CFG_CHAN_WIDTH_SHIFT_BIT) &
         |                       ^~~~~~~~~~
>> drivers/net/wireless/nxp/nxpwifi/11h.c:210:2: warning: variable 'chan_width' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
     210 |         default:
         |         ^~~~~~~
   drivers/net/wireless/nxp/nxpwifi/11h.c:216:9: note: uninitialized use occurs here
     216 |                     ((chan_width << BAND_CFG_CHAN_WIDTH_SHIFT_BIT) &
         |                       ^~~~~~~~~~
   drivers/net/wireless/nxp/nxpwifi/11h.c:178:26: note: initialize the variable 'chan_width' to silence this warning
     178 |         u8 chan_band, chan_width, chan2_offset;
         |                                 ^
         |                                  = '\0'
>> drivers/net/wireless/nxp/nxpwifi/11h.c:187:2: warning: variable 'chan_band' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
     187 |         default:
         |         ^~~~~~~
   drivers/net/wireless/nxp/nxpwifi/11h.c:218:9: note: uninitialized use occurs here
     218 |                     ((chan_band << BAND_CFG_CHAN_BAND_SHIFT_BIT) &
         |                       ^~~~~~~~~
   drivers/net/wireless/nxp/nxpwifi/11h.c:178:14: note: initialize the variable 'chan_band' to silence this warning
     178 |         u8 chan_band, chan_width, chan2_offset;
         |                     ^
         |                      = '\0'
   9 warnings generated.


vim +/chan2_offset +208 drivers/net/wireless/nxp/nxpwifi/11h.c

647388e635d138 David Lin 2024-06-21  174  
647388e635d138 David Lin 2024-06-21  175  static void nxpwifi_convert_chan_to_band_cfg(u8 *band_cfg,
647388e635d138 David Lin 2024-06-21  176  					     struct cfg80211_chan_def *chan_def)
647388e635d138 David Lin 2024-06-21  177  {
647388e635d138 David Lin 2024-06-21  178  	u8 chan_band, chan_width, chan2_offset;
647388e635d138 David Lin 2024-06-21  179  
647388e635d138 David Lin 2024-06-21  180  	switch (chan_def->chan->band) {
647388e635d138 David Lin 2024-06-21  181  	case NL80211_BAND_2GHZ:
647388e635d138 David Lin 2024-06-21  182  		chan_band = BAND_2GHZ;
647388e635d138 David Lin 2024-06-21  183  		break;
647388e635d138 David Lin 2024-06-21  184  	case NL80211_BAND_5GHZ:
647388e635d138 David Lin 2024-06-21  185  		chan_band = BAND_5GHZ;
647388e635d138 David Lin 2024-06-21  186  		break;
647388e635d138 David Lin 2024-06-21 @187  	default:
647388e635d138 David Lin 2024-06-21  188  		break;
647388e635d138 David Lin 2024-06-21  189  	}
647388e635d138 David Lin 2024-06-21  190  
647388e635d138 David Lin 2024-06-21  191  	switch (chan_def->width) {
647388e635d138 David Lin 2024-06-21  192  	case NL80211_CHAN_WIDTH_20_NOHT:
647388e635d138 David Lin 2024-06-21  193  	case NL80211_CHAN_WIDTH_20:
647388e635d138 David Lin 2024-06-21  194  		chan_width = CHAN_BW_20MHZ;
647388e635d138 David Lin 2024-06-21  195  		break;
647388e635d138 David Lin 2024-06-21  196  	case NL80211_CHAN_WIDTH_40:
647388e635d138 David Lin 2024-06-21  197  		chan_width = CHAN_BW_40MHZ;
647388e635d138 David Lin 2024-06-21  198  		if (chan_def->center_freq1 > chan_def->chan->center_freq)
647388e635d138 David Lin 2024-06-21  199  			chan2_offset = SEC_CHAN_ABOVE;
647388e635d138 David Lin 2024-06-21  200  		else
647388e635d138 David Lin 2024-06-21  201  			chan2_offset = SEC_CHAN_BELOW;
647388e635d138 David Lin 2024-06-21  202  		break;
647388e635d138 David Lin 2024-06-21  203  	case NL80211_CHAN_WIDTH_80:
647388e635d138 David Lin 2024-06-21  204  		chan2_offset =
647388e635d138 David Lin 2024-06-21  205  			nxpwifi_get_channel_2_offset(chan_def->chan->hw_value);
647388e635d138 David Lin 2024-06-21  206  		chan_width = CHAN_BW_80MHZ;
647388e635d138 David Lin 2024-06-21  207  		break;
647388e635d138 David Lin 2024-06-21 @208  	case NL80211_CHAN_WIDTH_80P80:
647388e635d138 David Lin 2024-06-21  209  	case NL80211_CHAN_WIDTH_160:
647388e635d138 David Lin 2024-06-21 @210  	default:
647388e635d138 David Lin 2024-06-21  211  		break;
647388e635d138 David Lin 2024-06-21  212  	}
647388e635d138 David Lin 2024-06-21  213  
647388e635d138 David Lin 2024-06-21 @214  	*band_cfg = ((chan2_offset << BAND_CFG_CHAN2_SHIFT_BIT) &
647388e635d138 David Lin 2024-06-21  215  		     BAND_CFG_CHAN2_OFFSET_MASK) |
647388e635d138 David Lin 2024-06-21 @216  		    ((chan_width << BAND_CFG_CHAN_WIDTH_SHIFT_BIT) &
647388e635d138 David Lin 2024-06-21  217  		     BAND_CFG_CHAN_WIDTH_MASK) |
647388e635d138 David Lin 2024-06-21  218  		    ((chan_band << BAND_CFG_CHAN_BAND_SHIFT_BIT) &
647388e635d138 David Lin 2024-06-21  219  		     BAND_CFG_CHAN_BAND_MASK);
647388e635d138 David Lin 2024-06-21  220  }
647388e635d138 David Lin 2024-06-21  221
kernel test robot June 26, 2024, 12:24 a.m. UTC | #2
Hi David,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 238d636723a30311e20fde0a361662e829fe488b]

url:    https://github.com/intel-lab-lkp/linux/commits/David-Lin/wifi-nxpwifi-add-11ac-c/20240625-161306
base:   238d636723a30311e20fde0a361662e829fe488b
patch link:    https://lore.kernel.org/r/20240621075208.513497-43-yu-hao.lin%40nxp.com
patch subject: [PATCH 42/43] wifi: nxpwifi: add Makefile and Kconfig files for nxpwifi compilation
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20240626/202406260848.0pH4xjvI-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240626/202406260848.0pH4xjvI-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406260848.0pH4xjvI-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/net/wireless/nxp/nxpwifi/11n_rxreorder.c: In function 'nxpwifi_11n_dispatch_amsdu_pkt':
>> drivers/net/wireless/nxp/nxpwifi/11n_rxreorder.c:40:47: warning: variable 'rx_hdr' set but not used [-Wunused-but-set-variable]
      40 |                         struct rx_packet_hdr *rx_hdr;
         |                                               ^~~~~~
--
   drivers/net/wireless/nxp/nxpwifi/sta_event.c: In function 'nxpwifi_sta_event_link_lost':
>> drivers/net/wireless/nxp/nxpwifi/sta_event.c:21:13: warning: variable 'reason_code' set but not used [-Wunused-but-set-variable]
      21 |         u16 reason_code;
         |             ^~~~~~~~~~~
--
   drivers/net/wireless/nxp/nxpwifi/sta_rx.c: In function 'nxpwifi_process_rx_packet':
>> drivers/net/wireless/nxp/nxpwifi/sta_rx.c:78:25: warning: variable 'rx_pkt_len' set but not used [-Wunused-but-set-variable]
      78 |         u16 rx_pkt_off, rx_pkt_len;
         |                         ^~~~~~~~~~


vim +/rx_hdr +40 drivers/net/wireless/nxp/nxpwifi/11n_rxreorder.c

148be2798f7a0c David Lin 2024-06-21  17  
148be2798f7a0c David Lin 2024-06-21  18  /* This function will dispatch amsdu packet and forward it to kernel/upper
148be2798f7a0c David Lin 2024-06-21  19   * layer.
148be2798f7a0c David Lin 2024-06-21  20   */
148be2798f7a0c David Lin 2024-06-21  21  static int nxpwifi_11n_dispatch_amsdu_pkt(struct nxpwifi_private *priv,
148be2798f7a0c David Lin 2024-06-21  22  					  struct sk_buff *skb)
148be2798f7a0c David Lin 2024-06-21  23  {
148be2798f7a0c David Lin 2024-06-21  24  	struct rxpd *local_rx_pd = (struct rxpd *)(skb->data);
148be2798f7a0c David Lin 2024-06-21  25  	int ret;
148be2798f7a0c David Lin 2024-06-21  26  
148be2798f7a0c David Lin 2024-06-21  27  	if (le16_to_cpu(local_rx_pd->rx_pkt_type) == PKT_TYPE_AMSDU) {
148be2798f7a0c David Lin 2024-06-21  28  		struct sk_buff_head list;
148be2798f7a0c David Lin 2024-06-21  29  		struct sk_buff *rx_skb;
148be2798f7a0c David Lin 2024-06-21  30  
148be2798f7a0c David Lin 2024-06-21  31  		__skb_queue_head_init(&list);
148be2798f7a0c David Lin 2024-06-21  32  
148be2798f7a0c David Lin 2024-06-21  33  		skb_pull(skb, le16_to_cpu(local_rx_pd->rx_pkt_offset));
148be2798f7a0c David Lin 2024-06-21  34  		skb_trim(skb, le16_to_cpu(local_rx_pd->rx_pkt_length));
148be2798f7a0c David Lin 2024-06-21  35  
148be2798f7a0c David Lin 2024-06-21  36  		ieee80211_amsdu_to_8023s(skb, &list, priv->curr_addr,
148be2798f7a0c David Lin 2024-06-21  37  					 priv->wdev.iftype, 0, NULL, NULL, false);
148be2798f7a0c David Lin 2024-06-21  38  
148be2798f7a0c David Lin 2024-06-21  39  		while (!skb_queue_empty(&list)) {
148be2798f7a0c David Lin 2024-06-21 @40  			struct rx_packet_hdr *rx_hdr;
148be2798f7a0c David Lin 2024-06-21  41  
148be2798f7a0c David Lin 2024-06-21  42  			rx_skb = __skb_dequeue(&list);
148be2798f7a0c David Lin 2024-06-21  43  			rx_hdr = (struct rx_packet_hdr *)rx_skb->data;
148be2798f7a0c David Lin 2024-06-21  44  
148be2798f7a0c David Lin 2024-06-21  45  			if (priv->bss_role == NXPWIFI_BSS_ROLE_UAP)
148be2798f7a0c David Lin 2024-06-21  46  				ret = nxpwifi_uap_recv_packet(priv, rx_skb);
148be2798f7a0c David Lin 2024-06-21  47  			else
148be2798f7a0c David Lin 2024-06-21  48  				ret = nxpwifi_recv_packet(priv, rx_skb);
148be2798f7a0c David Lin 2024-06-21  49  			if (ret == -1)
148be2798f7a0c David Lin 2024-06-21  50  				nxpwifi_dbg(priv->adapter, ERROR,
148be2798f7a0c David Lin 2024-06-21  51  					    "Rx of A-MSDU failed");
148be2798f7a0c David Lin 2024-06-21  52  		}
148be2798f7a0c David Lin 2024-06-21  53  		return 0;
148be2798f7a0c David Lin 2024-06-21  54  	}
148be2798f7a0c David Lin 2024-06-21  55  
148be2798f7a0c David Lin 2024-06-21  56  	return -1;
148be2798f7a0c David Lin 2024-06-21  57  }
148be2798f7a0c David Lin 2024-06-21  58
kernel test robot June 28, 2024, 4:46 a.m. UTC | #3
Hi David,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 238d636723a30311e20fde0a361662e829fe488b]

url:    https://github.com/intel-lab-lkp/linux/commits/David-Lin/wifi-nxpwifi-add-11ac-c/20240625-161306
base:   238d636723a30311e20fde0a361662e829fe488b
patch link:    https://lore.kernel.org/r/20240621075208.513497-43-yu-hao.lin%40nxp.com
patch subject: [PATCH 42/43] wifi: nxpwifi: add Makefile and Kconfig files for nxpwifi compilation
config: i386-randconfig-062-20240628 (https://download.01.org/0day-ci/archive/20240628/202406281235.idQnZtIJ-lkp@intel.com/config)
compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240628/202406281235.idQnZtIJ-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406281235.idQnZtIJ-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/net/wireless/nxp/nxpwifi/uap_cmd.c:541:19: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le16 [usertype] size @@     got unsigned int @@
   drivers/net/wireless/nxp/nxpwifi/uap_cmd.c:541:19: sparse:     expected restricted __le16 [usertype] size
   drivers/net/wireless/nxp/nxpwifi/uap_cmd.c:541:19: sparse:     got unsigned int
>> drivers/net/wireless/nxp/nxpwifi/uap_cmd.c:554:29: sparse: sparse: cast from restricted __le16
>> drivers/net/wireless/nxp/nxpwifi/uap_cmd.c:573:19: sparse: sparse: bad assignment (+=) to restricted __le16
   drivers/net/wireless/nxp/nxpwifi/uap_cmd.c:584:27: sparse: sparse: bad assignment (+=) to restricted __le16
   drivers/net/wireless/nxp/nxpwifi/uap_cmd.c:596:27: sparse: sparse: bad assignment (+=) to restricted __le16
   drivers/net/wireless/nxp/nxpwifi/uap_cmd.c:609:27: sparse: sparse: bad assignment (+=) to restricted __le16
   drivers/net/wireless/nxp/nxpwifi/uap_cmd.c:622:27: sparse: sparse: bad assignment (+=) to restricted __le16
   drivers/net/wireless/nxp/nxpwifi/uap_cmd.c:640:27: sparse: sparse: bad assignment (+=) to restricted __le16
   drivers/net/wireless/nxp/nxpwifi/uap_cmd.c:653:27: sparse: sparse: bad assignment (+=) to restricted __le16
   drivers/net/wireless/nxp/nxpwifi/uap_cmd.c:666:21: sparse: sparse: cast from restricted __le16

vim +541 drivers/net/wireless/nxp/nxpwifi/uap_cmd.c

309a0039e40257 David Lin 2024-06-21  521  
309a0039e40257 David Lin 2024-06-21  522  /* This function prepares AP specific add station command.
309a0039e40257 David Lin 2024-06-21  523   */
309a0039e40257 David Lin 2024-06-21  524  static int
309a0039e40257 David Lin 2024-06-21  525  nxpwifi_cmd_uap_add_new_station(struct nxpwifi_private *priv,
309a0039e40257 David Lin 2024-06-21  526  				struct host_cmd_ds_command *cmd,
309a0039e40257 David Lin 2024-06-21  527  				u16 cmd_no, void *data_buf,
309a0039e40257 David Lin 2024-06-21  528  				u16 cmd_action, u32 cmd_type)
309a0039e40257 David Lin 2024-06-21  529  {
309a0039e40257 David Lin 2024-06-21  530  	struct host_cmd_ds_add_station *new_sta = &cmd->params.sta_info;
309a0039e40257 David Lin 2024-06-21  531  	struct nxpwifi_sta_info *add_sta = (struct nxpwifi_sta_info *)data_buf;
309a0039e40257 David Lin 2024-06-21  532  	struct station_parameters *params = add_sta->params;
309a0039e40257 David Lin 2024-06-21  533  	struct nxpwifi_sta_node *sta_ptr;
309a0039e40257 David Lin 2024-06-21  534  	u8 *pos, *cmd_end;
309a0039e40257 David Lin 2024-06-21  535  	u16 tlv_len;
309a0039e40257 David Lin 2024-06-21  536  	struct nxpwifi_ie_types_sta_flag *sta_flag;
309a0039e40257 David Lin 2024-06-21  537  	int i;
309a0039e40257 David Lin 2024-06-21  538  
309a0039e40257 David Lin 2024-06-21  539  	cmd->command = cpu_to_le16(HOST_CMD_ADD_NEW_STATION);
309a0039e40257 David Lin 2024-06-21  540  	new_sta->action = cpu_to_le16(cmd_action);
309a0039e40257 David Lin 2024-06-21 @541  	cmd->size = sizeof(struct host_cmd_ds_add_station) + S_DS_GEN;
309a0039e40257 David Lin 2024-06-21  542  
309a0039e40257 David Lin 2024-06-21  543  	if (cmd_action == HOST_ACT_ADD_STA)
309a0039e40257 David Lin 2024-06-21  544  		sta_ptr = nxpwifi_add_sta_entry(priv, add_sta->peer_mac);
309a0039e40257 David Lin 2024-06-21  545  	else
309a0039e40257 David Lin 2024-06-21  546  		sta_ptr = nxpwifi_get_sta_entry(priv, add_sta->peer_mac);
309a0039e40257 David Lin 2024-06-21  547  
309a0039e40257 David Lin 2024-06-21  548  	if (!sta_ptr)
309a0039e40257 David Lin 2024-06-21  549  		return -1;
309a0039e40257 David Lin 2024-06-21  550  
309a0039e40257 David Lin 2024-06-21  551  	memcpy(new_sta->peer_mac, add_sta->peer_mac, ETH_ALEN);
309a0039e40257 David Lin 2024-06-21  552  
309a0039e40257 David Lin 2024-06-21  553  	if (cmd_action == HOST_ACT_REMOVE_STA) {
309a0039e40257 David Lin 2024-06-21 @554  		cmd->size = cpu_to_le16(cmd->size);
309a0039e40257 David Lin 2024-06-21  555  		return 0;
309a0039e40257 David Lin 2024-06-21  556  	}
309a0039e40257 David Lin 2024-06-21  557  
309a0039e40257 David Lin 2024-06-21  558  	new_sta->aid = cpu_to_le16(params->aid);
309a0039e40257 David Lin 2024-06-21  559  	new_sta->listen_interval = cpu_to_le32(params->listen_interval);
309a0039e40257 David Lin 2024-06-21  560  	new_sta->cap_info = cpu_to_le16(params->capability);
309a0039e40257 David Lin 2024-06-21  561  
309a0039e40257 David Lin 2024-06-21  562  	pos = new_sta->tlv;
309a0039e40257 David Lin 2024-06-21  563  	cmd_end = (u8 *)cmd;
309a0039e40257 David Lin 2024-06-21  564  	cmd_end += (NXPWIFI_SIZE_OF_CMD_BUFFER - 1);
309a0039e40257 David Lin 2024-06-21  565  
309a0039e40257 David Lin 2024-06-21  566  	if (params->sta_flags_set & NL80211_STA_FLAG_WME)
309a0039e40257 David Lin 2024-06-21  567  		sta_ptr->is_wmm_enabled = 1;
309a0039e40257 David Lin 2024-06-21  568  	sta_flag = (struct nxpwifi_ie_types_sta_flag *)pos;
309a0039e40257 David Lin 2024-06-21  569  	sta_flag->header.type = cpu_to_le16(TLV_TYPE_UAP_STA_FLAGS);
309a0039e40257 David Lin 2024-06-21  570  	sta_flag->header.len = cpu_to_le16(sizeof(__le32));
309a0039e40257 David Lin 2024-06-21  571  	sta_flag->sta_flags = cpu_to_le32(params->sta_flags_set);
309a0039e40257 David Lin 2024-06-21  572  	pos += sizeof(struct nxpwifi_ie_types_sta_flag);
309a0039e40257 David Lin 2024-06-21 @573  	cmd->size += sizeof(struct nxpwifi_ie_types_sta_flag);
309a0039e40257 David Lin 2024-06-21  574  
309a0039e40257 David Lin 2024-06-21  575  	if (params->ext_capab_len) {
309a0039e40257 David Lin 2024-06-21  576  		u8 *data = (u8 *)params->ext_capab;
309a0039e40257 David Lin 2024-06-21  577  		u16 len = params->ext_capab_len;
309a0039e40257 David Lin 2024-06-21  578  
309a0039e40257 David Lin 2024-06-21  579  		tlv_len = nxpwifi_append_data_tlv(WLAN_EID_EXT_CAPABILITY,
309a0039e40257 David Lin 2024-06-21  580  						  data, len, pos, cmd_end);
309a0039e40257 David Lin 2024-06-21  581  		if (!tlv_len)
309a0039e40257 David Lin 2024-06-21  582  			return -1;
309a0039e40257 David Lin 2024-06-21  583  		pos += tlv_len;
309a0039e40257 David Lin 2024-06-21  584  		cmd->size += tlv_len;
309a0039e40257 David Lin 2024-06-21  585  	}
309a0039e40257 David Lin 2024-06-21  586  
309a0039e40257 David Lin 2024-06-21  587  	if (params->link_sta_params.supported_rates_len) {
309a0039e40257 David Lin 2024-06-21  588  		u8 *data = (u8 *)params->link_sta_params.supported_rates;
309a0039e40257 David Lin 2024-06-21  589  		u16 len = params->link_sta_params.supported_rates_len;
309a0039e40257 David Lin 2024-06-21  590  
309a0039e40257 David Lin 2024-06-21  591  		tlv_len = nxpwifi_append_data_tlv(WLAN_EID_SUPP_RATES,
309a0039e40257 David Lin 2024-06-21  592  						  data, len, pos, cmd_end);
309a0039e40257 David Lin 2024-06-21  593  		if (!tlv_len)
309a0039e40257 David Lin 2024-06-21  594  			return -1;
309a0039e40257 David Lin 2024-06-21  595  		pos += tlv_len;
309a0039e40257 David Lin 2024-06-21  596  		cmd->size += tlv_len;
309a0039e40257 David Lin 2024-06-21  597  	}
309a0039e40257 David Lin 2024-06-21  598  
309a0039e40257 David Lin 2024-06-21  599  	if (params->uapsd_queues || params->max_sp) {
309a0039e40257 David Lin 2024-06-21  600  		u8 qos_capability = params->uapsd_queues | (params->max_sp << 5);
309a0039e40257 David Lin 2024-06-21  601  		u8 *data = &qos_capability;
309a0039e40257 David Lin 2024-06-21  602  		u16 len = sizeof(u8);
309a0039e40257 David Lin 2024-06-21  603  
309a0039e40257 David Lin 2024-06-21  604  		tlv_len = nxpwifi_append_data_tlv(WLAN_EID_QOS_CAPA,
309a0039e40257 David Lin 2024-06-21  605  						  data, len, pos, cmd_end);
309a0039e40257 David Lin 2024-06-21  606  		if (!tlv_len)
309a0039e40257 David Lin 2024-06-21  607  			return -1;
309a0039e40257 David Lin 2024-06-21  608  		pos += tlv_len;
309a0039e40257 David Lin 2024-06-21  609  		cmd->size += tlv_len;
309a0039e40257 David Lin 2024-06-21  610  		sta_ptr->is_wmm_enabled = 1;
309a0039e40257 David Lin 2024-06-21  611  	}
309a0039e40257 David Lin 2024-06-21  612  
309a0039e40257 David Lin 2024-06-21  613  	if (params->link_sta_params.ht_capa) {
309a0039e40257 David Lin 2024-06-21  614  		u8 *data = (u8 *)params->link_sta_params.ht_capa;
309a0039e40257 David Lin 2024-06-21  615  		u16 len = sizeof(struct ieee80211_ht_cap);
309a0039e40257 David Lin 2024-06-21  616  
309a0039e40257 David Lin 2024-06-21  617  		tlv_len = nxpwifi_append_data_tlv(WLAN_EID_HT_CAPABILITY,
309a0039e40257 David Lin 2024-06-21  618  						  data, len, pos, cmd_end);
309a0039e40257 David Lin 2024-06-21  619  		if (!tlv_len)
309a0039e40257 David Lin 2024-06-21  620  			return -1;
309a0039e40257 David Lin 2024-06-21  621  		pos += tlv_len;
309a0039e40257 David Lin 2024-06-21  622  		cmd->size += tlv_len;
309a0039e40257 David Lin 2024-06-21  623  		sta_ptr->is_11n_enabled = 1;
309a0039e40257 David Lin 2024-06-21  624  		sta_ptr->max_amsdu =
309a0039e40257 David Lin 2024-06-21  625  			le16_to_cpu(params->link_sta_params.ht_capa->cap_info) &
309a0039e40257 David Lin 2024-06-21  626  			IEEE80211_HT_CAP_MAX_AMSDU ?
309a0039e40257 David Lin 2024-06-21  627  			NXPWIFI_TX_DATA_BUF_SIZE_8K :
309a0039e40257 David Lin 2024-06-21  628  			NXPWIFI_TX_DATA_BUF_SIZE_4K;
309a0039e40257 David Lin 2024-06-21  629  	}
309a0039e40257 David Lin 2024-06-21  630  
309a0039e40257 David Lin 2024-06-21  631  	if (params->link_sta_params.vht_capa) {
309a0039e40257 David Lin 2024-06-21  632  		u8 *data = (u8 *)params->link_sta_params.vht_capa;
309a0039e40257 David Lin 2024-06-21  633  		u16 len = sizeof(struct ieee80211_vht_cap);
309a0039e40257 David Lin 2024-06-21  634  
309a0039e40257 David Lin 2024-06-21  635  		tlv_len = nxpwifi_append_data_tlv(WLAN_EID_VHT_CAPABILITY,
309a0039e40257 David Lin 2024-06-21  636  						  data, len, pos, cmd_end);
309a0039e40257 David Lin 2024-06-21  637  		if (!tlv_len)
309a0039e40257 David Lin 2024-06-21  638  			return -1;
309a0039e40257 David Lin 2024-06-21  639  		pos += tlv_len;
309a0039e40257 David Lin 2024-06-21  640  		cmd->size += tlv_len;
309a0039e40257 David Lin 2024-06-21  641  		sta_ptr->is_11ac_enabled = 1;
309a0039e40257 David Lin 2024-06-21  642  	}
309a0039e40257 David Lin 2024-06-21  643  
309a0039e40257 David Lin 2024-06-21  644  	if (params->link_sta_params.opmode_notif_used) {
309a0039e40257 David Lin 2024-06-21  645  		u8 *data = &params->link_sta_params.opmode_notif;
309a0039e40257 David Lin 2024-06-21  646  		u16 len = sizeof(u8);
309a0039e40257 David Lin 2024-06-21  647  
309a0039e40257 David Lin 2024-06-21  648  		tlv_len = nxpwifi_append_data_tlv(WLAN_EID_OPMODE_NOTIF,
309a0039e40257 David Lin 2024-06-21  649  						  data, len, pos, cmd_end);
309a0039e40257 David Lin 2024-06-21  650  		if (!tlv_len)
309a0039e40257 David Lin 2024-06-21  651  			return -1;
309a0039e40257 David Lin 2024-06-21  652  		pos += tlv_len;
309a0039e40257 David Lin 2024-06-21  653  		cmd->size += tlv_len;
309a0039e40257 David Lin 2024-06-21  654  	}
309a0039e40257 David Lin 2024-06-21  655  
309a0039e40257 David Lin 2024-06-21  656  	for (i = 0; i < MAX_NUM_TID; i++) {
309a0039e40257 David Lin 2024-06-21  657  		if (sta_ptr->is_11n_enabled)
309a0039e40257 David Lin 2024-06-21  658  			sta_ptr->ampdu_sta[i] =
309a0039e40257 David Lin 2024-06-21  659  				      priv->aggr_prio_tbl[i].ampdu_user;
309a0039e40257 David Lin 2024-06-21  660  		else
309a0039e40257 David Lin 2024-06-21  661  			sta_ptr->ampdu_sta[i] = BA_STREAM_NOT_ALLOWED;
309a0039e40257 David Lin 2024-06-21  662  	}
309a0039e40257 David Lin 2024-06-21  663  
309a0039e40257 David Lin 2024-06-21  664  	memset(sta_ptr->rx_seq, 0xff, sizeof(sta_ptr->rx_seq));
309a0039e40257 David Lin 2024-06-21  665  
309a0039e40257 David Lin 2024-06-21  666  	cmd->size = cpu_to_le16(cmd->size);
309a0039e40257 David Lin 2024-06-21  667  
309a0039e40257 David Lin 2024-06-21  668  	return 0;
309a0039e40257 David Lin 2024-06-21  669  }
309a0039e40257 David Lin 2024-06-21  670
diff mbox series

Patch

diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index c6599594dc99..4d7b81182925 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -27,6 +27,7 @@  source "drivers/net/wireless/intersil/Kconfig"
 source "drivers/net/wireless/marvell/Kconfig"
 source "drivers/net/wireless/mediatek/Kconfig"
 source "drivers/net/wireless/microchip/Kconfig"
+source "drivers/net/wireless/nxp/Kconfig"
 source "drivers/net/wireless/purelifi/Kconfig"
 source "drivers/net/wireless/ralink/Kconfig"
 source "drivers/net/wireless/realtek/Kconfig"
diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile
index e1c4141c6004..0c6b3cc719db 100644
--- a/drivers/net/wireless/Makefile
+++ b/drivers/net/wireless/Makefile
@@ -12,6 +12,7 @@  obj-$(CONFIG_WLAN_VENDOR_INTERSIL) += intersil/
 obj-$(CONFIG_WLAN_VENDOR_MARVELL) += marvell/
 obj-$(CONFIG_WLAN_VENDOR_MEDIATEK) += mediatek/
 obj-$(CONFIG_WLAN_VENDOR_MICROCHIP) += microchip/
+obj-$(CONFIG_WLAN_VENDOR_NXP) += nxp/
 obj-$(CONFIG_WLAN_VENDOR_PURELIFI) += purelifi/
 obj-$(CONFIG_WLAN_VENDOR_QUANTENNA) += quantenna/
 obj-$(CONFIG_WLAN_VENDOR_RALINK) += ralink/
diff --git a/drivers/net/wireless/nxp/Kconfig b/drivers/net/wireless/nxp/Kconfig
new file mode 100644
index 000000000000..68b32d4536e5
--- /dev/null
+++ b/drivers/net/wireless/nxp/Kconfig
@@ -0,0 +1,17 @@ 
+# SPDX-License-Identifier: GPL-2.0-only
+config WLAN_VENDOR_NXP
+	bool "NXP devices"
+	default y
+	help
+	  If you have a wireless card belonging to this class, say Y.
+
+	  Note that the answer to this question doesn't directly affect the
+	  kernel: saying N will just cause the configurator to skip all the
+	  questions about these cards. If you say Y, you will be asked for
+	  your specific card in the following questions.
+
+if WLAN_VENDOR_NXP
+
+source "drivers/net/wireless/nxp/nxpwifi/Kconfig"
+
+endif # WLAN_VENDOR_NXP
diff --git a/drivers/net/wireless/nxp/Makefile b/drivers/net/wireless/nxp/Makefile
new file mode 100644
index 000000000000..27b41a0afdd2
--- /dev/null
+++ b/drivers/net/wireless/nxp/Makefile
@@ -0,0 +1,3 @@ 
+# SPDX-License-Identifier: GPL-2.0-only
+
+obj-$(CONFIG_NXPWIFI)	+= nxpwifi/
diff --git a/drivers/net/wireless/nxp/nxpwifi/Kconfig b/drivers/net/wireless/nxp/nxpwifi/Kconfig
new file mode 100644
index 000000000000..3637068574b8
--- /dev/null
+++ b/drivers/net/wireless/nxp/nxpwifi/Kconfig
@@ -0,0 +1,22 @@ 
+# SPDX-License-Identifier: GPL-2.0-only
+config NXPWIFI
+	tristate "NXP WiFi Driver"
+	depends on CFG80211
+	help
+	  This adds support for wireless adapters based on NXP
+	  802.11n/ac chipsets.
+
+	  If you choose to build it as a module, it will be called
+	  nxpwifi.
+
+config NXPWIFI_SDIO
+	tristate "NXP WiFi Driver for IW61x"
+	depends on NXPWIFI && MMC
+	select FW_LOADER
+	select WANT_DEV_COREDUMP
+	help
+	  This adds support for wireless adapters based on NXP
+	  IW61x interface.
+
+	  If you choose to build it as a module, it will be called
+	  nxpwifi_sdio.
diff --git a/drivers/net/wireless/nxp/nxpwifi/Makefile b/drivers/net/wireless/nxp/nxpwifi/Makefile
new file mode 100644
index 000000000000..a9e5a528324b
--- /dev/null
+++ b/drivers/net/wireless/nxp/nxpwifi/Makefile
@@ -0,0 +1,38 @@ 
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Copyright 2011-2020 NXP
+#
+
+
+nxpwifi-y += main.o
+nxpwifi-y += init.o
+nxpwifi-y += cfp.o
+nxpwifi-y += cmdevt.o
+nxpwifi-y += util.o
+nxpwifi-y += txrx.o
+nxpwifi-y += wmm.o
+nxpwifi-y += 11n.o
+nxpwifi-y += 11ac.o
+nxpwifi-y += 11n_aggr.o
+nxpwifi-y += 11n_rxreorder.o
+nxpwifi-y += scan.o
+nxpwifi-y += join.o
+nxpwifi-y += sta_ioctl.o
+nxpwifi-y += sta_cmd.o
+nxpwifi-y += uap_cmd.o
+nxpwifi-y += ie.o
+nxpwifi-y += sta_event.o
+nxpwifi-y += uap_event.o
+nxpwifi-y += sta_tx.o
+nxpwifi-y += sta_rx.o
+nxpwifi-y += uap_txrx.o
+nxpwifi-y += cfg80211.o
+nxpwifi-y += ethtool.o
+nxpwifi-y += 11h.o
+nxpwifi-$(CONFIG_DEBUG_FS) += debugfs.o
+obj-$(CONFIG_NXPWIFI) += nxpwifi.o
+
+nxpwifi_sdio-y += sdio.o
+obj-$(CONFIG_NXPWIFI_SDIO) += nxpwifi_sdio.o
+
+ccflags-y += -D__CHECK_ENDIAN