1
2
3
4#ifndef _I40E_CLIENT_H_
5#define _I40E_CLIENT_H_
6
7#define I40E_CLIENT_STR_LENGTH 10
8
9
10
11
12#define I40E_CLIENT_VERSION_MAJOR 0
13#define I40E_CLIENT_VERSION_MINOR 01
14#define I40E_CLIENT_VERSION_BUILD 00
15#define I40E_CLIENT_VERSION_STR \
16 __stringify(I40E_CLIENT_VERSION_MAJOR) "." \
17 __stringify(I40E_CLIENT_VERSION_MINOR) "." \
18 __stringify(I40E_CLIENT_VERSION_BUILD)
19
20struct i40e_client_version {
21 u8 major;
22 u8 minor;
23 u8 build;
24 u8 rsvd;
25};
26
27enum i40e_client_state {
28 __I40E_CLIENT_NULL,
29 __I40E_CLIENT_REGISTERED
30};
31
32enum i40e_client_instance_state {
33 __I40E_CLIENT_INSTANCE_NONE,
34 __I40E_CLIENT_INSTANCE_OPENED,
35};
36
37struct i40e_ops;
38struct i40e_client;
39
40#define I40E_QUEUE_INVALID_IDX 0xFFFF
41
42struct i40e_qv_info {
43 u32 v_idx;
44 u16 ceq_idx;
45 u16 aeq_idx;
46 u8 itr_idx;
47};
48
49struct i40e_qvlist_info {
50 u32 num_vectors;
51 struct i40e_qv_info qv_info[1];
52};
53
54
55
56
57
58struct i40e_prio_qos_params {
59 u16 qs_handle;
60 u8 tc;
61 u8 reserved;
62};
63
64#define I40E_CLIENT_MAX_USER_PRIORITY 8
65
66struct i40e_qos_params {
67 struct i40e_prio_qos_params prio_qos[I40E_CLIENT_MAX_USER_PRIORITY];
68};
69
70struct i40e_params {
71 struct i40e_qos_params qos;
72 u16 mtu;
73};
74
75
76struct i40e_info {
77 struct i40e_client_version version;
78 u8 lanmac[6];
79 struct net_device *netdev;
80 struct pci_dev *pcidev;
81 u8 __iomem *hw_addr;
82 u8 fid;
83#define I40E_CLIENT_FTYPE_PF 0
84 u8 ftype;
85 void *pf;
86
87
88
89
90 struct i40e_qvlist_info *qvlist_info;
91 struct i40e_params params;
92 struct i40e_ops *ops;
93
94 u16 msix_count;
95
96 struct msix_entry *msix_entries;
97 u16 itr_index;
98 u16 fw_maj_ver;
99 u16 fw_min_ver;
100 u32 fw_build;
101};
102
103#define I40E_CLIENT_RESET_LEVEL_PF 1
104#define I40E_CLIENT_RESET_LEVEL_CORE 2
105#define I40E_CLIENT_VSI_FLAG_TCP_ENABLE BIT(1)
106
107struct i40e_ops {
108
109 int (*setup_qvlist)(struct i40e_info *ldev, struct i40e_client *client,
110 struct i40e_qvlist_info *qv_info);
111
112 int (*virtchnl_send)(struct i40e_info *ldev, struct i40e_client *client,
113 u32 vf_id, u8 *msg, u16 len);
114
115
116
117
118 void (*request_reset)(struct i40e_info *ldev,
119 struct i40e_client *client, u32 level);
120
121
122
123
124 int (*update_vsi_ctxt)(struct i40e_info *ldev,
125 struct i40e_client *client,
126 bool is_vf, u32 vf_id,
127 u32 flag, u32 valid_flag);
128};
129
130struct i40e_client_ops {
131
132
133
134 int (*open)(struct i40e_info *ldev, struct i40e_client *client);
135
136
137
138
139
140 void (*close)(struct i40e_info *ldev, struct i40e_client *client,
141 bool reset);
142
143
144 void (*l2_param_change)(struct i40e_info *ldev,
145 struct i40e_client *client,
146 struct i40e_params *params);
147
148 int (*virtchnl_receive)(struct i40e_info *ldev,
149 struct i40e_client *client, u32 vf_id,
150 u8 *msg, u16 len);
151
152
153 void (*vf_reset)(struct i40e_info *ldev,
154 struct i40e_client *client, u32 vf_id);
155
156
157 void (*vf_enable)(struct i40e_info *ldev,
158 struct i40e_client *client, u32 num_vfs);
159
160
161 int (*vf_capable)(struct i40e_info *ldev,
162 struct i40e_client *client, u32 vf_id);
163};
164
165
166struct i40e_client_instance {
167 struct list_head list;
168 struct i40e_info lan_info;
169 struct i40e_client *client;
170 unsigned long state;
171};
172
173struct i40e_client {
174 struct list_head list;
175 char name[I40E_CLIENT_STR_LENGTH];
176 struct i40e_client_version version;
177 unsigned long state;
178 atomic_t ref_cnt;
179 u32 flags;
180 u8 type;
181#define I40E_CLIENT_IWARP 0
182 const struct i40e_client_ops *ops;
183};
184
185static inline bool i40e_client_is_registered(struct i40e_client *client)
186{
187 return test_bit(__I40E_CLIENT_REGISTERED, &client->state);
188}
189
190
191int i40e_register_client(struct i40e_client *client);
192int i40e_unregister_client(struct i40e_client *client);
193
194#endif
195