1 /** @file mlan_txrx.c
2  *
3  *  @brief  This file provides the handling of TX/RX in MLAN
4  *
5  *  Copyright 2008-2024 NXP
6  *
7  *  SPDX-License-Identifier: BSD-3-Clause
8  *
9  */
10 
11 /*************************************************************
12 Change Log:
13     05/11/2009: initial version
14 ************************************************************/
15 #include <mlan_api.h>
16 
17 /* Additional WMSDK header files */
18 #include <wmerrno.h>
19 #include <osa.h>
20 
21 /* Always keep this include at the end of all include files */
22 #include <mlan_remap_mem_operations.h>
23 /********************************************************
24                 Local Variables
25 ********************************************************/
26 
27 /********************************************************
28                 Global Variables
29 ********************************************************/
30 
31 /********************************************************
32                 Local Functions
33 ********************************************************/
34 
35 /********************************************************
36                 Global Functions
37 ********************************************************/
38 /**
39  *   @brief This function processes the received buffer
40  *
41  *   @param pmadapter A pointer to mlan_adapter
42  *   @param pmbuf     A pointer to the received buffer
43  *
44  *   @return        MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
45  */
wlan_handle_rx_packet(pmlan_adapter pmadapter,pmlan_buffer pmbuf)46 mlan_status wlan_handle_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf)
47 {
48     mlan_status ret    = MLAN_STATUS_SUCCESS;
49     pmlan_private priv = wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY);
50     RxPD *prx_pd;
51 #ifdef DEBUG_LEVEL1
52     t_u32 sec, usec;
53 #endif
54 
55     ENTER();
56 
57     prx_pd = (RxPD *)(void *)(pmbuf->pbuf + pmbuf->data_offset);
58     /* Get the BSS number from RxPD, get corresponding priv */
59     priv = wlan_get_priv_by_id(pmadapter, prx_pd->bss_num & BSS_NUM_MASK, prx_pd->bss_type);
60     if (priv == MNULL)
61     {
62         priv = wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY);
63     }
64     pmbuf->bss_index = priv->bss_index;
65     PRINTM_GET_SYS_TIME(MDATA, &sec, &usec);
66     PRINTM_NETINTF(MDATA, priv);
67     /* PRINTM(MDATA, "%lu.%06lu : Data <= FW\n", sec, usec); */
68     ret = priv->ops.process_rx_packet(pmadapter, pmbuf);
69 
70     LEAVE();
71     return ret;
72 }
73