DEBUG: be sure this will be printed
[wave300.git] / wireless / driver / linux / mtlk_df_user.c
blob46a2d576abf010a5f1b8dbb1cfaf0de05d8d05d0
1 /******************************************************************************
3 Copyright (c) 2012
4 Lantiq Deutschland GmbH
6 For licensing information, see the file 'LICENSE' in the root folder of
7 this software module.
9 ******************************************************************************/
11 * $Id$
15 * Driver framework implementation for Linux
19 #include "mtlkinc.h"
20 #include "mtlk_clipboard.h"
21 #include "mtlk_coreui.h"
22 #include "mtlk_df_priv.h"
23 #include "core.h"
24 #include "mtlk_snprintf.h"
25 #include "wpa.h"
26 #include "mtlk_df.h"
27 #include "mtlk_df_nbuf.h"
29 #include <linux/wireless.h>
30 #include <linux/if_arp.h>
31 #include <net/iw_handler.h>
32 #include <asm/unaligned.h>
34 #ifdef MTLK_HAVE_PPA
35 #if defined(CONFIG_IFX_PPA_API_DIRECTPATH)
36 /* UGW 5.4 and older */
37 #include <net/ifx_ppa_api.h>
38 #include <net/ifx_ppa_hook.h>
39 #include <switch_api/ifx_ethsw_kernel_api.h>
40 #include <switch_api/ifx_ethsw_api.h>
42 #define PPA_SUCCESS IFX_SUCCESS
43 #define LTQ_ETHSW_API_HANDLE IFX_ETHSW_HANDLE
44 #define ltq_ethsw_api_kopen(x) ifx_ethsw_kopen(x)
45 #define ltq_ethsw_api_kioctl(x, y, z) ifx_ethsw_kioctl(x, y, z)
46 #define ltq_ethsw_api_kclose(x) ifx_ethsw_kclose(x)
47 #elif defined(CONFIG_LTQ_PPA_API_DIRECTPATH)
48 /* UGW 6.1 and newer */
49 #include <net/ppa_api.h>
50 #include <net/ppa_hook.h>
51 #include <asm/mach-lantiq/xway/switch-api/lantiq_ethsw_api.h>
52 #else
53 #error Invalid PPA configuration
54 #endif
55 #endif /* MTLK_HAVE_PPA */
57 #include "dataex.h"
58 #ifdef MTCFG_IRB_DEBUG
59 #include "mtlk_irb_pinger.h"
60 #endif
62 #include "mtlkaux.h"
63 #include "mtlkwlanirbdefs.h"
65 #include "mtlk_ps.h"
67 #define LOG_LOCAL_GID GID_DFUSER
68 #define LOG_LOCAL_FID 1
70 #define _DF_STAT_POLL_PERIOD (125)
71 #define _DF_RTS_THRESHOLD_MIN 100
72 #define _DF_WAIT_FW_ASSERT 2000
74 #define DF_USER_DEFAULT_IWPRIV_LIM_VALUE (-1)
76 #define MTLK_NIP6(addr) \
77 ntohs((addr).s6_addr16[0]), \
78 ntohs((addr).s6_addr16[1]), \
79 ntohs((addr).s6_addr16[2]), \
80 ntohs((addr).s6_addr16[3]), \
81 ntohs((addr).s6_addr16[4]), \
82 ntohs((addr).s6_addr16[5]), \
83 ntohs((addr).s6_addr16[6]), \
84 ntohs((addr).s6_addr16[7])
86 #define MTLK_NIP6_FMT "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x"
88 #define MTLK_NIPQUAD(addr) \
89 ((unsigned char *)&addr)[0], \
90 ((unsigned char *)&addr)[1], \
91 ((unsigned char *)&addr)[2], \
92 ((unsigned char *)&addr)[3]
94 #define MTLK_NIPQUAD_FMT "%u.%u.%u.%u"
96 static const IEEE_ADDR EMPTY_MAC_MASK = { {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} };
99 /********************************************************************
100 * IW driver IOCTL descriptor table
101 ********************************************************************/
102 extern const struct iw_handler_def mtlk_linux_handler_def;
106 * These magic numbers we got from WEB team.
107 * Should be replaced by meaningful protocol names.
109 enum {
110 NETWORK_MODE_11AN = 14,
111 NETWORK_MODE_11A = 10,
112 NETWORK_MODE_11N5 = 12,
113 NETWORK_MODE_11BGN = 23,
114 NETWORK_MODE_11BG = 19,
115 NETWORK_MODE_11B = 17,
116 NETWORK_MODE_11G = 18,
117 NETWORK_MODE_11N2 = 20,
118 NETWORK_MODE_11GN = 22,
119 NETWORK_MODE_11ABGN = 30,
120 NETWORK_MODE_11ABG = 0,
123 #define MAX_DF_UI_STAT_NAME_LENGTH 256
124 #define UM_DATA_BASE 0x80000000
125 #define UM_DATA_SIZE 0x0003fd00
126 #define AHBUM_DATA_BASE 0x80000000
127 #define AHBUM_DATA_SIZE 0x00100000
128 #define LM_DATA_BASE 0x80080000
129 #define LM_DATA_SIZE 0x00018000
130 #define SHRAM_DATA_BASE 0xa6000000
131 #define SHRAM_DATA_SIZE 0x00020000
133 /* slow context of DF user */
134 struct _mtlk_df_ui_slow_ctx_t
136 /* Core status & statistic */
137 mtlk_core_general_stats_t core_general_stats;
139 struct iw_statistics iw_stats;
140 /* Network device statistics */
141 struct net_device_stats linux_stats;
143 /**** BCL data *****/
144 uint32 *dbg_general_pkt_cnts;
145 uint32 dbg_general_pkt_cnts_num;
146 IEEE_ADDR *dbg_general_pkt_addr;
147 uint32 dbg_general_pkt_addr_num;
148 uint32 *dbg_rr_cnts;
149 uint32 dbg_rr_cnts_num;
150 IEEE_ADDR *dbg_rr_addr;
151 uint32 dbg_rr_addr_num;
152 /*******************/
154 mtlk_osal_timer_t stat_timer;
156 mtlk_df_proc_fs_node_t *proc_df_node;
157 mtlk_df_proc_fs_node_t *proc_df_debug_node;
159 #ifdef MTCFG_IRB_DEBUG
160 mtlk_irb_pinger_t pinger;
161 #endif
164 #ifdef MTLK_HAVE_PPA
165 typedef struct _mtlk_df_user_ppa_stats_t
167 uint32 tx_processed;
168 uint32 rx_accepted;
169 uint32 rx_rejected;
170 } mtlk_df_user_ppa_stats_t;
172 typedef struct _mtlk_df_user_ppa_t
174 PPA_DIRECTPATH_CB clb;
175 uint32 if_id;
176 mtlk_df_user_ppa_stats_t stats;
177 volatile BOOL is_active; /** store internal PPA registration state. */
178 } mtlk_df_user_ppa_t;
179 #endif /* MTLK_HAVE_PPA */
181 struct _mtlk_df_user_t
183 struct _mtlk_df_t *df;
184 struct net_device *dev;
186 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
187 struct net_device_ops dev_ops;
188 #endif
190 struct _mtlk_df_ui_slow_ctx_t *slow_ctx;
192 #ifdef MTLK_HAVE_PPA
193 mtlk_df_user_ppa_t ppa;
194 #endif
195 mtlk_osal_event_t fw_hang_evts[NUM_OF_MIPS];
198 MTLK_DECLARE_INIT_LOOP(FW_HANG_EVTs);
199 MTLK_DECLARE_INIT_LOOP(PROC_INIT);
200 MTLK_DECLARE_INIT_LOOP(PROC_CARD_INIT);
201 MTLK_DECLARE_INIT_STATUS;
202 MTLK_DECLARE_START_STATUS;
205 /********************************************************************
206 * Tools API definitions
207 ********************************************************************/
208 static uint8 __MTLK_IFUNC
209 _net_mode_ingress_filter (uint8 ingress_net_mode);
210 static uint8 __MTLK_IFUNC
211 _net_mode_egress_filter (uint8 egress_net_mode);
213 static void
214 mtlk_df_debug_bcl_cleanup(mtlk_df_user_t *df_user);
215 static int
216 mtlk_df_debug_bcl_init(mtlk_df_user_t *df_user);
218 /*****************************************************************************
219 *****************************************************************************/
220 static int
221 _mtlk_df_user_fill_ether_address(IEEE_ADDR *mac_addr, struct sockaddr *sa);
223 /*****************************************************************************
225 ** NAME mtlk_df_traffic_classifier_register / mtlk_df_traffic_classifier_unregister
227 ** DESCRIPTION This functions are used for registration of External Metalink's
228 ** traffic classifier module
230 ******************************************************************************/
231 int mtlk_df_traffic_classifier_register(void * classify_fn);
232 void mtlk_df_traffic_classifier_unregister(void);
233 EXPORT_SYMBOL(mtlk_df_traffic_classifier_register);
234 EXPORT_SYMBOL(mtlk_df_traffic_classifier_unregister);
236 int mtlk_df_traffic_classifier_register (void * classify_fn)
238 mtlk_qos_classifier_register((mtlk_qos_do_classify_f)classify_fn);
239 return 0; /*mtlk_err_to_linux_err(res)*/
243 void mtlk_df_traffic_classifier_unregister (void)
245 mtlk_qos_classifier_unregister();
248 /*****************************************************************************
249 *****************************************************************************/
250 static __INLINE uint32
251 _mtlk_df_user_get_core_slave_vap_index_by_iwpriv_param (uint32 iwpriv_slave_vap_index)
253 /* DF iwpriv commands use 0-based VAP index for Slave VAPs, while Core
254 * uses 0-based numeration for *all* the VAPs, including the Master.
255 * This function translates the DFs Slave VAP Index to a Cores one.
257 return (iwpriv_slave_vap_index + 1);
260 static int
261 _mtlk_df_mtlk_to_linux_error_code(int mtlk_res)
263 int linux_res;
265 switch (mtlk_res) {
267 case MTLK_ERR_OK:
268 linux_res = 0;
269 break;
271 case MTLK_ERR_PARAMS:
272 case MTLK_ERR_VALUE:
273 linux_res = -EINVAL;
274 break;
276 case MTLK_ERR_NO_MEM:
277 linux_res = -ENOMEM;
278 break;
280 case MTLK_ERR_PENDING:
281 linux_res = -EINPROGRESS;
282 break;
284 case MTLK_ERR_BUSY:
285 linux_res = -EBUSY;
286 break;
288 case MTLK_ERR_EEPROM:
289 case MTLK_ERR_HW:
290 case MTLK_ERR_FW:
291 case MTLK_ERR_UMI:
292 case MTLK_ERR_MAC:
293 linux_res = -EFAULT;
294 break;
296 case MTLK_ERR_TIMEOUT:
297 linux_res = -ETIME;
298 break;
300 case MTLK_ERR_NOT_READY:
301 linux_res = -EAGAIN;
302 break;
304 case MTLK_ERR_NOT_SUPPORTED:
305 linux_res = -EOPNOTSUPP;
306 break;
308 case MTLK_ERR_NOT_IN_USE:
309 case MTLK_ERR_NO_RESOURCES:
310 case MTLK_ERR_WRONG_CONTEXT:
311 case MTLK_ERR_SCAN_FAILED:
312 case MTLK_ERR_AOCS_FAILED:
313 case MTLK_ERR_PROHIB:
314 case MTLK_ERR_BUF_TOO_SMALL:
315 case MTLK_ERR_PKT_DROPPED:
316 case MTLK_ERR_FILEOP:
317 case MTLK_ERR_CANCELED:
318 case MTLK_ERR_NOT_HANDLED:
319 case MTLK_ERR_UNKNOWN:
320 linux_res = -EFAULT;
321 break;
323 case MTLK_ERR_DATA_TOO_BIG:
324 linux_res = -E2BIG;
325 break;
327 default :
328 linux_res = -EFAULT;
329 break;
332 return linux_res;
335 /* User-friendly interface/device name */
336 const char*
337 mtlk_df_user_get_name(mtlk_df_user_t *df_user)
339 MTLK_ASSERT(NULL != df_user);
340 return df_user->dev->name;
343 const uint32
344 mtlk_df_user_get_flags(mtlk_df_user_t *df_user)
346 MTLK_ASSERT(NULL != df_user);
347 MTLK_ASSERT(NULL != df_user->dev);
349 return df_user->dev->flags;
353 mtlk_df_user_set_flags(mtlk_df_user_t *df_user, uint32 newflags)
355 int res = MTLK_ERR_OK;
356 MTLK_ASSERT(NULL != df_user);
357 MTLK_ASSERT(NULL != df_user->dev);
359 rtnl_lock();
360 res = dev_change_flags(df_user->dev, newflags);
361 rtnl_unlock();
363 return res;
366 /* Layer-2 subsystem access */
367 void __MTLK_IFUNC
368 mtlk_df_ui_set_mac_addr(mtlk_df_t *df, const uint8* mac_addr)
370 MTLK_ASSERT(NULL != df);
371 MTLK_ASSERT(NULL != mac_addr);
373 mtlk_osal_copy_eth_addresses(mtlk_df_get_user(df)->dev->dev_addr, mac_addr);
376 const uint8* __MTLK_IFUNC
377 mtlk_df_ui_get_mac_addr(mtlk_df_t* df)
379 MTLK_ASSERT(NULL != df);
381 return mtlk_df_get_user(df)->dev->dev_addr;
384 BOOL __MTLK_IFUNC
385 mtlk_df_ui_is_promiscuous(mtlk_df_t *df)
387 MTLK_ASSERT(NULL != df);
388 return mtlk_df_get_user(df)->dev->promiscuity ? TRUE : FALSE;
391 void __MTLK_IFUNC
392 mtlk_df_ui_notify_tx_start(mtlk_df_t *df)
394 struct netdev_queue *txq;
396 MTLK_ASSERT(NULL != df);
398 //fixes build for x86_64. tested up to linux 4.8
399 txq = netdev_get_tx_queue(mtlk_df_get_user(df)->dev, 0);
400 if (txq->trans_start != jiffies)
401 txq->trans_start = jiffies;
404 MTLK_INIT_STEPS_LIST_BEGIN(df_user)
405 MTLK_INIT_STEPS_LIST_ENTRY(df_user, ALLOC_SLOW_CTX)
406 MTLK_INIT_STEPS_LIST_ENTRY(df_user, DEBUG_BCL)
407 MTLK_INIT_STEPS_LIST_ENTRY(df_user, ALLOC_NAME)
408 MTLK_INIT_STEPS_LIST_ENTRY(df_user, CREATE_CARD_DIR)
409 MTLK_INIT_STEPS_LIST_ENTRY(df_user, CREATE_DEBUG_DIR)
410 MTLK_INIT_STEPS_LIST_ENTRY(df_user, STAT_TIMER)
411 #ifdef MTCFG_IRB_DEBUG
412 MTLK_INIT_STEPS_LIST_ENTRY(df_user, IRB_PINGER_INIT)
413 #endif
414 MTLK_INIT_STEPS_LIST_ENTRY(df_user, PROC_INIT)
415 MTLK_INIT_STEPS_LIST_ENTRY(df_user, PROC_CARD_INIT)
416 MTLK_INIT_STEPS_LIST_ENTRY(df_user, FW_HANG_EVTs)
417 MTLK_INIT_INNER_STEPS_BEGIN(df_user)
418 MTLK_INIT_STEPS_LIST_END(df_user);
420 static int
421 _mtlk_df_user_start_tx(struct sk_buff *skb, struct net_device *dev)
423 mtlk_df_user_t* df_user = (mtlk_df_user_t*) netdev_priv(skb->dev);
425 MTLK_UNREFERENCED_PARAM(dev);
426 MTLK_ASSERT(NULL != skb);
427 MTLK_ASSERT(NULL != df_user);
429 mtlk_nbuf_priv_init(mtlk_nbuf_priv(skb));
431 mtlk_nbuf_start_tracking(skb);
432 mtlk_core_handle_tx_data(mtlk_df_get_vap_handle(df_user->df), skb);
433 return NETDEV_TX_OK;
436 /********************************************************************
437 * PPA supprting functionality BEGIN
438 ********************************************************************/
439 #ifdef MTLK_HAVE_PPA
441 uint32 _mtlk_df_user_ppa_tx_sent_up = 0;
442 uint32 _mtlk_df_user_ppa_tx_dropped = 0;
444 static int
445 _mtlk_df_user_ppa_start_xmit (struct net_device *rx_dev,
446 struct net_device *tx_dev,
447 struct sk_buff *skb,
448 int len)
451 if (tx_dev != NULL) {
452 mtlk_df_user_t* df_user = (mtlk_df_user_t*) netdev_priv(skb->dev);
454 ++df_user->ppa.stats.tx_processed;
456 skb->dev = tx_dev;
457 _mtlk_df_user_start_tx(skb, tx_dev);
459 else if (rx_dev != NULL)
461 int res;
462 MTLK_ASSERT(NULL != skb->dev);
463 /* as usual shift the eth header with skb->data */
464 skb->protocol = eth_type_trans(skb, skb->dev);
465 /* push up to protocol stacks */
466 res = netif_rx(skb);
467 pr_info("_mtlk_df_user_ppa_start_xmit, netif_rx res=%i\n", res);
469 ++_mtlk_df_user_ppa_tx_sent_up;
471 else {
472 dev_kfree_skb_any(skb);
473 ++_mtlk_df_user_ppa_tx_dropped;
476 return 0;
479 BOOL __MTLK_IFUNC
480 _mtlk_df_user_ppa_is_available (void)
482 return (ppa_hook_directpath_register_dev_fn != NULL);
485 BOOL __MTLK_IFUNC
486 _mtlk_df_user_ppa_is_registered (mtlk_df_user_t* df_user)
488 MTLK_ASSERT(df_user != NULL);
490 return (NULL != df_user->ppa.clb.rx_fn);
493 int __MTLK_IFUNC
494 _mtlk_df_user_ppa_register (mtlk_df_user_t* df_user)
496 int res = MTLK_ERR_UNKNOWN;
497 uint32 ppa_res;
499 MTLK_ASSERT(df_user != NULL);
500 MTLK_ASSERT(_mtlk_df_user_ppa_is_registered(df_user) == FALSE);
502 if (_mtlk_df_user_ppa_is_available() == FALSE) {
503 res = MTLK_ERR_NOT_SUPPORTED;
504 goto end;
507 memset(&df_user->ppa.clb, 0, sizeof(df_user->ppa.clb));
509 df_user->ppa.clb.rx_fn = _mtlk_df_user_ppa_start_xmit;
511 ppa_res =
512 ppa_hook_directpath_register_dev_fn(&df_user->ppa.if_id,
513 df_user->dev, &df_user->ppa.clb,
514 PPA_F_DIRECTPATH_REGISTER | PPA_F_DIRECTPATH_ETH_IF);
516 if (ppa_res != PPA_SUCCESS)
518 df_user->ppa.clb.rx_fn = NULL;
519 ELOG_D("Can't register PPA device function (err=%d)", ppa_res);
520 res = MTLK_ERR_UNKNOWN;
521 goto end;
524 /* At this point we can send packets via PPA */
525 df_user->ppa.is_active = TRUE;
527 ILOG0_D("PPA device function is registered (id=%d)", df_user->ppa.if_id);
528 res = MTLK_ERR_OK;
530 end:
531 return res;
534 void __MTLK_IFUNC
535 _mtlk_df_user_ppa_unregister (mtlk_df_user_t* df_user)
537 uint32 ppa_res;
539 MTLK_ASSERT(df_user != NULL);
540 MTLK_ASSERT(_mtlk_df_user_ppa_is_registered(df_user) == TRUE);
542 /* Stop sending packets before unregistration */
543 df_user->ppa.is_active = FALSE;
545 ppa_res =
546 ppa_hook_directpath_register_dev_fn(&df_user->ppa.if_id,
547 df_user->dev, NULL,
548 0/*PPA_F_DIRECTPATH_DEREGISTER*/);
551 if (ppa_res == PPA_SUCCESS) {
552 ILOG0_D("PPA device function is unregistered (id=%d)", df_user->ppa.if_id);
553 df_user->ppa.clb.rx_fn = NULL;
554 df_user->ppa.if_id = 0;
556 else {
557 ELOG_D("Can't unregister PPA device function (err=%d)", ppa_res);
559 /** \tocheck: PPA should not return error during unregistration.
560 * The PPA error have no sense for us during that state.
561 * Anyway we trying to keep the right internal state. */
562 df_user->ppa.is_active = TRUE;
566 void __MTLK_IFUNC
567 _mtlk_df_user_ppa_get_stats (mtlk_df_user_t* df_user,
568 mtlk_df_user_ppa_stats_t *stats)
570 MTLK_ASSERT(df_user != NULL);
571 MTLK_ASSERT(stats != NULL);
573 memcpy(stats, &df_user->ppa.stats, sizeof(df_user->ppa.stats));
576 void __MTLK_IFUNC
577 _mtlk_df_user_ppa_zero_stats (mtlk_df_user_t* df_user)
579 MTLK_ASSERT(df_user != NULL);
580 memset(&df_user->ppa.stats, 0, sizeof(df_user->ppa.stats));
582 #endif /* MTLK_HAVE_PPA */
585 static void
586 _mtlk_df_priv_xface_start (mtlk_df_user_t* df_user)
588 #ifdef MTLK_HAVE_PPA
589 _mtlk_df_user_ppa_register(df_user);
590 #endif /* MTLK_HAVE_PPA */
593 static void
594 _mtlk_df_priv_xface_stop (mtlk_df_user_t* df_user)
596 #ifdef MTLK_HAVE_PPA
597 if (_mtlk_df_user_ppa_is_registered(df_user)) {
598 _mtlk_df_user_ppa_unregister(df_user);
600 #endif /* MTLK_HAVE_PPA */
603 /********************************************************************
604 * PPA supprting functionality END
605 ********************************************************************/
607 static int
608 _mtlk_df_user_iface_open(struct net_device *dev)
610 mtlk_df_user_t* df_user = (mtlk_df_user_t*) netdev_priv(dev);
611 mtlk_clpb_t *clpb = NULL;
612 int res;
614 MTLK_ASSERT(NULL != df_user);
616 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_ACTIVATE_OPEN, &clpb, NULL, 0);
617 res = _mtlk_df_user_process_core_retval(res, clpb, MTLK_CORE_REQ_ACTIVATE_OPEN, TRUE);
619 return (MTLK_ERR_OK == res) ? 0 : -EAGAIN;
622 static int
623 _mtlk_df_user_iface_stop(struct net_device *dev)
625 mtlk_df_user_t* df_user = (mtlk_df_user_t*) netdev_priv(dev);
626 mtlk_clpb_t *clpb = NULL;
627 int res;
629 MTLK_ASSERT(NULL != df_user);
631 ILOG1_S("%s: stop the interface", mtlk_df_user_get_name(df_user));
634 The following loop was implemented since the OS might not
635 interpret an -EAGAIN error code correctly and hence will not
636 repeat calling _mtlk_df_user_iface_stop - in case retry is
637 needed.
640 do {
641 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_DEACTIVATE, &clpb, NULL, 0);
642 res = _mtlk_df_user_process_core_retval(res, clpb, MTLK_CORE_REQ_DEACTIVATE, TRUE);
643 mtlk_osal_msleep(100);
644 } while ((MTLK_ERR_OK != res) && (MTLK_ERR_FW != res));
646 return 0;
649 int __MTLK_IFUNC
650 mtlk_df_ui_linux_ioctl_setap (struct net_device *dev,
651 struct iw_request_info *info,
652 struct sockaddr *sa,
653 char *extra)
655 mtlk_df_user_t* df_user = (mtlk_df_user_t*) netdev_priv(dev);
656 mtlk_clpb_t *clpb = NULL;
657 int res = MTLK_ERR_NOT_SUPPORTED;
659 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
661 if (!netif_running(dev)) {
662 ILOG0_V("You should bring interface up first");
663 goto finish;
666 if (is_broadcast_ether_addr(sa->sa_data)) goto finish;
668 if (is_zero_ether_addr(sa->sa_data)) {
669 res = MTLK_ERR_OK;
670 goto finish;
673 ILOG1_SY("%s: Handle request: connect to %Y", dev->name, sa->sa_data);
675 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_CONNECT_STA,
676 &clpb, &sa->sa_data, sizeof(sa->sa_data));
677 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_CONNECT_STA, TRUE);
679 finish:
680 return _mtlk_df_mtlk_to_linux_error_code(res);
683 int __MTLK_IFUNC
684 mtlk_df_ui_linux_ioctl_setmlme (struct net_device *dev,
685 struct iw_request_info *info,
686 struct iw_point *data,
687 char *extra)
689 int res = MTLK_ERR_NOT_SUPPORTED;
690 mtlk_df_user_t* df_user = (mtlk_df_user_t*) netdev_priv(dev);
691 mtlk_clpb_t *clpb = NULL;
692 struct iw_mlme *mlme = (struct iw_mlme *) extra;
693 mtlk_core_ui_mlme_cfg_t mlme_cfg;
695 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
697 if (NULL == mlme) {
698 res = MTLK_ERR_PARAMS;
699 goto finish;
702 if (!netif_running(dev)) {
703 if(mtlk_osal_eth_is_broadcast(mlme->addr.sa_data)){
704 if((mlme->cmd == IW_MLME_DEAUTH) || (mlme->cmd == IW_MLME_DISASSOC)){
705 res = MTLK_ERR_OK;
706 goto finish;
710 ILOG0_V("You should bring interface up first");
711 goto finish;
714 memset(&mlme_cfg, 0, sizeof(mlme_cfg));
716 mlme_cfg.cmd = mlme->cmd;
717 mlme_cfg.reason_code = mlme->reason_code;
718 res = _mtlk_df_user_fill_ether_address(&mlme_cfg.sta_addr, &mlme->addr);
719 if (MTLK_ERR_OK != res) {
720 WLOG_SY("%s: Invalid address (%Y)", dev->name, mlme->addr.sa_data);
721 goto finish;
724 ILOG2_DD("MLME cmd %i reason_code %i", mlme->cmd, mlme->reason_code);
726 switch (mlme->cmd) {
727 case IW_MLME_DEAUTH:
728 case IW_MLME_DISASSOC:
729 ILOG1_SY("%s: Got MLME Disconnect/Disassociate ioctl (%Y)", dev->name, mlme->addr.sa_data);
730 if (!mtlk_df_is_ap(df_user->df)) {
731 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_DISCONNECT_STA,
732 &clpb, (char*)&mlme_cfg, sizeof(mlme_cfg));
733 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_DISCONNECT_STA, TRUE);
735 else if(mtlk_osal_eth_is_broadcast(mlme->addr.sa_data)) {
736 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_AP_DISCONNECT_ALL,
737 &clpb, (char*)&mlme_cfg, sizeof(mlme_cfg));
738 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_AP_DISCONNECT_ALL, TRUE);
740 else if(!mtlk_osal_is_valid_ether_addr(mlme->addr.sa_data)) {
741 ILOG1_SY("%s: Invalid MAC address (%Y)!", dev->name, mlme->addr.sa_data);
742 res = MTLK_ERR_PARAMS;
743 goto finish;
745 else {
746 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_AP_DISCONNECT_STA,
747 &clpb, (char*)&mlme_cfg, sizeof(mlme_cfg));
748 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_AP_DISCONNECT_STA, TRUE);
750 break;
751 default:
752 res = MTLK_ERR_NOT_SUPPORTED;
753 goto finish;
757 finish:
758 return _mtlk_df_mtlk_to_linux_error_code(res);
762 \fn mtlk_df_ui_linux_ioctl_set_scan()
763 \param net_device Network device for scan to be performed on
764 \param extra Scan options (if any) starting from WE18
765 \return Zero on success, negative error code on failure
766 \brief Handle 'start scan' request
768 Handler for SIOCSIWSCAN - request for scan schedule. Process scan
769 options (if any), and schedule scan. If scan already running - return
770 zero, to avoid 'setscan-getscan' infinite loops in user applications.
771 If scheduling succeed - return zero. If scan can't be started - return
772 -EAGAIN
774 int __MTLK_IFUNC
775 mtlk_df_ui_linux_ioctl_set_scan (struct net_device *dev,
776 struct iw_request_info *info,
777 union iwreq_data *wrqu,
778 char *extra)
780 int res = MTLK_ERR_NOT_SUPPORTED;
781 mtlk_df_user_t* df_user = (mtlk_df_user_t*) netdev_priv(dev);
782 mtlk_clpb_t *clpb = NULL;
783 char *essid = NULL;
784 size_t essid_size = 0;
786 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
788 #if WIRELESS_EXT >= 18
789 /* iwlist wlan0 scan <ESSID> */
790 if (extra && wrqu->data.pointer) {
791 struct iw_scan_req *scanopt = (struct iw_scan_req*)extra;
792 if (wrqu->data.flags & IW_SCAN_THIS_ESSID) {
793 ILOG2_SS("%s: Set ESSID pattern to (%s)", dev->name, scanopt->essid);
794 essid = scanopt->essid;
795 essid_size = sizeof(scanopt->essid);
798 #endif
800 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_START_SCANNING,
801 &clpb, essid, essid_size);
802 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_START_SCANNING, TRUE);
804 return _mtlk_df_mtlk_to_linux_error_code(res);
807 static uint8
808 _mtlk_df_ui_calc_signal_strength(int8 RSSI)
810 uint8 sig_strength = 1;
812 if (RSSI > -65)
813 sig_strength = 5;
814 else if (RSSI > -71)
815 sig_strength = 4;
816 else if (RSSI > -77)
817 sig_strength = 3;
818 else if (RSSI > -83)
819 sig_strength = 2;
821 return sig_strength;
825 \fn mtlk_df_ui_linux_ioctl_get_scan_results()
826 \return Zero and scan results on success, negative error code on failure
827 \brief Handle 'get scan results' request
829 Handler for SIOCGIWSCAN - request for scan results. If scan running -
830 return -EAGAIN and required buffer size. If not enough memory to store
831 all scan results - return -E2BIG. On success return zero and cached
832 scan results
834 int __MTLK_IFUNC
835 mtlk_df_ui_linux_ioctl_get_scan_results (struct net_device *dev,
836 struct iw_request_info *info,
837 union iwreq_data *wrqu,
838 char *extra)
840 int res = MTLK_ERR_NOT_SUPPORTED;
841 mtlk_df_user_t *df_user = (mtlk_df_user_t*) netdev_priv(dev);
842 mtlk_clpb_t *clpb = NULL;
844 bss_data_t *bss_found;
845 struct iw_event iwe;
846 char *stream;
847 char *border;
848 size_t size;
849 char *work_str;
850 char buf[32]; /* used for 3 RSSI string: "-xxx:-xxx:-xxx dBm" */
852 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
854 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_GET_SCANNING_RES,
855 &clpb, NULL, 0);
856 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_SCANNING_RES, FALSE);
857 if (MTLK_ERR_OK != res) {
858 goto finish;
861 memset(extra, 0, wrqu->data.length);
862 stream = extra;
863 border = extra + wrqu->data.length;
864 size = 0;
866 /* Process scanning results */
867 while(NULL != (bss_found = mtlk_clpb_enum_get_next(clpb, NULL))) {
869 ILOG1_SYD("\"%-32s\" %Y %3i", bss_found->essid, bss_found->bssid, bss_found->channel);
871 iwe.cmd = SIOCGIWAP;
872 memcpy(iwe.u.ap_addr.sa_data, bss_found->bssid, ETH_ALEN);
873 iwe.u.ap_addr.sa_family = ARPHRD_IEEE80211;
874 size += IW_EV_ADDR_LEN;
875 stream = mtlk_iwe_stream_add_event(info, stream, border, &iwe, IW_EV_ADDR_LEN);
877 iwe.cmd = SIOCGIWESSID;
878 iwe.u.data.length = strnlen(bss_found->essid, IW_ESSID_MAX_SIZE);
879 iwe.u.data.flags = 1;
880 size += IW_EV_POINT_LEN + iwe.u.data.length;
881 stream = mtlk_iwe_stream_add_point(info, stream, border, &iwe, bss_found->essid);
883 iwe.cmd = SIOCGIWFREQ;
884 iwe.u.freq.m = bss_found->channel;
885 iwe.u.freq.e = 0;
886 size += IW_EV_FREQ_LEN;
887 stream = mtlk_iwe_stream_add_event(info, stream, border, &iwe, IW_EV_FREQ_LEN);
889 if (RSN_IE_SIZE(bss_found)) {
890 iwe.cmd = IWEVGENIE;
891 iwe.u.data.length = RSN_IE_SIZE(bss_found) + sizeof(ie_t);
892 size += IW_EV_POINT_LEN + iwe.u.data.length;
893 stream = mtlk_iwe_stream_add_point(info, stream, border, &iwe, RSN_IE(bss_found));
896 if (WPA_IE_SIZE(bss_found)) {
897 iwe.cmd = IWEVGENIE;
898 iwe.u.data.length = WPA_IE_SIZE(bss_found) + sizeof(ie_t);
899 size += IW_EV_POINT_LEN + iwe.u.data.length;
900 stream = mtlk_iwe_stream_add_point(info, stream, border, &iwe, WPA_IE(bss_found));
903 if (WPS_IE_SIZE(bss_found)) {
904 iwe.cmd = IWEVGENIE;
905 iwe.u.data.length = WPS_IE_SIZE(bss_found) + sizeof(ie_t);
906 size += IW_EV_POINT_LEN + iwe.u.data.length;
907 stream = mtlk_iwe_stream_add_point(info, stream, border, &iwe, WPS_IE(bss_found));
910 iwe.cmd = SIOCGIWENCODE;
911 iwe.u.data.flags = BSS_IS_WEP_ENABLED(bss_found)? IW_ENCODE_ENABLED:IW_ENCODE_DISABLED;
912 iwe.u.data.length = 0;
913 size += IW_EV_POINT_LEN;
914 stream = mtlk_iwe_stream_add_point(info, stream, border, &iwe, NULL);
916 iwe.cmd = IWEVQUAL;
917 iwe.u.qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
918 iwe.u.qual.qual = _mtlk_df_ui_calc_signal_strength(MTLK_NORMALIZED_RSSI(bss_found->max_rssi));
919 iwe.u.qual.level = bss_found->max_rssi;
920 iwe.u.qual.noise = bss_found->noise;
921 size += IW_EV_QUAL_LEN;
922 stream = mtlk_iwe_stream_add_event(info, stream, border, &iwe, IW_EV_QUAL_LEN);
924 iwe.cmd = IWEVCUSTOM;
925 work_str = (bss_found->is_2_4)? "2.4 band":"5.2 band";
926 iwe.u.data.length = strlen(work_str);
927 size += IW_EV_POINT_LEN + iwe.u.data.length;
928 stream = mtlk_iwe_stream_add_point(info, stream, border, &iwe, work_str);
930 iwe.cmd = IWEVCUSTOM;
931 work_str = (bss_found->is_ht)? "HT":"not HT";
932 iwe.u.data.length = strlen(work_str);
933 size += IW_EV_POINT_LEN + iwe.u.data.length;
934 stream = mtlk_iwe_stream_add_point(info, stream, border, &iwe, work_str);
936 iwe.cmd = IWEVCUSTOM;
937 work_str = (bss_found->spectrum == SPECTRUM_40MHZ)? "40 MHz":"20 MHz";
938 iwe.u.data.length = strlen(work_str);
939 size += IW_EV_POINT_LEN + iwe.u.data.length;
940 stream = mtlk_iwe_stream_add_point(info, stream, border, &iwe, work_str);
942 iwe.cmd = IWEVCUSTOM;
943 work_str = WPS_IE_FOUND(bss_found)? "WPS":"not WPS";
944 iwe.u.data.length = strlen(work_str);
945 size += IW_EV_POINT_LEN + iwe.u.data.length;
946 stream = mtlk_iwe_stream_add_point(info, stream, border, &iwe, work_str);
948 iwe.cmd = IWEVCUSTOM;
949 sprintf(buf, "%d:%d:%d dBm",
950 MTLK_NORMALIZED_RSSI(bss_found->all_rssi[0]),
951 MTLK_NORMALIZED_RSSI(bss_found->all_rssi[1]),
952 MTLK_NORMALIZED_RSSI(bss_found->all_rssi[2]));
953 work_str = buf;
954 iwe.u.data.length = strlen(work_str);
955 size += IW_EV_POINT_LEN + iwe.u.data.length;
956 stream = mtlk_iwe_stream_add_point(info, stream, border, &iwe, work_str);
959 wrqu->data.length = size;
960 if (stream - extra < size) {
961 ILOG1_S("%s: Can't get scan results - buffer is not big enough", dev->name);
962 res = MTLK_ERR_DATA_TOO_BIG;
965 mtlk_clpb_delete(clpb);
966 finish:
967 return _mtlk_df_mtlk_to_linux_error_code(res);
971 static int
972 _mtlk_df_user_set_mac_addr_internal (struct net_device *dev,
973 struct sockaddr *addr)
975 mtlk_df_user_t* df_user = (mtlk_df_user_t*) netdev_priv(dev);
976 mtlk_clpb_t *clpb = NULL;
977 int res = MTLK_ERR_BUSY;
979 MTLK_ASSERT(NULL != df_user);
981 /* Allow to set MAC address only if !IFF_UP */
982 if (dev->flags & IFF_UP) {
983 WLOG_S("%s: Can't set MAC address with IFF_UP set", dev->name);
984 goto finish;
987 /* Validate address family */
988 if ((addr->sa_family != ARPHRD_IEEE80211) && (addr->sa_family != ARPHRD_ETHER)) {
989 WLOG_S("%s: Can't set MAC address - invalid sa_family", dev->name);
990 res = MTLK_ERR_PARAMS;
991 goto finish;
994 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_SET_MAC_ADDR,
995 &clpb, addr->sa_data, sizeof(addr->sa_data));
996 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_SET_MAC_ADDR, TRUE);
998 if(MTLK_ERR_OK == res)
1000 mtlk_osal_copy_eth_addresses(dev->dev_addr, addr->sa_data);
1003 finish:
1004 return _mtlk_df_mtlk_to_linux_error_code(res);
1007 static int
1008 _mtlk_df_user_set_mac_addr (struct net_device *dev, void* p)
1010 return _mtlk_df_user_set_mac_addr_internal(dev, (struct sockaddr *)p);
1013 int __MTLK_IFUNC
1014 mtlk_df_ui_linux_ioctl_set_mac_addr (struct net_device *dev,
1015 struct iw_request_info *info,
1016 union iwreq_data *wrqu,
1017 char *extra)
1019 return _mtlk_df_user_set_mac_addr_internal(dev, &wrqu->addr);
1022 int __MTLK_IFUNC
1023 mtlk_df_ui_linux_ioctl_get_mac_addr (struct net_device *dev,
1024 struct iw_request_info *info,
1025 union iwreq_data *wrqu,
1026 char *extra)
1028 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
1029 mtlk_clpb_t *clpb;
1030 int res = MTLK_ERR_PARAMS;
1031 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_GET_MAC_ADDR,
1032 &clpb, NULL, 0);
1033 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_MAC_ADDR, FALSE);
1034 if(MTLK_ERR_OK == res)
1036 int mac_addr_size;
1037 void* mac_addr = mtlk_clpb_enum_get_next(clpb, &mac_addr_size);
1038 MTLK_ASSERT(ETH_ALEN == mac_addr_size);
1040 mtlk_osal_copy_eth_addresses(wrqu->addr.sa_data, mac_addr);
1041 wrqu->addr.sa_family = ARPHRD_IEEE80211;
1043 mtlk_clpb_delete(clpb);
1046 return _mtlk_df_mtlk_to_linux_error_code(res);
1049 #define _DF_USER_GET_PARAM_MAP_START(df_user, param_id_var, int_res) \
1051 uint32 __get_param_macro_mix_guard__ = 0; \
1052 uint32 __req_data_length_in_map; \
1053 mtlk_df_user_t* __df_user_in_map = df_user; \
1054 int* __result_in_map = &int_res; \
1055 mtlk_handle_t __hreq_data_in_map = MTLK_INVALID_HANDLE; \
1056 *__result_in_map = MTLK_ERR_UNKNOWN; \
1057 switch(param_id_var) { \
1058 default: { { \
1059 MTLK_ASSERT(!"Unknown parameter id in get request"); \
1062 #define _DF_USER_GET_PARAM_MAP_END() \
1065 if(MTLK_INVALID_HANDLE != __hreq_data_in_map) \
1067 _mtlk_df_user_free_core_data(__df_user_in_map->df, __hreq_data_in_map); \
1071 MTLK_UNREFERENCED_PARAM(__get_param_macro_mix_guard__); \
1074 #define _DF_USER_GET_ON_PARAM(param_id, core_req_id, is_void_request, cfg_struct_type, cfg_struct_name) \
1077 if(MTLK_INVALID_HANDLE != __hreq_data_in_map) \
1079 _mtlk_df_user_free_core_data(__df_user_in_map->df, __hreq_data_in_map); \
1081 MTLK_UNREFERENCED_PARAM(__get_param_macro_mix_guard__); \
1082 break; \
1084 case (param_id): { \
1085 cfg_struct_type *cfg_struct_name; \
1086 *__result_in_map = _mtlk_df_user_pull_core_data(__df_user_in_map->df, (core_req_id), (is_void_request), (void**) &cfg_struct_name, &__req_data_length_in_map, &__hreq_data_in_map); \
1087 if(MTLK_ERR_OK == *__result_in_map) \
1089 MTLK_ASSERT(sizeof(cfg_struct_type) == __req_data_length_in_map); \
1092 #define _DF_USER_SET_PARAM_MAP_START(df_user, param_id_var, int_res) \
1094 uint32 __set_param_macro_mix_guard__ = 0; \
1095 mtlk_df_user_t* __df_user_in_map = df_user; \
1096 int* __result_in_map = &int_res; \
1097 void* __core_data_in_map = NULL; \
1098 uint32 __core_data_size_in_map = 0; \
1099 uint32 __core_req_id_in_map = 0; \
1100 uint32 __is_void_request_in_map = FALSE; \
1101 *__result_in_map = MTLK_ERR_OK; \
1102 switch(param_id_var) { \
1103 default: { \
1105 MTLK_ASSERT(!"Unknown parameter id in set request");
1107 #define _DF_USER_SET_PARAM_MAP_END() \
1109 if((NULL != __core_data_in_map))\
1111 if(MTLK_ERR_OK == *__result_in_map) { \
1112 *__result_in_map = _mtlk_df_user_push_core_data(__df_user_in_map->df, __core_req_id_in_map, __is_void_request_in_map, __core_data_in_map, __core_data_size_in_map); \
1113 } else { \
1114 mtlk_osal_mem_free(__core_data_in_map); \
1119 MTLK_UNREFERENCED_PARAM(__set_param_macro_mix_guard__); \
1122 #define _DF_USER_SET_ON_PARAM(param_id, core_req_id, is_void_request, cfg_struct_type, cfg_struct_name) \
1124 if((NULL != __core_data_in_map))\
1126 if(MTLK_ERR_OK == *__result_in_map) { \
1127 *__result_in_map = _mtlk_df_user_push_core_data(__df_user_in_map->df, __core_req_id_in_map, __is_void_request_in_map, __core_data_in_map, __core_data_size_in_map); \
1128 } else { \
1129 mtlk_osal_mem_free(__core_data_in_map); \
1133 MTLK_UNREFERENCED_PARAM(__set_param_macro_mix_guard__); \
1134 break; \
1135 case (param_id): { \
1136 cfg_struct_type *cfg_struct_name = _mtlk_df_user_alloc_core_data(__df_user_in_map->df, sizeof(cfg_struct_type)); \
1137 __core_data_size_in_map = sizeof(cfg_struct_type); \
1138 __core_data_in_map = cfg_struct_name; \
1139 __core_req_id_in_map = core_req_id; \
1140 __is_void_request_in_map = is_void_request; \
1141 if(NULL == __core_data_in_map) { \
1142 *__result_in_map = MTLK_ERR_NO_MEM; \
1143 } else {
1145 static int
1146 _mtlk_df_user_print_msdu_ac(char *buffer, size_t len, mtlk_aocs_ac_t *ac)
1148 return mtlk_snprintf(buffer, len,
1149 "\nBE %d BK %d VI %d VO %d",
1150 ac->ac[AC_BE], ac->ac[AC_BK],
1151 ac->ac[AC_VI], ac->ac[AC_VO]);
1154 static int
1155 _mtlk_df_user_print_restricted_ch(char *buffer, size_t len, uint8 *restricted_channels)
1157 uint32 i, length=0;
1159 length += mtlk_snprintf(buffer+length, len-length, "\n");
1160 for (i=0; i<MAX_CHANNELS; i++) {
1161 if (MTLK_CHANNEL_NOT_USED == restricted_channels[i]) {
1162 break;
1164 length += mtlk_snprintf(buffer+length, len-length, "%d ", restricted_channels[i]);
1167 if (length ==0) {
1168 /* no retricted channels */
1169 length = mtlk_snprintf(buffer, len, "\nAll channels allowed");
1172 return (int) length;
1175 static BOOL
1176 _mtlk_df_user_get_ac_by_name (char *buffer, uint8 *ac)
1178 int i;
1179 BOOL found = FALSE;
1180 static const char *aocs_msdu_ac_name[NTS_PRIORITIES] = {"BE", "BK", "VI", "VO"};
1182 for (i = 0; i < NTS_PRIORITIES; i++)
1183 if (!strcmp(buffer, aocs_msdu_ac_name[i])) {
1184 found = TRUE;
1185 *ac = i;
1186 break;
1188 return found;
1191 static int
1192 _mtlk_df_user_fill_ac_values(char *buffer, mtlk_aocs_ac_t *ac)
1194 char buf[16];
1195 char *next_token;
1196 uint8 ac_num;
1197 int v, result = MTLK_ERR_OK;
1199 if (buffer[0] == '\0') {
1200 goto FINISH;
1203 for (v = 0; v < NTS_PRIORITIES; v++) {
1204 ac->ac[v] = AC_NOT_USED;
1207 next_token = mtlk_get_token(buffer, buf, ARRAY_SIZE(buf), ' ');
1209 if (!(next_token || (buf[0] != '\0'))) {
1210 result = MTLK_ERR_UNKNOWN;
1211 goto FINISH;
1214 while (next_token || (buf[0] != '\0')) {
1216 /* here comes AC */
1217 ILOG4_S("ac_num = %s", buf);
1218 if (!_mtlk_df_user_get_ac_by_name(buf, &ac_num)) {
1219 ELOG_S("Wrong access category %s", buf);
1220 result = MTLK_ERR_UNKNOWN;
1221 goto FINISH;
1224 /* here comes the value */
1225 next_token = mtlk_get_token(next_token, buf, ARRAY_SIZE(buf), ' ');
1226 if (buf[0] == '\0') {
1227 ELOG_V("Value is missed");
1228 result = MTLK_ERR_UNKNOWN;
1229 goto FINISH;
1232 ILOG4_S("value %s", buf);
1233 v = mtlk_osal_str_atol(buf);
1234 if (0 == v) {
1235 ac->ac[ac_num] = AC_DISABLED;
1237 else if (1 == v) {
1238 ac->ac[ac_num] = AC_ENABLED;
1240 else {
1241 ELOG_V("Wrong value for ac");
1242 result = MTLK_ERR_UNKNOWN;
1243 goto FINISH;
1245 next_token = mtlk_get_token(next_token, buf, ARRAY_SIZE(buf), ' ');
1248 FINISH:
1249 return result;
1252 static int
1253 _mtlk_df_user_fill_restricted_ch(char *buffer, uint8 *out_chnl)
1255 uint16 channel;
1256 const uint8 max_channel_num = (uint8)-1;
1257 char buf[8];
1258 char *next_token;
1259 uint32 i=0;
1261 memset(out_chnl,(uint8)MTLK_CHANNEL_NOT_USED,MAX_CHANNELS);
1262 if (buffer[0] == '\0') {
1263 /* reset restricted channels */
1264 ILOG4_V("Reset restricted channels - allow all");
1266 else {
1267 next_token = mtlk_get_token(buffer, buf, ARRAY_SIZE(buf), ' ');
1268 while (next_token || (buf[0] != '\0')) {
1269 channel = mtlk_osal_str_atol(buf);
1270 if (channel > max_channel_num) {
1271 return MTLK_ERR_UNKNOWN;
1274 out_chnl[i] = channel;
1276 /* find next channel */
1277 next_token = mtlk_get_token(next_token, buf, ARRAY_SIZE(buf), ' ');
1278 if (MAX_CHANNELS == ++i) {
1279 break;
1283 return MTLK_ERR_OK;
1287 Parse string data for DELBA request
1289 \param delba_req - pointer to storage of DELBA configuration
1290 \param data - string representation of DELBA configuration
1292 \return
1293 MTLK_ERR_PARAMS - incorrect format detected in string configuration
1294 MTLK_ERR_OK - success
1296 \remark
1297 available data format:
1298 "<MAC> <TID>" - send DELBA request for special TID
1299 "<MAC>" - send DELBA request for all TIDs
1301 static int
1302 _mtlk_df_user_fill_delba_req(char const *data, mtlk_delba_req_t *delba_req)
1304 if (NULL == data)
1305 return MTLK_ERR_PARAMS;
1307 if (MTLK_ERR_OK != mtlk_str_to_mac(data, delba_req->sDA.au8Addr))
1309 ELOG_V("Wrong value for MAC");
1310 return MTLK_ERR_PARAMS;
1313 data = strchr(data, ' ');
1315 if (NULL != data)
1317 delba_req->tid = mtlk_osal_str_atol(data);
1319 if ((delba_req->tid < 0) && (delba_req->tid >= NTS_TIDS))
1321 ELOG_D("Wrong value for tid [%d]", delba_req->tid);
1322 return MTLK_ERR_PARAMS;
1325 else
1327 delba_req->tid = -1;
1330 return MTLK_ERR_OK;
1333 static int
1334 _mtlk_df_user_fill_ether_address(IEEE_ADDR *mac_addr, struct sockaddr *sa)
1336 if (sa->sa_family != ARPHRD_ETHER) {
1337 return MTLK_ERR_PARAMS;
1340 MTLK_ASSERT(ETH_ALEN == IEEE_ADDR_LEN);
1341 memcpy(mac_addr->au8Addr, sa->sa_data, ETH_ALEN);
1343 return MTLK_ERR_OK;
1346 static int
1347 _mtlk_df_user_translate_network_mode(uint8 df_network_more, uint8 *core_network_mode)
1349 *core_network_mode = _net_mode_ingress_filter(df_network_more);
1350 return (*core_network_mode != NETWORK_NONE) ? MTLK_ERR_OK : MTLK_ERR_PARAMS;
1353 static int
1354 _mtlk_df_user_parse_bitrate_str(const char *rate,
1355 mtlk_core_rate_cfg_t *rate_cfg)
1357 int tmp_int;
1358 int tmp_fractional;
1361 * Check whether requested value is bare index or mpbs.
1362 * We can distinguish with sscanf() return value (number of tokens read)
1364 if (2 == sscanf(rate, "%i.%i", &tmp_int, &tmp_fractional)) {
1365 MTLK_CFG_SET_ITEM(rate_cfg, int_rate, tmp_int)
1366 MTLK_CFG_SET_ITEM(rate_cfg, frac_rate, tmp_fractional)
1368 else if ((1 == sscanf(rate, "%i", &tmp_int))) {
1369 MTLK_CFG_SET_ITEM(rate_cfg, array_idx, (uint16)tmp_int)
1371 else if (!strcmp(rate, "auto")) {
1372 MTLK_CFG_SET_ITEM(rate_cfg, int_rate, MTLK_CORE_BITRATE_AUTO)
1373 MTLK_CFG_SET_ITEM(rate_cfg, frac_rate, MTLK_CORE_BITRATE_AUTO)
1375 else {
1376 return MTLK_ERR_PARAMS;
1378 return MTLK_ERR_OK;
1381 static int
1382 _mtlk_df_user_bitrate_to_str(mtlk_core_rate_cfg_t *rate_cfg,
1383 char *res,
1384 uint32 length)
1386 if ((MTLK_CORE_BITRATE_AUTO == rate_cfg->int_rate) &&
1387 (MTLK_CORE_BITRATE_AUTO == rate_cfg->frac_rate)) {
1388 snprintf(res, length, "auto");
1390 else {
1391 snprintf(res, length, "%i.%i mbps", rate_cfg->int_rate, rate_cfg->frac_rate);
1393 return MTLK_ERR_OK;
1396 static int
1397 _mtlk_df_user_countries_supported_to_str(mtlk_gen_core_country_name_t *country,
1398 char *res,
1399 int32 length)
1401 uint32 i;
1402 int32 printed_len = 0;
1404 for(i=0; i<MAX_COUNTRIES; i++) {
1405 /* stop if no more countries left */
1406 /* we got a zero-filled memory here */
1407 if(0 == *country[i].name) {
1408 break;
1411 /* no more iwpriv buffer left */
1412 if((length-printed_len) < 0) {
1413 break;
1416 /* newline each 8 elements */
1417 if(0 == i%8) {
1418 printed_len += snprintf(res+printed_len, length-printed_len, "\n");
1421 printed_len += snprintf(res+printed_len, length-printed_len, "%s ", country[i].name);
1423 return MTLK_ERR_OK;
1426 static int
1427 _mtlk_df_user_fill_hw_cfg(mtlk_hw_cfg_t *cfg, char *str)
1429 char buf[30];
1430 char *next_token = str;
1431 int res = MTLK_ERR_PARAMS;
1433 memset(cfg, 0, sizeof(*cfg));
1435 next_token = mtlk_get_token(next_token, buf, sizeof(buf), ',');
1436 if (next_token) {
1437 strncpy(cfg->buf, buf, sizeof(cfg->buf)-1);
1438 } else goto end;
1440 next_token = mtlk_get_token(next_token, buf, sizeof(buf), ',');
1441 if (next_token) {
1442 cfg->field_01 = (uint16)mtlk_osal_str_atol(buf);
1443 } else goto end;
1445 next_token = mtlk_get_token(next_token, buf, sizeof(buf), ',');
1446 if (next_token) {
1447 cfg->field_02 = mtlk_osal_str_atol(buf);
1448 } else goto end;
1450 mtlk_get_token(next_token, buf, sizeof(buf), ',');
1451 cfg->field_03 = (int16)mtlk_osal_str_atol(buf);
1453 res = MTLK_ERR_OK;
1455 end:
1456 return res;
1459 static int
1460 _mtlk_df_user_fill_ant_cfg(mtlk_ant_cfg_t *cfg, char *str)
1462 char buf[30];
1463 char *next_token = str;
1464 int res = MTLK_ERR_PARAMS;
1466 next_token = mtlk_get_token(next_token, buf, sizeof(buf), ',');
1467 if (next_token) {
1468 cfg->field_01 = mtlk_osal_str_atol(buf);
1469 } else goto end;
1471 mtlk_get_token(next_token, buf, sizeof(buf), ',');
1472 cfg->field_02 = mtlk_osal_str_atol(buf);
1474 res = MTLK_ERR_OK;
1476 end:
1477 return res;
1480 static int
1481 _mtlk_df_user_fill_power_limit_cfg_by_int_vec(mtlk_tx_power_limit_cfg_t *cfg, uint16 intvec_length, int32 *intvec)
1483 int res = MTLK_ERR_PARAMS;
1485 memset(cfg, 0, sizeof(mtlk_tx_power_limit_cfg_t));
1487 if (intvec_length != 3) {
1488 ELOG_V("Incorrect number of input values. Expected [11B boost] [BPSK boost] [auto-response boost]");
1489 return res;
1492 if ((intvec[0] < MIN_INT8) || (intvec[0] > MAX_INT8) || (intvec[1] < MIN_INT8) ||
1493 (intvec[1] > MAX_INT8) || (intvec[2] < MIN_INT8) || (intvec[2] > MAX_INT8)) {
1495 ELOG_V("Incorrect input value");
1496 return res;
1499 cfg->field_01 = intvec[0];
1500 cfg->field_02 = intvec[1];
1501 cfg->field_03 = intvec[2];
1503 return MTLK_ERR_OK;
1506 static int
1507 _mtlk_df_user_fill_peer_ap_key_idx (uint8 *peer_ap_key_idx, uint32 data)
1510 if (data > MIB_WEP_N_DEFAULT_KEYS)
1512 ELOG_DD("Wrong key index %d. Usage: <[1-%d]|0> (0 means Open)", data, MIB_WEP_N_DEFAULT_KEYS);
1513 return MTLK_ERR_VALUE;
1516 *peer_ap_key_idx = (uint8)data;
1518 return MTLK_ERR_OK;
1521 static uint32
1522 _mtlk_df_user_print_eeprom(mtlk_eeprom_data_cfg_t *eeprom, char *buffer, uint32 buf_len)
1524 uint8 *buf;
1525 uint32 used_len = 0;
1526 uint32 max_len = MTLK_MAX_EEPROM_SIZE;
1528 buf = mtlk_osal_mem_alloc(max_len, MTLK_MEM_TAG_EEPROM);
1530 if (NULL == buf) {
1531 goto nomem;
1534 memset(buf, 0, max_len);
1536 used_len += mtlk_snprintf(buf+used_len, max_len-used_len,
1537 "\nEEPROM version: %i.%i\n", eeprom->eeprom_version/0x100, eeprom->eeprom_version%0x100);
1538 MTLK_ASSERT(used_len < max_len);
1540 used_len += mtlk_snprintf(buf+used_len, max_len-used_len,
1541 "EEPROM MAC : " MAC_PRINTF_FMT "\n", MAC_PRINTF_ARG(eeprom->mac_address));
1542 MTLK_ASSERT(used_len < max_len);
1544 used_len += mtlk_snprintf(buf+used_len, max_len-used_len,
1545 "EEPROM country: %s\n", country_code_to_country(eeprom->country_code));
1546 MTLK_ASSERT(used_len < max_len);
1548 used_len += mtlk_snprintf(buf+used_len, max_len-used_len,
1549 "HW type : 0x%02X\n", eeprom->type);
1550 MTLK_ASSERT(used_len < max_len);
1552 used_len += mtlk_snprintf(buf+used_len, max_len-used_len,
1553 "HW revision : 0x%02X (%c)\n", eeprom->revision, eeprom->revision);
1554 MTLK_ASSERT(used_len < max_len);
1556 used_len += mtlk_snprintf(buf+used_len, max_len-used_len, "HW ID : 0x%x,0x%x,0x%x,0x%x\n",
1557 eeprom->vendor_id, eeprom->device_id,
1558 eeprom->sub_vendor_id, eeprom->sub_device_id);
1559 MTLK_ASSERT(used_len < max_len);
1561 used_len += mtlk_snprintf(buf+used_len, max_len-used_len, "Serial number : %02x%02x%02x\n",
1562 eeprom->sn[2], eeprom->sn[1], eeprom->sn[0]);
1563 MTLK_ASSERT(used_len < max_len);
1565 used_len += mtlk_snprintf(buf+used_len, max_len-used_len, "Week/Year : %02d/%02d\n",
1566 eeprom->production_week, eeprom->production_year);
1567 MTLK_ASSERT(used_len < max_len);
1568 MTLK_ASSERT(strlen(buf) == used_len);
1570 if (used_len <= buf_len) {
1571 strncpy(buffer, buf, used_len);
1573 else {
1574 used_len = 0;
1577 mtlk_osal_mem_free(buf);
1578 nomem:
1579 return used_len;
1582 static uint32
1583 _mtlk_df_user_print_raw_eeprom(uint8 *raw_eeprom, uint32 size_raw_eeprom, char *buffer, uint32 buf_len)
1585 uint8 *buf;
1586 uint32 used_len = 0;
1587 uint32 max_len = MTLK_MAX_EEPROM_SIZE;
1589 MTLK_ASSERT(max_len <= buf_len);
1590 MTLK_UNREFERENCED_PARAM(size_raw_eeprom);
1592 buf = mtlk_osal_mem_alloc(max_len, MTLK_MEM_TAG_EEPROM);
1593 if (NULL == buf) {
1594 goto nomem;
1597 memset(buf, 0, max_len);
1599 used_len += mtlk_snprintf(buf+used_len, max_len-used_len, "\nEEPROM header binary dump:\n");
1600 MTLK_ASSERT(used_len < max_len);
1602 MTLK_ASSERT(size_raw_eeprom >= mtlk_eeprom_get_size());
1603 MTLK_ASSERT((max_len-used_len) >= mtlk_eeprom_get_size());
1604 used_len += mtlk_shexdump(buf+used_len, raw_eeprom, mtlk_eeprom_get_size());
1606 if (used_len <= buf_len) {
1607 strncpy(buffer, buf, used_len);
1609 else {
1610 used_len = 0;
1613 mtlk_osal_mem_free(buf);
1614 nomem:
1615 return used_len;
1618 #ifdef MTCFG_IRB_DEBUG
1620 static uint32
1621 _mtlk_df_user_print_irb_pinger_stats(char *buf, uint32 len, struct mtlk_irb_pinger_stats *stats)
1623 uint64 avg_delay = 0;
1625 if (stats->nof_recvd_pongs) {
1626 /* NOTE: 64-bit division is not supported by default in linux kernel space =>
1627 * we should use the do_div() ASM macro here.
1629 avg_delay = stats->all_delay;
1630 do_div(avg_delay, stats->nof_recvd_pongs); /* the result is stored in avg_delay */
1633 return mtlk_snprintf(buf, len, "NofPongs=%u NofMissed=%u NofOOO=%u AllDly=%llu AvgDly=%llu PeakDly=%llu\n",
1634 stats->nof_recvd_pongs,
1635 stats->nof_missed_pongs,
1636 stats->nof_ooo_pongs,
1637 stats->all_delay,
1638 avg_delay,
1639 stats->peak_delay);
1642 static int __MTLK_IFUNC
1643 _mtlk_df_user_irb_pinger_int_get_cfg(mtlk_df_user_t* df_user, uint32 subcmd, char* data, uint16* length)
1645 struct mtlk_irb_pinger_stats stats;
1647 switch (subcmd) {
1648 case PRM_ID_IRB_PINGER_ENABLED:
1649 *(uint32*)data = mtlk_irb_pinger_get_ping_period_ms(&df_user->slow_ctx->pinger);
1650 return MTLK_ERR_OK;
1651 case PRM_ID_IRB_PINGER_STATS:
1652 mtlk_irb_pinger_get_stats(&df_user->slow_ctx->pinger, &stats);
1653 *length = _mtlk_df_user_print_irb_pinger_stats(data, TEXT_SIZE, &stats);
1654 return MTLK_ERR_OK;
1655 default:
1656 return MTLK_ERR_NOT_HANDLED;
1660 static int __MTLK_IFUNC
1661 _mtlk_df_user_irb_pinger_int_set_cfg(mtlk_df_user_t* df_user, uint32 subcmd, char* data, uint16* length)
1663 switch (subcmd) {
1664 case PRM_ID_IRB_PINGER_ENABLED:
1665 return mtlk_irb_pinger_restart(&df_user->slow_ctx->pinger, *(uint32*)data);
1666 case PRM_ID_IRB_PINGER_STATS:
1667 mtlk_irb_pinger_zero_stats(&df_user->slow_ctx->pinger);
1668 return MTLK_ERR_OK;
1669 default:
1670 return MTLK_ERR_NOT_HANDLED;
1674 #endif /* MTCFG_IRB_DEBUG */
1676 #ifdef MTLK_HAVE_PPA
1677 static int __MTLK_IFUNC
1678 _mtlk_df_user_ppa_directpath_int_get_cfg(mtlk_df_user_t* df_user, uint32 subcmd, char* data, uint16* length)
1680 if(PRM_ID_PPA_API_DIRECTPATH == subcmd) {
1681 if (!_mtlk_df_user_ppa_is_available()) {
1682 return MTLK_ERR_NOT_SUPPORTED;
1683 } else {
1684 *(uint32*)data = _mtlk_df_user_ppa_is_registered(df_user);
1685 return MTLK_ERR_OK;
1687 } else {
1688 return MTLK_ERR_NOT_HANDLED;
1692 static int __MTLK_IFUNC
1693 _mtlk_df_user_ppa_directpath_int_set_cfg(mtlk_df_user_t* df_user, uint32 subcmd, char* data, uint16* length)
1695 uint32 value = *(uint32*)data;
1697 if (PRM_ID_PPA_API_DIRECTPATH == subcmd) {
1698 if (!_mtlk_df_user_ppa_is_available()) {
1699 return MTLK_ERR_NOT_SUPPORTED;
1700 } else if (!value && _mtlk_df_user_ppa_is_registered(df_user)) {
1701 _mtlk_df_user_ppa_unregister(df_user);
1702 return MTLK_ERR_OK;
1703 } else if (value && !_mtlk_df_user_ppa_is_registered(df_user)) {
1704 return _mtlk_df_user_ppa_register(df_user);
1705 } else {
1706 return MTLK_ERR_OK;
1708 } else {
1709 return MTLK_ERR_NOT_HANDLED;
1712 #endif
1714 #ifdef MTCFG_USE_GENL
1715 /* Exported by mtlkroot */
1716 extern int mtlk_genl_family_id;
1718 static int __MTLK_IFUNC
1719 _mtlk_df_user_genl_int_get_cfg(mtlk_df_user_t* df_user, uint32 subcmd, char* data, uint16* length)
1721 if(PRM_ID_GENL_FAMILY_ID == subcmd) {
1722 *(uint32*)data = mtlk_genl_family_id;
1723 return MTLK_ERR_OK;
1724 } else {
1725 return MTLK_ERR_NOT_HANDLED;
1728 #endif
1730 static void
1731 _mtlk_df_set_vap_limits_cfg (mtlk_mbss_cfg_t *mbss_cfg, uint32 low, uint32 up)
1733 mbss_cfg->vap_limits.lower_limit = low;
1734 mbss_cfg->vap_limits.upper_limit = up;
1737 static void
1738 _mtlk_df_get_vap_limits_cfg (mtlk_mbss_cfg_t *mbss_cfg, uint32 *low, uint32 *up)
1740 *low = mbss_cfg->vap_limits.lower_limit;
1741 *up = mbss_cfg->vap_limits.upper_limit;
1744 static int
1745 _mtlk_df_user_get_interfdet_req_scantimes_by_intvec (const uint32 *intvec, uint16 intvec_length, mtlk_interfdet_req_scantimes_t *req_params)
1747 int res = MTLK_ERR_OK;
1748 int i;
1750 if (2 != intvec_length) {
1751 ELOG_D("Incorrect vector length. length(%u), expected 2", intvec_length);
1752 res = MTLK_ERR_PARAMS;
1753 } else for (i = 0; i < 2; i++) {
1754 if ((int32)intvec[i] < 0) {
1755 ELOG_DD("Incorrect parameter %d (%d)", i, intvec[i]);
1756 res = MTLK_ERR_PARAMS;
1757 break;
1761 if (MTLK_ERR_PARAMS == res) {
1762 ELOG_V("Expected parameters: <short_scan_max_time> <long_scan_max_time>");
1763 return res;
1766 req_params->short_scan_max_time = intvec[0];
1767 req_params->long_scan_max_time = intvec[1];
1768 return res;
1771 static int
1772 _mtlk_df_user_get_interfdet_req_timeouts_by_intvec (const uint32 *intvec, uint16 intvec_length, mtlk_interfdet_req_timeouts_t *req_params)
1774 int res = MTLK_ERR_OK;
1776 if (6 != intvec_length) {
1777 ELOG_D("Incorrect vector length. length(%u), expected 6", intvec_length);
1778 res = MTLK_ERR_PARAMS;
1781 if (MTLK_ERR_PARAMS == res) {
1782 ELOG_V("Expected parameters: <active_polling_timeout> <short_scan_polling_timeout> <long_scan_polling_timeout> "\
1783 "<active_notification_timeout> <short_scan_notification_timeout> <long_scan_notification_timeout>");
1784 return res;
1787 req_params->active_polling_timeout = intvec[0];
1788 req_params->short_scan_polling_timeout = intvec[1];
1789 req_params->long_scan_polling_timeout = intvec[2];
1790 req_params->active_notification_timeout = intvec[3];
1791 req_params->short_scan_notification_timeout = intvec[4];
1792 req_params->long_scan_notification_timeout = intvec[5];
1794 return res;
1797 static int
1798 _mtlk_df_user_get_interfdet_req_thresh_by_intvec (const uint32 *intvec, uint16 intvec_length, mtlk_interfdet_req_thresh_t *req_params)
1801 #define INTERF_THR_PARAMS_DET_20 0
1802 #define INTERF_THR_PARAMS_NOTIF_20 1
1803 #define INTERF_THR_PARAMS_DET_40 2
1804 #define INTERF_THR_PARAMS_NOTIF_40 3
1805 #define INTERF_THR_PARAMS_SN_THR 4 /* Scan Noise Threshold */
1806 #define INTERF_THR_PARAMS_SN_MIN 5 /* Scan Minimum Noise */
1807 #define INTERF_THR_PARAMS_NUM 6
1809 int res = MTLK_ERR_OK;
1810 int i;
1812 if (INTERF_THR_PARAMS_NUM != intvec_length) {
1813 ELOG_DD("Incorrect vector length. length(%u), expected %d", intvec_length, INTERF_THR_PARAMS_NUM);
1814 res = MTLK_ERR_PARAMS;
1815 } else for (i = 0; i < INTERF_THR_PARAMS_NUM; i++) {
1816 /* All, but 4, parameters are in dB */
1817 if ((i != INTERF_THR_PARAMS_SN_THR) && (((int32)intvec[i] < MIN_INT8) || ((int32)intvec[i] > 0))) {
1818 ELOG_DD("Incorrect parameter %d (%d), must be in range [0..-128]", i + 1, intvec[i]);
1819 res = MTLK_ERR_PARAMS;
1820 break;
1824 if ((MTLK_ERR_OK == res) && ((int32)intvec[INTERF_THR_PARAMS_SN_THR] > MAX_INT8)) {
1825 ELOG_DD("Incorrect parameter %d (%d), must be in range [0..127]", INTERF_THR_PARAMS_SN_THR, intvec[INTERF_THR_PARAMS_SN_THR]);
1826 res = MTLK_ERR_PARAMS;
1829 if (MTLK_ERR_PARAMS == res) {
1830 ELOG_V("Expected parameters: <detection_threshold_20mhz> <notification_threshold_20mhz> <detection_threshold_40mhz>"\
1831 "<notification_threshold_40mhz> <scan_noise_threshold> <scan_minimum_noise>");
1832 return res;
1835 req_params->detection_threshold_20mhz = intvec[INTERF_THR_PARAMS_DET_20 ];
1836 req_params->notification_threshold_20mhz = intvec[INTERF_THR_PARAMS_NOTIF_20];
1837 req_params->detection_threshold_40mhz = intvec[INTERF_THR_PARAMS_DET_40 ];
1838 req_params->notification_threshold_40mhz = intvec[INTERF_THR_PARAMS_NOTIF_40];
1839 req_params->scan_noise_threshold = intvec[INTERF_THR_PARAMS_SN_THR ];
1840 req_params->scan_minimum_noise = intvec[INTERF_THR_PARAMS_SN_MIN ];
1842 return res;
1846 static void
1847 _mtlk_df_user_get_intvec_by_fw_gpio_cfg (uint32 *intvec, uint16 *intvec_lenth, const mtlk_fw_led_gpio_cfg_t *gpio_cfg)
1849 intvec[0] = gpio_cfg->disable_testbus;
1850 intvec[1] = gpio_cfg->active_gpios;
1851 intvec[2] = gpio_cfg->led_polatity;
1853 *intvec_lenth = 3;
1856 static void
1857 _mtlk_df_user_intvec_by_11b_antsel (uint32 *intvec, uint16 *intvec_length, const mtlk_11b_antsel_t *antsel)
1859 intvec[0] = antsel->txAnt;
1860 intvec[1] = antsel->rxAnt;
1861 intvec[2] = antsel->rate;
1863 *intvec_length = 3;
1866 static int
1867 _mtlk_df_user_get_fw_gpio_cfg_by_intvec (const uint32 *intvec, uint16 intvec_lenth, mtlk_fw_led_gpio_cfg_t *gpio_cfg)
1869 int res = MTLK_ERR_PARAMS;
1871 if (3 != intvec_lenth) {
1872 ELOG_D("Incorrect vector length. length(%u)", intvec_lenth);
1874 else if (intvec[0] >= MAX_UINT8 || intvec[1] >= MAX_UINT8 || intvec[2] >= MAX_UINT8) {
1875 ELOG_DDD("Incorrect value (%u %u %u)", intvec[0], intvec[1], intvec[2]);
1877 else {
1878 gpio_cfg->disable_testbus = (uint8)intvec[0];
1879 gpio_cfg->active_gpios = (uint8)intvec[1];
1880 gpio_cfg->led_polatity = (uint8)intvec[2];
1881 res = MTLK_ERR_OK;
1884 return res;
1887 static int
1888 _mtlk_df_user_get_fw_led_state_by_intvec (const uint32 *intvec, uint16 intvec_lenth, mtlk_fw_led_state_t *led_state)
1890 int res = MTLK_ERR_PARAMS;
1892 if (2 != intvec_lenth) {
1893 ELOG_D("Incorrect vector length. length(%u)", intvec_lenth);
1895 else if (intvec[0] >= MAX_UINT8 || intvec[1] >= MAX_UINT8) {
1896 ELOG_DD("Incorrect value (%u %u)", intvec[0], intvec[1]);
1898 else {
1899 led_state->baseb_led = (uint8)intvec[0];
1900 led_state->led_state = (uint8)intvec[1];
1901 res = MTLK_ERR_OK;
1904 return res;
1907 static void
1908 _mtlk_df_user_get_intvec_by_auto_params (uint32 *intvec, uint16 *intvec_lenth, const mtlk_coc_auto_cfg_t *auto_params)
1910 intvec[0] = auto_params->interval_1x1;
1911 intvec[1] = auto_params->interval_2x2;
1912 intvec[2] = auto_params->interval_3x3;
1913 intvec[3] = auto_params->high_limit_1x1;
1914 intvec[4] = auto_params->low_limit_2x2;
1915 intvec[5] = auto_params->high_limit_2x2;
1916 intvec[6] = auto_params->low_limit_3x3;
1918 *intvec_lenth = 7;
1921 static void
1922 _mtlk_df_user_get_intvec_by_antenna_params (uint32 *intvec, uint16 *intvec_lenth, const mtlk_coc_antenna_cfg_t *antenna_params)
1924 intvec[1] = antenna_params->num_tx_antennas;
1925 intvec[2] = antenna_params->num_rx_antennas;
1927 *intvec_lenth = 3;
1930 static void
1931 _mtlk_df_user_get_intvec_by_n_rate_bo (int32 *intvec, uint16 *intvec_lenth, const mtlk_core_n_rate_bo_t *n_rate_bo)
1933 intvec[0] = n_rate_bo->qam16;
1934 intvec[1] = n_rate_bo->qam64_2_3;
1935 intvec[2] = n_rate_bo->qam64_3_4;
1936 intvec[3] = n_rate_bo->qam64_5_6;
1938 *intvec_lenth = 4;
1941 static void
1942 _mtlk_df_user_get_intvec_by_interf_params (int32 *intvec, uint16 *intvec_lenth, const mtlk_interf_t *interf_cfg)
1944 intvec[0] = interf_cfg->is_enabled;
1945 intvec[1] = interf_cfg->threshold;
1946 intvec[2] = interf_cfg->threshold_rssi;
1948 *intvec_lenth = 3;
1951 #ifdef MTCFG_PMCU_SUPPORT
1953 static void
1954 _mtlk_df_user_get_intvec_by_pcoc_params (uint32 *intvec, uint16 *intvec_lenth, const mtlk_pcoc_params_t *params)
1956 intvec[0] = params->interval;
1957 intvec[1] = params->limit_lower;
1958 intvec[2] = params->limit_upper;
1960 *intvec_lenth = 3;
1963 #endif
1965 static void
1966 _mtlk_df_user_intvec_by_11b_thresholds (uint32 *intvec, uint16 *intvec_length, const mtlk_enhanced11b_th_t *thresholds)
1968 intvec[0] = thresholds->Consecutive11nTH;
1969 intvec[1] = thresholds->Consecutive11bTH;
1971 *intvec_length = 2;
1974 static void
1975 _mtlk_df_user_intvec_by_recovery (uint32 *intvec, uint16 *intvec_length, const rcvry_cfg_t *recovery)
1977 intvec[0] = recovery->fast_rcvry_num;
1978 intvec[1] = recovery->full_rcvry_num;
1979 intvec[2] = recovery->complete_rcvry;
1980 intvec[3] = recovery->fail_time_interval;
1981 intvec[4] = recovery->fw_dump;
1983 *intvec_length = 5;
1986 static int
1987 _mtlk_df_user_get_coc_antenna_params_by_intvec (const uint32 *intvec, uint16 intvec_length, mtlk_coc_antenna_cfg_t *antenna_params)
1989 int res = MTLK_ERR_PARAMS;
1991 memset(antenna_params, 0, sizeof(mtlk_coc_antenna_cfg_t));
1993 if (((intvec[0] == 1) && (intvec_length != 1)) ||
1994 ((intvec[0] == 0) && (intvec_length != 3))) {
1995 ELOG_DD("Incorrect vector configuration: <enable mode %u> and length %u", intvec[0], intvec_length);
1997 else if ((intvec[0] != 1) && (intvec[0] != 0)) {
1998 ELOG_D("Incorrect vector configuration: <enable mode %u>", intvec[0]);
2000 else {
2001 antenna_params->num_tx_antennas = intvec[1];
2002 antenna_params->num_rx_antennas = intvec[2];
2004 res = MTLK_ERR_OK;
2007 return res;
2010 static int
2011 _mtlk_df_user_get_coc_auto_params_by_intvec (const uint32 *intvec, uint16 intvec_length, mtlk_coc_auto_cfg_t *auto_params)
2013 int res = MTLK_ERR_PARAMS;
2015 memset(auto_params, 0, sizeof(mtlk_coc_auto_cfg_t));
2017 if (intvec_length != 7) {
2018 ELOG_D("Incorrect vector length. length(%u)", intvec_length);
2020 else {
2021 auto_params->interval_1x1 = intvec[0];
2022 auto_params->interval_2x2 = intvec[1];
2023 auto_params->interval_3x3 = intvec[2];
2024 auto_params->high_limit_1x1 = intvec[3];
2025 auto_params->low_limit_2x2 = intvec[4];
2026 auto_params->high_limit_2x2 = intvec[5];
2027 auto_params->low_limit_3x3 = intvec[6];
2029 res = MTLK_ERR_OK;
2032 return res;
2035 static int
2036 _mtlk_df_user_get_interf_params_by_intvec (const int32 *intvec, uint16 intvec_length, mtlk_interf_t *interf_cfg)
2038 int res = MTLK_ERR_PARAMS;
2040 memset(interf_cfg, 0, sizeof(mtlk_interf_t));
2042 if (!!intvec[0]) {
2043 if (intvec_length != 3) {
2044 ELOG_D("Incorrect vector length. length(%u)", intvec_length);
2045 return res;
2047 else {
2048 if ((intvec[1] > 100) || (intvec[1] < 0)) {
2049 ELOG_D("Incorrect channel load threshold value (%d)", intvec[1]);
2050 return res;
2053 if ((intvec[2] < -128) || (intvec[2] > 0)) {
2054 ELOG_D("Incorrect RSSI threshold value (%d)", intvec[2]);
2055 return res;
2060 MTLK_CFG_SET_ITEM(interf_cfg, is_enabled, !!intvec[0]);
2061 if (!!intvec[0]) {
2062 MTLK_CFG_SET_ITEM(interf_cfg, threshold, intvec[1]);
2063 MTLK_CFG_SET_ITEM(interf_cfg, threshold_rssi, intvec[2]);
2066 res = MTLK_ERR_OK;
2068 return res;
2071 #ifdef MTCFG_PMCU_SUPPORT
2073 static int
2074 _mtlk_df_user_get_pcoc_params_by_intvec (const uint32 *intvec, uint16 intvec_length, mtlk_pcoc_params_t *params)
2076 int res = MTLK_ERR_PARAMS;
2078 memset(params, 0, sizeof(mtlk_pcoc_params_t));
2080 if (intvec_length != 3) {
2081 ELOG_D("Incorrect vector length. length(%u)", intvec_length);
2083 else {
2084 params->interval = intvec[0];
2085 params->limit_lower = intvec[1];
2086 params->limit_upper = intvec[2];
2088 res = MTLK_ERR_OK;
2091 return res;
2094 #endif
2096 static int
2097 _mtlk_df_user_get_11b_thresholds_by_intvec (const uint32 *intvec, uint16 intvec_length, mtlk_enhanced11b_th_t *thresholds)
2099 int res = MTLK_ERR_PARAMS;
2101 memset(thresholds, 0, sizeof(*thresholds));
2103 if (intvec_length != 2) {
2104 ELOG_D("Incorrect vector length (%u)", intvec_length);
2106 else {
2107 thresholds->Consecutive11nTH = intvec[0];
2108 thresholds->Consecutive11bTH = intvec[1];
2110 res = MTLK_ERR_OK;
2113 return res;
2116 static int
2117 _mtlk_df_user_get_11b_antsel_by_intvec (const uint32 *intvec, uint16 intvec_length, mtlk_11b_antsel_t *antsel)
2119 int res = MTLK_ERR_PARAMS;
2121 memset(antsel, 0, sizeof(*antsel));
2123 if (intvec_length != 3) {
2124 ELOG_D("Incorrect vector length (%u)", intvec_length);
2126 else {
2127 antsel->txAnt = intvec[0];
2128 antsel->rxAnt = intvec[1];
2129 antsel->rate = intvec[2];
2131 res = MTLK_ERR_OK;
2134 return res;
2137 static int
2138 _mtlk_df_user_get_recovery_by_intvec (const uint32 *intvec, uint16 intvec_length, rcvry_cfg_t *recovery)
2140 int res = MTLK_ERR_PARAMS;
2142 if (intvec_length != 5) {
2143 ELOG_D("Incorrect vector length (%u)", intvec_length);
2145 else {
2146 recovery->fast_rcvry_num = intvec[0];
2147 recovery->full_rcvry_num = intvec[1];
2148 recovery->complete_rcvry = intvec[2];
2149 recovery->fail_time_interval = intvec[3];
2150 recovery->fw_dump = intvec[4];
2152 res = MTLK_ERR_OK;
2155 return res;
2158 static void
2159 _mtlk_df_user_intvec_by_agg_rate_limit (uint32 *intvec, uint16 *intvec_length, const mtlk_agg_rate_limit_t *limit)
2161 intvec[0] = limit->mode;
2162 intvec[1] = limit->maxRate;
2164 *intvec_length = 2;
2167 /* Parameters:
2168 mode 0/1 Feature Enable/Disable
2169 maxRate 0 ... BITRATE_LAST, use 0 if is not specified
2171 static int
2172 _mtlk_df_user_set_agg_rate_limit_by_intvec (const uint32 *intvec, uint16 intvec_length, mtlk_agg_rate_limit_t *limit)
2174 int res = MTLK_ERR_OK;
2175 uint32 mode, rate;
2177 memset(limit, 0, sizeof(*limit));
2179 if (0 == intvec_length) {
2180 ELOG_V("Value is missed");
2181 res = MTLK_ERR_PARAMS;
2183 else {
2184 mode = intvec[0];
2185 rate = (1 == intvec_length) ? 0 : intvec[1];
2187 /* check parameter 'mode' only */
2188 if (mode > 1) {
2189 ELOG_D("Wrong values for mode: %d (0/1 expected)\n", mode);
2190 res = MTLK_ERR_PARAMS;
2191 } else {
2192 limit->mode = mode;
2193 limit->maxRate = rate;
2194 /* res = MTLK_ERR_OK; */
2198 return res;
2201 /* Parameters:
2202 onTime 0 ... 32767
2203 offTime 0 ... 32767
2205 static int
2206 _mtlk_df_user_set_rx_duty_cycle_by_intvec (const uint32 *intvec, uint16 intvec_length, mtlk_rx_duty_cycle_t *rx_duty_cycle)
2208 int res = MTLK_ERR_OK;
2209 uint32 onTime, offTime;
2211 memset(rx_duty_cycle, 0, sizeof(*rx_duty_cycle));
2213 if (2 != intvec_length) {
2214 ELOG_V("Wrong parameter count (expected: 2)");
2215 res = MTLK_ERR_PARAMS;
2217 else {
2218 onTime = intvec[0];
2219 offTime = intvec[1];
2221 /* check parameters */
2222 if (onTime > 32767 || offTime > 32767) {
2223 ELOG_DD("Wrong values: %d %d (0...32767 expected)", onTime, offTime);
2224 res = MTLK_ERR_PARAMS;
2225 } else {
2226 rx_duty_cycle->onTime = onTime;
2227 rx_duty_cycle->offTime = offTime;
2228 /* res = MTLK_ERR_OK; */
2232 return res;
2235 static void
2236 _mtlk_df_user_intvec_by_rx_duty_cycle (uint32 *intvec, uint16 *intvec_length, const mtlk_rx_duty_cycle_t *rx_duty_cycle)
2238 intvec[0] = rx_duty_cycle->onTime;
2239 intvec[1] = rx_duty_cycle->offTime;
2241 *intvec_length = 2;
2245 static int
2246 _mtlk_df_user_set_lna_gain_by_intvec (const int32 *intvec, uint16 intvec_length, mtlk_lna_gain_t *lna_gains)
2248 int res = MTLK_ERR_OK;
2250 memset(lna_gains, 0, sizeof(mtlk_lna_gain_t));
2252 if (2 != intvec_length) {
2253 ELOG_V("Incorrect input vector length. Expected parameters [extLnaGainBypass] [extLnaGainHigh]");
2254 return MTLK_ERR_PARAMS;
2257 if ((intvec[0] < MIN_INT8) || (intvec[0] > MAX_INT8) || (intvec[1] < MIN_INT8) || (intvec[1] > MAX_INT8)) {
2258 ELOG_DD("Incorrect input value (%u %u)", intvec[0], intvec[1]);
2259 return MTLK_ERR_PARAMS;
2262 lna_gains->lna_gain_bypass = (int8)intvec[0];
2263 lna_gains->lna_gain_high = (int8)intvec[1];
2265 return res;
2268 static void
2269 _mtlk_df_user_intvec_by_lna_gain (int32 *intvec, uint16 *intvec_length, const mtlk_lna_gain_t *lna_gains)
2271 intvec[0] = lna_gains->lna_gain_bypass;
2272 intvec[1] = lna_gains->lna_gain_high;
2274 *intvec_length = 2;
2277 static int
2278 _mtlk_df_user_get_n_rate_bo_by_intvec (const int32 *intvec, uint16 intvec_length, mtlk_core_n_rate_bo_t *n_rate_bo)
2280 int res = MTLK_ERR_PARAMS;
2282 if (intvec_length != 4) {
2283 ELOG_D("Incorrect vector length (%u)", intvec_length);
2285 else {
2286 n_rate_bo->qam16 = intvec[0];
2287 n_rate_bo->qam64_2_3 = intvec[1];
2288 n_rate_bo->qam64_3_4 = intvec[2];
2289 n_rate_bo->qam64_5_6 = intvec[3];
2291 res = MTLK_ERR_OK;
2294 return res;
2297 static int
2298 _mtlk_df_user_do_simple_cli (const uint32 *intvec, uint16 intvec_length, UmiDbgCliReq_t *DbgCliReq)
2300 int res = MTLK_ERR_PARAMS;
2302 if ((1 > intvec_length) || (4 < intvec_length)) {
2303 ELOG_D("Incorrect vector length. length(%u)", intvec_length);
2304 } else {
2305 memset(DbgCliReq, 0, sizeof(UmiDbgCliReq_t));
2306 DbgCliReq->numOfArgumets = intvec_length - 1;
2307 DbgCliReq->action = intvec[0];
2308 switch(intvec_length)
2310 case 4:
2311 DbgCliReq->data3 = intvec[3];
2312 case 3:
2313 DbgCliReq->data2 = intvec[2];
2314 case 2:
2315 DbgCliReq->data1 = intvec[1];
2316 default:
2317 break;
2319 res = MTLK_ERR_OK;
2322 return res;
2325 static int
2326 _mtlk_df_user_do_fw_debug (const uint32 *intvec, uint16 intvec_length, UMI_FW_DBG_REQ *FWDebugReq)
2328 int res = MTLK_ERR_PARAMS;
2330 if ((1 > intvec_length) || (2 < intvec_length)) {
2331 ELOG_D("Incorrect vector length. length(%u)", intvec_length);
2332 } else {
2333 memset(FWDebugReq, 0, sizeof(UMI_FW_DBG_REQ));
2334 /* For some reason, first argument is ignored */
2335 if(2 == intvec_length) {
2336 FWDebugReq->debugType = intvec[1];
2338 res = MTLK_ERR_OK;
2341 return res;
2344 static void
2345 _mtlk_df_user_addr_vect_to_text (char *buf, mtlk_clpb_t *addr_vect_clpb, uint16 *length, uint32 max_len)
2347 uint32 used_len, out_cnt;
2348 uint32 addr_size;
2349 IEEE_ADDR *addr;
2351 ASSERT(buf != NULL);
2352 ASSERT(addr_vect_clpb != NULL);
2354 used_len = 0;
2355 out_cnt = 0;
2357 while(1)
2359 addr = mtlk_clpb_enum_get_next(addr_vect_clpb, &addr_size);
2360 if (NULL == addr) break;
2362 MTLK_ASSERT(addr_size == sizeof(IEEE_ADDR));
2363 used_len += mtlk_snprintf(buf+used_len, max_len-used_len,
2364 "\n " MAC_PRINTF_FMT,
2365 MAC_PRINTF_ARG(addr->au8Addr));
2367 out_cnt++;
2370 if (out_cnt == 0)
2372 used_len = mtlk_snprintf(buf, max_len, " No any address");
2375 used_len += mtlk_snprintf(buf+used_len, max_len-used_len, "\n");
2377 *length = used_len;
2378 return;
2381 static int
2382 _mtlk_df_user_print_ta_debug_info(char *buffer, size_t len, mtlk_ta_debug_info_cfg_t *debug_info)
2384 uint32 i;
2385 uint32 length=0;
2386 uint32 nof_crits;
2387 uint32 nof_stas;
2389 nof_crits = debug_info->nof_crit;
2390 length += mtlk_snprintf(buffer+length, len-length, "\n");
2391 length += mtlk_snprintf(buffer+length, len-length, "==============================================================================\n");
2392 length += mtlk_snprintf(buffer+length, len-length, " CRITERIA (%d)\n", nof_crits);
2393 length += mtlk_snprintf(buffer+length, len-length, "------------------------------------------------------------------------------\n");
2394 length += mtlk_snprintf(buffer+length, len-length, " ID | Signature | FCN | Callback | Context | Count | Period \n");
2395 length += mtlk_snprintf(buffer+length, len-length, "------------------------------------------------------------------------------\n");
2396 for (i=0; i < nof_crits; ++i) {
2397 mtlk_ta_crit_t *crit = &debug_info->crit[i];
2398 length += mtlk_snprintf(buffer+length, len-length, " %02u %10X %10X %10X %10X %4u %8u \n",
2399 crit->id, crit->signature, (uint32)crit->fcn, (uint32)crit->clb,
2400 (uint32)crit->clb_ctx, crit->tmr_cnt, crit->tmr_period);
2403 nof_stas = debug_info->nof_sta_wss;
2404 length += mtlk_snprintf(buffer+length, len-length, "==============================================================================\n");
2405 length += mtlk_snprintf(buffer+length, len-length, " STA WSS (%d)\n", nof_stas);
2406 length += mtlk_snprintf(buffer+length, len-length, "------------------------------------------------------------------------------\n");
2407 length += mtlk_snprintf(buffer+length, len-length, " | | | RX | TX \n");
2408 length += mtlk_snprintf(buffer+length, len-length, " STA | VAP | Valid | Prev | Delta | Prev | Delta \n");
2409 length += mtlk_snprintf(buffer+length, len-length, "------------------------------------------------------------------------------\n");
2410 for (i=0; i < nof_stas; ++i) {
2411 mtlk_ta_sta_wss_t *wss = &debug_info->sta_wss[i];
2412 mtlk_ta_wss_counter_t *rx = &wss->coc_rx_bytes;
2413 mtlk_ta_wss_counter_t *tx = &wss->coc_tx_bytes;
2414 length += mtlk_snprintf(buffer+length, len-length, "%10X %3X %c %10u %10u %10u %10u\n",
2415 (uint32)wss->sta_entry, (uint32)mtlk_vap_get_id(((sta_entry*)wss->sta_entry)->vap_handle),
2416 wss->coc_wss_valid?'Y':'N',
2417 rx->prev, rx->delta,
2418 tx->prev, tx->delta);
2420 length += mtlk_snprintf(buffer+length, len-length, "==============================================================================\n");
2422 return length;
2425 static BOOL
2426 _mtlk_df_user_card_type_is_g35(mtlk_df_user_t *df_user)
2428 mtlk_card_type_t card_type = MTLK_CARD_UNKNOWN;
2429 mtlk_vap_handle_t vap;
2430 BOOL is_type_ok = FALSE;
2431 int res;
2433 vap = mtlk_df_get_vap_handle(df_user->df);
2434 res = mtlk_vap_get_hw_vft(vap)->get_prop(vap, MTLK_HW_PROP_CARD_TYPE,
2435 &card_type, sizeof(&card_type));
2436 MTLK_ASSERT(MTLK_ERR_OK == res);
2437 CARD_SELECTOR_START(card_type)
2438 IF_CARD_G3 (
2439 /* nothing */
2441 IF_CARD_AHBG35 (
2442 is_type_ok = TRUE;
2444 CARD_SELECTOR_END();
2446 return is_type_ok;
2449 static BOOL
2450 _mtlk_df_user_check_master_vap_on_g35(mtlk_df_user_t *df_user)
2452 return mtlk_vap_is_master(mtlk_df_get_vap_handle(df_user->df)) &&
2453 _mtlk_df_user_card_type_is_g35(df_user);
2456 static int
2457 __set_item_value_int8 (int32 value, int8 *item)
2459 int res = MTLK_ERR_OK;
2461 if (MIN_INT8 <= value && value <= MAX_INT8) {
2462 *item = value;
2463 } else {
2464 ELOG_V("Wrong value (expected: -128...127)");
2465 res = MTLK_ERR_PARAMS;
2468 return res;
2471 static int __MTLK_IFUNC
2472 _mtlk_df_user_iwpriv_get_core_param(mtlk_df_user_t* df_user, uint32 param_id, char* data, uint16* length)
2474 int res;
2476 _DF_USER_GET_PARAM_MAP_START(df_user, param_id, res)
2478 _DF_USER_GET_ON_PARAM(PRM_ID_BE_BAUSE, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2479 MTLK_CFG_GET_ITEM(&addba_cfg->tid[0], use_aggr, *(uint32*)data);
2481 _DF_USER_GET_ON_PARAM(PRM_ID_BK_BAUSE, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2482 MTLK_CFG_GET_ITEM(&addba_cfg->tid[1], use_aggr, *(uint32*)data);
2484 _DF_USER_GET_ON_PARAM(PRM_ID_VI_BAUSE, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2485 MTLK_CFG_GET_ITEM(&addba_cfg->tid[5], use_aggr, *(uint32*)data);
2487 _DF_USER_GET_ON_PARAM(PRM_ID_VO_BAUSE, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2488 MTLK_CFG_GET_ITEM(&addba_cfg->tid[6], use_aggr, *(uint32*)data);
2490 _DF_USER_GET_ON_PARAM(PRM_ID_BE_BAACCEPT, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2491 MTLK_CFG_GET_ITEM(&addba_cfg->tid[3], accept_aggr, *(uint32*)data);
2493 _DF_USER_GET_ON_PARAM(PRM_ID_BK_BAACCEPT, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2494 MTLK_CFG_GET_ITEM(&addba_cfg->tid[2], accept_aggr, *(uint32*)data);
2496 _DF_USER_GET_ON_PARAM(PRM_ID_VI_BAACCEPT, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2497 MTLK_CFG_GET_ITEM(&addba_cfg->tid[5], accept_aggr, *(uint32*)data);
2499 _DF_USER_GET_ON_PARAM(PRM_ID_VO_BAACCEPT, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2500 MTLK_CFG_GET_ITEM(&addba_cfg->tid[7], accept_aggr, *(uint32*)data);
2502 _DF_USER_GET_ON_PARAM(PRM_ID_BE_BATIMEOUT, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2503 MTLK_CFG_GET_ITEM(&addba_cfg->tid[0], addba_timeout, *(uint32*)data);
2505 _DF_USER_GET_ON_PARAM(PRM_ID_BK_BATIMEOUT, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2506 MTLK_CFG_GET_ITEM(&addba_cfg->tid[1], addba_timeout, *(uint32*)data);
2508 _DF_USER_GET_ON_PARAM(PRM_ID_VI_BATIMEOUT, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2509 MTLK_CFG_GET_ITEM(&addba_cfg->tid[5], addba_timeout, *(uint32*)data);
2511 _DF_USER_GET_ON_PARAM(PRM_ID_VO_BATIMEOUT, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2512 MTLK_CFG_GET_ITEM(&addba_cfg->tid[6], addba_timeout, *(uint32*)data);
2514 _DF_USER_GET_ON_PARAM(PRM_ID_BE_BAWINSIZE, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2515 MTLK_CFG_GET_ITEM(&addba_cfg->tid[0], aggr_win_size, *(uint32*)data);
2517 _DF_USER_GET_ON_PARAM(PRM_ID_BK_BAWINSIZE, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2518 MTLK_CFG_GET_ITEM(&addba_cfg->tid[1], aggr_win_size, *(uint32*)data);
2520 _DF_USER_GET_ON_PARAM(PRM_ID_VI_BAWINSIZE, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2521 MTLK_CFG_GET_ITEM(&addba_cfg->tid[5], aggr_win_size, *(uint32*)data);
2523 _DF_USER_GET_ON_PARAM(PRM_ID_VO_BAWINSIZE, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2524 MTLK_CFG_GET_ITEM(&addba_cfg->tid[6], aggr_win_size, *(uint32*)data);
2526 _DF_USER_GET_ON_PARAM(PRM_ID_BE_AGGRMAXBTS, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2527 MTLK_CFG_GET_ITEM(&addba_cfg->tid[0], max_nof_bytes, *(uint32*)data);
2529 _DF_USER_GET_ON_PARAM(PRM_ID_BK_AGGRMAXBTS, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2530 MTLK_CFG_GET_ITEM(&addba_cfg->tid[1], max_nof_bytes, *(uint32*)data);
2532 _DF_USER_GET_ON_PARAM(PRM_ID_VI_AGGRMAXBTS, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2533 MTLK_CFG_GET_ITEM(&addba_cfg->tid[5], max_nof_bytes, *(uint32*)data);
2535 _DF_USER_GET_ON_PARAM(PRM_ID_VO_AGGRMAXBTS, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2536 MTLK_CFG_GET_ITEM(&addba_cfg->tid[6], max_nof_bytes, *(uint32*)data);
2538 _DF_USER_GET_ON_PARAM(PRM_ID_BE_AGGRMAXPKTS, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2539 MTLK_CFG_GET_ITEM(&addba_cfg->tid[0], max_nof_packets, *(uint32*)data);
2541 _DF_USER_GET_ON_PARAM(PRM_ID_BK_AGGRMAXPKTS, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2542 MTLK_CFG_GET_ITEM(&addba_cfg->tid[1], max_nof_packets, *(uint32*)data);
2544 _DF_USER_GET_ON_PARAM(PRM_ID_VI_AGGRMAXPKTS, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2545 MTLK_CFG_GET_ITEM(&addba_cfg->tid[5], max_nof_packets, *(uint32*)data);
2547 _DF_USER_GET_ON_PARAM(PRM_ID_VO_AGGRMAXPKTS, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2548 MTLK_CFG_GET_ITEM(&addba_cfg->tid[6], max_nof_packets, *(uint32*)data);
2550 _DF_USER_GET_ON_PARAM(PRM_ID_BE_AGGRMINPTSZ, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2551 MTLK_CFG_GET_ITEM(&addba_cfg->tid[0], min_packet_size_in_aggr, *(uint32*)data);
2553 _DF_USER_GET_ON_PARAM(PRM_ID_BK_AGGRMINPTSZ, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2554 MTLK_CFG_GET_ITEM(&addba_cfg->tid[1], min_packet_size_in_aggr, *(uint32*)data);
2556 _DF_USER_GET_ON_PARAM(PRM_ID_VI_AGGRMINPTSZ, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2557 MTLK_CFG_GET_ITEM(&addba_cfg->tid[5], min_packet_size_in_aggr, *(uint32*)data);
2559 _DF_USER_GET_ON_PARAM(PRM_ID_VO_AGGRMINPTSZ, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2560 MTLK_CFG_GET_ITEM(&addba_cfg->tid[6], min_packet_size_in_aggr, *(uint32*)data);
2562 _DF_USER_GET_ON_PARAM(PRM_ID_BE_AGGRTIMEOUT, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2563 MTLK_CFG_GET_ITEM(&addba_cfg->tid[0], timeout_interval, *(uint32*)data);
2565 _DF_USER_GET_ON_PARAM(PRM_ID_BK_AGGRTIMEOUT, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2566 MTLK_CFG_GET_ITEM(&addba_cfg->tid[1], timeout_interval, *(uint32*)data);
2568 _DF_USER_GET_ON_PARAM(PRM_ID_VI_AGGRTIMEOUT, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2569 MTLK_CFG_GET_ITEM(&addba_cfg->tid[5], timeout_interval, *(uint32*)data);
2571 _DF_USER_GET_ON_PARAM(PRM_ID_VO_AGGRTIMEOUT, MTLK_CORE_REQ_GET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
2572 MTLK_CFG_GET_ITEM(&addba_cfg->tid[6], timeout_interval, *(uint32*)data);
2574 _DF_USER_GET_ON_PARAM(PRM_ID_BE_AIFSN, MTLK_CORE_REQ_GET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
2575 MTLK_CFG_GET_ITEM(&wme_bss_cfg->wme_class[0], aifsn, *(uint32*)data);
2577 _DF_USER_GET_ON_PARAM(PRM_ID_BK_AIFSN, MTLK_CORE_REQ_GET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
2578 MTLK_CFG_GET_ITEM(&wme_bss_cfg->wme_class[1], aifsn, *(uint32*)data);
2580 _DF_USER_GET_ON_PARAM(PRM_ID_VI_AIFSN, MTLK_CORE_REQ_GET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
2581 MTLK_CFG_GET_ITEM(&wme_bss_cfg->wme_class[2], aifsn, *(uint32*)data);
2583 _DF_USER_GET_ON_PARAM(PRM_ID_VO_AIFSN, MTLK_CORE_REQ_GET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
2584 MTLK_CFG_GET_ITEM(&wme_bss_cfg->wme_class[3], aifsn, *(uint32*)data);
2586 _DF_USER_GET_ON_PARAM(PRM_ID_BE_CWMAX, MTLK_CORE_REQ_GET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
2587 MTLK_CFG_GET_ITEM(&wme_bss_cfg->wme_class[0], cwmax, *(uint32*)data);
2589 _DF_USER_GET_ON_PARAM(PRM_ID_BK_CWMAX, MTLK_CORE_REQ_GET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
2590 MTLK_CFG_GET_ITEM(&wme_bss_cfg->wme_class[1], cwmax, *(uint32*)data);
2592 _DF_USER_GET_ON_PARAM(PRM_ID_VI_CWMAX, MTLK_CORE_REQ_GET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
2593 MTLK_CFG_GET_ITEM(&wme_bss_cfg->wme_class[2], cwmax, *(uint32*)data);
2595 _DF_USER_GET_ON_PARAM(PRM_ID_VO_CWMAX, MTLK_CORE_REQ_GET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
2596 MTLK_CFG_GET_ITEM(&wme_bss_cfg->wme_class[3], cwmax, *(uint32*)data);
2598 _DF_USER_GET_ON_PARAM(PRM_ID_BE_CWMIN, MTLK_CORE_REQ_GET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
2599 MTLK_CFG_GET_ITEM(&wme_bss_cfg->wme_class[0], cwmin, *(uint32*)data);
2601 _DF_USER_GET_ON_PARAM(PRM_ID_BK_CWMIN, MTLK_CORE_REQ_GET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
2602 MTLK_CFG_GET_ITEM(&wme_bss_cfg->wme_class[1], cwmin, *(uint32*)data);
2604 _DF_USER_GET_ON_PARAM(PRM_ID_VI_CWMIN, MTLK_CORE_REQ_GET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
2605 MTLK_CFG_GET_ITEM(&wme_bss_cfg->wme_class[2], cwmin, *(uint32*)data);
2607 _DF_USER_GET_ON_PARAM(PRM_ID_VO_CWMIN, MTLK_CORE_REQ_GET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
2608 MTLK_CFG_GET_ITEM(&wme_bss_cfg->wme_class[3], cwmin, *(uint32*)data);
2610 _DF_USER_GET_ON_PARAM(PRM_ID_BE_TXOP, MTLK_CORE_REQ_GET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
2611 MTLK_CFG_GET_ITEM(&wme_bss_cfg->wme_class[0], txop, *(uint32*)data);
2613 _DF_USER_GET_ON_PARAM(PRM_ID_BK_TXOP, MTLK_CORE_REQ_GET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
2614 MTLK_CFG_GET_ITEM(&wme_bss_cfg->wme_class[1], txop, *(uint32*)data);
2616 _DF_USER_GET_ON_PARAM(PRM_ID_VI_TXOP, MTLK_CORE_REQ_GET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
2617 MTLK_CFG_GET_ITEM(&wme_bss_cfg->wme_class[2], txop, *(uint32*)data);
2619 _DF_USER_GET_ON_PARAM(PRM_ID_VO_TXOP, MTLK_CORE_REQ_GET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
2620 MTLK_CFG_GET_ITEM(&wme_bss_cfg->wme_class[3], txop, *(uint32*)data);
2622 _DF_USER_GET_ON_PARAM(PRM_ID_BE_AIFSNAP, MTLK_CORE_REQ_GET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
2623 MTLK_CFG_GET_ITEM(&wme_ap_cfg->wme_class[0], aifsn, *(uint32*)data);
2625 _DF_USER_GET_ON_PARAM(PRM_ID_BK_AIFSNAP, MTLK_CORE_REQ_GET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
2626 MTLK_CFG_GET_ITEM(&wme_ap_cfg->wme_class[1], aifsn, *(uint32*)data);
2628 _DF_USER_GET_ON_PARAM(PRM_ID_VI_AIFSNAP, MTLK_CORE_REQ_GET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
2629 MTLK_CFG_GET_ITEM(&wme_ap_cfg->wme_class[2], aifsn, *(uint32*)data);
2631 _DF_USER_GET_ON_PARAM(PRM_ID_VO_AIFSNAP, MTLK_CORE_REQ_GET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
2632 MTLK_CFG_GET_ITEM(&wme_ap_cfg->wme_class[3], aifsn, *(uint32*)data);
2634 _DF_USER_GET_ON_PARAM(PRM_ID_BE_CWMAXAP, MTLK_CORE_REQ_GET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
2635 MTLK_CFG_GET_ITEM(&wme_ap_cfg->wme_class[0], cwmax, *(uint32*)data);
2637 _DF_USER_GET_ON_PARAM(PRM_ID_BK_CWMAXAP, MTLK_CORE_REQ_GET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
2638 MTLK_CFG_GET_ITEM(&wme_ap_cfg->wme_class[1], cwmax, *(uint32*)data);
2640 _DF_USER_GET_ON_PARAM(PRM_ID_VI_CWMAXAP, MTLK_CORE_REQ_GET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
2641 MTLK_CFG_GET_ITEM(&wme_ap_cfg->wme_class[2], cwmax, *(uint32*)data);
2643 _DF_USER_GET_ON_PARAM(PRM_ID_VO_CWMAXAP, MTLK_CORE_REQ_GET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
2644 MTLK_CFG_GET_ITEM(&wme_ap_cfg->wme_class[3], cwmax, *(uint32*)data);
2646 _DF_USER_GET_ON_PARAM(PRM_ID_BE_CWMINAP, MTLK_CORE_REQ_GET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
2647 MTLK_CFG_GET_ITEM(&wme_ap_cfg->wme_class[0], cwmin, *(uint32*)data);
2649 _DF_USER_GET_ON_PARAM(PRM_ID_BK_CWMINAP, MTLK_CORE_REQ_GET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
2650 MTLK_CFG_GET_ITEM(&wme_ap_cfg->wme_class[1], cwmin, *(uint32*)data);
2652 _DF_USER_GET_ON_PARAM(PRM_ID_VI_CWMINAP, MTLK_CORE_REQ_GET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
2653 MTLK_CFG_GET_ITEM(&wme_ap_cfg->wme_class[2], cwmin, *(uint32*)data);
2655 _DF_USER_GET_ON_PARAM(PRM_ID_VO_CWMINAP, MTLK_CORE_REQ_GET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
2656 MTLK_CFG_GET_ITEM(&wme_ap_cfg->wme_class[3], cwmin, *(uint32*)data);
2658 _DF_USER_GET_ON_PARAM(PRM_ID_BE_TXOPAP, MTLK_CORE_REQ_GET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
2659 MTLK_CFG_GET_ITEM(&wme_ap_cfg->wme_class[0], txop, *(uint32*)data);
2661 _DF_USER_GET_ON_PARAM(PRM_ID_BK_TXOPAP, MTLK_CORE_REQ_GET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
2662 MTLK_CFG_GET_ITEM(&wme_ap_cfg->wme_class[1], txop, *(uint32*)data);
2664 _DF_USER_GET_ON_PARAM(PRM_ID_VI_TXOPAP, MTLK_CORE_REQ_GET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
2665 MTLK_CFG_GET_ITEM(&wme_ap_cfg->wme_class[2], txop, *(uint32*)data);
2667 _DF_USER_GET_ON_PARAM(PRM_ID_VO_TXOPAP, MTLK_CORE_REQ_GET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
2668 MTLK_CFG_GET_ITEM(&wme_ap_cfg->wme_class[3], txop, *(uint32*)data);
2670 _DF_USER_GET_ON_PARAM(PRM_ID_AOCS_WEIGHT_CL, MTLK_CORE_REQ_GET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
2671 MTLK_CFG_GET_ITEM(aocs_cfg, weight_ch_load, *(uint32*)data);
2673 _DF_USER_GET_ON_PARAM(PRM_ID_AOCS_WEIGHT_TX, MTLK_CORE_REQ_GET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
2674 MTLK_CFG_GET_ITEM(aocs_cfg, weight_tx_power, *(uint32*)data);
2676 _DF_USER_GET_ON_PARAM(PRM_ID_AOCS_WEIGHT_BSS, MTLK_CORE_REQ_GET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
2677 MTLK_CFG_GET_ITEM(aocs_cfg, weight_nof_bss, *(uint32*)data);
2679 _DF_USER_GET_ON_PARAM(PRM_ID_AOCS_WEIGHT_SM, MTLK_CORE_REQ_GET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
2680 MTLK_CFG_GET_ITEM(aocs_cfg, weight_sm_required, *(uint32*)data);
2682 _DF_USER_GET_ON_PARAM(PRM_ID_AOCS_SCAN_AGING, MTLK_CORE_REQ_GET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
2683 MTLK_CFG_GET_ITEM(aocs_cfg, scan_aging_ms, *(uint32*)data);
2685 _DF_USER_GET_ON_PARAM(PRM_ID_AOCS_CONFIRM_RANK_AGING, MTLK_CORE_REQ_GET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
2686 MTLK_CFG_GET_ITEM(aocs_cfg, confirm_rank_aging_ms, *(uint32*)data);
2688 _DF_USER_GET_ON_PARAM(PRM_ID_AOCS_CFM_RANK_SW_THRESHOLD, MTLK_CORE_REQ_GET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
2689 MTLK_CFG_GET_ITEM(aocs_cfg, cfm_rank_sw_threshold, *(uint32*)data);
2691 _DF_USER_GET_ON_PARAM(PRM_ID_AOCS_AFILTER, MTLK_CORE_REQ_GET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
2692 MTLK_CFG_GET_ITEM(aocs_cfg, alpha_filter_coefficient, *(uint32*)data);
2694 _DF_USER_GET_ON_PARAM(PRM_ID_AOCS_BONDING, MTLK_CORE_REQ_GET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
2695 MTLK_CFG_GET_ITEM(aocs_cfg, bonding, *(uint32*)data);
2697 _DF_USER_GET_ON_PARAM(PRM_ID_AOCS_EN_PENALTIES, MTLK_CORE_REQ_GET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
2698 MTLK_CFG_GET_ITEM(aocs_cfg, use_tx_penalties, *(uint32*)data);
2700 _DF_USER_GET_ON_PARAM(PRM_ID_AOCS_WIN_TIME, MTLK_CORE_REQ_GET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
2701 MTLK_CFG_GET_ITEM(aocs_cfg, udp_aocs_window_time_ms, *(uint32*)data);
2703 _DF_USER_GET_ON_PARAM(PRM_ID_AOCS_LOWER_THRESHOLD, MTLK_CORE_REQ_GET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
2704 MTLK_CFG_GET_ITEM(aocs_cfg, udp_lower_threshold, *(uint32*)data);
2706 _DF_USER_GET_ON_PARAM(PRM_ID_AOCS_THRESHOLD_WINDOW, MTLK_CORE_REQ_GET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
2707 MTLK_CFG_GET_ITEM(aocs_cfg, udp_threshold_window, *(uint32*)data);
2709 _DF_USER_GET_ON_PARAM(PRM_ID_AOCS_MSDU_DEBUG_ENABLED, MTLK_CORE_REQ_GET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
2710 MTLK_CFG_GET_ITEM(aocs_cfg, udp_msdu_debug_enabled, *(uint32*)data);
2712 _DF_USER_GET_ON_PARAM(PRM_ID_AOCS_IS_ENABLED, MTLK_CORE_REQ_GET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
2713 MTLK_CFG_GET_ITEM(aocs_cfg, type, *(uint32*)data);
2715 _DF_USER_GET_ON_PARAM(PRM_ID_AOCS_MSDU_PER_WIN_THRESHOLD, MTLK_CORE_REQ_GET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
2716 MTLK_CFG_GET_ITEM(aocs_cfg, udp_msdu_per_window_threshold, *(uint32*)data);
2718 _DF_USER_GET_ON_PARAM(PRM_ID_AOCS_MSDU_THRESHOLD, MTLK_CORE_REQ_GET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
2719 MTLK_CFG_GET_ITEM(aocs_cfg, udp_msdu_threshold_aocs, *(uint32*)data);
2721 _DF_USER_GET_ON_PARAM(PRM_ID_AOCS_MEASUREMENT_WINDOW, MTLK_CORE_REQ_GET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
2722 MTLK_CFG_GET_ITEM(aocs_cfg, tcp_measurement_window, *(uint32*)data);
2724 _DF_USER_GET_ON_PARAM(PRM_ID_AOCS_THROUGHPUT_THRESHOLD, MTLK_CORE_REQ_GET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
2725 MTLK_CFG_GET_ITEM(aocs_cfg, tcp_throughput_threshold, *(uint32*)data);
2727 _DF_USER_GET_ON_PARAM(PRM_ID_AOCS_NON_OCCUPANCY_PERIOD, MTLK_CORE_REQ_GET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
2728 MTLK_CFG_GET_ITEM(aocs_cfg, dbg_non_occupied_period, *(uint32*)data);
2730 _DF_USER_GET_ON_PARAM(PRM_ID_AOCS_RESTRICT_MODE, MTLK_CORE_REQ_GET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
2731 MTLK_CFG_GET_ITEM(aocs_cfg, restrict_mode, *(uint32*)data);
2733 _DF_USER_GET_ON_PARAM(PRM_ID_AOCS_RESTRICTED_CHANNELS, MTLK_CORE_REQ_GET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
2734 MTLK_CFG_GET_ITEM_BY_FUNC(aocs_cfg, restricted_channels, _mtlk_df_user_print_restricted_ch,
2735 (data, TEXT_SIZE, aocs_cfg->restricted_channels), *length);
2737 _DF_USER_GET_ON_PARAM(PRM_ID_AOCS_MSDU_TX_AC, MTLK_CORE_REQ_GET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
2738 MTLK_CFG_GET_ITEM_BY_FUNC(aocs_cfg, msdu_tx_ac, _mtlk_df_user_print_msdu_ac,
2739 (data, TEXT_SIZE, &aocs_cfg->msdu_tx_ac), *length);
2741 _DF_USER_GET_ON_PARAM(PRM_ID_AOCS_MSDU_RX_AC, MTLK_CORE_REQ_GET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
2742 MTLK_CFG_GET_ITEM_BY_FUNC(aocs_cfg, msdu_rx_ac, _mtlk_df_user_print_msdu_ac,
2743 (data, TEXT_SIZE, &aocs_cfg->msdu_rx_ac), *length);
2745 _DF_USER_GET_ON_PARAM(PRM_ID_AOCS_NON_WIFI_NOISE, MTLK_CORE_REQ_GET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
2746 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(aocs_cfg, non_wifi_interf, _mtlk_df_user_get_intvec_by_interf_params,
2747 ((int32*)data, length, &aocs_cfg->non_wifi_interf));
2749 _DF_USER_GET_ON_PARAM(PRM_ID_11H_RADAR_DETECTION, MTLK_CORE_REQ_GET_DOT11H_CFG, FALSE, mtlk_11h_cfg_t, dot11h_cfg)
2750 MTLK_CFG_GET_ITEM(dot11h_cfg, radar_detect, *(uint32*)data);
2752 _DF_USER_GET_ON_PARAM(PRM_ID_11H_STATUS, MTLK_CORE_REQ_GET_DOT11H_CFG, FALSE, mtlk_11h_cfg_t, dot11h_cfg)
2753 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(dot11h_cfg, status, strcpy, (data, dot11h_cfg->status));
2754 *length = strlen(dot11h_cfg->status);
2756 _DF_USER_GET_ON_PARAM(PRM_ID_11H_BEACON_COUNT, MTLK_CORE_REQ_GET_DOT11H_AP_CFG, FALSE, mtlk_11h_ap_cfg_t, dot11h_cfg)
2757 MTLK_CFG_GET_ITEM(dot11h_cfg, debugChannelSwitchCount, *(uint32*)data);
2759 _DF_USER_GET_ON_PARAM(PRM_ID_11H_CHANNEL_AVAILABILITY_CHECK_TIME, MTLK_CORE_REQ_GET_DOT11H_AP_CFG, FALSE, mtlk_11h_ap_cfg_t, dot11h_cfg)
2760 MTLK_CFG_GET_ITEM(dot11h_cfg, debugChannelAvailabilityCheckTime, *(uint32*)data);
2762 _DF_USER_GET_ON_PARAM(PRM_ID_11H_ENABLE_SM_CHANNELS, MTLK_CORE_REQ_GET_DOT11H_AP_CFG, FALSE, mtlk_11h_ap_cfg_t, dot11h_cfg)
2763 MTLK_CFG_GET_ITEM(dot11h_cfg, enable_sm_required, *(uint32*)data);
2765 _DF_USER_GET_ON_PARAM(PRM_ID_11H_NEXT_CHANNEL, MTLK_CORE_REQ_GET_DOT11H_AP_CFG, FALSE, mtlk_11h_ap_cfg_t, dot11h_cfg)
2766 MTLK_CFG_GET_ITEM(dot11h_cfg, next_channel, *(uint32*)data);
2768 _DF_USER_GET_ON_PARAM(MIB_ACL_MODE, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2769 MTLK_CFG_GET_ITEM(mibs_cfg, acl_mode, *(uint32*)data);
2771 _DF_USER_GET_ON_PARAM(PRM_ID_VAP_STA_LIMS, MTLK_CORE_REQ_MBSS_GET_VARS, FALSE, mtlk_mbss_cfg_t, mbss_cfg)
2772 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(mbss_cfg, vap_limits, _mtlk_df_get_vap_limits_cfg,
2773 (mbss_cfg, &((uint32*)data)[0], &((uint32*)data)[1]));
2774 *length = VAP_LIMIT_SET_SIZE;
2776 _DF_USER_GET_ON_PARAM(MIB_CALIBRATION_ALGO_MASK, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2777 MTLK_CFG_GET_ITEM(mibs_cfg, calibr_algo_mask, *(uint32*)data);
2779 _DF_USER_GET_ON_PARAM(PRM_USE_SHORT_CYCLIC_PREFIX_RX, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2780 MTLK_CFG_GET_ITEM(mibs_cfg, short_cyclic_prefix_rx, *(uint32*)data);
2782 _DF_USER_GET_ON_PARAM(PRM_USE_SHORT_CYCLIC_PREFIX_TX, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2783 MTLK_CFG_GET_ITEM(mibs_cfg, short_cyclic_prefix_tx, *(uint32*)data);
2785 _DF_USER_GET_ON_PARAM(PRM_USE_SHORT_CYCLIC_PREFIX_RATE31, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2786 MTLK_CFG_GET_ITEM(mibs_cfg, short_cyclic_prefix_rate31, *(uint32*)data);
2788 _DF_USER_GET_ON_PARAM(PRM_ID_SHORT_PREAMBLE_OPTION_IMPLEMENTED, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2789 MTLK_CFG_GET_ITEM(mibs_cfg, short_preamble_option, *(uint32*)data);
2791 _DF_USER_GET_ON_PARAM(PRM_ID_SHORT_SLOT_TIME_OPTION_ENABLED_11G, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2792 MTLK_CFG_GET_ITEM(mibs_cfg, short_slot_time_option, *(uint32*)data);
2794 _DF_USER_GET_ON_PARAM(MIB_SHORT_RETRY_LIMIT, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2795 MTLK_CFG_GET_ITEM(mibs_cfg, short_retry_limit, *(uint32*)data);
2797 _DF_USER_GET_ON_PARAM(MIB_LONG_RETRY_LIMIT, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2798 MTLK_CFG_GET_ITEM(mibs_cfg, long_retry_limit, *(uint32*)data);
2800 _DF_USER_GET_ON_PARAM(MIB_TX_MSDU_LIFETIME, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2801 MTLK_CFG_GET_ITEM(mibs_cfg, tx_msdu_lifetime, *(uint32*)data);
2803 _DF_USER_GET_ON_PARAM(MIB_CURRENT_TX_ANTENNA, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2804 MTLK_CFG_GET_ITEM(mibs_cfg, current_tx_antenna, *(uint32*)data);
2806 _DF_USER_GET_ON_PARAM(MIB_BEACON_PERIOD, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2807 MTLK_CFG_GET_ITEM(mibs_cfg, beacon_period, *(uint32*)data);
2809 _DF_USER_GET_ON_PARAM(MIB_DISCONNECT_ON_NACKS_WEIGHT, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2810 MTLK_CFG_GET_ITEM(mibs_cfg, disconnect_on_nacks_weight, *(uint32*)data);
2812 _DF_USER_GET_ON_PARAM(MIB_SM_ENABLE, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2813 MTLK_CFG_GET_ITEM(mibs_cfg, sm_enable, *(uint32*)data);
2815 _DF_USER_GET_ON_PARAM(MIB_ADVANCED_CODING_SUPPORTED, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2816 MTLK_CFG_GET_ITEM(mibs_cfg, advanced_coding_supported, *(uint32*)data);
2818 _DF_USER_GET_ON_PARAM(MIB_OVERLAPPING_PROTECTION_ENABLE, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2819 MTLK_CFG_GET_ITEM(mibs_cfg, overlapping_protect_enabled, *(uint32*)data);
2821 _DF_USER_GET_ON_PARAM(MIB_OFDM_PROTECTION_METHOD, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2822 MTLK_CFG_GET_ITEM(mibs_cfg, ofdm_protect_method, *(uint32*)data);
2824 _DF_USER_GET_ON_PARAM(MIB_HT_PROTECTION_METHOD, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2825 MTLK_CFG_GET_ITEM(mibs_cfg, ht_method, *(uint32*)data);
2827 _DF_USER_GET_ON_PARAM(MIB_DTIM_PERIOD, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2828 MTLK_CFG_GET_ITEM(mibs_cfg, dtim_period, *(uint32*)data);
2830 _DF_USER_GET_ON_PARAM(MIB_RECEIVE_AMPDU_MAX_LENGTH, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2831 MTLK_CFG_GET_ITEM(mibs_cfg, receive_ampdu_max_len, *(uint32*)data);
2833 _DF_USER_GET_ON_PARAM(MIB_CB_DATABINS_PER_SYMBOL, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2834 MTLK_CFG_GET_ITEM(mibs_cfg, cb_databins_per_symbol, *(uint32*)data);
2836 _DF_USER_GET_ON_PARAM(MIB_USE_LONG_PREAMBLE_FOR_MULTICAST, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2837 MTLK_CFG_GET_ITEM(mibs_cfg, use_long_preamble_for_multicast, *(uint32*)data);
2839 _DF_USER_GET_ON_PARAM(MIB_USE_SPACE_TIME_BLOCK_CODE, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2840 MTLK_CFG_GET_ITEM(mibs_cfg, use_space_time_block_code, *(uint32*)data);
2842 _DF_USER_GET_ON_PARAM(MIB_TWO_ANTENNA_TRANSMISSION_ENABLE, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2843 if (mtlk_vap_is_master(mtlk_df_get_vap_handle(df_user->df))) {
2844 MTLK_CFG_GET_ITEM(mibs_cfg, two_antenna_tx_enable, *(uint32*)data);
2845 } else {
2846 res = MTLK_ERR_NOT_SUPPORTED;
2849 _DF_USER_GET_ON_PARAM(MIB_ONLINE_CALIBRATION_ALGO_MASK, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2850 MTLK_CFG_GET_ITEM(mibs_cfg, online_calibr_algo_mask, *(uint32*)data);
2852 _DF_USER_GET_ON_PARAM(MIB_DISCONNECT_ON_NACKS_ENABLE, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2853 MTLK_CFG_GET_ITEM(mibs_cfg, disconnect_on_nacks_enable, *(uint32*)data);
2855 _DF_USER_GET_ON_PARAM(MIB_RTS_THRESHOLD, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2856 MTLK_CFG_GET_ITEM(mibs_cfg, rts_threshold, *(uint32*)data);
2858 _DF_USER_GET_ON_PARAM(MIB_TX_POWER, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2859 MTLK_CFG_GET_ITEM(mibs_cfg, tx_power, *(uint32*)data);
2861 _DF_USER_GET_ON_PARAM(MIB_SUPPORTED_TX_ANTENNAS, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2862 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(mibs_cfg, tx_antennas, strncpy,
2863 (data, mibs_cfg->tx_antennas, MTLK_NUM_ANTENNAS_BUFSIZE));
2864 *length = MTLK_NUM_ANTENNAS_BUFSIZE;
2866 _DF_USER_GET_ON_PARAM(MIB_SUPPORTED_RX_ANTENNAS, MTLK_CORE_REQ_GET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
2867 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(mibs_cfg, rx_antennas, strncpy,
2868 (data, mibs_cfg->rx_antennas, MTLK_NUM_ANTENNAS_BUFSIZE));
2869 *length = MTLK_NUM_ANTENNAS_BUFSIZE;
2871 _DF_USER_GET_ON_PARAM(PRM_ID_HIDDEN_SSID, MTLK_CORE_REQ_GET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, core_cfg)
2872 MTLK_CFG_GET_ITEM(core_cfg, is_hidden_ssid, *(uint32*)data);
2874 _DF_USER_GET_ON_PARAM(MIB_COUNTRY, MTLK_CORE_REQ_GET_COUNTRY_CFG, FALSE, mtlk_country_cfg_t, country_cfg)
2875 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(country_cfg, country, strncpy,
2876 (data, country_cfg->country, MTLK_CHNLS_COUNTRY_BUFSIZE));
2877 *length = MTLK_CHNLS_COUNTRY_BUFSIZE;
2879 _DF_USER_GET_ON_PARAM(PRM_ID_L2NAT_AGING_TIMEOUT, MTLK_CORE_REQ_GET_L2NAT_CFG, FALSE, mtlk_l2nat_cfg_t, l2nat_cfg)
2880 MTLK_CFG_GET_ITEM(l2nat_cfg, aging_timeout, *(uint32*)data);
2882 _DF_USER_GET_ON_PARAM(PRM_ID_L2NAT_DEFAULT_HOST, MTLK_CORE_REQ_GET_L2NAT_CFG, FALSE, mtlk_l2nat_cfg_t, l2nat_cfg)
2883 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(l2nat_cfg, address, memcpy, ((*(struct sockaddr*)data).sa_data, l2nat_cfg->address.au8Addr, ETH_ALEN));
2885 _DF_USER_GET_ON_PARAM(PRM_ID_PEERAP_KEY_IDX, MTLK_CORE_REQ_GET_WDS_CFG, FALSE, mtlk_wds_cfg_t, wds_cfg)
2886 MTLK_CFG_GET_ITEM(wds_cfg, peer_ap_key_idx, *(uint32*)data);
2888 _DF_USER_GET_ON_PARAM(PRM_ID_PEERAP_LIST, MTLK_CORE_REQ_GET_WDS_PEERAP, FALSE, mtlk_wds_cfg_t, wds_cfg)
2889 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(wds_cfg, peer_ap_vect, _mtlk_df_user_addr_vect_to_text, (data, wds_cfg->peer_ap_vect, length, TEXT_SIZE));
2890 mtlk_clpb_delete(wds_cfg->peer_ap_vect);
2891 wds_cfg->peer_ap_vect = NULL;
2893 _DF_USER_GET_ON_PARAM(PRM_ID_11D, MTLK_CORE_REQ_GET_DOT11D_CFG, FALSE, mtlk_dot11d_cfg_t, dot11d_cfg)
2894 MTLK_CFG_GET_ITEM(dot11d_cfg, is_dot11d, *(uint32*)data);
2896 _DF_USER_GET_ON_PARAM(PRM_ID_MAC_WATCHDOG_TIMEOUT_MS, MTLK_CORE_REQ_GET_MAC_WATCHDOG_CFG, FALSE, mtlk_mac_wdog_cfg_t, mac_wdog_cfg)
2897 MTLK_CFG_GET_ITEM(mac_wdog_cfg, mac_watchdog_timeout_ms, *(uint32*)data);
2899 _DF_USER_GET_ON_PARAM(PRM_ID_MAC_WATCHDOG_PERIOD_MS, MTLK_CORE_REQ_GET_MAC_WATCHDOG_CFG, FALSE, mtlk_mac_wdog_cfg_t, mac_wdog_cfg)
2900 MTLK_CFG_GET_ITEM(mac_wdog_cfg, mac_watchdog_period_ms, *(uint32*)data);
2902 _DF_USER_GET_ON_PARAM(PRM_ID_STA_KEEPALIVE_TIMEOUT, MTLK_CORE_REQ_GET_STADB_CFG, FALSE, mtlk_stadb_cfg_t, stadb_cfg)
2903 MTLK_CFG_GET_ITEM(stadb_cfg, sta_keepalive_timeout, *(uint32*)data);
2905 _DF_USER_GET_ON_PARAM(PRM_ID_STA_KEEPALIVE_INTERVAL, MTLK_CORE_REQ_GET_STADB_CFG, FALSE, mtlk_stadb_cfg_t, stadb_cfg)
2906 MTLK_CFG_GET_ITEM(stadb_cfg, keepalive_interval, *(uint32*)data);
2908 _DF_USER_GET_ON_PARAM(PRM_ID_AGGR_OPEN_THRESHOLD, MTLK_CORE_REQ_GET_STADB_CFG, FALSE, mtlk_stadb_cfg_t, stadb_cfg)
2909 MTLK_CFG_GET_ITEM(stadb_cfg, aggr_open_threshold, *(uint32*)data);
2911 _DF_USER_GET_ON_PARAM(PRM_ID_BRIDGE_MODE, MTLK_CORE_REQ_GET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, core_cfg)
2912 MTLK_CFG_GET_ITEM(core_cfg, bridge_mode, *(uint32*)data);
2914 _DF_USER_GET_ON_PARAM(PRM_ID_DBG_SW_WD_ENABLE, MTLK_CORE_REQ_GET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, core_cfg)
2915 MTLK_CFG_GET_ITEM(core_cfg, dbg_sw_wd_enable, *(uint32*)data);
2917 _DF_USER_GET_ON_PARAM(PRM_ID_RELIABLE_MULTICAST, MTLK_CORE_REQ_GET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, core_cfg)
2918 MTLK_CFG_GET_ITEM(core_cfg, reliable_multicast, *(uint32*)data);
2920 _DF_USER_GET_ON_PARAM(PRM_ID_UP_RESCAN_EXEMPTION_TIME, MTLK_CORE_REQ_GET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, core_cfg)
2921 MTLK_CFG_GET_ITEM(core_cfg, up_rescan_exemption_time, *(uint32*)data);
2923 _DF_USER_GET_ON_PARAM(PRM_ID_AP_FORWARDING, MTLK_CORE_REQ_GET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, core_cfg)
2924 MTLK_CFG_GET_ITEM(core_cfg, ap_forwarding, *(uint32*)data);
2926 _DF_USER_GET_ON_PARAM(PRM_ID_SPECTRUM_MODE, MTLK_CORE_REQ_GET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, core_cfg)
2927 MTLK_CFG_GET_ITEM(core_cfg, spectrum_mode, *(uint32*)data);
2929 _DF_USER_GET_ON_PARAM(PRM_ID_NETWORK_MODE, MTLK_CORE_REQ_GET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, core_cfg)
2930 MTLK_CFG_GET_ITEM(core_cfg, net_mode, *(uint32*)data);
2931 *(uint32*)data = _net_mode_egress_filter(*(uint32*)data);
2933 _DF_USER_GET_ON_PARAM(PRM_ID_BSS_BASIC_RATE_SET, MTLK_CORE_REQ_GET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, core_cfg)
2934 MTLK_CFG_GET_ITEM(core_cfg, basic_rates, *(uint32*)data);
2936 _DF_USER_GET_ON_PARAM(PRM_ID_BSS_SUPPORTED_RATE_SET, MTLK_CORE_REQ_GET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, core_cfg)
2937 MTLK_CFG_GET_ITEM(core_cfg, supported_rates, *(uint32*)data);
2939 _DF_USER_GET_ON_PARAM(PRM_ID_BSS_EXTENDED_RATE_SET, MTLK_CORE_REQ_GET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, core_cfg)
2940 MTLK_CFG_GET_ITEM(core_cfg, extended_rates, *(uint32*)data);
2942 _DF_USER_GET_ON_PARAM(PRM_ID_CHANNEL, MTLK_CORE_REQ_GET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, core_cfg)
2943 MTLK_CFG_GET_ITEM(core_cfg, channel, *(uint32*)data);
2945 _DF_USER_GET_ON_PARAM(PRM_ID_POWER_SELECTION, MTLK_CORE_REQ_GET_MASTER_CFG, FALSE, mtlk_master_core_cfg_t, master_cfg)
2946 MTLK_CFG_GET_ITEM(master_cfg, power_selection, *(uint32*)data);
2948 _DF_USER_GET_ON_PARAM(PRM_ID_RX_HIGH_THRESHOLD, MTLK_CORE_REQ_GET_MASTER_CFG, FALSE, mtlk_master_core_cfg_t, master_cfg)
2949 MTLK_CFG_GET_ITEM(master_cfg, rx_high_threshold, *(uint32*)data);
2951 _DF_USER_GET_ON_PARAM(PRM_ID_CCA_THRESHOLD, MTLK_CORE_REQ_GET_MASTER_CFG, FALSE, mtlk_master_core_cfg_t, master_cfg)
2952 MTLK_CFG_GET_ITEM(master_cfg, cca_threshold, *(uint32*)data);
2954 _DF_USER_GET_ON_PARAM(PRM_ID_RA_PROTECTION, MTLK_CORE_REQ_GET_MASTER_CFG, FALSE, mtlk_master_core_cfg_t, master_cfg)
2955 MTLK_CFG_GET_ITEM(master_cfg, ra_protection, *(uint32*)data);
2957 _DF_USER_GET_ON_PARAM(PRM_ID_FORCE_NCB, MTLK_CORE_REQ_GET_MASTER_CFG, FALSE, mtlk_master_core_cfg_t, master_cfg)
2958 MTLK_CFG_GET_ITEM(master_cfg, force_ncb, *(uint32*)data);
2960 _DF_USER_GET_ON_PARAM(PRM_ID_N_RATES_BOS, MTLK_CORE_REQ_GET_MASTER_CFG, FALSE, mtlk_master_core_cfg_t, master_cfg)
2961 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(master_cfg, n_rate_bo,
2962 _mtlk_df_user_get_intvec_by_n_rate_bo, ((int32*)data, length, &master_cfg->n_rate_bo));
2964 _DF_USER_GET_ON_PARAM(PRM_ID_DEBUG_TPC, MTLK_CORE_REQ_GET_MASTER_CFG, FALSE, mtlk_master_core_cfg_t, master_cfg)
2965 MTLK_CFG_GET_ITEM(master_cfg, debug_tpc, *(uint32*)data);
2967 _DF_USER_GET_ON_PARAM(PRM_ID_VAP_LNA_GAINS, MTLK_CORE_REQ_GET_MASTER_CFG, FALSE, mtlk_master_core_cfg_t, master_cfg)
2968 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(master_cfg, lna_gain, _mtlk_df_user_intvec_by_lna_gain,
2969 ((uint32*)data, length, &master_cfg->lna_gain));
2971 _DF_USER_GET_ON_PARAM(PRM_ID_CORE_COUNTRIES_SUPPORTED, MTLK_CORE_REQ_GET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, core_cfg)
2972 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(core_cfg, countries_supported,
2973 _mtlk_df_user_countries_supported_to_str, (core_cfg->countries_supported, data, TEXT_SIZE));
2974 *length = TEXT_SIZE;
2976 _DF_USER_GET_ON_PARAM(PRM_ID_NICK_NAME, MTLK_CORE_REQ_GET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, core_cfg)
2977 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(core_cfg, nickname,
2978 memcpy, (data, core_cfg->nickname, IW_ESSID_MAX_SIZE));
2979 *length = strnlen(data, IW_ESSID_MAX_SIZE);
2981 _DF_USER_GET_ON_PARAM(PRM_ID_ESSID, MTLK_CORE_REQ_GET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, core_cfg)
2982 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(core_cfg, essid,
2983 memcpy, (data, core_cfg->essid, IW_ESSID_MAX_SIZE));
2984 *length = strnlen(data, IW_ESSID_MAX_SIZE);
2986 _DF_USER_GET_ON_PARAM(PRM_ID_BSSID, MTLK_CORE_REQ_GET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, core_cfg)
2987 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(core_cfg, bssid, memcpy,
2988 (data, core_cfg->bssid, ETH_ALEN));
2989 *length = ETH_ALEN;
2991 _DF_USER_GET_ON_PARAM(PRM_ID_LEGACY_FORCE_RATE, MTLK_CORE_REQ_GET_MASTER_CFG, FALSE, mtlk_master_core_cfg_t, master_cfg)
2992 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(master_cfg, legacy_force_rate, _mtlk_df_user_bitrate_to_str,
2993 (&master_cfg->legacy_force_rate, data, TEXT_SIZE));
2994 *length = TEXT_SIZE;
2996 _DF_USER_GET_ON_PARAM(PRM_ID_HT_FORCE_RATE, MTLK_CORE_REQ_GET_MASTER_CFG, FALSE, mtlk_master_core_cfg_t, master_cfg)
2997 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(master_cfg, ht_force_rate, _mtlk_df_user_bitrate_to_str,
2998 (&master_cfg->ht_force_rate, data, TEXT_SIZE));
2999 *length = TEXT_SIZE;
3001 _DF_USER_GET_ON_PARAM(PRM_ID_AGG_RATE_LIMIT, MTLK_CORE_REQ_GET_MASTER_CFG, FALSE, mtlk_master_core_cfg_t, master_cfg)
3002 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(master_cfg, agg_rate_limit, _mtlk_df_user_intvec_by_agg_rate_limit,
3003 ((uint32*)data, length, &master_cfg->agg_rate_limit));
3005 _DF_USER_GET_ON_PARAM(PRM_ID_RX_DUTY_CYCLE, MTLK_CORE_REQ_GET_MASTER_CFG, FALSE, mtlk_master_core_cfg_t, master_cfg)
3006 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(master_cfg, rx_duty_cycle, _mtlk_df_user_intvec_by_rx_duty_cycle,
3007 ((uint32*)data, length, &master_cfg->rx_duty_cycle));
3009 _DF_USER_GET_ON_PARAM(PRM_ID_ACL, MTLK_CORE_REQ_GET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, core_cfg)
3010 int i;
3011 MTLK_CFG_GET_ITEM(core_cfg, num_macs_to_set, *length);
3012 MTLK_ASSERT(*length <= MAX_ADDRESSES_IN_ACL);
3013 for (i=0; i<*length; i++) {
3014 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(core_cfg, macs_to_set, memcpy,
3015 (((struct sockaddr*)data)[i].sa_data, core_cfg->macs_to_set[i].au8Addr,sizeof(core_cfg->macs_to_set[i].au8Addr)))
3018 _DF_USER_GET_ON_PARAM(PRM_ID_ACL_RANGE, MTLK_CORE_REQ_GET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, core_cfg)
3019 int i, num_ranges;
3020 MTLK_CFG_GET_ITEM(core_cfg, num_macs_to_set, *length);
3021 MTLK_ASSERT(*length <= MAX_ADDRESSES_IN_ACL);
3022 for (i=0, num_ranges=0; i<*length; i++) {
3023 if (mtlk_osal_compare_eth_addresses(EMPTY_MAC_MASK.au8Addr, core_cfg->mac_mask[i].au8Addr)) {
3024 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(core_cfg, macs_to_set, memcpy,
3025 (((struct sockaddr*)data)[num_ranges << 1].sa_data, core_cfg->macs_to_set[i].au8Addr,sizeof(core_cfg->macs_to_set[i].au8Addr)))
3026 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(core_cfg, macs_to_set, memcpy,
3027 (((struct sockaddr*)data)[(num_ranges << 1) + 1].sa_data, core_cfg->mac_mask[i].au8Addr,sizeof(core_cfg->mac_mask[i].au8Addr)))
3028 num_ranges++;
3031 *length = num_ranges << 1;
3033 _DF_USER_GET_ON_PARAM(PRM_ID_ACTIVE_SCAN_SSID, MTLK_CORE_REQ_GET_SCAN_CFG, FALSE, mtlk_scan_cfg_t, scan_cfg)
3034 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(scan_cfg, essid, strncpy,
3035 (data, scan_cfg->essid, MIB_ESSID_LENGTH + 1));
3036 *length = MIB_ESSID_LENGTH + 1;
3038 _DF_USER_GET_ON_PARAM(PRM_ID_EEPROM, MTLK_CORE_REQ_GET_EEPROM_CFG, FALSE, mtlk_eeprom_cfg_t, eeprom_cfg)
3039 /* TODO: incorrect implementation, is_if_stopped flag must be dropped in favor of abilities or internal core logic */
3040 BOOL is_if_stopped = FALSE;
3041 MTLK_CFG_GET_ITEM(eeprom_cfg, is_if_stopped, is_if_stopped);
3043 if (is_if_stopped) {
3044 int used_len = 0;
3045 *length = 0;
3046 MTLK_CFG_GET_ITEM_BY_FUNC(eeprom_cfg, eeprom_data, _mtlk_df_user_print_eeprom,
3047 (&eeprom_cfg->eeprom_data, data, TEXT_SIZE), used_len);
3048 *length += used_len;
3049 MTLK_ASSERT(*length <= TEXT_SIZE);
3051 MTLK_CFG_GET_ITEM_BY_FUNC(eeprom_cfg, eeprom_raw_data, _mtlk_df_user_print_raw_eeprom,
3052 (eeprom_cfg->eeprom_raw_data, sizeof(eeprom_cfg->eeprom_raw_data), data+*length, TEXT_SIZE-*length), used_len);
3053 *length += used_len;
3054 MTLK_ASSERT(*length <= TEXT_SIZE);
3056 else {
3057 *length = mtlk_snprintf(data, TEXT_SIZE, "EE data is not available since IF is up\n");
3060 _DF_USER_GET_ON_PARAM(PRM_ID_TX_POWER_LIMIT, MTLK_CORE_REQ_GET_TX_POWER_LIMIT, FALSE,
3061 mtlk_tx_power_limit_cfg_t, tx_power_limit_cfg)
3062 MTLK_CFG_GET_ITEM(tx_power_limit_cfg, field_01, ((int32*)data)[0]);
3063 MTLK_CFG_GET_ITEM(tx_power_limit_cfg, field_02, ((int32*)data)[1]);
3064 MTLK_CFG_GET_ITEM(tx_power_limit_cfg, field_03, ((int32*)data)[2]);
3065 *length = 3;
3067 _DF_USER_GET_ON_PARAM(PRM_ID_WDS_HOST_TIMEOUT, MTLK_CORE_REQ_GET_HSTDB_CFG, FALSE, mtlk_hstdb_cfg_t, hstdb_cfg)
3068 MTLK_CFG_GET_ITEM(hstdb_cfg, wds_host_timeout, *(uint32*)data);
3070 _DF_USER_GET_ON_PARAM(PRM_ID_HSTDB_LOCAL_MAC, MTLK_CORE_REQ_GET_HSTDB_CFG, FALSE, mtlk_hstdb_cfg_t, hstdb_cfg)
3071 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(hstdb_cfg, address, memcpy,
3072 (((struct sockaddr*)data)->sa_data, hstdb_cfg->address.au8Addr, ETH_ALEN));
3074 _DF_USER_GET_ON_PARAM(PRM_ID_SCAN_CACHE_LIFETIME, MTLK_CORE_REQ_GET_SCAN_CFG, FALSE, mtlk_scan_cfg_t, scan_cfg)
3075 MTLK_CFG_GET_ITEM(scan_cfg, cache_expire, *(uint32*)data);
3077 _DF_USER_GET_ON_PARAM(PRM_ID_BG_SCAN_CH_LIMIT, MTLK_CORE_REQ_GET_SCAN_CFG, FALSE, mtlk_scan_cfg_t, scan_cfg)
3078 MTLK_CFG_GET_ITEM(scan_cfg, channels_per_chunk_limit, *(uint32*)data);
3080 _DF_USER_GET_ON_PARAM(PRM_ID_BG_SCAN_PAUSE, MTLK_CORE_REQ_GET_SCAN_CFG, FALSE, mtlk_scan_cfg_t, scan_cfg)
3081 MTLK_CFG_GET_ITEM(scan_cfg, pause_between_chunks, *(uint32*)data);
3083 _DF_USER_GET_ON_PARAM(PRM_ID_IS_BACKGROUND_SCAN, MTLK_CORE_REQ_GET_SCAN_CFG, FALSE, mtlk_scan_cfg_t, scan_cfg)
3084 MTLK_CFG_GET_ITEM(scan_cfg, is_background_scan, *(uint32*)data);
3086 _DF_USER_GET_ON_PARAM(PRM_ID_USE_8021Q, MTLK_CORE_REQ_GET_QOS_CFG, FALSE, mtlk_qos_cfg_t, qos_cfg)
3087 MTLK_CFG_GET_ITEM(qos_cfg, map, *(uint32*)data);
3089 _DF_USER_GET_ON_PARAM(PRM_ID_COC_POWER_MODE, MTLK_CORE_REQ_GET_COC_CFG, FALSE, mtlk_coc_mode_cfg_t, coc_cfg)
3090 MTLK_CFG_GET_ITEM(coc_cfg, is_auto_mode, *(uint32*)data);
3091 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(coc_cfg, antenna_params,
3092 _mtlk_df_user_get_intvec_by_antenna_params, ((uint32*)data, length, &coc_cfg->antenna_params));
3094 _DF_USER_GET_ON_PARAM(PRM_ID_COC_AUTO_PARAMS, MTLK_CORE_REQ_GET_COC_CFG, FALSE, mtlk_coc_mode_cfg_t, coc_cfg)
3095 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(coc_cfg, auto_params,
3096 _mtlk_df_user_get_intvec_by_auto_params, ((uint32*)data, length, &coc_cfg->auto_params));
3098 #ifdef MTCFG_PMCU_SUPPORT
3099 _DF_USER_GET_ON_PARAM(PRM_ID_PCOC_POWER_MODE, MTLK_CORE_REQ_GET_PCOC_CFG, FALSE, mtlk_pcoc_mode_cfg_t, pcoc_cfg)
3100 MTLK_CFG_GET_ITEM(pcoc_cfg, is_enabled, ((uint32*)data)[0]);
3101 MTLK_CFG_GET_ITEM(pcoc_cfg, is_active, ((uint32*)data)[1]);
3102 MTLK_CFG_GET_ITEM(pcoc_cfg, traffic_state, ((uint32*)data)[2]);
3103 *length = 3;
3105 _DF_USER_GET_ON_PARAM(PRM_ID_PCOC_AUTO_PARAMS, MTLK_CORE_REQ_GET_PCOC_CFG, FALSE, mtlk_pcoc_mode_cfg_t, pcoc_cfg)
3106 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(pcoc_cfg, params,
3107 _mtlk_df_user_get_intvec_by_pcoc_params, ((uint32*)data, length, &pcoc_cfg->params));
3108 #endif
3110 _DF_USER_GET_ON_PARAM(PRM_ID_SQ_LIMITS, MTLK_CORE_REQ_GET_SQ_CFG, FALSE, mtlk_sq_cfg_t, sq_cfg)
3111 MTLK_CFG_GET_ARRAY_ITEM(sq_cfg, sq_limit, (int32*)data, NTS_PRIORITIES);
3112 *length = NTS_PRIORITIES;
3114 _DF_USER_GET_ON_PARAM(PRM_ID_SQ_PEER_LIMITS, MTLK_CORE_REQ_GET_SQ_CFG, FALSE, mtlk_sq_cfg_t, sq_cfg)
3115 MTLK_CFG_GET_ARRAY_ITEM(sq_cfg, peer_queue_limit, (int32*)data, NTS_PRIORITIES);
3116 *length = NTS_PRIORITIES;
3118 /* 20/40 coexistence */
3120 _DF_USER_GET_ON_PARAM(PRM_ID_COEX_MODE, MTLK_CORE_REQ_GET_COEX_20_40_MODE_CFG, FALSE, mtlk_coex_20_40_mode_cfg_t, coex20_40_cfg)
3121 MTLK_CFG_GET_ITEM(coex20_40_cfg, coexistence_mode, *(uint32*)data);
3123 _DF_USER_GET_ON_PARAM(PRM_ID_COEX_THRESHOLD, MTLK_CORE_REQ_GET_COEX_20_40_RSSI_THR_CFG, FALSE, mtlk_coex_20_40_mode_cfg_t, coex20_40_cfg)
3124 MTLK_CFG_GET_ITEM(coex20_40_cfg, rssi_threshold, *(int32*)data);
3126 _DF_USER_GET_ON_PARAM(PRM_ID_INTOLERANCE_MODE, MTLK_CORE_REQ_GET_COEX_20_40_MODE_CFG, FALSE, mtlk_coex_20_40_mode_cfg_t, coex20_40_cfg)
3127 MTLK_CFG_GET_ITEM(coex20_40_cfg, intolerance_mode, *(uint32*)data);
3129 _DF_USER_GET_ON_PARAM(PRM_ID_SCAN_AP_FORCE_SCAN_PARAMS_ON_ASSOC_STA, MTLK_CORE_REQ_GET_COEX_20_40_AP_FORCE_PARAMS_CFG, FALSE, mtlk_coex_20_40_ap_force_params_cfg_t, coex20_40_cfg)
3130 MTLK_CFG_GET_ITEM(coex20_40_cfg, ap_force_scan_params_on_assoc_sta, *(uint32*)data);
3132 _DF_USER_GET_ON_PARAM(PRM_ID_SCAN_AP_WAIT_FOR_SCAN_RESULTS_INTERVAL, MTLK_CORE_REQ_GET_COEX_20_40_AP_FORCE_PARAMS_CFG, FALSE, mtlk_coex_20_40_ap_force_params_cfg_t, coex20_40_cfg)
3133 MTLK_CFG_GET_ITEM(coex20_40_cfg, wait_for_scan_results_interval, *(uint32*)data);
3135 _DF_USER_GET_ON_PARAM(PRM_ID_EXEMPTION_REQ, MTLK_CORE_REQ_GET_COEX_20_40_STA_EXEMPTION_REQ_CFG, FALSE, mtlk_coex_20_40_exm_req_cfg_t, coex20_40_cfg)
3136 MTLK_CFG_GET_ITEM(coex20_40_cfg, exemption_req, *(uint32*)data);
3138 _DF_USER_GET_ON_PARAM(PRM_ID_MIN_NON_EXEMPTED_STA, MTLK_CORE_REQ_GET_COEX_20_40_AP_MIN_NUM_OF_EXM_STA_CFG, FALSE, mtlk_coex_20_40_min_num_exm_sta_cfg_t, coex20_40_cfg)
3139 MTLK_CFG_GET_ITEM(coex20_40_cfg, min_non_exempted_sta, *(uint32*)data);
3141 _DF_USER_GET_ON_PARAM(PRM_ID_DELAY_FACTOR, MTLK_CORE_REQ_GET_COEX_20_40_TIMES_CFG, FALSE, mtlk_coex_20_40_times_cfg_t, coex20_40_cfg)
3142 MTLK_CFG_GET_ITEM(coex20_40_cfg, delay_factor, *(uint32*)data);
3144 _DF_USER_GET_ON_PARAM(PRM_ID_OBSS_SCAN_INTERVAL, MTLK_CORE_REQ_GET_COEX_20_40_TIMES_CFG, FALSE, mtlk_coex_20_40_times_cfg_t, coex20_40_cfg)
3145 MTLK_CFG_GET_ITEM(coex20_40_cfg, obss_scan_interval, *(uint32*)data);
3147 _DF_USER_GET_ON_PARAM(PRM_ID_SCAN_ACTIVITY_THRESHOLD, MTLK_CORE_REQ_GET_COEX_20_40_TIMES_CFG, FALSE, mtlk_coex_20_40_times_cfg_t, coex20_40_cfg)
3148 MTLK_CFG_GET_ITEM(coex20_40_cfg, scan_activity_threshold, *(uint32*)data);
3150 _DF_USER_GET_ON_PARAM(PRM_ID_SCAN_PASSIVE_DWELL, MTLK_CORE_REQ_GET_COEX_20_40_TIMES_CFG, FALSE, mtlk_coex_20_40_times_cfg_t, coex20_40_cfg)
3151 MTLK_CFG_GET_ITEM(coex20_40_cfg, scan_passive_dwell, *(uint32*)data);
3153 _DF_USER_GET_ON_PARAM(PRM_ID_SCAN_ACTIVE_DWELL, MTLK_CORE_REQ_GET_COEX_20_40_TIMES_CFG, FALSE, mtlk_coex_20_40_times_cfg_t, coex20_40_cfg)
3154 MTLK_CFG_GET_ITEM(coex20_40_cfg, scan_active_dwell, *(uint32*)data);
3156 _DF_USER_GET_ON_PARAM(PRM_ID_SCAN_PASSIVE_TOTAL_PER_CHANNEL, MTLK_CORE_REQ_GET_COEX_20_40_TIMES_CFG, FALSE, mtlk_coex_20_40_times_cfg_t, coex20_40_cfg)
3157 MTLK_CFG_GET_ITEM(coex20_40_cfg, scan_passive_total_per_channel, *(uint32*)data);
3159 _DF_USER_GET_ON_PARAM(PRM_ID_SCAN_ACTIVE_TOTAL_PER_CHANNEL, MTLK_CORE_REQ_GET_COEX_20_40_TIMES_CFG, FALSE, mtlk_coex_20_40_times_cfg_t, coex20_40_cfg)
3160 MTLK_CFG_GET_ITEM(coex20_40_cfg, scan_active_total_per_channel, *(uint32*)data);
3162 /* Interference Detection */
3163 _DF_USER_GET_ON_PARAM(PRM_ID_INTERFERENCE_MODE, MTLK_CORE_REQ_GET_INTERFDET_MODE_CFG, TRUE, mtlk_interfdet_mode_cfg_t, interfdet_mode_cfg)
3164 MTLK_CFG_GET_ITEM(interfdet_mode_cfg, interfdet_mode, *(uint32*)data);
3166 /* Card Capabilities */
3167 _DF_USER_GET_ON_PARAM(PRM_ID_AP_CAPABILITIES_MAX_STAs, MTLK_CORE_REQ_GET_AP_CAPABILITIES, TRUE, mtlk_card_capabilities_t, card_capabilities)
3168 MTLK_CFG_GET_ITEM(card_capabilities, max_stas_supported, *(uint32*)data);
3169 _DF_USER_GET_ON_PARAM(PRM_ID_AP_CAPABILITIES_MAX_VAPs, MTLK_CORE_REQ_GET_AP_CAPABILITIES, TRUE, mtlk_card_capabilities_t, card_capabilities)
3170 MTLK_CFG_GET_ITEM(card_capabilities, max_vaps_supported, *(uint32*)data);
3171 _DF_USER_GET_ON_PARAM(PRM_ID_AP_CAPABILITIES_MAX_ACLs, MTLK_CORE_REQ_GET_AP_CAPABILITIES, TRUE, mtlk_card_capabilities_t, card_capabilities)
3172 MTLK_CFG_GET_ITEM(card_capabilities, max_acls_supported, *(uint32*)data);
3174 /* FW GPIO LED */
3175 _DF_USER_GET_ON_PARAM(PRM_ID_CFG_LED_GPIO, MTLK_CORE_REQ_GET_FW_LED_CFG, FALSE, mtlk_fw_led_cfg_t, led_gpio_cfg)
3176 MTLK_CFG_GET_ITEM_BY_FUNC_VOID(led_gpio_cfg, gpio_cfg,
3177 _mtlk_df_user_get_intvec_by_fw_gpio_cfg, ((uint32*)data, length, &led_gpio_cfg->gpio_cfg));
3179 _DF_USER_GET_ON_PARAM(PRM_ID_TA_TIMER_RESOLUTION, MTLK_CORE_REQ_GET_TA_CFG, FALSE, mtlk_ta_cfg_t, mtlk_ta_cfg)
3180 MTLK_CFG_GET_ITEM(mtlk_ta_cfg, timer_resolution, *(uint32*)data);
3182 _DF_USER_GET_ON_PARAM(PRM_ID_TA_DBG, MTLK_CORE_REQ_GET_TA_CFG, FALSE, mtlk_ta_cfg_t, mtlk_ta_cfg)
3183 MTLK_CFG_GET_ITEM_BY_FUNC(mtlk_ta_cfg, debug_info, _mtlk_df_user_print_ta_debug_info,
3184 (data, TEXT_SIZE, &mtlk_ta_cfg->debug_info), *length);
3186 _DF_USER_GET_ON_PARAM(PRM_ID_ENHANCED11B_TH, MTLK_CORE_REQ_GET_ENHANCED11B_CFG, FALSE, mtlk_enhanced11b_cfg_t, mtlk_enhanced11b_cfg)
3187 MTLK_CFG_SET_ITEM_BY_FUNC_VOID(mtlk_enhanced11b_cfg, thresholds,
3188 _mtlk_df_user_intvec_by_11b_thresholds, ((uint32*)data, length, &mtlk_enhanced11b_cfg->thresholds));
3190 _DF_USER_GET_ON_PARAM(PRM_ID_FW_RECOVERY, MTLK_CORE_REQ_GET_RECOVERY_CFG, FALSE, mtlk_rcvry_cfg_t, fw_rcvry_cfg)
3191 MTLK_CFG_SET_ITEM_BY_FUNC_VOID(fw_rcvry_cfg, recovery_cfg,
3192 _mtlk_df_user_intvec_by_recovery, ((uint32*)data, length, &fw_rcvry_cfg->recovery_cfg));
3194 _DF_USER_GET_ON_PARAM(PRM_ID_11B_ANTENNA_SELECTION, MTLK_CORE_REQ_GET_11B_CFG, FALSE, mtlk_11b_cfg_t, mtlk_11b_cfg)
3195 MTLK_CFG_SET_ITEM_BY_FUNC_VOID(mtlk_11b_cfg, antsel,
3196 _mtlk_df_user_intvec_by_11b_antsel, ((uint32*)data, length, &mtlk_11b_cfg->antsel));
3198 /* 802.11w begin */
3199 _DF_USER_GET_ON_PARAM(PRM_ID_PMF_ACTIVATED, MTLK_CORE_REQ_GET_DOT11W_CFG, FALSE, mtlk_dot11w_cfg_t, mtlk_dot11w_cfg)
3200 MTLK_CFG_GET_ITEM(mtlk_dot11w_cfg, pmf_activated, *(uint32*)data);
3201 _DF_USER_GET_ON_PARAM(PRM_ID_PMF_REQUIRED, MTLK_CORE_REQ_GET_DOT11W_CFG, FALSE, mtlk_dot11w_cfg_t, mtlk_dot11w_cfg)
3202 MTLK_CFG_GET_ITEM(mtlk_dot11w_cfg, pmf_required, *(uint32*)data);
3203 _DF_USER_GET_ON_PARAM(PRM_ID_SAQ_RETR_TMOUT, MTLK_CORE_REQ_GET_DOT11W_CFG, FALSE, mtlk_dot11w_cfg_t, mtlk_dot11w_cfg)
3204 MTLK_CFG_GET_ITEM(mtlk_dot11w_cfg, saq_retr_tmout, *(uint32*)data);
3205 _DF_USER_GET_ON_PARAM(PRM_ID_SAQ_MAX_TMOUT, MTLK_CORE_REQ_GET_DOT11W_CFG, FALSE, mtlk_dot11w_cfg_t, mtlk_dot11w_cfg)
3206 MTLK_CFG_GET_ITEM(mtlk_dot11w_cfg, saq_max_tmout, *(uint32*)data);
3207 /* 802.11w end */
3209 _DF_USER_GET_ON_PARAM(PRM_ID_MC_PS_SIZE, MTLK_CORE_REQ_GET_MC_PS_SIZE_CFG, FALSE, mtlk_mc_ps_size_cfg_t, mc_ps_size_cfg)
3210 MTLK_CFG_GET_ITEM(mc_ps_size_cfg, maxNumberOfFsdus, *(uint32*)data);
3212 /* U-APSD mode */
3213 _DF_USER_GET_ON_PARAM(PRM_ID_UAPSD_MODE, MTLK_CORE_REQ_GET_UAPSD_MODE, FALSE, mtlk_uapsd_mode_cfg_t, uapsd_mode_cfg)
3214 MTLK_CFG_GET_ITEM(uapsd_mode_cfg, uapsd_enabled, *(uint32*)data);
3216 _DF_USER_GET_ON_PARAM(PRM_ID_UAPSD_MAX_SP, MTLK_CORE_REQ_GET_UAPSD_CFG, FALSE, mtlk_uapsd_cfg_t, uapsd_cfg)
3217 MTLK_CFG_GET_ITEM(uapsd_cfg, uapsd_max_sp, *(uint32*)data);
3219 _DF_USER_GET_PARAM_MAP_END()
3221 return res;
3224 static int __MTLK_IFUNC
3225 _mtlk_df_user_iwpriv_set_core_param(mtlk_df_user_t* df_user, uint32 param_id, char* data, uint16* length)
3227 int res;
3229 _DF_USER_SET_PARAM_MAP_START(df_user, param_id, res)
3230 _DF_USER_SET_ON_PARAM(PRM_ID_DELBA_REQ, MTLK_CORE_REQ_SET_DELBA_REQ, FALSE, mtlk_delba_cfg_entity_t, delba_cfg)
3231 MTLK_CFG_SET_ITEM_BY_FUNC(delba_cfg, delba_req, _mtlk_df_user_fill_delba_req,
3232 ((char*)data, &delba_cfg->delba_req), res);
3234 _DF_USER_SET_ON_PARAM(PRM_ID_BE_BAUSE, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3235 MTLK_CFG_SET_ITEM(&addba_cfg->tid[0], use_aggr, !!*(uint32*)data);
3237 _DF_USER_SET_ON_PARAM(PRM_ID_BK_BAUSE, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3238 MTLK_CFG_SET_ITEM(&addba_cfg->tid[1], use_aggr, !!*(uint32*)data);
3240 _DF_USER_SET_ON_PARAM(PRM_ID_VI_BAUSE, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3241 MTLK_CFG_SET_ITEM(&addba_cfg->tid[5], use_aggr, !!*(uint32*)data);
3243 _DF_USER_SET_ON_PARAM(PRM_ID_VO_BAUSE, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3244 MTLK_CFG_SET_ITEM(&addba_cfg->tid[6], use_aggr, !!*(uint32*)data);
3246 _DF_USER_SET_ON_PARAM(PRM_ID_BE_BAACCEPT, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3247 MTLK_CFG_SET_ITEM(&addba_cfg->tid[0], accept_aggr, !!*(uint32*)data);
3248 MTLK_CFG_SET_ITEM(&addba_cfg->tid[3], accept_aggr, !!*(uint32*)data);
3250 _DF_USER_SET_ON_PARAM(PRM_ID_BK_BAACCEPT, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3251 MTLK_CFG_SET_ITEM(&addba_cfg->tid[1], accept_aggr, !!*(uint32*)data);
3252 MTLK_CFG_SET_ITEM(&addba_cfg->tid[2], accept_aggr, !!*(uint32*)data);
3254 _DF_USER_SET_ON_PARAM(PRM_ID_VI_BAACCEPT, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3255 MTLK_CFG_SET_ITEM(&addba_cfg->tid[5], accept_aggr, !!*(uint32*)data);
3256 MTLK_CFG_SET_ITEM(&addba_cfg->tid[4], accept_aggr, !!*(uint32*)data);
3258 _DF_USER_SET_ON_PARAM(PRM_ID_VO_BAACCEPT, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3259 MTLK_CFG_SET_ITEM(&addba_cfg->tid[6], accept_aggr, !!*(uint32*)data);
3260 MTLK_CFG_SET_ITEM(&addba_cfg->tid[7], accept_aggr, !!*(uint32*)data);
3262 _DF_USER_SET_ON_PARAM(PRM_ID_BE_BATIMEOUT, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3263 MTLK_CFG_SET_ITEM(&addba_cfg->tid[0], addba_timeout, *(uint32*)data);
3265 _DF_USER_SET_ON_PARAM(PRM_ID_BK_BATIMEOUT, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3266 MTLK_CFG_SET_ITEM(&addba_cfg->tid[1], addba_timeout, *(uint32*)data);
3268 _DF_USER_SET_ON_PARAM(PRM_ID_VI_BATIMEOUT, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3269 MTLK_CFG_SET_ITEM(&addba_cfg->tid[5], addba_timeout, *(uint32*)data);
3271 _DF_USER_SET_ON_PARAM(PRM_ID_VO_BATIMEOUT, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3272 MTLK_CFG_SET_ITEM(&addba_cfg->tid[6], addba_timeout, *(uint32*)data);
3274 _DF_USER_SET_ON_PARAM(PRM_ID_BE_BAWINSIZE, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3275 MTLK_CFG_SET_ITEM(&addba_cfg->tid[0], aggr_win_size, *(uint32*)data);
3277 _DF_USER_SET_ON_PARAM(PRM_ID_BK_BAWINSIZE, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3278 MTLK_CFG_SET_ITEM(&addba_cfg->tid[1], aggr_win_size, *(uint32*)data);
3280 _DF_USER_SET_ON_PARAM(PRM_ID_VI_BAWINSIZE, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3281 MTLK_CFG_SET_ITEM(&addba_cfg->tid[5], aggr_win_size, *(uint32*)data);
3283 _DF_USER_SET_ON_PARAM(PRM_ID_VO_BAWINSIZE, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3284 MTLK_CFG_SET_ITEM(&addba_cfg->tid[6], aggr_win_size, *(uint32*)data);
3286 _DF_USER_SET_ON_PARAM(PRM_ID_BE_AGGRMAXBTS, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3287 MTLK_CFG_SET_ITEM(&addba_cfg->tid[0], max_nof_bytes, *(uint32*)data);
3289 _DF_USER_SET_ON_PARAM(PRM_ID_BK_AGGRMAXBTS, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3290 MTLK_CFG_SET_ITEM(&addba_cfg->tid[1], max_nof_bytes, *(uint32*)data);
3292 _DF_USER_SET_ON_PARAM(PRM_ID_VI_AGGRMAXBTS, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3293 MTLK_CFG_SET_ITEM(&addba_cfg->tid[5], max_nof_bytes, *(uint32*)data);
3295 _DF_USER_SET_ON_PARAM(PRM_ID_VO_AGGRMAXBTS, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3296 MTLK_CFG_SET_ITEM(&addba_cfg->tid[6], max_nof_bytes, *(uint32*)data);
3298 _DF_USER_SET_ON_PARAM(PRM_ID_BE_AGGRMAXPKTS, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3299 MTLK_CFG_SET_ITEM(&addba_cfg->tid[0], max_nof_packets, *(uint32*)data);
3301 _DF_USER_SET_ON_PARAM(PRM_ID_BK_AGGRMAXPKTS, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3302 MTLK_CFG_SET_ITEM(&addba_cfg->tid[1], max_nof_packets, *(uint32*)data);
3304 _DF_USER_SET_ON_PARAM(PRM_ID_VI_AGGRMAXPKTS, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3305 MTLK_CFG_SET_ITEM(&addba_cfg->tid[5], max_nof_packets, *(uint32*)data);
3307 _DF_USER_SET_ON_PARAM(PRM_ID_VO_AGGRMAXPKTS, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3308 MTLK_CFG_SET_ITEM(&addba_cfg->tid[6], max_nof_packets, *(uint32*)data);
3310 _DF_USER_SET_ON_PARAM(PRM_ID_BE_AGGRMINPTSZ, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3311 MTLK_CFG_SET_ITEM(&addba_cfg->tid[0], min_packet_size_in_aggr, *(uint32*)data);
3313 _DF_USER_SET_ON_PARAM(PRM_ID_BK_AGGRMINPTSZ, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3314 MTLK_CFG_SET_ITEM(&addba_cfg->tid[1], min_packet_size_in_aggr, *(uint32*)data);
3316 _DF_USER_SET_ON_PARAM(PRM_ID_VI_AGGRMINPTSZ, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3317 MTLK_CFG_SET_ITEM(&addba_cfg->tid[5], min_packet_size_in_aggr, *(uint32*)data);
3319 _DF_USER_SET_ON_PARAM(PRM_ID_VO_AGGRMINPTSZ, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3320 MTLK_CFG_SET_ITEM(&addba_cfg->tid[6], min_packet_size_in_aggr, *(uint32*)data);
3322 _DF_USER_SET_ON_PARAM(PRM_ID_BE_AGGRTIMEOUT, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3323 MTLK_CFG_SET_ITEM(&addba_cfg->tid[0], timeout_interval, *(uint32*)data);
3325 _DF_USER_SET_ON_PARAM(PRM_ID_BK_AGGRTIMEOUT, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3326 MTLK_CFG_SET_ITEM(&addba_cfg->tid[1], timeout_interval, *(uint32*)data);
3328 _DF_USER_SET_ON_PARAM(PRM_ID_VI_AGGRTIMEOUT, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3329 MTLK_CFG_SET_ITEM(&addba_cfg->tid[5], timeout_interval, *(uint32*)data);
3331 _DF_USER_SET_ON_PARAM(PRM_ID_VO_AGGRTIMEOUT, MTLK_CORE_REQ_SET_ADDBA_CFG, FALSE, mtlk_addba_cfg_entity_t, addba_cfg)
3332 MTLK_CFG_SET_ITEM(&addba_cfg->tid[6], timeout_interval, *(uint32*)data);
3334 _DF_USER_SET_ON_PARAM(PRM_ID_BE_AIFSN, MTLK_CORE_REQ_SET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
3335 MTLK_CFG_SET_ITEM(&wme_bss_cfg->wme_class[0], aifsn, *(uint32*)data);
3337 _DF_USER_SET_ON_PARAM(PRM_ID_BK_AIFSN, MTLK_CORE_REQ_SET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
3338 MTLK_CFG_SET_ITEM(&wme_bss_cfg->wme_class[1], aifsn, *(uint32*)data);
3340 _DF_USER_SET_ON_PARAM(PRM_ID_VI_AIFSN, MTLK_CORE_REQ_SET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
3341 MTLK_CFG_SET_ITEM(&wme_bss_cfg->wme_class[2], aifsn, *(uint32*)data);
3343 _DF_USER_SET_ON_PARAM(PRM_ID_VO_AIFSN, MTLK_CORE_REQ_SET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
3344 MTLK_CFG_SET_ITEM(&wme_bss_cfg->wme_class[3], aifsn, *(uint32*)data);
3346 _DF_USER_SET_ON_PARAM(PRM_ID_BE_CWMAX, MTLK_CORE_REQ_SET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
3347 MTLK_CFG_SET_ITEM(&wme_bss_cfg->wme_class[0], cwmax, *(uint32*)data);
3349 _DF_USER_SET_ON_PARAM(PRM_ID_BK_CWMAX, MTLK_CORE_REQ_SET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
3350 MTLK_CFG_SET_ITEM(&wme_bss_cfg->wme_class[1], cwmax, *(uint32*)data);
3352 _DF_USER_SET_ON_PARAM(PRM_ID_VI_CWMAX, MTLK_CORE_REQ_SET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
3353 MTLK_CFG_SET_ITEM(&wme_bss_cfg->wme_class[2], cwmax, *(uint32*)data);
3355 _DF_USER_SET_ON_PARAM(PRM_ID_VO_CWMAX, MTLK_CORE_REQ_SET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
3356 MTLK_CFG_SET_ITEM(&wme_bss_cfg->wme_class[3], cwmax, *(uint32*)data);
3358 _DF_USER_SET_ON_PARAM(PRM_ID_BE_CWMIN, MTLK_CORE_REQ_SET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
3359 MTLK_CFG_SET_ITEM(&wme_bss_cfg->wme_class[0], cwmin, *(uint32*)data);
3361 _DF_USER_SET_ON_PARAM(PRM_ID_BK_CWMIN, MTLK_CORE_REQ_SET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
3362 MTLK_CFG_SET_ITEM(&wme_bss_cfg->wme_class[1], cwmin, *(uint32*)data);
3364 _DF_USER_SET_ON_PARAM(PRM_ID_VI_CWMIN, MTLK_CORE_REQ_SET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
3365 MTLK_CFG_SET_ITEM(&wme_bss_cfg->wme_class[2], cwmin, *(uint32*)data);
3367 _DF_USER_SET_ON_PARAM(PRM_ID_VO_CWMIN, MTLK_CORE_REQ_SET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
3368 MTLK_CFG_SET_ITEM(&wme_bss_cfg->wme_class[3], cwmin, *(uint32*)data);
3370 _DF_USER_SET_ON_PARAM(PRM_ID_BE_TXOP, MTLK_CORE_REQ_SET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
3371 MTLK_CFG_SET_ITEM(&wme_bss_cfg->wme_class[0], txop, *(uint32*)data);
3373 _DF_USER_SET_ON_PARAM(PRM_ID_BK_TXOP, MTLK_CORE_REQ_SET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
3374 MTLK_CFG_SET_ITEM(&wme_bss_cfg->wme_class[1], txop, *(uint32*)data);
3376 _DF_USER_SET_ON_PARAM(PRM_ID_VI_TXOP, MTLK_CORE_REQ_SET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
3377 MTLK_CFG_SET_ITEM(&wme_bss_cfg->wme_class[2], txop, *(uint32*)data);
3379 _DF_USER_SET_ON_PARAM(PRM_ID_VO_TXOP, MTLK_CORE_REQ_SET_WME_BSS_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_bss_cfg)
3380 MTLK_CFG_SET_ITEM(&wme_bss_cfg->wme_class[3], txop, *(uint32*)data);
3382 _DF_USER_SET_ON_PARAM(PRM_ID_BE_AIFSNAP, MTLK_CORE_REQ_SET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
3383 MTLK_CFG_SET_ITEM(&wme_ap_cfg->wme_class[0], aifsn, *(uint32*)data);
3385 _DF_USER_SET_ON_PARAM(PRM_ID_BK_AIFSNAP, MTLK_CORE_REQ_SET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
3386 MTLK_CFG_SET_ITEM(&wme_ap_cfg->wme_class[1], aifsn, *(uint32*)data);
3388 _DF_USER_SET_ON_PARAM(PRM_ID_VI_AIFSNAP, MTLK_CORE_REQ_SET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
3389 MTLK_CFG_SET_ITEM(&wme_ap_cfg->wme_class[2], aifsn, *(uint32*)data);
3391 _DF_USER_SET_ON_PARAM(PRM_ID_VO_AIFSNAP, MTLK_CORE_REQ_SET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
3392 MTLK_CFG_SET_ITEM(&wme_ap_cfg->wme_class[3], aifsn, *(uint32*)data);
3394 _DF_USER_SET_ON_PARAM(PRM_ID_BE_CWMAXAP, MTLK_CORE_REQ_SET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
3395 MTLK_CFG_SET_ITEM(&wme_ap_cfg->wme_class[0], cwmax, *(uint32*)data);
3397 _DF_USER_SET_ON_PARAM(PRM_ID_BK_CWMAXAP, MTLK_CORE_REQ_SET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
3398 MTLK_CFG_SET_ITEM(&wme_ap_cfg->wme_class[1], cwmax, *(uint32*)data);
3400 _DF_USER_SET_ON_PARAM(PRM_ID_VI_CWMAXAP, MTLK_CORE_REQ_SET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
3401 MTLK_CFG_SET_ITEM(&wme_ap_cfg->wme_class[2], cwmax, *(uint32*)data);
3403 _DF_USER_SET_ON_PARAM(PRM_ID_VO_CWMAXAP, MTLK_CORE_REQ_SET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
3404 MTLK_CFG_SET_ITEM(&wme_ap_cfg->wme_class[3], cwmax, *(uint32*)data);
3406 _DF_USER_SET_ON_PARAM(PRM_ID_BE_CWMINAP, MTLK_CORE_REQ_SET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
3407 MTLK_CFG_SET_ITEM(&wme_ap_cfg->wme_class[0], cwmin, *(uint32*)data);
3409 _DF_USER_SET_ON_PARAM(PRM_ID_BK_CWMINAP, MTLK_CORE_REQ_SET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
3410 MTLK_CFG_SET_ITEM(&wme_ap_cfg->wme_class[1], cwmin, *(uint32*)data);
3412 _DF_USER_SET_ON_PARAM(PRM_ID_VI_CWMINAP, MTLK_CORE_REQ_SET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
3413 MTLK_CFG_SET_ITEM(&wme_ap_cfg->wme_class[2], cwmin, *(uint32*)data);
3415 _DF_USER_SET_ON_PARAM(PRM_ID_VO_CWMINAP, MTLK_CORE_REQ_SET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
3416 MTLK_CFG_SET_ITEM(&wme_ap_cfg->wme_class[3], cwmin, *(uint32*)data);
3418 _DF_USER_SET_ON_PARAM(PRM_ID_BE_TXOPAP, MTLK_CORE_REQ_SET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
3419 MTLK_CFG_SET_ITEM(&wme_ap_cfg->wme_class[0], txop, *(uint32*)data);
3421 _DF_USER_SET_ON_PARAM(PRM_ID_BK_TXOPAP, MTLK_CORE_REQ_SET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
3422 MTLK_CFG_SET_ITEM(&wme_ap_cfg->wme_class[1], txop, *(uint32*)data);
3424 _DF_USER_SET_ON_PARAM(PRM_ID_VI_TXOPAP, MTLK_CORE_REQ_SET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
3425 MTLK_CFG_SET_ITEM(&wme_ap_cfg->wme_class[2], txop, *(uint32*)data);
3427 _DF_USER_SET_ON_PARAM(PRM_ID_VO_TXOPAP, MTLK_CORE_REQ_SET_WME_AP_CFG, FALSE, mtlk_wme_cfg_entity_t, wme_ap_cfg)
3428 MTLK_CFG_SET_ITEM(&wme_ap_cfg->wme_class[3], txop, *(uint32*)data);
3430 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_WEIGHT_CL, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3431 MTLK_CFG_SET_ITEM(aocs_cfg, weight_ch_load, *(uint32*)data);
3433 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_WEIGHT_TX, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3434 MTLK_CFG_SET_ITEM(aocs_cfg, weight_tx_power, *(uint32*)data);
3436 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_WEIGHT_BSS, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3437 MTLK_CFG_SET_ITEM(aocs_cfg, weight_nof_bss, *(uint32*)data);
3439 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_WEIGHT_SM, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3440 MTLK_CFG_SET_ITEM(aocs_cfg, weight_sm_required, *(uint32*)data);
3442 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_CFM_RANK_SW_THRESHOLD, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3443 MTLK_CFG_SET_ITEM(aocs_cfg, cfm_rank_sw_threshold, *(uint32*)data);
3445 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_SCAN_AGING, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3446 MTLK_CFG_SET_ITEM(aocs_cfg, scan_aging_ms, *(uint32*)data);
3448 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_CONFIRM_RANK_AGING, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3449 MTLK_CFG_SET_ITEM(aocs_cfg, confirm_rank_aging_ms, *(uint32*)data);
3451 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_AFILTER, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3452 MTLK_CFG_SET_ITEM(aocs_cfg, alpha_filter_coefficient, *(uint32*)data);
3454 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_BONDING, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3455 MTLK_CFG_SET_ITEM(aocs_cfg, bonding, *(uint32*)data);
3457 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_EN_PENALTIES, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3458 MTLK_CFG_SET_ITEM(aocs_cfg, use_tx_penalties, *(uint32*)data);
3460 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_WIN_TIME, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3461 MTLK_CFG_SET_ITEM(aocs_cfg, udp_aocs_window_time_ms, *(uint32*)data);
3463 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_LOWER_THRESHOLD, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3464 MTLK_CFG_SET_ITEM(aocs_cfg, udp_lower_threshold, *(uint32*)data);
3466 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_THRESHOLD_WINDOW, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3467 MTLK_CFG_SET_ITEM(aocs_cfg, udp_threshold_window, *(uint32*)data);
3469 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_MSDU_DEBUG_ENABLED, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3470 MTLK_CFG_SET_ITEM(aocs_cfg, udp_msdu_debug_enabled, *(uint32*)data);
3472 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_IS_ENABLED, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3473 MTLK_CFG_SET_ITEM(aocs_cfg, type, *(uint32*)data);
3475 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_MSDU_PER_WIN_THRESHOLD, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3476 MTLK_CFG_SET_ITEM(aocs_cfg, udp_msdu_per_window_threshold, *(uint32*)data);
3478 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_MSDU_THRESHOLD, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3479 MTLK_CFG_SET_ITEM(aocs_cfg, udp_msdu_threshold_aocs, *(uint32*)data);
3481 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_MEASUREMENT_WINDOW, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3482 MTLK_CFG_SET_ITEM(aocs_cfg, tcp_measurement_window, *(uint32*)data);
3484 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_THROUGHPUT_THRESHOLD, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3485 MTLK_CFG_SET_ITEM(aocs_cfg, tcp_throughput_threshold, *(uint32*)data);
3487 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_NON_OCCUPANCY_PERIOD, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3488 MTLK_CFG_SET_ITEM(aocs_cfg, dbg_non_occupied_period, *(uint32*)data);
3490 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_RESTRICT_MODE, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3492 if (*(uint32*)data >= AOCS_RESTRICT_CHAN_MODE_LAST) {
3493 res = MTLK_ERR_PARAMS;
3494 } else {
3495 MTLK_CFG_SET_ITEM(aocs_cfg, restrict_mode, *(uint32*)data);
3499 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_NON_WIFI_NOISE, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3500 MTLK_CFG_SET_ITEM_BY_FUNC(aocs_cfg, non_wifi_interf,
3501 _mtlk_df_user_get_interf_params_by_intvec, ((int32*)data, *length, &aocs_cfg->non_wifi_interf), res);
3503 _DF_USER_SET_ON_PARAM(PRM_ID_11H_RADAR_DETECTION, MTLK_CORE_REQ_SET_DOT11H_CFG, FALSE, mtlk_11h_cfg_t, dot11h_cfg)
3504 MTLK_CFG_SET_ITEM(dot11h_cfg, radar_detect, *(uint32*)data);
3506 _DF_USER_SET_ON_PARAM(PRM_ID_11H_EMULATE_RADAR_DETECTION, MTLK_CORE_REQ_SET_DOT11H_AP_CFG, FALSE, mtlk_11h_ap_cfg_t, dot11h_cfg)
3507 MTLK_CFG_SET_ITEM(dot11h_cfg, channel_emu, *(uint32*)data);
3509 _DF_USER_SET_ON_PARAM(PRM_ID_11H_SWITCH_CHANNEL, MTLK_CORE_REQ_SET_DOT11H_AP_CFG, FALSE, mtlk_11h_ap_cfg_t, dot11h_cfg)
3510 MTLK_CFG_SET_ITEM(dot11h_cfg, channel_switch, *(uint32*)data);
3512 _DF_USER_SET_ON_PARAM(PRM_ID_11H_ENABLE_SM_CHANNELS, MTLK_CORE_REQ_SET_DOT11H_AP_CFG, FALSE, mtlk_11h_ap_cfg_t, dot11h_cfg)
3513 MTLK_CFG_SET_ITEM(dot11h_cfg, enable_sm_required, *(uint32*)data);
3515 _DF_USER_SET_ON_PARAM(PRM_ID_11H_BEACON_COUNT, MTLK_CORE_REQ_SET_DOT11H_AP_CFG, FALSE, mtlk_11h_ap_cfg_t, dot11h_cfg)
3516 MTLK_CFG_SET_ITEM(dot11h_cfg, debugChannelSwitchCount, *(uint32*)data);
3518 _DF_USER_SET_ON_PARAM(PRM_ID_11H_CHANNEL_AVAILABILITY_CHECK_TIME, MTLK_CORE_REQ_SET_DOT11H_AP_CFG, FALSE, mtlk_11h_ap_cfg_t, dot11h_cfg)
3519 MTLK_CFG_SET_ITEM(dot11h_cfg, debugChannelAvailabilityCheckTime, *(uint32*)data);
3521 _DF_USER_SET_ON_PARAM(PRM_ID_11H_NEXT_CHANNEL, MTLK_CORE_REQ_SET_DOT11H_AP_CFG, FALSE, mtlk_11h_ap_cfg_t, dot11h_cfg)
3522 MTLK_CFG_SET_ITEM(dot11h_cfg, next_channel, *(uint32*)data);
3524 _DF_USER_SET_ON_PARAM(MIB_ACL_MODE, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3525 if (*(uint32*)data > 2) {
3526 ELOG_V("Usage: 0 - OFF, 1 - white list, 2 - black list");
3527 res = MTLK_ERR_PARAMS;
3528 } else if (!mtlk_df_is_ap(df_user->df)) {
3529 ELOG_V("The command is supported only in AP mode");
3530 res = MTLK_ERR_PARAMS;
3531 } else {
3532 MTLK_CFG_SET_ITEM(mibs_cfg, acl_mode, *(uint32*)data);
3535 _DF_USER_SET_ON_PARAM(PRM_ID_VAP_STA_LIMS, MTLK_CORE_REQ_MBSS_SET_VARS, FALSE, mtlk_mbss_cfg_t, mbss_cfg)
3536 int i;
3537 uint32 *value = (uint32*)data;
3538 if (*length != VAP_LIMIT_SET_SIZE) {
3539 ELOG_V("Needs a set of two parameters");
3540 res = MTLK_ERR_PARAMS;
3541 } else {
3542 for (i = 0; i < VAP_LIMIT_SET_SIZE; i ++) {
3543 if (value[i] == (uint32)DF_USER_DEFAULT_IWPRIV_LIM_VALUE) {
3544 value[i] = MTLK_MBSS_VAP_LIMIT_DEFAULT;
3546 else if (((int32)value[i]) < 0) {
3547 ELOG_V("invalid parameter");
3548 res = MTLK_ERR_PARAMS;
3551 if(MTLK_ERR_OK == res) {
3552 MTLK_CFG_SET_ITEM_BY_FUNC_VOID(mbss_cfg, vap_limits, _mtlk_df_set_vap_limits_cfg, (mbss_cfg, value[0], value[1]));
3556 _DF_USER_SET_ON_PARAM(PRM_ID_VAP_ADD, MTLK_CORE_REQ_MBSS_ADD_VAP, FALSE, mtlk_mbss_cfg_t, mbss_cfg)
3557 MTLK_CFG_SET_ITEM(mbss_cfg, added_vap_index, _mtlk_df_user_get_core_slave_vap_index_by_iwpriv_param (*(uint32*)data));
3559 _DF_USER_SET_ON_PARAM(PRM_ID_VAP_DEL, MTLK_CORE_REQ_MBSS_DEL_VAP, FALSE, mtlk_mbss_cfg_t, mbss_cfg)
3560 MTLK_CFG_SET_ITEM(mbss_cfg, deleted_vap_index, _mtlk_df_user_get_core_slave_vap_index_by_iwpriv_param (*(uint32*)data));
3562 _DF_USER_SET_ON_PARAM(MIB_CALIBRATION_ALGO_MASK, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3563 MTLK_CFG_SET_ITEM(mibs_cfg, calibr_algo_mask, *(uint32*)data);
3565 _DF_USER_SET_ON_PARAM(PRM_USE_SHORT_CYCLIC_PREFIX_RX, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3566 MTLK_CFG_SET_ITEM(mibs_cfg, short_cyclic_prefix_rx, !!(*(uint32*)data));
3568 _DF_USER_SET_ON_PARAM(PRM_USE_SHORT_CYCLIC_PREFIX_TX, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3569 MTLK_CFG_SET_ITEM(mibs_cfg, short_cyclic_prefix_tx, !!(*(uint32*)data));
3571 _DF_USER_SET_ON_PARAM(PRM_USE_SHORT_CYCLIC_PREFIX_RATE31, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3572 MTLK_CFG_SET_ITEM(mibs_cfg, short_cyclic_prefix_rate31, !!(*(uint32*)data));
3574 _DF_USER_SET_ON_PARAM(PRM_ID_SHORT_PREAMBLE_OPTION_IMPLEMENTED, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3575 MTLK_CFG_SET_ITEM(mibs_cfg, short_preamble_option, *(uint32*)data);
3577 _DF_USER_SET_ON_PARAM(PRM_ID_SHORT_SLOT_TIME_OPTION_ENABLED_11G, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3578 MTLK_CFG_SET_ITEM(mibs_cfg, short_slot_time_option, *(uint32*)data);
3580 _DF_USER_SET_ON_PARAM(MIB_SHORT_RETRY_LIMIT, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3581 MTLK_CFG_SET_ITEM(mibs_cfg, short_retry_limit, *(uint32*)data);
3583 _DF_USER_SET_ON_PARAM(MIB_LONG_RETRY_LIMIT, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3584 MTLK_CFG_SET_ITEM(mibs_cfg, long_retry_limit, *(uint32*)data);
3586 _DF_USER_SET_ON_PARAM(MIB_TX_MSDU_LIFETIME, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3587 MTLK_CFG_SET_ITEM(mibs_cfg, tx_msdu_lifetime, *(uint32*)data);
3589 _DF_USER_SET_ON_PARAM(MIB_CURRENT_TX_ANTENNA, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3590 MTLK_CFG_SET_ITEM(mibs_cfg, current_tx_antenna, *(uint32*)data);
3592 _DF_USER_SET_ON_PARAM(MIB_BEACON_PERIOD, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3593 MTLK_CFG_SET_ITEM(mibs_cfg, beacon_period, *(uint32*)data);
3595 _DF_USER_SET_ON_PARAM(MIB_DISCONNECT_ON_NACKS_WEIGHT, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3596 MTLK_CFG_SET_ITEM(mibs_cfg, disconnect_on_nacks_weight, *(uint32*)data);
3598 _DF_USER_SET_ON_PARAM(MIB_SM_ENABLE, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3599 MTLK_CFG_SET_ITEM(mibs_cfg, sm_enable, *(uint32*)data);
3601 _DF_USER_SET_ON_PARAM(MIB_ADVANCED_CODING_SUPPORTED, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3602 MTLK_CFG_SET_ITEM(mibs_cfg, advanced_coding_supported, *(uint32*)data);
3604 _DF_USER_SET_ON_PARAM(MIB_OVERLAPPING_PROTECTION_ENABLE, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3605 MTLK_CFG_SET_ITEM(mibs_cfg, overlapping_protect_enabled, *(uint32*)data);
3607 _DF_USER_SET_ON_PARAM(MIB_OFDM_PROTECTION_METHOD, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3608 MTLK_CFG_SET_ITEM(mibs_cfg, ofdm_protect_method, *(uint32*)data);
3610 _DF_USER_SET_ON_PARAM(MIB_HT_PROTECTION_METHOD, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3611 MTLK_CFG_SET_ITEM(mibs_cfg, ht_method, *(uint32*)data);
3613 _DF_USER_SET_ON_PARAM(MIB_DTIM_PERIOD, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3614 MTLK_CFG_SET_ITEM(mibs_cfg, dtim_period, *(uint32*)data);
3616 _DF_USER_SET_ON_PARAM(MIB_RECEIVE_AMPDU_MAX_LENGTH, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3617 MTLK_CFG_SET_ITEM(mibs_cfg, receive_ampdu_max_len, *(uint32*)data);
3619 _DF_USER_SET_ON_PARAM(MIB_CB_DATABINS_PER_SYMBOL, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3620 MTLK_CFG_SET_ITEM(mibs_cfg, cb_databins_per_symbol, *(uint32*)data);
3622 _DF_USER_SET_ON_PARAM(MIB_USE_LONG_PREAMBLE_FOR_MULTICAST, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3623 MTLK_CFG_SET_ITEM(mibs_cfg, use_long_preamble_for_multicast, *(uint32*)data);
3625 _DF_USER_SET_ON_PARAM(MIB_USE_SPACE_TIME_BLOCK_CODE, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3626 MTLK_CFG_SET_ITEM(mibs_cfg, use_space_time_block_code, *(uint32*)data);
3628 _DF_USER_SET_ON_PARAM(MIB_TWO_ANTENNA_TRANSMISSION_ENABLE, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3629 if (_mtlk_df_user_check_master_vap_on_g35(df_user)) {
3630 MTLK_CFG_SET_ITEM(mibs_cfg, two_antenna_tx_enable, *(uint32*)data);
3631 } else {
3632 res = MTLK_ERR_NOT_SUPPORTED;
3635 _DF_USER_SET_ON_PARAM(MIB_ONLINE_CALIBRATION_ALGO_MASK, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3636 MTLK_CFG_SET_ITEM(mibs_cfg, online_calibr_algo_mask, *(uint32*)data);
3638 _DF_USER_SET_ON_PARAM(MIB_DISCONNECT_ON_NACKS_ENABLE, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3639 MTLK_CFG_SET_ITEM(mibs_cfg, disconnect_on_nacks_enable, *(uint32*)data);
3641 _DF_USER_SET_ON_PARAM(MIB_RTS_THRESHOLD, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3642 MTLK_CFG_SET_ITEM(mibs_cfg, rts_threshold, *(uint32*)data);
3644 _DF_USER_SET_ON_PARAM(MIB_TX_POWER, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3645 MTLK_CFG_SET_ITEM(mibs_cfg, tx_power, *(uint32*)data);
3647 _DF_USER_SET_ON_PARAM(MIB_SUPPORTED_TX_ANTENNAS, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3648 MTLK_CFG_SET_ARRAY_ITEM_BY_FUNC_VOID(mibs_cfg, tx_antennas, strncpy,
3649 (mibs_cfg->tx_antennas, data, MTLK_NUM_ANTENNAS_BUFSIZE));
3651 _DF_USER_SET_ON_PARAM(MIB_SUPPORTED_RX_ANTENNAS, MTLK_CORE_REQ_SET_MIBS_CFG, FALSE, mtlk_mibs_cfg_t, mibs_cfg)
3652 MTLK_CFG_SET_ARRAY_ITEM_BY_FUNC_VOID(mibs_cfg, rx_antennas, strncpy,
3653 (mibs_cfg->rx_antennas, data, MTLK_NUM_ANTENNAS_BUFSIZE));
3655 _DF_USER_SET_ON_PARAM(PRM_ID_HIDDEN_SSID, MTLK_CORE_REQ_SET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, core_cfg)
3656 MTLK_CFG_SET_ITEM(core_cfg, is_hidden_ssid, (*(uint32*)data)?TRUE:FALSE);
3658 _DF_USER_SET_ON_PARAM(MIB_COUNTRY, MTLK_CORE_REQ_SET_COUNTRY_CFG, FALSE, mtlk_country_cfg_t, country_cfg)
3659 MTLK_CFG_SET_ARRAY_ITEM_BY_FUNC_VOID(country_cfg, country, strncpy,
3660 (country_cfg->country, data, MTLK_CHNLS_COUNTRY_BUFSIZE));
3662 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_RESTRICTED_CHANNELS, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3663 MTLK_CFG_SET_ARRAY_ITEM_BY_FUNC(aocs_cfg, restricted_channels, _mtlk_df_user_fill_restricted_ch,
3664 (data, aocs_cfg->restricted_channels), res);
3666 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_MSDU_TX_AC, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3667 MTLK_CFG_SET_ARRAY_ITEM_BY_FUNC(aocs_cfg, msdu_tx_ac, _mtlk_df_user_fill_ac_values,
3668 (data, &aocs_cfg->msdu_tx_ac), res);
3670 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_MSDU_RX_AC, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3671 MTLK_CFG_SET_ARRAY_ITEM_BY_FUNC(aocs_cfg, msdu_rx_ac, _mtlk_df_user_fill_ac_values,
3672 (data, &aocs_cfg->msdu_rx_ac), res);
3674 _DF_USER_SET_ON_PARAM(PRM_ID_AOCS_PENALTIES, MTLK_CORE_REQ_SET_AOCS_CFG, FALSE, mtlk_aocs_cfg_t, aocs_cfg)
3675 MTLK_CFG_SET_ARRAY_ITEM(aocs_cfg, penalties, (int32*)data, *length, res);
3677 _DF_USER_SET_ON_PARAM(PRM_ID_L2NAT_AGING_TIMEOUT, MTLK_CORE_REQ_SET_L2NAT_CFG, FALSE, mtlk_l2nat_cfg_t, l2nat_cfg)
3678 MTLK_CFG_SET_ITEM(l2nat_cfg, aging_timeout, *(uint32*)data);
3680 _DF_USER_SET_ON_PARAM(PRM_ID_L2NAT_DEFAULT_HOST, MTLK_CORE_REQ_SET_L2NAT_CFG, FALSE, mtlk_l2nat_cfg_t, l2nat_cfg)
3681 MTLK_CFG_SET_ITEM_BY_FUNC(l2nat_cfg, address, _mtlk_df_user_fill_ether_address,
3682 (&l2nat_cfg->address, (struct sockaddr*)data), res);
3684 _DF_USER_SET_ON_PARAM(PRM_ID_PEERAP_DBG, MTLK_CORE_REQ_SET_WDS_DBG, FALSE, mtlk_wds_dbg_t, wds_dbg)
3685 MTLK_CFG_SET_ITEM(wds_dbg, dummy, *(uint32*)data);
3687 _DF_USER_SET_ON_PARAM(PRM_ID_ADD_PEERAP, MTLK_CORE_REQ_SET_WDS_CFG, FALSE, mtlk_wds_cfg_t, wds_cfg)
3688 MTLK_CFG_SET_ITEM_BY_FUNC(wds_cfg, peer_ap_addr_add, _mtlk_df_user_fill_ether_address,
3689 (&wds_cfg->peer_ap_addr_add, (struct sockaddr*)data), res);
3691 _DF_USER_SET_ON_PARAM(PRM_ID_DEL_PEERAP, MTLK_CORE_REQ_SET_WDS_CFG, FALSE, mtlk_wds_cfg_t, wds_cfg)
3692 MTLK_CFG_SET_ITEM_BY_FUNC(wds_cfg, peer_ap_addr_del, _mtlk_df_user_fill_ether_address,
3693 (&wds_cfg->peer_ap_addr_del, (struct sockaddr*)data), res);
3695 _DF_USER_SET_ON_PARAM(PRM_ID_PEERAP_KEY_IDX, MTLK_CORE_REQ_SET_WDS_CFG, FALSE, mtlk_wds_cfg_t, wds_cfg)
3696 MTLK_CFG_SET_ITEM_BY_FUNC(wds_cfg, peer_ap_key_idx, _mtlk_df_user_fill_peer_ap_key_idx,
3697 (&wds_cfg->peer_ap_key_idx, *(uint32*)data), res);
3699 _DF_USER_SET_ON_PARAM(PRM_ID_11D, MTLK_CORE_REQ_SET_DOT11D_CFG, FALSE, mtlk_dot11d_cfg_t, dot11d_cfg)
3700 MTLK_CFG_SET_ITEM(dot11d_cfg, is_dot11d, *(uint32*)data);
3702 _DF_USER_SET_ON_PARAM(PRM_ID_11D_RESTORE_DEFAULTS, MTLK_CORE_REQ_SET_DOT11D_CFG, FALSE, mtlk_dot11d_cfg_t, dot11d_cfg)
3703 MTLK_CFG_SET_ITEM(dot11d_cfg, should_reset_tx_limits, *(uint32*)data);
3705 _DF_USER_SET_ON_PARAM(PRM_ID_MAC_WATCHDOG_TIMEOUT_MS, MTLK_CORE_REQ_SET_MAC_WATCHDOG_CFG, FALSE, mtlk_mac_wdog_cfg_t, mac_wdog_cfg)
3706 MTLK_CFG_SET_ITEM(mac_wdog_cfg, mac_watchdog_timeout_ms, *(uint32*)data);
3708 _DF_USER_SET_ON_PARAM(PRM_ID_MAC_WATCHDOG_PERIOD_MS, MTLK_CORE_REQ_SET_MAC_WATCHDOG_CFG, FALSE, mtlk_mac_wdog_cfg_t, mac_wdog_cfg)
3709 MTLK_CFG_SET_ITEM(mac_wdog_cfg, mac_watchdog_period_ms, *(uint32*)data);
3711 _DF_USER_SET_ON_PARAM(PRM_ID_STA_KEEPALIVE_TIMEOUT, MTLK_CORE_REQ_SET_STADB_CFG, FALSE, mtlk_stadb_cfg_t, stadb_cfg)
3712 MTLK_CFG_SET_ITEM(stadb_cfg, sta_keepalive_timeout, *(uint32*)data);
3714 _DF_USER_SET_ON_PARAM(PRM_ID_STA_KEEPALIVE_INTERVAL, MTLK_CORE_REQ_SET_STADB_CFG, FALSE, mtlk_stadb_cfg_t, stadb_cfg)
3715 MTLK_CFG_SET_ITEM(stadb_cfg, keepalive_interval, *(uint32*)data);
3717 _DF_USER_SET_ON_PARAM(PRM_ID_AGGR_OPEN_THRESHOLD, MTLK_CORE_REQ_SET_STADB_CFG, FALSE, mtlk_stadb_cfg_t, stadb_cfg)
3718 MTLK_CFG_SET_ITEM(stadb_cfg, aggr_open_threshold, *(uint32*)data);
3720 _DF_USER_SET_ON_PARAM(PRM_ID_BRIDGE_MODE, MTLK_CORE_REQ_SET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, pcore_cfg)
3721 MTLK_CFG_SET_ITEM(pcore_cfg, bridge_mode, *(uint32*)data);
3723 _DF_USER_SET_ON_PARAM(PRM_ID_DBG_SW_WD_ENABLE, MTLK_CORE_REQ_SET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, pcore_cfg)
3724 MTLK_CFG_SET_ITEM(pcore_cfg, dbg_sw_wd_enable, *(uint32*)data);
3726 _DF_USER_SET_ON_PARAM(PRM_ID_RELIABLE_MULTICAST, MTLK_CORE_REQ_SET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, pcore_cfg)
3727 MTLK_CFG_SET_ITEM(pcore_cfg, reliable_multicast, *(uint32*)data);
3729 _DF_USER_SET_ON_PARAM(PRM_ID_UP_RESCAN_EXEMPTION_TIME, MTLK_CORE_REQ_SET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, pcore_cfg)
3730 MTLK_CFG_SET_ITEM(pcore_cfg, up_rescan_exemption_time, *(uint32*)data);
3732 _DF_USER_SET_ON_PARAM(PRM_ID_AP_FORWARDING, MTLK_CORE_REQ_SET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, pcore_cfg)
3733 MTLK_CFG_SET_ITEM(pcore_cfg, ap_forwarding, *(uint32*)data);
3735 _DF_USER_SET_ON_PARAM(PRM_ID_SPECTRUM_MODE, MTLK_CORE_REQ_SET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, pcore_cfg)
3736 MTLK_CFG_SET_ITEM(pcore_cfg, spectrum_mode, *(uint32*)data);
3738 _DF_USER_SET_ON_PARAM(PRM_ID_NETWORK_MODE, MTLK_CORE_REQ_SET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, pcore_cfg)
3739 MTLK_CFG_SET_ITEM_BY_FUNC(pcore_cfg, net_mode, _mtlk_df_user_translate_network_mode,
3740 (*(uint32*)data, &pcore_cfg->net_mode), res)
3742 _DF_USER_SET_ON_PARAM(PRM_ID_BSS_BASIC_RATE_SET, MTLK_CORE_REQ_SET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, pcore_cfg)
3743 MTLK_CFG_SET_ITEM(pcore_cfg, basic_rates, *(uint32*)data);
3745 _DF_USER_SET_ON_PARAM(PRM_ID_BSS_SUPPORTED_RATE_SET, MTLK_CORE_REQ_SET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, pcore_cfg)
3746 MTLK_CFG_SET_ITEM(pcore_cfg, supported_rates, *(uint32*)data);
3748 _DF_USER_SET_ON_PARAM(PRM_ID_BSS_EXTENDED_RATE_SET, MTLK_CORE_REQ_SET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, pcore_cfg)
3749 MTLK_CFG_SET_ITEM(pcore_cfg, extended_rates, *(uint32*)data);
3751 _DF_USER_SET_ON_PARAM(PRM_ID_CHANNEL, MTLK_CORE_REQ_SET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, pcore_cfg)
3752 MTLK_CFG_SET_ITEM(pcore_cfg, channel, *(uint32*)data);
3754 _DF_USER_SET_ON_PARAM(PRM_ID_POWER_SELECTION, MTLK_CORE_REQ_SET_MASTER_CFG, FALSE, mtlk_master_core_cfg_t, master_core_cfg)
3755 MTLK_CFG_SET_ITEM(master_core_cfg, power_selection, *(uint32*)data);
3758 _DF_USER_SET_ON_PARAM(PRM_ID_RX_HIGH_THRESHOLD, MTLK_CORE_REQ_SET_MASTER_CFG, FALSE, mtlk_master_core_cfg_t, master_core_cfg)
3759 MTLK_CFG_SET_ITEM_BY_FUNC(master_core_cfg, rx_high_threshold, __set_item_value_int8,
3760 (*(int32*)data, &master_core_cfg->rx_high_threshold), res);
3762 _DF_USER_SET_ON_PARAM(PRM_ID_CCA_THRESHOLD, MTLK_CORE_REQ_SET_MASTER_CFG, FALSE, mtlk_master_core_cfg_t, master_core_cfg)
3763 MTLK_CFG_SET_ITEM_BY_FUNC(master_core_cfg, cca_threshold, __set_item_value_int8,
3764 (*(int32*)data, &master_core_cfg->cca_threshold), res);
3766 _DF_USER_SET_ON_PARAM(PRM_ID_RA_PROTECTION, MTLK_CORE_REQ_SET_MASTER_CFG, FALSE, mtlk_master_core_cfg_t, master_core_cfg)
3767 MTLK_CFG_SET_ITEM(master_core_cfg, ra_protection, !!(*(uint32*)data));
3769 _DF_USER_SET_ON_PARAM(PRM_ID_FORCE_NCB, MTLK_CORE_REQ_SET_MASTER_CFG, FALSE, mtlk_master_core_cfg_t, master_core_cfg)
3770 MTLK_CFG_SET_ITEM(master_core_cfg, force_ncb, !!(*(uint32*)data));
3772 _DF_USER_SET_ON_PARAM(PRM_ID_N_RATES_BOS, MTLK_CORE_REQ_SET_MASTER_CFG, FALSE, mtlk_master_core_cfg_t, pmaster_cfg)
3773 MTLK_CFG_SET_ITEM_BY_FUNC(pmaster_cfg, n_rate_bo,
3774 _mtlk_df_user_get_n_rate_bo_by_intvec, ((int32*)data, *length, &pmaster_cfg->n_rate_bo), res);
3776 _DF_USER_SET_ON_PARAM(PRM_ID_DEBUG_TPC, MTLK_CORE_REQ_SET_MASTER_CFG, FALSE, mtlk_master_core_cfg_t, master_core_cfg)
3777 MTLK_CFG_SET_ITEM(master_core_cfg, debug_tpc, *(uint32*)data);
3779 _DF_USER_SET_ON_PARAM(PRM_ID_VAP_LNA_GAINS, MTLK_CORE_REQ_SET_MASTER_CFG, FALSE, mtlk_master_core_cfg_t, master_core_cfg)
3780 MTLK_CFG_SET_ITEM_BY_FUNC(master_core_cfg, lna_gain, _mtlk_df_user_set_lna_gain_by_intvec,
3781 ((uint32*)data, *length, &master_core_cfg->lna_gain), res);
3783 _DF_USER_SET_ON_PARAM(PRM_ID_NICK_NAME, MTLK_CORE_REQ_SET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, pcore_cfg)
3784 MTLK_ASSERT(sizeof(pcore_cfg->nickname) >= *length);
3785 MTLK_CFG_SET_ARRAY_ITEM_BY_FUNC_VOID(pcore_cfg, nickname, memcpy,
3786 (pcore_cfg->nickname, data, *length));
3788 _DF_USER_SET_ON_PARAM(PRM_ID_ESSID, MTLK_CORE_REQ_SET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, pcore_cfg)
3789 MTLK_ASSERT(sizeof(pcore_cfg->essid) >= *length);
3790 MTLK_CFG_SET_ARRAY_ITEM_BY_FUNC_VOID(pcore_cfg, essid, memcpy,
3791 (pcore_cfg->essid, data, *length));
3793 _DF_USER_SET_ON_PARAM(PRM_ID_LEGACY_FORCE_RATE, MTLK_CORE_REQ_SET_MASTER_CFG, FALSE, mtlk_master_core_cfg_t, pmaster_cfg)
3794 data[*length - 1] = '\0'; /* force string null-termination */
3795 MTLK_CFG_SET_ITEM_BY_FUNC(pmaster_cfg, legacy_force_rate, _mtlk_df_user_parse_bitrate_str,
3796 (data, &pmaster_cfg->legacy_force_rate), res);
3798 _DF_USER_SET_ON_PARAM(PRM_ID_HT_FORCE_RATE, MTLK_CORE_REQ_SET_MASTER_CFG, FALSE, mtlk_master_core_cfg_t, pmaster_cfg)
3799 data[*length - 1] = '\0'; /* force string null-termination */
3800 MTLK_CFG_SET_ITEM_BY_FUNC(pmaster_cfg, ht_force_rate, _mtlk_df_user_parse_bitrate_str,
3801 (data, &pmaster_cfg->ht_force_rate), res);
3803 _DF_USER_SET_ON_PARAM(PRM_ID_AGG_RATE_LIMIT, MTLK_CORE_REQ_SET_MASTER_CFG, FALSE, mtlk_master_core_cfg_t, pmaster_cfg)
3804 MTLK_CFG_SET_ITEM_BY_FUNC(pmaster_cfg, agg_rate_limit, _mtlk_df_user_set_agg_rate_limit_by_intvec,
3805 ((uint32*)data, *length, &pmaster_cfg->agg_rate_limit), res);
3807 _DF_USER_SET_ON_PARAM(PRM_ID_RX_DUTY_CYCLE, MTLK_CORE_REQ_SET_MASTER_CFG, FALSE, mtlk_master_core_cfg_t, pmaster_cfg)
3808 MTLK_CFG_SET_ITEM_BY_FUNC(pmaster_cfg, rx_duty_cycle, _mtlk_df_user_set_rx_duty_cycle_by_intvec,
3809 ((uint32*)data, *length, &pmaster_cfg->rx_duty_cycle), res);
3811 _DF_USER_SET_ON_PARAM(PRM_ID_ACL, MTLK_CORE_REQ_SET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, pcore_cfg)
3812 int i;
3813 MTLK_CFG_SET_ITEM(pcore_cfg, num_macs_to_set, *length);
3814 for (i = 0; (i < pcore_cfg->num_macs_to_set) && (i < MAX_ADDRESSES_IN_ACL); i++) {
3815 MTLK_CFG_SET_ITEM_BY_FUNC_VOID(pcore_cfg, macs_to_set, memcpy,
3816 (pcore_cfg->macs_to_set[i].au8Addr, ((struct sockaddr*)data)[i].sa_data, sizeof(pcore_cfg->macs_to_set[i].au8Addr)));
3819 _DF_USER_SET_ON_PARAM(PRM_ID_ACL_RANGE, MTLK_CORE_REQ_SET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, pcore_cfg)
3820 int i;
3822 if (0 != (*length % 2)) {
3823 ELOG_D("Address vector length should be even. length(%u)", *length);
3824 res = MTLK_ERR_PARAMS;
3825 } else if ((*length >> 1) > MAX_ADDRESSES_IN_ACL) {
3826 ELOG_D("Address vector length should be not more than %u address/mask pairs", MAX_ADDRESSES_IN_ACL);
3827 res = MTLK_ERR_PARAMS;
3828 } else {
3829 MTLK_CFG_SET_ITEM(pcore_cfg, num_macs_to_set, (*length) >> 1);
3830 for (i = 0; i < pcore_cfg->num_macs_to_set; i++) {
3831 MTLK_CFG_SET_ITEM_BY_FUNC_VOID(pcore_cfg, macs_to_set, memcpy,
3832 (pcore_cfg->macs_to_set[i].au8Addr, ((struct sockaddr*)data)[i << 1].sa_data, sizeof(pcore_cfg->macs_to_set[i].au8Addr)));
3833 MTLK_CFG_SET_ITEM_BY_FUNC_VOID(pcore_cfg, mac_mask, memcpy,
3834 (pcore_cfg->mac_mask[i].au8Addr, ((struct sockaddr*)data)[(i << 1) + 1].sa_data, sizeof(pcore_cfg->mac_mask[i].au8Addr)));
3838 _DF_USER_SET_ON_PARAM(PRM_ID_ACL_DEL, MTLK_CORE_REQ_SET_CORE_CFG, FALSE, mtlk_gen_core_cfg_t, pcore_cfg)
3839 int i;
3840 MTLK_CFG_SET_ITEM(pcore_cfg, num_macs_to_del, *length);
3841 for (i = 0; (i < pcore_cfg->num_macs_to_del) && (i < MAX_ADDRESSES_IN_ACL); i++) {
3842 MTLK_CFG_SET_ITEM_BY_FUNC_VOID(pcore_cfg, macs_to_del, memcpy,
3843 (pcore_cfg->macs_to_del[i].au8Addr, ((struct sockaddr*)data)[i].sa_data, sizeof(pcore_cfg->macs_to_del[i].au8Addr)));
3846 _DF_USER_SET_ON_PARAM(PRM_ID_ACTIVE_SCAN_SSID, MTLK_CORE_REQ_SET_SCAN_CFG, FALSE, mtlk_scan_cfg_t, scan_cfg)
3847 data[*length - 1] = '\0'; /* force string null-termination */
3848 MTLK_CFG_SET_ITEM_BY_FUNC_VOID(scan_cfg, essid, strncpy,
3849 (scan_cfg->essid, data, MIB_ESSID_LENGTH + 1));
3850 scan_cfg->essid[MIB_ESSID_LENGTH] = '\0';
3852 _DF_USER_SET_ON_PARAM(PRM_ID_HW_LIMITS, MTLK_CORE_REQ_SET_HW_DATA_CFG, FALSE, mtlk_hw_data_cfg_t, hw_data_cfg)
3853 data[*length - 1] = '\0';
3854 MTLK_CFG_SET_ITEM_BY_FUNC(hw_data_cfg, hw_cfg, _mtlk_df_user_fill_hw_cfg,
3855 (&hw_data_cfg->hw_cfg, data), res);
3857 _DF_USER_SET_ON_PARAM(PRM_ID_ANT_GAIN, MTLK_CORE_REQ_SET_HW_DATA_CFG, FALSE, mtlk_hw_data_cfg_t, hw_data_cfg)
3858 data[*length - 1] = '\0';
3859 MTLK_CFG_SET_ITEM_BY_FUNC(hw_data_cfg, ant, _mtlk_df_user_fill_ant_cfg,
3860 (&hw_data_cfg->ant, data), res);
3862 _DF_USER_SET_ON_PARAM(PRM_ID_TX_POWER_LIMIT, MTLK_CORE_REQ_SET_HW_DATA_CFG, FALSE, mtlk_hw_data_cfg_t, hw_data_cfg)
3863 MTLK_CFG_SET_ITEM_BY_FUNC(hw_data_cfg, power_limit, _mtlk_df_user_fill_power_limit_cfg_by_int_vec,
3864 (&hw_data_cfg->power_limit, *length, (int32*)data), res);
3866 _DF_USER_SET_ON_PARAM(PRM_ID_WDS_HOST_TIMEOUT, MTLK_CORE_REQ_SET_HSTDB_CFG, FALSE, mtlk_hstdb_cfg_t, hstdb_cfg)
3867 MTLK_CFG_SET_ITEM(hstdb_cfg, wds_host_timeout, *(uint32*)data);
3869 _DF_USER_SET_ON_PARAM(PRM_ID_HSTDB_LOCAL_MAC, MTLK_CORE_REQ_SET_HSTDB_CFG, FALSE, mtlk_hstdb_cfg_t, hstdb_cfg)
3870 MTLK_CFG_SET_ITEM_BY_FUNC(hstdb_cfg, address, _mtlk_df_user_fill_ether_address, (&hstdb_cfg->address, (struct sockaddr*)data), res);
3872 _DF_USER_SET_ON_PARAM(PRM_ID_SCAN_CACHE_LIFETIME, MTLK_CORE_REQ_SET_SCAN_CFG, FALSE, mtlk_scan_cfg_t, scan_cfg)
3873 MTLK_CFG_SET_ITEM(scan_cfg, cache_expire, *(uint32*)data);
3875 _DF_USER_SET_ON_PARAM(PRM_ID_BG_SCAN_CH_LIMIT, MTLK_CORE_REQ_SET_SCAN_CFG, FALSE, mtlk_scan_cfg_t, scan_cfg)
3876 MTLK_CFG_SET_ITEM(scan_cfg, channels_per_chunk_limit, *(uint32*)data);
3878 _DF_USER_SET_ON_PARAM(PRM_ID_BG_SCAN_PAUSE, MTLK_CORE_REQ_SET_SCAN_CFG, FALSE, mtlk_scan_cfg_t, scan_cfg)
3879 MTLK_CFG_SET_ITEM(scan_cfg, pause_between_chunks, *(uint32*)data);
3881 _DF_USER_SET_ON_PARAM(PRM_ID_IS_BACKGROUND_SCAN, MTLK_CORE_REQ_SET_SCAN_CFG, FALSE, mtlk_scan_cfg_t, scan_cfg)
3882 MTLK_CFG_SET_ITEM(scan_cfg, is_background_scan, *(uint32*)data);
3884 _DF_USER_SET_ON_PARAM(PRM_ID_USE_8021Q, MTLK_CORE_REQ_SET_QOS_CFG, FALSE, mtlk_qos_cfg_t, qos_cfg)
3885 MTLK_CFG_SET_ITEM(qos_cfg, map, *(uint32*)data);
3887 _DF_USER_SET_ON_PARAM(PRM_ID_COC_POWER_MODE, MTLK_CORE_REQ_SET_COC_CFG, FALSE, mtlk_coc_mode_cfg_t, coc_cfg)
3888 MTLK_CFG_SET_ITEM(coc_cfg, is_auto_mode, *(uint32*)data);
3889 MTLK_CFG_SET_ITEM_BY_FUNC(coc_cfg, antenna_params,
3890 _mtlk_df_user_get_coc_antenna_params_by_intvec, ((uint32*)data, *length, &coc_cfg->antenna_params), res);
3892 _DF_USER_SET_ON_PARAM(PRM_ID_COC_AUTO_PARAMS, MTLK_CORE_REQ_SET_COC_CFG, FALSE, mtlk_coc_mode_cfg_t, coc_cfg)
3893 MTLK_CFG_SET_ITEM_BY_FUNC(coc_cfg, auto_params,
3894 _mtlk_df_user_get_coc_auto_params_by_intvec, ((uint32*)data, *length, &coc_cfg->auto_params), res);
3896 #ifdef MTCFG_PMCU_SUPPORT
3897 _DF_USER_SET_ON_PARAM(PRM_ID_PCOC_POWER_MODE, MTLK_CORE_REQ_SET_PCOC_CFG, FALSE, mtlk_pcoc_mode_cfg_t, pcoc_cfg)
3898 MTLK_CFG_SET_ITEM(pcoc_cfg, is_enabled, *(uint32*)data);
3900 _DF_USER_SET_ON_PARAM(PRM_ID_PCOC_AUTO_PARAMS, MTLK_CORE_REQ_SET_PCOC_CFG, FALSE, mtlk_pcoc_mode_cfg_t, pcoc_cfg)
3901 MTLK_CFG_SET_ITEM_BY_FUNC(pcoc_cfg, params,
3902 _mtlk_df_user_get_pcoc_params_by_intvec, ((uint32*)data, *length, &pcoc_cfg->params), res);
3904 _DF_USER_SET_ON_PARAM(PRM_ID_PCOC_PMCU_DEBUG, MTLK_CORE_REQ_SET_PCOC_CFG, FALSE, mtlk_pcoc_mode_cfg_t, pcoc_cfg)
3905 MTLK_CFG_SET_ITEM(pcoc_cfg, pmcu_debug, *(uint32*)data);
3906 #endif
3908 _DF_USER_SET_ON_PARAM(PRM_ID_SQ_LIMITS, MTLK_CORE_REQ_SET_SQ_CFG, FALSE, mtlk_sq_cfg_t, sq_cfg)
3909 MTLK_CFG_SET_ARRAY_ITEM(sq_cfg, sq_limit, (int32*)data, *length, res);
3911 _DF_USER_SET_ON_PARAM(PRM_ID_SQ_PEER_LIMITS, MTLK_CORE_REQ_SET_SQ_CFG, FALSE, mtlk_sq_cfg_t, sq_cfg)
3912 MTLK_CFG_SET_ARRAY_ITEM(sq_cfg, peer_queue_limit, (int32*)data, *length, res);
3914 /* 20/40 coexistence */
3916 _DF_USER_SET_ON_PARAM(PRM_ID_COEX_MODE, MTLK_CORE_REQ_SET_COEX_20_40_MODE_CFG, FALSE, mtlk_coex_20_40_mode_cfg_t, coex20_40_cfg)
3917 MTLK_CFG_SET_ITEM(coex20_40_cfg, coexistence_mode, *(uint32*)data);
3918 /*ILOG0_D("FUNCTION Value in core = %d\n", *(uint32*)data);*/
3920 _DF_USER_SET_ON_PARAM(PRM_ID_COEX_THRESHOLD, MTLK_CORE_REQ_SET_COEX_20_40_RSSI_THR_CFG, FALSE, mtlk_coex_20_40_mode_cfg_t, coex20_40_cfg)
3921 MTLK_CFG_SET_ITEM(coex20_40_cfg, rssi_threshold, *(int32*)data);
3923 _DF_USER_SET_ON_PARAM(PRM_ID_INTOLERANCE_MODE, MTLK_CORE_REQ_SET_COEX_20_40_MODE_CFG, FALSE, mtlk_coex_20_40_mode_cfg_t, coex20_40_cfg)
3924 MTLK_CFG_SET_ITEM(coex20_40_cfg, intolerance_mode, *(uint32*)data);
3925 /*ILOG0_D("FUNCTION Value in core = %d\n", *(uint32*)data);*/
3927 _DF_USER_SET_ON_PARAM(PRM_ID_SCAN_AP_FORCE_SCAN_PARAMS_ON_ASSOC_STA, MTLK_CORE_REQ_SET_COEX_20_40_AP_FORCE_PARAMS_CFG, FALSE, mtlk_coex_20_40_ap_force_params_cfg_t, coex20_40_cfg)
3928 MTLK_CFG_SET_ITEM(coex20_40_cfg, ap_force_scan_params_on_assoc_sta, *(uint32*)data);
3929 /*ILOG0_D("FUNCTION Value in core = %d\n", *(uint32*)data);*/
3931 _DF_USER_SET_ON_PARAM(PRM_ID_SCAN_AP_WAIT_FOR_SCAN_RESULTS_INTERVAL, MTLK_CORE_REQ_SET_COEX_20_40_AP_FORCE_PARAMS_CFG, FALSE, mtlk_coex_20_40_ap_force_params_cfg_t, coex20_40_cfg)
3932 MTLK_CFG_SET_ITEM(coex20_40_cfg, wait_for_scan_results_interval, *(uint32*)data);
3933 /*ILOG0_D("FUNCTION Value in core = %d\n", *(uint32*)data);*/
3935 _DF_USER_SET_ON_PARAM(PRM_ID_EXEMPTION_REQ, MTLK_CORE_REQ_SET_COEX_20_40_STA_EXEMPTION_REQ_CFG, FALSE, mtlk_coex_20_40_exm_req_cfg_t, coex20_40_cfg)
3936 MTLK_CFG_SET_ITEM(coex20_40_cfg, exemption_req, *(uint32*)data);
3937 /*ILOG0_D("FUNCTION Value in core = %d\n", *(uint32*)data);*/
3939 _DF_USER_SET_ON_PARAM(PRM_ID_MIN_NON_EXEMPTED_STA, MTLK_CORE_REQ_SET_COEX_20_40_AP_MIN_NUM_OF_EXM_STA_CFG, FALSE, mtlk_coex_20_40_min_num_exm_sta_cfg_t, coex20_40_cfg)
3940 MTLK_CFG_SET_ITEM(coex20_40_cfg, min_non_exempted_sta, *(uint32*)data);
3941 /*ILOG0_D("FUNCTION Value in core = %d\n", *(uint32*)data);*/
3943 _DF_USER_SET_ON_PARAM(PRM_ID_DELAY_FACTOR, MTLK_CORE_REQ_SET_COEX_20_40_TIMES_CFG, FALSE, mtlk_coex_20_40_times_cfg_t, coex20_40_cfg)
3944 MTLK_CFG_SET_ITEM(coex20_40_cfg, delay_factor, *(uint32*)data);
3945 /*ILOG0_D("FUNCTION Value in core = %d\n", *(uint32*)data);*/
3947 _DF_USER_SET_ON_PARAM(PRM_ID_OBSS_SCAN_INTERVAL, MTLK_CORE_REQ_SET_COEX_20_40_TIMES_CFG, FALSE, mtlk_coex_20_40_times_cfg_t, coex20_40_cfg)
3948 MTLK_CFG_SET_ITEM(coex20_40_cfg, obss_scan_interval, *(uint32*)data);
3949 /*ILOG0_D("FUNCTION Value in core = %d\n", *(uint32*)data);*/
3951 _DF_USER_SET_ON_PARAM(PRM_ID_SCAN_ACTIVITY_THRESHOLD, MTLK_CORE_REQ_SET_COEX_20_40_TIMES_CFG, FALSE, mtlk_coex_20_40_times_cfg_t, coex20_40_cfg)
3952 MTLK_CFG_SET_ITEM(coex20_40_cfg, scan_activity_threshold, *(uint32*)data);
3953 /*ILOG0_D("FUNCTION Value in core = %d\n", *(uint32*)data);*/
3955 _DF_USER_SET_ON_PARAM(PRM_ID_SCAN_PASSIVE_DWELL, MTLK_CORE_REQ_SET_COEX_20_40_TIMES_CFG, FALSE, mtlk_coex_20_40_times_cfg_t, coex20_40_cfg)
3956 MTLK_CFG_SET_ITEM(coex20_40_cfg, scan_passive_dwell, *(uint32*)data);
3957 /*ILOG0_D("FUNCTION Value in core = %d\n", *(uint32*)data);*/
3959 _DF_USER_SET_ON_PARAM(PRM_ID_SCAN_ACTIVE_DWELL, MTLK_CORE_REQ_SET_COEX_20_40_TIMES_CFG, FALSE, mtlk_coex_20_40_times_cfg_t, coex20_40_cfg)
3960 MTLK_CFG_SET_ITEM(coex20_40_cfg, scan_active_dwell, *(uint32*)data);
3961 /*ILOG0_D("FUNCTION Value in core = %d\n", *(uint32*)data);*/
3963 _DF_USER_SET_ON_PARAM(PRM_ID_SCAN_PASSIVE_TOTAL_PER_CHANNEL, MTLK_CORE_REQ_SET_COEX_20_40_TIMES_CFG, FALSE, mtlk_coex_20_40_times_cfg_t, coex20_40_cfg)
3964 MTLK_CFG_SET_ITEM(coex20_40_cfg, scan_passive_total_per_channel, *(uint32*)data);
3965 /*ILOG0_D("FUNCTION Value in core = %d\n", *(uint32*)data);*/
3967 _DF_USER_SET_ON_PARAM(PRM_ID_SCAN_ACTIVE_TOTAL_PER_CHANNEL, MTLK_CORE_REQ_SET_COEX_20_40_TIMES_CFG, FALSE, mtlk_coex_20_40_times_cfg_t, coex20_40_cfg)
3968 MTLK_CFG_SET_ITEM(coex20_40_cfg, scan_active_total_per_channel, *(uint32*)data);
3969 /*ILOG0_D("FUNCTION Value in core = %d\n", *(uint32*)data);*/
3971 /* Interference Detection */
3972 _DF_USER_SET_ON_PARAM(PRM_ID_INTERFER_TIMEOUTS, MTLK_CORE_REQ_SET_INTERFDET_PARAMS_CFG, FALSE, mtlk_interfdet_cfg_t, interfdet_cfg)
3973 MTLK_CFG_SET_ITEM_BY_FUNC(interfdet_cfg, req_timeouts,
3974 _mtlk_df_user_get_interfdet_req_timeouts_by_intvec, ((uint32*)data, *length, &interfdet_cfg->req_timeouts), res);
3976 _DF_USER_SET_ON_PARAM(PRM_ID_INTERFER_THRESH, MTLK_CORE_REQ_SET_INTERFDET_PARAMS_CFG, FALSE, mtlk_interfdet_cfg_t, interfdet_cfg)
3977 MTLK_CFG_SET_ITEM_BY_FUNC(interfdet_cfg, req_thresh,
3978 _mtlk_df_user_get_interfdet_req_thresh_by_intvec, ((uint32*)data, *length, &interfdet_cfg->req_thresh), res);
3980 _DF_USER_SET_ON_PARAM(PRM_ID_INTERFER_SCANTIMES, MTLK_CORE_REQ_SET_INTERFDET_PARAMS_CFG, FALSE, mtlk_interfdet_cfg_t, interfdet_cfg)
3981 MTLK_CFG_SET_ITEM_BY_FUNC(interfdet_cfg, req_scantimes,
3982 _mtlk_df_user_get_interfdet_req_scantimes_by_intvec, ((uint32*)data, *length, &interfdet_cfg->req_scantimes), res);
3984 _DF_USER_SET_ON_PARAM(PRM_ID_CFG_LED_GPIO, MTLK_CORE_REQ_SET_FW_LED_CFG, FALSE, mtlk_fw_led_cfg_t, fw_led_cfg)
3985 MTLK_CFG_SET_ITEM_BY_FUNC(fw_led_cfg, gpio_cfg,
3986 _mtlk_df_user_get_fw_gpio_cfg_by_intvec, ((uint32*)data, *length, &fw_led_cfg->gpio_cfg), res);
3988 _DF_USER_SET_ON_PARAM(PRM_ID_CFG_LED_STATE, MTLK_CORE_REQ_SET_FW_LED_CFG, FALSE, mtlk_fw_led_cfg_t, fw_led_cfg)
3989 MTLK_CFG_SET_ITEM_BY_FUNC(fw_led_cfg, led_state,
3990 _mtlk_df_user_get_fw_led_state_by_intvec, ((uint32*)data, *length, &fw_led_cfg->led_state), res);
3992 _DF_USER_SET_ON_PARAM(PRM_ID_DBG_CLI, MTLK_CORE_REQ_SET_DBG_CLI, FALSE, mtlk_dbg_cli_cfg_t, dbg_cli_cfg)
3993 MTLK_CFG_SET_ITEM_BY_FUNC(dbg_cli_cfg, DbgCliReq,
3994 _mtlk_df_user_do_simple_cli, ((uint32*)data, *length, &dbg_cli_cfg->DbgCliReq), res);
3996 _DF_USER_SET_ON_PARAM(PRM_ID_FW_DEBUG, MTLK_CORE_REQ_SET_FW_DEBUG, FALSE, mtlk_fw_debug_cfg_t, fw_debug_cfg)
3997 MTLK_CFG_SET_ITEM_BY_FUNC(fw_debug_cfg, FWDebugReq,
3998 _mtlk_df_user_do_fw_debug, ((uint32*)data, *length, &fw_debug_cfg->FWDebugReq), res);
4000 _DF_USER_SET_ON_PARAM(PRM_ID_FW_LOG_SEVERITY, MTLK_CORE_REQ_SET_FW_LOG_SEVERITY, FALSE, mtlk_fw_log_severity_t, fw_log_severity)
4001 if (2 != (*length)) {
4002 ELOG_D("Need exactly 2 arguments (length=%u)", *length);
4003 res = MTLK_ERR_PARAMS;
4004 } else {
4005 MTLK_CFG_SET_ITEM(fw_log_severity, newLevel, ((uint32*)data)[0]);
4006 MTLK_CFG_SET_ITEM(fw_log_severity, targetCPU, ((uint32*)data)[1]);
4007 /* ILOG0_DD("FUNCTION Values in core = %d, %d\n", ((uint32*)data)[0], ((uint32*)data)[1]); */
4010 _DF_USER_SET_ON_PARAM(PRM_ID_TA_TIMER_RESOLUTION, MTLK_CORE_REQ_SET_TA_CFG, FALSE, mtlk_ta_cfg_t, mtlk_ta_cfg)
4011 MTLK_CFG_SET_ITEM(mtlk_ta_cfg, timer_resolution, *(uint32*)data);
4013 _DF_USER_SET_ON_PARAM(PRM_ID_ENHANCED11B_TH, MTLK_CORE_REQ_SET_ENHANCED11B_CFG, FALSE, mtlk_enhanced11b_cfg_t, mtlk_enhanced11b_cfg)
4014 MTLK_CFG_SET_ITEM_BY_FUNC(mtlk_enhanced11b_cfg, thresholds,
4015 _mtlk_df_user_get_11b_thresholds_by_intvec, ((uint32*)data, *length, &mtlk_enhanced11b_cfg->thresholds), res);
4017 _DF_USER_SET_ON_PARAM(PRM_ID_11B_ANTENNA_SELECTION, MTLK_CORE_REQ_SET_11B_CFG, FALSE, mtlk_11b_cfg_t, mtlk_11b_cfg)
4018 MTLK_CFG_SET_ITEM_BY_FUNC(mtlk_11b_cfg, antsel,
4019 _mtlk_df_user_get_11b_antsel_by_intvec, ((uint32*)data, *length, &mtlk_11b_cfg->antsel), res);
4021 /* 802.11w parameters begin */
4022 _DF_USER_SET_ON_PARAM(PRM_ID_PMF_ACTIVATED, MTLK_CORE_REQ_SET_DOT11W_CFG, FALSE, mtlk_dot11w_cfg_t, mtlk_dot11w_cfg)
4023 MTLK_CFG_SET_ITEM(mtlk_dot11w_cfg, pmf_activated, *(uint32*)data);
4025 _DF_USER_SET_ON_PARAM(PRM_ID_PMF_REQUIRED, MTLK_CORE_REQ_SET_DOT11W_CFG, FALSE, mtlk_dot11w_cfg_t, mtlk_dot11w_cfg)
4026 MTLK_CFG_SET_ITEM(mtlk_dot11w_cfg, pmf_required, *(uint32*)data);
4028 _DF_USER_SET_ON_PARAM(PRM_ID_SAQ_RETR_TMOUT, MTLK_CORE_REQ_SET_DOT11W_CFG, FALSE, mtlk_dot11w_cfg_t, mtlk_dot11w_cfg)
4029 MTLK_CFG_SET_ITEM(mtlk_dot11w_cfg, saq_retr_tmout, *(uint32*)data);
4031 _DF_USER_SET_ON_PARAM(PRM_ID_SAQ_MAX_TMOUT, MTLK_CORE_REQ_SET_DOT11W_CFG, FALSE, mtlk_dot11w_cfg_t, mtlk_dot11w_cfg)
4032 MTLK_CFG_SET_ITEM(mtlk_dot11w_cfg, saq_max_tmout, *(uint32*)data);
4033 /* 802.11w parameters end */
4035 _DF_USER_SET_ON_PARAM(PRM_ID_FW_RECOVERY, MTLK_CORE_REQ_SET_RECOVERY_CFG, FALSE, mtlk_rcvry_cfg_t, fw_rcvry_cfg)
4036 MTLK_CFG_SET_ITEM_BY_FUNC(fw_rcvry_cfg, recovery_cfg,
4037 _mtlk_df_user_get_recovery_by_intvec, ((uint32*)data, *length, &fw_rcvry_cfg->recovery_cfg), res);
4039 _DF_USER_SET_ON_PARAM(PRM_ID_MC_PS_SIZE, MTLK_CORE_REQ_SET_MC_PS_SIZE_CFG, FALSE, mtlk_mc_ps_size_cfg_t, mc_ps_size_cfg)
4040 MTLK_CFG_SET_ITEM(mc_ps_size_cfg, maxNumberOfFsdus, *(uint32*)data);
4042 /* U-APSD mode */
4043 _DF_USER_SET_ON_PARAM(PRM_ID_UAPSD_MODE, MTLK_CORE_REQ_SET_UAPSD_MODE, FALSE, mtlk_uapsd_mode_cfg_t, uapsd_mode_cfg)
4044 MTLK_CFG_SET_ITEM(uapsd_mode_cfg, uapsd_enabled, *(uint32*)data);
4046 _DF_USER_SET_ON_PARAM(PRM_ID_UAPSD_MAX_SP, MTLK_CORE_REQ_SET_UAPSD_CFG, FALSE, mtlk_uapsd_cfg_t, uapsd_cfg)
4047 MTLK_CFG_SET_ITEM(uapsd_cfg, uapsd_max_sp, *(uint32*)data);
4049 _DF_USER_SET_PARAM_MAP_END()
4051 return res;
4054 static int
4055 _mtlk_ioctl_drv_gen_data_exchange (mtlk_df_user_t* df_user, struct ifreq *ifr)
4057 int res = MTLK_ERR_OK;
4058 mtlk_core_ui_gen_data_t req;
4059 WE_GEN_DATAEX_RESPONSE resp;
4060 mtlk_clpb_t *clpb = NULL;
4062 WE_GEN_DATAEX_DEVICE_STATUS *dev_status = NULL;
4063 WE_GEN_DATAEX_CONNECTION_STATUS *con_status = NULL;
4064 WE_GEN_DATAEX_STATUS *status = NULL;
4065 WE_GEN_DATAEX_RESPONSE *core_resp = NULL;
4066 uint32 core_resp_size = 0;
4068 /* response, should be placed first to user buffer */
4069 void *out = ifr->ifr_data + sizeof(WE_GEN_DATAEX_RESPONSE);
4070 const char *reason = "system error";
4072 /* Make sure no fields will be left uninitialized by command handler */
4073 memset(&req, 0, sizeof(req));
4074 memset(&resp, 0, sizeof(resp));
4076 if (0 != copy_from_user(&req.request, ifr->ifr_data, sizeof(req.request))) {
4077 res = MTLK_ERR_PARAMS;
4078 goto finish;
4081 /* error case - copy response with error status and needed protocol version to user space */
4082 if (WE_GEN_DATAEX_PROTO_VER != req.request.ver) {
4083 uint32 proto_ver = WE_GEN_DATAEX_PROTO_VER;
4085 WLOG_DD("Data exchange protocol version mismatch (version is %u, expected %u)",
4086 req.request.ver,
4087 WE_GEN_DATAEX_PROTO_VER);
4089 resp.status = WE_GEN_DATAEX_PROTO_MISMATCH;
4090 resp.datalen = sizeof(uint32);
4092 if (0 != copy_to_user(out, &proto_ver, sizeof(uint32))) {
4093 res = MTLK_ERR_PARAMS;
4095 goto finish;
4098 /* in case of MAC leds additional parameters are needed from userspace */
4099 if (WE_GEN_DATAEX_CMD_LEDS_MAC == req.request.cmd_id) {
4100 if (0 != copy_from_user(&req.leds_status,
4101 ifr->ifr_data + sizeof(WE_GEN_DATAEX_REQUEST),
4102 sizeof(req.leds_status))) {
4103 res = MTLK_ERR_PARAMS;
4104 goto finish;
4108 res = _mtlk_df_user_invoke_core(df_user->df,
4109 MTLK_CORE_REQ_GEN_DATA_EXCHANGE,
4110 &clpb, &req, sizeof(req));
4111 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GEN_DATA_EXCHANGE, FALSE);
4113 if (MTLK_ERR_OK != res) {
4114 goto finish;
4117 switch (req.request.cmd_id) {
4118 case WE_GEN_DATAEX_CMD_CONNECTION_STATS:
4120 /* step - WE_GEN_DATAEX_CONNECTION_STATUS should be copied first
4121 * to userspace */
4122 void *tmp_out = out;
4123 out += sizeof(WE_GEN_DATAEX_CONNECTION_STATUS);
4125 MTLK_ASSERT(sizeof(WE_GEN_DATAEX_DEVICE_STATUS) !=
4126 sizeof(WE_GEN_DATAEX_CONNECTION_STATUS));
4128 MTLK_ASSERT(sizeof(WE_GEN_DATAEX_DEVICE_STATUS) !=
4129 sizeof(WE_GEN_DATAEX_RESPONSE));
4131 MTLK_ASSERT(sizeof(WE_GEN_DATAEX_CONNECTION_STATUS) !=
4132 sizeof(WE_GEN_DATAEX_RESPONSE));
4134 /* retrieve several WE_GEN_DATAEX_DEVICE_STATUS from clipboard
4135 * and copy them to userspace, these structures may be not present
4136 * in clipboard in case of no STA connected to AP */
4137 dev_status = mtlk_clpb_enum_get_next(clpb, &core_resp_size);
4139 while (sizeof(WE_GEN_DATAEX_DEVICE_STATUS) == core_resp_size) {
4140 if (0 != copy_to_user(out, dev_status, core_resp_size)) {
4141 res = MTLK_ERR_VALUE;
4142 goto process_res;
4144 out += sizeof(WE_GEN_DATAEX_DEVICE_STATUS);
4145 dev_status = mtlk_clpb_enum_get_next(clpb, &core_resp_size);
4148 MTLK_ASSERT(core_resp_size != sizeof(WE_GEN_DATAEX_RESPONSE));
4149 MTLK_ASSERT(core_resp_size == sizeof(WE_GEN_DATAEX_CONNECTION_STATUS));
4151 /* WE_GEN_DATAEX_CONNECTION_STATUS must be placed after WE_GEN_DATAEX_DEVICE_STATUS
4152 * in clipboard, copy it to userspace using previously stored pointer tmp_out! */
4153 con_status = (WE_GEN_DATAEX_CONNECTION_STATUS*)dev_status;
4155 MTLK_ASSERT(NULL != con_status);
4157 if (0 != copy_to_user(tmp_out, con_status, core_resp_size)) {
4158 res = MTLK_ERR_VALUE;
4159 goto process_res;
4162 /* retrieve WE_GEN_DATAEX_RESPONSE from clipboard
4163 * it will be copied to userspace at the end of function */
4164 core_resp = mtlk_clpb_enum_get_next(clpb, &core_resp_size);
4166 MTLK_ASSERT(NULL != core_resp);
4167 MTLK_ASSERT(sizeof(*core_resp) == core_resp_size);
4169 resp = *core_resp;
4171 break;
4172 case WE_GEN_DATAEX_CMD_STATUS:
4174 /* retrieve several WE_GEN_DATAEX_STATUS from clipboard
4175 * and copy them to userspace */
4176 status = mtlk_clpb_enum_get_next(clpb, &core_resp_size);
4178 MTLK_ASSERT(NULL != status);
4179 MTLK_ASSERT(sizeof(*status) == core_resp_size);
4181 if (0 != copy_to_user(out, status, core_resp_size)) {
4182 res = MTLK_ERR_VALUE;
4183 goto process_res;
4186 /* retrieve WE_GEN_DATAEX_RESPONSE from clipboard
4187 * it will be copied to userspace at the end of function */
4188 core_resp = mtlk_clpb_enum_get_next(clpb, &core_resp_size);
4190 MTLK_ASSERT(NULL != core_resp);
4191 MTLK_ASSERT(sizeof(*core_resp) == core_resp_size);
4193 resp = *core_resp;
4195 break;
4196 case WE_GEN_DATAEX_CMD_LEDS_MAC:
4198 /* retrieve WE_GEN_DATAEX_RESPONSE from clipboard
4199 * it will be copied to userspace at the end of function */
4200 core_resp = mtlk_clpb_enum_get_next(clpb, &core_resp_size);
4202 MTLK_ASSERT(NULL != core_resp);
4203 MTLK_ASSERT(sizeof(*core_resp) == core_resp_size);
4205 resp = *core_resp;
4207 break;
4208 default:
4209 WLOG_D("Data exchange protocol: unknown command %u", req.request.cmd_id);
4210 resp.status = WE_GEN_DATAEX_UNKNOWN_CMD;
4211 resp.datalen = 0;
4212 break;
4215 if (resp.status == WE_GEN_DATAEX_FAIL) {
4216 /* Return failure reason */
4217 size_t reason_sz = strlen(reason) + 1;
4218 if (req.request.datalen >= reason_sz) {
4219 if (0 != copy_to_user(ifr->ifr_data + sizeof(WE_GEN_DATAEX_RESPONSE), reason, reason_sz)) {
4220 res = MTLK_ERR_VALUE;
4221 goto process_res;
4223 resp.datalen = reason_sz;
4225 else {
4226 resp.datalen = 0; /* error string does not fit */
4230 /* copy previously filled WE_GEN_DATAEX_RESPONSE */
4231 if (copy_to_user(ifr->ifr_data, &resp, sizeof(resp)) != 0) {
4232 res = MTLK_ERR_VALUE;
4235 process_res:
4236 mtlk_clpb_delete(clpb);
4238 finish:
4239 if (MTLK_ERR_OK != res) {
4240 ELOG_D("Error#%d during data exchange request", res);
4243 return _mtlk_df_mtlk_to_linux_error_code(res);
4246 static int
4247 mtlk_df_do_command (struct net_device *dev, struct ifreq *ifr, int cmd)
4249 mtlk_df_user_t* df_user = (mtlk_df_user_t*)netdev_priv(dev);
4250 int res = -EOPNOTSUPP;
4252 ILOG3_SSDD("%s: Invoked from %s (%i), cmd is 0x%04x", dev->name, current->comm, current->pid, cmd);
4254 /* we only support private ioctls */
4255 if ((cmd < MTLK_IOCTL_FIRST) || (cmd > MTLK_IOCTL_LAST)) {
4256 goto FINISH;
4259 switch (cmd) {
4260 case MTLK_IOCTL_DATAEX:
4261 res = _mtlk_ioctl_drv_gen_data_exchange(df_user, ifr);
4262 break;
4263 default:
4264 ELOG_D("ioctl not supported: 0x%04x", cmd);
4265 break;
4268 FINISH:
4269 return res;
4272 static void
4273 _df_user_copy_linux_stats(struct net_device_stats* linux_stats,
4274 mtlk_core_general_stats_t* core_status)
4276 linux_stats->rx_packets = core_status->rx_packets;
4277 linux_stats->tx_packets = core_status->tx_packets - core_status->core_priv_stats.fwd_tx_packets;
4278 linux_stats->rx_bytes = core_status->rx_bytes;
4279 linux_stats->tx_bytes = core_status->tx_bytes - core_status->core_priv_stats.fwd_tx_bytes;
4280 linux_stats->tx_dropped = core_status->mac_stat.stat[STAT_TX_FAIL]; /* total tx packets dropped */
4281 linux_stats->collisions = core_status->mac_stat.stat[STAT_TX_RETRY]; /* total tx retries */
4282 linux_stats->rx_fifo_errors = core_status->mac_stat.stat[STAT_OUT_OF_RX_MSDUS]; /* total rx queue overruns */
4283 linux_stats->tx_fifo_errors = core_status->core_priv_stats.tx_overruns;
4286 static struct net_device_stats *
4287 _mtlk_df_user_get_stats(struct net_device *dev)
4289 mtlk_df_user_t* df_user = (mtlk_df_user_t*) netdev_priv(dev);
4290 return &df_user->slow_ctx->linux_stats;
4293 static void __MTLK_IFUNC
4294 _mtlk_df_poll_stats_clb(mtlk_handle_t user_context,
4295 int processing_result,
4296 mtlk_clpb_t *pclpb)
4298 int res;
4299 mtlk_df_user_t* df_user = (mtlk_df_user_t*) user_context;
4301 res = _mtlk_df_user_process_core_retval_void(processing_result, pclpb, MTLK_CORE_REQ_GET_STATUS, FALSE);
4303 if(MTLK_ERR_OK == res)
4305 uint32 size;
4307 mtlk_core_general_stats_t* core_status =
4308 (mtlk_core_general_stats_t*) mtlk_clpb_enum_get_next(pclpb, &size);
4310 MTLK_ASSERT(NULL != core_status);
4311 MTLK_ASSERT(sizeof(*core_status) == size);
4313 df_user->slow_ctx->core_general_stats = *core_status;
4315 _df_user_copy_linux_stats(&df_user->slow_ctx->linux_stats, core_status);
4317 else
4319 memset(&df_user->slow_ctx->linux_stats, 0,
4320 sizeof(df_user->slow_ctx->linux_stats));
4323 if (!mtlk_osal_timer_is_cancelled(&df_user->slow_ctx->stat_timer)) {
4324 /* if timer has been already canceled, don't start it again,
4325 thus this callback can be performed from serializer later after timer stop */
4326 mtlk_osal_timer_set(&df_user->slow_ctx->stat_timer, _DF_STAT_POLL_PERIOD);
4330 static uint32
4331 _mtlk_df_poll_stats (mtlk_osal_timer_t *timer, mtlk_handle_t data)
4333 mtlk_df_user_t* df_user = (mtlk_df_user_t*) data;
4335 _mtlk_df_user_invoke_core_async(df_user->df, MTLK_CORE_REQ_GET_STATUS,
4336 NULL, 0, _mtlk_df_poll_stats_clb, HANDLE_T(df_user));
4338 return 0;
4341 static int
4342 _mtlk_df_user_prevent_change_mtu(struct net_device *dev, int new_mtu)
4344 return -EFAULT;
4347 static void _mtlk_df_user_fill_callbacks(mtlk_df_user_t *df_user)
4349 df_user->dev->wireless_handlers = (struct iw_handler_def *)&mtlk_linux_handler_def;
4351 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
4352 df_user->dev->hard_start_xmit = _mtlk_df_user_start_tx;
4353 df_user->dev->open = _mtlk_df_user_iface_open;
4354 df_user->dev->stop = _mtlk_df_user_iface_stop;
4355 df_user->dev->set_mac_address = _mtlk_df_user_set_mac_addr;
4356 df_user->dev->get_stats = _mtlk_df_user_get_stats;
4358 df_user->dev->tx_timeout = NULL;
4359 df_user->dev->change_mtu = _mtlk_df_user_prevent_change_mtu;
4361 df_user->dev->do_ioctl = mtlk_df_do_command;
4362 #else
4363 df_user->dev_ops.ndo_start_xmit = _mtlk_df_user_start_tx;
4364 df_user->dev_ops.ndo_open = _mtlk_df_user_iface_open;
4365 df_user->dev_ops.ndo_stop = _mtlk_df_user_iface_stop;
4366 df_user->dev_ops.ndo_set_mac_address = _mtlk_df_user_set_mac_addr;
4367 df_user->dev_ops.ndo_get_stats = _mtlk_df_user_get_stats;
4369 df_user->dev_ops.ndo_tx_timeout = NULL;
4370 df_user->dev_ops.ndo_change_mtu = _mtlk_df_user_prevent_change_mtu;
4372 df_user->dev_ops.ndo_do_ioctl = mtlk_df_do_command;
4374 df_user->dev->netdev_ops = &df_user->dev_ops;
4375 #endif
4378 static int _mtlk_df_ui_create_card_dir(mtlk_df_user_t* df_user)
4380 MTLK_ASSERT(NULL != df_user);
4382 df_user->slow_ctx->proc_df_node =
4383 mtlk_df_proc_node_create(mtlk_df_user_get_name(df_user), mtlk_dfg_get_drv_proc_node());
4385 if (NULL == df_user->slow_ctx->proc_df_node) {
4386 return MTLK_ERR_NO_MEM;
4388 return MTLK_ERR_OK;
4391 static int _mtlk_df_ui_create_debug_dir(mtlk_df_user_t* df_user)
4393 MTLK_ASSERT(NULL != df_user);
4395 df_user->slow_ctx->proc_df_debug_node =
4396 mtlk_df_proc_node_create("Debug", df_user->slow_ctx->proc_df_node);
4398 if (NULL == df_user->slow_ctx->proc_df_debug_node) {
4399 return MTLK_ERR_NO_MEM;
4401 return MTLK_ERR_OK;
4404 static void _mtlk_df_ui_delete_card_dir(mtlk_df_user_t* df_user)
4406 mtlk_df_proc_node_delete(df_user->slow_ctx->proc_df_node);
4407 df_user->slow_ctx->proc_df_node = NULL;
4410 static void _mtlk_df_ui_delete_debug_dir(mtlk_df_user_t* df_user)
4412 mtlk_df_proc_node_delete(df_user->slow_ctx->proc_df_debug_node);
4413 df_user->slow_ctx->proc_df_debug_node = NULL;
4416 static void
4417 _mtlk_df_user_unregister_ndev(mtlk_df_user_t *df_user, mtlk_vap_manager_interface_e intf)
4419 switch(intf) {
4420 case MTLK_VAP_MASTER_INTERFACE:
4421 /* master interface can be removed only in case of driver remove (rmmod),
4422 * so no need to check is slave or not here
4423 * this call holds rtnl_lock() */
4424 unregister_netdev(df_user->dev);
4425 break;
4427 case MTLK_VAP_SLAVE_INTERFACE:
4428 /* we cannot call free_netdev() directly, because unregistration will be complete only when we exit ioctl
4429 * On ioctl exit rtnl_unlock() is called, which in turn calls netdev_run_todo() function
4430 * - it completes unregistration of network device.
4431 * We MUST NOT call rtnl_unlock() from within ioctl */
4432 //TODO destructor removed
4433 // df_user->dev->destructor = free_netdev;
4435 /* doesn't hold rtnl_lock(), it's already held, because we are in ioctl now */
4436 unregister_netdevice(df_user->dev);
4437 break;
4439 default:
4440 MTLK_ASSERT(0);
4444 static int
4445 _mtlk_df_user_register_ndev(mtlk_df_user_t *df_user, mtlk_vap_manager_interface_e intf)
4447 int res = -EINVAL;
4448 switch(intf) {
4449 case MTLK_VAP_MASTER_INTERFACE:
4450 /* master interface can be removed only in case of driver remove (rmmod),
4451 * so no need to check is slave or not here
4452 * this call holds rtnl_lock() */
4453 res = register_netdev(df_user->dev);
4454 break;
4456 case MTLK_VAP_SLAVE_INTERFACE:
4457 /* doesn't hold rtnl_lock(), it's already held, because we are in ioctl now */
4458 res = register_netdevice(df_user->dev);
4460 /* we don't need to play rtnl_lock/rtnl_unlock here -
4461 * there is no "todo's" scheduled in kernel on Network Device registration
4463 break;
4464 default:
4465 MTLK_ASSERT(0);
4468 return (0 == res) ? MTLK_ERR_OK : MTLK_ERR_UNKNOWN;
4471 MTLK_START_STEPS_LIST_BEGIN(df_user)
4472 MTLK_START_STEPS_LIST_ENTRY(df_user, REGISTER_DEVICE)
4473 MTLK_START_STEPS_LIST_ENTRY(df_user, STAT_POLL)
4474 MTLK_START_STEPS_LIST_ENTRY(df_user, PPA_XFACE)
4475 MTLK_START_INNER_STEPS_BEGIN(df_user)
4476 MTLK_START_STEPS_LIST_END(df_user);
4478 void
4479 mtlk_df_user_stop(mtlk_df_user_t *df_user, mtlk_vap_manager_interface_e intf)
4481 #ifdef MTCFG_IRB_DEBUG
4482 if (mtlk_irb_pinger_is_started(&df_user->slow_ctx->pinger)) {
4483 mtlk_irb_pinger_stop(&df_user->slow_ctx->pinger);
4485 #endif /* MTCFG_IRB_DEBUG */
4487 MTLK_STOP_BEGIN(df_user, MTLK_OBJ_PTR(df_user))
4488 MTLK_STOP_STEP(df_user, PPA_XFACE, MTLK_OBJ_PTR(df_user),
4489 _mtlk_df_priv_xface_stop, (df_user));
4490 MTLK_STOP_STEP(df_user, STAT_POLL, MTLK_OBJ_PTR(df_user),
4491 mtlk_osal_timer_cancel_sync, (&df_user->slow_ctx->stat_timer));
4492 MTLK_STOP_STEP(df_user, REGISTER_DEVICE, MTLK_OBJ_PTR(df_user),
4493 _mtlk_df_user_unregister_ndev, (df_user, intf));
4494 MTLK_STOP_END(df_user, MTLK_OBJ_PTR(df_user));
4498 mtlk_df_user_start(mtlk_df_t *df, mtlk_df_user_t *df_user, mtlk_vap_manager_interface_e intf)
4500 /* From time we've allocated device name till time we register netdevice
4501 * we should hold rtnl lock to prohibit someone else from registering same netdevice name.
4502 * We can't use register_netdev, because we've splitted netdevice registration into 2 phases:
4503 * 1) allocate name
4504 * ... driver internal initialization
4505 * 2) register.
4506 * We need this because:
4507 * 1) initialization (registration of proc entries) requires knowledge of netdevice name
4508 * 2) we can't register netdevice before we have initialized the driver (we might crash on
4509 * request from the OS)
4511 * NEW APPROACH: Now the Net Device name is allocated on DF UI initialization in assumption
4512 * that no one else will register the same device name.
4513 * - DF infrastructure has been created already on DF UI initialization.
4514 * - register_netdev() API can used here from now
4515 * - It is not needed to take rtnl_lock manually
4516 * This approach allows Core to register abilities correctly before Net Device registration.
4519 MTLK_START_TRY(df_user, MTLK_OBJ_PTR(df_user))
4520 MTLK_START_STEP(df_user, REGISTER_DEVICE, MTLK_OBJ_PTR(df_user),
4521 _mtlk_df_user_register_ndev, (df_user, intf));
4523 MTLK_START_STEP(df_user, STAT_POLL, MTLK_OBJ_PTR(df_user),
4524 mtlk_osal_timer_set,
4525 (&df_user->slow_ctx->stat_timer, _DF_STAT_POLL_PERIOD));
4527 MTLK_START_STEP_VOID_IF(mtlk_vap_is_master(mtlk_df_get_vap_handle(df_user->df)),
4528 df_user, PPA_XFACE, MTLK_OBJ_PTR(df_user),
4529 _mtlk_df_priv_xface_start, (df_user));
4531 MTLK_START_FINALLY(df_user, MTLK_OBJ_PTR(df_user))
4532 MTLK_START_RETURN(df_user, MTLK_OBJ_PTR(df_user), mtlk_df_user_stop, (df_user, intf))
4535 int __MTLK_IFUNC
4536 mtlk_df_ui_indicate_rx_data(mtlk_df_t *df, mtlk_nbuf_t *nbuf)
4538 int res;
4539 mtlk_df_user_t *df_user;
4541 MTLK_ASSERT(NULL != df);
4542 MTLK_ASSERT(NULL != nbuf);
4544 df_user = mtlk_df_get_user(df);
4546 mtlk_nbuf_stop_tracking(nbuf);
4547 mtlk_nbuf_priv_cleanup(mtlk_nbuf_priv(nbuf));
4549 /* set pointer to dev, nbuf->protocol for PPA case will be set within PPA RX call back */
4550 nbuf->dev = df_user->dev;
4552 #ifdef MTLK_HAVE_PPA
4553 if (ppa_hook_directpath_send_fn && _mtlk_df_user_ppa_is_registered(df_user) && df_user->ppa.is_active) {
4554 /* set raw pointer for proper work if directpath is disabled */
4555 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
4556 skb_reset_mac_header(nbuf);
4557 #else
4558 nbuf->mac.raw = nbuf->data;
4559 #endif
4561 /* send packets to the ppa */
4562 if (ppa_hook_directpath_send_fn(df_user->ppa.if_id,
4563 nbuf, nbuf->len, 0) == PPA_SUCCESS) {
4564 ++df_user->ppa.stats.rx_accepted;
4565 return MTLK_ERR_OK;
4568 ++df_user->ppa.stats.rx_rejected;
4570 /** \note: In PPA mode we should not cleanup packet on sending failure.
4571 * Also frame can not be transferred in to the IP stack.
4572 * Otherwise packet will corrupt per CPU queue with NULL pointer access during dequeue.
4573 * \tocheck: Can be a PPA problem or not a problem at all. */
4574 return MTLK_ERR_UNKNOWN;
4576 #endif /* MTLK_HAVE_PPA */
4578 nbuf->protocol = eth_type_trans(nbuf, nbuf->dev);
4579 res = netif_rx(nbuf);
4581 //TODO removed in kernel
4582 // df_user->dev->last_rx = jiffies;
4584 if(NET_RX_SUCCESS != res)
4586 ILOG2_D("netif_rx failed: %d", res);
4587 return MTLK_ERR_UNKNOWN;
4590 return MTLK_ERR_OK;
4593 BOOL __MTLK_IFUNC mtlk_df_ui_check_is_mc_group_member(mtlk_df_t *df,
4594 const uint8* group_addr)
4596 mtlk_df_user_t *df_user;
4598 MTLK_ASSERT(NULL != df);
4599 MTLK_ASSERT(NULL != group_addr);
4601 df_user = mtlk_df_get_user(df);
4603 //check if we subscribed to all multicast
4604 if (df_user->dev->allmulti)
4605 return TRUE;
4607 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
4609 struct dev_mc_list* mc_list_entry;
4610 //check if we subscribed to that group
4611 for (mc_list_entry = df_user->dev->mc_list;
4612 mc_list_entry != NULL;
4613 mc_list_entry = mc_list_entry->next) {
4614 if (0 == mtlk_osal_compare_eth_addresses(mc_list_entry->dmi_addr, group_addr))
4615 return TRUE;
4618 #else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35) */
4620 struct netdev_hw_addr *ha;
4621 netdev_for_each_mc_addr(ha, df_user->dev) {
4622 if (!mtlk_osal_compare_eth_addresses(ha->addr, group_addr))
4623 return TRUE;
4626 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35) */
4628 return FALSE;
4631 static void
4632 _mtlk_df_user_notify_mac_addr_event( mtlk_df_user_t *df_user,
4633 int event_id,
4634 const uint8 *mac )
4636 union iwreq_data req_data;
4638 MTLK_ASSERT(NULL != df_user);
4639 MTLK_ASSERT(NULL != mac);
4641 req_data.ap_addr.sa_family = ARPHRD_ETHER;
4642 mtlk_osal_copy_eth_addresses(req_data.ap_addr.sa_data, mac);
4644 wireless_send_event(df_user->dev, event_id, &req_data, NULL);
4647 void __MTLK_IFUNC
4648 mtlk_df_ui_notify_association( mtlk_df_t *df,
4649 const uint8 *mac )
4651 _mtlk_df_user_notify_mac_addr_event(mtlk_df_get_user(df), SIOCGIWAP, mac);
4654 void __MTLK_IFUNC
4655 mtlk_df_ui_notify_disassociation(mtlk_df_t *df)
4657 static const uint8 mac[ETH_ALEN] = {0};
4658 _mtlk_df_user_notify_mac_addr_event(mtlk_df_get_user(df), SIOCGIWAP, mac);
4661 void __MTLK_IFUNC
4662 mtlk_df_ui_notify_node_connect(mtlk_df_t *df, const uint8 *node_addr)
4664 _mtlk_df_user_notify_mac_addr_event(mtlk_df_get_user(df), IWEVREGISTERED, node_addr);
4667 void __MTLK_IFUNC
4668 mtlk_df_ui_notify_node_disconect(mtlk_df_t *df, const uint8 *node_addr)
4670 _mtlk_df_user_notify_mac_addr_event(mtlk_df_get_user(df), IWEVEXPIRED, node_addr);
4673 void __MTLK_IFUNC
4674 mtlk_df_ui_notify_secure_node_connect(mtlk_df_t *df,
4675 const uint8 *node_addr,
4676 const uint8 *rsnie,
4677 size_t rsnie_len)
4679 union iwreq_data wrqu;
4680 uint8 buf[IW_CUSTOM_MAX] = {0};
4681 uint8 *p=buf;
4682 size_t i;
4684 MTLK_ASSERT(NULL != df);
4686 p += sprintf(p, "NEWSTA " MAC_PRINTF_FMT ", RSNIE_LEN %i : ",
4687 MAC_PRINTF_ARG(node_addr), rsnie_len);
4689 MTLK_ASSERT(p - buf + rsnie_len*2 < IW_CUSTOM_MAX);
4691 for (i = 0; i < rsnie_len; i++)
4692 p += sprintf(p, "%02x", rsnie[i]);
4694 wrqu.data.length = p - buf +1;
4696 wireless_send_event(mtlk_df_get_user(df)->dev, IWEVCUSTOM, &wrqu, buf);
4699 void __MTLK_IFUNC
4700 mtlk_df_ui_notify_mic_failure(mtlk_df_t *df,
4701 const uint8 *src_mac,
4702 mtlk_df_ui_mic_fail_type_t fail_type)
4704 union iwreq_data wrqu;
4705 struct iw_michaelmicfailure mic = {0};
4707 MTLK_ASSERT(NULL != df);
4708 MTLK_ASSERT(NULL != src_mac);
4710 wrqu.data.length = sizeof(struct iw_michaelmicfailure);
4712 mic.src_addr.sa_family = ARPHRD_ETHER;
4713 mtlk_osal_copy_eth_addresses(mic.src_addr.sa_data, src_mac);
4715 switch(fail_type)
4717 case MIC_FAIL_PAIRWISE:
4718 mic.flags |= IW_MICFAILURE_PAIRWISE;
4719 break;
4720 case MIC_FAIL_GROUP:
4721 mic.flags |= IW_MICFAILURE_GROUP;
4722 break;
4723 default:
4724 MTLK_ASSERT(!"Unknown MIC failure type");
4727 wireless_send_event(mtlk_df_get_user(df)->dev, IWEVMICHAELMICFAILURE, &wrqu, (char*)&mic);
4730 void __MTLK_IFUNC
4731 mtlk_df_ui_notify_scan_complete(mtlk_df_t *df)
4733 union iwreq_data wrqu;
4735 MTLK_ASSERT(NULL != df);
4737 wrqu.data.length = 0;
4738 wrqu.data.flags = 0;
4740 wireless_send_event(mtlk_df_get_user(df)->dev, SIOCGIWSCAN, &wrqu, NULL);
4743 static const mtlk_guid_t IRBE_RMMOD = MTLK_IRB_GUID_RMMOD;
4745 void __MTLK_IFUNC
4746 mtlk_df_ui_notify_notify_rmmod (const char *wlanitrf)
4748 mtlk_irbd_notify_app(mtlk_irbd_get_root(), &IRBE_RMMOD, (char *) wlanitrf, IFNAMSIZ);
4751 void __MTLK_IFUNC
4752 mtlk_df_ui_notify_notify_fw_hang(mtlk_df_t *df, uint32 fw_cpu, uint32 sw_watchdog_data)
4754 MTLK_ASSERT(df != NULL);
4755 MTLK_ASSERT(fw_cpu < ARRAY_SIZE(mtlk_df_get_user(df)->fw_hang_evts));
4757 mtlk_osal_event_set(&mtlk_df_get_user(df)->fw_hang_evts[fw_cpu]);
4758 WLOG_DD("CID-%04x: FW CPU#%d hang detected", mtlk_vap_get_oid(mtlk_df_get_vap_handle(df)), fw_cpu);
4761 void __MTLK_IFUNC
4762 mtlk_df_on_rcvry_isol (mtlk_df_t *df)
4764 MTLK_ASSERT(df != NULL);
4766 /* Stop stat timer */
4767 mtlk_osal_timer_cancel_sync(&mtlk_df_get_user(df)->slow_ctx->stat_timer);
4769 /* Unlock waiting events */
4770 mtlk_osal_event_set(&mtlk_df_get_user(df)->fw_hang_evts[UMIPS]);
4771 mtlk_osal_event_set(&mtlk_df_get_user(df)->fw_hang_evts[LMIPS]);
4774 void __MTLK_IFUNC
4775 mtlk_df_on_rcvry_restore (mtlk_df_t *df)
4777 MTLK_ASSERT(df != NULL);
4779 mtlk_osal_event_reset(&mtlk_df_get_user(df)->fw_hang_evts[UMIPS]);
4780 mtlk_osal_event_reset(&mtlk_df_get_user(df)->fw_hang_evts[LMIPS]);
4782 /* Start stat timer */
4783 mtlk_osal_timer_set(&mtlk_df_get_user(df)->slow_ctx->stat_timer, _DF_STAT_POLL_PERIOD);
4786 /**************************************************************
4787 * Transactions with Core
4788 **************************************************************/
4789 static int mtlk_df_ui_addba_status(mtlk_seq_entry_t *s, void *data)
4791 mtlk_df_t *df = mtlk_df_proc_seq_entry_get_df(s);
4792 mtlk_addba_peer_state_t *peer = NULL;
4793 mtlk_clpb_t *clpb = NULL;
4794 uint32 size;
4795 int i, res;
4797 MTLK_ASSERT(NULL != df);
4799 res = _mtlk_df_user_invoke_core(df, MTLK_CORE_REQ_GET_ADDBA_STATE, &clpb, NULL, 0);
4800 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_ADDBA_STATE, FALSE);
4802 if (MTLK_ERR_OK != res) {
4803 goto err_ret;
4806 while(NULL != (peer = mtlk_clpb_enum_get_next(clpb, &size)))
4808 MTLK_ASSERT(size == sizeof(*peer));
4810 mtlk_aux_seq_printf(s, MAC_PRINTF_FMT ":%s\n",
4811 MAC_PRINTF_ARG(peer->addr.au8Addr),
4812 peer->is_active ? "active" : "disabled");
4814 mtlk_aux_seq_printf(s, " TX %4s %5s %9s %9s %s\n",
4815 "TID",
4816 "state",
4817 "req_cfmd",
4818 "req_dlgt",
4819 "res_rejects");
4820 for (i = 0; i < ARRAY_SIZE(peer->tid); i++)
4822 mtlk_aux_seq_printf(s, " %4d %5d %9u %9u %u\n",
4824 peer->tid[i].tx.state,
4825 peer->tid[i].tx.addba_req_cfmd_time,
4826 peer->tid[i].tx.addba_req_dlgt,
4827 peer->tid[i].tx.addba_res_rejects);
4830 mtlk_aux_seq_printf(s, " RX %4s %5s %10s %10s %s\n",
4831 "TID",
4832 "state",
4833 "del_tstamp",
4834 "req_tstamp",
4835 "add_res_result_code");
4836 for (i = 0; i < ARRAY_SIZE(peer->tid); i++)
4838 mtlk_aux_seq_printf(s, " %4d %5d %10u %10u %u\n",
4840 peer->tid[i].rx.state,
4841 peer->tid[i].rx.delba_timeout,
4842 peer->tid[i].rx.req_tstamp,
4843 MAC_TO_HOST16(peer->tid[i].rx.addba_res.u16ResultCode)
4848 mtlk_clpb_delete(clpb);
4850 err_ret:
4851 return _mtlk_df_mtlk_to_linux_error_code(res);
4854 static int mtlk_df_ui_aocs_history(mtlk_seq_entry_t *s, void *data)
4856 int res = MTLK_ERR_NOT_SUPPORTED;
4857 mtlk_clpb_t *clpb = NULL;
4858 mtlk_aocs_history_stat_entry_t *stat_entry;
4859 mtlk_df_t *df = mtlk_df_proc_seq_entry_get_df(s);
4861 res = _mtlk_df_user_invoke_core(df, MTLK_CORE_REQ_GET_AOCS_HISTORY,
4862 &clpb, NULL, 0);
4863 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_AOCS_HISTORY, FALSE);
4865 if (MTLK_ERR_OK != res) {
4866 goto err_ret;
4869 mtlk_aux_seq_printf(s,"Channel switch history:\n"
4870 "Time (ago) Ch (2nd)"
4871 " Switch reason Selection criteria\n");
4873 while(NULL != (stat_entry = mtlk_clpb_enum_get_next(clpb, NULL))) {
4874 mtlk_aux_seq_printf(s,"%04dh %02dm %02d.%03ds %3d (%3d) %17s %26s\n"
4875 , stat_entry->hour_ago
4876 , stat_entry->min_ago
4877 , stat_entry->sec_ago
4878 , stat_entry->msec_ago
4879 , stat_entry->primary_channel
4880 , stat_entry->secondary_channel
4881 , stat_entry->reason_text
4882 , stat_entry->criteria_text);
4885 mtlk_clpb_delete(clpb);
4886 err_ret:
4887 return _mtlk_df_mtlk_to_linux_error_code(res);
4890 static int mtlk_df_ui_aocs_table(mtlk_seq_entry_t *s, void *data)
4892 int res = MTLK_ERR_NOT_SUPPORTED;
4893 mtlk_clpb_t *clpb = NULL;
4894 mtlk_aocs_table_stat_entry_t *stat_entry;
4895 mtlk_df_t *df = mtlk_df_proc_seq_entry_get_df(s);
4897 res = _mtlk_df_user_invoke_core(df, MTLK_CORE_REQ_GET_AOCS_TBL, &clpb, NULL, 0);
4898 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_AOCS_TBL, FALSE);
4900 if (MTLK_ERR_OK != res) {
4901 goto err_ret;
4904 mtlk_aux_seq_printf(s,"AOCS table:\n"
4905 " Ch (2nd) SRnk CRnk BSSinR CL Tx SM Rad NOc"
4906 " ClrChk !use Excl Noisy Rdr TxPenalty Tx11d MaxNoise CurNoise BT_excl\n");
4908 while(NULL != (stat_entry = mtlk_clpb_enum_get_next(clpb, NULL))) {
4909 mtlk_aux_seq_printf(s,"%3d (%3d) %4d %4d %6d %3d %3d.%03d %2d %3d %3d %10u %4d %4d %5d %3d %3d.%03d %d.%03d %8d %8d %7d\n",
4910 stat_entry->channel_primary,
4911 stat_entry->channel_secondary,
4912 stat_entry->scan_rank,
4913 stat_entry->confirm_rank,
4914 stat_entry->nof_bss_in_range,
4915 stat_entry->channel_load,
4916 stat_entry->tx_power / 8,
4917 (stat_entry->tx_power % 8) * 125,
4918 stat_entry->sm,
4919 stat_entry->radar_detected,
4920 stat_entry->time_ms_non_occupied_period / 60000,
4921 stat_entry->time_ms_last_clear_check,
4922 stat_entry->dont_use,
4923 stat_entry->exclude,
4924 stat_entry->is_noisy,
4925 stat_entry->is_in_radar_timeout,
4926 stat_entry->tx_power_penalty / 8,
4927 (stat_entry->tx_power_penalty % 8) * 125,
4928 stat_entry->max_tx_power / 8,
4929 (stat_entry->max_tx_power % 8) * 125,
4930 stat_entry->floor_noise_metric,
4931 stat_entry->noise_current,
4932 stat_entry->bt_acs_excl_reason);
4935 mtlk_clpb_delete(clpb);
4936 err_ret:
4937 return _mtlk_df_mtlk_to_linux_error_code(res);
4940 static int mtlk_df_ui_aocs_channels(mtlk_seq_entry_t *s, void *data)
4942 int res = MTLK_ERR_NOT_SUPPORTED;
4943 mtlk_clpb_t *clpb = NULL;
4944 mtlk_aocs_channels_stat_t *stat;
4945 mtlk_df_t *df = mtlk_df_proc_seq_entry_get_df(s);
4947 res = _mtlk_df_user_invoke_core(df, MTLK_CORE_REQ_GET_AOCS_CHANNELS_TBL,
4948 &clpb, NULL, 0);
4949 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_AOCS_CHANNELS_TBL, FALSE);
4951 if (MTLK_ERR_OK != res) {
4952 goto err_ret;
4955 mtlk_aux_seq_printf(s,"AOCS channels:\n Ch SM CL n20 n40up n40lw Intol Affected DrIf FwIf Fl.noise\n");
4957 while(NULL != (stat = mtlk_clpb_enum_get_next(clpb, NULL))) {
4958 mtlk_aux_seq_printf(s," %3d %2d %3d %3d %5d %5d %5d %8d %4d %4d %8d\n",
4959 stat->channel,
4960 stat->sm_required,
4961 stat->channel_load,
4962 stat->num_20mhz_bss,
4963 stat->num_40mhz_up_bss,
4964 stat->num_40mhz_lw_bss,
4965 stat->forty_mhz_intolerant,
4966 stat->forty_mhz_int_affected,
4967 stat->DrIf,
4968 stat->FwIf,
4969 stat->fl_noise_metric);
4972 mtlk_clpb_delete(clpb);
4973 err_ret:
4974 return _mtlk_df_mtlk_to_linux_error_code(res);
4977 #ifdef BT_ACS_DEBUG
4978 static int mtlk_df_ui_aocs_channels_dbg(struct file *file, const char __user *buffer,
4979 unsigned long count, void *data)
4981 int res = MTLK_ERR_OK;
4982 mtlk_clpb_t *clpb = NULL;
4983 mtlk_df_t *df = (mtlk_df_t*) data;
4984 int num=0, bss20=0, bss40up=0, bss40lo=0, intol=0, noise=MIN_INT8;
4985 mtlk_aocs_channel_data_t entry;
4987 memset(&entry.stat, 0, sizeof(entry.stat));
4989 sscanf(buffer, "%d %d %d %d %d %d", &num, &bss20, &bss40up, &bss40lo, &intol, &noise);
4990 entry.stat.channel = num;
4992 if (num) {
4993 entry.stat.num_20mhz_bss = bss20;
4994 entry.stat.num_40mhz_up_bss = bss40up;
4995 entry.stat.num_40mhz_lw_bss = bss40lo;
4996 entry.stat.forty_mhz_intolerant = intol;
4997 entry.stat.fl_noise_metric = noise;
5000 ILOG1_DDDDDD("Adding AOCS Channels Entry {channel=%d, bss20=%d, bss40up=%d, bss40lo=%d, intol=%d, noise=%d}", num, bss20, bss40up, bss40lo, intol, noise);
5002 res = _mtlk_df_user_invoke_core(df, MTLK_CORE_REQ_SET_AOCS_CHANNELS_TBL_DBG, &clpb, &entry, sizeof(entry));
5003 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_SET_AOCS_CHANNELS_TBL_DBG, TRUE);
5005 return count;
5007 #endif /* BT_ACS_DEBUG */
5009 static int mtlk_df_ui_aocs_penalties(mtlk_seq_entry_t *s, void *data)
5011 int res = MTLK_ERR_NOT_SUPPORTED;
5012 mtlk_clpb_t *clpb = NULL;
5013 mtlk_aocs_penalties_stat_entry_t *stat_entry;
5014 mtlk_df_t *df = mtlk_df_proc_seq_entry_get_df(s);
5016 res = _mtlk_df_user_invoke_core(df, MTLK_CORE_REQ_GET_AOCS_PENALTIES,
5017 &clpb, NULL, 0);
5018 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_AOCS_PENALTIES, FALSE);
5020 if (MTLK_ERR_OK != res) {
5021 goto err_ret;
5024 mtlk_aux_seq_printf(s,"AOCS TxPowerPenalties:\nFreq Penalty\n");
5026 while(NULL != (stat_entry = mtlk_clpb_enum_get_next(clpb, NULL))) {
5027 mtlk_aux_seq_printf(s,"%4d %d.%03d\n",
5028 stat_entry->freq,
5029 stat_entry->penalty / 8,
5030 (stat_entry->penalty % 8) * 125);
5033 mtlk_clpb_delete(clpb);
5034 err_ret:
5035 return _mtlk_df_mtlk_to_linux_error_code(res);
5038 static int mtlk_df_ui_hw_limits(mtlk_seq_entry_t *s, void *data)
5040 int res = MTLK_ERR_OK;
5041 mtlk_clpb_t *clpb = NULL;
5042 mtlk_hw_limits_stat_entry_t *stat_entry;
5043 mtlk_df_t *df = mtlk_df_proc_seq_entry_get_df(s);
5045 res = _mtlk_df_user_invoke_core(df, MTLK_CORE_REQ_GET_HW_LIMITS, &clpb, NULL, 0);
5046 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_HW_LIMITS, FALSE);
5048 if (MTLK_ERR_OK != res) {
5049 goto err_ret;
5052 mtlk_aux_seq_printf(s,"HW specific limits:\nFreq Spectrum Limit Domain\n");
5054 while(NULL != (stat_entry = mtlk_clpb_enum_get_next(clpb, NULL))) {
5055 mtlk_aux_seq_printf(s,"%4d %8d %5d 0x%x\n",
5056 stat_entry->freq,
5057 stat_entry->spectrum,
5058 stat_entry->tx_lim,
5059 stat_entry->reg_domain);
5062 mtlk_clpb_delete(clpb);
5063 err_ret:
5064 return _mtlk_df_mtlk_to_linux_error_code(res);
5067 static int mtlk_df_ui_reg_limits(mtlk_seq_entry_t *s, void *data)
5069 int res = MTLK_ERR_OK;
5070 mtlk_clpb_t *clpb = NULL;
5071 mtlk_reg_limits_stat_entry_t *stat_entry;
5072 mtlk_df_t *df = mtlk_df_proc_seq_entry_get_df(s);
5074 res = _mtlk_df_user_invoke_core(df, MTLK_CORE_REQ_GET_REG_LIMITS, &clpb, NULL, 0);
5075 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_REG_LIMITS, FALSE);
5077 if (MTLK_ERR_OK != res) {
5078 goto err_ret;
5081 mtlk_aux_seq_printf(s,"Regulatory domain limits:\n");
5083 while(NULL != (stat_entry = mtlk_clpb_enum_get_next(clpb, NULL))) {
5084 mtlk_aux_seq_printf(s,"domain: 0x%x, class: %d, spacing: %d, channel: %d,%d,%d\n",
5085 stat_entry->reg_domain,
5086 stat_entry->reg_class,
5087 stat_entry->spectrum,
5088 stat_entry->channel,
5089 stat_entry->tx_lim,
5090 stat_entry->mitigation);
5093 mtlk_clpb_delete(clpb);
5094 err_ret:
5095 return _mtlk_df_mtlk_to_linux_error_code(res);
5098 static int mtlk_df_ui_ant_gain(mtlk_seq_entry_t *s, void *data)
5100 int res = MTLK_ERR_OK;
5101 mtlk_clpb_t *clpb = NULL;
5102 mtlk_ant_gain_stat_entry_t *stat_entry;
5103 mtlk_df_t *df = mtlk_df_proc_seq_entry_get_df(s);
5105 res = _mtlk_df_user_invoke_core(df, MTLK_CORE_REQ_GET_ANTENNA_GAIN, &clpb, NULL, 0);
5106 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_ANTENNA_GAIN, FALSE);
5108 if (MTLK_ERR_OK != res) {
5109 goto err_ret;
5112 mtlk_aux_seq_printf(s,"Antenna gain table:\nFreq Gain\n");
5114 while(NULL != (stat_entry = mtlk_clpb_enum_get_next(clpb, NULL))) {
5115 mtlk_aux_seq_printf(s,"%4d %4d\n",
5116 stat_entry->freq,
5117 stat_entry->gain);
5120 mtlk_clpb_delete(clpb);
5121 err_ret:
5122 return _mtlk_df_mtlk_to_linux_error_code(res);
5125 static int mtlk_df_ui_serializer_dump(mtlk_seq_entry_t *s, void *data)
5127 int res = MTLK_ERR_OK;
5128 mtlk_clpb_t *clpb = NULL;
5129 mtlk_serializer_command_info_t *cmd_info;
5130 mtlk_df_t *df = mtlk_df_proc_seq_entry_get_df(s);
5132 res = _mtlk_df_user_invoke_core(df, MTLK_CORE_REQ_GET_SERIALIZER_INFO, &clpb, NULL, 0);
5133 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_SERIALIZER_INFO, FALSE);
5135 if (MTLK_ERR_OK != res) {
5136 goto err_ret;
5139 mtlk_aux_seq_printf(s,"Serialized Commands:\nCurr Prio GID FID LID\n");
5141 while(NULL != (cmd_info = mtlk_clpb_enum_get_next(clpb, NULL))) {
5142 mtlk_aux_seq_printf(s,"%4u %4u %3u %3u %3u\n",
5143 cmd_info->is_current,
5144 cmd_info->priority,
5145 mtlk_slid_get_gid(cmd_info->issuer_slid),
5146 mtlk_slid_get_fid(cmd_info->issuer_slid),
5147 mtlk_slid_get_lid(cmd_info->issuer_slid));
5150 mtlk_clpb_delete(clpb);
5151 err_ret:
5152 return _mtlk_df_mtlk_to_linux_error_code(res);
5155 static void
5156 _mtlk_df_ui_print_driver_stats(mtlk_seq_entry_t *s, mtlk_core_general_stats_t *general_stats)
5158 struct priv_stats *pstats;
5159 mtlk_mac_stats_t *mac_stat;
5161 char buf[MAX_DF_UI_STAT_NAME_LENGTH];
5162 uint32 i;
5163 const char *uint_fmt = "%10u %s\n";
5165 mac_stat = &general_stats->mac_stat;
5167 pstats = &general_stats->core_priv_stats;
5169 mtlk_aux_seq_printf(s, uint_fmt, general_stats->rx_dat_frames, "data frames received");
5170 mtlk_aux_seq_printf(s, uint_fmt, general_stats->rx_ctl_frames, "control frames received");
5171 mtlk_aux_seq_printf(s, uint_fmt, general_stats->rx_man_frames, "management frames received");
5172 mtlk_aux_seq_printf(s, uint_fmt, mac_stat->stat[STAT_TX_FAIL], "TX packets dropped");
5173 mtlk_aux_seq_printf(s, uint_fmt, pstats->tx_max_cons_drop, "TX maximum consecutive dropped packets");
5175 for (i = 0; i < NTS_PRIORITIES; i++) {
5176 sprintf(buf, "MSDUs received, QoS priority %d", i);
5177 mtlk_aux_seq_printf(s, uint_fmt, pstats->ac_rx_counter[i], buf);
5180 for (i = 0; i < NTS_PRIORITIES; i++) {
5181 sprintf(buf, "MSDUs transmitted, QoS priority %d", i);
5182 mtlk_aux_seq_printf(s, uint_fmt, pstats->ac_tx_counter[i], buf);
5185 for (i = 0; i < NTS_PRIORITIES; i++) {
5186 sprintf(buf, "MSDUs dropped, QoS priority %d", i);
5187 mtlk_aux_seq_printf(s, uint_fmt, pstats->ac_dropped_counter[i], buf);
5190 for (i = 0; i < NTS_PRIORITIES; i++) {
5191 sprintf(buf, "MSDUs used, QoS priority %d", i);
5192 mtlk_aux_seq_printf(s, uint_fmt, pstats->ac_used_counter[i], buf);
5195 mtlk_aux_seq_printf(s, uint_fmt, general_stats->tx_msdus_free, "TX MSDUs free");
5196 mtlk_aux_seq_printf(s, uint_fmt, general_stats->tx_msdus_usage_peak, "TX MSDUs usage peak");
5198 mtlk_aux_seq_printf(s, uint_fmt, general_stats->fwd_rx_packets, "packets received that should be forwarded to one or more STAs");
5199 mtlk_aux_seq_printf(s, uint_fmt, general_stats->fwd_rx_bytes, "bytes received that should be forwarded to one or more STAs");
5200 mtlk_aux_seq_printf(s, uint_fmt, pstats->fwd_tx_packets, "packets transmitted for forwarded data");
5201 mtlk_aux_seq_printf(s, uint_fmt, pstats->fwd_tx_bytes, "bytes transmitted for forwarded data");
5202 mtlk_aux_seq_printf(s, uint_fmt, pstats->fwd_dropped, "forwarding (transmission) failures");
5203 mtlk_aux_seq_printf(s, uint_fmt, pstats->rmcast_dropped, "reliable multicast (transmission) failures");
5204 mtlk_aux_seq_printf(s, uint_fmt, general_stats->unicast_replayed_packets + general_stats->multicast_replayed_packets, "packets replayed");
5205 mtlk_aux_seq_printf(s, uint_fmt, pstats->bars_cnt, "BAR frames received");
5207 mtlk_aux_seq_printf(s, uint_fmt, general_stats->bist_check_passed, "BIST check passed");
5209 mtlk_aux_seq_printf(s, uint_fmt, general_stats->txmm_sent, "MAN Messages sent");
5210 mtlk_aux_seq_printf(s, uint_fmt, general_stats->txmm_cfmd, "MAN Messages confirmed");
5211 mtlk_aux_seq_printf(s, uint_fmt, general_stats->txmm_peak, "MAN Messages in peak");
5212 mtlk_aux_seq_printf(s, uint_fmt, general_stats->txdm_sent, "DBG Messages sent");
5213 mtlk_aux_seq_printf(s, uint_fmt, general_stats->txdm_cfmd, "DBG Messages confirmed");
5214 mtlk_aux_seq_printf(s, uint_fmt, general_stats->txdm_peak, "DBG Messages in peak");
5215 mtlk_aux_seq_printf(s, uint_fmt, general_stats->fw_logger_packets_processed, "FW logger packets processed");
5216 mtlk_aux_seq_printf(s, uint_fmt, general_stats->fw_logger_packets_dropped, "FW logger packets dropped");
5219 static int mtlk_df_ui_debug_general(mtlk_seq_entry_t *s, void *data)
5221 int res = MTLK_ERR_NOT_SUPPORTED;
5222 mtlk_clpb_t *clpb = NULL;
5223 mtlk_stadb_stat_t *stadb_stat;
5224 uint32 size;
5225 unsigned long total_rx_packets;
5226 unsigned long total_tx_packets;
5227 unsigned long total_rx_dropped;
5228 mtlk_df_t *df = mtlk_df_proc_seq_entry_get_df(s);
5229 mtlk_df_user_t *df_user = mtlk_df_get_user(df);
5230 mtlk_core_ui_get_stadb_status_req_t get_stadb_status_req;
5232 /* Get Core general information from DF buffer and don't call Core */
5234 get_stadb_status_req.get_hostdb = TRUE;
5235 get_stadb_status_req.use_cipher = FALSE;
5236 res = _mtlk_df_user_invoke_core(df, MTLK_CORE_REQ_GET_STADB_STATUS, &clpb,
5237 &get_stadb_status_req, sizeof(get_stadb_status_req));
5238 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_STADB_STATUS, FALSE);
5239 if (MTLK_ERR_OK != res) {
5240 goto err_ret;
5243 mtlk_aux_seq_printf(s, "\n"
5244 "Driver Statistics\n"
5245 "\n"
5246 "------------------+------------------+--------------------------------------\n"
5247 "MAC | Packets received | Packets sent | Rx packets dropped\n"
5248 "------------------+------------------+--------------------------------------\n");
5250 total_rx_packets = 0;
5251 total_tx_packets = 0;
5252 total_rx_dropped = 0;
5254 /* enumerate sta entries */
5255 while(NULL != (stadb_stat = mtlk_clpb_enum_get_next(clpb, &size))) {
5256 if (sizeof(*stadb_stat) != size) {
5257 res = MTLK_ERR_UNKNOWN;
5258 goto delete_clpb;
5261 if (STAT_ID_STADB == stadb_stat->type) {
5263 total_rx_packets += stadb_stat->u.general_stat.sta_rx_packets;
5264 total_tx_packets += stadb_stat->u.general_stat.sta_tx_packets;
5265 total_rx_dropped += stadb_stat->u.general_stat.sta_rx_dropped;
5267 mtlk_aux_seq_printf(s, MAC_PRINTF_FMT " | %-16u | %-16u | %-16u\n",
5268 MAC_PRINTF_ARG(stadb_stat->u.general_stat.addr.au8Addr),
5269 stadb_stat->u.general_stat.sta_rx_packets,
5270 stadb_stat->u.general_stat.sta_tx_packets,
5271 stadb_stat->u.general_stat.sta_rx_dropped);
5273 else if (STAT_ID_HSTDB == stadb_stat->type) {
5274 if (mtlk_df_is_ap(df)) {
5275 mtlk_aux_seq_printf(s, " STA's WDS hosts:\n");
5277 else {
5278 mtlk_aux_seq_printf(s, " All WDS hosts connected to this STA\n");
5281 mtlk_aux_seq_printf(s, MAC_PRINTF_FMT "\n", MAC_PRINTF_ARG(stadb_stat->u.hstdb_stat.addr.au8Addr));
5282 } else {
5283 res = MTLK_ERR_UNKNOWN;
5284 goto delete_clpb;
5288 mtlk_aux_seq_printf(s,
5289 "------------------+------------------+--------------------------------------\n"
5290 "Total | %-16lu | %-16lu | %lu\n"
5291 "------------------+------------------+--------------------------------------\n"
5292 "Broadcast/non-reliable multicast | %-16lu |\n"
5293 "------------------+------------------+--------------------------------------\n"
5294 "\n",
5295 total_rx_packets, total_tx_packets, total_rx_dropped,
5296 (unsigned long)df_user->slow_ctx->core_general_stats.core_priv_stats.tx_bcast_nrmcast);
5298 _mtlk_df_ui_print_driver_stats(s, &df_user->slow_ctx->core_general_stats);
5300 delete_clpb:
5301 mtlk_clpb_delete(clpb);
5302 err_ret:
5303 return _mtlk_df_mtlk_to_linux_error_code(res);
5306 static int mtlk_df_ui_debug_mac_stats(mtlk_seq_entry_t *s, void *data)
5308 int idx;
5309 int res = MTLK_ERR_OK;
5310 mtlk_df_t *df = mtlk_df_proc_seq_entry_get_df(s);
5311 mtlk_df_user_t *df_user = mtlk_df_get_user(df);
5313 mtlk_aux_seq_printf(s, "\nMAC Statistics\n\n");
5315 for (idx = 0; idx < mtlk_df_get_stat_info_len(); idx++) {
5316 mtlk_aux_seq_printf(s, "%10u %s\n",
5317 df_user->slow_ctx->core_general_stats.mac_stat.stat[mtlk_df_get_stat_info_idx(idx)],
5318 mtlk_df_get_stat_info_name(idx));
5321 return _mtlk_df_mtlk_to_linux_error_code(res);
5324 static int mtlk_df_ui_reordering_stats(mtlk_seq_entry_t *s, void *data)
5326 int res = MTLK_ERR_NOT_SUPPORTED;
5327 mtlk_clpb_t *clpb = NULL;
5328 uint32 size;
5329 mtlk_stadb_stat_t *stadb_stat;
5330 uint8 tid;
5331 mtlk_df_t *df = mtlk_df_proc_seq_entry_get_df(s);
5332 mtlk_core_ui_get_stadb_status_req_t get_stadb_status_req;
5334 get_stadb_status_req.get_hostdb = FALSE;
5335 get_stadb_status_req.use_cipher = FALSE;
5336 res = _mtlk_df_user_invoke_core(df, MTLK_CORE_REQ_GET_STADB_STATUS, &clpb,
5337 &get_stadb_status_req, sizeof(get_stadb_status_req));
5338 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_STADB_STATUS, FALSE);
5339 if (MTLK_ERR_OK != res) {
5340 goto err_ret;
5343 mtlk_aux_seq_printf(s, "\n"
5344 "\n"
5345 "Reordering Statistics\n"
5346 "\n"
5347 "------------------+----+------------+------------+------------+------------+------------\n"
5348 "MAC | ID | Too old | Duplicate | Queued | Overflows | Lost \n"
5349 "------------------+----+------------+------------+------------+------------+------------\n");
5351 while(NULL != (stadb_stat = mtlk_clpb_enum_get_next(clpb, &size))) {
5352 if ((sizeof(*stadb_stat) != size) || (STAT_ID_STADB != stadb_stat->type)) {
5353 res = MTLK_ERR_UNKNOWN;
5354 goto delete_clpb;
5357 for (tid = 0; tid < ARRAY_SIZE(stadb_stat->u.general_stat.reordering_stats); tid++ )
5359 if (stadb_stat->u.general_stat.reordering_stats[tid].used) {
5360 mtlk_aux_seq_printf(s, MAC_PRINTF_FMT " | %-2d | %-10u | %-10u | %-10u | %-10u | %-10u\n",
5361 MAC_PRINTF_ARG(stadb_stat->u.general_stat.addr.au8Addr),
5362 tid,
5363 stadb_stat->u.general_stat.reordering_stats[tid].reord_stat.too_old,
5364 stadb_stat->u.general_stat.reordering_stats[tid].reord_stat.duplicate,
5365 stadb_stat->u.general_stat.reordering_stats[tid].reord_stat.queued,
5366 stadb_stat->u.general_stat.reordering_stats[tid].reord_stat.overflows,
5367 stadb_stat->u.general_stat.reordering_stats[tid].reord_stat.lost);
5368 } else {
5369 mtlk_aux_seq_printf(s, MAC_PRINTF_FMT " | %-2d | Not Used\n",
5370 MAC_PRINTF_ARG(stadb_stat->u.general_stat.addr.au8Addr),
5371 tid);
5376 mtlk_aux_seq_printf(s,
5377 "------------------+----+------------+------------+------------+------------+------------\n");
5379 delete_clpb:
5380 mtlk_clpb_delete(clpb);
5381 err_ret:
5382 return _mtlk_df_mtlk_to_linux_error_code(res);
5385 static int mtlk_df_ui_debug_l2nat(mtlk_seq_entry_t *s, void *data)
5387 int res = MTLK_ERR_NOT_SUPPORTED;
5388 mtlk_clpb_t *clpb = NULL;
5389 mtlk_df_t *df = mtlk_df_proc_seq_entry_get_df(s);
5390 struct l2nat_hash_entry_stats *hash_entry_stats;
5391 struct l2nat_buckets_stats *buckets_stats;
5392 int idx;
5394 res = _mtlk_df_user_invoke_core(df, MTLK_CORE_REQ_GET_L2NAT_STATS, &clpb, NULL, 0);
5395 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_L2NAT_STATS, FALSE);
5397 if (MTLK_ERR_OK != res) {
5398 goto err_ret;
5401 buckets_stats = mtlk_clpb_enum_get_next(clpb, NULL);
5402 if (NULL == buckets_stats) {
5403 res = MTLK_ERR_UNKNOWN;
5404 goto err_get_stat;
5407 mtlk_aux_seq_printf(s, "\nL2NAT Statistics\n\n"
5408 "IP MAC Inactive (ms) Age(secs) Pkts from\n"
5409 "----------------------------------------------------------------------------\n");
5411 while(NULL != (hash_entry_stats = mtlk_clpb_enum_get_next(clpb, NULL))) {
5412 mtlk_aux_seq_printf(s, MTLK_NIPQUAD_FMT "\t" MAC_PRINTF_FMT "%15lu %15lu %10u\n",
5413 MTLK_NIPQUAD(hash_entry_stats->ip),
5414 MAC_PRINTF_ARG(hash_entry_stats->mac),
5415 hash_entry_stats->last_pkt_timestamp,
5416 hash_entry_stats->first_pkt_timestamp,
5417 hash_entry_stats->pkts_from);
5420 mtlk_aux_seq_printf(s,
5421 "----------------------------------------------------------------------------\n");
5423 mtlk_aux_seq_printf(s, "\n\nHash table statistics\n\n"
5424 "Bucket length :");
5426 for (idx = 0; idx < ARRAY_SIZE(buckets_stats->blens) - 1; idx++) {
5427 mtlk_aux_seq_printf(s, " %3d", idx);
5430 mtlk_aux_seq_printf(s, " >%2d\n", (int)(ARRAY_SIZE(buckets_stats->blens) - 2));
5431 mtlk_aux_seq_printf(s, "Number of buckets :");
5433 for (idx = 0; idx < ARRAY_SIZE(buckets_stats->blens) ; idx++) {
5434 mtlk_aux_seq_printf(s, " %3d", buckets_stats->blens[idx]);
5437 mtlk_aux_seq_printf(s, "\n\n");
5439 err_get_stat:
5440 mtlk_clpb_delete(clpb);
5441 err_ret:
5442 return _mtlk_df_mtlk_to_linux_error_code(res);
5445 static int mtlk_df_ui_debug_send_queue(mtlk_seq_entry_t *s, void *data)
5447 int res = MTLK_ERR_NOT_SUPPORTED;
5448 mtlk_clpb_t *clpb = NULL;
5449 mtlk_df_t *df = mtlk_df_proc_seq_entry_get_df(s);
5450 mtlk_sq_status_t *status;
5451 mtlk_sq_peer_status_t *peer_status;
5452 int idx;
5454 res = _mtlk_df_user_invoke_core(df, MTLK_CORE_REQ_GET_SQ_STATUS, &clpb, NULL, 0);
5455 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_SQ_STATUS, FALSE);
5457 if (MTLK_ERR_OK != res) {
5458 goto err_ret;
5461 status = mtlk_clpb_enum_get_next(clpb, NULL);
5462 if (NULL == status) {
5463 res = MTLK_ERR_UNKNOWN;
5464 goto err_get_stat;
5467 /* iterate with format string */
5468 #define ITF(head_str, ...) \
5469 mtlk_aux_seq_printf(s, head_str); \
5470 for (idx = 0; idx < NTS_PRIORITIES; idx++) \
5471 mtlk_aux_seq_printf(s, __VA_ARGS__ ); \
5472 mtlk_aux_seq_printf(s,"\n");
5474 ITF("--------------------------", "%s", "-------------");
5475 ITF("Name |", "%11s |", mtlk_qos_get_ac_name(idx));
5476 ITF("--------------------------", "%s", "-------------");
5478 ITF("packets pushed |", "%11d |", status->stats.pkts_pushed[idx]);
5479 ITF("packets sent to UM |", "%11d |", status->stats.pkts_sent_to_um[idx]);
5480 ITF("global queue limits |", "%11d |", status->limits.global_queue_limit[idx]);
5481 ITF("peer queue limits |", "%11d |", status->limits.peer_queue_limit[idx]);
5482 ITF("current sizes |", "%11d |", status->qsizes.qsize[idx]);
5483 ITF("packets dropped (limit) |", "%11d |", status->stats.pkts_limit_dropped[idx]);
5485 ITF("--------------------------", "%s", "-------------");
5487 while(NULL != (peer_status = mtlk_clpb_enum_get_next(clpb, NULL))) {
5488 BOOL uapsd_any = FALSE;
5490 /* Check if we have UAPSD enabled for any of the categories */
5491 for (idx = 0; idx < NTS_PRIORITIES; idx++) {
5492 if (peer_status->uapsd_enabled[idx]) {
5493 uapsd_any = TRUE;
5494 break;
5498 if (NULL == peer_status->vap_handle) { /* STA */
5499 mtlk_aux_seq_printf(s, "\nSTA MAC:" MAC_PRINTF_FMT, MAC_PRINTF_ARG(peer_status->mac_addr.au8Addr));
5500 } else { /* VAP */
5501 mtlk_aux_seq_printf(s, "\nVAP ID: %u", mtlk_vap_get_id(peer_status->vap_handle));
5503 if (!peer_status->ps_mode_enabled || !uapsd_any) {
5504 mtlk_aux_seq_printf(s, "\nLimit: %10u\nUsed: %11u\n", peer_status->limit, peer_status->used);
5505 } else {
5506 const char *acs[] = {"BE","BK","VI","VO"};
5507 uint32 used;
5508 BOOL first;
5510 mtlk_aux_seq_printf(s, "\nLimits: Legacy(");
5511 for (first = TRUE, idx = 0; idx < NTS_PRIORITIES; idx++) {
5512 if (!peer_status->uapsd_enabled[idx]) {
5513 if (first) {
5514 first = FALSE;
5515 } else {
5516 mtlk_aux_seq_printf(s, ",");
5518 mtlk_aux_seq_printf(s, "%s", acs[idx]);
5521 mtlk_aux_seq_printf(s, "):%02u", peer_status->limit);
5523 mtlk_aux_seq_printf(s, " U-APSD(");
5524 for (first = TRUE, idx = 0; idx < NTS_PRIORITIES; idx++) {
5525 if (peer_status->uapsd_enabled[idx]) {
5526 if (first) {
5527 first = FALSE;
5528 } else {
5529 mtlk_aux_seq_printf(s, ",");
5531 mtlk_aux_seq_printf(s, "%s", acs[idx]);
5534 if (first) {
5535 mtlk_aux_seq_printf(s, ")");
5536 } else {
5537 mtlk_aux_seq_printf(s, "):%02u", peer_status->limit_uapsd);
5539 mtlk_aux_seq_printf(s, "\nUsed: Legacy(");
5540 for (first = TRUE, used = 0, idx = 0; idx < NTS_PRIORITIES; idx++) {
5541 if (!peer_status->uapsd_enabled[idx]) {
5542 if (first) {
5543 first = FALSE;
5544 } else {
5545 mtlk_aux_seq_printf(s, ",");
5547 mtlk_aux_seq_printf(s, "%s", acs[idx]);
5548 used += peer_status->used_per_ac[idx];
5551 mtlk_aux_seq_printf(s, "):%02u", used);
5553 mtlk_aux_seq_printf(s, " U-APSD(");
5554 for (first = TRUE, idx = 0; idx < NTS_PRIORITIES; idx++) {
5555 if (peer_status->uapsd_enabled[idx]) {
5556 if (first) {
5557 first = FALSE;
5558 } else {
5559 mtlk_aux_seq_printf(s, ",");
5561 mtlk_aux_seq_printf(s, "%s:%02u", acs[idx], peer_status->used_per_ac[idx]);
5564 mtlk_aux_seq_printf(s, ")");
5565 mtlk_aux_seq_printf(s, "\n");
5568 ITF(" --------------------------", "%s", "-------------");
5569 ITF(" Name |", " %s |", mtlk_qos_get_ac_name(idx));
5570 ITF(" --------------------------", "%s", "-------------");
5571 ITF(" packets pushed |", "%11d |", peer_status->stats.pkts_pushed[idx]);
5572 ITF(" packets sent to UM |", "%11d |", peer_status->stats.pkts_sent_to_um[idx]);
5573 ITF(" current sizes |", "%11d |", peer_status->current_size[idx]);
5574 ITF(" packets dropped (limit) |", "%11d |", peer_status->stats.pkts_limit_dropped[idx]);
5575 ITF(" --------------------------", "%s", "-------------");
5578 err_get_stat:
5579 mtlk_clpb_delete(clpb);
5580 err_ret:
5581 return _mtlk_df_mtlk_to_linux_error_code(res);
5584 static int mtlk_df_ui_debug_power_save(mtlk_seq_entry_t *s, void *data)
5586 int res = MTLK_ERR_NOT_SUPPORTED;
5587 mtlk_clpb_t *clpb = NULL;
5588 mtlk_df_t *df = mtlk_df_proc_seq_entry_get_df(s);
5589 mtlk_ps_status_t *status;
5590 mtlk_ps_peer_status_t *peer_status;
5591 int idx;
5592 uint32 num_of_elements;
5593 int elem;
5595 res = _mtlk_df_user_invoke_core(df, MTLK_CORE_REQ_GET_PS_STATUS, &clpb, NULL, 0);
5596 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_PS_STATUS, FALSE);
5598 if (MTLK_ERR_OK != res) {
5599 goto err_ret;
5602 /* iterate with format string */
5603 #define ITF(head_str, ...) \
5604 mtlk_aux_seq_printf(s, head_str); \
5605 for (idx = 0; idx < NTS_PRIORITIES; idx++) \
5606 mtlk_aux_seq_printf(s, __VA_ARGS__ ); \
5607 mtlk_aux_seq_printf(s,"\n");
5609 mtlk_aux_seq_printf(s,"\n");
5611 ITF(" --------------------------", "%s", "-------------");
5612 ITF(" Station |", " %s |", mtlk_qos_get_ac_name(idx));
5613 ITF(" --------------------------", "%s", "-------------");
5615 num_of_elements = mtlk_clpb_get_num_of_elements(clpb);
5617 for (elem = 0; elem < num_of_elements-1; ++elem) {
5619 peer_status = mtlk_clpb_enum_get_next(clpb, NULL);
5620 if (NULL == peer_status) {
5621 res = MTLK_ERR_UNKNOWN;
5622 goto err_get_stat;
5625 mtlk_aux_seq_printf(s, " " MAC_PRINTF_FMT, MAC_PRINTF_ARG(peer_status->mac_addr.au8Addr));
5626 if (peer_status->ps_mode_enabled) {
5627 mtlk_aux_seq_printf(s, " (PS) |");
5628 } else {
5629 mtlk_aux_seq_printf(s, " |");
5631 for (idx = 0; idx < NTS_PRIORITIES; idx++) {
5632 mtlk_aux_seq_printf(s, " %02d:%c:%02d |", peer_status->used_per_ac[idx],
5633 peer_status->uapsd_enabled[idx]?'U':'L', peer_status->limit_per_ac[idx]);
5635 mtlk_aux_seq_printf(s,"\n");
5638 ITF(" --------------------------", "%s", "-------------");
5639 mtlk_aux_seq_printf(s, " Notes: <used>:<[U]-APSD|[L]egacy>:<limit>\n");
5642 status = mtlk_clpb_enum_get_next(clpb, NULL);
5643 if (NULL == status) {
5644 res = MTLK_ERR_UNKNOWN;
5645 goto err_get_stat;
5648 mtlk_aux_seq_printf(s, "\nU-APSD enabled station(s): %2u", status->uapsd_enabled_stas);
5649 mtlk_aux_seq_printf(s, "\nDelivery enabled AC(s): %2u\n", status->delivery_enabled_acs);
5651 err_get_stat:
5652 mtlk_clpb_delete(clpb);
5653 err_ret:
5654 return _mtlk_df_mtlk_to_linux_error_code(res);
5657 static int
5658 mtlk_df_do_debug_assert_write (struct file *file, const char *buf,
5659 unsigned long count, void *data)
5661 int res = MTLK_ERR_PARAMS;
5662 char str[MAX_PROC_STR_LEN];
5663 mtlk_df_t *df = (mtlk_df_t *)data;
5664 mtlk_clpb_t *clpb = NULL;
5665 int arg_num;
5666 int arg_assert_type;
5668 if (count > MAX_PROC_STR_LEN) {
5669 goto end;
5672 memset(str, 0, sizeof(str));
5673 if (copy_from_user(str, buf, count)) {
5674 ELOG0_D("CID-%04x: copy_from_user error", mtlk_vap_get_oid(mtlk_df_get_vap_handle(df)));
5675 goto end;
5678 arg_num = sscanf(str, "%d", &arg_assert_type);
5679 if (arg_num < 1) {
5680 goto end;
5683 if (arg_num >= 1) {
5684 if (arg_assert_type < 0 || arg_assert_type >= MTLK_CORE_UI_ASSERT_TYPE_LAST) {
5685 ELOG_DD("CID-%04x: Unsupported assert type: %d", mtlk_vap_get_oid(mtlk_df_get_vap_handle(df)), arg_assert_type);
5686 goto end;
5690 switch (arg_assert_type)
5692 case MTLK_CORE_UI_ASSERT_TYPE_FW_LMIPS:
5693 /* Check whether the LMIPS has already been asserted. If so - doesn't call the Core */
5694 res = mtlk_osal_event_wait(&mtlk_df_get_user(df)->fw_hang_evts[LMIPS], 0);
5695 if (res == MTLK_ERR_OK) {
5696 ILOG0_D("CID-%04x: LMIPS already asserted", mtlk_vap_get_oid(mtlk_df_get_vap_handle(df)));
5697 goto end;
5699 break;
5700 case MTLK_CORE_UI_ASSERT_TYPE_FW_UMIPS:
5701 /* Check whether the UMIPS has already been asserted. If so - doesn't call the Core */
5702 res = mtlk_osal_event_wait(&mtlk_df_get_user(df)->fw_hang_evts[UMIPS], 0);
5703 if (res == MTLK_ERR_OK) {
5704 ILOG0_D("CID-%04x: UMIPS already asserted", mtlk_vap_get_oid(mtlk_df_get_vap_handle(df)));
5705 goto end;
5707 default:
5708 break;
5711 res = _mtlk_df_user_invoke_core(df, MTLK_CORE_REQ_SET_MAC_ASSERT, &clpb,
5712 &arg_assert_type, sizeof(arg_assert_type));
5713 _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_SET_MAC_ASSERT, TRUE);
5715 if (res == MTLK_ERR_NOT_READY) {
5716 ILOG0_D("CID-%04x: Already asserted", mtlk_vap_get_oid(mtlk_df_get_vap_handle(df)));
5717 goto end;
5720 switch (arg_assert_type)
5722 case MTLK_CORE_UI_ASSERT_TYPE_FW_LMIPS:
5723 /* Wait for LMIPS to detect ASSERTION */
5724 res = mtlk_osal_event_wait(&mtlk_df_get_user(df)->fw_hang_evts[LMIPS], _DF_WAIT_FW_ASSERT);
5725 if (res != MTLK_ERR_OK) {
5726 WLOG_DD("CID-%04x: LMIPS assertion failed (res=%d)", mtlk_vap_get_oid(mtlk_df_get_vap_handle(df)), res);
5728 else {
5729 ILOG0_D("CID-%04x: LMIPS asserted", mtlk_vap_get_oid(mtlk_df_get_vap_handle(df)));
5731 break;
5732 case MTLK_CORE_UI_ASSERT_TYPE_FW_UMIPS:
5733 /* Wait for UMIPS to detect ASSERTION */
5734 res = mtlk_osal_event_wait(&mtlk_df_get_user(df)->fw_hang_evts[UMIPS], _DF_WAIT_FW_ASSERT);
5735 if (res != MTLK_ERR_OK) {
5736 WLOG_DD("CID-%04x: UMIPS assertion failed (res=%d)", mtlk_vap_get_oid(mtlk_df_get_vap_handle(df)), res);
5738 else {
5739 ILOG0_D("CID-%04x: UMIPS asserted", mtlk_vap_get_oid(mtlk_df_get_vap_handle(df)));
5741 case MTLK_CORE_UI_ASSERT_TYPE_LAST:
5742 default:
5743 break;
5746 end:
5747 /* need to return counter, not result in this type of proc */
5748 return count;
5751 static int
5752 _mtlk_df_ui_proc_bcl_read (char *page, char **start, off_t off, int count, int *eof,
5753 void *data, int io_base, int io_size)
5755 int res = MTLK_ERR_NOT_SUPPORTED;
5756 mtlk_df_t *df = (mtlk_df_t *)data;
5757 mtlk_clpb_t *clpb = NULL;
5758 UMI_BCL_REQUEST req;
5759 UMI_BCL_REQUEST *req_result;
5761 /* Calculate io offset */
5762 if (off >= io_size) {
5763 *eof = 1;
5764 return 0;
5767 if ((off & (sizeof(req.Data) - 1)) || (count < sizeof(req.Data)))
5768 return -EIO;
5770 count = 0;
5772 /* Fill get BCL request */
5773 /* We mast inform core in some way that it should not convert result data words in host format
5774 * when BCL read operation has been requested from Proc (memory dump). So, add BCL_UNIT_MAX to
5775 * Unit field and check&subtract it in core */
5776 req.Unit = BCL_UNIT_INT_RAM + BCL_UNIT_MAX;
5777 req.Size = sizeof(req.Data);
5778 req.Address = io_base + off;
5779 memset(req.Data, 0x5c, sizeof(req.Data)); /* poison */
5781 /* Send request to core */
5782 res = _mtlk_df_user_invoke_core(df, MTLK_CORE_REQ_GET_BCL_MAC_DATA, &clpb, &req, sizeof(req));
5783 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_BCL_MAC_DATA, FALSE);
5784 if (MTLK_ERR_OK != res) {
5785 goto err_ret;
5788 /* Handle result */
5789 req_result = mtlk_clpb_enum_get_next(clpb, NULL);
5791 if (NULL != req_result) {
5792 count = sizeof(req_result->Data);
5793 memcpy(page, req_result->Data, count);
5794 *start = (char*)sizeof(req_result->Data);
5797 mtlk_clpb_delete(clpb);
5798 err_ret:
5799 return count;
5802 #ifdef MTCFG_BUS_PCI_PCIE
5803 static int mtlk_df_ui_lm(char *page, char **start, off_t off,
5804 int count, int *eof, void *data)
5806 return _mtlk_df_ui_proc_bcl_read(page, start, off, count, eof, data, LM_DATA_BASE, LM_DATA_SIZE);
5809 static int mtlk_df_ui_um(char *page, char **start, off_t off,
5810 int count, int *eof, void *data)
5812 return _mtlk_df_ui_proc_bcl_read(page, start, off, count, eof, data, UM_DATA_BASE, UM_DATA_SIZE);
5814 #endif /* MTCFG_BUS_PCI_PCIE */
5816 static int mtlk_df_ui_shram(char *page, char **start, off_t off,
5817 int count, int *eof, void *data)
5819 return _mtlk_df_ui_proc_bcl_read(page, start, off, count, eof, data, SHRAM_DATA_BASE, SHRAM_DATA_SIZE);
5822 #ifdef MTCFG_BUS_AHB
5823 static int mtlk_df_ui_ahbum(char *page, char **start, off_t off,
5824 int count, int *eof, void *data)
5826 return _mtlk_df_ui_proc_bcl_read(page, start, off, count, eof, data, AHBUM_DATA_BASE, AHBUM_DATA_SIZE);
5828 #endif /* MTCFG_BUS_AHB */
5830 static int
5831 _mtlk_df_ui_ee_caps(mtlk_seq_entry_t *s, void *data)
5833 int res = MTLK_ERR_NOT_SUPPORTED;
5834 mtlk_df_t *df = mtlk_df_proc_seq_entry_get_df(s);
5835 mtlk_eeprom_data_stat_entry_t *pstat;
5836 mtlk_handle_t hdata;
5838 res = _mtlk_df_user_pull_core_data(df, MTLK_CORE_REQ_GET_EE_CAPS, TRUE, (void**) &pstat, NULL, &hdata);
5839 if (MTLK_ERR_OK != res) {
5840 goto err_ret;
5843 mtlk_aux_seq_printf(s, "AP disabled: %i\nDFS channels disabled: %i\n",
5844 pstat->ap_disabled, pstat->disable_sm_channels);
5846 _mtlk_df_user_free_core_data(df, hdata);
5848 err_ret:
5849 return _mtlk_df_mtlk_to_linux_error_code(res);
5852 static int
5853 _mtlk_df_ui_debug_igmp_read(mtlk_seq_entry_t *s, void *data)
5855 int res = MTLK_ERR_NOT_SUPPORTED;
5856 mtlk_df_t *df = mtlk_df_proc_seq_entry_get_df(s);
5857 mtlk_clpb_t *clpb = NULL;
5858 mtlk_mc_igmp_tbl_item_t *igmp_tbl_item;
5860 res = _mtlk_df_user_invoke_core(df, MTLK_CORE_REQ_GET_MC_IGMP_TBL, &clpb, NULL, 0);
5861 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_MC_IGMP_TBL, FALSE);
5862 if (MTLK_ERR_OK != res) {
5863 goto err_ret;
5866 while (NULL != (igmp_tbl_item = mtlk_clpb_enum_get_next(clpb, NULL))) {
5868 switch (igmp_tbl_item->type) {
5869 case MTLK_MC_IPV4_ADDR:
5870 mtlk_aux_seq_printf(s, "IPv4 mcast group " MTLK_NIPQUAD_FMT "\n",
5871 MTLK_NIPQUAD( ((mtlk_mc_igmp_tbl_ipv4_item_t*)igmp_tbl_item)->addr.s_addr ));
5872 break;
5873 case MTLK_MC_IPV6_ADDR:
5874 mtlk_aux_seq_printf(s, "IPv6 mcast group " MTLK_NIP6_FMT "\n",
5875 MTLK_NIP6( ((mtlk_mc_igmp_tbl_ipv6_item_t*)igmp_tbl_item)->addr ));
5876 break;
5877 case MTLK_MC_MAC_ADDR:
5878 mtlk_aux_seq_printf(s, " " MAC_PRINTF_FMT "\n",
5879 MAC_PRINTF_ARG( ((mtlk_mc_igmp_tbl_mac_item_t*)igmp_tbl_item)->addr.au8Addr ));
5880 break;
5881 default:
5882 MTLK_ASSERT(FALSE);
5886 mtlk_clpb_delete(clpb);
5887 err_ret:
5888 return _mtlk_df_mtlk_to_linux_error_code(res);
5891 static int
5892 mtlk_df_ui_reset_stats(mtlk_df_t* df)
5894 mtlk_clpb_t *clpb = NULL;
5895 int res;
5897 res = _mtlk_df_user_invoke_core(df, MTLK_CORE_REQ_RESET_STATS, &clpb, NULL, 0);
5898 res = _mtlk_df_user_process_core_retval(res, clpb, MTLK_CORE_REQ_RESET_STATS, TRUE);
5900 return res;
5903 int _mtlk_df_ui_reset_stats_proc(struct file *file, const char __user *buffer,
5904 unsigned long count, void *data)
5906 mtlk_df_ui_reset_stats((mtlk_df_t*)data);
5907 return count;
5910 static int _mtlk_df_ui_l2nat_clear_table(struct file *file, const char __user *buffer,
5911 unsigned long count, void *data)
5913 mtlk_clpb_t *clpb = NULL;
5914 mtlk_df_t *df = (mtlk_df_t*) data;
5916 int res = _mtlk_df_user_invoke_core(df, MTLK_CORE_REQ_L2NAT_CLEAR_TABLE, &clpb, NULL, 0);
5917 _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_L2NAT_CLEAR_TABLE, TRUE);
5919 return count;
5922 #ifdef AOCS_DEBUG
5923 static int mtlk_df_ui_aocs_proc_cl(struct file *file, const char __user *buffer,
5924 unsigned long count, void *data)
5926 int res = MTLK_ERR_OK;
5927 mtlk_clpb_t *clpb = NULL;
5928 uint32 cl;
5929 mtlk_df_t *df = (mtlk_df_t*) data;
5931 if (1 != sscanf(buffer, "%u", &cl)) {
5932 return count;
5935 res = _mtlk_df_user_invoke_core(df, MTLK_CORE_REQ_SET_AOCS_CL, &clpb, &cl, sizeof(cl));
5936 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_SET_AOCS_CL, TRUE);
5938 return count;
5940 #endif
5942 static int _mtlk_df_version_dump(mtlk_seq_entry_t *s, void *v)
5944 int res = MTLK_ERR_OK;
5945 mtlk_df_t *df = mtlk_df_proc_seq_entry_get_df(s);
5946 mtlk_vap_handle_t vap = mtlk_df_get_vap_handle(df);
5947 char *buffer;
5949 buffer = mtlk_osal_mem_alloc(MTLK_HW_VERSION_PRINTOUT_LEN, MTLK_MEM_TAG_VERSION_PRINTOUT);
5951 if(!buffer)
5953 ELOG_V("Cannot allocate memory for version printout");
5954 res = MTLK_ERR_NO_MEM;
5955 goto finish;
5958 res = mtlk_vap_get_hw_vft(vap)->get_prop(vap, MTLK_HW_VERSION_PRINTOUT,
5959 buffer, MTLK_HW_VERSION_PRINTOUT_LEN);
5961 if(res != MTLK_ERR_OK)
5963 ELOG_V("Cannot perform version printout");
5964 goto free_buffer;
5967 mtlk_aux_seq_printf(s, "%s", buffer);
5969 free_buffer:
5970 mtlk_osal_mem_free(buffer);
5972 finish:
5973 return _mtlk_df_mtlk_to_linux_error_code(res);
5976 /**************************************************************
5977 * Register handlers
5978 **************************************************************/
5980 #define PROC_NODE_ADDBA_STATUS "addba_status"
5982 static int mtlk_df_ui_reg_addba_status(mtlk_df_user_t* df_user)
5984 return mtlk_df_proc_node_add_seq_entry(
5985 PROC_NODE_ADDBA_STATUS, df_user->slow_ctx->proc_df_debug_node, df_user->df, mtlk_df_ui_addba_status);
5988 static void mtlk_df_ui_unreg_addba_status(mtlk_df_user_t* df_user)
5990 mtlk_df_proc_node_remove_entry(PROC_NODE_ADDBA_STATUS, df_user->slow_ctx->proc_df_debug_node);
5993 static int mtlk_df_ui_reg_aocs_history(mtlk_df_user_t* df_user)
5995 return mtlk_df_proc_node_add_seq_entry(
5996 "aocs_history", df_user->slow_ctx->proc_df_node, df_user->df, mtlk_df_ui_aocs_history);
5999 static int mtlk_df_ui_reg_aocs_table(mtlk_df_user_t* df_user)
6001 return mtlk_df_proc_node_add_seq_entry(
6002 "aocs_table", df_user->slow_ctx->proc_df_node, df_user->df, mtlk_df_ui_aocs_table);
6005 static int mtlk_df_ui_reg_aocs_channels(mtlk_df_user_t* df_user)
6007 return mtlk_df_proc_node_add_seq_entry(
6008 "aocs_channels", df_user->slow_ctx->proc_df_node, df_user->df, mtlk_df_ui_aocs_channels);
6011 #ifdef BT_ACS_DEBUG
6012 static int mtlk_df_ui_reg_aocs_channels_dbg(mtlk_df_user_t* df_user)
6014 return mtlk_df_proc_node_add_wo_entry(
6015 "aocs_channels_dbg", df_user->slow_ctx->proc_df_node, df_user->df, mtlk_df_ui_aocs_channels_dbg);
6017 #endif /* BT_ACS_DEBUG */
6019 static int mtlk_df_ui_reg_aocs_penalties(mtlk_df_user_t* df_user)
6021 return mtlk_df_proc_node_add_seq_entry(
6022 "aocs_penalties", df_user->slow_ctx->proc_df_node, df_user->df, mtlk_df_ui_aocs_penalties);
6025 static int mtlk_df_ui_reg_hw_limits(mtlk_df_user_t* df_user)
6027 return mtlk_df_proc_node_add_seq_entry(
6028 "hw_limits", df_user->slow_ctx->proc_df_node, df_user->df, mtlk_df_ui_hw_limits);
6031 static int mtlk_df_ui_reg_reg_limits(mtlk_df_user_t* df_user)
6033 return mtlk_df_proc_node_add_seq_entry(
6034 "reg_limits", df_user->slow_ctx->proc_df_node, df_user->df, mtlk_df_ui_reg_limits);
6037 static int mtlk_df_ui_reg_ant_gain(mtlk_df_user_t* df_user)
6039 return mtlk_df_proc_node_add_seq_entry(
6040 "antenna_gain", df_user->slow_ctx->proc_df_node, df_user->df, mtlk_df_ui_ant_gain);
6043 static void mtlk_df_ui_unreg_serializer_dump(mtlk_df_user_t* df_user)
6045 mtlk_df_proc_node_remove_entry("serializer_dump", df_user->slow_ctx->proc_df_debug_node);
6048 static int mtlk_df_ui_reg_serializer_dump(mtlk_df_user_t* df_user)
6050 return mtlk_df_proc_node_add_seq_entry(
6051 "serializer_dump", df_user->slow_ctx->proc_df_debug_node, df_user->df, mtlk_df_ui_serializer_dump);
6054 static void mtlk_df_ui_unreg_core_status(mtlk_df_user_t* df_user)
6056 mtlk_df_proc_node_remove_entry("General", df_user->slow_ctx->proc_df_debug_node);
6057 mtlk_df_proc_node_remove_entry("MACStats", df_user->slow_ctx->proc_df_debug_node);
6060 static int mtlk_df_ui_reg_core_status(mtlk_df_user_t* df_user)
6062 int res;
6063 res = mtlk_df_proc_node_add_seq_entry(
6064 "General", df_user->slow_ctx->proc_df_debug_node, df_user->df, mtlk_df_ui_debug_general);
6066 if (MTLK_ERR_OK == res) {
6067 res = mtlk_df_proc_node_add_seq_entry(
6068 "MACStats",
6069 df_user->slow_ctx->proc_df_debug_node,
6070 df_user->df,
6071 mtlk_df_ui_debug_mac_stats);
6074 if (MTLK_ERR_OK != res) {
6075 mtlk_df_ui_unreg_core_status(df_user);
6078 return res;
6081 static int mtlk_df_ui_reg_debug_reordering_stats(mtlk_df_user_t* df_user)
6083 return mtlk_df_proc_node_add_seq_entry(
6084 "ReorderingStats",
6085 df_user->slow_ctx->proc_df_debug_node,
6086 df_user->df,
6087 mtlk_df_ui_reordering_stats);
6090 static int mtlk_df_ui_reg_debug_l2nat(mtlk_df_user_t* df_user)
6092 return mtlk_df_proc_node_add_seq_entry(
6093 "L2NAT", df_user->slow_ctx->proc_df_debug_node, df_user->df, mtlk_df_ui_debug_l2nat);
6096 static int mtlk_df_ui_reg_debug_send_queue(mtlk_df_user_t* df_user)
6098 return mtlk_df_proc_node_add_seq_entry(
6099 "SendQueue", df_user->slow_ctx->proc_df_debug_node, df_user->df, mtlk_df_ui_debug_send_queue);
6102 static int mtlk_df_ui_reg_debug_power_save(mtlk_df_user_t* df_user)
6104 return mtlk_df_proc_node_add_seq_entry(
6105 "PS", df_user->slow_ctx->proc_df_debug_node, df_user->df, mtlk_df_ui_debug_power_save);
6108 static int mtlk_df_ui_reg_debug_mac_assert(mtlk_df_user_t* df_user)
6110 return mtlk_df_proc_node_add_wo_entry(
6111 "do_debug_assert", df_user->slow_ctx->proc_df_node, df_user->df, mtlk_df_do_debug_assert_write);
6114 #ifdef MTCFG_BUS_PCI_PCIE
6115 static int mtlk_df_ui_reg_bcl_read_lm(mtlk_df_user_t* df_user)
6117 return mtlk_df_proc_node_add_ro_entry(
6118 "lm", df_user->slow_ctx->proc_df_node, df_user->df, mtlk_df_ui_lm);
6121 static int mtlk_df_ui_reg_bcl_read_um(mtlk_df_user_t* df_user)
6123 return mtlk_df_proc_node_add_ro_entry(
6124 "um", df_user->slow_ctx->proc_df_node, df_user->df, mtlk_df_ui_um);
6126 #endif /* MTCFG_BUS_PCI_PCIE */
6128 static int mtlk_df_ui_reg_bcl_read_shram(mtlk_df_user_t* df_user)
6130 return mtlk_df_proc_node_add_ro_entry(
6131 "shram", df_user->slow_ctx->proc_df_node, df_user->df, mtlk_df_ui_shram);
6134 #ifdef MTCFG_BUS_AHB
6135 static int mtlk_df_ui_reg_bcl_read_ahbum(mtlk_df_user_t* df_user)
6137 return mtlk_df_proc_node_add_ro_entry(
6138 "um", df_user->slow_ctx->proc_df_node, df_user->df, mtlk_df_ui_ahbum);
6140 #endif /* MTCFG_BUS_AHB */
6142 static int mtlk_df_ui_reg_ee_caps(mtlk_df_user_t* df_user)
6144 return mtlk_df_proc_node_add_seq_entry(
6145 "EECaps", df_user->slow_ctx->proc_df_node, df_user->df, _mtlk_df_ui_ee_caps);
6148 static int mtlk_df_ui_reg_debug_igmp_read(mtlk_df_user_t* df_user)
6150 return mtlk_df_proc_node_add_seq_entry(
6151 "igmp", df_user->slow_ctx->proc_df_node, df_user->df, _mtlk_df_ui_debug_igmp_read);
6154 static int mtlk_df_ui_reg_reset_stats(mtlk_df_user_t* df_user)
6156 return mtlk_df_proc_node_add_wo_entry(
6157 "ResetStats",
6158 df_user->slow_ctx->proc_df_debug_node,
6159 df_user->df,
6160 _mtlk_df_ui_reset_stats_proc);
6163 static int mtlk_df_ui_reg_l2nat_clear_table(mtlk_df_user_t* df_user)
6165 return mtlk_df_proc_node_add_wo_entry(
6166 "L2NAT_ClearTable",
6167 df_user->slow_ctx->proc_df_debug_node,
6168 df_user->df,
6169 _mtlk_df_ui_l2nat_clear_table);
6172 #ifdef AOCS_DEBUG
6173 static int mtlk_df_ui_reg_aocs_proc_cl(mtlk_df_user_t* df_user)
6175 return mtlk_df_proc_node_add_wo_entry(
6176 "aocs_cl", df_user->slow_ctx->proc_df_debug_node, df_user->df, mtlk_df_ui_aocs_proc_cl);
6178 #endif
6180 static int mtlk_df_ui_reg_version(mtlk_df_user_t* df_user)
6182 return mtlk_df_proc_node_add_seq_entry(
6183 "version", df_user->slow_ctx->proc_df_node, df_user->df, _mtlk_df_version_dump);
6186 /**************************************************************
6187 * Unregister handlers
6188 **************************************************************/
6189 static void mtlk_df_ui_unreg_aocs_history(mtlk_df_user_t* df_user)
6191 mtlk_df_proc_node_remove_entry("aocs_history", df_user->slow_ctx->proc_df_node);
6194 static void mtlk_df_ui_unreg_aocs_table(mtlk_df_user_t* df_user)
6196 mtlk_df_proc_node_remove_entry("aocs_table", df_user->slow_ctx->proc_df_node);
6199 static void mtlk_df_ui_unreg_aocs_channels(mtlk_df_user_t* df_user)
6201 mtlk_df_proc_node_remove_entry("aocs_channels", df_user->slow_ctx->proc_df_node);
6204 #ifdef BT_ACS_DEBUG
6205 static void mtlk_df_ui_unreg_aocs_channels_dbg(mtlk_df_user_t* df_user)
6207 mtlk_df_proc_node_remove_entry("aocs_channels_dbg", df_user->slow_ctx->proc_df_node);
6209 #endif /* BT_ACS_DEBUG */
6211 static void mtlk_df_ui_unreg_aocs_penalties(mtlk_df_user_t* df_user)
6213 mtlk_df_proc_node_remove_entry("aocs_penalties", df_user->slow_ctx->proc_df_node);
6216 static void mtlk_df_ui_unreg_hw_limits(mtlk_df_user_t* df_user)
6218 mtlk_df_proc_node_remove_entry("hw_limits", df_user->slow_ctx->proc_df_node);
6221 static void mtlk_df_ui_unreg_reg_limits(mtlk_df_user_t* df_user)
6223 mtlk_df_proc_node_remove_entry("reg_limits", df_user->slow_ctx->proc_df_node);
6226 static void mtlk_df_ui_unreg_ant_gain(mtlk_df_user_t* df_user)
6228 mtlk_df_proc_node_remove_entry("antenna_gain", df_user->slow_ctx->proc_df_node);
6231 static void mtlk_df_ui_unreg_debug_reordering_stats(mtlk_df_user_t* df_user)
6233 mtlk_df_proc_node_remove_entry("ReorderingStats", df_user->slow_ctx->proc_df_debug_node);
6236 static void mtlk_df_ui_unreg_debug_l2nat(mtlk_df_user_t* df_user)
6238 mtlk_df_proc_node_remove_entry("L2NAT", df_user->slow_ctx->proc_df_debug_node);
6241 static void mtlk_df_ui_unreg_debug_send_queue(mtlk_df_user_t* df_user)
6243 mtlk_df_proc_node_remove_entry("SendQueue", df_user->slow_ctx->proc_df_debug_node);
6246 static void mtlk_df_ui_unreg_debug_power_save(mtlk_df_user_t* df_user)
6248 mtlk_df_proc_node_remove_entry("PS", df_user->slow_ctx->proc_df_debug_node);
6251 static void mtlk_df_ui_unreg_debug_mac_assert(mtlk_df_user_t* df_user)
6253 mtlk_df_proc_node_remove_entry("do_debug_assert", df_user->slow_ctx->proc_df_node);
6256 #ifdef MTCFG_BUS_PCI_PCIE
6257 static void mtlk_df_ui_unreg_bcl_read_lm(mtlk_df_user_t* df_user)
6259 mtlk_df_proc_node_remove_entry("lm", df_user->slow_ctx->proc_df_node);
6262 static void mtlk_df_ui_unreg_bcl_read_um(mtlk_df_user_t* df_user)
6264 mtlk_df_proc_node_remove_entry("um", df_user->slow_ctx->proc_df_node);
6266 #endif /* MTCFG_BUS_PCI_PCIE */
6268 static void mtlk_df_ui_unreg_bcl_read_shram(mtlk_df_user_t* df_user)
6270 mtlk_df_proc_node_remove_entry("shram", df_user->slow_ctx->proc_df_node);
6273 #ifdef MTCFG_BUS_AHB
6274 static void mtlk_df_ui_unreg_bcl_read_ahbum(mtlk_df_user_t* df_user)
6276 mtlk_df_proc_node_remove_entry("um", df_user->slow_ctx->proc_df_node);
6278 #endif /* MTCFG_BUS_AHB */
6280 static void mtlk_df_ui_unreg_ee_caps(mtlk_df_user_t* df_user)
6282 mtlk_df_proc_node_remove_entry("EECaps", df_user->slow_ctx->proc_df_node);
6285 static void mtlk_df_ui_unreg_debug_igmp_read(mtlk_df_user_t* df_user)
6287 mtlk_df_proc_node_remove_entry("igmp", df_user->slow_ctx->proc_df_node);
6290 static void mtlk_df_ui_unreg_reset_stats(mtlk_df_user_t* df_user)
6292 mtlk_df_proc_node_remove_entry("ResetStats", df_user->slow_ctx->proc_df_debug_node);
6295 static void mtlk_df_ui_unreg_l2nat_clear_table(mtlk_df_user_t* df_user)
6297 mtlk_df_proc_node_remove_entry("L2NAT_ClearTable", df_user->slow_ctx->proc_df_debug_node);
6300 #ifdef AOCS_DEBUG
6301 static void mtlk_df_ui_unreg_aocs_proc_cl(mtlk_df_user_t* df_user)
6303 mtlk_df_proc_node_remove_entry("aocs_cl", df_user->slow_ctx->proc_df_debug_node);
6305 #endif
6307 static void mtlk_df_ui_unreg_version(mtlk_df_user_t* df_user)
6309 mtlk_df_proc_node_remove_entry("version", df_user->slow_ctx->proc_df_node);
6312 #ifdef EEPROM_DATA_VALIDATION
6314 #define PROC_EEPROM "eeprom"
6316 static int
6317 _mtlk_df_ui_eeprom(mtlk_seq_entry_t *s, void *data)
6319 int res = MTLK_ERR_NOT_SUPPORTED;
6320 uint32 req_data_length; \
6321 mtlk_df_t *df = mtlk_df_proc_seq_entry_get_df(s);
6322 mtlk_eeprom_cfg_t *eeprom_cfg;
6323 mtlk_handle_t hdata;
6325 MTLK_UNREFERENCED_PARAM(data);
6327 res = _mtlk_df_user_pull_core_data(df, MTLK_CORE_REQ_GET_EEPROM_CFG, FALSE,
6328 (void**) &eeprom_cfg, &req_data_length,
6329 &hdata);
6330 if(MTLK_ERR_OK == res)
6332 MTLK_ASSERT(sizeof(mtlk_eeprom_cfg_t) == req_data_length);
6334 res = mtlk_aux_seq_write(s, eeprom_cfg->eeprom_raw_data, sizeof(eeprom_cfg->eeprom_raw_data));
6337 if(MTLK_INVALID_HANDLE != hdata)
6339 _mtlk_df_user_free_core_data(df, hdata);
6342 return _mtlk_df_mtlk_to_linux_error_code(res);
6345 static int mtlk_df_ui_reg_eeprom_proc_cl(mtlk_df_user_t* df_user)
6347 return mtlk_df_proc_node_add_seq_entry(PROC_EEPROM,
6348 df_user->slow_ctx->proc_df_node, df_user->df, _mtlk_df_ui_eeprom);
6351 static void mtlk_df_ui_unreg_eeprom_proc_cl(mtlk_df_user_t* df_user)
6353 mtlk_df_proc_node_remove_entry(PROC_EEPROM, df_user->slow_ctx->proc_df_node);
6356 #define PROC_EEPROMFW "eeprom_fw"
6358 static int
6359 _mtlk_df_ui_eepromfw(mtlk_seq_entry_t *s, void *data)
6361 int res = MTLK_ERR_NOT_SUPPORTED;
6362 uint32 req_data_length; \
6363 mtlk_df_t *df = mtlk_df_proc_seq_entry_get_df(s);
6364 mtlk_eeprom_cfg_t *eeprom_cfg;
6365 mtlk_handle_t hdata;
6367 MTLK_UNREFERENCED_PARAM(data);
6369 res = _mtlk_df_user_pull_core_data(df, MTLK_CORE_REQ_GET_EEPROM_FW, FALSE,
6370 (void**) &eeprom_cfg, &req_data_length,
6371 &hdata);
6373 if(MTLK_ERR_OK == res)
6375 MTLK_ASSERT(sizeof(mtlk_eeprom_cfg_t) == req_data_length);
6377 res = mtlk_aux_seq_write(s, eeprom_cfg->eeprom_raw_data, sizeof(eeprom_cfg->eeprom_raw_data));
6380 if(MTLK_INVALID_HANDLE != hdata)
6382 _mtlk_df_user_free_core_data(df, hdata);
6385 return _mtlk_df_mtlk_to_linux_error_code(res);
6388 static int mtlk_df_ui_reg_eepromfw_proc_cl(mtlk_df_user_t* df_user)
6390 return mtlk_df_proc_node_add_seq_entry(PROC_EEPROMFW,
6391 df_user->slow_ctx->proc_df_node, df_user->df, _mtlk_df_ui_eepromfw);
6394 static void mtlk_df_ui_unreg_eepromfw_proc_cl(mtlk_df_user_t* df_user)
6396 mtlk_df_proc_node_remove_entry(PROC_EEPROMFW, df_user->slow_ctx->proc_df_node);
6398 #endif /* EEPROM_DATA_VALIDATION */
6400 struct _proc_management_handlers_t
6402 int (*on_register) (mtlk_df_user_t* df_user);
6403 void (*on_unregister)(mtlk_df_user_t* df_user);
6406 static const struct _proc_management_handlers_t
6407 _proc_management_handlers[] =
6409 { mtlk_df_ui_reg_hw_limits, mtlk_df_ui_unreg_hw_limits },
6410 { mtlk_df_ui_reg_reg_limits, mtlk_df_ui_unreg_reg_limits },
6411 { mtlk_df_ui_reg_ant_gain, mtlk_df_ui_unreg_ant_gain },
6412 { mtlk_df_ui_reg_debug_mac_assert, mtlk_df_ui_unreg_debug_mac_assert },
6413 { mtlk_df_ui_reg_bcl_read_shram, mtlk_df_ui_unreg_bcl_read_shram },
6414 { mtlk_df_ui_reg_core_status, mtlk_df_ui_unreg_core_status },
6415 { mtlk_df_ui_reg_debug_igmp_read, mtlk_df_ui_unreg_debug_igmp_read },
6416 { mtlk_df_ui_reg_reset_stats, mtlk_df_ui_unreg_reset_stats },
6417 { mtlk_df_ui_reg_aocs_history, mtlk_df_ui_unreg_aocs_history },
6418 { mtlk_df_ui_reg_addba_status, mtlk_df_ui_unreg_addba_status},
6419 { mtlk_df_ui_reg_aocs_table, mtlk_df_ui_unreg_aocs_table },
6420 { mtlk_df_ui_reg_aocs_channels, mtlk_df_ui_unreg_aocs_channels },
6421 #ifdef BT_ACS_DEBUG
6422 { mtlk_df_ui_reg_aocs_channels_dbg, mtlk_df_ui_unreg_aocs_channels_dbg },
6423 #endif /* BT_ACS_DEBUG */
6424 { mtlk_df_ui_reg_aocs_penalties, mtlk_df_ui_unreg_aocs_penalties },
6425 #ifdef AOCS_DEBUG
6426 { mtlk_df_ui_reg_aocs_proc_cl, mtlk_df_ui_unreg_aocs_proc_cl },
6427 #endif
6428 { mtlk_df_ui_reg_debug_l2nat, mtlk_df_ui_unreg_debug_l2nat },
6429 { mtlk_df_ui_reg_l2nat_clear_table, mtlk_df_ui_unreg_l2nat_clear_table },
6430 { mtlk_df_ui_reg_debug_reordering_stats, mtlk_df_ui_unreg_debug_reordering_stats },
6431 { mtlk_df_ui_reg_ee_caps, mtlk_df_ui_unreg_ee_caps },
6432 { mtlk_df_ui_reg_debug_send_queue, mtlk_df_ui_unreg_debug_send_queue },
6433 { mtlk_df_ui_reg_debug_power_save, mtlk_df_ui_unreg_debug_power_save },
6434 { mtlk_df_ui_reg_serializer_dump, mtlk_df_ui_unreg_serializer_dump },
6435 #ifdef EEPROM_DATA_VALIDATION
6436 { mtlk_df_ui_reg_eeprom_proc_cl, mtlk_df_ui_unreg_eeprom_proc_cl },
6437 { mtlk_df_ui_reg_eepromfw_proc_cl, mtlk_df_ui_unreg_eepromfw_proc_cl },
6438 #endif /* EEPROM_DATA_VALIDATION */
6439 { mtlk_df_ui_reg_version, mtlk_df_ui_unreg_version },
6442 #ifdef MTCFG_BUS_PCI_PCIE
6443 static const struct _proc_management_handlers_t
6444 _proc_management_pci_pcie_handlers[] =
6446 { mtlk_df_ui_reg_bcl_read_lm, mtlk_df_ui_unreg_bcl_read_lm },
6447 { mtlk_df_ui_reg_bcl_read_um, mtlk_df_ui_unreg_bcl_read_um }
6449 #endif /* MTCFG_BUS_PCI_PCIE */
6451 #ifdef MTCFG_BUS_AHB
6452 static const struct _proc_management_handlers_t
6453 _proc_management_ahb_handlers[] =
6455 { mtlk_df_ui_reg_bcl_read_ahbum, mtlk_df_ui_unreg_bcl_read_ahbum }
6457 #endif /* MTCFG_BUS_AHB */
6459 int __MTLK_IFUNC
6460 mtlk_df_ui_iw_bcl_mac_data_get (struct net_device *dev,
6461 struct iw_request_info *info,
6462 union iwreq_data *wrqu, char *extra)
6464 int res = 0;
6465 UMI_BCL_REQUEST req;
6466 UMI_BCL_REQUEST *req_result;
6467 mtlk_df_user_t* df_user = (mtlk_df_user_t*) netdev_priv(dev);
6468 mtlk_clpb_t *clpb = NULL;
6470 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
6472 if (copy_from_user(&req, wrqu->data.pointer, sizeof(req)) != 0) {
6473 res = MTLK_ERR_PARAMS;
6474 goto finish;
6477 /* Send request to core */
6478 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_GET_BCL_MAC_DATA,
6479 &clpb, &req, sizeof(req));
6480 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_BCL_MAC_DATA, FALSE);
6481 if (MTLK_ERR_OK != res) {
6482 goto finish;
6485 /* Handle result */
6486 req_result = mtlk_clpb_enum_get_next(clpb, NULL);
6488 if (NULL == req_result) {
6489 res = MTLK_ERR_UNKNOWN;
6490 } else if (copy_to_user(wrqu->data.pointer, req_result, sizeof(*req_result)) != 0) {
6491 res = MTLK_ERR_UNKNOWN;
6494 mtlk_clpb_delete(clpb);
6495 finish:
6496 return _mtlk_df_mtlk_to_linux_error_code(res);
6499 int __MTLK_IFUNC
6500 mtlk_df_ui_iw_bcl_mac_data_set (struct net_device *dev,
6501 struct iw_request_info *info,
6502 union iwreq_data *wrqu, char *extra)
6504 int res = 0;
6505 UMI_BCL_REQUEST req;
6506 mtlk_df_user_t* df_user = (mtlk_df_user_t*) netdev_priv(dev);
6507 mtlk_clpb_t *clpb = NULL;
6509 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
6511 if (copy_from_user(&req, wrqu->data.pointer, sizeof(req)) != 0) {
6512 res = MTLK_ERR_PARAMS;
6513 goto finish;
6516 /* Send request to core */
6517 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_SET_BCL_MAC_DATA,
6518 &clpb, &req, sizeof(req));
6519 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_SET_BCL_MAC_DATA, TRUE);
6521 finish:
6522 return _mtlk_df_mtlk_to_linux_error_code(res);
6525 int __MTLK_IFUNC
6526 mtlk_df_ui_linux_ioctl_stop_lower_mac (struct net_device *dev,
6527 struct iw_request_info *info,
6528 union iwreq_data *wrqu,
6529 char *extra)
6531 int res = 0;
6532 mtlk_clpb_t *clpb = NULL;
6533 mtlk_df_user_t* df_user = (mtlk_df_user_t*) netdev_priv(dev);
6535 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
6537 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_STOP_LM, &clpb, NULL, 0);
6538 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_STOP_LM, TRUE);
6540 return _mtlk_df_mtlk_to_linux_error_code(res);
6543 int __MTLK_IFUNC
6544 mtlk_df_ui_linux_ioctl_mac_calibrate (struct net_device *dev,
6545 struct iw_request_info *info,
6546 union iwreq_data *wrqu,
6547 char *extra)
6549 int res = 0;
6550 mtlk_clpb_t *clpb = NULL;
6551 mtlk_df_user_t* df_user = (mtlk_df_user_t*) netdev_priv(dev);
6553 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
6555 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_MAC_CALIBRATE, &clpb, NULL, 0);
6556 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_MAC_CALIBRATE, TRUE);
6558 return _mtlk_df_mtlk_to_linux_error_code(res);
6561 int __MTLK_IFUNC
6562 mtlk_df_ui_linux_ioctl_iw_generic (struct net_device *dev,
6563 struct iw_request_info *info,
6564 union iwreq_data *wrqu, char *extra)
6566 int res = MTLK_ERR_OK;
6567 UMI_GENERIC_MAC_REQUEST req;
6568 UMI_GENERIC_MAC_REQUEST *preq = NULL;
6569 uint32 preq_size = 0;
6570 mtlk_df_user_t* df_user = (mtlk_df_user_t*) netdev_priv(dev);
6571 mtlk_clpb_t *clpb = NULL;
6573 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
6575 if (0 != copy_from_user(&req, wrqu->data.pointer, sizeof(req))) {
6576 res = MTLK_ERR_PARAMS;
6577 goto finish;
6580 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_GET_IW_GENERIC,
6581 &clpb, &req, sizeof(req));
6582 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_IW_GENERIC, FALSE);
6584 if (MTLK_ERR_OK != res) {
6585 goto finish;
6588 preq = mtlk_clpb_enum_get_next(clpb, &preq_size);
6590 MTLK_ASSERT(NULL != preq);
6591 MTLK_ASSERT(sizeof(*preq) == preq_size);
6593 ILOG2_DDDDDD("Generic opcode %ux, %ud dwords, action 0x%ux results 0x%ux 0x%ux 0x%ux\n",
6594 (unsigned int)preq->opcode,
6595 (unsigned int)preq->size,
6596 (unsigned int)preq->action,
6597 (unsigned int)preq->res0,
6598 (unsigned int)preq->res1,
6599 (unsigned int)preq->res2);
6601 if (0 != copy_to_user(wrqu->data.pointer, preq, sizeof(*preq))) {
6602 ELOG_V("Unable to copy iw generic data");
6603 res = MTLK_ERR_PARAMS;
6606 mtlk_clpb_delete(clpb);
6607 finish:
6608 return _mtlk_df_mtlk_to_linux_error_code(res);
6611 int __MTLK_IFUNC
6612 mtlk_df_ui_linux_ioctl_ctrl_mac_gpio (struct net_device *dev,
6613 struct iw_request_info *info,
6614 union iwreq_data *wrqu,
6615 char *extra)
6617 int res = 0;
6618 mtlk_df_user_t* df_user = (mtlk_df_user_t*) netdev_priv(dev);
6619 mtlk_clpb_t *clpb = NULL;
6620 int *ptr_extra = (int *)extra;
6621 UMI_SET_LED leds_status;
6623 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
6624 ILOG3_DD("ptr_extra = 0x%x, ptr_extra1 = 0x%x", ptr_extra[0], ptr_extra[1]);
6626 memset(&leds_status, 0, sizeof(leds_status));
6628 leds_status.u8BasebLed = (uint8)(ptr_extra[0] & 0xFF);
6629 leds_status.u8LedStatus = (uint8)(ptr_extra[1] & 0xFF);
6631 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_CTRL_MAC_GPIO,
6632 &clpb, &leds_status, sizeof(leds_status));
6633 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_CTRL_MAC_GPIO, TRUE);
6635 return _mtlk_df_mtlk_to_linux_error_code(res);
6639 * Due to lack of synchronization between fw-to-driver and driver-to-user
6640 * Network Mode should be converted on driver-to-user border.
6642 uint8 __MTLK_IFUNC
6643 _net_mode_ingress_filter (uint8 ingress_net_mode)
6645 switch (ingress_net_mode) {
6646 case NETWORK_MODE_11A:
6647 return NETWORK_11A_ONLY;
6648 case NETWORK_MODE_11ABG:
6649 return NETWORK_11ABG_MIXED;
6650 case NETWORK_MODE_11ABGN:
6651 return NETWORK_11ABGN_MIXED;
6652 case NETWORK_MODE_11AN:
6653 return NETWORK_11AN_MIXED;
6654 case NETWORK_MODE_11B:
6655 return NETWORK_11B_ONLY;
6656 case NETWORK_MODE_11BG:
6657 return NETWORK_11BG_MIXED;
6658 case NETWORK_MODE_11BGN:
6659 return NETWORK_11BGN_MIXED;
6660 case NETWORK_MODE_11GN:
6661 return NETWORK_11GN_MIXED;
6662 case NETWORK_MODE_11G:
6663 return NETWORK_11G_ONLY;
6664 case NETWORK_MODE_11N2:
6665 return NETWORK_11N_2_4_ONLY;
6666 case NETWORK_MODE_11N5:
6667 return NETWORK_11N_5_ONLY;
6668 default:
6669 break;
6672 return NETWORK_NONE;
6675 uint8 __MTLK_IFUNC
6676 _net_mode_egress_filter (uint8 egress_net_mode)
6678 switch (egress_net_mode) {
6679 case NETWORK_11ABG_MIXED:
6680 return NETWORK_MODE_11ABG;
6681 case NETWORK_11ABGN_MIXED:
6682 return NETWORK_MODE_11ABGN;
6683 case NETWORK_11B_ONLY:
6684 return NETWORK_MODE_11B;
6685 case NETWORK_11G_ONLY:
6686 return NETWORK_MODE_11G;
6687 case NETWORK_11N_2_4_ONLY:
6688 return NETWORK_MODE_11N2;
6689 case NETWORK_11BG_MIXED:
6690 return NETWORK_MODE_11BG;
6691 case NETWORK_11GN_MIXED:
6692 return NETWORK_MODE_11GN;
6693 case NETWORK_11BGN_MIXED:
6694 return NETWORK_MODE_11BGN;
6695 case NETWORK_11A_ONLY:
6696 return NETWORK_MODE_11A;
6697 case NETWORK_11N_5_ONLY:
6698 return NETWORK_MODE_11N5;
6699 case NETWORK_11AN_MIXED:
6700 return NETWORK_MODE_11AN;
6701 default:
6702 break;
6705 ASSERT(0);
6707 return 0; /* just fake cc */
6710 int __MTLK_IFUNC
6711 mtlk_df_ui_linux_ioctl_getname (struct net_device *dev,
6712 struct iw_request_info *info,
6713 char *name,
6714 char *extra)
6716 uint32 net_mode = NUM_OF_NETWORK_MODES;
6717 int res = MTLK_ERR_NOT_HANDLED;
6718 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
6720 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
6722 res = _mtlk_df_user_iwpriv_get_core_param(df_user, PRM_ID_NETWORK_MODE, (char*)&net_mode, NULL);
6723 if (MTLK_ERR_OK == res) {
6724 strcpy(name, net_mode_to_string(_net_mode_ingress_filter(net_mode)));
6727 return _mtlk_df_mtlk_to_linux_error_code(res);
6730 int __MTLK_IFUNC
6731 mtlk_df_ui_linux_ioctl_getmode (struct net_device *dev,
6732 struct iw_request_info *info,
6733 u32 *mode,
6734 char *extra)
6736 mtlk_df_user_t* df_user = (mtlk_df_user_t*)netdev_priv(dev);
6738 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
6740 if (mtlk_df_is_ap(df_user->df))
6741 *mode = IW_MODE_MASTER;
6742 else
6743 *mode = IW_MODE_INFRA;
6745 return 0;
6748 int __MTLK_IFUNC
6749 mtlk_df_ui_linux_ioctl_setnick (struct net_device *dev,
6750 struct iw_request_info *info,
6751 union iwreq_data *wrqu,
6752 char *extra)
6754 int res = MTLK_ERR_OK;
6755 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
6757 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
6759 if (0 == wrqu->essid.length) {
6760 goto finish;
6763 if (MTLK_ESSID_MAX_SIZE < wrqu->essid.length) {
6764 res = MTLK_ERR_PARAMS;
6765 goto finish;
6768 /* WARNING: Take care about kernel and WE version compatibility:
6769 * the NickName can be passed without null terminated character*/
6770 res = _mtlk_df_user_iwpriv_set_core_param(df_user, PRM_ID_NICK_NAME, extra, &wrqu->essid.length);
6772 finish:
6773 return _mtlk_df_mtlk_to_linux_error_code(res);
6776 int __MTLK_IFUNC
6777 mtlk_df_ui_linux_ioctl_getnick (struct net_device *dev,
6778 struct iw_request_info *info,
6779 union iwreq_data *wrqu,
6780 char *extra)
6782 int res = MTLK_ERR_PARAMS;
6783 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
6785 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
6787 if ((NULL == extra) || (0 == wrqu->essid.length)) {
6788 goto finish;
6791 res = _mtlk_df_user_iwpriv_get_core_param(df_user, PRM_ID_NICK_NAME, extra, &wrqu->essid.length);
6793 finish:
6794 return _mtlk_df_mtlk_to_linux_error_code(res);
6797 int __MTLK_IFUNC
6798 mtlk_df_ui_linux_ioctl_setessid (struct net_device *dev,
6799 struct iw_request_info *info,
6800 union iwreq_data *wrqu,
6801 char *extra)
6803 int res = MTLK_ERR_OK;
6804 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
6806 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
6808 if (0 == wrqu->essid.length) {
6809 goto finish;
6812 if (MTLK_ESSID_MAX_SIZE < wrqu->essid.length) {
6813 res = MTLK_ERR_PARAMS;
6814 goto finish;
6817 /* WARNING: Take care about kernel and WE version compatibility:
6818 * the ESSID can be passed without null terminated character*/
6819 res = _mtlk_df_user_iwpriv_set_core_param(df_user, PRM_ID_ESSID, extra, &wrqu->essid.length);
6821 finish:
6822 return _mtlk_df_mtlk_to_linux_error_code(res);
6825 int __MTLK_IFUNC
6826 mtlk_df_ui_linux_ioctl_getessid (struct net_device *dev,
6827 struct iw_request_info *info,
6828 union iwreq_data *wrqu,
6829 char *extra)
6831 int res = MTLK_ERR_PARAMS;
6832 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
6834 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
6836 if ((NULL == extra) || (0 == wrqu->essid.length)) {
6837 goto finish;
6840 res = _mtlk_df_user_iwpriv_get_core_param(df_user, PRM_ID_ESSID, extra, &wrqu->essid.length);
6842 if (MTLK_ERR_OK == res) {
6843 wrqu->data.flags = 1;
6846 finish:
6847 return _mtlk_df_mtlk_to_linux_error_code(res);
6850 int __MTLK_IFUNC
6851 mtlk_df_ui_linux_ioctl_getap (struct net_device *dev,
6852 struct iw_request_info *info,
6853 union iwreq_data *wrqu,
6854 char *extra)
6856 int res = MTLK_ERR_PARAMS;
6857 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
6859 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
6861 if (NULL == wrqu) {
6862 goto finish;
6865 if (mtlk_df_is_ap(df_user->df)) {
6866 res = mtlk_df_ui_linux_ioctl_get_mac_addr(dev, info, wrqu, extra);
6867 } else {
6868 /* STA: Return connected BSSID */
6869 uint16 len;
6870 res = _mtlk_df_user_iwpriv_get_core_param(df_user, PRM_ID_BSSID, wrqu->addr.sa_data, &len);
6871 MTLK_ASSERT(ETH_ALEN == len);
6874 if (MTLK_ERR_OK == res) {
6875 wrqu->addr.sa_family = ARPHRD_ETHER;
6878 finish:
6879 return _mtlk_df_mtlk_to_linux_error_code(res);
6882 int __MTLK_IFUNC
6883 mtlk_df_ui_linux_ioctl_getfreq (struct net_device *dev,
6884 struct iw_request_info *info,
6885 union iwreq_data *wrqu,
6886 char *extra)
6888 int res = MTLK_ERR_NOT_HANDLED;
6889 uint32 channel = 0;
6890 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
6892 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
6894 res = _mtlk_df_user_iwpriv_get_core_param(df_user, PRM_ID_CHANNEL, (char*)&channel, NULL);
6895 if (MTLK_ERR_OK != res) {
6896 res = MTLK_ERR_UNKNOWN;
6897 goto finish;
6900 if (0 == channel) {
6901 ILOG2_S("%s: Channel autoselection enabled", dev->name);
6902 wrqu->freq.e = 0;
6903 wrqu->freq.m = 0;
6904 wrqu->freq.i = 0;
6905 #if WIRELESS_EXT >= 17
6906 wrqu->freq.flags = IW_FREQ_AUTO;
6907 #endif
6908 } else {
6909 ILOG2_SD("%s: Value of channel is %i", dev->name, channel);
6910 wrqu->freq.e = 0;
6911 wrqu->freq.m = channel;
6912 wrqu->freq.i = 0;
6913 #if WIRELESS_EXT >= 17
6914 wrqu->freq.flags = IW_FREQ_FIXED;
6915 #endif
6918 finish:
6919 return _mtlk_df_mtlk_to_linux_error_code(res);
6922 int __MTLK_IFUNC
6923 mtlk_df_ui_linux_ioctl_setfreq (struct net_device *dev,
6924 struct iw_request_info *info,
6925 union iwreq_data *wrqu,
6926 char *extra)
6928 int res = MTLK_ERR_PARAMS;
6929 uint32 channel = 0;
6930 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
6932 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
6934 if (!mtlk_df_is_ap(df_user->df)) {
6935 ILOG2_S("%s: Channel selection unsupported on STA.", dev->name);
6936 res = MTLK_ERR_NOT_SUPPORTED;
6937 goto finish;
6941 * To enable AOCS
6942 * with WE < 17 use 'iwconfig <IF> channel 0'
6943 * with WE >= 17 also can use 'iwconfig <IF> channel auto'
6946 #if WIRELESS_EXT < 17
6947 if ((wrqu->freq.e == 0) && (wrqu->freq.m == 0)) {
6948 #else
6949 if ( ((wrqu->freq.e == 0) && (wrqu->freq.m == 0)) ||
6950 ((IW_FREQ_FIXED & wrqu->freq.flags) == 0) ) {
6951 #endif /* WIRELESS_EXT < 17 */
6952 channel = 0;
6954 } else if (wrqu->freq.e == 0) {
6955 channel = wrqu->freq.m;
6957 } else {
6958 res = MTLK_ERR_PARAMS;
6959 goto finish;
6962 res = _mtlk_df_user_iwpriv_set_core_param(df_user, PRM_ID_CHANNEL, (char*)&channel, NULL);
6964 finish:
6965 return _mtlk_df_mtlk_to_linux_error_code(res);
6968 int __MTLK_IFUNC
6969 mtlk_df_ui_linux_ioctl_setrtsthr (struct net_device *dev,
6970 struct iw_request_info *info,
6971 union iwreq_data *wrqu,
6972 char *extra)
6974 int res = MTLK_ERR_PARAMS;
6975 int32 value;
6976 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
6978 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
6980 if (wrqu->rts.value < 0) {
6981 res = MTLK_ERR_PARAMS;
6982 goto finish;
6985 value = (wrqu->rts.value < _DF_RTS_THRESHOLD_MIN ? _DF_RTS_THRESHOLD_MIN : wrqu->rts.value);
6986 ILOG2_D("Set RTS/CTS threshold to value %i", value);
6988 res = _mtlk_df_user_iwpriv_set_core_param(df_user, MIB_RTS_THRESHOLD, (char*)&value, NULL);
6990 finish:
6991 return _mtlk_df_mtlk_to_linux_error_code(res);
6994 int __MTLK_IFUNC
6995 mtlk_df_ui_linux_ioctl_getrtsthr (struct net_device *dev,
6996 struct iw_request_info *info,
6997 union iwreq_data *wrqu,
6998 char *extra)
7000 int res = MTLK_ERR_PARAMS;
7001 int32 value;
7002 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
7004 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
7006 res = _mtlk_df_user_iwpriv_get_core_param(df_user, MIB_RTS_THRESHOLD, (char*)&value, NULL);
7007 if (MTLK_ERR_OK == res) {
7008 wrqu->rts.value = value;
7009 wrqu->rts.fixed = 1;
7010 wrqu->rts.disabled = 0;
7011 wrqu->rts.flags = 0;
7014 return _mtlk_df_mtlk_to_linux_error_code(res);
7017 int __MTLK_IFUNC
7018 mtlk_df_ui_linux_ioctl_settxpower (struct net_device *dev,
7019 struct iw_request_info *info,
7020 union iwreq_data *wrqu,
7021 char *extra)
7023 int res = MTLK_ERR_PARAMS;
7024 int32 value;
7025 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
7027 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
7029 if (wrqu->txpower.value > 0) {
7030 ILOG2_D("Set TxPower to specified value %i mW", wrqu->txpower.value);
7031 value = wrqu->txpower.value;
7032 } else {
7033 ILOG2_V("Enable TxPower auto-calculation");
7034 value = 0; /* Auto */
7037 res = _mtlk_df_user_iwpriv_set_core_param(df_user, MIB_TX_POWER, (char*)&value, NULL);
7039 return _mtlk_df_mtlk_to_linux_error_code(res);
7042 int __MTLK_IFUNC
7043 mtlk_df_ui_linux_ioctl_gettxpower (struct net_device *dev,
7044 struct iw_request_info *info,
7045 union iwreq_data *wrqu,
7046 char *extra)
7049 int res = MTLK_ERR_OK;
7050 int32 value;
7051 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
7053 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
7055 if (netif_running(dev)) {
7057 res = _mtlk_df_user_iwpriv_get_core_param(df_user, MIB_TX_POWER, (char*)&value, NULL);
7058 if (MTLK_ERR_OK == res) {
7060 wrqu->txpower.value = value;
7061 wrqu->txpower.fixed = 1;
7062 wrqu->txpower.flags = IW_TXPOW_DBM;
7063 wrqu->txpower.disabled = 0;
7066 else{
7068 wrqu->txpower.disabled = 1;
7071 return _mtlk_df_mtlk_to_linux_error_code(res);
7074 int __MTLK_IFUNC
7075 mtlk_df_ui_linux_ioctl_setretry (struct net_device *dev,
7076 struct iw_request_info *info,
7077 union iwreq_data *wrqu,
7078 char *extra)
7080 int res = MTLK_ERR_PARAMS;
7081 int32 value;
7082 uint16 obj_id;
7083 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
7085 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
7087 value = wrqu->retry.value;
7089 /* Determine requested parameter */
7090 switch (wrqu->retry.flags) {
7091 case IW_RETRY_LIMIT:
7092 case IW_RETRY_LIMIT | IW_RETRY_MIN:
7093 obj_id = MIB_SHORT_RETRY_LIMIT;
7094 break;
7095 case IW_RETRY_LIMIT | IW_RETRY_MAX:
7096 obj_id = MIB_LONG_RETRY_LIMIT;
7097 break;
7098 case IW_RETRY_LIFETIME:
7099 case IW_RETRY_LIFETIME | IW_RETRY_MIN:
7100 case IW_RETRY_LIFETIME | IW_RETRY_MAX:
7101 /* WT send to us value in microseconds, but MAC accepts miliseconds */
7102 if (value < 1000) {
7103 goto finish;
7105 obj_id = MIB_TX_MSDU_LIFETIME;
7106 value = value/1000;
7107 break;
7108 default:
7109 WLOG_D("Unknown parameter type: 0x%04x", wrqu->retry.flags);
7110 goto finish;
7113 if (value >= 0) {
7114 ILOG2_DD("Set Retry limits (lifetime) to value %i %i ", value, wrqu->retry.value);
7115 res = _mtlk_df_user_iwpriv_set_core_param(df_user, obj_id, (char*)&value, NULL);
7118 finish:
7119 return _mtlk_df_mtlk_to_linux_error_code(res);
7122 int __MTLK_IFUNC
7123 mtlk_df_ui_linux_ioctl_getretry (struct net_device *dev,
7124 struct iw_request_info *info,
7125 union iwreq_data *wrqu,
7126 char *extra)
7128 int res = MTLK_ERR_PARAMS;
7129 uint16 obj_id;
7130 int scale = 1;
7131 int32 value;
7132 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
7134 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
7136 /* Determine requested parameter */
7137 switch (wrqu->retry.flags) {
7138 case 0:
7139 case IW_RETRY_LIFETIME:
7140 case IW_RETRY_LIFETIME | IW_RETRY_MIN:
7141 case IW_RETRY_LIFETIME | IW_RETRY_MAX:
7142 obj_id = MIB_TX_MSDU_LIFETIME;
7143 /* WT expects value in microseconds, but MAC work with miliseconds */
7144 scale = 1000;
7145 wrqu->retry.flags = IW_RETRY_LIFETIME;
7146 break;
7147 case IW_RETRY_LIMIT:
7148 case IW_RETRY_LIMIT | IW_RETRY_MIN:
7149 obj_id = MIB_SHORT_RETRY_LIMIT;
7150 wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MIN;
7151 break;
7152 case IW_RETRY_LIMIT | IW_RETRY_MAX:
7153 obj_id = MIB_LONG_RETRY_LIMIT;
7154 wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
7155 break;
7156 default:
7157 WLOG_D("Unknown parameter type: 0x%04x", wrqu->retry.flags);
7158 goto finish;
7161 res = _mtlk_df_user_iwpriv_get_core_param(df_user, obj_id, (char*)&value, NULL);
7162 if (MTLK_ERR_OK == res) {
7163 wrqu->retry.value = scale*value;
7164 wrqu->retry.fixed = 1;
7165 wrqu->retry.disabled = 0;
7168 finish:
7169 return _mtlk_df_mtlk_to_linux_error_code(res);
7172 int __MTLK_IFUNC
7173 mtlk_df_ui_linux_ioctl_getrange (struct net_device *dev,
7174 struct iw_request_info *info,
7175 union iwreq_data *wrqu,
7176 char *extra)
7178 int res = MTLK_ERR_NOT_HANDLED;
7179 mtlk_df_user_t* df_user = (mtlk_df_user_t*)netdev_priv(dev);
7180 mtlk_core_ui_range_info_t *range_info = NULL;
7181 mtlk_handle_t hcore_data;
7182 struct iw_range *range = (struct iw_range *) extra;
7183 int idx;
7185 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
7187 res= _mtlk_df_user_pull_core_data(df_user->df, MTLK_CORE_REQ_GET_RANGE_INFO, TRUE, (void**) &range_info, NULL, &hcore_data);
7189 if(MTLK_ERR_OK != res) {
7190 goto finish;
7193 /** Fill output data **/
7194 wrqu->data.length = sizeof(struct iw_range);
7195 /* In kernes < 2.6.22 range is not zeroed */
7196 memset(range, 0, sizeof(struct iw_range));
7198 range->we_version_compiled = WIRELESS_EXT;
7200 /* kernel MUST be patched up to this version if security is needed */
7201 if (WIRELESS_EXT < 18)
7202 range->we_version_compiled = 18;
7204 range->we_version_source = 18; /* what version we support */
7206 /* WEP stuff */
7207 range->num_encoding_sizes = 2;
7208 range->encoding_size[0] = 5; /* 40 bit */
7209 range->encoding_size[1] = 13; /* 104 bit */
7210 range->max_encoding_tokens = 4;
7212 /* TxPower stuff */
7213 range->txpower_capa = IW_TXPOW_DBM;
7215 /* Maximum quality */
7216 range->max_qual.qual = 5;
7218 /** Fill output bitrates data **/
7219 range->num_bitrates = 0;
7220 if (IW_MAX_BITRATES < range_info->num_bitrates) {
7221 res = MTLK_ERR_UNKNOWN;
7222 goto error_delete_data;
7223 } else if (0 < range_info->num_bitrates) {
7224 range->num_bitrates = range_info->num_bitrates;
7225 /* Array of bitrates is sorted and consist of only unique elements */
7226 for (idx = 0; idx <= range_info->num_bitrates; idx++) {
7227 range->bitrate[idx] = range_info->bitrates[idx];
7231 /* Fill output channels and frequencies data */
7232 range->num_frequency = 0;
7233 range->num_channels = 0;
7235 if (0 < range_info->num_channels) {
7236 if (IW_MAX_FREQUENCIES < range_info->num_channels) {
7237 range_info->num_channels = IW_MAX_FREQUENCIES;
7240 for(idx = 0; idx < range_info->num_channels; idx++) {
7241 range->freq[idx].i = range_info->channels[idx];
7242 range->freq[idx].m = channel_to_frequency(range_info->channels[idx]);
7243 range->freq[idx].e = 6;
7244 //range->freq[i].flags = 0; /* fixed/auto (not used by iwlist currently)*/
7245 range->num_frequency++;
7249 range->num_channels = range->num_frequency;
7251 error_delete_data:
7252 _mtlk_df_user_free_core_data(df_user->df, hcore_data);
7253 finish:
7254 return _mtlk_df_mtlk_to_linux_error_code(res);
7257 int __MTLK_IFUNC
7258 mtlk_df_ui_linux_ioctl_getaplist (struct net_device *dev,
7259 struct iw_request_info *info,
7260 union iwreq_data *wrqu,
7261 char *extra)
7263 int res = MTLK_ERR_NOT_HANDLED;
7264 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
7265 mtlk_clpb_t *clpb = NULL;
7266 struct sockaddr *list = (struct sockaddr*)extra;
7267 int idx = 0;
7268 uint32 size;
7269 mtlk_stadb_stat_t *stadb_stat;
7270 mtlk_core_ui_get_stadb_status_req_t get_stadb_status_req;
7272 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
7274 if (!mtlk_df_is_ap(df_user->df)) {
7275 /* This is STA - do not print anything */
7276 res = MTLK_ERR_NOT_SUPPORTED;
7277 wrqu->data.length = 0;
7278 goto err_ret;
7281 get_stadb_status_req.get_hostdb = FALSE;
7282 get_stadb_status_req.use_cipher = TRUE;
7283 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_GET_STADB_STATUS,
7284 &clpb, &get_stadb_status_req, sizeof(get_stadb_status_req));
7285 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_STADB_STATUS, FALSE);
7286 if(MTLK_ERR_OK != res) {
7287 goto err_ret;
7290 /* Print list of connected STAs */
7291 while (NULL != (stadb_stat = mtlk_clpb_enum_get_next(clpb, &size))) {
7292 if ((sizeof(*stadb_stat) != size) || (STAT_ID_STADB != stadb_stat->type)) {
7293 res = MTLK_ERR_UNKNOWN;
7294 goto delete_clpb;
7297 if (idx == wrqu->data.length) break;
7299 list[idx].sa_family = ARPHRD_ETHER;
7300 memcpy(list[idx].sa_data, stadb_stat->u.general_stat.addr.au8Addr, ETH_ALEN);
7301 idx++;
7304 wrqu->data.length = idx;
7306 delete_clpb:
7307 mtlk_clpb_delete(clpb);
7308 err_ret:
7309 return _mtlk_df_mtlk_to_linux_error_code(res);
7312 int __MTLK_IFUNC
7313 mtlk_df_ui_linux_ioctl_get_connection_info (struct net_device *dev,
7314 struct iw_request_info *info,
7315 union iwreq_data *wrqu,
7316 char *extra)
7318 int res = MTLK_ERR_NOT_HANDLED;
7319 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
7320 mtlk_stadb_stat_t *stadb_stat = NULL;
7321 mtlk_gen_core_cfg_t *core_cfg = NULL;
7322 uint32 size;
7323 char *str = extra;
7324 unsigned len = 0;
7326 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
7328 /* in case we don't add anything to the string we want an empty string */
7329 *str = '\0';
7331 if (!mtlk_df_is_ap(df_user->df)) {
7332 /* This is STA */
7333 uint16 channel = 0;
7334 uint8 bonding = 0;
7335 uint8 frequency_band_cur = 0;
7336 uint8 spectrum_mode = 0;
7337 mtlk_handle_t hcore_data;
7339 res = _mtlk_df_user_pull_core_data(df_user->df, MTLK_CORE_REQ_GET_CORE_CFG, FALSE, (void**) &core_cfg, NULL, &hcore_data);
7341 MTLK_CFG_GET_ITEM(core_cfg, channel, channel);
7342 MTLK_CFG_GET_ITEM(core_cfg, bonding, bonding);
7343 MTLK_CFG_GET_ITEM(core_cfg, frequency_band_cur, frequency_band_cur);
7344 MTLK_CFG_GET_ITEM(core_cfg, spectrum_mode, spectrum_mode);
7346 len += snprintf(str, TEXT_SIZE, "%sGHz,%d,%dMHz",
7347 MTLK_HW_BAND_5_2_GHZ == frequency_band_cur ? "5.2" : "2.4",
7348 channel,
7349 spectrum_mode == SPECTRUM_20MHZ ? 20 : 40);
7351 if (spectrum_mode == SPECTRUM_40MHZ)
7352 len += snprintf(str + len, TEXT_SIZE - len, ALTERNATE_LOWER == bonding ? ",Lower" : ",Upper");
7354 _mtlk_df_user_free_core_data(df_user->df, hcore_data);
7355 } else { /* This is AP */
7356 mtlk_clpb_t *clpb = NULL;
7357 mtlk_core_ui_get_stadb_status_req_t get_stadb_status_req;
7359 get_stadb_status_req.get_hostdb = FALSE;
7360 get_stadb_status_req.use_cipher = TRUE;
7361 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_GET_STADB_STATUS, &clpb,
7362 &get_stadb_status_req, sizeof(get_stadb_status_req));
7363 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_STADB_STATUS, FALSE);
7364 if(MTLK_ERR_OK != res) {
7365 goto err_ret;
7368 while (NULL != (stadb_stat = mtlk_clpb_enum_get_next(clpb, &size))) {
7369 if ((sizeof(*stadb_stat) != size) || (STAT_ID_STADB != stadb_stat->type)) {
7370 res = MTLK_ERR_UNKNOWN;
7371 mtlk_clpb_delete(clpb);
7372 goto err_ret;
7373 } else {
7374 /* With 64 stas the total string may exceed 2046 bytes, so don't output too much here */
7375 len += snprintf(str + len, TEXT_SIZE - len, "\n" MAC_PRINTF_FMT, MAC_PRINTF_ARG(stadb_stat->u.general_stat.addr.au8Addr));
7377 if (len >= TEXT_SIZE)
7379 WLOG_V("Connection information truncated");
7380 len = TEXT_SIZE - 1;
7381 break;
7386 mtlk_clpb_delete(clpb);
7389 wrqu->data.length = len;
7391 err_ret:
7392 return _mtlk_df_mtlk_to_linux_error_code(res);
7395 /* Driver support only 40 bit and 104 bit length WEP keys.
7396 * Also, according to IEEE standard packet transmission
7397 * with zero-filled WEP key is not supported.
7399 static int
7400 mtlk_df_ui_validate_wep_key (uint8 *key, size_t length) {
7401 int i;
7402 ASSERT(key);
7404 /* Check key length */
7405 if ((length != MIB_WEP_KEY_WEP1_LENGTH) && /* 40 bit */
7406 (length != MIB_WEP_KEY_WEP2_LENGTH)) { /* 104 bit */
7407 return MTLK_ERR_PARAMS;
7410 /* Validate key's value. All-zero key value is invalid. */
7411 for (i = 0; i < length; i++)
7412 if (key[i])
7413 return MTLK_ERR_OK;
7415 return MTLK_ERR_PARAMS;
7418 int __MTLK_IFUNC
7419 mtlk_df_ui_linux_ioctl_setenc (struct net_device *dev,
7420 struct iw_request_info *info,
7421 union iwreq_data *wrqu,
7422 char *extra)
7424 int res = MTLK_ERR_NOT_HANDLED;
7425 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
7426 mtlk_clpb_t *clpb = NULL;
7427 mtlk_core_ui_enc_cfg_t enc_cfg;
7428 uint8 key_id;
7430 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
7432 memset(&enc_cfg, 0, sizeof(enc_cfg));
7434 /* Mark values as not specified */
7435 enc_cfg.wep_enabled = MAX_UINT8;
7436 enc_cfg.authentication = MAX_UINT8;
7437 enc_cfg.key_id = MAX_UINT8;
7439 if (wrqu->data.flags & IW_ENCODE_DISABLED) {
7440 /* Disable WEP encryption */
7441 enc_cfg.wep_enabled = FALSE;
7442 enc_cfg.authentication = MIB_AUTHENTICATION_OPEN_SYSTEM;
7444 } else if (wrqu->data.flags & IW_ENCODE_OPEN) {
7445 /* Open mode */
7446 enc_cfg.wep_enabled = TRUE;
7447 enc_cfg.authentication = MIB_AUTHENTICATION_OPEN_SYSTEM;
7449 } else if ((wrqu->data.flags & IW_ENCODE_OPEN) &&
7450 (wrqu->data.flags & IW_ENCODE_RESTRICTED)) {
7451 /* auto mode (on STA) */
7452 enc_cfg.wep_enabled = TRUE;
7453 enc_cfg.authentication = MIB_AUTHENTICATION_AUTO;
7455 } else if (wrqu->data.flags & IW_ENCODE_RESTRICTED) {
7456 /* Restricted mode */
7457 enc_cfg.wep_enabled = TRUE;
7458 enc_cfg.authentication = MIB_AUTHENTICATION_SHARED_KEY;
7461 /* Validate and adjust key index
7462 Up to 4 WEP keys supported. WE enumerate WEP keys from 1
7463 to N, and 0 means key not specified, current TX key will be used instead. */
7464 key_id = (uint8)(wrqu->data.flags & IW_ENCODE_INDEX);
7465 if (key_id != 0){
7466 if (MIB_WEP_N_DEFAULT_KEYS < key_id ) {
7467 WLOG_S("%s: Unsupported WEP key index", dev->name);
7468 res = MTLK_ERR_PARAMS;
7469 goto finish;
7471 enc_cfg.key_id = key_id - 1;
7474 /* Set WEP key */
7475 /* Validate key first */
7476 if (0 != wrqu->data.length){
7477 if (mtlk_df_ui_validate_wep_key(extra, wrqu->data.length) != MTLK_ERR_OK) {
7478 WLOG_S("%s: Bad WEP key", dev->name);
7479 res = MTLK_ERR_PARAMS;
7480 goto finish; /* res = -EINVAL */
7482 /* Only one key might be passed from OS. So, slot 0 is used */
7483 enc_cfg.wep_keys.sKey[0].u8KeyLength = wrqu->data.length;
7484 memcpy(enc_cfg.wep_keys.sKey[0].au8KeyData, extra, wrqu->data.length);
7487 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_SET_WEP_ENC_CFG,
7488 &clpb, (char*)&enc_cfg, sizeof(enc_cfg));
7489 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_SET_WEP_ENC_CFG, TRUE);
7490 if(MTLK_ERR_OK != res) {
7491 goto finish;
7494 finish:
7495 return _mtlk_df_mtlk_to_linux_error_code(res);
7498 int __MTLK_IFUNC
7499 mtlk_df_ui_linux_ioctl_getenc (struct net_device *dev,
7500 struct iw_request_info *info,
7501 union iwreq_data *wrqu,
7502 char *extra)
7504 int res = MTLK_ERR_NOT_HANDLED;
7505 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
7506 mtlk_clpb_t *clpb = NULL;
7507 mtlk_core_ui_enc_cfg_t *enc_cfg_res;
7508 uint32 size;
7509 uint8 key_index;
7511 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
7513 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_GET_WEP_ENC_CFG, &clpb, NULL, 0);
7514 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_WEP_ENC_CFG, FALSE);
7515 if(MTLK_ERR_OK != res) {
7516 goto finish;
7519 enc_cfg_res = mtlk_clpb_enum_get_next(clpb, &size);
7520 if ( (NULL == enc_cfg_res) || (sizeof(*enc_cfg_res) != size) ) {
7521 res = MTLK_ERR_UNKNOWN;
7522 goto delete_clpb;
7525 /* Validate key index */
7526 key_index = (uint8)(wrqu->data.flags & IW_ENCODE_INDEX);
7527 if (MIB_WEP_N_DEFAULT_KEYS < key_index ) {
7528 WLOG_S("%s: Unsupported WEP key index", dev->name);
7529 res = MTLK_ERR_PARAMS;
7530 goto delete_clpb;
7533 if (key_index != 0) {
7534 /* Report key only if key index is specified */
7535 key_index--;
7537 }else {
7538 /* Key index == 0 report current WEP configuration */
7539 wrqu->data.flags = 0;
7541 if (enc_cfg_res->wep_enabled) {
7542 wrqu->data.flags |= IW_ENCODE_ENABLED;
7543 /* Report access policy */
7544 if (MIB_AUTHENTICATION_SHARED_KEY == enc_cfg_res->authentication) {
7545 wrqu->data.flags |= IW_ENCODE_RESTRICTED;
7546 } else if (MIB_AUTHENTICATION_OPEN_SYSTEM == enc_cfg_res->authentication) {
7547 wrqu->data.flags |= IW_ENCODE_OPEN;
7548 } else if (MIB_AUTHENTICATION_AUTO == enc_cfg_res->authentication) {
7549 wrqu->data.flags |= IW_ENCODE_OPEN|IW_ENCODE_RESTRICTED;
7551 }else{
7552 wrqu->data.flags |= IW_ENCODE_DISABLED;
7555 wrqu->data.flags |= ((uint16)(enc_cfg_res->key_id + 1) & IW_ENCODE_INDEX);
7556 key_index = enc_cfg_res->key_id;
7559 /* Get requested key */
7560 wrqu->data.length = enc_cfg_res->wep_keys.sKey[key_index].u8KeyLength;
7561 memcpy(extra, enc_cfg_res->wep_keys.sKey[key_index].au8KeyData, wrqu->data.length);
7563 delete_clpb:
7564 mtlk_clpb_delete(clpb);
7565 finish:
7566 return _mtlk_df_mtlk_to_linux_error_code(res);
7569 int __MTLK_IFUNC
7570 mtlk_df_ui_linux_ioctl_setauth (struct net_device *dev,
7571 struct iw_request_info *info,
7572 union iwreq_data *wrqu,
7573 char *extra)
7575 int res = MTLK_ERR_OK;
7576 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
7577 mtlk_clpb_t *clpb = NULL;
7578 mtlk_core_ui_auth_cfg_t auth_cfg;
7580 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
7582 memset(&auth_cfg, 0, sizeof(auth_cfg));
7583 auth_cfg.wep_enabled = -1;
7584 auth_cfg.rsn_enabled = -1;
7585 auth_cfg.authentication = -1;
7587 ILOG2_SDD("%s: flags %i, value %i", dev->name, wrqu->param.flags, wrqu->param.value);
7589 switch (wrqu->param.flags & IW_AUTH_INDEX) {
7590 case IW_AUTH_WPA_VERSION:
7591 if ((wrqu->param.value & IW_AUTH_WPA_VERSION_WPA) ||
7592 (wrqu->param.value & IW_AUTH_WPA_VERSION_WPA2)) {
7593 auth_cfg.rsn_enabled = 1;
7595 break;
7597 case IW_AUTH_CIPHER_PAIRWISE:
7598 case IW_AUTH_CIPHER_GROUP:
7599 if (wrqu->param.value & (IW_AUTH_CIPHER_WEP40|IW_AUTH_CIPHER_WEP104)) {
7600 auth_cfg.wep_enabled = 1;
7601 } else {
7602 auth_cfg.wep_enabled = 0;
7604 break;
7607 case IW_AUTH_80211_AUTH_ALG:
7608 if ((wrqu->param.value & IW_AUTH_ALG_OPEN_SYSTEM) &&
7609 (wrqu->param.value & IW_AUTH_ALG_SHARED_KEY)) { /* automatic mode */
7610 auth_cfg.authentication = MIB_AUTHENTICATION_AUTO;
7611 } else if (wrqu->param.value & IW_AUTH_ALG_SHARED_KEY) {
7612 auth_cfg.authentication = MIB_AUTHENTICATION_SHARED_KEY;
7613 } else if (wrqu->param.value & IW_AUTH_ALG_OPEN_SYSTEM) {
7614 auth_cfg.authentication = MIB_AUTHENTICATION_OPEN_SYSTEM;
7615 } else {
7616 res = MTLK_ERR_PARAMS;
7618 break;
7620 case IW_AUTH_KEY_MGMT:
7621 case IW_AUTH_PRIVACY_INVOKED:
7622 case IW_AUTH_RX_UNENCRYPTED_EAPOL:
7623 case IW_AUTH_DROP_UNENCRYPTED:
7624 case IW_AUTH_TKIP_COUNTERMEASURES:
7625 case IW_AUTH_WPA_ENABLED:
7626 res = MTLK_ERR_NOT_HANDLED;
7627 break;
7629 default:
7630 res = MTLK_ERR_NOT_SUPPORTED;
7633 if (MTLK_ERR_NOT_SUPPORTED == res) {
7634 res = MTLK_ERR_OK;
7635 goto finish;
7636 } else if (MTLK_ERR_OK == res) {
7637 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_SET_AUTH_CFG,
7638 &clpb, (char*)&auth_cfg, sizeof(auth_cfg));
7639 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_SET_AUTH_CFG, TRUE);
7642 finish:
7643 return _mtlk_df_mtlk_to_linux_error_code(res);
7646 static int
7647 mtlk_df_ui_iw_cipher_encode2auth(int enc_cipher)
7649 switch (enc_cipher) {
7650 case IW_ENCODE_ALG_NONE:
7651 return IW_AUTH_CIPHER_NONE;
7652 case IW_ENCODE_ALG_WEP:
7653 return IW_AUTH_CIPHER_WEP40;
7654 case IW_ENCODE_ALG_TKIP:
7655 return IW_AUTH_CIPHER_TKIP;
7656 case IW_ENCODE_ALG_CCMP:
7657 return IW_AUTH_CIPHER_CCMP;
7658 default:
7659 return 0;
7663 int __MTLK_IFUNC
7664 mtlk_df_ui_linux_ioctl_getauth (struct net_device *dev,
7665 struct iw_request_info *info,
7666 struct iw_param *param,
7667 char *extra)
7669 int res = MTLK_ERR_NOT_HANDLED;
7670 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
7671 mtlk_clpb_t *clpb = NULL;
7672 mtlk_core_ui_auth_state_t *auth_state;
7673 uint32 size;
7675 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
7677 ILOG2_SDD("%s: flags %i, value %i", dev->name, param->flags, param->value);
7679 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_GET_AUTH_CFG, &clpb, NULL, 0);
7680 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_AUTH_CFG, FALSE);
7681 if (MTLK_ERR_OK != res) {
7682 goto finish;
7685 auth_state = mtlk_clpb_enum_get_next(clpb, &size);
7686 if ( (NULL == auth_state) || (sizeof(*auth_state) != size) ) {
7687 res = MTLK_ERR_UNKNOWN;
7688 goto delete_clpb;
7691 /* Fill result */
7693 param->value = 0;
7694 switch (param->flags & IW_AUTH_INDEX) {
7695 case IW_AUTH_WPA_VERSION:
7696 if (!auth_state->rsnie.au8RsnIe[0]) {
7697 res = MTLK_ERR_PARAMS;
7698 } else if (auth_state->rsnie.au8RsnIe[0] == RSN_INFO_ELEM) {
7699 param->value = IW_AUTH_WPA_VERSION_WPA2;
7700 } else if (auth_state->rsnie.au8RsnIe[0] == GENERIC_INFO_ELEM) {
7701 param->value = IW_AUTH_WPA_VERSION_WPA;
7703 break;
7705 case IW_AUTH_CIPHER_PAIRWISE:
7706 if (0 > auth_state->cipher_pairwise) {
7707 res = MTLK_ERR_NOT_SUPPORTED;
7708 } else {
7709 param->value = mtlk_df_ui_iw_cipher_encode2auth(auth_state->cipher_pairwise);
7711 break;
7713 case IW_AUTH_CIPHER_GROUP:
7714 if (!auth_state->group_cipher) {
7715 res = MTLK_ERR_PARAMS;
7716 } else {
7717 param->value = mtlk_df_ui_iw_cipher_encode2auth(auth_state->group_cipher);
7719 break;
7721 default:
7722 res = MTLK_ERR_NOT_SUPPORTED;
7725 delete_clpb:
7726 mtlk_clpb_delete(clpb);
7727 finish:
7728 return _mtlk_df_mtlk_to_linux_error_code(res);
7731 int __MTLK_IFUNC
7732 mtlk_df_ui_linux_ioctl_setgenie (struct net_device *dev,
7733 struct iw_request_info *info,
7734 struct iw_point *data,
7735 char *extra)
7737 int res = MTLK_ERR_PARAMS;
7738 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
7739 mtlk_clpb_t *clpb = NULL;
7740 mtlk_core_ui_genie_cfg_t genie_cfg;
7741 u8 *ie = (u8 *)extra;
7742 u8 *oui = ie +2;
7743 u8 wpa_oui[] = {0x00, 0x50, 0xf2, 0x01};
7744 u8 wps_oui[] = {0x00, 0x50, 0xf2, 0x04};
7745 int ie_len = data->length;
7747 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
7749 memset(&genie_cfg, 0, sizeof(genie_cfg));
7750 ILOG2_SDD("%s: IE %i, length %i", dev->name, ie ? ie[0] : 0, ie_len);
7752 if ((0 != ie_len) && (NULL == ie)) {
7753 goto finish;
7756 if ( (NULL != ie) && (0 != ie_len) && (GENERIC_INFO_ELEM == ie[0]) &&
7757 (0 != memcmp(oui, wpa_oui, sizeof(wpa_oui)) ) ) {
7758 ILOG2_D("WPS IE, type %i", data->flags);
7759 mtlk_dump(3, ie, ie_len, "dump of WPS IE:");
7760 // Set wps_in_progress flag. In AP mode parse WPS IE
7761 // and check Selected Registrar attribute. In STA mode
7762 // it is enough to check that WPS IE is not zero.
7763 if (mtlk_df_is_ap(df_user->df)) { /* AP */
7764 /* Parse WPS IE and */
7765 u8 *p = ie;
7766 /* Go to WPS OUI */
7767 while (memcmp(oui, wps_oui, sizeof(wps_oui)) != 0) {
7768 p += p[1] + 2;
7769 if (p >= ie+ie_len) {
7770 WLOG_V("WPS OUI was not found");
7771 goto finish;
7773 oui = p + 2;
7775 p = oui + sizeof(wps_oui);
7776 MTLK_CFG_SET_ITEM(&genie_cfg, wps_in_progress, 0);
7778 while (p < ie+ie_len) {
7779 ILOG2_D("WPS IE, attr %04x", ntohs(*(uint16*)p));
7780 if (ntohs(get_unaligned((uint16*)p)) == 0x1041) { // Selected Registrar
7781 if (p[4] == 1) {
7782 MTLK_CFG_SET_ITEM(&genie_cfg, wps_in_progress, 1);
7784 break;
7786 p += 4 + ntohs(get_unaligned((uint16*)(p+2))); // Go to next attribute
7788 } else { /* STA */
7789 MTLK_CFG_SET_ITEM(&genie_cfg, rsnie_reset, 1);
7790 MTLK_CFG_SET_ITEM(&genie_cfg, wps_in_progress, 1);
7793 if (sizeof(genie_cfg.gen_ie) < ie_len) {
7794 WLOG_V("WPS gen ie invalid length");
7795 goto finish;
7798 MTLK_CFG_SET_ITEM(&genie_cfg, gen_ie_set, 1);
7799 MTLK_CFG_SET_ITEM(&genie_cfg, gen_ie_type, data->flags);
7800 MTLK_CFG_SET_ITEM(&genie_cfg, gen_ie_len, ie_len);
7801 MTLK_CFG_SET_ITEM_BY_FUNC_VOID(&genie_cfg, gen_ie, memcpy,
7802 (genie_cfg.gen_ie, ie, ie_len));
7804 goto configure;
7807 if (sizeof(UMI_RSN_IE) < ie_len ) {
7808 WLOG_DD("invalid RSN IE length (%i > %i)", ie_len, (int)sizeof(UMI_RSN_IE));
7809 goto finish;
7812 MTLK_CFG_SET_ITEM(&genie_cfg, rsn_enabled, 0);
7814 if (ie_len) {
7815 MTLK_CFG_SET_ITEM_BY_FUNC_VOID(&genie_cfg, rsnie, memcpy, (&genie_cfg.rsnie, ie, ie_len));
7816 mtlk_dump(2, ie, ie_len, "dump of rsnie:");
7818 if (mtlk_df_is_ap(df_user->df) &&
7819 (ie[0] == GENERIC_INFO_ELEM || ie[0] == RSN_INFO_ELEM)) {
7820 MTLK_CFG_SET_ITEM(&genie_cfg, rsn_enabled, 1);
7823 } else { /* reset WPS IE case */
7825 // Note: in WPS mode data->flags represents the type of
7826 // WPS IE (for beacons, probe responces or probe reqs).
7827 // In STA mode flags == 1 (probe reqs type). So we
7828 // check it to avoid collisions with WPA IE reset.
7830 MTLK_CFG_SET_ITEM(&genie_cfg, rsnie_reset, 1);
7831 #ifdef MTCFG_HOSTAP_06
7832 if (!mtlk_df_is_ap(df_user->df))
7833 #else
7834 if (!mtlk_df_is_ap(df_user->df) && data->flags)
7835 #endif
7837 MTLK_CFG_SET_ITEM(&genie_cfg, wps_in_progress, 0);
7840 MTLK_CFG_SET_ITEM(&genie_cfg, gen_ie_set, 1);
7841 MTLK_CFG_SET_ITEM(&genie_cfg, gen_ie_type, data->flags);
7842 MTLK_CFG_SET_ITEM(&genie_cfg, gen_ie_len, ie_len);
7843 MTLK_CFG_SET_ITEM_BY_FUNC_VOID(&genie_cfg, gen_ie, memcpy,
7844 (genie_cfg.gen_ie, ie, ie_len));
7847 configure:
7848 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_SET_GENIE_CFG,
7849 &clpb, (char*)&genie_cfg, sizeof(genie_cfg));
7850 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_SET_GENIE_CFG, TRUE);
7852 finish:
7853 return _mtlk_df_mtlk_to_linux_error_code(res);
7857 int __MTLK_IFUNC
7858 mtlk_df_ui_linux_ioctl_getencext (struct net_device *dev,
7859 struct iw_request_info *info,
7860 struct iw_point *encoding,
7861 char *extra)
7864 int res = MTLK_ERR_PARAMS;
7865 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
7866 mtlk_clpb_t *clpb = NULL;
7867 uint32 size;
7868 UMI_GROUP_PN *umi_gpn;
7869 struct iw_encode_ext *ext = NULL;
7871 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
7873 ext = (struct iw_encode_ext *)extra;
7874 if (ext == NULL)
7875 goto finish;
7877 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_GET_ENCEXT_CFG, &clpb, NULL, 0);
7878 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_ENCEXT_CFG, FALSE);
7879 if (MTLK_ERR_OK != res) {
7880 goto finish;
7883 umi_gpn = mtlk_clpb_enum_get_next(clpb, &size);
7884 if ( (NULL == umi_gpn) || (sizeof(*umi_gpn) != size) ) {
7885 res = MTLK_ERR_UNKNOWN;
7886 goto delete_clpb;
7889 /* Set kernel's iwp->length here in order to prevent it to be equal to max_tokens,
7890 which leads to the errornous situation after this handler is called.
7891 TODO: check all other getters implementation. */
7892 encoding->length= sizeof(*ext);
7894 memcpy(ext->rx_seq, umi_gpn->au8TxSeqNum, 6);
7895 ILOG2_DDDDDD("RSC: %02x%02x%02x%02x%02x%02x",
7896 ext->rx_seq[0], ext->rx_seq[1], ext->rx_seq[2],
7897 ext->rx_seq[3], ext->rx_seq[4], ext->rx_seq[5]);
7899 delete_clpb:
7900 mtlk_clpb_delete(clpb);
7901 finish:
7902 return _mtlk_df_mtlk_to_linux_error_code(res);
7905 int __MTLK_IFUNC
7906 mtlk_df_ui_linux_ioctl_setencext (struct net_device *dev,
7907 struct iw_request_info *info,
7908 struct iw_point *encoding,
7909 char *extra)
7911 int res = MTLK_ERR_PARAMS;
7912 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
7913 mtlk_clpb_t *clpb = NULL;
7914 struct iw_encode_ext *ext = NULL;
7915 mtlk_core_ui_encext_cfg_t encext_cfg;
7916 uint16 key_idx, key_len;
7918 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
7920 ext = (struct iw_encode_ext *)extra;
7921 if (ext == NULL) {
7922 WLOG_S("%s: extra parameter expected", dev->name);
7923 goto finish;
7926 memset(&encext_cfg, 0, sizeof(encext_cfg));
7927 ILOG2_DDD("alg %04x, enc flags %04x, ext flags %08x", ext->alg, encoding->flags, ext->ext_flags);
7929 /* Determine and validate the encoding algorithm */
7930 if (encoding->flags & IW_ENCODE_DISABLED)
7931 ext->alg = IW_ENCODE_ALG_NONE;
7932 switch (ext->alg) {
7933 case IW_ENCODE_ALG_NONE:
7934 /* IW_ENCODE_ALG_NONE - reset keys */
7935 MTLK_CFG_SET_ITEM(&encext_cfg, wep_enabled, 0);
7936 break;
7937 case IW_ENCODE_ALG_WEP:
7938 MTLK_CFG_SET_ITEM(&encext_cfg, wep_enabled, 1);
7939 break;
7940 case IW_ENCODE_ALG_TKIP:
7941 break;
7942 case IW_ENCODE_ALG_CCMP:
7943 break;
7944 case IW_ENCODE_ALG_AES_CMAC:
7945 break;
7946 default:
7947 WLOG_SD("%s: Unsupported encoding algorithm type (%u)", dev->name, ext->alg);
7948 res = MTLK_ERR_NOT_SUPPORTED;
7949 goto finish;
7951 ILOG2_D("alg: type (%u)", ext->alg);
7952 MTLK_CFG_SET_ITEM(&encext_cfg, alg_type, ext->alg);
7954 pr_info("alg: %u\n", ext->alg);
7956 /* Determine and validate the key index */
7957 key_idx = (encoding->flags & IW_ENCODE_INDEX);
7958 if (ext->alg == IW_ENCODE_ALG_NONE) {
7959 #ifndef MTCFG_SUPORT_IW_ENCODE_ALG_NONE
7960 /* Because FW not support IW_ENCODE_ALG_NONE, just return MTLK_ERR_OK.*/
7961 res = MTLK_ERR_OK;
7962 goto finish;
7963 #else
7964 /* Clear keys */
7965 if ((UMI_RSN_IGTK_GM_KEY_INDEX != key_idx) &&
7966 (UMI_RSN_IGTK_GN_KEY_INDEX != key_idx) &&
7967 (MIB_WEP_N_DEFAULT_KEYS < key_idx )) {
7968 WLOG_SD("%s: Invalid key index (%u)", dev->name, key_idx);
7969 goto finish;
7971 #endif
7972 } else if (ext->alg == IW_ENCODE_ALG_AES_CMAC) {
7973 /* Set IGTK keys */
7974 if(key_idx != UMI_RSN_IGTK_GM_KEY_INDEX &&
7975 key_idx != UMI_RSN_IGTK_GN_KEY_INDEX) {
7976 WLOG_SD("%s: Invalid IGTK key index (%u)", dev->name, key_idx);
7977 goto finish;
7979 } else {
7980 /* Set normal keys */
7981 if (MIB_WEP_N_DEFAULT_KEYS < key_idx ) {
7982 WLOG_SD("%s: Invalid WEP key index (%u)", dev->name, key_idx);
7983 goto finish;
7986 if (0 != key_idx) {
7987 key_idx--;
7989 ILOG2_D("key: key_idx (%u)", key_idx);
7990 MTLK_CFG_SET_ITEM(&encext_cfg, key_idx, key_idx);
7992 /* Set default key index unless setting PMF IGTK key (index 4, 5) */
7993 if ((ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) && (key_idx < MIB_WEP_N_DEFAULT_KEYS)) {
7994 MTLK_CFG_SET_ITEM(&encext_cfg, default_key_idx, key_idx);
7995 ILOG2_D("key: default_key_idx (%u)", key_idx);
7998 /* Determine and validate the STA ether address */
7999 MTLK_CFG_SET_ITEM_BY_FUNC(&encext_cfg, sta_addr,
8000 _mtlk_df_user_fill_ether_address, (&encext_cfg.sta_addr, &ext->addr), res);
8001 if (MTLK_ERR_OK != res) {
8002 WLOG_SY("%s: Invalid address (%Y)", dev->name, ext->addr.sa_data);
8003 goto finish;
8005 ILOG2_Y("%Y", ext->addr.sa_data);
8007 /* Determine and validate the key length */
8008 key_len = 0;
8009 if (ext->ext_flags & (IW_ENCODE_EXT_SET_TX_KEY|IW_ENCODE_EXT_GROUP_KEY)) {
8010 key_len = ext->key_len;
8012 if ( (IW_ENCODE_ALG_WEP == ext->alg) || (IW_ENCODE_ALG_NONE == ext->alg) )
8014 if ((0 < key_len) && (key_len != MIB_WEP_KEY_WEP1_LENGTH) && (key_len != MIB_WEP_KEY_WEP2_LENGTH)) {
8015 WLOG_SD("%s: Invalid WEP key length (%u)", dev->name, key_len);
8016 res = MTLK_ERR_PARAMS;
8017 goto finish;
8020 /* Prevent setting all-zero WEP key */
8021 if ((IW_ENCODE_ALG_WEP == ext->alg) &&
8022 (0 < key_len) &&
8023 (mtlk_df_ui_validate_wep_key(ext->key, key_len) != MTLK_ERR_OK)) {
8024 WLOG_S("%s: Invalid WEP key", dev->name);
8025 res = MTLK_ERR_PARAMS;
8026 goto finish;
8030 if ((UMI_RSN_TK1_LEN + UMI_RSN_TK2_LEN) < key_len) {
8031 WLOG_SD("%s: Invalid key length (%u)", dev->name, key_len);
8032 key_len = UMI_RSN_TK1_LEN + UMI_RSN_TK2_LEN;
8035 MTLK_CFG_SET_ITEM(&encext_cfg, key_len, key_len);
8036 ILOG2_D("key: key_len (%u)", key_len);
8038 /* Determine and validate the key */
8039 if (key_len) {
8040 MTLK_CFG_SET_ITEM_BY_FUNC_VOID(&encext_cfg, key, memcpy,
8041 (encext_cfg.key, ext->key, key_len));
8042 mtlk_dump(2, ext->key, key_len, "KEY:");
8045 /* Determine and validate the RX seq */
8046 if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) {
8047 MTLK_CFG_SET_ITEM_BY_FUNC_VOID(&encext_cfg, rx_seq, memcpy,
8048 (encext_cfg.rx_seq, ext->rx_seq, 6));
8049 mtlk_dump(2, ext->rx_seq, 6, "group RSC");
8052 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_SET_ENCEXT_CFG,
8053 &clpb, (char*)&encext_cfg, sizeof(encext_cfg));
8054 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_SET_ENCEXT_CFG, TRUE);
8056 finish:
8057 return _mtlk_df_mtlk_to_linux_error_code(res);
8060 struct iw_statistics* __MTLK_IFUNC
8061 mtlk_df_ui_linux_ioctl_get_iw_stats (struct net_device *dev)
8063 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
8064 mtlk_core_general_stats_t *general_stats;
8066 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
8068 /* Get Core general information from DF buffer and don't call Core */
8069 general_stats = &df_user->slow_ctx->core_general_stats;
8071 df_user->slow_ctx->iw_stats.status = general_stats->net_state;
8072 df_user->slow_ctx->iw_stats.discard.nwid = general_stats->core_priv_stats.discard_nwi;
8073 df_user->slow_ctx->iw_stats.miss.beacon = general_stats->core_priv_stats.missed_beacon;
8075 if (!mtlk_df_is_ap(df_user->df) && (mtlk_core_net_state_is_connected(general_stats->net_state))) {
8077 df_user->slow_ctx->iw_stats.qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
8078 df_user->slow_ctx->iw_stats.qual.noise = general_stats->noise;
8079 df_user->slow_ctx->iw_stats.qual.level = general_stats->max_rssi;
8080 df_user->slow_ctx->iw_stats.qual.qual =
8081 _mtlk_df_ui_calc_signal_strength(MTLK_NORMALIZED_RSSI(general_stats->max_rssi));
8084 df_user->slow_ctx->iw_stats.discard.fragment = general_stats->mac_stat.stat[STAT_FRAGMENT_FAILED];
8085 df_user->slow_ctx->iw_stats.discard.retries = general_stats->mac_stat.stat[STAT_TX_MAX_RETRY];
8086 df_user->slow_ctx->iw_stats.discard.code =
8087 + general_stats->mac_stat.stat[STAT_WEP_UNDECRYPTABLE]
8088 + general_stats->mac_stat.stat[STAT_WEP_ICV_ERROR]
8089 + general_stats->mac_stat.stat[STAT_WEP_EXCLUDED]
8090 + general_stats->mac_stat.stat[STAT_DECRYPTION_FAILED];
8091 df_user->slow_ctx->iw_stats.discard.misc =
8092 + general_stats->mac_stat.stat[STAT_RX_DISCARD]
8093 + general_stats->mac_stat.stat[STAT_TX_FAIL]
8094 - df_user->slow_ctx->iw_stats.discard.code
8095 - df_user->slow_ctx->iw_stats.discard.retries;
8097 return &df_user->slow_ctx->iw_stats;
8101 typedef int (*mtlk_df_ui_cfg_handler_f)(mtlk_df_user_t* df_user, uint32 subcmd, char* data, uint16* length);
8103 static int
8104 _mtlk_df_ui_execute_cfg_handler(mtlk_df_ui_cfg_handler_f *cfg_handlers_tbl,
8105 mtlk_df_user_t* df_user,
8106 uint32 subcmd_id,
8107 char* value,
8108 uint16* length)
8110 int result = MTLK_ERR_NOT_HANDLED;
8111 ILOG2_D("IWPRIV #0x%04x being processed", subcmd_id);
8113 while ((NULL != *cfg_handlers_tbl) && (MTLK_ERR_NOT_HANDLED == result)) {
8114 result = (*cfg_handlers_tbl++)(df_user, subcmd_id, value, length);
8117 MTLK_ASSERT(MTLK_ERR_NOT_HANDLED != result);
8118 ILOG2_D("IWPRIV #0x%04x processing done", subcmd_id);
8120 return result;
8123 static mtlk_df_ui_cfg_handler_f _mtlk_df_ui_cfg_getters_tbl[] =
8125 #ifdef MTCFG_IRB_DEBUG
8126 _mtlk_df_user_irb_pinger_int_get_cfg,
8127 #endif
8128 #ifdef MTLK_HAVE_PPA
8129 _mtlk_df_user_ppa_directpath_int_get_cfg,
8130 #endif
8131 #ifdef MTCFG_USE_GENL
8132 _mtlk_df_user_genl_int_get_cfg,
8133 #endif
8134 _mtlk_df_user_iwpriv_get_core_param,
8135 NULL
8138 static mtlk_df_ui_cfg_handler_f _mtlk_df_ui_cfg_setters_tbl[] =
8140 #ifdef MTCFG_IRB_DEBUG
8141 _mtlk_df_user_irb_pinger_int_set_cfg,
8142 #endif
8143 #ifdef MTLK_HAVE_PPA
8144 _mtlk_df_user_ppa_directpath_int_set_cfg,
8145 #endif
8146 _mtlk_df_user_iwpriv_set_core_param,
8147 NULL,
8151 int __MTLK_IFUNC
8152 mtlk_df_ui_linux_ioctl_get_int (struct net_device *dev,
8153 struct iw_request_info *info,
8154 union iwreq_data *wrqu,
8155 char *extra)
8157 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
8158 int res = _mtlk_df_ui_execute_cfg_handler(_mtlk_df_ui_cfg_getters_tbl,
8159 df_user, wrqu->mode, extra, NULL);
8160 return _mtlk_df_mtlk_to_linux_error_code(res);
8163 int __MTLK_IFUNC
8164 mtlk_df_ui_linux_ioctl_set_int (struct net_device *dev,
8165 struct iw_request_info *info,
8166 union iwreq_data *wrqu,
8167 char *extra)
8169 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
8170 int res = _mtlk_df_ui_execute_cfg_handler(_mtlk_df_ui_cfg_setters_tbl,
8171 df_user, wrqu->mode, extra + sizeof(uint32), NULL);
8172 return _mtlk_df_mtlk_to_linux_error_code(res);
8175 int __MTLK_IFUNC
8176 mtlk_df_ui_linux_ioctl_get_text (struct net_device *dev,
8177 struct iw_request_info *info,
8178 union iwreq_data *wrqu,
8179 char *extra)
8181 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
8182 int res = _mtlk_df_ui_execute_cfg_handler(_mtlk_df_ui_cfg_getters_tbl,
8183 df_user, wrqu->data.flags, extra, &wrqu->data.length);
8184 return _mtlk_df_mtlk_to_linux_error_code(res);
8187 int __MTLK_IFUNC
8188 mtlk_df_ui_linux_ioctl_set_text (struct net_device *dev,
8189 struct iw_request_info *info,
8190 union iwreq_data *wrqu,
8191 char *extra)
8193 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
8194 int res = _mtlk_df_ui_execute_cfg_handler(_mtlk_df_ui_cfg_setters_tbl,
8195 df_user, wrqu->data.flags, extra, &wrqu->data.length);
8196 return _mtlk_df_mtlk_to_linux_error_code(res);
8199 int __MTLK_IFUNC
8200 mtlk_df_ui_linux_ioctl_get_intvec (struct net_device *dev,
8201 struct iw_request_info *info,
8202 union iwreq_data *wrqu,
8203 char *extra)
8205 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
8206 int res = _mtlk_df_ui_execute_cfg_handler(_mtlk_df_ui_cfg_getters_tbl,
8207 df_user, wrqu->data.flags, extra, &wrqu->data.length);
8208 return _mtlk_df_mtlk_to_linux_error_code(res);
8211 int __MTLK_IFUNC
8212 mtlk_df_ui_linux_ioctl_set_intvec (struct net_device *dev,
8213 struct iw_request_info *info,
8214 union iwreq_data *wrqu,
8215 char *extra)
8217 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
8218 int res = _mtlk_df_ui_execute_cfg_handler(_mtlk_df_ui_cfg_setters_tbl,
8219 df_user, wrqu->data.flags, extra, &wrqu->data.length);
8220 return _mtlk_df_mtlk_to_linux_error_code(res);
8223 int __MTLK_IFUNC
8224 mtlk_df_ui_linux_ioctl_get_addr (struct net_device *dev,
8225 struct iw_request_info *info,
8226 union iwreq_data *wrqu,
8227 char *extra)
8229 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
8230 int res = _mtlk_df_ui_execute_cfg_handler(_mtlk_df_ui_cfg_getters_tbl,
8231 df_user, wrqu->mode, extra, NULL);
8232 return _mtlk_df_mtlk_to_linux_error_code(res);
8235 int __MTLK_IFUNC
8236 mtlk_df_ui_linux_ioctl_set_addr (struct net_device *dev,
8237 struct iw_request_info *info,
8238 union iwreq_data *wrqu,
8239 char *extra)
8241 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
8242 int res = _mtlk_df_ui_execute_cfg_handler(_mtlk_df_ui_cfg_setters_tbl,
8243 df_user, wrqu->data.flags, extra, NULL);
8244 return _mtlk_df_mtlk_to_linux_error_code(res);
8247 int __MTLK_IFUNC
8248 mtlk_df_ui_linux_ioctl_get_addrvec (struct net_device *dev,
8249 struct iw_request_info *info,
8250 union iwreq_data *wrqu,
8251 char *extra)
8253 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
8254 int res = _mtlk_df_ui_execute_cfg_handler(_mtlk_df_ui_cfg_getters_tbl,
8255 df_user, wrqu->data.flags, extra, &wrqu->data.length);
8256 return _mtlk_df_mtlk_to_linux_error_code(res);
8259 int __MTLK_IFUNC
8260 mtlk_df_ui_linux_ioctl_set_addrvec (struct net_device *dev,
8261 struct iw_request_info *info,
8262 union iwreq_data *wrqu,
8263 char *extra)
8265 int res;
8267 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
8269 res = _mtlk_df_ui_execute_cfg_handler(_mtlk_df_ui_cfg_setters_tbl,
8270 df_user, wrqu->data.flags, extra, &wrqu->data.length);
8271 return _mtlk_df_mtlk_to_linux_error_code(res);
8274 static void
8275 _mtlk_df_user_cleanup(mtlk_df_user_t *df_user)
8277 int i;
8278 int res = 0;
8279 mtlk_card_type_t card_type = MTLK_CARD_UNKNOWN;
8280 mtlk_vap_handle_t vap;
8282 MTLK_CLEANUP_BEGIN(df_user, MTLK_OBJ_PTR(df_user))
8283 for (i = 0; MTLK_CLEANUP_ITERATONS_LEFT(MTLK_OBJ_PTR(df_user), FW_HANG_EVTs) > 0; i++) {
8284 MTLK_CLEANUP_STEP_LOOP(df_user, FW_HANG_EVTs, MTLK_OBJ_PTR(df_user),
8285 mtlk_osal_event_cleanup, (&df_user->fw_hang_evts[i]));
8288 vap = mtlk_df_get_vap_handle(df_user->df);
8289 res = mtlk_vap_get_hw_vft(vap)->get_prop(vap, MTLK_HW_PROP_CARD_TYPE,
8290 &card_type, sizeof(&card_type));
8291 MTLK_ASSERT(MTLK_ERR_OK == res);
8292 CARD_SELECTOR_START(card_type)
8293 IF_CARD_G3 (
8294 for (i = 0; MTLK_CLEANUP_ITERATONS_LEFT(MTLK_OBJ_PTR(df_user), PROC_CARD_INIT) > 0; i++) {
8295 MTLK_CLEANUP_STEP_LOOP(df_user, PROC_CARD_INIT, MTLK_OBJ_PTR(df_user),
8296 _proc_management_pci_pcie_handlers[i].on_unregister, (df_user));
8299 IF_CARD_AHBG35 (
8300 for (i = 0; MTLK_CLEANUP_ITERATONS_LEFT(MTLK_OBJ_PTR(df_user), PROC_CARD_INIT) > 0; i++) {
8301 MTLK_CLEANUP_STEP_LOOP(df_user, PROC_CARD_INIT, MTLK_OBJ_PTR(df_user),
8302 _proc_management_ahb_handlers[i].on_unregister, (df_user));
8305 CARD_SELECTOR_END();
8307 for (i = 0; MTLK_CLEANUP_ITERATONS_LEFT(MTLK_OBJ_PTR(df_user), PROC_INIT) > 0; i++)
8309 MTLK_CLEANUP_STEP_LOOP(df_user, PROC_INIT, MTLK_OBJ_PTR(df_user),
8310 _proc_management_handlers[i].on_unregister, (df_user));
8312 #ifdef MTCFG_IRB_DEBUG
8313 MTLK_CLEANUP_STEP(df_user, IRB_PINGER_INIT, MTLK_OBJ_PTR(df_user),
8314 mtlk_irb_pinger_cleanup,
8315 (&df_user->slow_ctx->pinger));
8316 #endif /* MTCFG_IRB_DEBUG */
8318 MTLK_CLEANUP_STEP(df_user, STAT_TIMER, MTLK_OBJ_PTR(df_user),
8319 mtlk_osal_timer_cleanup, (&df_user->slow_ctx->stat_timer));
8320 MTLK_CLEANUP_STEP(df_user, CREATE_DEBUG_DIR, MTLK_OBJ_PTR(df_user),
8321 _mtlk_df_ui_delete_debug_dir, (df_user));
8322 MTLK_CLEANUP_STEP(df_user, CREATE_CARD_DIR, MTLK_OBJ_PTR(df_user),
8323 _mtlk_df_ui_delete_card_dir, (df_user));
8324 MTLK_CLEANUP_STEP(df_user, ALLOC_NAME, MTLK_OBJ_PTR(df_user),
8325 MTLK_NOACTION, ());
8326 MTLK_CLEANUP_STEP(df_user, DEBUG_BCL, MTLK_OBJ_PTR(df_user),
8327 mtlk_df_debug_bcl_cleanup, (df_user));
8328 MTLK_CLEANUP_STEP(df_user, ALLOC_SLOW_CTX, MTLK_OBJ_PTR(df_user),
8329 mtlk_osal_mem_free, (df_user->slow_ctx));
8330 MTLK_CLEANUP_END(df_user, MTLK_OBJ_PTR(df_user));
8333 static int
8334 _mtlk_df_user_alloc_devname(mtlk_df_user_t *df_user)
8336 int res;
8337 char ndev_name_pattern[IFNAMSIZ];
8339 if (mtlk_df_is_slave(df_user->df)) {
8340 mtlk_df_t *master_df = mtlk_vap_manager_get_master_df(
8341 mtlk_df_get_vap_manager(df_user->df));
8343 MTLK_ASSERT(master_df != NULL);
8344 sprintf(ndev_name_pattern, "%s.%d", mtlk_df_user_get_name(mtlk_df_get_user(master_df)), mtlk_vap_get_id(mtlk_df_get_vap_handle(df_user->df))-1);
8346 else {
8347 strcpy(ndev_name_pattern, MTLK_NDEV_NAME "%d");
8350 ILOG0_S("NDEV Name pattern: %s", ndev_name_pattern);
8352 if (mtlk_df_is_slave(df_user->df)) {
8353 res = dev_alloc_name(df_user->dev, ndev_name_pattern);
8354 } else {
8355 rtnl_lock();
8356 res = dev_alloc_name(df_user->dev, ndev_name_pattern);
8357 rtnl_unlock();
8359 if (res < 0) {
8360 res = MTLK_ERR_NO_RESOURCES;
8362 else {
8363 res = MTLK_ERR_OK;
8366 return res;
8369 static int
8370 _mtlk_df_user_init(mtlk_df_user_t *df_user,
8371 mtlk_df_t *df,
8372 struct net_device *dev)
8374 /* NEW APPROACH: Now the Net Device name is allocated on DF UI initialization in assumption
8375 * that no one else will register the same device name.
8376 * - DF infrastructure (proc_fs dirrectories) has been created here.
8377 * This approach allows Core to register abilities correctly before Net Device registration.
8379 int i;
8380 int res = 0;
8381 mtlk_card_type_t card_type = MTLK_CARD_UNKNOWN;
8382 mtlk_vap_handle_t vap;
8384 MTLK_INIT_TRY(df_user, MTLK_OBJ_PTR(df_user))
8385 df_user->df = df;
8386 df_user->dev = dev;
8387 MTLK_INIT_STEP_EX(df_user, ALLOC_SLOW_CTX, MTLK_OBJ_PTR(df_user),
8388 mtlk_osal_mem_alloc, (sizeof(*df_user->slow_ctx), MTLK_MEM_TAG_DF_SLOW),
8389 df_user->slow_ctx, NULL != df_user->slow_ctx, MTLK_ERR_NO_MEM);
8391 memset(&df_user->slow_ctx->linux_stats, 0,
8392 sizeof(df_user->slow_ctx->linux_stats));
8393 memset(&df_user->slow_ctx->iw_stats, 0,
8394 sizeof(df_user->slow_ctx->iw_stats));
8395 memset(&df_user->slow_ctx->core_general_stats, 0,
8396 sizeof(df_user->slow_ctx->core_general_stats));
8398 MTLK_INIT_STEP(df_user, DEBUG_BCL, MTLK_OBJ_PTR(df_user), mtlk_df_debug_bcl_init, (df_user));
8400 MTLK_INIT_STEP(df_user, ALLOC_NAME, MTLK_OBJ_PTR(df_user), _mtlk_df_user_alloc_devname, (df_user));
8402 MTLK_INIT_STEP(df_user, CREATE_CARD_DIR, MTLK_OBJ_PTR(df_user),
8403 _mtlk_df_ui_create_card_dir, (df_user));
8405 MTLK_INIT_STEP(df_user, CREATE_DEBUG_DIR, MTLK_OBJ_PTR(df_user),
8406 _mtlk_df_ui_create_debug_dir, (df_user));
8408 MTLK_INIT_STEP(df_user, STAT_TIMER, MTLK_OBJ_PTR(df_user),
8409 mtlk_osal_timer_init,
8410 (&df_user->slow_ctx->stat_timer, _mtlk_df_poll_stats, HANDLE_T(df_user)));
8412 _mtlk_df_user_fill_callbacks(df_user);
8414 #ifdef MTCFG_IRB_DEBUG
8415 /* TODO: GS: It's used ROOT IRB ??? Allow it only for MASTER??*/
8416 MTLK_INIT_STEP(df_user, IRB_PINGER_INIT, MTLK_OBJ_PTR(df_user),
8417 mtlk_irb_pinger_init,
8418 (&df_user->slow_ctx->pinger, mtlk_irbd_get_root()));
8419 #endif /*MTCFG_IRB_DEBUG*/
8421 for (i = 0; i < ARRAY_SIZE(_proc_management_handlers); i++) {
8422 MTLK_INIT_STEP_LOOP(df_user, PROC_INIT, MTLK_OBJ_PTR(df_user),
8423 _proc_management_handlers[i].on_register, (df_user));
8426 vap = mtlk_df_get_vap_handle(df_user->df);
8427 res = mtlk_vap_get_hw_vft(vap)->get_prop(vap, MTLK_HW_PROP_CARD_TYPE,
8428 &card_type, sizeof(&card_type));
8430 MTLK_ASSERT(MTLK_ERR_OK == res);
8431 CARD_SELECTOR_START(card_type)
8432 IF_CARD_G3 (
8433 for (i = 0; i < ARRAY_SIZE(_proc_management_pci_pcie_handlers); i++) {
8434 MTLK_INIT_STEP_LOOP(df_user, PROC_CARD_INIT, MTLK_OBJ_PTR(df_user),
8435 _proc_management_pci_pcie_handlers[i].on_register, (df_user));
8438 IF_CARD_AHBG35 (
8439 for (i = 0; i < ARRAY_SIZE(_proc_management_ahb_handlers); i++) {
8440 MTLK_INIT_STEP_LOOP(df_user, PROC_CARD_INIT, MTLK_OBJ_PTR(df_user),
8441 _proc_management_ahb_handlers[i].on_register, (df_user));
8444 CARD_SELECTOR_END();
8446 for (i = 0; i < ARRAY_SIZE(df_user->fw_hang_evts); i++) {
8447 MTLK_INIT_STEP_LOOP(df_user, FW_HANG_EVTs, MTLK_OBJ_PTR(df_user),
8448 mtlk_osal_event_init, (&df_user->fw_hang_evts[i]));
8451 MTLK_INIT_FINALLY(df_user, MTLK_OBJ_PTR(df_user))
8452 MTLK_INIT_RETURN(df_user, MTLK_OBJ_PTR(df_user), _mtlk_df_user_cleanup, (df_user))
8455 mtlk_df_user_t*
8456 mtlk_df_user_create(mtlk_df_t *df)
8458 struct net_device *dev = alloc_etherdev(sizeof(mtlk_df_user_t));
8459 mtlk_df_user_t* df_user;
8461 if(NULL == dev)
8463 ELOG_V("Failed to allocate network device");
8464 return NULL;
8467 df_user = netdev_priv(dev);
8469 if(MTLK_ERR_OK != _mtlk_df_user_init(df_user, df, dev))
8471 free_netdev(dev);
8472 return NULL;
8475 return df_user;
8478 void
8479 mtlk_df_user_delete(mtlk_df_user_t* df_user)
8481 struct net_device* dev = df_user->dev;
8483 _mtlk_df_user_cleanup(df_user);
8484 //TODO destructor removed in kernel
8485 // if (dev && !dev->destructor) {
8486 if (dev) {
8487 free_netdev(dev);
8491 /******************************************************************************************
8492 * BCL debugging interface implementation
8493 ******************************************************************************************/
8494 /* TODO: add packing
8495 * Do not change this structure (synchronized with BCLSockServer) */
8496 typedef struct _BCL_DRV_DATA_EX_REQUEST
8498 uint32 mode;
8499 uint32 category;
8500 uint32 index;
8501 uint32 datalen;
8502 } BCL_DRV_DATA_EX_REQUEST;
8504 /* BCL Driver message modes
8505 * Do not change these numbers (synchronized with BCLSockServer) */
8506 typedef enum
8508 BclDrvModeCatInit = 1,
8509 BclDrvModeCatFree = 2,
8510 BclDrvModeNameGet = 3,
8511 BclDrvModeValGet = 4,
8512 BclDrvModeValSet = 5
8513 } BCL_DRV_DATA_EX_MODE;
8515 /* BCL Driver message categories for DRV_* commands */
8516 /* Do not change these values (synchronized with BBStudio) */
8517 #define DRVCAT_DBG_API_RESET 1
8518 #define DRVCAT_DBG_API_GENERAL_PKT 2
8519 #define DRVCAT_DBG_API_GENERAL 3
8520 #define DRVCAT_DBG_API_MAC_STATS 4
8521 #define DRVCAT_DBG_API_RR_STATS 5
8523 /* Subcommand indices for DRVCAT_DBG_API_RESET: */
8524 /* Do not change these values (synchronized with BBStudio) */
8525 #define IDX_DBG_API_RESET_ALL 1
8527 /***** DRVCAT_DBG_API_RR_STATS categories definitions */
8529 * The header string should be returned on get_text with 0 index value.
8531 const char bcl_rr_counters_hdr[] = "MAC|ID|Too old|Duplicate|Queued|Overflows|Lost";
8532 const int bcl_rr_counters_num_cnts = 5;
8534 /***** DRVCAT_DBG_API_GENERAL_PKT categories definitions */
8536 * The header string should be returned on get_text with 0 index value.
8537 * The footer string should be returned on get_text with last index value.
8539 const char bcl_pkt_counters_hdr[] = "MAC|Packets received|Packets sent";
8540 const int bcl_pkt_counters_num_cnts = 2;
8541 const char bcl_pkt_counters_ftr[] = "Total";
8543 /***** DRVCAT_DBG_API_GENERAL categories definitions */
8544 #define MAX_STAT_NAME_LENGTH 256
8546 #define FETCH_NAME 1
8547 #define FETCH_VAL 2
8549 /* General statistic data processing structures */
8550 struct bcl_general_count_stat_params_t
8552 int num_stats;
8555 struct bcl_general_fetch_stat_params_t
8557 int index_search;
8558 int index_cur;
8559 int what;
8560 char name[MAX_STAT_NAME_LENGTH];
8561 unsigned long val;
8564 /***********************************************************
8565 * BCL function implementation
8566 ***********************************************************/
8567 static int
8568 mtlk_df_debug_bcl_category_free(mtlk_df_user_t *df_user, uint32 category);
8570 void
8571 mtlk_df_debug_bcl_cleanup(mtlk_df_user_t *df_user)
8573 mtlk_df_debug_bcl_category_free(df_user, DRVCAT_DBG_API_GENERAL);
8574 mtlk_df_debug_bcl_category_free(df_user, DRVCAT_DBG_API_GENERAL_PKT);
8575 mtlk_df_debug_bcl_category_free(df_user, DRVCAT_DBG_API_RR_STATS);
8576 mtlk_df_debug_bcl_category_free(df_user, DRVCAT_DBG_API_MAC_STATS);
8580 mtlk_df_debug_bcl_init(mtlk_df_user_t *df_user)
8582 df_user->slow_ctx->dbg_rr_addr = NULL;
8583 df_user->slow_ctx->dbg_rr_addr_num = 0;
8584 df_user->slow_ctx->dbg_rr_cnts = NULL;
8585 df_user->slow_ctx->dbg_rr_cnts_num = 0;
8587 df_user->slow_ctx->dbg_general_pkt_addr = NULL;
8588 df_user->slow_ctx->dbg_general_pkt_addr_num = 0;
8589 df_user->slow_ctx->dbg_general_pkt_cnts = NULL;
8590 df_user->slow_ctx->dbg_general_pkt_cnts_num = 0;
8591 return MTLK_ERR_OK;
8594 static int
8595 mtlk_df_debug_bcl_debug_mac_stats_init(mtlk_df_user_t *df_user, uint32 *pcnt)
8597 int res = MTLK_ERR_OK;
8599 ILOG2_S("%s: Create mac_stats_init", mtlk_df_user_get_name(df_user));
8601 /* Get MAC statistic from DF buffer and don't call Core */
8603 *pcnt = mtlk_df_get_stat_info_len();
8605 return res;
8608 static int
8609 mtlk_df_debug_bcl_debug_rr_counters_init(mtlk_df_user_t *df_user, uint32 *pcnt)
8611 int res = MTLK_ERR_NOT_SUPPORTED;
8612 mtlk_clpb_t *clpb = NULL;
8613 uint32 size;
8614 mtlk_stadb_stat_t *stadb_stat;
8615 mtlk_core_ui_get_stadb_status_req_t get_stadb_status_req;
8616 uint8 tid;
8618 uint32 num_sta_connected = 0;
8619 uint32 addr_num_entries_max = 0;
8620 uint32 cnt_num_entries_max = 0;
8621 uint32 *dbg_rr_cnts = NULL;
8622 IEEE_ADDR *dbg_rr_addr = NULL;
8624 uint32 addr_cur_entry = 0;
8625 uint32 cnts_cur_entry = 0;
8627 ILOG2_S("%s: Create rr_counters", mtlk_df_user_get_name(df_user));
8629 ASSERT(df_user->slow_ctx->dbg_rr_addr == NULL);
8630 ASSERT(df_user->slow_ctx->dbg_rr_cnts == NULL);
8632 *pcnt = 0;
8634 get_stadb_status_req.get_hostdb = FALSE;
8635 get_stadb_status_req.use_cipher = FALSE;
8636 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_GET_STADB_STATUS,
8637 &clpb, &get_stadb_status_req, sizeof(get_stadb_status_req));
8638 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_STADB_STATUS, FALSE);
8639 if (MTLK_ERR_OK != res) {
8640 goto finish;
8643 num_sta_connected = mtlk_clpb_get_num_of_elements(clpb);
8644 if (0 == num_sta_connected) {
8645 goto delete_clpb;
8648 addr_num_entries_max = num_sta_connected * NTS_TIDS;
8649 cnt_num_entries_max = num_sta_connected * NTS_TIDS * (bcl_rr_counters_num_cnts + 1/*+TID*/);
8651 dbg_rr_addr = mtlk_osal_mem_alloc(addr_num_entries_max * sizeof(IEEE_ADDR), MTLK_MEM_TAG_DEBUG_DATA);
8652 if (NULL == dbg_rr_addr) {
8653 ELOG_V("Out of memory");
8654 res = MTLK_ERR_NO_MEM;
8655 goto delete_clpb;
8657 memset(dbg_rr_addr, 0, addr_num_entries_max * sizeof(IEEE_ADDR));
8659 dbg_rr_cnts = mtlk_osal_mem_alloc(cnt_num_entries_max * sizeof(uint32), MTLK_MEM_TAG_DEBUG_DATA);
8660 if (NULL == dbg_rr_cnts) {
8661 ELOG_V("Out of memory");
8662 res = MTLK_ERR_NO_MEM;
8663 goto delete_dbg_rr_addr;
8665 memset(dbg_rr_cnts, 0, cnt_num_entries_max * sizeof(uint32));
8667 addr_cur_entry = 0;
8668 cnts_cur_entry = 0;
8670 while(NULL != (stadb_stat = mtlk_clpb_enum_get_next(clpb, &size))) {
8671 if ((sizeof(*stadb_stat) != size) || (STAT_ID_STADB != stadb_stat->type)) {
8672 res = MTLK_ERR_UNKNOWN;
8673 goto delete_dbg_rr_cnts;
8676 for (tid = 0; tid < ARRAY_SIZE(stadb_stat->u.general_stat.reordering_stats); tid++ )
8678 if (stadb_stat->u.general_stat.reordering_stats[tid].used) {
8679 ASSERT(addr_cur_entry < addr_num_entries_max);
8680 dbg_rr_addr[addr_cur_entry++] = stadb_stat->u.general_stat.addr;
8682 ASSERT(cnts_cur_entry < cnt_num_entries_max);
8683 dbg_rr_cnts[cnts_cur_entry++] = tid;
8685 ASSERT(cnts_cur_entry < cnt_num_entries_max);
8686 dbg_rr_cnts[cnts_cur_entry++] =
8687 stadb_stat->u.general_stat.reordering_stats[tid].reord_stat.too_old;
8689 ASSERT(cnts_cur_entry < cnt_num_entries_max);
8690 dbg_rr_cnts[cnts_cur_entry++] =
8691 stadb_stat->u.general_stat.reordering_stats[tid].reord_stat.duplicate;
8693 ASSERT(cnts_cur_entry < cnt_num_entries_max);
8694 dbg_rr_cnts[cnts_cur_entry++] =
8695 stadb_stat->u.general_stat.reordering_stats[tid].reord_stat.queued;
8697 ASSERT(cnts_cur_entry < cnt_num_entries_max);
8698 dbg_rr_cnts[cnts_cur_entry++] =
8699 stadb_stat->u.general_stat.reordering_stats[tid].reord_stat.overflows;
8701 ASSERT(cnts_cur_entry < cnt_num_entries_max);
8702 dbg_rr_cnts[cnts_cur_entry++] =
8703 stadb_stat->u.general_stat.reordering_stats[tid].reord_stat.lost;
8708 df_user->slow_ctx->dbg_rr_addr = dbg_rr_addr;
8709 df_user->slow_ctx->dbg_rr_addr_num = addr_cur_entry;
8710 df_user->slow_ctx->dbg_rr_cnts = dbg_rr_cnts;
8711 df_user->slow_ctx->dbg_rr_cnts_num = cnts_cur_entry;
8713 ILOG2_DDDDD("Created "
8714 "num_sta_connected (%d), "
8715 "addr_num (%d), cnts_num (%d), "
8716 "addr_num_entries_max (%d), cnt_num_entries_max (%d)",
8717 num_sta_connected,
8718 addr_cur_entry, cnts_cur_entry,
8719 addr_num_entries_max, cnt_num_entries_max);
8721 *pcnt = addr_cur_entry;
8723 if (0 == addr_cur_entry) {
8724 /* Not TIDs used */
8725 goto delete_dbg_rr_cnts;
8728 goto delete_clpb;
8730 delete_dbg_rr_cnts:
8731 mtlk_osal_mem_free(dbg_rr_cnts);
8732 delete_dbg_rr_addr:
8733 mtlk_osal_mem_free(dbg_rr_addr);
8734 delete_clpb:
8735 mtlk_clpb_delete(clpb);
8736 finish:
8737 return res;
8740 static int
8741 mtlk_df_debug_bcl_debug_pkt_counters_init(mtlk_df_user_t *df_user, uint32 *pcnt)
8743 int res = MTLK_ERR_NOT_SUPPORTED;
8744 mtlk_clpb_t *clpb = NULL;
8745 uint32 size;
8747 uint32 num_sta_connected;
8748 uint32 addr_num_entries_max;
8749 uint32 cnt_num_entries_max;
8750 uint32 *dbg_general_pkt_cnts = NULL;
8751 IEEE_ADDR *dbg_general_pkt_addr = NULL;
8752 uint32 addr_cur_entry = 0;
8753 uint32 cnts_cur_entry = 0;
8754 uint32 total_rx_packets = 0;
8755 uint32 total_tx_packets = 0;
8757 ILOG2_S("%s: Create pkt_counters", mtlk_df_user_get_name(df_user));
8759 ASSERT(df_user->slow_ctx->dbg_general_pkt_cnts == NULL);
8760 ASSERT(df_user->slow_ctx->dbg_general_pkt_addr == NULL);
8762 *pcnt = 0;
8764 if (mtlk_df_is_ap(df_user->df)) { /*AP*/
8765 mtlk_stadb_stat_t *stadb_stat;
8766 mtlk_core_ui_get_stadb_status_req_t get_stadb_status_req;
8768 get_stadb_status_req.get_hostdb = FALSE;
8769 get_stadb_status_req.use_cipher = FALSE;
8770 res = _mtlk_df_user_invoke_core(df_user->df, MTLK_CORE_REQ_GET_STADB_STATUS,
8771 &clpb, &get_stadb_status_req, sizeof(get_stadb_status_req));
8772 res = _mtlk_df_user_process_core_retval_void(res, clpb, MTLK_CORE_REQ_GET_STADB_STATUS, FALSE);
8773 if (MTLK_ERR_OK != res) {
8774 goto finish;
8777 num_sta_connected = mtlk_clpb_get_num_of_elements(clpb);
8778 if (0 == num_sta_connected) {
8779 goto delete_clpb;
8782 addr_num_entries_max = num_sta_connected;
8783 cnt_num_entries_max = (num_sta_connected + 1 /*Total*/) * bcl_pkt_counters_num_cnts;
8785 dbg_general_pkt_addr = mtlk_osal_mem_alloc(addr_num_entries_max * sizeof(IEEE_ADDR), MTLK_MEM_TAG_DEBUG_DATA);
8786 if (NULL == dbg_general_pkt_addr) {
8787 ELOG_V("Out of memory");
8788 res = MTLK_ERR_NO_MEM;
8789 goto delete_clpb;
8791 memset(dbg_general_pkt_addr, 0, addr_num_entries_max * sizeof(IEEE_ADDR));
8793 dbg_general_pkt_cnts = mtlk_osal_mem_alloc(cnt_num_entries_max * sizeof(uint32), MTLK_MEM_TAG_DEBUG_DATA);
8794 if (NULL == dbg_general_pkt_cnts) {
8795 ELOG_V("Out of memory");
8796 res = MTLK_ERR_NO_MEM;
8797 goto delete_dbg_general_pkt_addr;
8799 memset(dbg_general_pkt_cnts, 0, cnt_num_entries_max * sizeof(uint32));
8801 while(NULL != (stadb_stat = mtlk_clpb_enum_get_next(clpb, &size))) {
8802 if ((sizeof(*stadb_stat) != size) || (STAT_ID_STADB != stadb_stat->type)) {
8803 res = MTLK_ERR_UNKNOWN;
8804 goto delete_dbg_general_pkt_cnts;
8807 ASSERT(addr_cur_entry < addr_num_entries_max);
8808 dbg_general_pkt_addr[addr_cur_entry++] = stadb_stat->u.general_stat.addr;
8810 total_rx_packets += stadb_stat->u.general_stat.sta_rx_packets;
8811 total_tx_packets += stadb_stat->u.general_stat.sta_tx_packets;
8813 ASSERT(cnts_cur_entry < cnt_num_entries_max);
8814 dbg_general_pkt_cnts[cnts_cur_entry++] = stadb_stat->u.general_stat.sta_rx_packets;
8816 ASSERT(cnts_cur_entry < cnt_num_entries_max);
8817 dbg_general_pkt_cnts[cnts_cur_entry++] = stadb_stat->u.general_stat.sta_tx_packets;
8819 } else { /*STA*/
8820 mtlk_core_general_stats_t *general_stats;
8822 /* Get Core general information from DF buffer and don't call Core */
8823 general_stats = &df_user->slow_ctx->core_general_stats;
8825 if (!mtlk_core_net_state_is_connected(general_stats->net_state)) {
8826 res = MTLK_ERR_NOT_READY;
8827 goto finish;
8830 num_sta_connected = 1;
8831 addr_num_entries_max = num_sta_connected;
8832 cnt_num_entries_max = (num_sta_connected + 1 /*Total*/) * bcl_pkt_counters_num_cnts;
8834 dbg_general_pkt_addr =
8835 mtlk_osal_mem_alloc(addr_num_entries_max * sizeof(IEEE_ADDR), MTLK_MEM_TAG_DEBUG_DATA);
8836 if (NULL == dbg_general_pkt_addr) {
8837 ELOG_V("Out of memory");
8838 res = MTLK_ERR_NO_MEM;
8839 goto finish;
8841 memset(dbg_general_pkt_addr, 0, addr_num_entries_max * sizeof(IEEE_ADDR));
8843 dbg_general_pkt_cnts =
8844 mtlk_osal_mem_alloc(cnt_num_entries_max * sizeof(uint32), MTLK_MEM_TAG_DEBUG_DATA);
8845 if (NULL == dbg_general_pkt_cnts) {
8846 ELOG_V("Out of memory");
8847 res = MTLK_ERR_NO_MEM;
8848 mtlk_osal_mem_free(dbg_general_pkt_addr);
8849 goto finish;
8851 memset(dbg_general_pkt_cnts, 0, cnt_num_entries_max * sizeof(uint32));
8853 memcpy(&dbg_general_pkt_addr[addr_cur_entry++], general_stats->bssid, sizeof(IEEE_ADDR));
8855 total_rx_packets = general_stats->core_priv_stats.sta_session_rx_packets;
8856 total_tx_packets = general_stats->core_priv_stats.sta_session_tx_packets;
8858 dbg_general_pkt_cnts[cnts_cur_entry++] = total_rx_packets;
8859 dbg_general_pkt_cnts[cnts_cur_entry++] = total_tx_packets;
8862 ASSERT(cnts_cur_entry < cnt_num_entries_max);
8863 dbg_general_pkt_cnts[cnts_cur_entry++] = total_rx_packets;
8865 ASSERT(cnts_cur_entry < cnt_num_entries_max);
8866 dbg_general_pkt_cnts[cnts_cur_entry++] = total_tx_packets;
8868 df_user->slow_ctx->dbg_general_pkt_addr = dbg_general_pkt_addr;
8869 df_user->slow_ctx->dbg_general_pkt_addr_num = addr_cur_entry;
8870 df_user->slow_ctx->dbg_general_pkt_cnts = dbg_general_pkt_cnts;
8871 df_user->slow_ctx->dbg_general_pkt_cnts_num = cnts_cur_entry;
8873 ILOG2_DDDDD("Created "
8874 "num_sta_connected (%d), "
8875 "addr_num (%d), cnts_num (%d), "
8876 "addr_num_entries_max (%d), cnt_num_entries_max (%d)",
8877 num_sta_connected,
8878 addr_cur_entry, cnts_cur_entry,
8879 addr_num_entries_max, cnt_num_entries_max);
8881 *pcnt = addr_cur_entry + 1 /*Total*/;
8883 if (0 == addr_cur_entry) {
8884 /* Not TIDs used */
8885 goto delete_dbg_general_pkt_cnts;
8888 goto delete_clpb;
8890 delete_dbg_general_pkt_cnts:
8891 mtlk_osal_mem_free(dbg_general_pkt_cnts);
8892 delete_dbg_general_pkt_addr:
8893 mtlk_osal_mem_free(dbg_general_pkt_addr);
8894 delete_clpb:
8895 mtlk_clpb_delete(clpb);
8896 finish:
8897 return res;
8900 static int mtlk_df_debug_bcl_debug_general_iterate(mtlk_df_user_t *df_user,
8901 int (* fn)(void *params, unsigned long val, const char* str), void *params)
8903 int i;
8904 char buf[MAX_STAT_NAME_LENGTH];
8906 if (MTLK_ERR_OK != fn(params, df_user->slow_ctx->core_general_stats.rx_dat_frames,
8907 "data frames received"))
8908 return MTLK_ERR_PARAMS;
8909 if (MTLK_ERR_OK != fn(params, df_user->slow_ctx->core_general_stats.rx_ctl_frames,
8910 "control frames received"))
8911 return MTLK_ERR_PARAMS;
8912 if (MTLK_ERR_OK != fn(params, df_user->slow_ctx->core_general_stats.rx_man_frames,
8913 "management frames received"))
8914 return MTLK_ERR_PARAMS;
8915 if (MTLK_ERR_OK != fn(params, df_user->slow_ctx->core_general_stats.mac_stat.stat[STAT_TX_FAIL],
8916 "TX packets dropped"))
8917 return MTLK_ERR_PARAMS;
8918 if (MTLK_ERR_OK != fn(params, df_user->slow_ctx->core_general_stats.core_priv_stats.tx_max_cons_drop,
8919 "TX maximum consecutive dropped packets"))
8920 return MTLK_ERR_PARAMS;
8922 for (i = 0; i < NTS_PRIORITIES; i++) {
8923 sprintf(buf, "MSDUs received, QoS priority %d", i);
8924 if (MTLK_ERR_OK != fn(params, df_user->slow_ctx->core_general_stats.core_priv_stats.ac_rx_counter[i], buf))
8925 return MTLK_ERR_PARAMS;
8928 for (i = 0; i < NTS_PRIORITIES; i++) {
8929 sprintf(buf, "MSDUs transmitted, QoS priority %d", i);
8930 if (MTLK_ERR_OK != fn(params, df_user->slow_ctx->core_general_stats.core_priv_stats.ac_tx_counter[i], buf))
8931 return MTLK_ERR_PARAMS;
8934 for (i = 0; i < NTS_PRIORITIES; i++) {
8935 sprintf(buf, "MSDUs dropped, QoS priority %d", i);
8936 if (MTLK_ERR_OK != fn(params, df_user->slow_ctx->core_general_stats.core_priv_stats.ac_dropped_counter[i], buf))
8937 return MTLK_ERR_PARAMS;
8940 for (i = 0; i < NTS_PRIORITIES; i++) {
8941 sprintf(buf, "MSDUs used, QoS priority %d", i);
8942 if (MTLK_ERR_OK != fn(params, df_user->slow_ctx->core_general_stats.core_priv_stats.ac_used_counter[i], buf))
8943 return MTLK_ERR_PARAMS;
8946 if (MTLK_ERR_OK != fn(params, df_user->slow_ctx->core_general_stats.tx_msdus_free, "TX MSDUs free"))
8947 return MTLK_ERR_PARAMS;
8948 if (MTLK_ERR_OK != fn(params, df_user->slow_ctx->core_general_stats.tx_msdus_usage_peak, "TX MSDUs usage peak"))
8949 return MTLK_ERR_PARAMS;
8950 if (MTLK_ERR_OK != fn(params, df_user->slow_ctx->core_general_stats.fwd_rx_packets,
8951 "packets received that should be forwarded to one or more STAs"))
8952 return MTLK_ERR_PARAMS;
8953 if (MTLK_ERR_OK !=fn(params, df_user->slow_ctx->core_general_stats.fwd_rx_bytes,
8954 "bytes received that should be forwarded to one or more STAs"))
8955 return MTLK_ERR_PARAMS;
8956 if (MTLK_ERR_OK !=fn(params, df_user->slow_ctx->core_general_stats.core_priv_stats.fwd_tx_packets,
8957 "packets transmitted for forwarded data"))
8958 return MTLK_ERR_PARAMS;
8959 if (MTLK_ERR_OK !=fn(params, df_user->slow_ctx->core_general_stats.core_priv_stats.fwd_tx_bytes,
8960 "bytes transmitted for forwarded data"))
8961 return MTLK_ERR_PARAMS;
8962 if (MTLK_ERR_OK !=fn(params, df_user->slow_ctx->core_general_stats.core_priv_stats.fwd_dropped,
8963 "forwarding (transmission) failures"))
8964 return MTLK_ERR_PARAMS;
8965 if (MTLK_ERR_OK !=fn(params, df_user->slow_ctx->core_general_stats.core_priv_stats.rmcast_dropped,
8966 "reliable multicast (transmission) failures"))
8967 return MTLK_ERR_PARAMS;
8968 if (MTLK_ERR_OK !=fn(params, df_user->slow_ctx->core_general_stats.unicast_replayed_packets+df_user->slow_ctx->core_general_stats.multicast_replayed_packets,
8969 "packets replayed"))
8970 return MTLK_ERR_PARAMS;
8971 if (MTLK_ERR_OK !=fn(params, df_user->slow_ctx->core_general_stats.core_priv_stats.bars_cnt,
8972 "BAR frames received"))
8973 return MTLK_ERR_PARAMS;
8975 #ifdef MTLK_HAVE_PPA
8977 mtlk_df_user_ppa_stats_t ppa_stats;
8979 _mtlk_df_user_ppa_get_stats(df_user, &ppa_stats);
8981 if (MTLK_ERR_OK !=fn(params, ppa_stats.tx_processed, "TX Frames processed from PPA"))
8982 return MTLK_ERR_PARAMS;
8983 if (MTLK_ERR_OK !=fn(params, _mtlk_df_user_ppa_tx_sent_up, "TX Frames sent up from PPA"))
8984 return MTLK_ERR_PARAMS;
8985 if (MTLK_ERR_OK !=fn(params, _mtlk_df_user_ppa_tx_dropped, "TX Frames dropped from PPA"))
8986 return MTLK_ERR_PARAMS;
8987 if (MTLK_ERR_OK !=fn(params, ppa_stats.rx_accepted, "RX Frames accepted by PPA"))
8988 return MTLK_ERR_PARAMS;
8989 if (MTLK_ERR_OK !=fn(params, ppa_stats.rx_rejected, "RX Frames rejected by PPA"))
8990 return MTLK_ERR_PARAMS;
8992 #endif
8994 if (MTLK_ERR_OK !=fn(params, df_user->slow_ctx->core_general_stats.bist_check_passed, "BIST check passed"))
8995 return MTLK_ERR_PARAMS;
8997 return MTLK_ERR_OK;
9000 static int mtlk_df_debug_bcl_debug_general_count_stat(void *params, unsigned long val, const char* str)
9002 struct bcl_general_count_stat_params_t *pcsp = (struct bcl_general_count_stat_params_t *) params;
9003 ++pcsp->num_stats;
9004 return MTLK_ERR_OK;
9007 static int mtlk_df_debug_bcl_debug_general_fetch_stat(void *params, unsigned long val, const char *str)
9009 struct bcl_general_fetch_stat_params_t *pfsp = (struct bcl_general_fetch_stat_params_t*) params;
9010 int res = MTLK_ERR_OK;
9012 if (pfsp->index_cur == pfsp->index_search) {
9013 if (pfsp->what == FETCH_VAL)
9014 pfsp->val = val;
9016 else if (pfsp->what == FETCH_NAME) {
9017 int rslt = snprintf(pfsp->name, MAX_STAT_NAME_LENGTH, "%s", str);
9018 if (rslt < 0 || rslt >= MAX_STAT_NAME_LENGTH)
9019 res = MTLK_ERR_PARAMS;
9021 } else {
9022 res = MTLK_ERR_PARAMS;
9025 ++pfsp->index_cur;
9026 return res;
9029 static int
9030 mtlk_df_debug_bcl_debug_general_init(mtlk_df_user_t *df_user, uint32 *pcnt)
9032 int res = MTLK_ERR_OK;
9033 struct bcl_general_count_stat_params_t csp;
9035 ILOG2_S("%s: Create general", mtlk_df_user_get_name(df_user));
9037 /* Get Core general information from DF buffer and don't call Core */
9038 *pcnt = 0;
9040 csp.num_stats = 0;
9041 res = mtlk_df_debug_bcl_debug_general_iterate(
9042 df_user, &mtlk_df_debug_bcl_debug_general_count_stat, &csp);
9043 if (MTLK_ERR_OK != res) {
9044 ELOG_V("Error while iterating driver statistics");
9045 goto finish;
9048 *pcnt = csp.num_stats;
9050 finish:
9051 return res;
9054 static int
9055 mtlk_df_debug_bcl_category_init(mtlk_df_user_t *df_user, uint32 category, uint32 *cnt)
9057 int res = MTLK_ERR_PARAMS;
9059 mtlk_df_debug_bcl_category_free(df_user, category);
9061 switch (category)
9063 case DRVCAT_DBG_API_GENERAL:
9064 res = mtlk_df_debug_bcl_debug_general_init(df_user, cnt);
9065 break;
9066 case DRVCAT_DBG_API_GENERAL_PKT:
9067 res = mtlk_df_debug_bcl_debug_pkt_counters_init(df_user, cnt);
9068 break;
9069 case DRVCAT_DBG_API_RR_STATS:
9070 res = mtlk_df_debug_bcl_debug_rr_counters_init(df_user, cnt);
9071 break;
9072 case DRVCAT_DBG_API_MAC_STATS:
9073 res = mtlk_df_debug_bcl_debug_mac_stats_init(df_user, cnt);
9074 break;
9075 default:
9076 ELOG_D("Unsupported data category (%u) requested", category);
9077 break;
9079 return res;
9082 static int
9083 mtlk_df_debug_bcl_debug_mac_stats_category_free(mtlk_df_user_t *df_user)
9085 ILOG2_S("%s: Free mac_stats_category_free", mtlk_df_user_get_name(df_user));
9087 return MTLK_ERR_OK;
9090 static int
9091 mtlk_df_debug_bcl_debug_rr_counters_category_free(mtlk_df_user_t *df_user)
9093 ILOG2_S("%s: Free rr_counters", mtlk_df_user_get_name(df_user));
9095 if (NULL != df_user->slow_ctx->dbg_rr_addr) {
9096 mtlk_osal_mem_free(df_user->slow_ctx->dbg_rr_addr);
9097 df_user->slow_ctx->dbg_rr_addr = NULL;
9099 df_user->slow_ctx->dbg_rr_addr_num = 0;
9101 if (NULL != df_user->slow_ctx->dbg_rr_cnts) {
9102 mtlk_osal_mem_free(df_user->slow_ctx->dbg_rr_cnts);
9103 df_user->slow_ctx->dbg_rr_cnts = NULL;
9105 df_user->slow_ctx->dbg_rr_cnts_num = 0;
9106 return MTLK_ERR_OK;
9109 static int
9110 mtlk_df_debug_bcl_debug_pkt_counters_category_free(mtlk_df_user_t *df_user)
9112 ILOG2_S("%s: Free pkt_counters", mtlk_df_user_get_name(df_user));
9114 if (NULL != df_user->slow_ctx->dbg_general_pkt_addr) {
9115 mtlk_osal_mem_free(df_user->slow_ctx->dbg_general_pkt_addr);
9116 df_user->slow_ctx->dbg_general_pkt_addr = NULL;
9118 df_user->slow_ctx->dbg_general_pkt_addr_num = 0;
9120 if (NULL != df_user->slow_ctx->dbg_general_pkt_cnts) {
9121 mtlk_osal_mem_free(df_user->slow_ctx->dbg_general_pkt_cnts);
9122 df_user->slow_ctx->dbg_general_pkt_cnts = NULL;
9124 df_user->slow_ctx->dbg_general_pkt_cnts_num = 0;
9125 return MTLK_ERR_OK;
9128 static int
9129 mtlk_df_debug_bcl_debug_general_category_free(mtlk_df_user_t *df_user)
9131 ILOG2_S("%s: Free core_general_stats", mtlk_df_user_get_name(df_user));
9133 return MTLK_ERR_OK;
9137 mtlk_df_debug_bcl_category_free(mtlk_df_user_t *df_user, uint32 category)
9139 int res = MTLK_ERR_PARAMS;
9141 switch (category)
9143 case DRVCAT_DBG_API_GENERAL:
9144 res = mtlk_df_debug_bcl_debug_general_category_free(df_user);
9145 break;
9146 case DRVCAT_DBG_API_GENERAL_PKT:
9147 res = mtlk_df_debug_bcl_debug_pkt_counters_category_free(df_user);
9148 break;
9149 case DRVCAT_DBG_API_RR_STATS:
9150 res = mtlk_df_debug_bcl_debug_rr_counters_category_free(df_user);
9151 break;
9152 case DRVCAT_DBG_API_MAC_STATS:
9153 res = mtlk_df_debug_bcl_debug_mac_stats_category_free(df_user);
9154 break;
9155 default:
9156 ELOG_D("Unsupported data category (%u) requested", category);
9157 break;
9159 return res;
9162 static int
9163 mtlk_df_debug_bcl_debug_mac_stats_name_get(uint32 index, char *pdata, uint32 datalen)
9165 int rslt;
9166 if (index >= mtlk_df_get_stat_info_len()) {
9167 ELOG_D("Index out of bounds (index %u)", index);
9168 return MTLK_ERR_PARAMS;
9170 rslt = snprintf(pdata, datalen, "%s", mtlk_df_get_stat_info_name(index));
9171 if (rslt < 0 || rslt >= datalen) {
9172 WLOG_DD("Buffer size (%u) too small: string truncated (index %u)", datalen, index);
9175 return MTLK_ERR_OK;
9178 static int
9179 mtlk_df_debug_bcl_debug_rr_counters_name_get(
9180 mtlk_df_user_t *df_user, uint32 index, char *pdata, uint32 datalen)
9182 int res = MTLK_ERR_OK;
9183 int rslt = 0;
9185 if (index >= (df_user->slow_ctx->dbg_rr_addr_num + 1)) { /* +1 for header */
9186 ELOG_D("Index out of bounds (index %u)", index);
9187 res = MTLK_ERR_PARAMS;
9189 } else if (0 == index) {
9190 rslt = snprintf(pdata, datalen, "%s", bcl_rr_counters_hdr);
9192 } else if (NULL == df_user->slow_ctx->dbg_rr_addr) {
9193 res = MTLK_ERR_NOT_READY;
9195 } else {
9196 rslt = snprintf(pdata, datalen, MAC_PRINTF_FMT,
9197 MAC_PRINTF_ARG(df_user->slow_ctx->dbg_rr_addr[index - 1].au8Addr));
9200 if (rslt < 0 || rslt >= datalen) {
9201 WLOG_DD("Buffer size (%u) too small: string truncated (index %u)", datalen, index);
9204 return res;
9207 static int
9208 mtlk_df_debug_bcl_debug_pkt_counters_name_get(
9209 mtlk_df_user_t *df_user, uint32 index, char *pdata, uint32 datalen)
9211 int res = MTLK_ERR_OK;
9212 int rslt = 0;
9214 if (index >= (df_user->slow_ctx->dbg_general_pkt_addr_num + 2)) { /* +1 for header +1 footer*/
9215 ELOG_D("Index out of bounds (index %u)", index);
9216 res = MTLK_ERR_PARAMS;
9218 } else if (0 == index) {
9219 rslt = snprintf(pdata, datalen, "%s", bcl_pkt_counters_hdr);
9221 } else if ((df_user->slow_ctx->dbg_general_pkt_addr_num + 1) == index) {
9222 rslt = snprintf(pdata, datalen, "%s", bcl_pkt_counters_ftr);
9224 } else if (NULL == df_user->slow_ctx->dbg_general_pkt_addr) {
9225 res = MTLK_ERR_NOT_READY;
9227 } else {
9228 rslt = snprintf(pdata, datalen, MAC_PRINTF_FMT,
9229 MAC_PRINTF_ARG(df_user->slow_ctx->dbg_general_pkt_addr[index - 1].au8Addr));
9232 if (rslt < 0 || rslt >= datalen) {
9233 WLOG_DD("Buffer size (%u) too small: string truncated (index %u)", datalen, index);
9236 return res;
9239 static int
9240 mtlk_df_debug_bcl_debug_general_name_get(
9241 mtlk_df_user_t *df_user, uint32 index, char *pdata, uint32 datalen)
9243 int res = MTLK_ERR_OK;
9244 int rslt = 0;
9245 struct bcl_general_fetch_stat_params_t fsp;
9247 fsp.index_cur = 0;
9248 fsp.index_search = index;
9249 fsp.what = FETCH_NAME;
9251 res = mtlk_df_debug_bcl_debug_general_iterate(df_user, &mtlk_df_debug_bcl_debug_general_fetch_stat, &fsp);
9252 if (MTLK_ERR_OK != res) {
9253 ELOG_V("Error while iterating driver statistics");
9254 } else {
9255 rslt = snprintf(pdata, datalen, "%s", fsp.name);
9256 if (rslt < 0 || rslt >= datalen) {
9257 WLOG_DD("Buffer size (%u) too small: string truncated (index %u)", datalen, index);
9261 return res;
9264 static int
9265 mtlk_df_debug_bcl_name_get(mtlk_df_user_t *df_user, uint32 category,
9266 uint32 index, char *pdata, uint32 datalen)
9268 int res = MTLK_ERR_PARAMS;
9270 switch (category)
9272 case DRVCAT_DBG_API_GENERAL:
9273 res = mtlk_df_debug_bcl_debug_general_name_get(df_user, index, pdata, datalen);
9274 break;
9275 case DRVCAT_DBG_API_GENERAL_PKT:
9276 res = mtlk_df_debug_bcl_debug_pkt_counters_name_get(df_user, index, pdata, datalen);
9277 break;
9278 case DRVCAT_DBG_API_RR_STATS:
9279 res = mtlk_df_debug_bcl_debug_rr_counters_name_get(df_user, index, pdata, datalen);
9280 break;
9281 case DRVCAT_DBG_API_MAC_STATS:
9282 res = mtlk_df_debug_bcl_debug_mac_stats_name_get(index, pdata, datalen);
9283 break;
9284 default:
9285 ELOG_D("Unsupported data category (%u) requested", category);
9286 break;
9288 return res;
9291 static int
9292 mtlk_df_debug_bcl_debug_mac_stats_val_get(mtlk_df_user_t *df_user, uint32 index, uint32 *pval)
9294 int res = MTLK_ERR_OK;
9296 if (index >= mtlk_df_get_stat_info_len()) {
9297 ELOG_D("Index out of bounds (index %u)", index);
9298 res = MTLK_ERR_PARAMS;
9299 } else {
9300 *pval = df_user->slow_ctx->core_general_stats.mac_stat.stat[mtlk_df_get_stat_info_idx(index)];
9303 return res;
9306 static int
9307 mtlk_df_debug_bcl_debug_rr_counters_val_get(mtlk_df_user_t *df_user, uint32 index, uint32 *pval)
9309 int res = MTLK_ERR_OK;
9311 if (NULL == df_user->slow_ctx->dbg_rr_cnts) {
9312 res = MTLK_ERR_NOT_READY;
9313 } else if (index >= df_user->slow_ctx->dbg_rr_cnts_num) {
9314 ELOG_D("Index out of bounds (index %u)", index);
9315 res = MTLK_ERR_PARAMS;
9316 } else {
9317 *pval = df_user->slow_ctx->dbg_rr_cnts[index];
9320 return res;
9323 static int
9324 mtlk_df_debug_bcl_debug_pkt_counters_val_get(mtlk_df_user_t *df_user, uint32 index, uint32 *pval)
9326 int res = MTLK_ERR_OK;
9328 if (NULL == df_user->slow_ctx->dbg_general_pkt_cnts) {
9329 res = MTLK_ERR_NOT_READY;
9330 } else if (index >= df_user->slow_ctx->dbg_general_pkt_cnts_num) {
9331 ELOG_D("Index out of bounds (index %u)", index);
9332 res = MTLK_ERR_PARAMS;
9333 } else {
9334 *pval = df_user->slow_ctx->dbg_general_pkt_cnts[index];
9337 return res;
9340 static int
9341 mtlk_df_debug_bcl_debug_general_val_get(mtlk_df_user_t *df_user, uint32 index, uint32 *pval)
9343 int res = MTLK_ERR_OK;
9344 struct bcl_general_fetch_stat_params_t fsp;
9346 fsp.index_cur = 0;
9347 fsp.index_search = index;
9348 fsp.what = FETCH_VAL;
9350 res = mtlk_df_debug_bcl_debug_general_iterate(df_user, &mtlk_df_debug_bcl_debug_general_fetch_stat, &fsp);
9351 if (MTLK_ERR_OK != res) {
9352 ELOG_V("Error while iterating driver statistics");
9353 } else {
9354 *pval = fsp.val;
9357 return res;
9360 static int
9361 mtlk_df_debug_bcl_val_get(mtlk_df_user_t *df_user, uint32 category, uint32 index, uint32 *pval)
9363 int res = MTLK_ERR_PARAMS;
9365 switch (category)
9367 case DRVCAT_DBG_API_GENERAL:
9368 res = mtlk_df_debug_bcl_debug_general_val_get(df_user, index, pval);
9369 break;
9370 case DRVCAT_DBG_API_GENERAL_PKT:
9371 res = mtlk_df_debug_bcl_debug_pkt_counters_val_get(df_user, index, pval);
9372 break;
9373 case DRVCAT_DBG_API_RR_STATS:
9374 res = mtlk_df_debug_bcl_debug_rr_counters_val_get(df_user, index, pval);
9375 break;
9376 case DRVCAT_DBG_API_MAC_STATS:
9377 res = mtlk_df_debug_bcl_debug_mac_stats_val_get(df_user, index, pval);
9378 break;
9379 default:
9380 ELOG_D("Unsupported data category (%u) requested", category);
9381 break;
9383 return res;
9386 static int
9387 mtlk_df_debug_bcl_reset(mtlk_df_user_t *df_user, uint32 index, uint32 val)
9389 int res = MTLK_ERR_PARAMS;
9391 switch (index) {
9392 case IDX_DBG_API_RESET_ALL:
9393 res = mtlk_df_ui_reset_stats(df_user->df);
9394 #ifdef MTLK_HAVE_PPA
9395 _mtlk_df_user_ppa_zero_stats(df_user);
9396 #endif
9397 break;
9398 default:
9399 ELOG_D("Index out of bounds (index %u)", index);
9402 return res;
9405 static int
9406 mtlk_df_debug_bcl_val_put(mtlk_df_user_t *df_user, uint32 category, uint32 index, uint32 val)
9408 int res = MTLK_ERR_PARAMS;
9410 switch (category)
9412 case DRVCAT_DBG_API_RESET:
9413 res = mtlk_df_debug_bcl_reset(df_user, index, val);
9414 break;
9415 default:
9416 ELOG_D("Unsupported data category (%u) requested", category);
9417 break;
9420 return res;
9423 int __MTLK_IFUNC
9424 mtlk_df_ui_linux_ioctl_bcl_drv_data_exchange (struct net_device *dev,
9425 struct iw_request_info *info,
9426 union iwreq_data *wrqu, char *extra)
9428 mtlk_df_user_t *df_user = (mtlk_df_user_t*)netdev_priv(dev);
9429 BCL_DRV_DATA_EX_REQUEST preq;
9430 char *pdata = NULL;
9431 int res = MTLK_ERR_OK;
9432 uint32 value;
9434 ILOG3_SSD("%s: Invoked from %s (%i)", dev->name, current->comm, current->pid);
9436 if (mtlk_df_is_slave(df_user->df)) {
9437 res = MTLK_ERR_NOT_SUPPORTED;
9438 goto cleanup;
9441 if (0 != copy_from_user(&preq, wrqu->data.pointer, sizeof(preq))) {
9442 res = MTLK_ERR_VALUE;
9443 goto cleanup;
9446 switch (preq.mode) {
9447 case BclDrvModeCatInit:
9448 /* Make sure there's enough space to fit the counter: */
9449 if (sizeof(uint32) != preq.datalen) {
9450 res = MTLK_ERR_PARAMS;
9451 } else {
9452 /* Return category items counter to BCLSockServer: */
9453 res = mtlk_df_debug_bcl_category_init(df_user, preq.category, /* out */ &value);
9454 if (MTLK_ERR_OK == res) {
9455 if (0 != copy_to_user(wrqu->data.pointer + sizeof(preq), &value, sizeof(uint32))) {
9456 res = MTLK_ERR_VALUE;
9460 break;
9461 case BclDrvModeCatFree:
9462 res = mtlk_df_debug_bcl_category_free(df_user, preq.category);
9463 break;
9464 case BclDrvModeNameGet:
9465 pdata = mtlk_osal_mem_alloc(preq.datalen * sizeof(char), MTLK_MEM_TAG_IOCTL);
9466 if (NULL == pdata) {
9467 res = MTLK_ERR_NO_MEM;
9468 } else {
9469 res = mtlk_df_debug_bcl_name_get(df_user, preq.category, preq.index, pdata, preq.datalen);
9470 if (MTLK_ERR_OK == res) {
9471 if (0 != copy_to_user(wrqu->data.pointer + sizeof(preq), pdata, strlen(pdata) + 1)) {
9472 res = MTLK_ERR_VALUE;
9475 mtlk_osal_mem_free(pdata);
9477 break;
9478 case BclDrvModeValGet:
9479 /* Make sure there's enough space to store the value: */
9480 if (sizeof(uint32) != preq.datalen) {
9481 res = MTLK_ERR_PARAMS;
9482 } else {
9483 /* Return the value to BCLSockServer: */
9484 res = mtlk_df_debug_bcl_val_get(df_user, preq.category, preq.index, /* out */ &value);
9485 if (MTLK_ERR_OK == res) {
9486 if (0 != copy_to_user(wrqu->data.pointer + sizeof(preq), &value, sizeof(uint32))) {
9487 res = MTLK_ERR_VALUE;
9491 break;
9492 case BclDrvModeValSet:
9493 /* Make sure the value is present: */
9494 if (sizeof(uint32) != preq.datalen) {
9495 res = MTLK_ERR_PARAMS;
9496 } else {
9497 /* Process the value: */
9498 if (0 != copy_from_user(&value, wrqu->data.pointer + sizeof(preq), sizeof(uint32))) {
9499 res = MTLK_ERR_VALUE;
9500 } else {
9501 res = mtlk_df_debug_bcl_val_put(df_user, preq.category, preq.index, value);
9504 break;
9505 default:
9506 ELOG_D("Unknown data exchange mode (%u)", preq.mode);
9507 res = MTLK_ERR_PARAMS;
9510 cleanup:
9511 return _mtlk_df_mtlk_to_linux_error_code(res);
9514 /* Remove MAC address from switch MAC table by ifx_ethsw_kioctl
9515 1. QUERY: search MAC address in switch table.
9516 The bFound will be set to 1 if MAC address found.
9517 2. REMOVE: remove MAC address if found.
9518 Note: It is should be done independently of whether PPA is active or not.
9520 void __MTLK_IFUNC
9521 mtlk_df_user_ppa_remove_mac_addr(mtlk_df_t *df, const uint8 *mac_addr)
9523 #ifdef MTLK_HAVE_PPA
9525 LTQ_ETHSW_API_HANDLE handle;
9526 IFX_ETHSW_MAC_tableQuery_t MAC_tableQuery;
9527 IFX_ETHSW_MAC_tableRemove_t MAC_tableRemove;
9529 MTLK_ASSERT(NULL != df);
9530 MTLK_ASSERT(NULL != mac_addr);
9532 /* ifx_ethsw_kopen returns a zero in case the device does not exist or is blocked */
9533 handle = ltq_ethsw_api_kopen("/dev/switch/0");
9535 if (0 != handle) {
9537 /* 1. Search MAC address in switch table */
9538 memset(&MAC_tableQuery, 0x00, sizeof(MAC_tableQuery));
9539 MAC_tableQuery.nFId = 0;
9540 memcpy(MAC_tableQuery.nMAC, mac_addr, IEEE_ADDR_LEN);
9541 ltq_ethsw_api_kioctl(handle, IFX_ETHSW_MAC_TABLE_ENTRY_QUERY, (unsigned int)&MAC_tableQuery);
9543 ILOG3_YDD("MAC %Y switch query: bFound %d, nPortId %d",
9544 mac_addr, (int)MAC_tableQuery.bFound, (int)MAC_tableQuery.nPortId);
9546 /* 2. Remove MAC address if found */
9547 if (MAC_tableQuery.bFound) {
9548 memset(&MAC_tableRemove, 0x00, sizeof(MAC_tableRemove));
9549 MAC_tableRemove.nFId = 0;
9550 memcpy(MAC_tableRemove.nMAC, mac_addr, IEEE_ADDR_LEN);
9551 ltq_ethsw_api_kioctl(handle, IFX_ETHSW_MAC_TABLE_ENTRY_REMOVE, (unsigned int)&MAC_tableRemove);
9553 ILOG3_Y("MAC %Y removed from switch MAC table", mac_addr);
9556 ltq_ethsw_api_kclose(handle);
9558 #endif /* MTLK_HAVE_PPA */