mirror of
https://github.com/lwfinger/rtl8188eu.git
synced 2025-06-23 08:34:20 +00:00
rtl8188eu: Change union recv_frame to struct
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
parent
89efde68f8
commit
7fd86158bf
11 changed files with 377 additions and 381 deletions
|
@ -267,7 +267,7 @@ struct recv_buf {
|
|||
len = (unsigned int )(tail - data);
|
||||
|
||||
*/
|
||||
struct recv_frame_hdr {
|
||||
struct recv_frame {
|
||||
struct list_head list;
|
||||
struct sk_buff *pkt;
|
||||
struct sk_buff *pkt_newalloc;
|
||||
|
@ -286,23 +286,15 @@ struct recv_frame_hdr {
|
|||
struct recv_reorder_ctrl *preorder_ctrl;
|
||||
};
|
||||
|
||||
union recv_frame {
|
||||
union {
|
||||
struct list_head list;
|
||||
struct recv_frame_hdr hdr;
|
||||
uint mem[RECVFRAME_HDR_ALIGN>>2];
|
||||
} u;
|
||||
};
|
||||
|
||||
union recv_frame *_rtw_alloc_recvframe(struct __queue *pfree_recv_queue);
|
||||
union recv_frame *rtw_alloc_recvframe(struct __queue *pfree_recv_queue);
|
||||
void rtw_init_recvframe(union recv_frame *precvframe,
|
||||
struct recv_frame *_rtw_alloc_recvframe(struct __queue *pfree_recv_queue);
|
||||
struct recv_frame *rtw_alloc_recvframe(struct __queue *pfree_recv_queue);
|
||||
void rtw_init_recvframe(struct recv_frame *precvframe,
|
||||
struct recv_priv *precvpriv);
|
||||
int rtw_free_recvframe(union recv_frame *precvframe,
|
||||
int rtw_free_recvframe(struct recv_frame *precvframe,
|
||||
struct __queue *pfree_recv_queue);
|
||||
#define rtw_dequeue_recvframe(queue) rtw_alloc_recvframe(queue)
|
||||
int _rtw_enqueue_recvframe(union recv_frame *precvframe, struct __queue *queue);
|
||||
int rtw_enqueue_recvframe(union recv_frame *precvframe, struct __queue *queue);
|
||||
int _rtw_enqueue_recvframe(struct recv_frame *precvframe, struct __queue *queue);
|
||||
int rtw_enqueue_recvframe(struct recv_frame *precvframe, struct __queue *queue);
|
||||
void rtw_free_recvframe_queue(struct __queue *pframequeue,
|
||||
struct __queue *pfree_recv_queue);
|
||||
u32 rtw_free_uc_swdec_pending_queue(struct adapter *adapter);
|
||||
|
@ -312,29 +304,29 @@ struct recv_buf *rtw_dequeue_recvbuf(struct __queue *queue);
|
|||
|
||||
void rtw_reordering_ctrl_timeout_handler(void *pcontext);
|
||||
|
||||
static inline u8 *get_rxmem(union recv_frame *precvframe)
|
||||
static inline u8 *get_rxmem(struct recv_frame *precvframe)
|
||||
{
|
||||
/* always return rx_head... */
|
||||
if (precvframe == NULL)
|
||||
return NULL;
|
||||
return precvframe->u.hdr.rx_head;
|
||||
return precvframe->rx_head;
|
||||
}
|
||||
|
||||
static inline u8 *get_rx_status(union recv_frame *precvframe)
|
||||
static inline u8 *get_rx_status(struct recv_frame *precvframe)
|
||||
{
|
||||
return get_rxmem(precvframe);
|
||||
}
|
||||
|
||||
static inline u8 *get_recvframe_data(union recv_frame *precvframe)
|
||||
static inline u8 *get_recvframe_data(struct recv_frame *precvframe)
|
||||
{
|
||||
/* always return rx_data */
|
||||
if (precvframe == NULL)
|
||||
return NULL;
|
||||
|
||||
return precvframe->u.hdr.rx_data;
|
||||
return precvframe->rx_data;
|
||||
}
|
||||
|
||||
static inline u8 *recvframe_push(union recv_frame *precvframe, int sz)
|
||||
static inline u8 *recvframe_push(struct recv_frame *precvframe, int sz)
|
||||
{
|
||||
/* append data before rx_data */
|
||||
|
||||
|
@ -345,16 +337,16 @@ static inline u8 *recvframe_push(union recv_frame *precvframe, int sz)
|
|||
*/
|
||||
if (precvframe == NULL)
|
||||
return NULL;
|
||||
precvframe->u.hdr.rx_data -= sz ;
|
||||
if (precvframe->u.hdr.rx_data < precvframe->u.hdr.rx_head) {
|
||||
precvframe->u.hdr.rx_data += sz;
|
||||
precvframe->rx_data -= sz ;
|
||||
if (precvframe->rx_data < precvframe->rx_head) {
|
||||
precvframe->rx_data += sz;
|
||||
return NULL;
|
||||
}
|
||||
precvframe->u.hdr.len += sz;
|
||||
return precvframe->u.hdr.rx_data;
|
||||
precvframe->len += sz;
|
||||
return precvframe->rx_data;
|
||||
}
|
||||
|
||||
static inline u8 *recvframe_pull(union recv_frame *precvframe, int sz)
|
||||
static inline u8 *recvframe_pull(struct recv_frame *precvframe, int sz)
|
||||
{
|
||||
/* rx_data += sz; move rx_data sz bytes hereafter */
|
||||
|
||||
|
@ -363,16 +355,16 @@ static inline u8 *recvframe_pull(union recv_frame *precvframe, int sz)
|
|||
|
||||
if (precvframe == NULL)
|
||||
return NULL;
|
||||
precvframe->u.hdr.rx_data += sz;
|
||||
if (precvframe->u.hdr.rx_data > precvframe->u.hdr.rx_tail) {
|
||||
precvframe->u.hdr.rx_data -= sz;
|
||||
precvframe->rx_data += sz;
|
||||
if (precvframe->rx_data > precvframe->rx_tail) {
|
||||
precvframe->rx_data -= sz;
|
||||
return NULL;
|
||||
}
|
||||
precvframe->u.hdr.len -= sz;
|
||||
return precvframe->u.hdr.rx_data;
|
||||
precvframe->len -= sz;
|
||||
return precvframe->rx_data;
|
||||
}
|
||||
|
||||
static inline u8 *recvframe_put(union recv_frame *precvframe, int sz)
|
||||
static inline u8 *recvframe_put(struct recv_frame *precvframe, int sz)
|
||||
{
|
||||
/* used for append sz bytes from ptr to rx_tail, update rx_tail
|
||||
* and return the updated rx_tail to the caller */
|
||||
|
@ -381,17 +373,17 @@ static inline u8 *recvframe_put(union recv_frame *precvframe, int sz)
|
|||
if (precvframe == NULL)
|
||||
return NULL;
|
||||
|
||||
precvframe->u.hdr.rx_tail += sz;
|
||||
precvframe->rx_tail += sz;
|
||||
|
||||
if (precvframe->u.hdr.rx_tail > precvframe->u.hdr.rx_end) {
|
||||
precvframe->u.hdr.rx_tail -= sz;
|
||||
if (precvframe->rx_tail > precvframe->rx_end) {
|
||||
precvframe->rx_tail -= sz;
|
||||
return NULL;
|
||||
}
|
||||
precvframe->u.hdr.len += sz;
|
||||
return precvframe->u.hdr.rx_tail;
|
||||
precvframe->len += sz;
|
||||
return precvframe->rx_tail;
|
||||
}
|
||||
|
||||
static inline u8 *recvframe_pull_tail(union recv_frame *precvframe, int sz)
|
||||
static inline u8 *recvframe_pull_tail(struct recv_frame *precvframe, int sz)
|
||||
{
|
||||
/* rmv data from rx_tail (by yitsen) */
|
||||
|
||||
|
@ -401,16 +393,16 @@ static inline u8 *recvframe_pull_tail(union recv_frame *precvframe, int sz)
|
|||
|
||||
if (precvframe == NULL)
|
||||
return NULL;
|
||||
precvframe->u.hdr.rx_tail -= sz;
|
||||
if (precvframe->u.hdr.rx_tail < precvframe->u.hdr.rx_data) {
|
||||
precvframe->u.hdr.rx_tail += sz;
|
||||
precvframe->rx_tail -= sz;
|
||||
if (precvframe->rx_tail < precvframe->rx_data) {
|
||||
precvframe->rx_tail += sz;
|
||||
return NULL;
|
||||
}
|
||||
precvframe->u.hdr.len -= sz;
|
||||
return precvframe->u.hdr.rx_tail;
|
||||
precvframe->len -= sz;
|
||||
return precvframe->rx_tail;
|
||||
}
|
||||
|
||||
static inline unsigned char *get_rxbuf_desc(union recv_frame *precvframe)
|
||||
static inline unsigned char *get_rxbuf_desc(struct recv_frame *precvframe)
|
||||
{
|
||||
unsigned char *buf_desc;
|
||||
|
||||
|
@ -419,20 +411,20 @@ static inline unsigned char *get_rxbuf_desc(union recv_frame *precvframe)
|
|||
return buf_desc;
|
||||
}
|
||||
|
||||
static inline union recv_frame *rxmem_to_recvframe(u8 *rxmem)
|
||||
static inline struct recv_frame *rxmem_to_recvframe(u8 *rxmem)
|
||||
{
|
||||
/* due to the design of 2048 bytes alignment of recv_frame,
|
||||
* we can reference the union recv_frame */
|
||||
* we can reference the struct recv_frame */
|
||||
/* from any given member of recv_frame. */
|
||||
/* rxmem indicates the any member/address in recv_frame */
|
||||
|
||||
return (union recv_frame *)(((size_t)rxmem >> RXFRAME_ALIGN) << RXFRAME_ALIGN);
|
||||
return (struct recv_frame *)(((size_t)rxmem >> RXFRAME_ALIGN) << RXFRAME_ALIGN);
|
||||
}
|
||||
|
||||
static inline union recv_frame *pkt_to_recvframe(struct sk_buff *pkt)
|
||||
static inline struct recv_frame *pkt_to_recvframe(struct sk_buff *pkt)
|
||||
{
|
||||
u8 *buf_star;
|
||||
union recv_frame *precv_frame;
|
||||
struct recv_frame *precv_frame;
|
||||
precv_frame = rxmem_to_recvframe((unsigned char *)buf_star);
|
||||
|
||||
return precv_frame;
|
||||
|
@ -442,23 +434,23 @@ static inline u8 *pkt_to_recvmem(struct sk_buff *pkt)
|
|||
{
|
||||
/* return the rx_head */
|
||||
|
||||
union recv_frame *precv_frame = pkt_to_recvframe(pkt);
|
||||
struct recv_frame *precv_frame = pkt_to_recvframe(pkt);
|
||||
|
||||
return precv_frame->u.hdr.rx_head;
|
||||
return precv_frame->rx_head;
|
||||
}
|
||||
|
||||
static inline u8 *pkt_to_recvdata(struct sk_buff *pkt)
|
||||
{
|
||||
/* return the rx_data */
|
||||
|
||||
union recv_frame *precv_frame = pkt_to_recvframe(pkt);
|
||||
struct recv_frame *precv_frame = pkt_to_recvframe(pkt);
|
||||
|
||||
return precv_frame->u.hdr.rx_data;
|
||||
return precv_frame->rx_data;
|
||||
}
|
||||
|
||||
static inline int get_recvframe_len(union recv_frame *precvframe)
|
||||
static inline int get_recvframe_len(struct recv_frame *precvframe)
|
||||
{
|
||||
return precvframe->u.hdr.len;
|
||||
return precvframe->len;
|
||||
}
|
||||
|
||||
static inline s32 translate_percentage_to_dbm(u32 sig_stren_index)
|
||||
|
@ -476,6 +468,6 @@ struct sta_info;
|
|||
|
||||
void _rtw_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv);
|
||||
|
||||
void mgt_dispatcher(struct adapter *padapter, union recv_frame *precv_frame);
|
||||
void mgt_dispatcher(struct adapter *padapter, struct recv_frame *precv_frame);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue