Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /******************************************************************************
0003  *
0004  * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
0005  *
0006  * Modifications for inclusion into the Linux staging tree are
0007  * Copyright(c) 2010 Larry Finger. All rights reserved.
0008  *
0009  * Contact information:
0010  * WLAN FAE <wlanfae@realtek.com>
0011  * Larry Finger <Larry.Finger@lwfinger.net>
0012  *
0013  ******************************************************************************/
0014 #ifndef _RTL8712_RECV_H_
0015 #define _RTL8712_RECV_H_
0016 
0017 #include "osdep_service.h"
0018 #include "drv_types.h"
0019 
0020 /* Realtek's v2.6.6 reduced this to 4. However, under heavy network and CPU
0021  * loads, even 8 receive buffers might not be enough; cutting it to 4 seemed
0022  * unwise.
0023  */
0024 #define NR_RECVBUFF (8)
0025 
0026 #define NR_PREALLOC_RECV_SKB (8)
0027 #define RXDESC_SIZE 24
0028 #define RXDESC_OFFSET RXDESC_SIZE
0029 #define RECV_BLK_SZ 512
0030 #define RECV_BLK_CNT 16
0031 #define RECV_BLK_TH RECV_BLK_CNT
0032 #define MAX_RECVBUF_SZ 9100
0033 #define RECVBUFF_ALIGN_SZ 512
0034 #define RSVD_ROOM_SZ (0)
0035 /*These definition is used for Rx packet reordering.*/
0036 #define SN_LESS(a, b)       (((a-b) & 0x800) != 0)
0037 #define SN_EQUAL(a, b)  (a == b)
0038 #define REORDER_WAIT_TIME   30 /* (ms)*/
0039 
0040 struct recv_stat {
0041     __le32 rxdw0;
0042     __le32 rxdw1;
0043     __le32 rxdw2;
0044     __le32 rxdw3;
0045     __le32 rxdw4;
0046     __le32 rxdw5;
0047 };
0048 
0049 struct phy_cck_rx_status {
0050     /* For CCK rate descriptor. This is a unsigned 8:1 variable.
0051      * LSB bit present 0.5. And MSB 7 bts present a signed value.
0052      * Range from -64~+63.5.
0053      */
0054     u8  adc_pwdb_X[4];
0055     u8  sq_rpt;
0056     u8  cck_agc_rpt;
0057 };
0058 
0059 struct phy_stat {
0060     __le32 phydw0;
0061     __le32 phydw1;
0062     __le32 phydw2;
0063     __le32 phydw3;
0064     __le32 phydw4;
0065     __le32 phydw5;
0066     __le32 phydw6;
0067     __le32 phydw7;
0068 };
0069 
0070 #define PHY_STAT_GAIN_TRSW_SHT 0
0071 #define PHY_STAT_PWDB_ALL_SHT 4
0072 #define PHY_STAT_CFOSHO_SHT 5
0073 #define PHY_STAT_CCK_AGC_RPT_SHT 5
0074 #define PHY_STAT_CFOTAIL_SHT 9
0075 #define PHY_STAT_RXEVM_SHT 13
0076 #define PHY_STAT_RXSNR_SHT 15
0077 #define PHY_STAT_PDSNR_SHT 19
0078 #define PHY_STAT_CSI_CURRENT_SHT 21
0079 #define PHY_STAT_CSI_TARGET_SHT 23
0080 #define PHY_STAT_SIGEVM_SHT 25
0081 #define PHY_STAT_MAX_EX_PWR_SHT 26
0082 
0083 union recvstat {
0084     struct recv_stat recv_stat;
0085     unsigned int value[RXDESC_SIZE>>2];
0086 };
0087 
0088 struct recv_buf {
0089     struct list_head list;
0090     spinlock_t recvbuf_lock;
0091     u32 ref_cnt;
0092     struct _adapter  *adapter;
0093     struct urb *purb;
0094     _pkt *pskb;
0095     u8  irp_pending;
0096     u32  transfer_len;
0097     uint  len;
0098     u8 *phead;
0099     u8 *pdata;
0100     u8 *ptail;
0101     u8 *pend;
0102     u8 *pbuf;
0103     u8 *pallocated_buf;
0104 };
0105 
0106 /*
0107  *  head  ----->
0108  *      data  ----->
0109  *          payload
0110  *      tail  ----->
0111  *  end   ----->
0112  *  len = (unsigned int )(tail - data);
0113  */
0114 struct recv_frame_hdr {
0115     struct list_head list;
0116     _pkt    *pkt;
0117     _pkt *pkt_newalloc;
0118     struct _adapter  *adapter;
0119     u8 fragcnt;
0120     struct rx_pkt_attrib attrib;
0121     uint  len;
0122     u8 *rx_head;
0123     u8 *rx_data;
0124     u8 *rx_tail;
0125     u8 *rx_end;
0126     void *precvbuf;
0127     struct sta_info *psta;
0128     /*for A-MPDU Rx reordering buffer control*/
0129     struct recv_reorder_ctrl *preorder_ctrl;
0130 };
0131 
0132 union recv_frame {
0133     union {
0134         struct list_head list;
0135         struct recv_frame_hdr hdr;
0136     } u;
0137 };
0138 
0139 void r8712_init_recvbuf(struct _adapter *padapter, struct recv_buf *precvbuf);
0140 void r8712_rxcmd_event_hdl(struct _adapter *padapter, void *prxcmdbuf);
0141 s32 r8712_signal_scale_mapping(s32 cur_sig);
0142 void r8712_reordering_ctrl_timeout_handler(void *pcontext);
0143 
0144 #endif
0145