Merge remote-tracking branch 'spi/fix/core' into spi-linus
[deliverable/linux.git] / drivers / net / ethernet / intel / i40evf / i40e_adminq.h
1 /*******************************************************************************
2 *
3 * Intel Ethernet Controller XL710 Family Linux Virtual Function Driver
4 * Copyright(c) 2013 Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * The full GNU General Public License is included in this distribution in
16 * the file called "COPYING".
17 *
18 * Contact Information:
19 * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
20 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
21 *
22 ******************************************************************************/
23
24 #ifndef _I40E_ADMINQ_H_
25 #define _I40E_ADMINQ_H_
26
27 #include "i40e_osdep.h"
28 #include "i40e_adminq_cmd.h"
29
30 #define I40E_ADMINQ_DESC(R, i) \
31 (&(((struct i40e_aq_desc *)((R).desc_buf.va))[i]))
32
33 #define I40E_ADMINQ_DESC_ALIGNMENT 4096
34
35 struct i40e_adminq_ring {
36 struct i40e_virt_mem dma_head; /* space for dma structures */
37 struct i40e_dma_mem desc_buf; /* descriptor ring memory */
38 struct i40e_virt_mem cmd_buf; /* command buffer memory */
39
40 union {
41 struct i40e_dma_mem *asq_bi;
42 struct i40e_dma_mem *arq_bi;
43 } r;
44
45 u16 count; /* Number of descriptors */
46 u16 rx_buf_len; /* Admin Receive Queue buffer length */
47
48 /* used for interrupt processing */
49 u16 next_to_use;
50 u16 next_to_clean;
51
52 /* used for queue tracking */
53 u32 head;
54 u32 tail;
55 u32 len;
56 };
57
58 /* ASQ transaction details */
59 struct i40e_asq_cmd_details {
60 void *callback; /* cast from type I40E_ADMINQ_CALLBACK */
61 u64 cookie;
62 u16 flags_ena;
63 u16 flags_dis;
64 bool async;
65 bool postpone;
66 };
67
68 #define I40E_ADMINQ_DETAILS(R, i) \
69 (&(((struct i40e_asq_cmd_details *)((R).cmd_buf.va))[i]))
70
71 /* ARQ event information */
72 struct i40e_arq_event_info {
73 struct i40e_aq_desc desc;
74 u16 msg_size;
75 u8 *msg_buf;
76 };
77
78 /* Admin Queue information */
79 struct i40e_adminq_info {
80 struct i40e_adminq_ring arq; /* receive queue */
81 struct i40e_adminq_ring asq; /* send queue */
82 u16 num_arq_entries; /* receive queue depth */
83 u16 num_asq_entries; /* send queue depth */
84 u16 arq_buf_size; /* receive queue buffer size */
85 u16 asq_buf_size; /* send queue buffer size */
86 u16 fw_maj_ver; /* firmware major version */
87 u16 fw_min_ver; /* firmware minor version */
88 u16 api_maj_ver; /* api major version */
89 u16 api_min_ver; /* api minor version */
90
91 struct mutex asq_mutex; /* Send queue lock */
92 struct mutex arq_mutex; /* Receive queue lock */
93
94 /* last status values on send and receive queues */
95 enum i40e_admin_queue_err asq_last_status;
96 enum i40e_admin_queue_err arq_last_status;
97 };
98
99 /* general information */
100 #define I40E_AQ_LARGE_BUF 512
101 #define I40E_ASQ_CMD_TIMEOUT 100000 /* usecs */
102
103 void i40evf_fill_default_direct_cmd_desc(struct i40e_aq_desc *desc,
104 u16 opcode);
105
106 #endif /* _I40E_ADMINQ_H_ */
This page took 0.046866 seconds and 6 git commands to generate.