1
2#ifndef _I40E_CLIENT_H_
3#define _I40E_CLIENT_H_
4
5#define I40EVF_CLIENT_STR_LENGTH 10
6
7
8
9
10#define I40EVF_CLIENT_VERSION_MAJOR 0
11#define I40EVF_CLIENT_VERSION_MINOR 01
12#define I40EVF_CLIENT_VERSION_BUILD 00
13#define I40EVF_CLIENT_VERSION_STR \
14 __stringify(I40EVF_CLIENT_VERSION_MAJOR) "." \
15 __stringify(I40EVF_CLIENT_VERSION_MINOR) "." \
16 __stringify(I40EVF_CLIENT_VERSION_BUILD)
17
18struct i40e_client_version {
19 u8 major;
20 u8 minor;
21 u8 build;
22 u8 rsvd;
23};
24
25enum i40e_client_state {
26 __I40E_CLIENT_NULL,
27 __I40E_CLIENT_REGISTERED
28};
29
30enum i40e_client_instance_state {
31 __I40E_CLIENT_INSTANCE_NONE,
32 __I40E_CLIENT_INSTANCE_OPENED,
33};
34
35struct i40e_ops;
36struct i40e_client;
37
38
39
40
41
42#define I40E_QUEUE_TYPE_PE_AEQ 0x80
43#define I40E_QUEUE_INVALID_IDX 0xFFFF
44
45struct i40e_qv_info {
46 u32 v_idx;
47 u16 ceq_idx;
48 u16 aeq_idx;
49 u8 itr_idx;
50};
51
52struct i40e_qvlist_info {
53 u32 num_vectors;
54 struct i40e_qv_info qv_info[1];
55};
56
57#define I40E_CLIENT_MSIX_ALL 0xFFFFFFFF
58
59
60
61
62struct i40e_prio_qos_params {
63 u16 qs_handle;
64 u8 tc;
65 u8 reserved;
66};
67
68#define I40E_CLIENT_MAX_USER_PRIORITY 8
69
70struct i40e_qos_params {
71 struct i40e_prio_qos_params prio_qos[I40E_CLIENT_MAX_USER_PRIORITY];
72};
73
74struct i40e_params {
75 struct i40e_qos_params qos;
76 u16 mtu;
77 u16 link_up;
78};
79
80
81struct i40e_info {
82 struct i40e_client_version version;
83 u8 lanmac[6];
84 struct net_device *netdev;
85 struct pci_dev *pcidev;
86 u8 __iomem *hw_addr;
87 u8 fid;
88#define I40E_CLIENT_FTYPE_PF 0
89#define I40E_CLIENT_FTYPE_VF 1
90 u8 ftype;
91 void *vf;
92
93
94
95
96 struct i40e_params params;
97 struct i40e_ops *ops;
98
99 u16 msix_count;
100
101 struct msix_entry *msix_entries;
102 u16 itr_index;
103};
104
105struct i40e_ops {
106
107 int (*setup_qvlist)(struct i40e_info *ldev, struct i40e_client *client,
108 struct i40e_qvlist_info *qv_info);
109
110 u32 (*virtchnl_send)(struct i40e_info *ldev, struct i40e_client *client,
111 u8 *msg, u16 len);
112
113
114 void (*request_reset)(struct i40e_info *ldev,
115 struct i40e_client *client);
116};
117
118struct i40e_client_ops {
119
120
121
122 int (*open)(struct i40e_info *ldev, struct i40e_client *client);
123
124
125
126
127
128 void (*close)(struct i40e_info *ldev, struct i40e_client *client,
129 bool reset);
130
131
132 void (*l2_param_change)(struct i40e_info *ldev,
133 struct i40e_client *client,
134 struct i40e_params *params);
135
136
137 int (*virtchnl_receive)(struct i40e_info *ldev,
138 struct i40e_client *client,
139 u8 *msg, u16 len);
140};
141
142
143struct i40e_client_instance {
144 struct list_head list;
145 struct i40e_info lan_info;
146 struct i40e_client *client;
147 unsigned long state;
148};
149
150struct i40e_client {
151 struct list_head list;
152 char name[I40EVF_CLIENT_STR_LENGTH];
153 struct i40e_client_version version;
154 unsigned long state;
155 atomic_t ref_cnt;
156 u32 flags;
157#define I40E_CLIENT_FLAGS_LAUNCH_ON_PROBE BIT(0)
158#define I40E_TX_FLAGS_NOTIFY_OTHER_EVENTS BIT(2)
159 u8 type;
160#define I40E_CLIENT_IWARP 0
161 struct i40e_client_ops *ops;
162};
163
164
165int i40evf_register_client(struct i40e_client *client);
166int i40evf_unregister_client(struct i40e_client *client);
167#endif
168