1 /*******************************************************************************
3 * Intel Ethernet Controller XL710 Family Linux Driver
4 * Copyright(c) 2013 - 2017 Intel Corporation.
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.
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
15 * You should have received a copy of the GNU General Public License along
16 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 * The full GNU General Public License is included in this distribution in
19 * the file called "COPYING".
21 * Contact Information:
22 * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
23 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
25 ******************************************************************************/
27 #include <linux/list.h>
28 #include <linux/errno.h>
31 #include "i40e_prototype.h"
32 #include "i40e_client.h"
34 static const char i40e_client_interface_version_str[] = I40E_CLIENT_VERSION_STR;
35 static struct i40e_client *registered_client;
36 static LIST_HEAD(i40e_devices);
37 static DEFINE_MUTEX(i40e_device_mutex);
39 static int i40e_client_virtchnl_send(struct i40e_info *ldev,
40 struct i40e_client *client,
41 u32 vf_id, u8 *msg, u16 len);
43 static int i40e_client_setup_qvlist(struct i40e_info *ldev,
44 struct i40e_client *client,
45 struct i40e_qvlist_info *qvlist_info);
47 static void i40e_client_request_reset(struct i40e_info *ldev,
48 struct i40e_client *client,
51 static int i40e_client_update_vsi_ctxt(struct i40e_info *ldev,
52 struct i40e_client *client,
53 bool is_vf, u32 vf_id,
54 u32 flag, u32 valid_flag);
56 static struct i40e_ops i40e_lan_ops = {
57 .virtchnl_send = i40e_client_virtchnl_send,
58 .setup_qvlist = i40e_client_setup_qvlist,
59 .request_reset = i40e_client_request_reset,
60 .update_vsi_ctxt = i40e_client_update_vsi_ctxt,
64 * i40e_client_get_params - Get the params that can change at runtime
65 * @vsi: the VSI with the message
66 * @param: clinet param struct
70 int i40e_client_get_params(struct i40e_vsi *vsi, struct i40e_params *params)
72 struct i40e_dcbx_config *dcb_cfg = &vsi->back->hw.local_dcbx_config;
75 for (i = 0; i < I40E_MAX_USER_PRIORITY; i++) {
76 u8 tc = dcb_cfg->etscfg.prioritytable[i];
79 /* If TC is not enabled for VSI use TC0 for UP */
80 if (!(vsi->tc_config.enabled_tc & BIT(tc)))
83 qs_handle = le16_to_cpu(vsi->info.qs_handle[tc]);
84 params->qos.prio_qos[i].tc = tc;
85 params->qos.prio_qos[i].qs_handle = qs_handle;
86 if (qs_handle == I40E_AQ_VSI_QS_HANDLE_INVALID) {
87 dev_err(&vsi->back->pdev->dev, "Invalid queue set handle for TC = %d, vsi id = %d\n",
93 params->mtu = vsi->netdev->mtu;
98 * i40e_notify_client_of_vf_msg - call the client vf message callback
99 * @vsi: the VSI with the message
100 * @vf_id: the absolute VF id that sent the message
101 * @msg: message buffer
102 * @len: length of the message
104 * If there is a client to this VSI, call the client
107 i40e_notify_client_of_vf_msg(struct i40e_vsi *vsi, u32 vf_id, u8 *msg, u16 len)
109 struct i40e_pf *pf = vsi->back;
110 struct i40e_client_instance *cdev = pf->cinst;
112 if (!cdev || !cdev->client)
114 if (!cdev->client->ops || !cdev->client->ops->virtchnl_receive) {
115 dev_dbg(&pf->pdev->dev,
116 "Cannot locate client instance virtual channel receive routine\n");
119 if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state)) {
120 dev_dbg(&pf->pdev->dev, "Client is not open, abort virtchnl_receive\n");
123 cdev->client->ops->virtchnl_receive(&cdev->lan_info, cdev->client,
128 * i40e_notify_client_of_l2_param_changes - call the client notify callback
129 * @vsi: the VSI with l2 param changes
131 * If there is a client to this VSI, call the client
133 void i40e_notify_client_of_l2_param_changes(struct i40e_vsi *vsi)
135 struct i40e_pf *pf = vsi->back;
136 struct i40e_client_instance *cdev = pf->cinst;
137 struct i40e_params params;
139 if (!cdev || !cdev->client)
141 if (!cdev->client->ops || !cdev->client->ops->l2_param_change) {
142 dev_dbg(&vsi->back->pdev->dev,
143 "Cannot locate client instance l2_param_change routine\n");
146 if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state)) {
147 dev_dbg(&vsi->back->pdev->dev, "Client is not open, abort l2 param change\n");
150 memset(¶ms, 0, sizeof(params));
151 i40e_client_get_params(vsi, ¶ms);
152 memcpy(&cdev->lan_info.params, ¶ms, sizeof(struct i40e_params));
153 cdev->client->ops->l2_param_change(&cdev->lan_info, cdev->client,
158 * i40e_client_release_qvlist - release MSI-X vector mapping for client
159 * @ldev: pointer to L2 context.
162 static void i40e_client_release_qvlist(struct i40e_info *ldev)
164 struct i40e_qvlist_info *qvlist_info = ldev->qvlist_info;
167 if (!ldev->qvlist_info)
170 for (i = 0; i < qvlist_info->num_vectors; i++) {
171 struct i40e_pf *pf = ldev->pf;
172 struct i40e_qv_info *qv_info;
175 qv_info = &qvlist_info->qv_info[i];
178 reg_idx = I40E_PFINT_LNKLSTN(qv_info->v_idx - 1);
179 wr32(&pf->hw, reg_idx, I40E_PFINT_LNKLSTN_FIRSTQ_INDX_MASK);
181 kfree(ldev->qvlist_info);
182 ldev->qvlist_info = NULL;
186 * i40e_notify_client_of_netdev_close - call the client close callback
187 * @vsi: the VSI with netdev closed
188 * @reset: true when close called due to a reset pending
190 * If there is a client to this netdev, call the client with close
192 void i40e_notify_client_of_netdev_close(struct i40e_vsi *vsi, bool reset)
194 struct i40e_pf *pf = vsi->back;
195 struct i40e_client_instance *cdev = pf->cinst;
197 if (!cdev || !cdev->client)
199 if (!cdev->client->ops || !cdev->client->ops->close) {
200 dev_dbg(&vsi->back->pdev->dev,
201 "Cannot locate client instance close routine\n");
204 cdev->client->ops->close(&cdev->lan_info, cdev->client, reset);
205 clear_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state);
206 i40e_client_release_qvlist(&cdev->lan_info);
210 * i40e_notify_client_of_vf_reset - call the client vf reset callback
211 * @pf: PF device pointer
212 * @vf_id: asolute id of VF being reset
214 * If there is a client attached to this PF, notify when a VF is reset
216 void i40e_notify_client_of_vf_reset(struct i40e_pf *pf, u32 vf_id)
218 struct i40e_client_instance *cdev = pf->cinst;
220 if (!cdev || !cdev->client)
222 if (!cdev->client->ops || !cdev->client->ops->vf_reset) {
223 dev_dbg(&pf->pdev->dev,
224 "Cannot locate client instance VF reset routine\n");
227 if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state)) {
228 dev_dbg(&pf->pdev->dev, "Client is not open, abort vf-reset\n");
231 cdev->client->ops->vf_reset(&cdev->lan_info, cdev->client, vf_id);
235 * i40e_notify_client_of_vf_enable - call the client vf notification callback
236 * @pf: PF device pointer
237 * @num_vfs: the number of VFs currently enabled, 0 for disable
239 * If there is a client attached to this PF, call its VF notification routine
241 void i40e_notify_client_of_vf_enable(struct i40e_pf *pf, u32 num_vfs)
243 struct i40e_client_instance *cdev = pf->cinst;
245 if (!cdev || !cdev->client)
247 if (!cdev->client->ops || !cdev->client->ops->vf_enable) {
248 dev_dbg(&pf->pdev->dev,
249 "Cannot locate client instance VF enable routine\n");
252 if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED,
254 dev_dbg(&pf->pdev->dev, "Client is not open, abort vf-enable\n");
257 cdev->client->ops->vf_enable(&cdev->lan_info, cdev->client, num_vfs);
261 * i40e_vf_client_capable - ask the client if it likes the specified VF
262 * @pf: PF device pointer
263 * @vf_id: the VF in question
265 * If there is a client of the specified type attached to this PF, call
266 * its vf_capable routine
268 int i40e_vf_client_capable(struct i40e_pf *pf, u32 vf_id)
270 struct i40e_client_instance *cdev = pf->cinst;
273 if (!cdev || !cdev->client)
275 if (!cdev->client->ops || !cdev->client->ops->vf_capable) {
276 dev_dbg(&pf->pdev->dev,
277 "Cannot locate client instance VF capability routine\n");
280 if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state))
283 capable = cdev->client->ops->vf_capable(&cdev->lan_info,
291 * i40e_client_add_instance - add a client instance struct to the instance list
292 * @pf: pointer to the board struct
293 * @client: pointer to a client struct in the client list.
294 * @existing: if there was already an existing instance
297 static void i40e_client_add_instance(struct i40e_pf *pf)
299 struct i40e_client_instance *cdev = NULL;
300 struct netdev_hw_addr *mac = NULL;
301 struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];
303 if (!registered_client || pf->cinst)
306 cdev = kzalloc(sizeof(*cdev), GFP_KERNEL);
310 cdev->lan_info.pf = (void *)pf;
311 cdev->lan_info.netdev = vsi->netdev;
312 cdev->lan_info.pcidev = pf->pdev;
313 cdev->lan_info.fid = pf->hw.pf_id;
314 cdev->lan_info.ftype = I40E_CLIENT_FTYPE_PF;
315 cdev->lan_info.hw_addr = pf->hw.hw_addr;
316 cdev->lan_info.ops = &i40e_lan_ops;
317 cdev->lan_info.version.major = I40E_CLIENT_VERSION_MAJOR;
318 cdev->lan_info.version.minor = I40E_CLIENT_VERSION_MINOR;
319 cdev->lan_info.version.build = I40E_CLIENT_VERSION_BUILD;
320 cdev->lan_info.fw_maj_ver = pf->hw.aq.fw_maj_ver;
321 cdev->lan_info.fw_min_ver = pf->hw.aq.fw_min_ver;
322 cdev->lan_info.fw_build = pf->hw.aq.fw_build;
323 set_bit(__I40E_CLIENT_INSTANCE_NONE, &cdev->state);
325 if (i40e_client_get_params(vsi, &cdev->lan_info.params)) {
331 cdev->lan_info.msix_count = pf->num_iwarp_msix;
332 cdev->lan_info.msix_entries = &pf->msix_entries[pf->iwarp_base_vector];
334 mac = list_first_entry(&cdev->lan_info.netdev->dev_addrs.list,
335 struct netdev_hw_addr, list);
337 ether_addr_copy(cdev->lan_info.lanmac, mac->addr);
339 dev_err(&pf->pdev->dev, "MAC address list is empty!\n");
341 cdev->client = registered_client;
346 * i40e_client_del_instance - removes a client instance from the list
347 * @pf: pointer to the board struct
351 void i40e_client_del_instance(struct i40e_pf *pf)
358 * i40e_client_subtask - client maintenance work
359 * @pf: board private structure
361 void i40e_client_subtask(struct i40e_pf *pf)
363 struct i40e_client *client = registered_client;
364 struct i40e_client_instance *cdev;
365 struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];
368 if (!(pf->flags & I40E_FLAG_SERVICE_CLIENT_REQUESTED))
370 pf->flags &= ~I40E_FLAG_SERVICE_CLIENT_REQUESTED;
373 /* If we're down or resetting, just bail */
374 if (test_bit(__I40E_DOWN, pf->state) ||
375 test_bit(__I40E_CONFIG_BUSY, pf->state))
378 if (!client || !cdev)
381 /* Here we handle client opens. If the client is down, but
382 * the netdev is up, then open the client.
384 if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state)) {
385 if (!test_bit(__I40E_VSI_DOWN, vsi->state) &&
386 client->ops && client->ops->open) {
387 set_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state);
388 ret = client->ops->open(&cdev->lan_info, client);
390 /* Remove failed client instance */
391 clear_bit(__I40E_CLIENT_INSTANCE_OPENED,
393 i40e_client_del_instance(pf);
397 /* Likewise for client close. If the client is up, but the netdev
398 * is down, then close the client.
400 if (test_bit(__I40E_VSI_DOWN, vsi->state) &&
401 client->ops && client->ops->close) {
402 clear_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state);
403 client->ops->close(&cdev->lan_info, client, false);
404 i40e_client_release_qvlist(&cdev->lan_info);
410 * i40e_lan_add_device - add a lan device struct to the list of lan devices
411 * @pf: pointer to the board struct
413 * Returns 0 on success or none 0 on error
415 int i40e_lan_add_device(struct i40e_pf *pf)
417 struct i40e_device *ldev;
420 mutex_lock(&i40e_device_mutex);
421 list_for_each_entry(ldev, &i40e_devices, list) {
422 if (ldev->pf == pf) {
427 ldev = kzalloc(sizeof(*ldev), GFP_KERNEL);
433 INIT_LIST_HEAD(&ldev->list);
434 list_add(&ldev->list, &i40e_devices);
435 dev_info(&pf->pdev->dev, "Added LAN device PF%d bus=0x%02x dev=0x%02x func=0x%02x\n",
436 pf->hw.pf_id, pf->hw.bus.bus_id,
437 pf->hw.bus.device, pf->hw.bus.func);
439 /* If a client has already been registered, we need to add an instance
440 * of it to our new LAN device.
442 if (registered_client)
443 i40e_client_add_instance(pf);
445 /* Since in some cases register may have happened before a device gets
446 * added, we can schedule a subtask to go initiate the clients if
447 * they can be launched at probe time.
449 pf->flags |= I40E_FLAG_SERVICE_CLIENT_REQUESTED;
450 i40e_service_event_schedule(pf);
453 mutex_unlock(&i40e_device_mutex);
458 * i40e_lan_del_device - removes a lan device from the device list
459 * @pf: pointer to the board struct
461 * Returns 0 on success or non-0 on error
463 int i40e_lan_del_device(struct i40e_pf *pf)
465 struct i40e_device *ldev, *tmp;
468 /* First, remove any client instance. */
469 i40e_client_del_instance(pf);
471 mutex_lock(&i40e_device_mutex);
472 list_for_each_entry_safe(ldev, tmp, &i40e_devices, list) {
473 if (ldev->pf == pf) {
474 dev_info(&pf->pdev->dev, "Deleted LAN device PF%d bus=0x%02x dev=0x%02x func=0x%02x\n",
475 pf->hw.pf_id, pf->hw.bus.bus_id,
476 pf->hw.bus.device, pf->hw.bus.func);
477 list_del(&ldev->list);
483 mutex_unlock(&i40e_device_mutex);
488 * i40e_client_release - release client specific resources
489 * @client: pointer to the registered client
492 static void i40e_client_release(struct i40e_client *client)
494 struct i40e_client_instance *cdev;
495 struct i40e_device *ldev;
498 mutex_lock(&i40e_device_mutex);
499 list_for_each_entry(ldev, &i40e_devices, list) {
505 while (test_and_set_bit(__I40E_SERVICE_SCHED,
507 usleep_range(500, 1000);
509 if (test_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state)) {
510 if (client->ops && client->ops->close)
511 client->ops->close(&cdev->lan_info, client,
513 i40e_client_release_qvlist(&cdev->lan_info);
514 clear_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state);
516 dev_warn(&pf->pdev->dev,
517 "Client %s instance for PF id %d closed\n",
518 client->name, pf->hw.pf_id);
520 /* delete the client instance */
521 i40e_client_del_instance(pf);
522 dev_info(&pf->pdev->dev, "Deleted client instance of Client %s\n",
524 clear_bit(__I40E_SERVICE_SCHED, pf->state);
526 mutex_unlock(&i40e_device_mutex);
530 * i40e_client_prepare - prepare client specific resources
531 * @client: pointer to the registered client
534 static void i40e_client_prepare(struct i40e_client *client)
536 struct i40e_device *ldev;
539 mutex_lock(&i40e_device_mutex);
540 list_for_each_entry(ldev, &i40e_devices, list) {
542 i40e_client_add_instance(pf);
543 /* Start the client subtask */
544 pf->flags |= I40E_FLAG_SERVICE_CLIENT_REQUESTED;
545 i40e_service_event_schedule(pf);
547 mutex_unlock(&i40e_device_mutex);
551 * i40e_client_virtchnl_send - TBD
552 * @ldev: pointer to L2 context
553 * @client: Client pointer
554 * @vf_id: absolute VF identifier
555 * @msg: message buffer
556 * @len: length of message buffer
558 * Return 0 on success or < 0 on error
560 static int i40e_client_virtchnl_send(struct i40e_info *ldev,
561 struct i40e_client *client,
562 u32 vf_id, u8 *msg, u16 len)
564 struct i40e_pf *pf = ldev->pf;
565 struct i40e_hw *hw = &pf->hw;
568 err = i40e_aq_send_msg_to_vf(hw, vf_id, VIRTCHNL_OP_IWARP,
571 dev_err(&pf->pdev->dev, "Unable to send iWarp message to VF, error %d, aq status %d\n",
572 err, hw->aq.asq_last_status);
578 * i40e_client_setup_qvlist
579 * @ldev: pointer to L2 context.
580 * @client: Client pointer.
581 * @qv_info: queue and vector list
583 * Return 0 on success or < 0 on error
585 static int i40e_client_setup_qvlist(struct i40e_info *ldev,
586 struct i40e_client *client,
587 struct i40e_qvlist_info *qvlist_info)
589 struct i40e_pf *pf = ldev->pf;
590 struct i40e_hw *hw = &pf->hw;
591 struct i40e_qv_info *qv_info;
592 u32 v_idx, i, reg_idx, reg;
595 size = sizeof(struct i40e_qvlist_info) +
596 (sizeof(struct i40e_qv_info) * (qvlist_info->num_vectors - 1));
597 ldev->qvlist_info = kzalloc(size, GFP_KERNEL);
598 if (!ldev->qvlist_info)
600 ldev->qvlist_info->num_vectors = qvlist_info->num_vectors;
602 for (i = 0; i < qvlist_info->num_vectors; i++) {
603 qv_info = &qvlist_info->qv_info[i];
606 v_idx = qv_info->v_idx;
608 /* Validate vector id belongs to this client */
609 if ((v_idx >= (pf->iwarp_base_vector + pf->num_iwarp_msix)) ||
610 (v_idx < pf->iwarp_base_vector))
613 ldev->qvlist_info->qv_info[i] = *qv_info;
614 reg_idx = I40E_PFINT_LNKLSTN(v_idx - 1);
616 if (qv_info->ceq_idx == I40E_QUEUE_INVALID_IDX) {
617 /* Special case - No CEQ mapped on this vector */
618 wr32(hw, reg_idx, I40E_PFINT_LNKLSTN_FIRSTQ_INDX_MASK);
620 reg = (qv_info->ceq_idx &
621 I40E_PFINT_LNKLSTN_FIRSTQ_INDX_MASK) |
622 (I40E_QUEUE_TYPE_PE_CEQ <<
623 I40E_PFINT_LNKLSTN_FIRSTQ_TYPE_SHIFT);
624 wr32(hw, reg_idx, reg);
626 reg = (I40E_PFINT_CEQCTL_CAUSE_ENA_MASK |
627 (v_idx << I40E_PFINT_CEQCTL_MSIX_INDX_SHIFT) |
629 I40E_PFINT_CEQCTL_ITR_INDX_SHIFT) |
630 (I40E_QUEUE_END_OF_LIST <<
631 I40E_PFINT_CEQCTL_NEXTQ_INDX_SHIFT));
632 wr32(hw, I40E_PFINT_CEQCTL(qv_info->ceq_idx), reg);
634 if (qv_info->aeq_idx != I40E_QUEUE_INVALID_IDX) {
635 reg = (I40E_PFINT_AEQCTL_CAUSE_ENA_MASK |
636 (v_idx << I40E_PFINT_AEQCTL_MSIX_INDX_SHIFT) |
638 I40E_PFINT_AEQCTL_ITR_INDX_SHIFT));
640 wr32(hw, I40E_PFINT_AEQCTL, reg);
643 /* Mitigate sync problems with iwarp VF driver */
647 kfree(ldev->qvlist_info);
648 ldev->qvlist_info = NULL;
653 * i40e_client_request_reset
654 * @ldev: pointer to L2 context.
655 * @client: Client pointer.
656 * @level: reset level
658 static void i40e_client_request_reset(struct i40e_info *ldev,
659 struct i40e_client *client,
662 struct i40e_pf *pf = ldev->pf;
664 switch (reset_level) {
665 case I40E_CLIENT_RESET_LEVEL_PF:
666 set_bit(__I40E_PF_RESET_REQUESTED, pf->state);
668 case I40E_CLIENT_RESET_LEVEL_CORE:
669 set_bit(__I40E_PF_RESET_REQUESTED, pf->state);
672 dev_warn(&pf->pdev->dev,
673 "Client for PF id %d requested an unsupported reset: %d.\n",
674 pf->hw.pf_id, reset_level);
678 i40e_service_event_schedule(pf);
682 * i40e_client_update_vsi_ctxt
683 * @ldev: pointer to L2 context.
684 * @client: Client pointer.
685 * @is_vf: if this for the VF
686 * @vf_id: if is_vf true this carries the vf_id
687 * @flag: Any device level setting that needs to be done for PE
688 * @valid_flag: Bits in this match up and enable changing of flag bits
690 * Return 0 on success or < 0 on error
692 static int i40e_client_update_vsi_ctxt(struct i40e_info *ldev,
693 struct i40e_client *client,
694 bool is_vf, u32 vf_id,
695 u32 flag, u32 valid_flag)
697 struct i40e_pf *pf = ldev->pf;
698 struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];
699 struct i40e_vsi_context ctxt;
703 /* TODO: for now do not allow setting VF's VSI setting */
707 ctxt.seid = pf->main_vsi_seid;
708 ctxt.pf_num = pf->hw.pf_id;
709 err = i40e_aq_get_vsi_params(&pf->hw, &ctxt, NULL);
710 ctxt.flags = I40E_AQ_VSI_TYPE_PF;
712 dev_info(&pf->pdev->dev,
713 "couldn't get PF vsi config, err %s aq_err %s\n",
714 i40e_stat_str(&pf->hw, err),
716 pf->hw.aq.asq_last_status));
720 if ((valid_flag & I40E_CLIENT_VSI_FLAG_TCP_PACKET_ENABLE) &&
721 (flag & I40E_CLIENT_VSI_FLAG_TCP_PACKET_ENABLE)) {
722 ctxt.info.valid_sections =
723 cpu_to_le16(I40E_AQ_VSI_PROP_QUEUE_OPT_VALID);
724 ctxt.info.queueing_opt_flags |= I40E_AQ_VSI_QUE_OPT_TCP_ENA;
725 } else if ((valid_flag & I40E_CLIENT_VSI_FLAG_TCP_PACKET_ENABLE) &&
726 !(flag & I40E_CLIENT_VSI_FLAG_TCP_PACKET_ENABLE)) {
727 ctxt.info.valid_sections =
728 cpu_to_le16(I40E_AQ_VSI_PROP_QUEUE_OPT_VALID);
729 ctxt.info.queueing_opt_flags &= ~I40E_AQ_VSI_QUE_OPT_TCP_ENA;
732 dev_warn(&pf->pdev->dev,
733 "Client for PF id %d request an unsupported Config: %x.\n",
738 err = i40e_aq_update_vsi_params(&vsi->back->hw, &ctxt, NULL);
740 dev_info(&pf->pdev->dev,
741 "update VSI ctxt for PE failed, err %s aq_err %s\n",
742 i40e_stat_str(&pf->hw, err),
744 pf->hw.aq.asq_last_status));
751 * i40e_register_client - Register a i40e client driver with the L2 driver
752 * @client: pointer to the i40e_client struct
754 * Returns 0 on success or non-0 on error
756 int i40e_register_client(struct i40e_client *client)
765 if (strlen(client->name) == 0) {
766 pr_info("i40e: Failed to register client with no name\n");
771 if (registered_client) {
772 pr_info("i40e: Client %s has already been registered!\n",
778 if ((client->version.major != I40E_CLIENT_VERSION_MAJOR) ||
779 (client->version.minor != I40E_CLIENT_VERSION_MINOR)) {
780 pr_info("i40e: Failed to register client %s due to mismatched client interface version\n",
782 pr_info("Client is using version: %02d.%02d.%02d while LAN driver supports %s\n",
783 client->version.major, client->version.minor,
784 client->version.build,
785 i40e_client_interface_version_str);
790 registered_client = client;
792 i40e_client_prepare(client);
794 pr_info("i40e: Registered client %s\n", client->name);
798 EXPORT_SYMBOL(i40e_register_client);
801 * i40e_unregister_client - Unregister a i40e client driver with the L2 driver
802 * @client: pointer to the i40e_client struct
804 * Returns 0 on success or non-0 on error
806 int i40e_unregister_client(struct i40e_client *client)
810 if (registered_client != client) {
811 pr_info("i40e: Client %s has not been registered\n",
816 registered_client = NULL;
817 /* When a unregister request comes through we would have to send
818 * a close for each of the client instances that were opened.
819 * client_release function is called to handle this.
821 i40e_client_release(client);
823 pr_info("i40e: Unregistered client %s\n", client->name);
827 EXPORT_SYMBOL(i40e_unregister_client);