0001
0002 #ifndef _RTL871X_RECV_H_
0003 #define _RTL871X_RECV_H_
0004
0005 #include "osdep_service.h"
0006 #include "drv_types.h"
0007
0008 #define NR_RECVFRAME 256
0009
0010 #define RXFRAME_ALIGN 8
0011 #define RXFRAME_ALIGN_SZ (1 << RXFRAME_ALIGN)
0012
0013 #define MAX_SUBFRAME_COUNT 64
0014
0015
0016 struct recv_reorder_ctrl {
0017 struct _adapter *padapter;
0018 u16 indicate_seq;
0019 u16 wend_b;
0020 u8 wsize_b;
0021 struct __queue pending_recvframe_queue;
0022 struct timer_list reordering_ctrl_timer;
0023 };
0024
0025 struct stainfo_rxcache {
0026 u16 tid_rxseq[16];
0027 };
0028
0029 #define PHY_RSSI_SLID_WIN_MAX 100
0030 #define PHY_LINKQUALITY_SLID_WIN_MAX 20
0031
0032 struct smooth_rssi_data {
0033 u32 elements[100];
0034 u32 index;
0035 u32 total_num;
0036 u32 total_val;
0037 };
0038
0039 struct rx_pkt_attrib {
0040 u8 amsdu;
0041 u8 order;
0042 u8 qos;
0043 u8 to_fr_ds;
0044 u8 frag_num;
0045 u16 seq_num;
0046 u8 pw_save;
0047 u8 mfrag;
0048 u8 mdata;
0049 u8 privacy;
0050 u8 bdecrypted;
0051 int hdrlen;
0052 int encrypt;
0053 int iv_len;
0054 int icv_len;
0055 int priority;
0056 int ack_policy;
0057 u8 crc_err;
0058 u8 dst[ETH_ALEN];
0059 u8 src[ETH_ALEN];
0060 u8 ta[ETH_ALEN];
0061 u8 ra[ETH_ALEN];
0062 u8 bssid[ETH_ALEN];
0063 u8 tcpchk_valid;
0064 u8 ip_chkrpt;
0065 u8 tcp_chkrpt;
0066 u8 signal_qual;
0067 s8 rx_mimo_signal_qual[2];
0068 u8 mcs_rate;
0069 u8 htc;
0070 u8 signal_strength;
0071 };
0072
0073
0074
0075
0076
0077
0078
0079
0080 struct recv_priv {
0081 spinlock_t lock;
0082 struct __queue free_recv_queue;
0083 struct __queue recv_pending_queue;
0084 u8 *pallocated_frame_buf;
0085 u8 *precv_frame_buf;
0086 uint free_recvframe_cnt;
0087 struct _adapter *adapter;
0088 uint rx_bytes;
0089 uint rx_pkts;
0090 uint rx_drop;
0091 uint rx_icv_err;
0092 uint rx_largepacket_crcerr;
0093 uint rx_smallpacket_crcerr;
0094 uint rx_middlepacket_crcerr;
0095 u8 rx_pending_cnt;
0096 uint ff_hwaddr;
0097 struct tasklet_struct recv_tasklet;
0098 struct sk_buff_head free_recv_skb_queue;
0099 struct sk_buff_head rx_skb_queue;
0100 u8 *pallocated_recv_buf;
0101 u8 *precv_buf;
0102 struct __queue free_recv_buf_queue;
0103 u32 free_recv_buf_queue_cnt;
0104
0105 s8 rssi;
0106 u8 signal;
0107 u8 noise;
0108 u8 fw_rssi;
0109 struct smooth_rssi_data signal_qual_data;
0110 struct smooth_rssi_data signal_strength_data;
0111 };
0112
0113 struct sta_recv_priv {
0114 spinlock_t lock;
0115 sint option;
0116 struct __queue defrag_q;
0117 struct stainfo_rxcache rxcache;
0118 uint sta_rx_bytes;
0119 uint sta_rx_pkts;
0120 uint sta_rx_fail;
0121 };
0122
0123 #include "rtl8712_recv.h"
0124
0125
0126 union recv_frame *r8712_alloc_recvframe(struct __queue *pfree_recv_queue);
0127 void r8712_free_recvframe(union recv_frame *precvframe,
0128 struct __queue *pfree_recv_queue);
0129 void r8712_free_recvframe_queue(struct __queue *pframequeue,
0130 struct __queue *pfree_recv_queue);
0131 int r8712_wlanhdr_to_ethhdr(union recv_frame *precvframe);
0132 int recv_func(struct _adapter *padapter, void *pcontext);
0133
0134 static inline u8 *get_rxmem(union recv_frame *precvframe)
0135 {
0136
0137 if (!precvframe)
0138 return NULL;
0139 return precvframe->u.hdr.rx_head;
0140 }
0141
0142 static inline u8 *recvframe_pull(union recv_frame *precvframe, sint sz)
0143 {
0144
0145
0146
0147 if (!precvframe)
0148 return NULL;
0149 precvframe->u.hdr.rx_data += sz;
0150 if (precvframe->u.hdr.rx_data > precvframe->u.hdr.rx_tail) {
0151 precvframe->u.hdr.rx_data -= sz;
0152 return NULL;
0153 }
0154 precvframe->u.hdr.len -= sz;
0155 return precvframe->u.hdr.rx_data;
0156 }
0157
0158 static inline u8 *recvframe_put(union recv_frame *precvframe, sint sz)
0159 {
0160
0161
0162
0163
0164 if (!precvframe)
0165 return NULL;
0166 precvframe->u.hdr.rx_tail += sz;
0167 if (precvframe->u.hdr.rx_tail > precvframe->u.hdr.rx_end) {
0168 precvframe->u.hdr.rx_tail -= sz;
0169 return NULL;
0170 }
0171 precvframe->u.hdr.len += sz;
0172 return precvframe->u.hdr.rx_tail;
0173 }
0174
0175 static inline u8 *recvframe_pull_tail(union recv_frame *precvframe, sint sz)
0176 {
0177
0178
0179
0180
0181
0182 if (!precvframe)
0183 return NULL;
0184 precvframe->u.hdr.rx_tail -= sz;
0185 if (precvframe->u.hdr.rx_tail < precvframe->u.hdr.rx_data) {
0186 precvframe->u.hdr.rx_tail += sz;
0187 return NULL;
0188 }
0189 precvframe->u.hdr.len -= sz;
0190 return precvframe->u.hdr.rx_tail;
0191 }
0192
0193 struct sta_info;
0194
0195 void _r8712_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv);
0196 sint r8712_recvframe_chkmic(struct _adapter *adapter,
0197 union recv_frame *precvframe);
0198 union recv_frame *r8712_decryptor(struct _adapter *adapter,
0199 union recv_frame *precv_frame);
0200 union recv_frame *r8712_recvframe_chk_defrag(struct _adapter *adapter,
0201 union recv_frame *precv_frame);
0202 int r8712_validate_recv_frame(struct _adapter *adapter,
0203 union recv_frame *precv_frame);
0204 union recv_frame *r8712_portctrl(struct _adapter *adapter,
0205 union recv_frame *precv_frame);
0206
0207 #endif
0208