1
2
3
4 #ifndef _ICE_CONTROLQ_H_
5 #define _ICE_CONTROLQ_H_
6
7 #include "ice_adminq_cmd.h"
8
9
10 #define ICE_AQ_MAX_BUF_LEN 4096
11 #define ICE_MBXQ_MAX_BUF_LEN 4096
12
13 #define ICE_CTL_Q_DESC(R, i) \
14 (&(((struct ice_aq_desc *)((R).desc_buf.va))[i]))
15
16 #define ICE_CTL_Q_DESC_UNUSED(R) \
17 (u16)((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \
18 (R)->next_to_clean - (R)->next_to_use - 1)
19
20
21
22
23 #define EXP_FW_API_VER_BRANCH 0x00
24 #define EXP_FW_API_VER_MAJOR 0x01
25 #define EXP_FW_API_VER_MINOR 0x03
26
27
28 enum ice_ctl_q {
29 ICE_CTL_Q_UNKNOWN = 0,
30 ICE_CTL_Q_ADMIN,
31 ICE_CTL_Q_MAILBOX,
32 };
33
34
35 #define ICE_CTL_Q_SQ_CMD_TIMEOUT 2500
36 #define ICE_CTL_Q_SQ_CMD_USEC 100
37
38 struct ice_ctl_q_ring {
39 void *dma_head;
40 struct ice_dma_mem desc_buf;
41 void *cmd_buf;
42
43 union {
44 struct ice_dma_mem *sq_bi;
45 struct ice_dma_mem *rq_bi;
46 } r;
47
48 u16 count;
49
50
51 u16 next_to_use;
52 u16 next_to_clean;
53
54
55 u32 head;
56 u32 tail;
57 u32 len;
58 u32 bah;
59 u32 bal;
60 u32 len_mask;
61 u32 len_ena_mask;
62 u32 head_mask;
63 };
64
65
66 struct ice_sq_cd {
67 struct ice_aq_desc *wb_desc;
68 };
69
70 #define ICE_CTL_Q_DETAILS(R, i) (&(((struct ice_sq_cd *)((R).cmd_buf))[i]))
71
72
73 struct ice_rq_event_info {
74 struct ice_aq_desc desc;
75 u16 msg_len;
76 u16 buf_len;
77 u8 *msg_buf;
78 };
79
80
81 struct ice_ctl_q_info {
82 enum ice_ctl_q qtype;
83 enum ice_aq_err rq_last_status;
84 struct ice_ctl_q_ring rq;
85 struct ice_ctl_q_ring sq;
86 u32 sq_cmd_timeout;
87 u16 num_rq_entries;
88 u16 num_sq_entries;
89 u16 rq_buf_size;
90 u16 sq_buf_size;
91 enum ice_aq_err sq_last_status;
92 struct mutex sq_lock;
93 struct mutex rq_lock;
94 };
95
96 #endif