]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | // SPDX-License-Identifier: GPL-2.0 |
ed0e894d MW |
2 | #include <linux/list.h> |
3 | #include <linux/errno.h> | |
4 | ||
5 | #include "i40evf.h" | |
6 | #include "i40e_prototype.h" | |
7 | #include "i40evf_client.h" | |
8 | ||
9 | static | |
10 | const char i40evf_client_interface_version_str[] = I40EVF_CLIENT_VERSION_STR; | |
11 | static struct i40e_client *vf_registered_client; | |
12 | static LIST_HEAD(i40evf_devices); | |
13 | static DEFINE_MUTEX(i40evf_device_mutex); | |
14 | ||
15 | static u32 i40evf_client_virtchnl_send(struct i40e_info *ldev, | |
16 | struct i40e_client *client, | |
17 | u8 *msg, u16 len); | |
18 | ||
19 | static int i40evf_client_setup_qvlist(struct i40e_info *ldev, | |
20 | struct i40e_client *client, | |
21 | struct i40e_qvlist_info *qvlist_info); | |
22 | ||
23 | static struct i40e_ops i40evf_lan_ops = { | |
24 | .virtchnl_send = i40evf_client_virtchnl_send, | |
25 | .setup_qvlist = i40evf_client_setup_qvlist, | |
26 | }; | |
27 | ||
01acc73f AB |
28 | /** |
29 | * i40evf_client_get_params - retrieve relevant client parameters | |
30 | * @vsi: VSI with parameters | |
31 | * @params: client param struct | |
32 | **/ | |
33 | static | |
34 | void i40evf_client_get_params(struct i40e_vsi *vsi, struct i40e_params *params) | |
35 | { | |
36 | int i; | |
37 | ||
38 | memset(params, 0, sizeof(struct i40e_params)); | |
39 | params->mtu = vsi->netdev->mtu; | |
40 | params->link_up = vsi->back->link_up; | |
41 | ||
42 | for (i = 0; i < I40E_MAX_USER_PRIORITY; i++) { | |
43 | params->qos.prio_qos[i].tc = 0; | |
44 | params->qos.prio_qos[i].qs_handle = vsi->qs_handle; | |
45 | } | |
46 | } | |
47 | ||
ed0e894d MW |
48 | /** |
49 | * i40evf_notify_client_message - call the client message receive callback | |
50 | * @vsi: the VSI associated with this client | |
51 | * @msg: message buffer | |
52 | * @len: length of message | |
53 | * | |
54 | * If there is a client to this VSI, call the client | |
55 | **/ | |
56 | void i40evf_notify_client_message(struct i40e_vsi *vsi, u8 *msg, u16 len) | |
57 | { | |
703ba885 | 58 | struct i40e_client_instance *cinst; |
ed0e894d MW |
59 | |
60 | if (!vsi) | |
61 | return; | |
62 | ||
703ba885 | 63 | cinst = vsi->back->cinst; |
ed0e894d MW |
64 | if (!cinst || !cinst->client || !cinst->client->ops || |
65 | !cinst->client->ops->virtchnl_receive) { | |
66 | dev_dbg(&vsi->back->pdev->dev, | |
67 | "Cannot locate client instance virtchnl_receive function\n"); | |
68 | return; | |
69 | } | |
70 | cinst->client->ops->virtchnl_receive(&cinst->lan_info, cinst->client, | |
71 | msg, len); | |
72 | } | |
73 | ||
74 | /** | |
75 | * i40evf_notify_client_l2_params - call the client notify callback | |
76 | * @vsi: the VSI with l2 param changes | |
77 | * | |
78 | * If there is a client to this VSI, call the client | |
79 | **/ | |
80 | void i40evf_notify_client_l2_params(struct i40e_vsi *vsi) | |
81 | { | |
703ba885 | 82 | struct i40e_client_instance *cinst; |
ed0e894d MW |
83 | struct i40e_params params; |
84 | ||
85 | if (!vsi) | |
86 | return; | |
703ba885 CIK |
87 | |
88 | cinst = vsi->back->cinst; | |
ed0e894d MW |
89 | |
90 | if (!cinst || !cinst->client || !cinst->client->ops || | |
91 | !cinst->client->ops->l2_param_change) { | |
92 | dev_dbg(&vsi->back->pdev->dev, | |
93 | "Cannot locate client instance l2_param_change function\n"); | |
94 | return; | |
95 | } | |
01acc73f AB |
96 | i40evf_client_get_params(vsi, ¶ms); |
97 | cinst->lan_info.params = params; | |
ed0e894d MW |
98 | cinst->client->ops->l2_param_change(&cinst->lan_info, cinst->client, |
99 | ¶ms); | |
100 | } | |
101 | ||
102 | /** | |
103 | * i40evf_notify_client_open - call the client open callback | |
104 | * @vsi: the VSI with netdev opened | |
105 | * | |
106 | * If there is a client to this netdev, call the client with open | |
107 | **/ | |
108 | void i40evf_notify_client_open(struct i40e_vsi *vsi) | |
109 | { | |
110 | struct i40evf_adapter *adapter = vsi->back; | |
111 | struct i40e_client_instance *cinst = adapter->cinst; | |
112 | int ret; | |
113 | ||
114 | if (!cinst || !cinst->client || !cinst->client->ops || | |
115 | !cinst->client->ops->open) { | |
116 | dev_dbg(&vsi->back->pdev->dev, | |
117 | "Cannot locate client instance open function\n"); | |
118 | return; | |
119 | } | |
120 | if (!(test_bit(__I40E_CLIENT_INSTANCE_OPENED, &cinst->state))) { | |
121 | ret = cinst->client->ops->open(&cinst->lan_info, cinst->client); | |
122 | if (!ret) | |
123 | set_bit(__I40E_CLIENT_INSTANCE_OPENED, &cinst->state); | |
124 | } | |
125 | } | |
126 | ||
127 | /** | |
128 | * i40evf_client_release_qvlist - send a message to the PF to release iwarp qv map | |
129 | * @ldev: pointer to L2 context. | |
130 | * | |
131 | * Return 0 on success or < 0 on error | |
132 | **/ | |
133 | static int i40evf_client_release_qvlist(struct i40e_info *ldev) | |
134 | { | |
135 | struct i40evf_adapter *adapter = ldev->vf; | |
136 | i40e_status err; | |
137 | ||
138 | if (adapter->aq_required) | |
139 | return -EAGAIN; | |
140 | ||
141 | err = i40e_aq_send_msg_to_pf(&adapter->hw, | |
310a2ad9 | 142 | VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP, |
ed0e894d MW |
143 | I40E_SUCCESS, NULL, 0, NULL); |
144 | ||
145 | if (err) | |
146 | dev_err(&adapter->pdev->dev, | |
147 | "Unable to send iWarp vector release message to PF, error %d, aq status %d\n", | |
148 | err, adapter->hw.aq.asq_last_status); | |
149 | ||
150 | return err; | |
151 | } | |
152 | ||
153 | /** | |
154 | * i40evf_notify_client_close - call the client close callback | |
155 | * @vsi: the VSI with netdev closed | |
156 | * @reset: true when close called due to reset pending | |
157 | * | |
158 | * If there is a client to this netdev, call the client with close | |
159 | **/ | |
160 | void i40evf_notify_client_close(struct i40e_vsi *vsi, bool reset) | |
161 | { | |
162 | struct i40evf_adapter *adapter = vsi->back; | |
163 | struct i40e_client_instance *cinst = adapter->cinst; | |
164 | ||
165 | if (!cinst || !cinst->client || !cinst->client->ops || | |
166 | !cinst->client->ops->close) { | |
167 | dev_dbg(&vsi->back->pdev->dev, | |
168 | "Cannot locate client instance close function\n"); | |
169 | return; | |
170 | } | |
171 | cinst->client->ops->close(&cinst->lan_info, cinst->client, reset); | |
172 | i40evf_client_release_qvlist(&cinst->lan_info); | |
173 | clear_bit(__I40E_CLIENT_INSTANCE_OPENED, &cinst->state); | |
174 | } | |
175 | ||
176 | /** | |
177 | * i40evf_client_add_instance - add a client instance to the instance list | |
178 | * @adapter: pointer to the board struct | |
179 | * @client: pointer to a client struct in the client list. | |
180 | * | |
181 | * Returns cinst ptr on success, NULL on failure | |
182 | **/ | |
183 | static struct i40e_client_instance * | |
184 | i40evf_client_add_instance(struct i40evf_adapter *adapter) | |
185 | { | |
186 | struct i40e_client_instance *cinst = NULL; | |
ed0e894d | 187 | struct i40e_vsi *vsi = &adapter->vsi; |
01acc73f AB |
188 | struct netdev_hw_addr *mac = NULL; |
189 | struct i40e_params params; | |
ed0e894d MW |
190 | |
191 | if (!vf_registered_client) | |
192 | goto out; | |
193 | ||
194 | if (adapter->cinst) { | |
195 | cinst = adapter->cinst; | |
196 | goto out; | |
197 | } | |
198 | ||
199 | cinst = kzalloc(sizeof(*cinst), GFP_KERNEL); | |
200 | if (!cinst) | |
201 | goto out; | |
202 | ||
203 | cinst->lan_info.vf = (void *)adapter; | |
204 | cinst->lan_info.netdev = vsi->netdev; | |
205 | cinst->lan_info.pcidev = adapter->pdev; | |
206 | cinst->lan_info.fid = 0; | |
207 | cinst->lan_info.ftype = I40E_CLIENT_FTYPE_VF; | |
208 | cinst->lan_info.hw_addr = adapter->hw.hw_addr; | |
209 | cinst->lan_info.ops = &i40evf_lan_ops; | |
210 | cinst->lan_info.version.major = I40EVF_CLIENT_VERSION_MAJOR; | |
211 | cinst->lan_info.version.minor = I40EVF_CLIENT_VERSION_MINOR; | |
212 | cinst->lan_info.version.build = I40EVF_CLIENT_VERSION_BUILD; | |
01acc73f AB |
213 | i40evf_client_get_params(vsi, ¶ms); |
214 | cinst->lan_info.params = params; | |
ed0e894d MW |
215 | set_bit(__I40E_CLIENT_INSTANCE_NONE, &cinst->state); |
216 | ||
217 | cinst->lan_info.msix_count = adapter->num_iwarp_msix; | |
218 | cinst->lan_info.msix_entries = | |
219 | &adapter->msix_entries[adapter->iwarp_base_vector]; | |
220 | ||
ed0e894d MW |
221 | mac = list_first_entry(&cinst->lan_info.netdev->dev_addrs.list, |
222 | struct netdev_hw_addr, list); | |
223 | if (mac) | |
224 | ether_addr_copy(cinst->lan_info.lanmac, mac->addr); | |
225 | else | |
226 | dev_err(&adapter->pdev->dev, "MAC address list is empty!\n"); | |
227 | ||
228 | cinst->client = vf_registered_client; | |
229 | adapter->cinst = cinst; | |
230 | out: | |
231 | return cinst; | |
232 | } | |
233 | ||
234 | /** | |
235 | * i40evf_client_del_instance - removes a client instance from the list | |
236 | * @adapter: pointer to the board struct | |
237 | * @client: pointer to the client struct | |
238 | * | |
239 | **/ | |
240 | static | |
241 | void i40evf_client_del_instance(struct i40evf_adapter *adapter) | |
242 | { | |
243 | kfree(adapter->cinst); | |
244 | adapter->cinst = NULL; | |
245 | } | |
246 | ||
247 | /** | |
248 | * i40evf_client_subtask - client maintenance work | |
249 | * @adapter: board private structure | |
250 | **/ | |
251 | void i40evf_client_subtask(struct i40evf_adapter *adapter) | |
252 | { | |
253 | struct i40e_client *client = vf_registered_client; | |
254 | struct i40e_client_instance *cinst; | |
255 | int ret = 0; | |
256 | ||
257 | if (adapter->state < __I40EVF_DOWN) | |
258 | return; | |
259 | ||
260 | /* first check client is registered */ | |
261 | if (!client) | |
262 | return; | |
263 | ||
264 | /* Add the client instance to the instance list */ | |
265 | cinst = i40evf_client_add_instance(adapter); | |
266 | if (!cinst) | |
267 | return; | |
268 | ||
269 | dev_info(&adapter->pdev->dev, "Added instance of Client %s\n", | |
270 | client->name); | |
271 | ||
272 | if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED, &cinst->state)) { | |
273 | /* Send an Open request to the client */ | |
274 | ||
275 | if (client->ops && client->ops->open) | |
276 | ret = client->ops->open(&cinst->lan_info, client); | |
277 | if (!ret) | |
278 | set_bit(__I40E_CLIENT_INSTANCE_OPENED, | |
279 | &cinst->state); | |
280 | else | |
281 | /* remove client instance */ | |
282 | i40evf_client_del_instance(adapter); | |
283 | } | |
284 | } | |
285 | ||
286 | /** | |
287 | * i40evf_lan_add_device - add a lan device struct to the list of lan devices | |
288 | * @adapter: pointer to the board struct | |
289 | * | |
290 | * Returns 0 on success or none 0 on error | |
291 | **/ | |
292 | int i40evf_lan_add_device(struct i40evf_adapter *adapter) | |
293 | { | |
294 | struct i40e_device *ldev; | |
295 | int ret = 0; | |
296 | ||
297 | mutex_lock(&i40evf_device_mutex); | |
298 | list_for_each_entry(ldev, &i40evf_devices, list) { | |
299 | if (ldev->vf == adapter) { | |
300 | ret = -EEXIST; | |
301 | goto out; | |
302 | } | |
303 | } | |
304 | ldev = kzalloc(sizeof(*ldev), GFP_KERNEL); | |
305 | if (!ldev) { | |
306 | ret = -ENOMEM; | |
307 | goto out; | |
308 | } | |
309 | ldev->vf = adapter; | |
310 | INIT_LIST_HEAD(&ldev->list); | |
311 | list_add(&ldev->list, &i40evf_devices); | |
312 | dev_info(&adapter->pdev->dev, "Added LAN device bus=0x%02x dev=0x%02x func=0x%02x\n", | |
313 | adapter->hw.bus.bus_id, adapter->hw.bus.device, | |
314 | adapter->hw.bus.func); | |
315 | ||
316 | /* Since in some cases register may have happened before a device gets | |
317 | * added, we can schedule a subtask to go initiate the clients. | |
318 | */ | |
319 | adapter->flags |= I40EVF_FLAG_SERVICE_CLIENT_REQUESTED; | |
320 | ||
321 | out: | |
322 | mutex_unlock(&i40evf_device_mutex); | |
323 | return ret; | |
324 | } | |
325 | ||
326 | /** | |
327 | * i40evf_lan_del_device - removes a lan device from the device list | |
328 | * @adapter: pointer to the board struct | |
329 | * | |
330 | * Returns 0 on success or non-0 on error | |
331 | **/ | |
332 | int i40evf_lan_del_device(struct i40evf_adapter *adapter) | |
333 | { | |
334 | struct i40e_device *ldev, *tmp; | |
335 | int ret = -ENODEV; | |
336 | ||
337 | mutex_lock(&i40evf_device_mutex); | |
338 | list_for_each_entry_safe(ldev, tmp, &i40evf_devices, list) { | |
339 | if (ldev->vf == adapter) { | |
340 | dev_info(&adapter->pdev->dev, | |
341 | "Deleted LAN device bus=0x%02x dev=0x%02x func=0x%02x\n", | |
342 | adapter->hw.bus.bus_id, adapter->hw.bus.device, | |
343 | adapter->hw.bus.func); | |
344 | list_del(&ldev->list); | |
345 | kfree(ldev); | |
346 | ret = 0; | |
347 | break; | |
348 | } | |
349 | } | |
350 | ||
351 | mutex_unlock(&i40evf_device_mutex); | |
352 | return ret; | |
353 | } | |
354 | ||
355 | /** | |
356 | * i40evf_client_release - release client specific resources | |
357 | * @client: pointer to the registered client | |
358 | * | |
359 | **/ | |
360 | static void i40evf_client_release(struct i40e_client *client) | |
361 | { | |
362 | struct i40e_client_instance *cinst; | |
363 | struct i40e_device *ldev; | |
364 | struct i40evf_adapter *adapter; | |
365 | ||
366 | mutex_lock(&i40evf_device_mutex); | |
367 | list_for_each_entry(ldev, &i40evf_devices, list) { | |
368 | adapter = ldev->vf; | |
369 | cinst = adapter->cinst; | |
370 | if (!cinst) | |
371 | continue; | |
372 | if (test_bit(__I40E_CLIENT_INSTANCE_OPENED, &cinst->state)) { | |
373 | if (client->ops && client->ops->close) | |
374 | client->ops->close(&cinst->lan_info, client, | |
375 | false); | |
376 | i40evf_client_release_qvlist(&cinst->lan_info); | |
377 | clear_bit(__I40E_CLIENT_INSTANCE_OPENED, &cinst->state); | |
378 | ||
379 | dev_warn(&adapter->pdev->dev, | |
380 | "Client %s instance closed\n", client->name); | |
381 | } | |
382 | /* delete the client instance */ | |
383 | i40evf_client_del_instance(adapter); | |
384 | dev_info(&adapter->pdev->dev, "Deleted client instance of Client %s\n", | |
385 | client->name); | |
386 | } | |
387 | mutex_unlock(&i40evf_device_mutex); | |
388 | } | |
389 | ||
390 | /** | |
391 | * i40evf_client_prepare - prepare client specific resources | |
392 | * @client: pointer to the registered client | |
393 | * | |
394 | **/ | |
395 | static void i40evf_client_prepare(struct i40e_client *client) | |
396 | { | |
397 | struct i40e_device *ldev; | |
398 | struct i40evf_adapter *adapter; | |
399 | ||
400 | mutex_lock(&i40evf_device_mutex); | |
401 | list_for_each_entry(ldev, &i40evf_devices, list) { | |
402 | adapter = ldev->vf; | |
403 | /* Signal the watchdog to service the client */ | |
404 | adapter->flags |= I40EVF_FLAG_SERVICE_CLIENT_REQUESTED; | |
405 | } | |
406 | mutex_unlock(&i40evf_device_mutex); | |
407 | } | |
408 | ||
409 | /** | |
410 | * i40evf_client_virtchnl_send - send a message to the PF instance | |
411 | * @ldev: pointer to L2 context. | |
412 | * @client: Client pointer. | |
413 | * @msg: pointer to message buffer | |
414 | * @len: message length | |
415 | * | |
416 | * Return 0 on success or < 0 on error | |
417 | **/ | |
418 | static u32 i40evf_client_virtchnl_send(struct i40e_info *ldev, | |
419 | struct i40e_client *client, | |
420 | u8 *msg, u16 len) | |
421 | { | |
422 | struct i40evf_adapter *adapter = ldev->vf; | |
423 | i40e_status err; | |
424 | ||
425 | if (adapter->aq_required) | |
426 | return -EAGAIN; | |
427 | ||
310a2ad9 | 428 | err = i40e_aq_send_msg_to_pf(&adapter->hw, VIRTCHNL_OP_IWARP, |
ed0e894d MW |
429 | I40E_SUCCESS, msg, len, NULL); |
430 | if (err) | |
431 | dev_err(&adapter->pdev->dev, "Unable to send iWarp message to PF, error %d, aq status %d\n", | |
432 | err, adapter->hw.aq.asq_last_status); | |
433 | ||
434 | return err; | |
435 | } | |
436 | ||
437 | /** | |
438 | * i40evf_client_setup_qvlist - send a message to the PF to setup iwarp qv map | |
439 | * @ldev: pointer to L2 context. | |
440 | * @client: Client pointer. | |
441 | * @qv_info: queue and vector list | |
442 | * | |
443 | * Return 0 on success or < 0 on error | |
444 | **/ | |
445 | static int i40evf_client_setup_qvlist(struct i40e_info *ldev, | |
446 | struct i40e_client *client, | |
447 | struct i40e_qvlist_info *qvlist_info) | |
448 | { | |
310a2ad9 | 449 | struct virtchnl_iwarp_qvlist_info *v_qvlist_info; |
ed0e894d MW |
450 | struct i40evf_adapter *adapter = ldev->vf; |
451 | struct i40e_qv_info *qv_info; | |
452 | i40e_status err; | |
453 | u32 v_idx, i; | |
454 | u32 msg_size; | |
455 | ||
456 | if (adapter->aq_required) | |
457 | return -EAGAIN; | |
458 | ||
459 | /* A quick check on whether the vectors belong to the client */ | |
460 | for (i = 0; i < qvlist_info->num_vectors; i++) { | |
461 | qv_info = &qvlist_info->qv_info[i]; | |
462 | if (!qv_info) | |
463 | continue; | |
464 | v_idx = qv_info->v_idx; | |
465 | if ((v_idx >= | |
466 | (adapter->iwarp_base_vector + adapter->num_iwarp_msix)) || | |
467 | (v_idx < adapter->iwarp_base_vector)) | |
468 | return -EINVAL; | |
469 | } | |
470 | ||
310a2ad9 JB |
471 | v_qvlist_info = (struct virtchnl_iwarp_qvlist_info *)qvlist_info; |
472 | msg_size = sizeof(struct virtchnl_iwarp_qvlist_info) + | |
473 | (sizeof(struct virtchnl_iwarp_qv_info) * | |
ed0e894d MW |
474 | (v_qvlist_info->num_vectors - 1)); |
475 | ||
310a2ad9 | 476 | adapter->client_pending |= BIT(VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP); |
ed0e894d | 477 | err = i40e_aq_send_msg_to_pf(&adapter->hw, |
310a2ad9 | 478 | VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP, |
ed0e894d MW |
479 | I40E_SUCCESS, (u8 *)v_qvlist_info, msg_size, NULL); |
480 | ||
481 | if (err) { | |
482 | dev_err(&adapter->pdev->dev, | |
483 | "Unable to send iWarp vector config message to PF, error %d, aq status %d\n", | |
484 | err, adapter->hw.aq.asq_last_status); | |
485 | goto out; | |
486 | } | |
487 | ||
488 | err = -EBUSY; | |
489 | for (i = 0; i < 5; i++) { | |
490 | msleep(100); | |
491 | if (!(adapter->client_pending & | |
310a2ad9 | 492 | BIT(VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP))) { |
ed0e894d MW |
493 | err = 0; |
494 | break; | |
495 | } | |
496 | } | |
497 | out: | |
498 | return err; | |
499 | } | |
500 | ||
501 | /** | |
502 | * i40evf_register_client - Register a i40e client driver with the L2 driver | |
503 | * @client: pointer to the i40e_client struct | |
504 | * | |
505 | * Returns 0 on success or non-0 on error | |
506 | **/ | |
507 | int i40evf_register_client(struct i40e_client *client) | |
508 | { | |
509 | int ret = 0; | |
510 | ||
511 | if (!client) { | |
512 | ret = -EIO; | |
513 | goto out; | |
514 | } | |
515 | ||
516 | if (strlen(client->name) == 0) { | |
517 | pr_info("i40evf: Failed to register client with no name\n"); | |
518 | ret = -EIO; | |
519 | goto out; | |
520 | } | |
521 | ||
522 | if (vf_registered_client) { | |
523 | pr_info("i40evf: Client %s has already been registered!\n", | |
524 | client->name); | |
525 | ret = -EEXIST; | |
526 | goto out; | |
527 | } | |
528 | ||
529 | if ((client->version.major != I40EVF_CLIENT_VERSION_MAJOR) || | |
530 | (client->version.minor != I40EVF_CLIENT_VERSION_MINOR)) { | |
531 | pr_info("i40evf: Failed to register client %s due to mismatched client interface version\n", | |
532 | client->name); | |
533 | pr_info("Client is using version: %02d.%02d.%02d while LAN driver supports %s\n", | |
534 | client->version.major, client->version.minor, | |
535 | client->version.build, | |
536 | i40evf_client_interface_version_str); | |
537 | ret = -EIO; | |
538 | goto out; | |
539 | } | |
540 | ||
541 | vf_registered_client = client; | |
542 | ||
543 | i40evf_client_prepare(client); | |
544 | ||
545 | pr_info("i40evf: Registered client %s with return code %d\n", | |
546 | client->name, ret); | |
547 | out: | |
548 | return ret; | |
549 | } | |
550 | EXPORT_SYMBOL(i40evf_register_client); | |
551 | ||
552 | /** | |
553 | * i40evf_unregister_client - Unregister a i40e client driver with the L2 driver | |
554 | * @client: pointer to the i40e_client struct | |
555 | * | |
556 | * Returns 0 on success or non-0 on error | |
557 | **/ | |
558 | int i40evf_unregister_client(struct i40e_client *client) | |
559 | { | |
560 | int ret = 0; | |
561 | ||
562 | /* When a unregister request comes through we would have to send | |
563 | * a close for each of the client instances that were opened. | |
564 | * client_release function is called to handle this. | |
565 | */ | |
566 | i40evf_client_release(client); | |
567 | ||
568 | if (vf_registered_client != client) { | |
569 | pr_info("i40evf: Client %s has not been registered\n", | |
570 | client->name); | |
571 | ret = -ENODEV; | |
572 | goto out; | |
573 | } | |
574 | vf_registered_client = NULL; | |
575 | pr_info("i40evf: Unregistered client %s\n", client->name); | |
576 | out: | |
577 | return ret; | |
578 | } | |
579 | EXPORT_SYMBOL(i40evf_unregister_client); |