1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2016-2020 Intel Corporation
5 #ifndef __DLB_RESOURCE_H
6 #define __DLB_RESOURCE_H
8 #include "dlb_hw_types.h"
9 #include "dlb_osdep_types.h"
12 * dlb_resource_init() - initialize the device
13 * @hw: pointer to struct dlb_hw.
15 * This function initializes the device's software state (pointed to by the hw
16 * argument) and programs global scheduling QoS registers. This function should
17 * be called during driver initialization.
19 * The dlb_hw struct must be unique per DLB device and persist until the device
23 * Returns 0 upon success, -1 otherwise.
25 int dlb_resource_init(struct dlb_hw *hw);
28 * dlb_resource_free() - free device state memory
29 * @hw: dlb_hw handle for a particular device.
31 * This function frees software state pointed to by dlb_hw. This function
32 * should be called when resetting the device or unloading the driver.
34 void dlb_resource_free(struct dlb_hw *hw);
37 * dlb_resource_reset() - reset in-use resources to their initial state
38 * @hw: dlb_hw handle for a particular device.
40 * This function resets in-use resources, and makes them available for use.
42 void dlb_resource_reset(struct dlb_hw *hw);
45 * dlb_hw_create_sched_domain() - create a scheduling domain
46 * @hw: dlb_hw handle for a particular device.
47 * @args: scheduling domain creation arguments.
48 * @resp: response structure.
50 * This function creates a scheduling domain containing the resources specified
51 * in args. The individual resources (queues, ports, credit pools) can be
52 * configured after creating a scheduling domain.
55 * Returns 0 upon success, < 0 otherwise. If an error occurs, resp->status is
56 * assigned a detailed error code from enum dlb_error. If successful, resp->id
57 * contains the domain ID.
60 * EINVAL - A requested resource is unavailable, or the requested domain name
62 * EFAULT - Internal error (resp->status not set).
64 int dlb_hw_create_sched_domain(struct dlb_hw *hw,
65 struct dlb_create_sched_domain_args *args,
66 struct dlb_cmd_response *resp);
69 * dlb_hw_create_ldb_pool() - create a load-balanced credit pool
70 * @hw: dlb_hw handle for a particular device.
71 * @domain_id: domain ID.
72 * @args: credit pool creation arguments.
73 * @resp: response structure.
75 * This function creates a load-balanced credit pool containing the number of
79 * Returns 0 upon success, < 0 otherwise. If an error occurs, resp->status is
80 * assigned a detailed error code from enum dlb_error. If successful, resp->id
81 * contains the pool ID.
84 * EINVAL - A requested resource is unavailable, the domain is not configured,
85 * or the domain has already been started.
86 * EFAULT - Internal error (resp->status not set).
88 int dlb_hw_create_ldb_pool(struct dlb_hw *hw,
90 struct dlb_create_ldb_pool_args *args,
91 struct dlb_cmd_response *resp);
94 * dlb_hw_create_dir_pool() - create a directed credit pool
95 * @hw: dlb_hw handle for a particular device.
96 * @domain_id: domain ID.
97 * @args: credit pool creation arguments.
98 * @resp: response structure.
100 * This function creates a directed credit pool containing the number of
104 * Returns 0 upon success, < 0 otherwise. If an error occurs, resp->status is
105 * assigned a detailed error code from enum dlb_error. If successful, resp->id
106 * contains the pool ID.
109 * EINVAL - A requested resource is unavailable, the domain is not configured,
110 * or the domain has already been started.
111 * EFAULT - Internal error (resp->status not set).
113 int dlb_hw_create_dir_pool(struct dlb_hw *hw,
115 struct dlb_create_dir_pool_args *args,
116 struct dlb_cmd_response *resp);
119 * dlb_hw_create_ldb_queue() - create a load-balanced queue
120 * @hw: dlb_hw handle for a particular device.
121 * @domain_id: domain ID.
122 * @args: queue creation arguments.
123 * @resp: response structure.
125 * This function creates a load-balanced queue.
128 * Returns 0 upon success, < 0 otherwise. If an error occurs, resp->status is
129 * assigned a detailed error code from enum dlb_error. If successful, resp->id
130 * contains the queue ID.
133 * EINVAL - A requested resource is unavailable, the domain is not configured,
134 * the domain has already been started, or the requested queue name is
136 * EFAULT - Internal error (resp->status not set).
138 int dlb_hw_create_ldb_queue(struct dlb_hw *hw,
140 struct dlb_create_ldb_queue_args *args,
141 struct dlb_cmd_response *resp);
144 * dlb_hw_create_dir_queue() - create a directed queue
145 * @hw: dlb_hw handle for a particular device.
146 * @domain_id: domain ID.
147 * @args: queue creation arguments.
148 * @resp: response structure.
150 * This function creates a directed queue.
153 * Returns 0 upon success, < 0 otherwise. If an error occurs, resp->status is
154 * assigned a detailed error code from enum dlb_error. If successful, resp->id
155 * contains the queue ID.
158 * EINVAL - A requested resource is unavailable, the domain is not configured,
159 * or the domain has already been started.
160 * EFAULT - Internal error (resp->status not set).
162 int dlb_hw_create_dir_queue(struct dlb_hw *hw,
164 struct dlb_create_dir_queue_args *args,
165 struct dlb_cmd_response *resp);
168 * dlb_hw_create_dir_port() - create a directed port
169 * @hw: dlb_hw handle for a particular device.
170 * @domain_id: domain ID.
171 * @args: port creation arguments.
172 * @pop_count_dma_base: base address of the pop count memory. This can be
174 * @cq_dma_base: base address of the CQ memory. This can be a PA or an IOVA.
175 * @resp: response structure.
177 * This function creates a directed port.
180 * Returns 0 upon success, < 0 otherwise. If an error occurs, resp->status is
181 * assigned a detailed error code from enum dlb_error. If successful, resp->id
182 * contains the port ID.
185 * EINVAL - A requested resource is unavailable, a credit setting is invalid, a
186 * pool ID is invalid, a pointer address is not properly aligned, the
187 * domain is not configured, or the domain has already been started.
188 * EFAULT - Internal error (resp->status not set).
190 int dlb_hw_create_dir_port(struct dlb_hw *hw,
192 struct dlb_create_dir_port_args *args,
193 u64 pop_count_dma_base,
195 struct dlb_cmd_response *resp);
198 * dlb_hw_create_ldb_port() - create a load-balanced port
199 * @hw: dlb_hw handle for a particular device.
200 * @domain_id: domain ID.
201 * @args: port creation arguments.
202 * @pop_count_dma_base: base address of the pop count memory. This can be
204 * @cq_dma_base: base address of the CQ memory. This can be a PA or an IOVA.
205 * @resp: response structure.
207 * This function creates a load-balanced port.
210 * Returns 0 upon success, < 0 otherwise. If an error occurs, resp->status is
211 * assigned a detailed error code from enum dlb_error. If successful, resp->id
212 * contains the port ID.
215 * EINVAL - A requested resource is unavailable, a credit setting is invalid, a
216 * pool ID is invalid, a pointer address is not properly aligned, the
217 * domain is not configured, or the domain has already been started.
218 * EFAULT - Internal error (resp->status not set).
220 int dlb_hw_create_ldb_port(struct dlb_hw *hw,
222 struct dlb_create_ldb_port_args *args,
223 u64 pop_count_dma_base,
225 struct dlb_cmd_response *resp);
228 * dlb_hw_start_domain() - start a scheduling domain
229 * @hw: dlb_hw handle for a particular device.
230 * @domain_id: domain ID.
231 * @args: start domain arguments.
232 * @resp: response structure.
234 * This function starts a scheduling domain, which allows applications to send
235 * traffic through it. Once a domain is started, its resources can no longer be
236 * configured (besides QID remapping and port enable/disable).
239 * Returns 0 upon success, < 0 otherwise. If an error occurs, resp->status is
240 * assigned a detailed error code from enum dlb_error.
243 * EINVAL - the domain is not configured, or the domain is already started.
245 int dlb_hw_start_domain(struct dlb_hw *hw,
247 struct dlb_start_domain_args *args,
248 struct dlb_cmd_response *resp);
251 * dlb_hw_map_qid() - map a load-balanced queue to a load-balanced port
252 * @hw: dlb_hw handle for a particular device.
253 * @domain_id: domain ID.
254 * @args: map QID arguments.
255 * @resp: response structure.
257 * This function configures the DLB to schedule QEs from the specified queue to
258 * the specified port. Each load-balanced port can be mapped to up to 8 queues;
259 * each load-balanced queue can potentially map to all the load-balanced ports.
261 * A successful return does not necessarily mean the mapping was configured. If
262 * this function is unable to immediately map the queue to the port, it will
263 * add the requested operation to a per-port list of pending map/unmap
264 * operations, and (if it's not already running) launch a kernel thread that
265 * periodically attempts to process all pending operations. In a sense, this is
266 * an asynchronous function.
268 * This asynchronicity creates two views of the state of hardware: the actual
269 * hardware state and the requested state (as if every request completed
270 * immediately). If there are any pending map/unmap operations, the requested
271 * state will differ from the actual state. All validation is performed with
272 * respect to the pending state; for instance, if there are 8 pending map
273 * operations for port X, a request for a 9th will fail because a load-balanced
274 * port can only map up to 8 queues.
277 * Returns 0 upon success, < 0 otherwise. If an error occurs, resp->status is
278 * assigned a detailed error code from enum dlb_error.
281 * EINVAL - A requested resource is unavailable, invalid port or queue ID, or
282 * the domain is not configured.
283 * EFAULT - Internal error (resp->status not set).
285 int dlb_hw_map_qid(struct dlb_hw *hw,
287 struct dlb_map_qid_args *args,
288 struct dlb_cmd_response *resp);
291 * dlb_hw_unmap_qid() - Unmap a load-balanced queue from a load-balanced port
292 * @hw: dlb_hw handle for a particular device.
293 * @domain_id: domain ID.
294 * @args: unmap QID arguments.
295 * @resp: response structure.
297 * This function configures the DLB to stop scheduling QEs from the specified
298 * queue to the specified port.
300 * A successful return does not necessarily mean the mapping was removed. If
301 * this function is unable to immediately unmap the queue from the port, it
302 * will add the requested operation to a per-port list of pending map/unmap
303 * operations, and (if it's not already running) launch a kernel thread that
304 * periodically attempts to process all pending operations. See
305 * dlb_hw_map_qid() for more details.
308 * Returns 0 upon success, < 0 otherwise. If an error occurs, resp->status is
309 * assigned a detailed error code from enum dlb_error.
312 * EINVAL - A requested resource is unavailable, invalid port or queue ID, or
313 * the domain is not configured.
314 * EFAULT - Internal error (resp->status not set).
316 int dlb_hw_unmap_qid(struct dlb_hw *hw,
318 struct dlb_unmap_qid_args *args,
319 struct dlb_cmd_response *resp);
322 * dlb_finish_unmap_qid_procedures() - finish any pending unmap procedures
323 * @hw: dlb_hw handle for a particular device.
325 * This function attempts to finish any outstanding unmap procedures.
326 * This function should be called by the kernel thread responsible for
327 * finishing map/unmap procedures.
330 * Returns the number of procedures that weren't completed.
332 unsigned int dlb_finish_unmap_qid_procedures(struct dlb_hw *hw);
335 * dlb_finish_map_qid_procedures() - finish any pending map procedures
336 * @hw: dlb_hw handle for a particular device.
338 * This function attempts to finish any outstanding map procedures.
339 * This function should be called by the kernel thread responsible for
340 * finishing map/unmap procedures.
343 * Returns the number of procedures that weren't completed.
345 unsigned int dlb_finish_map_qid_procedures(struct dlb_hw *hw);
348 * dlb_hw_enable_ldb_port() - enable a load-balanced port for scheduling
349 * @hw: dlb_hw handle for a particular device.
350 * @domain_id: domain ID.
351 * @args: port enable arguments.
352 * @resp: response structure.
354 * This function configures the DLB to schedule QEs to a load-balanced port.
355 * Ports are enabled by default.
358 * Returns 0 upon success, < 0 otherwise. If an error occurs, resp->status is
359 * assigned a detailed error code from enum dlb_error.
362 * EINVAL - The port ID is invalid or the domain is not configured.
363 * EFAULT - Internal error (resp->status not set).
365 int dlb_hw_enable_ldb_port(struct dlb_hw *hw,
367 struct dlb_enable_ldb_port_args *args,
368 struct dlb_cmd_response *resp);
371 * dlb_hw_disable_ldb_port() - disable a load-balanced port for scheduling
372 * @hw: dlb_hw handle for a particular device.
373 * @domain_id: domain ID.
374 * @args: port disable arguments.
375 * @resp: response structure.
377 * This function configures the DLB to stop scheduling QEs to a load-balanced
378 * port. Ports are enabled by default.
381 * Returns 0 upon success, < 0 otherwise. If an error occurs, resp->status is
382 * assigned a detailed error code from enum dlb_error.
385 * EINVAL - The port ID is invalid or the domain is not configured.
386 * EFAULT - Internal error (resp->status not set).
388 int dlb_hw_disable_ldb_port(struct dlb_hw *hw,
390 struct dlb_disable_ldb_port_args *args,
391 struct dlb_cmd_response *resp);
394 * dlb_hw_enable_dir_port() - enable a directed port for scheduling
395 * @hw: dlb_hw handle for a particular device.
396 * @domain_id: domain ID.
397 * @args: port enable arguments.
398 * @resp: response structure.
400 * This function configures the DLB to schedule QEs to a directed port.
401 * Ports are enabled by default.
404 * Returns 0 upon success, < 0 otherwise. If an error occurs, resp->status is
405 * assigned a detailed error code from enum dlb_error.
408 * EINVAL - The port ID is invalid or the domain is not configured.
409 * EFAULT - Internal error (resp->status not set).
411 int dlb_hw_enable_dir_port(struct dlb_hw *hw,
413 struct dlb_enable_dir_port_args *args,
414 struct dlb_cmd_response *resp);
417 * dlb_hw_disable_dir_port() - disable a directed port for scheduling
418 * @hw: dlb_hw handle for a particular device.
419 * @domain_id: domain ID.
420 * @args: port disable arguments.
421 * @resp: response structure.
423 * This function configures the DLB to stop scheduling QEs to a directed port.
424 * Ports are enabled by default.
427 * Returns 0 upon success, < 0 otherwise. If an error occurs, resp->status is
428 * assigned a detailed error code from enum dlb_error.
431 * EINVAL - The port ID is invalid or the domain is not configured.
432 * EFAULT - Internal error (resp->status not set).
434 int dlb_hw_disable_dir_port(struct dlb_hw *hw,
436 struct dlb_disable_dir_port_args *args,
437 struct dlb_cmd_response *resp);
440 * dlb_configure_ldb_cq_interrupt() - configure load-balanced CQ for interrupts
441 * @hw: dlb_hw handle for a particular device.
442 * @port_id: load-balancd port ID.
443 * @vector: interrupt vector ID. Should be 0 for MSI or compressed MSI-X mode,
444 * else a value up to 64.
445 * @mode: interrupt type (DLB_CQ_ISR_MODE_MSI or DLB_CQ_ISR_MODE_MSIX)
446 * @threshold: the minimum CQ depth at which the interrupt can fire. Must be
449 * This function configures the DLB registers for load-balanced CQ's interrupts.
450 * This doesn't enable the CQ's interrupt; that can be done with
451 * dlb_arm_cq_interrupt() or through an interrupt arm QE.
454 * Returns 0 upon success, < 0 otherwise.
457 * EINVAL - The port ID is invalid.
459 int dlb_configure_ldb_cq_interrupt(struct dlb_hw *hw,
466 * dlb_configure_dir_cq_interrupt() - configure directed CQ for interrupts
467 * @hw: dlb_hw handle for a particular device.
468 * @port_id: load-balancd port ID.
469 * @vector: interrupt vector ID. Should be 0 for MSI or compressed MSI-X mode,
470 * else a value up to 64.
471 * @mode: interrupt type (DLB_CQ_ISR_MODE_MSI or DLB_CQ_ISR_MODE_MSIX)
472 * @threshold: the minimum CQ depth at which the interrupt can fire. Must be
475 * This function configures the DLB registers for directed CQ's interrupts.
476 * This doesn't enable the CQ's interrupt; that can be done with
477 * dlb_arm_cq_interrupt() or through an interrupt arm QE.
480 * Returns 0 upon success, < 0 otherwise.
483 * EINVAL - The port ID is invalid.
485 int dlb_configure_dir_cq_interrupt(struct dlb_hw *hw,
492 * dlb_enable_alarm_interrupts() - enable certain hardware alarm interrupts
493 * @hw: dlb_hw handle for a particular device.
495 * This function configures the ingress error alarm. (Other alarms are enabled
498 void dlb_enable_alarm_interrupts(struct dlb_hw *hw);
501 * dlb_disable_alarm_interrupts() - disable certain hardware alarm interrupts
502 * @hw: dlb_hw handle for a particular device.
504 * This function configures the ingress error alarm. (Other alarms are disabled
507 void dlb_disable_alarm_interrupts(struct dlb_hw *hw);
510 * dlb_set_msix_mode() - enable certain hardware alarm interrupts
511 * @hw: dlb_hw handle for a particular device.
512 * @mode: MSI-X mode (DLB_MSIX_MODE_PACKED or DLB_MSIX_MODE_COMPRESSED)
514 * This function configures the hardware to use either packed or compressed
515 * mode. This function should not be called if using MSI interrupts.
517 void dlb_set_msix_mode(struct dlb_hw *hw, int mode);
520 * dlb_arm_cq_interrupt() - arm a CQ's interrupt
521 * @hw: dlb_hw handle for a particular device.
523 * @is_ldb: true for load-balanced port, false for a directed port
525 * This function arms the CQ's interrupt. The CQ must be configured prior to
526 * calling this function.
528 * The function does no parameter validation; that is the caller's
531 * Return: returns 0 upon success, <0 otherwise.
533 * EINVAL - Invalid port ID.
535 int dlb_arm_cq_interrupt(struct dlb_hw *hw, int port_id, bool is_ldb);
538 * dlb_read_compressed_cq_intr_status() - read compressed CQ interrupt status
539 * @hw: dlb_hw handle for a particular device.
540 * @ldb_interrupts: 2-entry array of u32 bitmaps
541 * @dir_interrupts: 4-entry array of u32 bitmaps
543 * This function can be called from a compressed CQ interrupt handler to
544 * determine which CQ interrupts have fired. The caller should take appropriate
545 * (such as waking threads blocked on a CQ's interrupt) then ack the interrupts
546 * with dlb_ack_compressed_cq_intr().
548 void dlb_read_compressed_cq_intr_status(struct dlb_hw *hw,
550 u32 *dir_interrupts);
553 * dlb_ack_compressed_cq_intr_status() - ack compressed CQ interrupts
554 * @hw: dlb_hw handle for a particular device.
555 * @ldb_interrupts: 2-entry array of u32 bitmaps
556 * @dir_interrupts: 4-entry array of u32 bitmaps
558 * This function ACKs compressed CQ interrupts. Its arguments should be the
559 * same ones passed to dlb_read_compressed_cq_intr_status().
561 void dlb_ack_compressed_cq_intr(struct dlb_hw *hw,
563 u32 *dir_interrupts);
566 * dlb_process_alarm_interrupt() - process an alarm interrupt
567 * @hw: dlb_hw handle for a particular device.
569 * This function reads the alarm syndrome, logs its, and acks the interrupt.
570 * This function should be called from the alarm interrupt handler when
571 * interrupt vector DLB_INT_ALARM fires.
573 void dlb_process_alarm_interrupt(struct dlb_hw *hw);
576 * dlb_process_ingress_error_interrupt() - process ingress error interrupts
577 * @hw: dlb_hw handle for a particular device.
579 * This function reads the alarm syndrome, logs it, notifies user-space, and
580 * acks the interrupt. This function should be called from the alarm interrupt
581 * handler when interrupt vector DLB_INT_INGRESS_ERROR fires.
583 void dlb_process_ingress_error_interrupt(struct dlb_hw *hw);
586 * dlb_get_group_sequence_numbers() - return a group's number of SNs per queue
587 * @hw: dlb_hw handle for a particular device.
588 * @group_id: sequence number group ID.
590 * This function returns the configured number of sequence numbers per queue
591 * for the specified group.
594 * Returns -EINVAL if group_id is invalid, else the group's SNs per queue.
596 int dlb_get_group_sequence_numbers(struct dlb_hw *hw, unsigned int group_id);
599 * dlb_get_group_sequence_number_occupancy() - return a group's in-use slots
600 * @hw: dlb_hw handle for a particular device.
601 * @group_id: sequence number group ID.
603 * This function returns the group's number of in-use slots (i.e. load-balanced
604 * queues using the specified group).
607 * Returns -EINVAL if group_id is invalid, else the group's occupancy.
609 int dlb_get_group_sequence_number_occupancy(struct dlb_hw *hw,
610 unsigned int group_id);
613 * dlb_set_group_sequence_numbers() - assign a group's number of SNs per queue
614 * @hw: dlb_hw handle for a particular device.
615 * @group_id: sequence number group ID.
616 * @val: requested amount of sequence numbers per queue.
618 * This function configures the group's number of sequence numbers per queue.
619 * val can be a power-of-two between 32 and 1024, inclusive. This setting can
620 * be configured until the first ordered load-balanced queue is configured, at
621 * which point the configuration is locked.
624 * Returns 0 upon success; -EINVAL if group_id or val is invalid, -EPERM if an
625 * ordered queue is configured.
627 int dlb_set_group_sequence_numbers(struct dlb_hw *hw,
628 unsigned int group_id,
632 * dlb_reset_domain() - reset a scheduling domain
633 * @hw: dlb_hw handle for a particular device.
634 * @domain_id: domain ID.
636 * This function resets and frees a DLB scheduling domain and its associated
639 * Pre-condition: the driver must ensure software has stopped sending QEs
640 * through this domain's producer ports before invoking this function, or
641 * undefined behavior will result.
644 * Returns 0 upon success, -1 otherwise.
646 * EINVAL - Invalid domain ID, or the domain is not configured.
647 * EFAULT - Internal error. (Possibly caused if software is the pre-condition
649 * ETIMEDOUT - Hardware component didn't reset in the expected time.
651 int dlb_reset_domain(struct dlb_hw *hw, u32 domain_id);
654 * dlb_ldb_port_owned_by_domain() - query whether a port is owned by a domain
655 * @hw: dlb_hw handle for a particular device.
656 * @domain_id: domain ID.
659 * This function returns whether a load-balanced port is owned by a specified
663 * Returns 0 if false, 1 if true, <0 otherwise.
665 * EINVAL - Invalid domain or port ID, or the domain is not configured.
667 int dlb_ldb_port_owned_by_domain(struct dlb_hw *hw,
672 * dlb_dir_port_owned_by_domain() - query whether a port is owned by a domain
673 * @hw: dlb_hw handle for a particular device.
674 * @domain_id: domain ID.
677 * This function returns whether a directed port is owned by a specified
681 * Returns 0 if false, 1 if true, <0 otherwise.
683 * EINVAL - Invalid domain or port ID, or the domain is not configured.
685 int dlb_dir_port_owned_by_domain(struct dlb_hw *hw,
690 * dlb_hw_get_num_resources() - query the PCI function's available resources
691 * @arg: pointer to resource counts.
693 * This function returns the number of available resources for the PF.
695 void dlb_hw_get_num_resources(struct dlb_hw *hw,
696 struct dlb_get_num_resources_args *arg);
699 * dlb_hw_get_num_used_resources() - query the PCI function's used resources
700 * @arg: pointer to resource counts.
702 * This function returns the number of resources in use by the PF. It fills in
703 * the fields that args points to, except the following:
704 * - max_contiguous_atomic_inflights
705 * - max_contiguous_hist_list_entries
706 * - max_contiguous_ldb_credits
707 * - max_contiguous_dir_credits
709 void dlb_hw_get_num_used_resources(struct dlb_hw *hw,
710 struct dlb_get_num_resources_args *arg);
713 * dlb_disable_dp_vasr_feature() - disable directed pipe VAS reset hardware
714 * @hw: dlb_hw handle for a particular device.
716 * This function disables certain hardware in the directed pipe,
717 * necessary to workaround a DLB VAS reset issue.
719 void dlb_disable_dp_vasr_feature(struct dlb_hw *hw);
722 * dlb_enable_excess_tokens_alarm() - enable interrupts for the excess token
724 * @hw: dlb_hw handle for a particular device.
726 * This function enables the PF ingress error alarm interrupt to fire when an
727 * excess token pop occurs.
729 void dlb_enable_excess_tokens_alarm(struct dlb_hw *hw);
732 * dlb_disable_excess_tokens_alarm() - disable interrupts for the excess token
734 * @hw: dlb_hw handle for a particular device.
736 * This function disables the PF ingress error alarm interrupt to fire when an
737 * excess token pop occurs.
739 void dlb_disable_excess_tokens_alarm(struct dlb_hw *hw);
742 * dlb_hw_get_ldb_queue_depth() - returns the depth of a load-balanced queue
743 * @hw: dlb_hw handle for a particular device.
744 * @domain_id: domain ID.
745 * @args: queue depth args
747 * This function returns the depth of a load-balanced queue.
750 * Returns 0 upon success, < 0 otherwise. If an error occurs, resp->status is
751 * assigned a detailed error code from enum dlb_error. If successful, resp->id
752 * contains the depth.
755 * EINVAL - Invalid domain ID or queue ID.
757 int dlb_hw_get_ldb_queue_depth(struct dlb_hw *hw,
759 struct dlb_get_ldb_queue_depth_args *args,
760 struct dlb_cmd_response *resp);
763 * dlb_hw_get_dir_queue_depth() - returns the depth of a directed queue
764 * @hw: dlb_hw handle for a particular device.
765 * @domain_id: domain ID.
766 * @args: queue depth args
768 * This function returns the depth of a directed queue.
771 * Returns 0 upon success, < 0 otherwise. If an error occurs, resp->status is
772 * assigned a detailed error code from enum dlb_error. If successful, resp->id
773 * contains the depth.
776 * EINVAL - Invalid domain ID or queue ID.
778 int dlb_hw_get_dir_queue_depth(struct dlb_hw *hw,
780 struct dlb_get_dir_queue_depth_args *args,
781 struct dlb_cmd_response *resp);
784 * dlb_hw_pending_port_unmaps() - returns the number of unmap operations in
785 * progress for a load-balanced port.
786 * @hw: dlb_hw handle for a particular device.
787 * @domain_id: domain ID.
788 * @args: number of unmaps in progress args
791 * Returns 0 upon success, < 0 otherwise. If an error occurs, resp->status is
792 * assigned a detailed error code from enum dlb_error. If successful, resp->id
793 * contains the number of unmaps in progress.
796 * EINVAL - Invalid port ID.
798 int dlb_hw_pending_port_unmaps(struct dlb_hw *hw,
800 struct dlb_pending_port_unmaps_args *args,
801 struct dlb_cmd_response *resp);
804 * dlb_hw_enable_sparse_ldb_cq_mode() - enable sparse mode for load-balanced
806 * @hw: dlb_hw handle for a particular device.
808 * This function must be called prior to configuring scheduling domains.
810 void dlb_hw_enable_sparse_ldb_cq_mode(struct dlb_hw *hw);
813 * dlb_hw_enable_sparse_dir_cq_mode() - enable sparse mode for directed ports
814 * @hw: dlb_hw handle for a particular device.
816 * This function must be called prior to configuring scheduling domains.
818 void dlb_hw_enable_sparse_dir_cq_mode(struct dlb_hw *hw);
821 * dlb_hw_set_qe_arbiter_weights() - program QE arbiter weights
822 * @hw: dlb_hw handle for a particular device.
823 * @weight: 8-entry array of arbiter weights.
825 * weight[N] programs priority N's weight. In cases where the 8 priorities are
826 * reduced to 4 bins, the mapping is:
827 * - weight[1] programs bin 0
828 * - weight[3] programs bin 1
829 * - weight[5] programs bin 2
830 * - weight[7] programs bin 3
832 void dlb_hw_set_qe_arbiter_weights(struct dlb_hw *hw, u8 weight[8]);
835 * dlb_hw_set_qid_arbiter_weights() - program QID arbiter weights
836 * @hw: dlb_hw handle for a particular device.
837 * @weight: 8-entry array of arbiter weights.
839 * weight[N] programs priority N's weight. In cases where the 8 priorities are
840 * reduced to 4 bins, the mapping is:
841 * - weight[1] programs bin 0
842 * - weight[3] programs bin 1
843 * - weight[5] programs bin 2
844 * - weight[7] programs bin 3
846 void dlb_hw_set_qid_arbiter_weights(struct dlb_hw *hw, u8 weight[8]);
849 * dlb_hw_enable_pp_sw_alarms() - enable out-of-credit alarm for all producer
851 * @hw: dlb_hw handle for a particular device.
853 void dlb_hw_enable_pp_sw_alarms(struct dlb_hw *hw);
856 * dlb_hw_disable_pp_sw_alarms() - disable out-of-credit alarm for all producer
858 * @hw: dlb_hw handle for a particular device.
860 void dlb_hw_disable_pp_sw_alarms(struct dlb_hw *hw);
863 * dlb_hw_disable_pf_to_vf_isr_pend_err() - disable alarm triggered by PF
864 * access to VF's ISR pending register
865 * @hw: dlb_hw handle for a particular device.
867 void dlb_hw_disable_pf_to_vf_isr_pend_err(struct dlb_hw *hw);
870 * dlb_hw_disable_vf_to_pf_isr_pend_err() - disable alarm triggered by VF
871 * access to PF's ISR pending register
872 * @hw: dlb_hw handle for a particular device.
874 void dlb_hw_disable_vf_to_pf_isr_pend_err(struct dlb_hw *hw);
876 #endif /* __DLB_RESOURCE_H */