summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/eswin/fullmac/ecrnx_rx.h
blob: c84cd8b871ed35c7550e723c0c2d977222b25b2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/**
 ******************************************************************************
 *
 * @file ecrnx_rx.h
 *
 * Copyright (C) ESWIN 2015-2020
 *
 ******************************************************************************
 */
#ifndef _ECRNX_RX_H_
#define _ECRNX_RX_H_

#include <linux/workqueue.h>
#include "hal_desc.h"
enum rx_status_bits
{
    /// The buffer can be forwarded to the networking stack
    RX_STAT_FORWARD = 1 << 0,
    /// A new buffer has to be allocated
    RX_STAT_ALLOC = 1 << 1,
    /// The buffer has to be deleted
    RX_STAT_DELETE = 1 << 2,
    /// The length of the buffer has to be updated
    RX_STAT_LEN_UPDATE = 1 << 3,
    /// The length in the Ethernet header has to be updated
    RX_STAT_ETH_LEN_UPDATE = 1 << 4,
    /// Simple copy
    RX_STAT_COPY = 1 << 5,
    /// Spurious frame (inform upper layer and discard)
    RX_STAT_SPURIOUS = 1 << 6,
    /// packet for monitor interface
    RX_STAT_MONITOR = 1 << 7,
};

#if defined(CONFIG_ECRNX_ESWIN_USB)
typedef enum
{
    MSG_TYPE_DATA = 1,
    MSG_TYPE_CTRL
}MSG_TYPE_E;
#endif

/*
 * Decryption status subfields.
 * {
 */
// @}

#define _ASOCREQ_IE_OFFSET_     4   /* excluding wlan_hdr */
#define _REASOCREQ_IE_OFFSET_   10
#define STATION_INFO_ASSOC_REQ_IES 0
#define WLAN_HDR_A3_LEN            24
#define get_addr2_ptr(pbuf)	((unsigned char *)((unsigned int)(pbuf) + 10))

/* keep it same with the FW */
#define RX_CNTRL_REORD_WIN_SIZE 42
#ifdef CONFIG_ECRNX_MON_DATA
#define RX_MACHDR_BACKUP_LEN    64
/// MAC header backup descriptor
struct mon_machdrdesc
{
    /// Length of the buffer
    u32 buf_len;
    /// Buffer containing mac header, LLC and SNAP
    u8 buffer[RX_MACHDR_BACKUP_LEN];
};
#endif

struct hw_rxhdr {
    /** RX vector */
    struct hw_vect hwvect;

    /** PHY channel information */
    struct phy_channel_info_desc phy_info;

    /** RX flags */
    u32    flags_is_amsdu     : 1;
    u32    flags_is_80211_mpdu: 1;
    u32    flags_is_4addr     : 1;
    u32    flags_new_peer     : 1;
    u32    flags_user_prio    : 3;
    u32    flags_rsvd0        : 1;
    u32    flags_vif_idx      : 8;    // 0xFF if invalid VIF index
    u32    flags_sta_idx      : 8;    // 0xFF if invalid STA index
    u32    flags_dst_idx      : 8;    // 0xFF if unknown destination STA
#ifdef CONFIG_ECRNX_MON_DATA
    /// MAC header backup descriptor (used only for MSDU when there is a monitor and a data interface)
    struct mon_machdrdesc mac_hdr_backup;
#endif
    /** Pattern indicating if the buffer is available for the driver */
    u32    pattern;
};

struct ecrnx_defer_rx {
    struct sk_buff_head sk_list;
    struct work_struct work;
};

/**
 * struct ecrnx_defer_rx_cb - Control buffer for deferred buffers
 *
 * @vif: VIF that received the buffer
 */
struct ecrnx_defer_rx_cb {
    struct ecrnx_vif *vif;
};

u8 ecrnx_unsup_rx_vec_ind(void *pthis, void *hostid);
u8 ecrnx_rxdataind(void *pthis, void *hostid);
void ecrnx_rx_deferred(struct work_struct *ws);
void ecrnx_rx_defer_skb(struct ecrnx_hw *ecrnx_hw, struct ecrnx_vif *ecrnx_vif,
                       struct sk_buff *skb);
#ifdef CONFIG_ECRNX_ESWIN_SDIO
int ecrnx_rx_callback(void *priv, struct sk_buff *skb);
#elif defined(CONFIG_ECRNX_ESWIN_USB)
int ecrnx_rx_callback(void *priv, struct sk_buff *skb, uint8_t endpoint);
#endif

void ecrnx_rx_reord_deinit(struct ecrnx_hw *ecrnx_hw);
void ecrnx_rx_reord_init(struct ecrnx_hw *ecrnx_hw);
void ecrnx_rx_reord_sta_init(struct ecrnx_hw* ecrnx_hw, struct ecrnx_vif *ecrnx_vif, u8 sta_idx);
void ecrnx_rx_reord_sta_deinit(struct ecrnx_hw* ecrnx_hw, u8 sta_idx, bool is_del);


#endif /* _ECRNX_RX_H_ */