|
13 | 13 | #include "fmac_api_common.h"
|
14 | 14 | #include "fmac_util.h"
|
15 | 15 | #include "host_rpu_umac_if.h"
|
| 16 | +#include "host_rpu_sys_if.h" |
16 | 17 |
|
17 | 18 | bool nrf_wifi_util_is_multicast_addr(const unsigned char *addr)
|
18 | 19 | {
|
@@ -366,6 +367,98 @@ enum nrf_wifi_status nrf_wifi_check_mode_validity(unsigned char mode)
|
366 | 367 | return NRF_WIFI_STATUS_FAIL;
|
367 | 368 | }
|
368 | 369 |
|
| 370 | +#if defined(CONFIG_NRF700X_PROMISC_DATA_RX) |
| 371 | +bool nrf_wifi_util_check_filt_setting(struct nrf_wifi_fmac_vif_ctx *vif, |
| 372 | + unsigned short *frame_control) |
| 373 | +{ |
| 374 | + bool filter_check = false; |
| 375 | + struct nrf_wifi_fmac_frame_ctrl *frm_ctrl = |
| 376 | + (struct nrf_wifi_fmac_frame_ctrl *)frame_control; |
| 377 | + |
| 378 | + /** |
| 379 | + * The different filter settings for 802.11 packets are a bit map |
| 380 | + * and the description of the different valid values for the case |
| 381 | + * statements are as follows: |
| 382 | + * 0x2 - Enable management packets only |
| 383 | + * 0x4 - Enable data packets only |
| 384 | + * 0x8 - Enable control packets only |
| 385 | + * 0x6 - Enable data and management packets |
| 386 | + * 0xa - Enable control and management packets |
| 387 | + * 0xb - Enable data and control packets |
| 388 | + * if bit 0 is set, all packet types are allowed to be sent upstack |
| 389 | + **/ |
| 390 | + nrf_wifi_osal_log_err(vif->fmac_dev_ctx->fpriv->opriv, |
| 391 | + "%s: is 0x%x", |
| 392 | + __func__, *frame_control); |
| 393 | + |
| 394 | + nrf_wifi_osal_log_err(vif->fmac_dev_ctx->fpriv->opriv, |
| 395 | + "%s: packet_filter is %d", |
| 396 | + __func__, vif->packet_filter); |
| 397 | + |
| 398 | + switch (vif->packet_filter) { |
| 399 | + case 0x2: |
| 400 | + nrf_wifi_osal_log_err(vif->fmac_dev_ctx->fpriv->opriv, |
| 401 | + "%s: NRF_WIFI_MGMT_PKT_TYPE", |
| 402 | + __func__); |
| 403 | + if (frm_ctrl->type == NRF_WIFI_MGMT_PKT_TYPE) { |
| 404 | + filter_check = true; |
| 405 | + } |
| 406 | + break; |
| 407 | + case 0x4: |
| 408 | + nrf_wifi_osal_log_err(vif->fmac_dev_ctx->fpriv->opriv, |
| 409 | + "%s: NRF_WIFI_DATA_PKT_TYPE", |
| 410 | + __func__); |
| 411 | + if (frm_ctrl->type == NRF_WIFI_DATA_PKT_TYPE) { |
| 412 | + filter_check = true; |
| 413 | + } |
| 414 | + break; |
| 415 | + case 0x6: |
| 416 | + nrf_wifi_osal_log_err(vif->fmac_dev_ctx->fpriv->opriv, |
| 417 | + "%s: NRF_WIFI_DATA_PKT_TYPE/NRF_WIFI_MGMT_PKT_TYPE", |
| 418 | + __func__); |
| 419 | + if ((frm_ctrl->type == NRF_WIFI_DATA_PKT_TYPE) || |
| 420 | + (frm_ctrl->type == NRF_WIFI_MGMT_PKT_TYPE)) { |
| 421 | + filter_check = true; |
| 422 | + } |
| 423 | + break; |
| 424 | + case 0x8: |
| 425 | + nrf_wifi_osal_log_err(vif->fmac_dev_ctx->fpriv->opriv, |
| 426 | + "%s: NRF_WIFI_CTRL_PKT_TYPE", |
| 427 | + __func__); |
| 428 | + if (frm_ctrl->type == NRF_WIFI_CTRL_PKT_TYPE) |
| 429 | + filter_check = true; |
| 430 | + break; |
| 431 | + case 0xa: |
| 432 | + nrf_wifi_osal_log_err(vif->fmac_dev_ctx->fpriv->opriv, |
| 433 | + "%s: NRF_WIFI_CTRL_PKT_TYPE/NRF_WIFI_MGMT_PKT_TYPE", |
| 434 | + __func__); |
| 435 | + if ((frm_ctrl->type == NRF_WIFI_CTRL_PKT_TYPE) || |
| 436 | + (frm_ctrl->type == NRF_WIFI_MGMT_PKT_TYPE)) { |
| 437 | + filter_check = true; |
| 438 | + } |
| 439 | + break; |
| 440 | + case 0xb: |
| 441 | + nrf_wifi_osal_log_err(vif->fmac_dev_ctx->fpriv->opriv, |
| 442 | + "%s: NRF_WIFI_DATA_PKT_TYPE/NRF_WIFI_CTRL_PKT_TYPE", |
| 443 | + __func__); |
| 444 | + if ((frm_ctrl->type == NRF_WIFI_DATA_PKT_TYPE) || |
| 445 | + (frm_ctrl->type == NRF_WIFI_CTRL_PKT_TYPE)) { |
| 446 | + filter_check = true; |
| 447 | + } |
| 448 | + /* all other packet_filter cases - bit 0 is set and hence all |
| 449 | + * packet types are allowed or in the case of 0xE - all packet |
| 450 | + * type bits are enabled */ |
| 451 | + default: |
| 452 | + nrf_wifi_osal_log_err(vif->fmac_dev_ctx->fpriv->opriv, |
| 453 | + "%s: default", |
| 454 | + __func__); |
| 455 | + filter_check = true; |
| 456 | + break; |
| 457 | + } |
| 458 | + return filter_check; |
| 459 | +} |
| 460 | +#endif |
| 461 | + |
369 | 462 | #ifdef CONFIG_NRF700X_RAW_DATA_TX
|
370 | 463 | bool nrf_wifi_util_is_rawpktmode_enabled(struct nrf_wifi_fmac_vif_ctx *vif)
|
371 | 464 | {
|
|
0 commit comments