1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2013 - 2018 Intel Corporation. */
4 #include <linux/list.h>
5 #include <linux/errno.h>
6 #include <linux/net/intel/i40e_client.h>
10 static LIST_HEAD(i40e_devices
);
11 static DEFINE_MUTEX(i40e_device_mutex
);
12 DEFINE_IDA(i40e_client_ida
);
14 static int i40e_client_virtchnl_send(struct i40e_info
*ldev
,
15 struct i40e_client
*client
,
16 u32 vf_id
, u8
*msg
, u16 len
);
18 static int i40e_client_setup_qvlist(struct i40e_info
*ldev
,
19 struct i40e_client
*client
,
20 struct i40e_qvlist_info
*qvlist_info
);
22 static void i40e_client_request_reset(struct i40e_info
*ldev
,
23 struct i40e_client
*client
,
26 static int i40e_client_update_vsi_ctxt(struct i40e_info
*ldev
,
27 struct i40e_client
*client
,
28 bool is_vf
, u32 vf_id
,
29 u32 flag
, u32 valid_flag
);
31 static struct i40e_ops i40e_lan_ops
= {
32 .virtchnl_send
= i40e_client_virtchnl_send
,
33 .setup_qvlist
= i40e_client_setup_qvlist
,
34 .request_reset
= i40e_client_request_reset
,
35 .update_vsi_ctxt
= i40e_client_update_vsi_ctxt
,
39 * i40e_client_get_params - Get the params that can change at runtime
40 * @vsi: the VSI with the message
41 * @params: client param struct
45 int i40e_client_get_params(struct i40e_vsi
*vsi
, struct i40e_params
*params
)
47 struct i40e_dcbx_config
*dcb_cfg
= &vsi
->back
->hw
.local_dcbx_config
;
50 for (i
= 0; i
< I40E_MAX_USER_PRIORITY
; i
++) {
51 u8 tc
= dcb_cfg
->etscfg
.prioritytable
[i
];
54 /* If TC is not enabled for VSI use TC0 for UP */
55 if (!(vsi
->tc_config
.enabled_tc
& BIT(tc
)))
58 qs_handle
= le16_to_cpu(vsi
->info
.qs_handle
[tc
]);
59 params
->qos
.prio_qos
[i
].tc
= tc
;
60 params
->qos
.prio_qos
[i
].qs_handle
= qs_handle
;
61 if (qs_handle
== I40E_AQ_VSI_QS_HANDLE_INVALID
) {
62 dev_err(&vsi
->back
->pdev
->dev
, "Invalid queue set handle for TC = %d, vsi id = %d\n",
68 params
->mtu
= vsi
->netdev
->mtu
;
73 * i40e_notify_client_of_vf_msg - call the client vf message callback
74 * @vsi: the VSI with the message
75 * @vf_id: the absolute VF id that sent the message
76 * @msg: message buffer
77 * @len: length of the message
79 * If there is a client to this VSI, call the client
82 i40e_notify_client_of_vf_msg(struct i40e_vsi
*vsi
, u32 vf_id
, u8
*msg
, u16 len
)
84 struct i40e_pf
*pf
= vsi
->back
;
85 struct i40e_client_instance
*cdev
= pf
->cinst
;
87 if (!cdev
|| !cdev
->client
)
89 if (!cdev
->client
->ops
|| !cdev
->client
->ops
->virtchnl_receive
) {
90 dev_dbg(&pf
->pdev
->dev
,
91 "Cannot locate client instance virtual channel receive routine\n");
94 if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED
, &cdev
->state
)) {
95 dev_dbg(&pf
->pdev
->dev
, "Client is not open, abort virtchnl_receive\n");
98 cdev
->client
->ops
->virtchnl_receive(&cdev
->lan_info
, cdev
->client
,
103 * i40e_notify_client_of_l2_param_changes - call the client notify callback
104 * @pf: PF device pointer
106 * If there is a client, call its callback
108 void i40e_notify_client_of_l2_param_changes(struct i40e_pf
*pf
)
110 struct i40e_vsi
*vsi
= i40e_pf_get_main_vsi(pf
);
111 struct i40e_client_instance
*cdev
= pf
->cinst
;
112 struct i40e_params params
;
114 if (!cdev
|| !cdev
->client
)
116 if (!cdev
->client
->ops
|| !cdev
->client
->ops
->l2_param_change
) {
117 dev_dbg(&pf
->pdev
->dev
,
118 "Cannot locate client instance l2_param_change routine\n");
121 if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED
, &cdev
->state
)) {
122 dev_dbg(&pf
->pdev
->dev
,
123 "Client is not open, abort l2 param change\n");
126 memset(¶ms
, 0, sizeof(params
));
127 i40e_client_get_params(vsi
, ¶ms
);
128 memcpy(&cdev
->lan_info
.params
, ¶ms
, sizeof(struct i40e_params
));
129 cdev
->client
->ops
->l2_param_change(&cdev
->lan_info
, cdev
->client
,
134 * i40e_client_release_qvlist - release MSI-X vector mapping for client
135 * @ldev: pointer to L2 context.
138 static void i40e_client_release_qvlist(struct i40e_info
*ldev
)
140 struct i40e_qvlist_info
*qvlist_info
= ldev
->qvlist_info
;
143 if (!ldev
->qvlist_info
)
146 for (i
= 0; i
< qvlist_info
->num_vectors
; i
++) {
147 struct i40e_pf
*pf
= ldev
->pf
;
148 struct i40e_qv_info
*qv_info
;
151 qv_info
= &qvlist_info
->qv_info
[i
];
152 reg_idx
= I40E_PFINT_LNKLSTN(qv_info
->v_idx
- 1);
153 wr32(&pf
->hw
, reg_idx
, I40E_PFINT_LNKLSTN_FIRSTQ_INDX_MASK
);
155 kfree(ldev
->qvlist_info
);
156 ldev
->qvlist_info
= NULL
;
160 * i40e_notify_client_of_netdev_close - call the client close callback
161 * @pf: PF device pointer
162 * @reset: true when close called due to a reset pending
164 * If there is a client to this netdev, call the client with close
166 void i40e_notify_client_of_netdev_close(struct i40e_pf
*pf
, bool reset
)
168 struct i40e_client_instance
*cdev
= pf
->cinst
;
170 if (!cdev
|| !cdev
->client
)
172 if (!cdev
->client
->ops
|| !cdev
->client
->ops
->close
) {
173 dev_dbg(&pf
->pdev
->dev
,
174 "Cannot locate client instance close routine\n");
177 if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED
, &cdev
->state
)) {
178 dev_dbg(&pf
->pdev
->dev
, "Client is not open, abort close\n");
181 cdev
->client
->ops
->close(&cdev
->lan_info
, cdev
->client
, reset
);
182 clear_bit(__I40E_CLIENT_INSTANCE_OPENED
, &cdev
->state
);
183 i40e_client_release_qvlist(&cdev
->lan_info
);
187 * i40e_notify_client_of_vf_reset - call the client vf reset callback
188 * @pf: PF device pointer
189 * @vf_id: asolute id of VF being reset
191 * If there is a client attached to this PF, notify when a VF is reset
193 void i40e_notify_client_of_vf_reset(struct i40e_pf
*pf
, u32 vf_id
)
195 struct i40e_client_instance
*cdev
= pf
->cinst
;
197 if (!cdev
|| !cdev
->client
)
199 if (!cdev
->client
->ops
|| !cdev
->client
->ops
->vf_reset
) {
200 dev_dbg(&pf
->pdev
->dev
,
201 "Cannot locate client instance VF reset routine\n");
204 if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED
, &cdev
->state
)) {
205 dev_dbg(&pf
->pdev
->dev
, "Client is not open, abort vf-reset\n");
208 cdev
->client
->ops
->vf_reset(&cdev
->lan_info
, cdev
->client
, vf_id
);
212 * i40e_notify_client_of_vf_enable - call the client vf notification callback
213 * @pf: PF device pointer
214 * @num_vfs: the number of VFs currently enabled, 0 for disable
216 * If there is a client attached to this PF, call its VF notification routine
218 void i40e_notify_client_of_vf_enable(struct i40e_pf
*pf
, u32 num_vfs
)
220 struct i40e_client_instance
*cdev
= pf
->cinst
;
222 if (!cdev
|| !cdev
->client
)
224 if (!cdev
->client
->ops
|| !cdev
->client
->ops
->vf_enable
) {
225 dev_dbg(&pf
->pdev
->dev
,
226 "Cannot locate client instance VF enable routine\n");
229 if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED
,
231 dev_dbg(&pf
->pdev
->dev
, "Client is not open, abort vf-enable\n");
234 cdev
->client
->ops
->vf_enable(&cdev
->lan_info
, cdev
->client
, num_vfs
);
238 * i40e_vf_client_capable - ask the client if it likes the specified VF
239 * @pf: PF device pointer
240 * @vf_id: the VF in question
242 * If there is a client of the specified type attached to this PF, call
243 * its vf_capable routine
245 int i40e_vf_client_capable(struct i40e_pf
*pf
, u32 vf_id
)
247 struct i40e_client_instance
*cdev
= pf
->cinst
;
250 if (!cdev
|| !cdev
->client
)
252 if (!cdev
->client
->ops
|| !cdev
->client
->ops
->vf_capable
) {
253 dev_dbg(&pf
->pdev
->dev
,
254 "Cannot locate client instance VF capability routine\n");
257 if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED
, &cdev
->state
))
260 capable
= cdev
->client
->ops
->vf_capable(&cdev
->lan_info
,
267 void i40e_client_update_msix_info(struct i40e_pf
*pf
)
269 struct i40e_client_instance
*cdev
= pf
->cinst
;
271 if (!cdev
|| !cdev
->client
)
274 cdev
->lan_info
.msix_count
= pf
->num_iwarp_msix
;
275 cdev
->lan_info
.msix_entries
= &pf
->msix_entries
[pf
->iwarp_base_vector
];
278 static void i40e_auxiliary_dev_release(struct device
*dev
)
280 struct i40e_auxiliary_device
*i40e_aux_dev
=
281 container_of(dev
, struct i40e_auxiliary_device
, aux_dev
.dev
);
283 ida_free(&i40e_client_ida
, i40e_aux_dev
->aux_dev
.id
);
287 static int i40e_register_auxiliary_dev(struct i40e_info
*ldev
, const char *name
)
289 struct i40e_auxiliary_device
*i40e_aux_dev
;
290 struct pci_dev
*pdev
= ldev
->pcidev
;
291 struct auxiliary_device
*aux_dev
;
294 i40e_aux_dev
= kzalloc(sizeof(*i40e_aux_dev
), GFP_KERNEL
);
298 i40e_aux_dev
->ldev
= ldev
;
300 aux_dev
= &i40e_aux_dev
->aux_dev
;
301 aux_dev
->name
= name
;
302 aux_dev
->dev
.parent
= &pdev
->dev
;
303 aux_dev
->dev
.release
= i40e_auxiliary_dev_release
;
304 ldev
->aux_dev
= aux_dev
;
306 ret
= ida_alloc(&i40e_client_ida
, GFP_KERNEL
);
313 ret
= auxiliary_device_init(aux_dev
);
315 ida_free(&i40e_client_ida
, aux_dev
->id
);
320 ret
= auxiliary_device_add(aux_dev
);
322 auxiliary_device_uninit(aux_dev
);
330 * i40e_client_add_instance - add a client instance struct to the instance list
331 * @pf: pointer to the board struct
334 static void i40e_client_add_instance(struct i40e_pf
*pf
)
336 struct i40e_vsi
*vsi
= i40e_pf_get_main_vsi(pf
);
337 struct i40e_client_instance
*cdev
= NULL
;
338 struct netdev_hw_addr
*mac
= NULL
;
340 cdev
= kzalloc(sizeof(*cdev
), GFP_KERNEL
);
344 cdev
->lan_info
.pf
= (void *)pf
;
345 cdev
->lan_info
.netdev
= vsi
->netdev
;
346 cdev
->lan_info
.pcidev
= pf
->pdev
;
347 cdev
->lan_info
.fid
= pf
->hw
.pf_id
;
348 cdev
->lan_info
.ftype
= I40E_CLIENT_FTYPE_PF
;
349 cdev
->lan_info
.hw_addr
= pf
->hw
.hw_addr
;
350 cdev
->lan_info
.ops
= &i40e_lan_ops
;
351 cdev
->lan_info
.version
.major
= I40E_CLIENT_VERSION_MAJOR
;
352 cdev
->lan_info
.version
.minor
= I40E_CLIENT_VERSION_MINOR
;
353 cdev
->lan_info
.version
.build
= I40E_CLIENT_VERSION_BUILD
;
354 cdev
->lan_info
.fw_maj_ver
= pf
->hw
.aq
.fw_maj_ver
;
355 cdev
->lan_info
.fw_min_ver
= pf
->hw
.aq
.fw_min_ver
;
356 cdev
->lan_info
.fw_build
= pf
->hw
.aq
.fw_build
;
357 set_bit(__I40E_CLIENT_INSTANCE_NONE
, &cdev
->state
);
359 if (i40e_client_get_params(vsi
, &cdev
->lan_info
.params
))
362 mac
= list_first_entry(&cdev
->lan_info
.netdev
->dev_addrs
.list
,
363 struct netdev_hw_addr
, list
);
365 ether_addr_copy(cdev
->lan_info
.lanmac
, mac
->addr
);
367 dev_err(&pf
->pdev
->dev
, "MAC address list is empty!\n");
371 cdev
->lan_info
.msix_count
= pf
->num_iwarp_msix
;
372 cdev
->lan_info
.msix_entries
= &pf
->msix_entries
[pf
->iwarp_base_vector
];
374 if (i40e_register_auxiliary_dev(&cdev
->lan_info
, "iwarp"))
385 * i40e_client_del_instance - removes a client instance from the list
386 * @pf: pointer to the board struct
390 void i40e_client_del_instance(struct i40e_pf
*pf
)
397 * i40e_client_subtask - client maintenance work
398 * @pf: board private structure
400 void i40e_client_subtask(struct i40e_pf
*pf
)
402 struct i40e_vsi
*vsi
= i40e_pf_get_main_vsi(pf
);
403 struct i40e_client_instance
*cdev
;
404 struct i40e_client
*client
;
407 if (!test_and_clear_bit(__I40E_CLIENT_SERVICE_REQUESTED
, pf
->state
))
411 /* If we're down or resetting, just bail */
412 if (test_bit(__I40E_DOWN
, pf
->state
) ||
413 test_bit(__I40E_CONFIG_BUSY
, pf
->state
))
416 if (!cdev
|| !cdev
->client
)
419 client
= cdev
->client
;
421 /* Here we handle client opens. If the client is down, and
422 * the netdev is registered, then open the client.
424 if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED
, &cdev
->state
)) {
425 if (vsi
->netdev_registered
&&
426 client
->ops
&& client
->ops
->open
) {
427 set_bit(__I40E_CLIENT_INSTANCE_OPENED
, &cdev
->state
);
428 ret
= client
->ops
->open(&cdev
->lan_info
, client
);
430 /* Remove failed client instance */
431 clear_bit(__I40E_CLIENT_INSTANCE_OPENED
,
438 /* enable/disable PE TCP_ENA flag based on netdev down/up
440 if (test_bit(__I40E_VSI_DOWN
, vsi
->state
))
441 i40e_client_update_vsi_ctxt(&cdev
->lan_info
, client
,
443 I40E_CLIENT_VSI_FLAG_TCP_ENABLE
);
445 i40e_client_update_vsi_ctxt(&cdev
->lan_info
, client
,
447 I40E_CLIENT_VSI_FLAG_TCP_ENABLE
,
448 I40E_CLIENT_VSI_FLAG_TCP_ENABLE
);
452 * i40e_lan_add_device - add a lan device struct to the list of lan devices
453 * @pf: pointer to the board struct
455 * Returns 0 on success or none 0 on error
457 int i40e_lan_add_device(struct i40e_pf
*pf
)
459 struct i40e_device
*ldev
;
462 mutex_lock(&i40e_device_mutex
);
463 list_for_each_entry(ldev
, &i40e_devices
, list
) {
464 if (ldev
->pf
== pf
) {
469 ldev
= kzalloc(sizeof(*ldev
), GFP_KERNEL
);
475 INIT_LIST_HEAD(&ldev
->list
);
476 list_add(&ldev
->list
, &i40e_devices
);
477 dev_info(&pf
->pdev
->dev
, "Added LAN device PF%d bus=0x%02x dev=0x%02x func=0x%02x\n",
478 pf
->hw
.pf_id
, pf
->hw
.bus
.bus_id
,
479 pf
->hw
.bus
.device
, pf
->hw
.bus
.func
);
481 i40e_client_add_instance(pf
);
483 set_bit(__I40E_CLIENT_SERVICE_REQUESTED
, pf
->state
);
484 i40e_service_event_schedule(pf
);
487 mutex_unlock(&i40e_device_mutex
);
492 * i40e_lan_del_device - removes a lan device from the device list
493 * @pf: pointer to the board struct
495 * Returns 0 on success or non-0 on error
497 int i40e_lan_del_device(struct i40e_pf
*pf
)
499 struct auxiliary_device
*aux_dev
= pf
->cinst
->lan_info
.aux_dev
;
500 struct i40e_device
*ldev
, *tmp
;
503 auxiliary_device_delete(aux_dev
);
504 auxiliary_device_uninit(aux_dev
);
506 /* First, remove any client instance. */
507 i40e_client_del_instance(pf
);
509 mutex_lock(&i40e_device_mutex
);
510 list_for_each_entry_safe(ldev
, tmp
, &i40e_devices
, list
) {
511 if (ldev
->pf
== pf
) {
512 dev_info(&pf
->pdev
->dev
, "Deleted LAN device PF%d bus=0x%02x dev=0x%02x func=0x%02x\n",
513 pf
->hw
.pf_id
, pf
->hw
.bus
.bus_id
,
514 pf
->hw
.bus
.device
, pf
->hw
.bus
.func
);
515 list_del(&ldev
->list
);
521 mutex_unlock(&i40e_device_mutex
);
526 * i40e_client_virtchnl_send - TBD
527 * @ldev: pointer to L2 context
528 * @client: Client pointer
529 * @vf_id: absolute VF identifier
530 * @msg: message buffer
531 * @len: length of message buffer
533 * Return 0 on success or < 0 on error
535 static int i40e_client_virtchnl_send(struct i40e_info
*ldev
,
536 struct i40e_client
*client
,
537 u32 vf_id
, u8
*msg
, u16 len
)
539 struct i40e_pf
*pf
= ldev
->pf
;
540 struct i40e_hw
*hw
= &pf
->hw
;
543 err
= i40e_aq_send_msg_to_vf(hw
, vf_id
, VIRTCHNL_OP_RDMA
,
546 dev_err(&pf
->pdev
->dev
, "Unable to send iWarp message to VF, error %d, aq status %d\n",
547 err
, hw
->aq
.asq_last_status
);
553 * i40e_client_setup_qvlist
554 * @ldev: pointer to L2 context.
555 * @client: Client pointer.
556 * @qvlist_info: queue and vector list
558 * Return 0 on success or < 0 on error
560 static int i40e_client_setup_qvlist(struct i40e_info
*ldev
,
561 struct i40e_client
*client
,
562 struct i40e_qvlist_info
*qvlist_info
)
564 struct i40e_pf
*pf
= ldev
->pf
;
565 struct i40e_hw
*hw
= &pf
->hw
;
566 struct i40e_qv_info
*qv_info
;
567 u32 v_idx
, i
, reg_idx
, reg
;
569 ldev
->qvlist_info
= kzalloc(struct_size(ldev
->qvlist_info
, qv_info
,
570 qvlist_info
->num_vectors
), GFP_KERNEL
);
571 if (!ldev
->qvlist_info
)
573 ldev
->qvlist_info
->num_vectors
= qvlist_info
->num_vectors
;
575 for (i
= 0; i
< qvlist_info
->num_vectors
; i
++) {
576 qv_info
= &qvlist_info
->qv_info
[i
];
577 v_idx
= qv_info
->v_idx
;
579 /* Validate vector id belongs to this client */
580 if ((v_idx
>= (pf
->iwarp_base_vector
+ pf
->num_iwarp_msix
)) ||
581 (v_idx
< pf
->iwarp_base_vector
))
584 ldev
->qvlist_info
->qv_info
[i
] = *qv_info
;
585 reg_idx
= I40E_PFINT_LNKLSTN(v_idx
- 1);
587 if (qv_info
->ceq_idx
== I40E_QUEUE_INVALID_IDX
) {
588 /* Special case - No CEQ mapped on this vector */
589 wr32(hw
, reg_idx
, I40E_PFINT_LNKLSTN_FIRSTQ_INDX_MASK
);
591 reg
= (qv_info
->ceq_idx
&
592 I40E_PFINT_LNKLSTN_FIRSTQ_INDX_MASK
) |
593 (I40E_QUEUE_TYPE_PE_CEQ
<<
594 I40E_PFINT_LNKLSTN_FIRSTQ_TYPE_SHIFT
);
595 wr32(hw
, reg_idx
, reg
);
597 reg
= (I40E_PFINT_CEQCTL_CAUSE_ENA_MASK
|
598 (v_idx
<< I40E_PFINT_CEQCTL_MSIX_INDX_SHIFT
) |
600 I40E_PFINT_CEQCTL_ITR_INDX_SHIFT
) |
601 (I40E_QUEUE_END_OF_LIST
<<
602 I40E_PFINT_CEQCTL_NEXTQ_INDX_SHIFT
));
603 wr32(hw
, I40E_PFINT_CEQCTL(qv_info
->ceq_idx
), reg
);
605 if (qv_info
->aeq_idx
!= I40E_QUEUE_INVALID_IDX
) {
606 reg
= (I40E_PFINT_AEQCTL_CAUSE_ENA_MASK
|
607 (v_idx
<< I40E_PFINT_AEQCTL_MSIX_INDX_SHIFT
) |
609 I40E_PFINT_AEQCTL_ITR_INDX_SHIFT
));
611 wr32(hw
, I40E_PFINT_AEQCTL
, reg
);
614 /* Mitigate sync problems with iwarp VF driver */
618 kfree(ldev
->qvlist_info
);
619 ldev
->qvlist_info
= NULL
;
624 * i40e_client_request_reset
625 * @ldev: pointer to L2 context.
626 * @client: Client pointer.
627 * @reset_level: reset level
629 static void i40e_client_request_reset(struct i40e_info
*ldev
,
630 struct i40e_client
*client
,
633 struct i40e_pf
*pf
= ldev
->pf
;
635 switch (reset_level
) {
636 case I40E_CLIENT_RESET_LEVEL_PF
:
637 set_bit(__I40E_PF_RESET_REQUESTED
, pf
->state
);
639 case I40E_CLIENT_RESET_LEVEL_CORE
:
640 set_bit(__I40E_PF_RESET_REQUESTED
, pf
->state
);
643 dev_warn(&pf
->pdev
->dev
,
644 "Client for PF id %d requested an unsupported reset: %d.\n",
645 pf
->hw
.pf_id
, reset_level
);
649 i40e_service_event_schedule(pf
);
653 * i40e_client_update_vsi_ctxt
654 * @ldev: pointer to L2 context.
655 * @client: Client pointer.
656 * @is_vf: if this for the VF
657 * @vf_id: if is_vf true this carries the vf_id
658 * @flag: Any device level setting that needs to be done for PE
659 * @valid_flag: Bits in this match up and enable changing of flag bits
661 * Return 0 on success or < 0 on error
663 static int i40e_client_update_vsi_ctxt(struct i40e_info
*ldev
,
664 struct i40e_client
*client
,
665 bool is_vf
, u32 vf_id
,
666 u32 flag
, u32 valid_flag
)
668 struct i40e_vsi
*vsi
= i40e_pf_get_main_vsi(ldev
->pf
);
669 struct i40e_pf
*pf
= ldev
->pf
;
670 struct i40e_vsi_context ctxt
;
674 /* TODO: for now do not allow setting VF's VSI setting */
678 ctxt
.seid
= pf
->main_vsi_seid
;
679 ctxt
.pf_num
= pf
->hw
.pf_id
;
680 err
= i40e_aq_get_vsi_params(&pf
->hw
, &ctxt
, NULL
);
681 ctxt
.flags
= I40E_AQ_VSI_TYPE_PF
;
683 dev_info(&pf
->pdev
->dev
,
684 "couldn't get PF vsi config, err %pe aq_err %s\n",
687 pf
->hw
.aq
.asq_last_status
));
691 if ((valid_flag
& I40E_CLIENT_VSI_FLAG_TCP_ENABLE
) &&
692 (flag
& I40E_CLIENT_VSI_FLAG_TCP_ENABLE
)) {
693 ctxt
.info
.valid_sections
=
694 cpu_to_le16(I40E_AQ_VSI_PROP_QUEUE_OPT_VALID
);
695 ctxt
.info
.queueing_opt_flags
|= I40E_AQ_VSI_QUE_OPT_TCP_ENA
;
696 } else if ((valid_flag
& I40E_CLIENT_VSI_FLAG_TCP_ENABLE
) &&
697 !(flag
& I40E_CLIENT_VSI_FLAG_TCP_ENABLE
)) {
698 ctxt
.info
.valid_sections
=
699 cpu_to_le16(I40E_AQ_VSI_PROP_QUEUE_OPT_VALID
);
700 ctxt
.info
.queueing_opt_flags
&= ~I40E_AQ_VSI_QUE_OPT_TCP_ENA
;
703 dev_warn(&pf
->pdev
->dev
,
704 "Client for PF id %d request an unsupported Config: %x.\n",
709 err
= i40e_aq_update_vsi_params(&vsi
->back
->hw
, &ctxt
, NULL
);
711 dev_info(&pf
->pdev
->dev
,
712 "update VSI ctxt for PE failed, err %pe aq_err %s\n",
715 pf
->hw
.aq
.asq_last_status
));
721 void i40e_client_device_register(struct i40e_info
*ldev
, struct i40e_client
*client
)
723 struct i40e_pf
*pf
= ldev
->pf
;
725 pf
->cinst
->client
= client
;
726 set_bit(__I40E_CLIENT_SERVICE_REQUESTED
, pf
->state
);
727 i40e_service_event_schedule(pf
);
729 EXPORT_SYMBOL_GPL(i40e_client_device_register
);
731 void i40e_client_device_unregister(struct i40e_info
*ldev
)
733 struct i40e_pf
*pf
= ldev
->pf
;
734 struct i40e_client_instance
*cdev
= pf
->cinst
;
739 while (test_and_set_bit(__I40E_SERVICE_SCHED
, pf
->state
))
740 usleep_range(500, 1000);
742 if (test_bit(__I40E_CLIENT_INSTANCE_OPENED
, &cdev
->state
)) {
743 cdev
->client
->ops
->close(&cdev
->lan_info
, cdev
->client
, false);
744 clear_bit(__I40E_CLIENT_INSTANCE_OPENED
, &cdev
->state
);
745 i40e_client_release_qvlist(&cdev
->lan_info
);
748 pf
->cinst
->client
= NULL
;
749 clear_bit(__I40E_SERVICE_SCHED
, pf
->state
);
751 EXPORT_SYMBOL_GPL(i40e_client_device_unregister
);