Add DLB2 PMD
PATCH v9 3/23 event/dlb2: add private data structures and constants
In reply to Timothy McDanielThe header file dlb2_priv.h is used internally by the PMD. It include constants, macros for device resources, structure definitions for hardware interfaces and software state, and various forward-declarations. The header file rte_pmd_dlb2.h will be exported in a subsequent patch, but is included here due to a data structure dependency.
--- drivers/event/dlb2/dlb2_priv.h | 575 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 575 insertions(+) create mode 100644 drivers/event/dlb2/dlb2_priv.h
drivers/event/dlb2/dlb2_priv.h new file +575 -0
@@ -0,0 +1,575 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2016-2020 Intel Corporation +*/ + +#ifndef _DLB2_PRIV_H_ +#define _DLB2_PRIV_H_ + +#include <emmintrin.h> +#include <stdbool.h> + +#include <rte_eventdev.h> +#include <rte_config.h> +#include "dlb2_user.h" +#include "dlb2_log.h" + +#ifndef RTE_LIBRTE_PMD_DLB2_QUELL_STATS +#define DLB2_INC_STAT (_stat, _incr_val) ((_stat) += _incr_val) +#else +#define DLB2_INC_STAT (_stat, _incr_val) +#endif + +#define EVDEV_DLB2_NAME_PMD dlb2_event + +/* command line arg strings */ +#define NUMA_NODE_ARG "numa_node" +#define DLB2_MAX_NUM_EVENTS "max_num_events" +#define DLB2_NUM_DIR_CREDITS "num_dir_credits" +#define DEV_ID_ARG "dev_id" +#define DLB2_DEFER_SCHED_ARG "defer_sched" +#define DLB2_QID_DEPTH_THRESH_ARG "qid_depth_thresh" +#define DLB2_COS_ARG "cos" + +/* Begin HW related defines and structs */ + +#define DLB2_MAX_NUM_DOMAINS 32 +#define DLB2_MAX_NUM_VFS 16 +#define DLB2_MAX_NUM_LDB_QUEUES 32 +#define DLB2_MAX_NUM_LDB_PORTS 64 +#define DLB2_MAX_NUM_DIR_PORTS 64 +#define DLB2_MAX_NUM_DIR_QUEUES 64 +#define DLB2_MAX_NUM_FLOWS (64 * 1024) +#define DLB2_MAX_NUM_LDB_CREDITS (8 * 1024) +#define DLB2_MAX_NUM_DIR_CREDITS (2 * 1024) +#define DLB2_MAX_NUM_LDB_CREDIT_POOLS 64 +#define DLB2_MAX_NUM_DIR_CREDIT_POOLS 64 +#define DLB2_MAX_NUM_HIST_LIST_ENTRIES 2048 +#define DLB2_MAX_NUM_AQOS_ENTRIES 2048 +#define DLB2_MAX_NUM_QIDS_PER_LDB_CQ 8 +#define DLB2_QID_PRIORITIES 8 +#define DLB2_MAX_DEVICE_PATH 32 +#define DLB2_MIN_DEQUEUE_TIMEOUT_NS 1 +/* Note: "- 1" here to support the timeout range check in eventdev_autotest */ +#define DLB2_MAX_DEQUEUE_TIMEOUT_NS (UINT32_MAX - 1) +#define DLB2_SW_CREDIT_BATCH_SZ 32 +#define DLB2_NUM_SN_GROUPS 2 +#define DLB2_MAX_LDB_SN_ALLOC 1024 +#define DLB2_MAX_QUEUE_DEPTH_THRESHOLD 8191 + +/* 2048 total hist list entries and 64 total ldb ports, which +* makes for 2048/64 == 32 hist list entries per port. However, CQ +* depth must be a power of 2 and must also be >= HIST LIST entries. +* As a result we just limit the maximum dequeue depth to 32. +*/ +#define DLB2_MIN_CQ_DEPTH 1 +#define DLB2_MAX_CQ_DEPTH 32 +#define DLB2_MIN_HARDWARE_CQ_DEPTH 8 +#define DLB2_NUM_HIST_LIST_ENTRIES_PER_LDB_PORT \ + DLB2_MAX_CQ_DEPTH + +/* +* Static per queue/port provisioning values +*/ +#define DLB2_NUM_ATOMIC_INFLIGHTS_PER_QUEUE 64 + +#define CQ_BASE (is_dir) ((is_dir) ? DLB2_DIR_CQ_BASE : DLB2_LDB_CQ_BASE) +#define CQ_SIZE (is_dir) ((is_dir) ? DLB2_DIR_CQ_MAX_SIZE : \ + DLB2_LDB_CQ_MAX_SIZE) +#define PP_BASE (is_dir) ((is_dir) ? DLB2_DIR_PP_BASE : DLB2_LDB_PP_BASE) + +#define PAGE_SIZE (sysconf(_SC_PAGESIZE)) + +#define DLB2_NUM_QES_PER_CACHE_LINE 4 + +#define DLB2_MAX_ENQUEUE_DEPTH 64 +#define DLB2_MIN_ENQUEUE_DEPTH 4 + +#define DLB2_NAME_SIZE 64 + +#define DLB2_1K 1024 +#define DLB2_2K (2 * DLB2_1K) +#define DLB2_4K (4 * DLB2_1K) +#define DLB2_16K (16 * DLB2_1K) +#define DLB2_32K (32 * DLB2_1K) +#define DLB2_1MB (DLB2_1K * DLB2_1K) +#define DLB2_16MB (16 * DLB2_1MB) + +/* Use the upper 3 bits of the event priority to select the DLB2 priority */ +#define EV_TO_DLB2_PRIO (x) ((x) >> 5) +#define DLB2_TO_EV_PRIO (x) ((x) << 5) + +enum dlb2_hw_port_types { +DLB2_LDB_PORT , +DLB2_DIR_PORT , +DLB2_NUM_PORT_TYPES /* Must be last */ +}; + +enum dlb2_hw_queue_types { +DLB2_LDB_QUEUE , +DLB2_DIR_QUEUE , +DLB2_NUM_QUEUE_TYPES /* Must be last */ +}; + +#define PORT_TYPE (p) ((p)->is_directed ? DLB2_DIR_PORT : DLB2_LDB_PORT) + +/* Do not change - must match hardware! */ +enum dlb2_hw_sched_type { +DLB2_SCHED_ATOMIC =0 , +DLB2_SCHED_UNORDERED , +DLB2_SCHED_ORDERED , +DLB2_SCHED_DIRECTED , +/* DLB2_NUM_HW_SCHED_TYPES must be last */ +DLB2_NUM_HW_SCHED_TYPES +}; + +struct dlb2_hw_rsrcs { +int32_t nb_events_limit; +uint32_t num_queues;/* Total queues (lb + dir) */ +uint32_t num_ldb_queues;/* Number of available ldb queues */ +uint32_t num_ldb_ports;/* Number of load balanced ports */ +uint32_t num_dir_ports;/* Number of directed ports */ +uint32_t num_ldb_credits;/* Number of load balanced credits */ +uint32_t num_dir_credits;/* Number of directed credits */ +uint32_t reorder_window_size;/* Size of reorder window */ +}; + +struct dlb2_hw_resource_info { +/**> Max resources that can be provided */ +struct dlb2_hw_rsrcs hw_rsrc_max; +int num_sched_domains; +uint32_t socket_id; +}; + +enum dlb2_enqueue_type { +/**> +* New : Used to inject a new packet into the QM. +*/ +DLB2_ENQ_NEW , +/**> +* Forward : Enqueues a packet, and +* - if atomic: release any lock it holds in the QM +* - if ordered: release the packet for egress re-ordering +*/ +DLB2_ENQ_FWD , +/**> +* Enqueue Drop : Release an inflight packet. Must be called with +* event == NULL. Used to drop a packet. +* +* Note that all packets dequeued from a load-balanced port must be +* released, either with DLB2_ENQ_DROP or DLB2_ENQ_FWD. +*/ +DLB2_ENQ_DROP , + +/* marker for array sizing etc. */ + _DLB2_NB_ENQ_TYPES +}; + +/* hw-specific format - do not change */ + +struct dlb2_event_type { +uint8_t major:4 ; +uint8_t unused:4 ; +uint8_t sub; +}; + +union dlb2_opaque_data { +uint16_t opaque_data; +struct dlb2_event_type event_type; +}; + +struct dlb2_msg_info { +uint8_t qid; +uint8_t sched_type:2 ; +uint8_t priority:3 ; +uint8_t msg_type:3 ; +}; + +#define DLB2_NEW_CMD_BYTE 0x08 +#define DLB2_FWD_CMD_BYTE 0x0A +#define DLB2_COMP_CMD_BYTE 0x02 +#define DLB2_POP_CMD_BYTE 0x01 +#define DLB2_NOOP_CMD_BYTE 0x00 + +/* hw-specific format - do not change */ +struct dlb2_enqueue_qe { +uint64_t data; +/* Word 3 */ +union dlb2_opaque_data u; +uint8_t qid; +uint8_t sched_type:2 ; +uint8_t priority:3 ; +uint8_t msg_type:3 ; +/* Word 4 */ +uint16_t lock_id; +uint8_t meas_lat:1 ; +uint8_t rsvd1:2 ; +uint8_t no_dec:1 ; +uint8_t cmp_id:4 ; +union { +uint8_t cmd_byte; +struct { +uint8_t cq_token:1 ; +uint8_t qe_comp:1 ; +uint8_t qe_frag:1 ; +uint8_t qe_valid:1 ; +uint8_t rsvd3:1 ; +uint8_t error:1 ; +uint8_t rsvd:2 ; + }; + }; +}; + +/* hw-specific format - do not change */ +struct dlb2_cq_pop_qe { +uint64_t data; +union dlb2_opaque_data u; +uint8_t qid; +uint8_t sched_type:2 ; +uint8_t priority:3 ; +uint8_t msg_type:3 ; +uint16_t tokens:10 ; +uint16_t rsvd2:6 ; +uint8_t meas_lat:1 ; +uint8_t rsvd1:2 ; +uint8_t no_dec:1 ; +uint8_t cmp_id:4 ; +union { +uint8_t cmd_byte; +struct { +uint8_t cq_token:1 ; +uint8_t qe_comp:1 ; +uint8_t qe_frag:1 ; +uint8_t qe_valid:1 ; +uint8_t rsvd3:1 ; +uint8_t error:1 ; +uint8_t rsvd:2 ; + }; + }; +}; + +/* hw-specific format - do not change */ +struct dlb2_dequeue_qe { +uint64_t data; +union dlb2_opaque_data u; +uint8_t qid; +uint8_t sched_type:2 ; +uint8_t priority:3 ; +uint8_t msg_type:3 ; +uint16_t flow_id:16 ;/* was pp_id in v1 */ +uint8_t debug; +uint8_t cq_gen:1 ; +uint8_t qid_depth:2 ;/* 2 bits in v2 */ +uint8_t rsvd1:2 ; +uint8_t error:1 ; +uint8_t rsvd2:2 ; +}; + +union dlb2_port_config { +struct dlb2_create_ldb_port_args ldb; +struct dlb2_create_dir_port_args dir; +}; + +enum dlb2_port_state { +PORT_CLOSED , +PORT_STARTED , +PORT_STOPPED +}; + +enum dlb2_configuration_state { +/* The resource has not been configured */ +DLB2_NOT_CONFIGURED , +/* The resource was configured, but the device was stopped */ +DLB2_PREV_CONFIGURED , +/* The resource is currently configured */ +DLB2_CONFIGURED +}; + +struct dlb2_port { +uint32_t id; +bool is_directed; +bool gen_bit; +uint16_t dir_credits; +uint32_t dequeue_depth; +union dlb2_port_config cfg; +uint32_t *credit_pool[DLB2_NUM_QUEUE_TYPES ];/* use __atomic builtins */ +uint16_t cached_ldb_credits; +uint16_t ldb_credits; +uint16_t cached_dir_credits; +bool int_armed; +uint16_t owed_tokens; +int16_t issued_releases; +int cq_depth; +uint16_t cq_idx; +uint16_t cq_idx_unmasked; +uint16_t cq_depth_mask; +uint16_t gen_bit_shift; +enum dlb2_port_state state; +enum dlb2_configuration_state config_state; +int num_mapped_qids; +uint8_t *qid_mappings; +struct dlb2_enqueue_qe *qe4;/* Cache line's worth of QEs (4) */ +struct dlb2_enqueue_qe *int_arm_qe; +struct dlb2_cq_pop_qe *consume_qe; +struct dlb2_eventdev *dlb2;/* back ptr */ +struct dlb2_eventdev_port *ev_port;/* back ptr */ +}; + +/* Per-process per-port mmio and memory pointers */ +struct process_local_port_data { +uint64_t *pp_addr; +struct dlb2_dequeue_qe *cq_base; +const struct rte_memzone *mz; +bool mmaped; +}; + +struct dlb2_eventdev ; + +struct dlb2_config { +int configured; +int reserved; +uint32_t num_ldb_credits; +uint32_t num_dir_credits; +struct dlb2_create_sched_domain_args resources; +}; + +enum dlb2_cos { +DLB2_COS_DEFAULT =-1 , +DLB2_COS_0 =0 , +DLB2_COS_1 , +DLB2_COS_2 , +DLB2_COS_3 +}; + +struct dlb2_hw_dev { +struct dlb2_config cfg; +struct dlb2_hw_resource_info info; +void *pf_dev;/* opaque pointer to PF PMD dev (struct dlb2_dev) */ +uint32_t domain_id; +enum dlb2_cos cos_id; +rte_spinlock_t resource_lock;/* for MP support */ +} __rte_cache_aligned; + +/* End HW related defines and structs */ + +/* Begin DLB2 PMD Eventdev related defines and structs */ + +#define DLB2_MAX_NUM_QUEUES \ + (DLB2_MAX_NUM_DIR_QUEUES + DLB2_MAX_NUM_LDB_QUEUES) + +#define DLB2_MAX_NUM_PORTS (DLB2_MAX_NUM_DIR_PORTS + DLB2_MAX_NUM_LDB_PORTS) +#define DLB2_MAX_INPUT_QUEUE_DEPTH 256 + +/** Structure to hold the queue to port link establishment attributes */ + +struct dlb2_event_queue_link { +uint8_t queue_id; +uint8_t priority; +bool mapped; +bool valid; +}; + +struct dlb2_traffic_stats { +uint64_t rx_ok; +uint64_t rx_drop; +uint64_t rx_interrupt_wait; +uint64_t rx_umonitor_umwait; +uint64_t tx_ok; +uint64_t total_polls; +uint64_t zero_polls; +uint64_t tx_nospc_ldb_hw_credits; +uint64_t tx_nospc_dir_hw_credits; +uint64_t tx_nospc_inflight_max; +uint64_t tx_nospc_new_event_limit; +uint64_t tx_nospc_inflight_credits; +}; + +/* DLB2 HW sets the 2bit qid_depth in rx QEs based on the programmable depth +* threshold. The global default value in config/common_base (or rte_config.h) +* can be overridden on a per-qid basis using a vdev command line parameter. +* 3: depth > threshold +* 2: threshold >= depth > 3/4 threshold +* 1: 3/4 threshold >= depth > 1/2 threshold +* 0: depth <= 1/2 threshold. +*/ +#define DLB2_QID_DEPTH_LE50 0 +#define DLB2_QID_DEPTH_GT50_LE75 1 +#define DLB2_QID_DEPTH_GT75_LE100 2 +#define DLB2_QID_DEPTH_GT100 3 +#define DLB2_NUM_QID_DEPTH_STAT_VALS 4/* 2 bits */ + +struct dlb2_queue_stats { +uint64_t enq_ok; +uint64_t qid_depth[DLB2_NUM_QID_DEPTH_STAT_VALS ]; +}; + +struct dlb2_port_stats { +struct dlb2_traffic_stats traffic; +uint64_t tx_op_cnt[4 ];/* indexed by rte_event.op */ +uint64_t tx_implicit_rel; +uint64_t tx_sched_cnt[DLB2_NUM_HW_SCHED_TYPES ]; +uint64_t tx_invalid; +uint64_t rx_sched_cnt[DLB2_NUM_HW_SCHED_TYPES ]; +uint64_t rx_sched_invalid; +struct dlb2_queue_stats queue[DLB2_MAX_NUM_QUEUES ]; +}; + +struct dlb2_eventdev_port { +struct dlb2_port qm_port;/* hw specific data structure */ +struct rte_event_port_conf conf;/* user-supplied configuration */ +uint16_t inflight_credits;/* num credits this port has right now */ +uint16_t credit_update_quanta; +struct dlb2_eventdev *dlb2;/* backlink optimization */ + struct dlb2_port_stats stats __rte_cache_aligned; +struct dlb2_event_queue_link link[DLB2_MAX_NUM_QIDS_PER_LDB_CQ ]; +int num_links; +uint32_t id;/* port id */ +/* num releases yet to be completed on this port. +* Only applies to load-balanced ports. +*/ +uint16_t outstanding_releases; +uint16_t inflight_max;/* app requested max inflights for this port */ +/* setup_done is set when the event port is setup */ +bool setup_done; +/* enq_configured is set when the qm port is created */ +bool enq_configured; +uint8_t implicit_release;/* release events before dequeueing */ +} __rte_cache_aligned; + +struct dlb2_queue { +uint32_t num_qid_inflights;/* User config */ +uint32_t num_atm_inflights;/* User config */ +enum dlb2_configuration_state config_state; +int sched_type;/* LB queue only */ +uint32_t id; +bool is_directed; +}; + +struct dlb2_eventdev_queue { +struct dlb2_queue qm_queue; +struct rte_event_queue_conf conf;/* User config */ +int depth_threshold;/* use default if 0 */ +uint32_t id; +bool setup_done; +uint8_t num_links; +}; + +enum dlb2_run_state { +DLB2_RUN_STATE_STOPPED =0 , +DLB2_RUN_STATE_STOPPING , +DLB2_RUN_STATE_STARTING , +DLB2_RUN_STATE_STARTED +}; + +struct dlb2_eventdev { +struct dlb2_eventdev_port ev_ports[DLB2_MAX_NUM_PORTS ]; +struct dlb2_eventdev_queue ev_queues[DLB2_MAX_NUM_QUEUES ]; +uint8_t qm_ldb_to_ev_queue_id[DLB2_MAX_NUM_QUEUES ]; +uint8_t qm_dir_to_ev_queue_id[DLB2_MAX_NUM_QUEUES ]; +/* store num stats and offset of the stats for each queue */ +uint16_t xstats_count_per_qid[DLB2_MAX_NUM_QUEUES ]; +uint16_t xstats_offset_for_qid[DLB2_MAX_NUM_QUEUES ]; +/* store num stats and offset of the stats for each port */ +uint16_t xstats_count_per_port[DLB2_MAX_NUM_PORTS ]; +uint16_t xstats_offset_for_port[DLB2_MAX_NUM_PORTS ]; +struct dlb2_get_num_resources_args hw_rsrc_query_results; +uint32_t xstats_count_mode_queue; +struct dlb2_hw_dev qm_instance;/* strictly hw related */ +uint64_t global_dequeue_wait_ticks; +struct dlb2_xstats_entry *xstats; +struct rte_eventdev *event_dev;/* backlink to dev */ +uint32_t xstats_count_mode_dev; +uint32_t xstats_count_mode_port; +uint32_t xstats_count; +uint32_t inflights;/* use __atomic builtins */ +uint32_t new_event_limit; +int max_num_events_override; +int num_dir_credits_override; +volatile enum dlb2_run_state run_state; +uint16_t num_dir_queues;/* total num of evdev dir queues requested */ +uint16_t num_dir_credits; +uint16_t num_ldb_credits; +uint16_t num_queues;/* total queues */ +uint16_t num_ldb_queues;/* total num of evdev ldb queues requested */ +uint16_t num_ports;/* total num of evdev ports requested */ +uint16_t num_ldb_ports;/* total num of ldb ports requested */ +uint16_t num_dir_ports;/* total num of dir ports requested */ +bool umwait_allowed; +bool global_dequeue_wait;/* Not using per dequeue wait if true */ +bool defer_sched; +enum dlb2_cq_poll_modes poll_mode; +uint8_t revision; +bool configured; +uint16_t max_ldb_credits; +uint16_t max_dir_credits; + +/* force hw credit pool counters into exclusive cache lines */ + +/* use __atomic builtins */ /* shared hw cred */ + uint32_t ldb_credit_pool __rte_cache_aligned; +/* use __atomic builtins */ /* shared hw cred */ + uint32_t dir_credit_pool __rte_cache_aligned; +}; + +/* used for collecting and passing around the dev args */ +struct dlb2_qid_depth_thresholds { +int val[DLB2_MAX_NUM_QUEUES ]; +}; + +struct dlb2_devargs { +int socket_id; +int max_num_events; +int num_dir_credits_override; +int dev_id; +int defer_sched; +struct dlb2_qid_depth_thresholds qid_depth_thresholds; +enum dlb2_cos cos_id; +}; + +/* End Eventdev related defines and structs */ + +/* Forwards for non-inlined functions */ + +void dlb2_eventdev_dump (struct rte_eventdev *dev,FILE *f); + +int dlb2_xstats_init (struct dlb2_eventdev *dlb2); + +void dlb2_xstats_uninit (struct dlb2_eventdev *dlb2); + +int dlb2_eventdev_xstats_get (const struct rte_eventdev *dev, +enum rte_event_dev_xstats_mode mode,uint8_t queue_port_id, +const unsigned int ids[],uint64_t values[],unsigned int n); + +int dlb2_eventdev_xstats_get_names (const struct rte_eventdev *dev, +enum rte_event_dev_xstats_mode mode,uint8_t queue_port_id, +struct rte_event_dev_xstats_name *xstat_names, +unsigned int *ids,unsigned int size); + +uint64_t dlb2_eventdev_xstats_get_by_name (const struct rte_eventdev *dev, +const char *name,unsigned int *id); + +int dlb2_eventdev_xstats_reset (struct rte_eventdev *dev, +enum rte_event_dev_xstats_mode mode, +int16_t queue_port_id, +const uint32_t ids[], +uint32_t nb_ids); + +int test_dlb2_eventdev (void ); + +int dlb2_primary_eventdev_probe (struct rte_eventdev *dev, +const char *name, +struct dlb2_devargs *dlb2_args); + +int dlb2_secondary_eventdev_probe (struct rte_eventdev *dev, +const char *name); + +uint32_t dlb2_get_queue_depth (struct dlb2_eventdev *dlb2, +struct dlb2_eventdev_queue *queue); + +int dlb2_parse_params (const char *params, +const char *name, +struct dlb2_devargs *dlb2_args); + +/* Extern globals */ +extern struct process_local_port_data dlb2_port[][DLB2_NUM_PORT_TYPES ]; + +#endif /* _DLB2_PRIV_H_ */
Signature · 1 line
2.6.4
PATCH v9 4/23 event/dlb2: add definitions shared with LKM or shared code
In reply to Timothy McDanielAdd headers containing structs and constants shared between the PMD and the shared code. The term shared code refers to the code that implements the hardware interface. The shared code is introduced in the probe patch, and then is extended as additional eventdev PMD entry points are added to the patchset. In the case of the bifurcated PMD (to be introduced in the future), the shared code is contained in the Linux kernel module itself.
--- drivers/event/dlb2/dlb2_user.h | 679 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 679 insertions(+) create mode 100644 drivers/event/dlb2/dlb2_user.h
drivers/event/dlb2/dlb2_user.h new file +679 -0
@@ -0,0 +1,679 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2016-2020 Intel Corporation +*/ + +#ifndef __DLB2_USER_H +#define __DLB2_USER_H + +#define DLB2_MAX_NAME_LEN 64 + +#include <linux/types.h> + +enum dlb2_error { +DLB2_ST_SUCCESS =0 , +DLB2_ST_NAME_EXISTS , +DLB2_ST_DOMAIN_UNAVAILABLE , +DLB2_ST_LDB_PORTS_UNAVAILABLE , +DLB2_ST_DIR_PORTS_UNAVAILABLE , +DLB2_ST_LDB_QUEUES_UNAVAILABLE , +DLB2_ST_LDB_CREDITS_UNAVAILABLE , +DLB2_ST_DIR_CREDITS_UNAVAILABLE , +DLB2_ST_SEQUENCE_NUMBERS_UNAVAILABLE , +DLB2_ST_INVALID_DOMAIN_ID , +DLB2_ST_INVALID_QID_INFLIGHT_ALLOCATION , +DLB2_ST_ATOMIC_INFLIGHTS_UNAVAILABLE , +DLB2_ST_HIST_LIST_ENTRIES_UNAVAILABLE , +DLB2_ST_INVALID_LDB_QUEUE_ID , +DLB2_ST_INVALID_CQ_DEPTH , +DLB2_ST_INVALID_CQ_VIRT_ADDR , +DLB2_ST_INVALID_PORT_ID , +DLB2_ST_INVALID_QID , +DLB2_ST_INVALID_PRIORITY , +DLB2_ST_NO_QID_SLOTS_AVAILABLE , +DLB2_ST_INVALID_DIR_QUEUE_ID , +DLB2_ST_DIR_QUEUES_UNAVAILABLE , +DLB2_ST_DOMAIN_NOT_CONFIGURED , +DLB2_ST_INTERNAL_ERROR , +DLB2_ST_DOMAIN_IN_USE , +DLB2_ST_DOMAIN_NOT_FOUND , +DLB2_ST_QUEUE_NOT_FOUND , +DLB2_ST_DOMAIN_STARTED , +DLB2_ST_DOMAIN_NOT_STARTED , +DLB2_ST_LDB_PORT_REQUIRED_FOR_LDB_QUEUES , +DLB2_ST_DOMAIN_RESET_FAILED , +DLB2_ST_MBOX_ERROR , +DLB2_ST_INVALID_HIST_LIST_DEPTH , +DLB2_ST_NO_MEMORY , +DLB2_ST_INVALID_LOCK_ID_COMP_LEVEL , +DLB2_ST_INVALID_COS_ID , +}; + +static const char dlb2_error_strings[][128 ] = { +"DLB2_ST_SUCCESS" , +"DLB2_ST_NAME_EXISTS" , +"DLB2_ST_DOMAIN_UNAVAILABLE" , +"DLB2_ST_LDB_PORTS_UNAVAILABLE" , +"DLB2_ST_DIR_PORTS_UNAVAILABLE" , +"DLB2_ST_LDB_QUEUES_UNAVAILABLE" , +"DLB2_ST_LDB_CREDITS_UNAVAILABLE" , +"DLB2_ST_DIR_CREDITS_UNAVAILABLE" , +"DLB2_ST_SEQUENCE_NUMBERS_UNAVAILABLE" , +"DLB2_ST_INVALID_DOMAIN_ID" , +"DLB2_ST_INVALID_QID_INFLIGHT_ALLOCATION" , +"DLB2_ST_ATOMIC_INFLIGHTS_UNAVAILABLE" , +"DLB2_ST_HIST_LIST_ENTRIES_UNAVAILABLE" , +"DLB2_ST_INVALID_LDB_QUEUE_ID" , +"DLB2_ST_INVALID_CQ_DEPTH" , +"DLB2_ST_INVALID_CQ_VIRT_ADDR" , +"DLB2_ST_INVALID_PORT_ID" , +"DLB2_ST_INVALID_QID" , +"DLB2_ST_INVALID_PRIORITY" , +"DLB2_ST_NO_QID_SLOTS_AVAILABLE" , +"DLB2_ST_INVALID_DIR_QUEUE_ID" , +"DLB2_ST_DIR_QUEUES_UNAVAILABLE" , +"DLB2_ST_DOMAIN_NOT_CONFIGURED" , +"DLB2_ST_INTERNAL_ERROR" , +"DLB2_ST_DOMAIN_IN_USE" , +"DLB2_ST_DOMAIN_NOT_FOUND" , +"DLB2_ST_QUEUE_NOT_FOUND" , +"DLB2_ST_DOMAIN_STARTED" , +"DLB2_ST_DOMAIN_NOT_STARTED" , +"DLB2_ST_LDB_PORT_REQUIRED_FOR_LDB_QUEUES" , +"DLB2_ST_DOMAIN_RESET_FAILED" , +"DLB2_ST_MBOX_ERROR" , +"DLB2_ST_INVALID_HIST_LIST_DEPTH" , +"DLB2_ST_NO_MEMORY" , +"DLB2_ST_INVALID_LOCK_ID_COMP_LEVEL" , +"DLB2_ST_INVALID_COS_ID" , +}; + +struct dlb2_cmd_response { +__u32 status;/* Interpret using enum dlb2_error */ +__u32 id; +}; + +/*******************/ +/* 'dlb2' commands */ +/*******************/ + +#define DLB2_DEVICE_VERSION (x) (((x) >> 8) & 0xFF) +#define DLB2_DEVICE_REVISION (x) ((x) & 0xFF) + +enum dlb2_revisions { +DLB2_REV_A0 =0 , +}; + +/* +* DLB2_CMD_GET_DEVICE_VERSION: Query the DLB device version. +* +* This ioctl interface is the same in all driver versions and is always +* the first ioctl. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id[7:0]: Device revision. +* - response.id[15:8]: Device version. +*/ + +struct dlb2_get_device_version_args { +/* Output parameters */ +struct dlb2_cmd_response response; +}; + +/* +* DLB2_CMD_CREATE_SCHED_DOMAIN: Create a DLB 2.0 scheduling domain and reserve +* its hardware resources. This command returns the newly created domain +* ID and a file descriptor for accessing the domain. +* +* Input parameters: +* - num_ldb_queues: Number of load-balanced queues. +* - num_ldb_ports: Number of load-balanced ports that can be allocated from +* any class-of-service with available ports. +* - num_cos_ldb_ports[4]: Number of load-balanced ports from +* classes-of-service 0-3. +* - num_dir_ports: Number of directed ports. A directed port has one directed +* queue, so no num_dir_queues argument is necessary. +* - num_atomic_inflights: This specifies the amount of temporary atomic QE +* storage for the domain. This storage is divided among the domain's +* load-balanced queues that are configured for atomic scheduling. +* - num_hist_list_entries: Amount of history list storage. This is divided +* among the domain's CQs. +* - num_ldb_credits: Amount of load-balanced QE storage (QED). QEs occupy this +* space until they are scheduled to a load-balanced CQ. One credit +* represents the storage for one QE. +* - num_dir_credits: Amount of directed QE storage (DQED). QEs occupy this +* space until they are scheduled to a directed CQ. One credit represents +* the storage for one QE. +* - cos_strict: If set, return an error if there are insufficient ports in +* class-of-service N to satisfy the num_ldb_ports_cosN argument. If +* unset, attempt to fulfill num_ldb_ports_cosN arguments from other +* classes-of-service if class N does not contain enough free ports. +* - padding1: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: domain ID. +* - domain_fd: file descriptor for performing the domain's ioctl operations +* - padding0: Reserved for future use. +*/ +struct dlb2_create_sched_domain_args { +/* Output parameters */ +struct dlb2_cmd_response response; +__u32 domain_fd; +__u32 padding0; +/* Input parameters */ +__u32 num_ldb_queues; +__u32 num_ldb_ports; +__u32 num_cos_ldb_ports[4 ]; +__u32 num_dir_ports; +__u32 num_atomic_inflights; +__u32 num_hist_list_entries; +__u32 num_ldb_credits; +__u32 num_dir_credits; +__u8 cos_strict; +__u8 padding1[3 ]; +}; + +/* +* DLB2_CMD_GET_NUM_RESOURCES: Return the number of available resources +* (queues, ports, etc.) that this device owns. +* +* Output parameters: +* - num_domains: Number of available scheduling domains. +* - num_ldb_queues: Number of available load-balanced queues. +* - num_ldb_ports: Total number of available load-balanced ports. +* - num_cos_ldb_ports[4]: Number of available load-balanced ports from +* classes-of-service 0-3. +* - num_dir_ports: Number of available directed ports. There is one directed +* queue for every directed port. +* - num_atomic_inflights: Amount of available temporary atomic QE storage. +* - num_hist_list_entries: Amount of history list storage. +* - max_contiguous_hist_list_entries: History list storage is allocated in +* a contiguous chunk, and this return value is the longest available +* contiguous range of history list entries. +* - num_ldb_credits: Amount of available load-balanced QE storage. +* - num_dir_credits: Amount of available directed QE storage. +*/ +struct dlb2_get_num_resources_args { +/* Output parameters */ +__u32 num_sched_domains; +__u32 num_ldb_queues; +__u32 num_ldb_ports; +__u32 num_cos_ldb_ports[4 ]; +__u32 num_dir_ports; +__u32 num_atomic_inflights; +__u32 num_hist_list_entries; +__u32 max_contiguous_hist_list_entries; +__u32 num_ldb_credits; +__u32 num_dir_credits; +}; + +/* +* DLB2_CMD_SET_SN_ALLOCATION: Configure a sequence number group (PF only) +* +* Input parameters: +* - group: Sequence number group ID. +* - num: Number of sequence numbers per queue. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_set_sn_allocation_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 group; +__u32 num; +}; + +/* +* DLB2_CMD_GET_SN_ALLOCATION: Get a sequence number group's configuration +* +* Input parameters: +* - group: Sequence number group ID. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: Specified group's number of sequence numbers per queue. +*/ +struct dlb2_get_sn_allocation_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 group; +__u32 padding0; +}; + +/* +* DLB2_CMD_SET_COS_BW: Set a bandwidth allocation percentage for a +* load-balanced port class-of-service (PF only). +* +* Input parameters: +* - cos_id: class-of-service ID, between 0 and 3 (inclusive). +* - bandwidth: class-of-service bandwidth percentage. Total bandwidth +* percentages across all 4 classes cannot exceed 100%. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_set_cos_bw_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 cos_id; +__u32 bandwidth; +}; + +/* +* DLB2_CMD_GET_COS_BW: Get the bandwidth allocation percentage for a +* load-balanced port class-of-service. +* +* Input parameters: +* - cos_id: class-of-service ID, between 0 and 3 (inclusive). +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: Specified class's bandwidth percentage. +*/ +struct dlb2_get_cos_bw_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 cos_id; +__u32 padding0; +}; + +/* +* DLB2_CMD_GET_SN_OCCUPANCY: Get a sequence number group's occupancy +* +* Each sequence number group has one or more slots, depending on its +* configuration. I.e.: +* - If configured for 1024 sequence numbers per queue, the group has 1 slot +* - If configured for 512 sequence numbers per queue, the group has 2 slots +* ... +* - If configured for 32 sequence numbers per queue, the group has 32 slots +* +* This ioctl returns the group's number of in-use slots. If its occupancy is +* 0, the group's sequence number allocation can be reconfigured. +* +* Input parameters: +* - group: Sequence number group ID. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: Specified group's number of used slots. +*/ +struct dlb2_get_sn_occupancy_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 group; +__u32 padding0; +}; + +enum dlb2_cq_poll_modes { +DLB2_CQ_POLL_MODE_STD , +DLB2_CQ_POLL_MODE_SPARSE , + +/* NUM_DLB2_CQ_POLL_MODE must be last */ +NUM_DLB2_CQ_POLL_MODE , +}; + +/* +* DLB2_CMD_QUERY_CQ_POLL_MODE: Query the CQ poll mode setting +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: CQ poll mode (see enum dlb2_cq_poll_modes). +*/ +struct dlb2_query_cq_poll_mode_args { +/* Output parameters */ +struct dlb2_cmd_response response; +}; + +/********************************/ +/* 'scheduling domain' commands */ +/********************************/ + +/* +* DLB2_DOMAIN_CMD_CREATE_LDB_QUEUE: Configure a load-balanced queue. +* Input parameters: +* - num_atomic_inflights: This specifies the amount of temporary atomic QE +* storage for this queue. If zero, the queue will not support atomic +* scheduling. +* - num_sequence_numbers: This specifies the number of sequence numbers used +* by this queue. If zero, the queue will not support ordered scheduling. +* If non-zero, the queue will not support unordered scheduling. +* - num_qid_inflights: The maximum number of QEs that can be inflight +* (scheduled to a CQ but not completed) at any time. If +* num_sequence_numbers is non-zero, num_qid_inflights must be set equal +* to num_sequence_numbers. +* - lock_id_comp_level: Lock ID compression level. Specifies the number of +* unique lock IDs the queue should compress down to. Valid compression +* levels: 0, 64, 128, 256, 512, 1k, 2k, 4k, 64k. If lock_id_comp_level is +* 0, the queue won't compress its lock IDs. +* - depth_threshold: DLB sets two bits in the received QE to indicate the +* depth of the queue relative to the threshold before scheduling the +* QE to a CQ: +* - 2’b11: depth > threshold +* - 2’b10: threshold >= depth > 0.75 * threshold +* - 2’b01: 0.75 * threshold >= depth > 0.5 * threshold +* - 2’b00: depth <= 0.5 * threshold +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: Queue ID. +*/ +struct dlb2_create_ldb_queue_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 num_sequence_numbers; +__u32 num_qid_inflights; +__u32 num_atomic_inflights; +__u32 lock_id_comp_level; +__u32 depth_threshold; +__u32 padding0; +}; + +/* +* DLB2_DOMAIN_CMD_CREATE_DIR_QUEUE: Configure a directed queue. +* Input parameters: +* - port_id: Port ID. If the corresponding directed port is already created, +* specify its ID here. Else this argument must be 0xFFFFFFFF to indicate +* that the queue is being created before the port. +* - depth_threshold: DLB sets two bits in the received QE to indicate the +* depth of the queue relative to the threshold before scheduling the +* QE to a CQ: +* - 2’b11: depth > threshold +* - 2’b10: threshold >= depth > 0.75 * threshold +* - 2’b01: 0.75 * threshold >= depth > 0.5 * threshold +* - 2’b00: depth <= 0.5 * threshold +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: Queue ID. +*/ +struct dlb2_create_dir_queue_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__s32 port_id; +__u32 depth_threshold; +}; + +/* +* DLB2_DOMAIN_CMD_CREATE_LDB_PORT: Configure a load-balanced port. +* Input parameters: +* - cq_depth: Depth of the port's CQ. Must be a power-of-two between 8 and +* 1024, inclusive. +* - cq_depth_threshold: CQ depth interrupt threshold. A value of N means that +* the CQ interrupt won't fire until there are N or more outstanding CQ +* tokens. +* - num_hist_list_entries: Number of history list entries. This must be +* greater than or equal cq_depth. +* - cos_id: class-of-service to allocate this port from. Must be between 0 and +* 3, inclusive. +* - cos_strict: If set, return an error if there are no available ports in the +* requested class-of-service. Else, allocate the port from a different +* class-of-service if the requested class has no available ports. +* +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: port ID. +*/ + +struct dlb2_create_ldb_port_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u16 cq_depth; +__u16 cq_depth_threshold; +__u16 cq_history_list_size; +__u8 cos_id; +__u8 cos_strict; +}; + +/* +* DLB2_DOMAIN_CMD_CREATE_DIR_PORT: Configure a directed port. +* Input parameters: +* - cq_depth: Depth of the port's CQ. Must be a power-of-two between 8 and +* 1024, inclusive. +* - cq_depth_threshold: CQ depth interrupt threshold. A value of N means that +* the CQ interrupt won't fire until there are N or more outstanding CQ +* tokens. +* - qid: Queue ID. If the corresponding directed queue is already created, +* specify its ID here. Else this argument must be 0xFFFFFFFF to indicate +* that the port is being created before the queue. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: Port ID. +*/ +struct dlb2_create_dir_port_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u16 cq_depth; +__u16 cq_depth_threshold; +__s32 queue_id; +}; + +/* +* DLB2_DOMAIN_CMD_START_DOMAIN: Mark the end of the domain configuration. This +* must be called before passing QEs into the device, and no configuration +* ioctls can be issued once the domain has started. Sending QEs into the +* device before calling this ioctl will result in undefined behavior. +* Input parameters: +* - (None) +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_start_domain_args { +/* Output parameters */ +struct dlb2_cmd_response response; +}; + +/* +* DLB2_DOMAIN_CMD_MAP_QID: Map a load-balanced queue to a load-balanced port. +* Input parameters: +* - port_id: Load-balanced port ID. +* - qid: Load-balanced queue ID. +* - priority: Queue->port service priority. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_map_qid_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 port_id; +__u32 qid; +__u32 priority; +__u32 padding0; +}; + +/* +* DLB2_DOMAIN_CMD_UNMAP_QID: Unmap a load-balanced queue to a load-balanced +* port. +* Input parameters: +* - port_id: Load-balanced port ID. +* - qid: Load-balanced queue ID. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_unmap_qid_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 port_id; +__u32 qid; +}; + +/* +* DLB2_DOMAIN_CMD_ENABLE_LDB_PORT: Enable scheduling to a load-balanced port. +* Input parameters: +* - port_id: Load-balanced port ID. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_enable_ldb_port_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 port_id; +__u32 padding0; +}; + +/* +* DLB2_DOMAIN_CMD_ENABLE_DIR_PORT: Enable scheduling to a directed port. +* Input parameters: +* - port_id: Directed port ID. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_enable_dir_port_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 port_id; +}; + +/* +* DLB2_DOMAIN_CMD_DISABLE_LDB_PORT: Disable scheduling to a load-balanced +* port. +* Input parameters: +* - port_id: Load-balanced port ID. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_disable_ldb_port_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 port_id; +__u32 padding0; +}; + +/* +* DLB2_DOMAIN_CMD_DISABLE_DIR_PORT: Disable scheduling to a directed port. +* Input parameters: +* - port_id: Directed port ID. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_disable_dir_port_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 port_id; +__u32 padding0; +}; + +/* +* DLB2_DOMAIN_CMD_GET_LDB_QUEUE_DEPTH: Get a load-balanced queue's depth. +* Input parameters: +* - queue_id: The load-balanced queue ID. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: queue depth. +*/ +struct dlb2_get_ldb_queue_depth_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 queue_id; +__u32 padding0; +}; + +/* +* DLB2_DOMAIN_CMD_DIR_QUEUE_DEPTH: Get a directed queue's depth. +* Input parameters: +* - queue_id: The directed queue ID. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: queue depth. +*/ +struct dlb2_get_dir_queue_depth_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 queue_id; +__u32 padding0; +}; + +/* +* DLB2_DOMAIN_CMD_PENDING_PORT_UNMAPS: Get number of queue unmap operations in +* progress for a load-balanced port. +* +* Note: This is a snapshot; the number of unmap operations in progress +* is subject to change at any time. +* +* Input parameters: +* - port_id: Load-balanced port ID. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: number of unmaps in progress. +*/ +struct dlb2_pending_port_unmaps_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 port_id; +__u32 padding0; +}; + +/* +* Mapping sizes for memory mapping the consumer queue (CQ) memory space, and +* producer port (PP) MMIO space. +*/ +#define DLB2_CQ_SIZE 65536 +#define DLB2_PP_SIZE 4096 + + +#endif /* __DLB2_USER_H */
Signature · 1 line
2.6.4
PATCH v9 5/23 event/dlb2: add inline functions
In reply to Timothy McDanielAdd miscellaneous inline functions that may be called from multiple files. These functions include inline assembly of new x86 instructions, such as movdir64b, since they are not available as builtin functions in the minimum supported GCC version.
--- drivers/event/dlb2/dlb2_inline_fns.h | 42 ++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 drivers/event/dlb2/dlb2_inline_fns.h
drivers/event/dlb2/dlb2_inline_fns.h new file +42 -0
@@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2016-2020 Intel Corporation +*/ + +#ifndef _DLB2_INLINE_FNS_H_ +#define _DLB2_INLINE_FNS_H_ + +/* Inline functions required in more than one source file. */ + +static inline struct dlb2_eventdev * +dlb2_pmd_priv (const struct rte_eventdev *eventdev) +{ +return eventdev->data->dev_private; +} + +static inline void +dlb2_movntdq_single (void *pp_addr,void *qe4) +{ +long long *_qe = (long long *)qe4; +__m128i src_data0 = (__m128i ){_qe[0 ], _qe[1 ]}; + +_mm_stream_si128 (pp_addr, src_data0); +} + +static inline void +dlb2_cldemote (void *addr) +{ +/* Load addr into RSI, then demote the cache line of the address +* contained in that register. +*/ + asmvolatile (".byte 0x0f, 0x1c, 0x06" ::"S" (addr)); +} + +static inline void +dlb2_movdir64b (void *pp_addr,void *qe4) +{ + asmvolatile (".byte 0x66, 0x0f, 0x38, 0xf8, 0x02" + : + :"a" (pp_addr),"d" (qe4)); +} + +#endif /* _DLB2_INLINE_FNS_H_ */
Signature · 1 line
2.6.4
PATCH v9 6/23 event/dlb2: add eventdev probe
In reply to Timothy McDanielAdd the eventdev portion of probe, and parse command line options, but do not initialize hardware.
Changes since v2 patch-set probe:
Primary and secondary probe-time init has been removed, and will be introduced in subsequent patches contained in the v3 patch-set.
Hardware init has been moved to a subsequent patch in order to minimize the patch size. The files dlb2/pf/dlb2_pf.c and dlb2/pf/dlb_main.c include stubs of hardware init functions, and these will be replaced with the real versions when the hardware layer is committed.
Initialization of the flexible interface layer has been moved to a subsequent patch in order to minimize patch size.
--- drivers/event/dlb2/dlb2.c | 343 ++++ drivers/event/dlb2/meson.build | 5 +- drivers/event/dlb2/pf/base/dlb2_hw_types.h | 367 ++++ drivers/event/dlb2/pf/base/dlb2_mbox.h | 596 ++++++ drivers/event/dlb2/pf/base/dlb2_osdep.h | 230 +++ drivers/event/dlb2/pf/base/dlb2_osdep_bitmap.h | 440 +++++ drivers/event/dlb2/pf/base/dlb2_osdep_list.h | 131 ++ drivers/event/dlb2/pf/base/dlb2_osdep_types.h | 31 + drivers/event/dlb2/pf/base/dlb2_regs.h | 2527 ++++++++++++++++++++++++ drivers/event/dlb2/pf/base/dlb2_resource.h | 1913 ++++++++++++++++++ drivers/event/dlb2/pf/dlb2_main.c | 621 ++++++ drivers/event/dlb2/pf/dlb2_main.h | 98 + drivers/event/dlb2/pf/dlb2_pf.c | 196 ++ 13 files changed, 7497 insertions(+), 1 deletion(-) create mode 100644 drivers/event/dlb2/pf/base/dlb2_hw_types.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_mbox.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_osdep.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_osdep_bitmap.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_osdep_list.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_osdep_types.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_regs.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_resource.h create mode 100644 drivers/event/dlb2/pf/dlb2_main.c create mode 100644 drivers/event/dlb2/pf/dlb2_main.h create mode 100644 drivers/event/dlb2/pf/dlb2_pf.c
drivers/event/dlb2/dlb2.c +343 -0
@@ -2,6 +2,349 @@* Copyright(c) 2016-2020 Intel Corporation */ +#include <assert.h> +#include <errno.h> +#include <nmmintrin.h> +#include <pthread.h> +#include <stdint.h> +#include <stdbool.h> +#include <stdio.h> +#include <string.h> +#include <sys/mman.h> +#include <sys/fcntl.h> + +#include <rte_common.h> +#include <rte_config.h> +#include <rte_cycles.h> +#include <rte_debug.h> +#include <rte_dev.h> +#include <rte_errno.h> +#include <rte_eventdev.h> +#include <rte_eventdev_pmd.h> +#include <rte_io.h> +#include <rte_kvargs.h> #include <rte_log.h> +#include <rte_malloc.h> +#include <rte_mbuf.h> +#include <rte_prefetch.h> +#include <rte_ring.h> +#include <rte_string_fns.h> + +#include "dlb2_priv.h" +#include "dlb2_inline_fns.h" + +/* +* Resources exposed to eventdev. Some values overridden at runtime using +* values returned by the DLB kernel driver. +*/ +#if (RTE_EVENT_MAX_QUEUES_PER_DEV >UINT8_MAX ) +#error "RTE_EVENT_MAX_QUEUES_PER_DEV cannot fit in member max_event_queues" +#endif + +struct process_local_port_data +dlb2_port[DLB2_MAX_NUM_PORTS ][DLB2_NUM_PORT_TYPES ]; + +#define DLB2_BASE_10 10 + +static int +dlb2_string_to_int (int *result,const char *str) +{ +long ret; +char *endptr; + +if (str ==NULL || result ==NULL ) +return -EINVAL ; + + errno =0 ; + ret =strtol (str, &endptr,DLB2_BASE_10 ); +if (errno) +return -errno; + +/* long int and int may be different width for some architectures */ +if (ret <INT_MIN || ret >INT_MAX || endptr == str) +return -EINVAL ; + + *result = ret; +return 0 ; +} + +static int +set_numa_node(const char *key __rte_unused, const char *value, void *opaque) +{ +int *socket_id = opaque; +int ret; + + ret =dlb2_string_to_int (socket_id, value); +if (ret <0 ) +return ret; + +if (*socket_id >RTE_MAX_NUMA_NODES ) +return -EINVAL ; +return 0 ; +} + +static int +set_max_num_events(const char *key __rte_unused, +const char *value, +void *opaque) +{ +int *max_num_events = opaque; +int ret; + +if (value ==NULL || opaque ==NULL ) { +DLB2_LOG_ERR ("NULL pointer\n" ); +return -EINVAL ; + } + + ret =dlb2_string_to_int (max_num_events, value); +if (ret <0 ) +return ret; + +if (*max_num_events <0 || *max_num_events > +DLB2_MAX_NUM_LDB_CREDITS ) { +DLB2_LOG_ERR ("dlb2: max_num_events must be between 0 and %d\n" , +DLB2_MAX_NUM_LDB_CREDITS ); +return -EINVAL ; + } + +return 0 ; +} + +static int +set_num_dir_credits(const char *key __rte_unused, +const char *value, +void *opaque) +{ +int *num_dir_credits = opaque; +int ret; + +if (value ==NULL || opaque ==NULL ) { +DLB2_LOG_ERR ("NULL pointer\n" ); +return -EINVAL ; + } + + ret =dlb2_string_to_int (num_dir_credits, value); +if (ret <0 ) +return ret; + +if (*num_dir_credits <0 || + *num_dir_credits >DLB2_MAX_NUM_DIR_CREDITS ) { +DLB2_LOG_ERR ("dlb2: num_dir_credits must be between 0 and %d\n" , +DLB2_MAX_NUM_DIR_CREDITS ); +return -EINVAL ; + } + +return 0 ; +} + +static int +set_dev_id(const char *key __rte_unused, +const char *value, +void *opaque) +{ +int *dev_id = opaque; +int ret; + +if (value ==NULL || opaque ==NULL ) { +DLB2_LOG_ERR ("NULL pointer\n" ); +return -EINVAL ; + } + + ret =dlb2_string_to_int (dev_id, value); +if (ret <0 ) +return ret; + +return 0 ; +} + +static int +set_cos(const char *key __rte_unused, +const char *value, +void *opaque) +{ +enum dlb2_cos *cos_id = opaque; +int x =0 ; +int ret; + +if (value ==NULL || opaque ==NULL ) { +DLB2_LOG_ERR ("NULL pointer\n" ); +return -EINVAL ; + } + + ret =dlb2_string_to_int (&x, value); +if (ret <0 ) +return ret; + +if (x !=DLB2_COS_DEFAULT && (x <DLB2_COS_0 || x >DLB2_COS_3 )) { +DLB2_LOG_ERR ( +"COS %d out of range, must be DLB2_COS_DEFAULT or 0-3\n" , + x); +return -EINVAL ; + } + + *cos_id = x; + +return 0 ; +} + + +static int +set_qid_depth_thresh(const char *key __rte_unused, +const char *value, +void *opaque) +{ +struct dlb2_qid_depth_thresholds *qid_thresh = opaque; +int first, last, thresh, i; + +if (value ==NULL || opaque ==NULL ) { +DLB2_LOG_ERR ("NULL pointer\n" ); +return -EINVAL ; + } + +/* command line override may take one of the following 3 forms: +* qid_depth_thresh=all:<threshold_value> ... all queues +* qid_depth_thresh=qidA-qidB:<threshold_value> ... a range of queues +* qid_depth_thresh=qid:<threshold_value> ... just one queue +*/ +if (sscanf (value,"all:%d" , &thresh) ==1 ) { + first =0 ; + last =DLB2_MAX_NUM_QUEUES -1 ; + }else if (sscanf (value,"%d-%d:%d" , &first, &last, &thresh) ==3 ) { +/* we have everything we need */ + }else if (sscanf (value,"%d:%d" , &first, &thresh) ==2 ) { + last = first; + }else { +DLB2_LOG_ERR ("Error parsing qid depth devarg. Should be all:val, qid-qid:val, or qid:val\n" ); +return -EINVAL ; + } + +if (first > last || first <0 || last >=DLB2_MAX_NUM_QUEUES ) { +DLB2_LOG_ERR ("Error parsing qid depth devarg, invalid qid value\n" ); +return -EINVAL ; + } + +if (thresh <0 || thresh >DLB2_MAX_QUEUE_DEPTH_THRESHOLD ) { +DLB2_LOG_ERR ("Error parsing qid depth devarg, threshold > %d\n" , +DLB2_MAX_QUEUE_DEPTH_THRESHOLD ); +return -EINVAL ; + } + +for (i = first; i <= last; i++) + qid_thresh->val[i] = thresh;/* indexed by qid */ + +return 0 ; +} + +int +dlb2_primary_eventdev_probe (struct rte_eventdev *dev, +const char *name, +struct dlb2_devargs *dlb2_args) +{ +RTE_SET_USED (dev); +RTE_SET_USED (name); +RTE_SET_USED (dlb2_args); + +return 0 ; +} + +int +dlb2_secondary_eventdev_probe (struct rte_eventdev *dev, +const char *name) +{ +RTE_SET_USED (dev); +RTE_SET_USED (name); + +return 0 ; +} + +int +dlb2_parse_params (const char *params, +const char *name, +struct dlb2_devargs *dlb2_args) +{ +int ret =0 ; +static const char *const args[] = {NUMA_NODE_ARG , +DLB2_MAX_NUM_EVENTS , +DLB2_NUM_DIR_CREDITS , +DEV_ID_ARG , +DLB2_QID_DEPTH_THRESH_ARG , +DLB2_COS_ARG , +NULL }; + +if (params !=NULL && params[0 ] !='\0' ) { +struct rte_kvargs *kvlist =rte_kvargs_parse (params, args); + +if (kvlist ==NULL ) { +RTE_LOG (INFO ,PMD , +"Ignoring unsupported parameters when creating device '%s'\n" , + name); + }else { +int ret =rte_kvargs_process (kvlist,NUMA_NODE_ARG , + set_numa_node, + &dlb2_args->socket_id); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing numa node parameter" , + name); +rte_kvargs_free (kvlist); +return ret; + } + + ret =rte_kvargs_process (kvlist,DLB2_MAX_NUM_EVENTS , + set_max_num_events, + &dlb2_args->max_num_events); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing max_num_events parameter" , + name); +rte_kvargs_free (kvlist); +return ret; + } + + ret =rte_kvargs_process (kvlist, +DLB2_NUM_DIR_CREDITS , + set_num_dir_credits, + &dlb2_args->num_dir_credits_override); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing num_dir_credits parameter" , + name); +rte_kvargs_free (kvlist); +return ret; + } + + ret =rte_kvargs_process (kvlist,DEV_ID_ARG , + set_dev_id, + &dlb2_args->dev_id); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing dev_id parameter" , + name); +rte_kvargs_free (kvlist); +return ret; + } + + ret =rte_kvargs_process ( + kvlist, +DLB2_QID_DEPTH_THRESH_ARG , + set_qid_depth_thresh, + &dlb2_args->qid_depth_thresholds); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing qid_depth_thresh parameter" , + name); +rte_kvargs_free (kvlist); +return ret; + } + + ret =rte_kvargs_process (kvlist,DLB2_COS_ARG , + set_cos, + &dlb2_args->cos_id); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing cos parameter" , + name); +rte_kvargs_free (kvlist); +return ret; + } +rte_kvargs_free (kvlist); + } + } +return ret; +}RTE_LOG_REGISTER (eventdev_dlb2_log_level, pmd.event.dlb2,NOTICE );
drivers/event/dlb2/meson.build +4 -1
@@ -7,6 +7,9 @@ if not is_linux or not dpdk_conf.has('RTE_ARCH_X86_64') subdir_done() endif -sources = files('dlb2.c') +sources = files('dlb2.c', + 'pf/dlb2_main.c', + 'pf/dlb2_pf.c' +) deps += ['mbuf', 'mempool', 'ring', 'pci', 'bus_pci']
drivers/event/dlb2/pf/base/dlb2_hw_types.h new file +367 -0
367 lines not on this page · raw message
drivers/event/dlb2/pf/base/dlb2_mbox.h new file +596 -0
596 lines not on this page · raw message
drivers/event/dlb2/pf/base/dlb2_osdep.h new file +230 -0
230 lines not on this page · raw message
drivers/event/dlb2/pf/base/dlb2_osdep_bitmap.h new file +440 -0
440 lines not on this page · raw message
drivers/event/dlb2/pf/base/dlb2_osdep_list.h new file +131 -0
131 lines not on this page · raw message
drivers/event/dlb2/pf/base/dlb2_osdep_types.h new file +31 -0
@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2016-2020 Intel Corporation +*/ + +#ifndef __DLB2_OSDEP_TYPES_H +#define __DLB2_OSDEP_TYPES_H + +#include <linux/types.h> + +#include <inttypes.h> +#include <ctype.h> +#include <stdint.h> +#include <stdbool.h> +#include <string.h> +#include <unistd.h> +#include <errno.h> + +/* Types for user mode PF PMD */ +typedef uint8_t u8 ; +typedef int8_t s8 ; +typedef uint16_t u16 ; +typedef int16_t s16 ; +typedef uint32_t u32 ; +typedef int32_t s32 ; +typedef uint64_t u64 ; + +#define __iomem + +/* END types for user mode PF PMD */ + +#endif /* __DLB2_OSDEP_TYPES_H */
drivers/event/dlb2/pf/base/dlb2_regs.h new file +2527 -0
846 lines not on this page · raw message
drivers/event/dlb2/pf/base/dlb2_resource.h new file +1913 -0
1,913 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_main.c new file +621 -0
621 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_main.h new file +98 -0
98 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_pf.c new file +196 -0
196 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.6.4
Part of the diff is not shown here. View the raw message.
PATCH v9 7/23 event/dlb2: add flexible interface
In reply to Timothy McDanielThis commit introduces the flexible interface. This interface allows the core code to operate in PF mode (direct hardware access) or bifurcated mode (hardware configured via kernel driver). This driver currently only supports PF mode but bifurcated mode will be added in a future DPDK patch-set. Note that the flexible interface is not used for data path operations, and thus there are no performance concerns related to the use of function pointers.
--- drivers/event/dlb2/dlb2_iface.c | 28 ++++++++++++++++++++++++++++ drivers/event/dlb2/dlb2_iface.h | 29 +++++++++++++++++++++++++++++ drivers/event/dlb2/meson.build | 1 + 3 files changed, 58 insertions(+) create mode 100644 drivers/event/dlb2/dlb2_iface.c create mode 100644 drivers/event/dlb2/dlb2_iface.h
drivers/event/dlb2/dlb2_iface.c new file +28 -0
@@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2016-2020 Intel Corporation +*/ + +#include <stdint.h> + +#include "dlb2_priv.h" + +/* DLB2 PMD Internal interface function pointers. +* If VDEV (bifurcated PMD), these will resolve to functions that issue ioctls +* serviced by DLB kernel module. +* If PCI (PF PMD), these will be implemented locally in user mode. +*/ + +void (*dlb2_iface_low_level_io_init)(void ); + +int (*dlb2_iface_open)(struct dlb2_hw_dev *handle,const char *name); + +int (*dlb2_iface_get_device_version)(struct dlb2_hw_dev *handle, +uint8_t *revision); + +void (*dlb2_iface_hardware_init)(struct dlb2_hw_dev *handle); + +int (*dlb2_iface_get_cq_poll_mode)(struct dlb2_hw_dev *handle, +enum dlb2_cq_poll_modes *mode); + +int (*dlb2_iface_get_num_resources)(struct dlb2_hw_dev *handle, +struct dlb2_get_num_resources_args *rsrcs);
drivers/event/dlb2/dlb2_iface.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2016-2020 Intel Corporation +*/ + +#ifndef _DLB2_IFACE_H_ +#define _DLB2_IFACE_H_ + +/* DLB2 PMD Internal interface function pointers. +* If VDEV (bifurcated PMD), these will resolve to functions that issue ioctls +* serviced by DLB kernel module. +* If PCI (PF PMD), these will be implemented locally in user mode. +*/ + +extern void (*dlb2_iface_low_level_io_init)(void ); + +extern int (*dlb2_iface_open)(struct dlb2_hw_dev *handle,const char *name); + +extern int (*dlb2_iface_get_device_version)(struct dlb2_hw_dev *handle, +uint8_t *revision); + +extern void (*dlb2_iface_hardware_init)(struct dlb2_hw_dev *handle); + +extern int (*dlb2_iface_get_cq_poll_mode)(struct dlb2_hw_dev *handle, +enum dlb2_cq_poll_modes *mode); + +extern int (*dlb2_iface_get_num_resources)(struct dlb2_hw_dev *handle, +struct dlb2_get_num_resources_args *rsrcs); + +#endif /* _DLB2_IFACE_H_ */
drivers/event/dlb2/meson.build +1 -0
@@ -8,6 +8,7 @@ if not is_linux or not dpdk_conf.has('RTE_ARCH_X86_64') endif sources = files('dlb2.c', + 'dlb2_iface.c', 'pf/dlb2_main.c', 'pf/dlb2_pf.c' )
Signature · 1 line
2.6.4
PATCH v9 8/23 event/dlb2: add probe-time hardware init
In reply to Timothy McDanielThis commit adds probe-time low level hardware initialization. It also adds probe-time init for both primary and secondary DPDK processes.
--- drivers/event/dlb2/dlb2.c | 188 +++++++++++++++++++- drivers/event/dlb2/meson.build | 3 +- drivers/event/dlb2/pf/base/dlb2_resource.c | 274 +++++++++++++++++++++++++++++ drivers/event/dlb2/pf/dlb2_main.c | 23 +-- drivers/event/dlb2/pf/dlb2_main.h | 1 - drivers/event/dlb2/pf/dlb2_pf.c | 78 ++++++-- 6 files changed, 523 insertions(+), 44 deletions(-) create mode 100644 drivers/event/dlb2/pf/base/dlb2_resource.c
drivers/event/dlb2/dlb2.c +183 -5
@@ -31,6 +31,7 @@#include <rte_string_fns.h> #include "dlb2_priv.h" +#include "dlb2_iface.h" #include "dlb2_inline_fns.h" /*
@@ -40,10 +41,108 @@#if (RTE_EVENT_MAX_QUEUES_PER_DEV >UINT8_MAX )#error "RTE_EVENT_MAX_QUEUES_PER_DEV cannot fit in member max_event_queues"#endif +static struct rte_event_dev_info evdev_dlb2_default_info = { + .driver_name ="" ,/* probe will set */ + .min_dequeue_timeout_ns =DLB2_MIN_DEQUEUE_TIMEOUT_NS , + .max_dequeue_timeout_ns =DLB2_MAX_DEQUEUE_TIMEOUT_NS , +#if (RTE_EVENT_MAX_QUEUES_PER_DEV < DLB2_MAX_NUM_LDB_QUEUES) + .max_event_queues =RTE_EVENT_MAX_QUEUES_PER_DEV , +#else + .max_event_queues =DLB2_MAX_NUM_LDB_QUEUES , +#endif + .max_event_queue_flows =DLB2_MAX_NUM_FLOWS , + .max_event_queue_priority_levels =DLB2_QID_PRIORITIES , + .max_event_priority_levels =DLB2_QID_PRIORITIES , + .max_event_ports =DLB2_MAX_NUM_LDB_PORTS , + .max_event_port_dequeue_depth =DLB2_MAX_CQ_DEPTH , + .max_event_port_enqueue_depth =DLB2_MAX_ENQUEUE_DEPTH , + .max_event_port_links =DLB2_MAX_NUM_QIDS_PER_LDB_CQ , + .max_num_events =DLB2_MAX_NUM_LDB_CREDITS , + .max_single_link_event_port_queue_pairs =DLB2_MAX_NUM_DIR_PORTS , + .event_dev_cap = (RTE_EVENT_DEV_CAP_QUEUE_QOS | +RTE_EVENT_DEV_CAP_EVENT_QOS | +RTE_EVENT_DEV_CAP_BURST_MODE | +RTE_EVENT_DEV_CAP_DISTRIBUTED_SCHED | +RTE_EVENT_DEV_CAP_IMPLICIT_RELEASE_DISABLE | +RTE_EVENT_DEV_CAP_QUEUE_ALL_TYPES ), +};struct process_local_port_data dlb2_port[DLB2_MAX_NUM_PORTS ][DLB2_NUM_PORT_TYPES ]; +/* override defaults with value(s) provided on command line */ +static void +dlb2_init_queue_depth_thresholds (struct dlb2_eventdev *dlb2, +int *qid_depth_thresholds) +{ +int q; + +for (q =0 ; q <DLB2_MAX_NUM_QUEUES ; q++) { +if (qid_depth_thresholds[q] !=0 ) + dlb2->ev_queues[q].depth_threshold = + qid_depth_thresholds[q]; + } +} + +static int +dlb2_hw_query_resources (struct dlb2_eventdev *dlb2) +{ +struct dlb2_hw_dev *handle = &dlb2->qm_instance; +struct dlb2_hw_resource_info *dlb2_info = &handle->info; +int ret; + +/* Query driver resources provisioned for this device */ + + ret =dlb2_iface_get_num_resources (handle, + &dlb2->hw_rsrc_query_results); +if (ret) { +DLB2_LOG_ERR ("ioctl get dlb2 num resources, err=%d\n" , ret); +return ret; + } + +/* Complete filling in device resource info returned to evdev app, +* overriding any default values. +* The capabilities (CAPs) were set at compile time. +*/ + + evdev_dlb2_default_info.max_event_queues = + dlb2->hw_rsrc_query_results.num_ldb_queues; + + evdev_dlb2_default_info.max_event_ports = + dlb2->hw_rsrc_query_results.num_ldb_ports; + + evdev_dlb2_default_info.max_num_events = + dlb2->hw_rsrc_query_results.num_ldb_credits; + +/* Save off values used when creating the scheduling domain. */ + + handle->info.num_sched_domains = + dlb2->hw_rsrc_query_results.num_sched_domains; + + handle->info.hw_rsrc_max.nb_events_limit = + dlb2->hw_rsrc_query_results.num_ldb_credits; + + handle->info.hw_rsrc_max.num_queues = + dlb2->hw_rsrc_query_results.num_ldb_queues + + dlb2->hw_rsrc_query_results.num_dir_ports; + + handle->info.hw_rsrc_max.num_ldb_queues = + dlb2->hw_rsrc_query_results.num_ldb_queues; + + handle->info.hw_rsrc_max.num_ldb_ports = + dlb2->hw_rsrc_query_results.num_ldb_ports; + + handle->info.hw_rsrc_max.num_dir_ports = + dlb2->hw_rsrc_query_results.num_dir_ports; + + handle->info.hw_rsrc_max.reorder_window_size = + dlb2->hw_rsrc_query_results.num_hist_list_entries; + +rte_memcpy (dlb2_info, &handle->info.hw_rsrc_max,sizeof (*dlb2_info)); + +return 0 ; +} +#define DLB2_BASE_10 10 static int
@@ -235,14 +334,71 @@ set_qid_depth_thresh(const char *key __rte_unused,return 0 ; } +static void +dlb2_entry_points_init (struct rte_eventdev *dev) +{ +RTE_SET_USED (dev); + +/* Eventdev PMD entry points */ +} +int dlb2_primary_eventdev_probe (struct rte_eventdev *dev,const char *name,struct dlb2_devargs *dlb2_args) { -RTE_SET_USED (dev); -RTE_SET_USED (name); -RTE_SET_USED (dlb2_args); +struct dlb2_eventdev *dlb2; +int err; + + dlb2 = dev->data->dev_private; + + dlb2->event_dev = dev;/* backlink */ + + evdev_dlb2_default_info.driver_name = name; + + dlb2->max_num_events_override = dlb2_args->max_num_events; + dlb2->num_dir_credits_override = dlb2_args->num_dir_credits_override; + dlb2->qm_instance.cos_id = dlb2_args->cos_id; + + err =dlb2_iface_open (&dlb2->qm_instance, name); +if (err <0 ) { +DLB2_LOG_ERR ("could not open event hardware device, err=%d\n" , + err); +return err; + } + + err =dlb2_iface_get_device_version (&dlb2->qm_instance, + &dlb2->revision); +if (err <0 ) { +DLB2_LOG_ERR ("dlb2: failed to get the device version, err=%d\n" , + err); +return err; + } + + err =dlb2_hw_query_resources (dlb2); +if (err) { +DLB2_LOG_ERR ("get resources err=%d for %s\n" , + err, name); +return err; + } + +dlb2_iface_hardware_init (&dlb2->qm_instance); + + err =dlb2_iface_get_cq_poll_mode (&dlb2->qm_instance, &dlb2->poll_mode); +if (err <0 ) { +DLB2_LOG_ERR ("dlb2: failed to get the poll mode, err=%d\n" , + err); +return err; + } + +rte_spinlock_init (&dlb2->qm_instance.resource_lock); + +dlb2_iface_low_level_io_init (); + +dlb2_entry_points_init (dev); + +dlb2_init_queue_depth_thresholds (dlb2, + dlb2_args->qid_depth_thresholds.val);return 0 ; }
@@ -251,8 +407,30 @@ int dlb2_secondary_eventdev_probe(struct rte_eventdev *dev, const char *name) { -RTE_SET_USED (dev); -RTE_SET_USED (name); + struct dlb2_eventdev *dlb2; +int err; + + dlb2 = dev->data->dev_private; + + evdev_dlb2_default_info.driver_name = name; + + err =dlb2_iface_open (&dlb2->qm_instance, name); +if (err <0 ) { +DLB2_LOG_ERR ("could not open event hardware device, err=%d\n" , + err); +return err; + } + + err =dlb2_hw_query_resources (dlb2); +if (err) { +DLB2_LOG_ERR ("get resources err=%d for %s\n" , + err, name); +return err; + } + +dlb2_iface_low_level_io_init (); + +dlb2_entry_points_init (dev);return 0 ; }
drivers/event/dlb2/meson.build +2 -1
@@ -10,7 +10,8 @@ endif sources = files('dlb2.c', 'dlb2_iface.c', 'pf/dlb2_main.c', - 'pf/dlb2_pf.c' + 'pf/dlb2_pf.c', + 'pf/base/dlb2_resource.c' ) deps += ['mbuf', 'mempool', 'ring', 'pci', 'bus_pci']
drivers/event/dlb2/pf/base/dlb2_resource.c new file +274 -0
274 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_main.c +1 -22
@@ -19,6 +19,7 @@#include "dlb2_main.h" #include "../dlb2_user.h" #include "../dlb2_priv.h" +#include "../dlb2_iface.h" #include "../dlb2_inline_fns.h" #define PF_ID_ZERO 0/* PF ONLY! */
@@ -72,27 +73,6 @@#define DLB2_PCI_ACS_UF 0x10#define DLB2_PCI_ACS_EC 0x20 -/* Stubs: Allow building partial probe patch */ -void dlb2_resource_free (struct dlb2_hw *hw) -{ -RTE_SET_USED (hw); -} - -int dlb2_resource_init (struct dlb2_hw *hw) -{ -int ret =0 ; -RTE_SET_USED (hw); - -return ret; -} - -void dlb2_clr_pmcsr_disable (struct dlb2_hw *hw) -{ -RTE_SET_USED (hw); -} - -/* End stubs */ -static int dlb2_pci_find_ext_capability (struct rte_pci_device *pdev,uint32_t id) {
@@ -149,7 +129,6 @@ static int dlb2_pf_init_driver_state(struct dlb2_dev *dlb2_dev) {rte_spinlock_init (&dlb2_dev->resource_mutex); -rte_spinlock_init (&dlb2_dev->measurement_lock);return 0 ; }
drivers/event/dlb2/pf/dlb2_main.h +0 -1
@@ -38,7 +38,6 @@ struct dlb2_dev {* hardware registers. */ rte_spinlock_t resource_mutex; -rte_spinlock_t measurement_lock;bool worker_launched;u8 revision; };
drivers/event/dlb2/pf/dlb2_pf.c +63 -15
104 lines not on this page · raw message
Signature · 1 line
2.6.4
PATCH v9 9/23 event/dlb2: add xstats
In reply to Timothy McDanielAdd support for DLB2 xstats. Perform initialization and add standard xstats entry points.
--- drivers/event/dlb2/dlb2.c | 35 +- drivers/event/dlb2/dlb2_xstats.c | 1240 ++++++++++++++++++++++++++++++++++++++ drivers/event/dlb2/meson.build | 1 + 3 files changed, 1273 insertions(+), 3 deletions(-) create mode 100644 drivers/event/dlb2/dlb2_xstats.c
drivers/event/dlb2/dlb2.c +32 -3
@@ -70,6 +70,21 @@ static struct rte_event_dev_info evdev_dlb2_default_info = {struct process_local_port_data dlb2_port[DLB2_MAX_NUM_PORTS ][DLB2_NUM_PORT_TYPES ]; +/* +* DUMMY - added so that xstats path will compile/link. +* Will be replaced by real version in a subsequent +* patch. +*/ +uint32_t +dlb2_get_queue_depth (struct dlb2_eventdev *dlb2, +struct dlb2_eventdev_queue *queue) +{ +RTE_SET_USED (dlb2); +RTE_SET_USED (queue); + +return 0 ; +} +/* override defaults with value(s) provided on command line */ static void dlb2_init_queue_depth_thresholds(struct dlb2_eventdev *dlb2,
@@ -337,9 +352,16 @@ set_qid_depth_thresh(const char *key __rte_unused,static void dlb2_entry_points_init (struct rte_eventdev *dev) { -RTE_SET_USED (dev); - -/* Eventdev PMD entry points */ +/* Expose PMD's eventdev interface */ +static struct rte_eventdev_ops dlb2_eventdev_entry_ops = { + .dump = dlb2_eventdev_dump, + .xstats_get = dlb2_eventdev_xstats_get, + .xstats_get_names = dlb2_eventdev_xstats_get_names, + .xstats_get_by_name = dlb2_eventdev_xstats_get_by_name, + .xstats_reset = dlb2_eventdev_xstats_reset, + }; + + dev->dev_ops = &dlb2_eventdev_entry_ops; }int
@@ -391,6 +413,13 @@ dlb2_primary_eventdev_probe(struct rte_eventdev *dev,return err; } +/* Complete xtstats runtime initialization */ + err =dlb2_xstats_init (dlb2); +if (err) { +DLB2_LOG_ERR ("dlb2: failed to init xstats, err=%d\n" , err); +return err; + } +rte_spinlock_init (&dlb2->qm_instance.resource_lock);dlb2_iface_low_level_io_init ();
drivers/event/dlb2/dlb2_xstats.c new file +1240 -0
1,240 lines not on this page · raw message
drivers/event/dlb2/meson.build +1 -0
@@ -9,6 +9,7 @@ endif sources = files('dlb2.c', 'dlb2_iface.c', + 'dlb2_xstats.c', 'pf/dlb2_main.c', 'pf/dlb2_pf.c', 'pf/base/dlb2_resource.c'
Signature · 1 line
2.6.4
PATCH v9 10/23 event/dlb2: add infos get and configure
In reply to Timothy McDanielAdd support for configuring the DLB2 hardware.
In particular, this patch configures the DLB2 hardware's scheduling domain, such that it is provisioned with the requested number of ports and queues, provided sufficient resources are available. Individual queues and ports are configured later in port setup and eventdev start.
--- doc/guides/eventdevs/dlb2.rst | 116 + drivers/event/dlb2/dlb2.c | 313 +++ drivers/event/dlb2/dlb2_iface.c | 5 + drivers/event/dlb2/dlb2_iface.h | 4 + drivers/event/dlb2/pf/base/dlb2_resource.c | 3237 ++++++++++++++++++++++++++++ drivers/event/dlb2/pf/dlb2_main.c | 15 + drivers/event/dlb2/pf/dlb2_pf.c | 44 + 7 files changed, 3734 insertions(+)
doc/guides/eventdevs/dlb2.rst +116 -0
@@ -32,9 +32,125 @@ detailed understanding of the hardware, but these details are important when writing high-performance code. This section describes the places where the eventdev API and DLB2 misalign. +Scheduling Domain Configuration +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +There are 32 scheduling domainis the DLB2. +When one is configured, it allocates load-balanced and +directed queues, ports, credits, and other hardware resources. Some +resource allocations are user-controlled -- the number of queues, for example +-- and others, like credit pools (one directed and one load-balanced pool per +scheduling domain), are not. + +The DLB2 is a closed system eventdev, and as such the ``nb_events_limit`` device +setup argument and the per-port ``new_event_threshold`` argument apply as +defined in the eventdev header file. The limit is applied to all enqueues, +regardless of whether it will consume a directed or load-balanced credit. + +Load-balanced and Directed Ports +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +DLB2 ports come in two flavors: load-balanced and directed. The eventdev API +does not have the same concept, but it has a similar one: ports and queues that +are singly-linked (i.e. linked to a single queue or port, respectively). + +The ``rte_event_dev_info_get()`` function reports the number of available +event ports and queues (among other things). For the DLB2 PMD, max_event_ports +and max_event_queues report the number of available load-balanced ports and +queues, and max_single_link_event_port_queue_pairs reports the number of +available directed ports and queues. + +When a scheduling domain is created in ``rte_event_dev_configure()``, the user +specifies ``nb_event_ports`` and ``nb_single_link_event_port_queues``, which +control the total number of ports (load-balanced and directed) and the number +of directed ports. Hence, the number of requested load-balanced ports is +``nb_event_ports - nb_single_link_event_ports``. The ``nb_event_queues`` field +specifies the total number of queues (load-balanced and directed). The number +of directed queues comes from ``nb_single_link_event_port_queues``, since +directed ports and queues come in pairs. + +When a port is setup, the ``RTE_EVENT_PORT_CFG_SINGLE_LINK`` flag determines +whether it should be configured as a directed (the flag is set) or a +load-balanced (the flag is unset) port. Similarly, the +``RTE_EVENT_QUEUE_CFG_SINGLE_LINK`` queue configuration flag controls +whether it is a directed or load-balanced queue. + +Load-balanced ports can only be linked to load-balanced queues, and directed +ports can only be linked to directed queues. Furthermore, directed ports can +only be linked to a single directed queue (and vice versa), and that link +cannot change after the eventdev is started. + +The eventdev API does not have a directed scheduling type. To support directed +traffic, the dlb PMD detects when an event is being sent to a directed queue +and overrides its scheduling type. Note that the originally selected scheduling +type (atomic, ordered, or parallel) is not preserved, and an event's sched_type +will be set to ``RTE_SCHED_TYPE_ATOMIC`` when it is dequeued from a directed +port. + Flow ID ~~~~~~~ The flow ID field is preserved in the event when it is scheduled in the DLB2. +Reconfiguration +~~~~~~~~~~~~~~~ + +The Eventdev API allows one to reconfigure a device, its ports, and its queues +by first stopping the device, calling the configuration function(s), then +restarting the device. The DLB2 does not support configuring an individual queue +or port without first reconfiguring the entire device, however, so there are +certain reconfiguration sequences that are valid in the eventdev API but not +supported by the PMD. + +Specifically, the PMD supports the following configuration sequence: +1. Configure and start the device +2. Stop the device +3. (Optional) Reconfigure the device +4. (Optional) If step 3 is run: + + a. Setup queue(s). The reconfigured queue(s) lose their previous port links. + b. The reconfigured port(s) lose their previous queue links. + +5. (Optional, only if steps 4a and 4b are run) Link port(s) to queue(s) +6. Restart the device. If the device is reconfigured in step 3 but one or more + of its ports or queues are not, the PMD will apply their previous + configuration (including port->queue links) at this time. + +The PMD does not support the following configuration sequences: +1. Configure and start the device +2. Stop the device +3. Setup queue or setup port +4. Start the device + +This sequence is not supported because the event device must be reconfigured +before its ports or queues can be. + +Atomic Inflights Allocation +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In the last stage prior to scheduling an atomic event to a CQ, DLB2 holds the +inflight event in a temporary buffer that is divided among load-balanced +queues. If a queue's atomic buffer storage fills up, this can result in +head-of-line-blocking. For example: + +- An LDB queue allocated N atomic buffer entries +- All N entries are filled with events from flow X, which is pinned to CQ 0. + +Until CQ 0 releases 1+ events, no other atomic flows for that LDB queue can be +scheduled. The likelihood of this case depends on the eventdev configuration, +traffic behavior, event processing latency, potential for a worker to be +interrupted or otherwise delayed, etc. + +By default, the PMD allocates 16 buffer entries for each load-balanced queue, +which provides an even division across all 128 queues but potentially wastes +buffer space (e.g. if not all queues are used, or aren't used for atomic +scheduling). + +The PMD provides a dev arg to override the default per-queue allocation. To +increase a vdev's per-queue atomic-inflight allocation to (for example) 64: + + .. code-block:: console + + --vdev=dlb1_event,atm_inflights=64 +
drivers/event/dlb2/dlb2.c +313 -0
329 lines not on this page · raw message
drivers/event/dlb2/dlb2_iface.c +5 -0
@@ -26,3 +26,8 @@ int (*dlb2_iface_get_cq_poll_mode)(struct dlb2_hw_dev *handle,int (*dlb2_iface_get_num_resources)(struct dlb2_hw_dev *handle,struct dlb2_get_num_resources_args *rsrcs); + +int (*dlb2_iface_sched_domain_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_sched_domain_args *args); + +void (*dlb2_iface_domain_reset)(struct dlb2_eventdev *dlb2);
drivers/event/dlb2/dlb2_iface.h +4 -0
@@ -26,4 +26,8 @@ extern int (*dlb2_iface_get_cq_poll_mode)(struct dlb2_hw_dev *handle,extern int (*dlb2_iface_get_num_resources)(struct dlb2_hw_dev *handle,struct dlb2_get_num_resources_args *rsrcs); +extern int (*dlb2_iface_sched_domain_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_sched_domain_args *args); + +extern void (*dlb2_iface_domain_reset)(struct dlb2_eventdev *dlb2);#endif /* _DLB2_IFACE_H_ */
drivers/event/dlb2/pf/base/dlb2_resource.c +3237 -0
2,530 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_pf.c +44 -0
44 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.6.4
Part of the diff is not shown here. View the raw message.
PATCH v9 11/23 event/dlb2: add queue and port default conf
In reply to Timothy McDanielAdd support for getting the queue and port default configuration.
--- drivers/event/dlb2/dlb2.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
drivers/event/dlb2/dlb2.c +30 -0
@@ -661,12 +661,42 @@ dlb2_eventdev_configure(const struct rte_eventdev *dev) }static void +dlb2_eventdev_port_default_conf_get (struct rte_eventdev *dev, +uint8_t port_id, +struct rte_event_port_conf *port_conf) +{ +RTE_SET_USED (port_id); +struct dlb2_eventdev *dlb2 =dlb2_pmd_priv (dev); + + port_conf->new_event_threshold = dlb2->new_event_limit; + port_conf->dequeue_depth =32 ; + port_conf->enqueue_depth =DLB2_MAX_ENQUEUE_DEPTH ; + port_conf->event_port_cfg =0 ; +} + +static void +dlb2_eventdev_queue_default_conf_get (struct rte_eventdev *dev, +uint8_t queue_id, +struct rte_event_queue_conf *queue_conf) +{ +RTE_SET_USED (dev); +RTE_SET_USED (queue_id); + + queue_conf->nb_atomic_flows =1024 ; + queue_conf->nb_atomic_order_sequences =64 ; + queue_conf->event_queue_cfg =0 ; + queue_conf->priority =0 ; +} + +static void dlb2_entry_points_init (struct rte_eventdev *dev) {/* Expose PMD's eventdev interface */ static struct rte_eventdev_ops dlb2_eventdev_entry_ops = { .dev_infos_get = dlb2_eventdev_info_get, .dev_configure = dlb2_eventdev_configure, + .queue_def_conf = dlb2_eventdev_queue_default_conf_get, + .port_def_conf = dlb2_eventdev_port_default_conf_get, .dump = dlb2_eventdev_dump, .xstats_get = dlb2_eventdev_xstats_get, .xstats_get_names = dlb2_eventdev_xstats_get_names,
Signature · 1 line
2.6.4
PATCH v9 12/23 event/dlb2: add queue setup
In reply to Timothy McDanielLoad balanced (ldb) queues are setup here. Directed queues are not set up until link time, at which point we know the directed port ID. Directed queue setup will only fail if this queue is already setup or there are no directed queues left to configure.
--- doc/guides/eventdevs/dlb2.rst | 73 +++-- drivers/event/dlb2/dlb2.c | 312 +++++++++++++++++++ drivers/event/dlb2/dlb2_iface.c | 12 + drivers/event/dlb2/dlb2_iface.h | 12 + drivers/event/dlb2/pf/base/dlb2_resource.c | 464 +++++++++++++++++++++++++++++ drivers/event/dlb2/pf/dlb2_main.c | 10 + drivers/event/dlb2/pf/dlb2_pf.c | 82 +++++ 7 files changed, 926 insertions(+), 39 deletions(-)
doc/guides/eventdevs/dlb2.rst +34 -39
@@ -47,45 +47,40 @@ setup argument and the per-port ``new_event_threshold`` argument apply as defined in the eventdev header file. The limit is applied to all enqueues, regardless of whether it will consume a directed or load-balanced credit. -Load-balanced and Directed Ports -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -DLB2 ports come in two flavors: load-balanced and directed. The eventdev API -does not have the same concept, but it has a similar one: ports and queues that -are singly-linked (i.e. linked to a single queue or port, respectively). - -The ``rte_event_dev_info_get()`` function reports the number of available -event ports and queues (among other things). For the DLB2 PMD, max_event_ports -and max_event_queues report the number of available load-balanced ports and -queues, and max_single_link_event_port_queue_pairs reports the number of -available directed ports and queues. - -When a scheduling domain is created in ``rte_event_dev_configure()``, the user -specifies ``nb_event_ports`` and ``nb_single_link_event_port_queues``, which -control the total number of ports (load-balanced and directed) and the number -of directed ports. Hence, the number of requested load-balanced ports is -``nb_event_ports - nb_single_link_event_ports``. The ``nb_event_queues`` field -specifies the total number of queues (load-balanced and directed). The number -of directed queues comes from ``nb_single_link_event_port_queues``, since -directed ports and queues come in pairs. - -When a port is setup, the ``RTE_EVENT_PORT_CFG_SINGLE_LINK`` flag determines -whether it should be configured as a directed (the flag is set) or a -load-balanced (the flag is unset) port. Similarly, the -``RTE_EVENT_QUEUE_CFG_SINGLE_LINK`` queue configuration flag controls -whether it is a directed or load-balanced queue. - -Load-balanced ports can only be linked to load-balanced queues, and directed -ports can only be linked to directed queues. Furthermore, directed ports can -only be linked to a single directed queue (and vice versa), and that link -cannot change after the eventdev is started. - -The eventdev API does not have a directed scheduling type. To support directed -traffic, the dlb PMD detects when an event is being sent to a directed queue -and overrides its scheduling type. Note that the originally selected scheduling -type (atomic, ordered, or parallel) is not preserved, and an event's sched_type -will be set to ``RTE_SCHED_TYPE_ATOMIC`` when it is dequeued from a directed -port. +Load-Balanced Queues +~~~~~~~~~~~~~~~~~~~~ + +A load-balanced queue can support atomic and ordered scheduling, or atomic and +unordered scheduling, but not atomic and unordered and ordered scheduling. A +queue's scheduling types are controlled by the event queue configuration. + +If the user sets the ``RTE_EVENT_QUEUE_CFG_ALL_TYPES`` flag, the +``nb_atomic_order_sequences`` determines the supported scheduling types. +With non-zero ``nb_atomic_order_sequences``, the queue is configured for atomic +and ordered scheduling. In this case, ``RTE_SCHED_TYPE_PARALLEL`` scheduling is +supported by scheduling those events as ordered events. Note that when the +event is dequeued, its sched_type will be ``RTE_SCHED_TYPE_ORDERED``. Else if +``nb_atomic_order_sequences`` is zero, the queue is configured for atomic and +unordered scheduling. In this case, ``RTE_SCHED_TYPE_ORDERED`` is unsupported. + +If the ``RTE_EVENT_QUEUE_CFG_ALL_TYPES`` flag is not set, schedule_type +dictates the queue's scheduling type. + +The ``nb_atomic_order_sequences`` queue configuration field sets the ordered +queue's reorder buffer size. DLB2 has 4 groups of ordered queues, where each +group is configured to contain either 1 queue with 1024 reorder entries, 2 +queues with 512 reorder entries, and so on down to 32 queues with 32 entries. + +When a load-balanced queue is created, the PMD will configure a new sequence +number group on-demand if num_sequence_numbers does not match a pre-existing +group with available reorder buffer entries. If all sequence number groups are +in use, no new group will be created and queue configuration will fail. (Note +that when the PMD is used with a virtual DLB2 device, it cannot change the +sequence number configuration.) + +The queue's ``nb_atomic_flows`` parameter is ignored by the DLB2 PMD, because +the DLB2 does not limit the number of flows a queue can track. In the DLB2, all +load-balanced queues can use the full 16-bit flow ID range. Flow ID ~~~~~~~
drivers/event/dlb2/dlb2.c +312 -0
324 lines not on this page · raw message
drivers/event/dlb2/dlb2_iface.c +12 -0
@@ -31,3 +31,15 @@ int (*dlb2_iface_sched_domain_create)(struct dlb2_hw_dev *handle, struct dlb2_create_sched_domain_args *args);void (*dlb2_iface_domain_reset)(struct dlb2_eventdev *dlb2); + +int (*dlb2_iface_ldb_queue_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_ldb_queue_args *cfg); + +int (*dlb2_iface_get_sn_allocation)(struct dlb2_hw_dev *handle, +struct dlb2_get_sn_allocation_args *args); + +int (*dlb2_iface_set_sn_allocation)(struct dlb2_hw_dev *handle, +struct dlb2_set_sn_allocation_args *args); + +int (*dlb2_iface_get_sn_occupancy)(struct dlb2_hw_dev *handle, +struct dlb2_get_sn_occupancy_args *args);
drivers/event/dlb2/dlb2_iface.h +12 -0
@@ -30,4 +30,16 @@ extern int (*dlb2_iface_sched_domain_create)(struct dlb2_hw_dev *handle, struct dlb2_create_sched_domain_args *args);extern void (*dlb2_iface_domain_reset)(struct dlb2_eventdev *dlb2); + +extern int (*dlb2_iface_ldb_queue_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_ldb_queue_args *cfg); + +extern int (*dlb2_iface_get_sn_allocation)(struct dlb2_hw_dev *handle, +struct dlb2_get_sn_allocation_args *args); + +extern int (*dlb2_iface_set_sn_allocation)(struct dlb2_hw_dev *handle, +struct dlb2_set_sn_allocation_args *args); + +extern int (*dlb2_iface_get_sn_occupancy)(struct dlb2_hw_dev *handle, +struct dlb2_get_sn_occupancy_args *args);#endif /* _DLB2_IFACE_H_ */
drivers/event/dlb2/pf/base/dlb2_resource.c +464 -0
467 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_main.c +10 -0
@@ -613,3 +613,13 @@ dlb2_pf_reset_domain(struct dlb2_hw *hw, u32 id) {return dlb2_reset_domain (hw, id,NOT_VF_REQ ,PF_ID_ZERO ); } + +int +dlb2_pf_create_ldb_queue (struct dlb2_hw *hw, +u32 id, +struct dlb2_create_ldb_queue_args *args, +struct dlb2_cmd_response *resp) +{ +return dlb2_hw_create_ldb_queue (hw, id, args, resp,NOT_VF_REQ , +PF_ID_ZERO ); +}
drivers/event/dlb2/pf/dlb2_pf.c +82 -0
94 lines not on this page · raw message
Signature · 1 line
2.6.4
PATCH v9 13/23 event/dlb2: add port setup
In reply to Timothy McDanielConfigure the load balanced (ldb) or directed (dir) port. The consumer queue (CQ) and producer port (PP) are also set up here.
--- doc/guides/eventdevs/dlb2.rst | 75 +++ drivers/event/dlb2/dlb2.c | 498 ++++++++++++++++ drivers/event/dlb2/dlb2_iface.c | 8 + drivers/event/dlb2/dlb2_iface.h | 8 + drivers/event/dlb2/pf/base/dlb2_resource.c | 922 +++++++++++++++++++++++++++++ drivers/event/dlb2/pf/dlb2_main.c | 28 + drivers/event/dlb2/pf/dlb2_pf.c | 180 ++++++ 7 files changed, 1719 insertions(+)
doc/guides/eventdevs/dlb2.rst +75 -0
@@ -82,6 +82,81 @@ The queue's ``nb_atomic_flows`` parameter is ignored by the DLB2 PMD, because the DLB2 does not limit the number of flows a queue can track. In the DLB2, all load-balanced queues can use the full 16-bit flow ID range. +Load-Balanced Queues +~~~~~~~~~~~~~~~~~~~~ + +A load-balanced queue can support atomic and ordered scheduling, or atomic and +unordered scheduling, but not atomic and unordered and ordered scheduling. A +queue's scheduling types are controlled by the event queue configuration. + +If the user sets the ``RTE_EVENT_QUEUE_CFG_ALL_TYPES`` flag, the +``nb_atomic_order_sequences`` determines the supported scheduling types. +With non-zero ``nb_atomic_order_sequences``, the queue is configured for atomic +and ordered scheduling. In this case, ``RTE_SCHED_TYPE_PARALLEL`` scheduling is +supported by scheduling those events as ordered events. Note that when the +event is dequeued, its sched_type will be ``RTE_SCHED_TYPE_ORDERED``. Else if +``nb_atomic_order_sequences`` is zero, the queue is configured for atomic and +unordered scheduling. In this case, ``RTE_SCHED_TYPE_ORDERED`` is unsupported. + +If the ``RTE_EVENT_QUEUE_CFG_ALL_TYPES`` flag is not set, schedule_type +dictates the queue's scheduling type. + +The ``nb_atomic_order_sequences`` queue configuration field sets the ordered +queue's reorder buffer size. DLB2 has 4 groups of ordered queues, where each +group is configured to contain either 1 queue with 1024 reorder entries, 2 +queues with 512 reorder entries, and so on down to 32 queues with 32 entries. + +When a load-balanced queue is created, the PMD will configure a new sequence +number group on-demand if num_sequence_numbers does not match a pre-existing +group with available reorder buffer entries. If all sequence number groups are +in use, no new group will be created and queue configuration will fail. (Note +that when the PMD is used with a virtual DLB2 device, it cannot change the +sequence number configuration.) + +The queue's ``nb_atomic_flows`` parameter is ignored by the DLB2 PMD, because +the DLB2 does not limit the number of flows a queue can track. In the DLB2, all +load-balanced queues can use the full 16-bit flow ID range. + +Load-balanced and Directed Ports +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +DLB2 ports come in two flavors: load-balanced and directed. The eventdev API +does not have the same concept, but it has a similar one: ports and queues that +are singly-linked (i.e. linked to a single queue or port, respectively). + +The ``rte_event_dev_info_get()`` function reports the number of available +event ports and queues (among other things). For the DLB2 PMD, max_event_ports +and max_event_queues report the number of available load-balanced ports and +queues, and max_single_link_event_port_queue_pairs reports the number of +available directed ports and queues. + +When a scheduling domain is created in ``rte_event_dev_configure()``, the user +specifies ``nb_event_ports`` and ``nb_single_link_event_port_queues``, which +control the total number of ports (load-balanced and directed) and the number +of directed ports. Hence, the number of requested load-balanced ports is +``nb_event_ports - nb_single_link_event_ports``. The ``nb_event_queues`` field +specifies the total number of queues (load-balanced and directed). The number +of directed queues comes from ``nb_single_link_event_port_queues``, since +directed ports and queues come in pairs. + +When a port is setup, the ``RTE_EVENT_PORT_CFG_SINGLE_LINK`` flag determines +whether it should be configured as a directed (the flag is set) or a +load-balanced (the flag is unset) port. Similarly, the +``RTE_EVENT_QUEUE_CFG_SINGLE_LINK`` queue configuration flag controls +whether it is a directed or load-balanced queue. + +Load-balanced ports can only be linked to load-balanced queues, and directed +ports can only be linked to directed queues. Furthermore, directed ports can +only be linked to a single directed queue (and vice versa), and that link +cannot change after the eventdev is started. + +The eventdev API does not have a directed scheduling type. To support directed +traffic, the dlb PMD detects when an event is being sent to a directed queue +and overrides its scheduling type. Note that the originally selected scheduling +type (atomic, ordered, or parallel) is not preserved, and an event's sched_type +will be set to ``RTE_SCHED_TYPE_ATOMIC`` when it is dequeued from a directed +port. + Flow ID ~~~~~~~
drivers/event/dlb2/dlb2.c +498 -0
510 lines not on this page · raw message
drivers/event/dlb2/dlb2_iface.c +8 -0
@@ -43,3 +43,11 @@ int (*dlb2_iface_set_sn_allocation)(struct dlb2_hw_dev *handle,int (*dlb2_iface_get_sn_occupancy)(struct dlb2_hw_dev *handle,struct dlb2_get_sn_occupancy_args *args); + +int (*dlb2_iface_ldb_port_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_ldb_port_args *cfg, +enum dlb2_cq_poll_modes poll_mode); + +int (*dlb2_iface_dir_port_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_dir_port_args *cfg, +enum dlb2_cq_poll_modes poll_mode);
drivers/event/dlb2/dlb2_iface.h +8 -0
@@ -42,4 +42,12 @@ extern int (*dlb2_iface_set_sn_allocation)(struct dlb2_hw_dev *handle,extern int (*dlb2_iface_get_sn_occupancy)(struct dlb2_hw_dev *handle,struct dlb2_get_sn_occupancy_args *args); + +extern int (*dlb2_iface_ldb_port_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_ldb_port_args *cfg, +enum dlb2_cq_poll_modes poll_mode); + +extern int (*dlb2_iface_dir_port_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_dir_port_args *cfg, +enum dlb2_cq_poll_modes poll_mode);#endif /* _DLB2_IFACE_H_ */
drivers/event/dlb2/pf/base/dlb2_resource.c +922 -0
925 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_main.c +28 -0
@@ -623,3 +623,31 @@ dlb2_pf_create_ldb_queue(struct dlb2_hw *hw,return dlb2_hw_create_ldb_queue (hw, id, args, resp,NOT_VF_REQ ,PF_ID_ZERO ); } + +int +dlb2_pf_create_ldb_port (struct dlb2_hw *hw, +u32 id, +struct dlb2_create_ldb_port_args *args, +uintptr_t cq_dma_base, +struct dlb2_cmd_response *resp) +{ +return dlb2_hw_create_ldb_port (hw, id, args, + cq_dma_base, + resp, +NOT_VF_REQ , +PF_ID_ZERO ); +} + +int +dlb2_pf_create_dir_port (struct dlb2_hw *hw, +u32 id, +struct dlb2_create_dir_port_args *args, +uintptr_t cq_dma_base, +struct dlb2_cmd_response *resp) +{ +return dlb2_hw_create_dir_port (hw, id, args, + cq_dma_base, + resp, +NOT_VF_REQ , +PF_ID_ZERO ); +}
drivers/event/dlb2/pf/dlb2_pf.c +180 -0
192 lines not on this page · raw message
Signature · 1 line
2.6.4
PATCH v9 14/23 event/dlb2: add port link
In reply to Timothy McDanielAdd port link entry point. Directed queues are identified and created at this stage. Their setup deferred until link-time, at which point we know the directed port ID. Directed queue setup will only fail if this queue is already setup or there are no directed queues left to configure.
--- drivers/event/dlb2/dlb2.c | 302 ++++++++++++++ drivers/event/dlb2/dlb2_iface.c | 6 + drivers/event/dlb2/dlb2_iface.h | 6 + drivers/event/dlb2/pf/base/dlb2_resource.c | 633 +++++++++++++++++++++++++++++ drivers/event/dlb2/pf/dlb2_main.c | 10 + drivers/event/dlb2/pf/dlb2_pf.c | 50 +++ 6 files changed, 1007 insertions(+)
drivers/event/dlb2/dlb2.c +302 -0
@@ -1496,6 +1496,307 @@ dlb2_eventdev_port_setup(struct rte_eventdev *dev,return 0 ; } +static int16_t +dlb2_hw_map_ldb_qid_to_port (struct dlb2_hw_dev *handle, +uint32_t qm_port_id, +uint16_t qm_qid, +uint8_t priority) +{ +struct dlb2_map_qid_args cfg; +int32_t ret; + +if (handle ==NULL ) +return -EINVAL ; + +/* Build message */ + cfg.port_id = qm_port_id; + cfg.qid = qm_qid; + cfg.priority =EV_TO_DLB2_PRIO (priority); + + ret =dlb2_iface_map_qid (handle, &cfg); +if (ret <0 ) { +DLB2_LOG_ERR ("dlb2: map qid error, ret=%d (driver status: %s)\n" , + ret, dlb2_error_strings[cfg.response.status]); +DLB2_LOG_ERR ("dlb2: grp=%d, qm_port=%d, qm_qid=%d prio=%d\n" , + handle->domain_id, cfg.port_id, + cfg.qid, + cfg.priority); + }else { +DLB2_LOG_DBG ("dlb2: mapped queue %d to qm_port %d\n" , + qm_qid, qm_port_id); + } + +return ret; +} + +static int +dlb2_event_queue_join_ldb (struct dlb2_eventdev *dlb2, +struct dlb2_eventdev_port *ev_port, +struct dlb2_eventdev_queue *ev_queue, +uint8_t priority) +{ +int first_avail =-1 ; +int ret, i; + +for (i =0 ; i <DLB2_MAX_NUM_QIDS_PER_LDB_CQ ; i++) { +if (ev_port->link[i].valid) { +if (ev_port->link[i].queue_id == ev_queue->id && + ev_port->link[i].priority == priority) { +if (ev_port->link[i].mapped) +return 0 ;/* already mapped */ + first_avail = i; + } + }else if (first_avail ==-1 ) + first_avail = i; + } +if (first_avail ==-1 ) { +DLB2_LOG_ERR ("dlb2: qm_port %d has no available QID slots.\n" , + ev_port->qm_port.id); +return -EINVAL ; + } + + ret =dlb2_hw_map_ldb_qid_to_port (&dlb2->qm_instance, + ev_port->qm_port.id, + ev_queue->qm_queue.id, + priority); + +if (!ret) + ev_port->link[first_avail].mapped = true; + +return ret; +} + +static int32_t +dlb2_hw_create_dir_queue (struct dlb2_eventdev *dlb2, +struct dlb2_eventdev_queue *ev_queue, +int32_t qm_port_id) +{ +struct dlb2_hw_dev *handle = &dlb2->qm_instance; +struct dlb2_create_dir_queue_args cfg; +int32_t ret; + +/* The directed port is always configured before its queue */ + cfg.port_id = qm_port_id; + +if (ev_queue->depth_threshold ==0 ) { + cfg.depth_threshold =RTE_PMD_DLB2_DEFAULT_DEPTH_THRESH ; + ev_queue->depth_threshold =RTE_PMD_DLB2_DEFAULT_DEPTH_THRESH ; + }else + cfg.depth_threshold = ev_queue->depth_threshold; + + ret =dlb2_iface_dir_queue_create (handle, &cfg); +if (ret <0 ) { +DLB2_LOG_ERR ("dlb2: create DIR event queue error, ret=%d (driver status: %s)\n" , + ret, dlb2_error_strings[cfg.response.status]); +return -EINVAL ; + } + +return cfg.response.id; +} + +static int +dlb2_eventdev_dir_queue_setup (struct dlb2_eventdev *dlb2, +struct dlb2_eventdev_queue *ev_queue, +struct dlb2_eventdev_port *ev_port) +{ +int32_t qm_qid; + + qm_qid =dlb2_hw_create_dir_queue (dlb2, ev_queue, ev_port->qm_port.id); + +if (qm_qid <0 ) { +DLB2_LOG_ERR ("Failed to create the DIR queue\n" ); +return qm_qid; + } + + dlb2->qm_dir_to_ev_queue_id[qm_qid] = ev_queue->id; + + ev_queue->qm_queue.id = qm_qid; + +return 0 ; +} + +static int +dlb2_do_port_link (struct rte_eventdev *dev, +struct dlb2_eventdev_queue *ev_queue, +struct dlb2_eventdev_port *ev_port, +uint8_t prio) +{ +struct dlb2_eventdev *dlb2 =dlb2_pmd_priv (dev); +int err; + +/* Don't link until start time. */ +if (dlb2->run_state ==DLB2_RUN_STATE_STOPPED ) +return 0 ; + +if (ev_queue->qm_queue.is_directed) + err =dlb2_eventdev_dir_queue_setup (dlb2, ev_queue, ev_port); +else + err =dlb2_event_queue_join_ldb (dlb2, ev_port, ev_queue, prio); + +if (err) { +DLB2_LOG_ERR ("port link failure for %s ev_q %d, ev_port %d\n" , + ev_queue->qm_queue.is_directed ?"DIR" :"LDB" , + ev_queue->id, ev_port->id); + + rte_errno = err; +return -1 ; + } + +return 0 ; +} + +static int +dlb2_validate_port_link (struct dlb2_eventdev_port *ev_port, +uint8_t queue_id, +bool link_exists, +int index) +{ +struct dlb2_eventdev *dlb2 = ev_port->dlb2; +struct dlb2_eventdev_queue *ev_queue; +bool port_is_dir, queue_is_dir; + +if (queue_id > dlb2->num_queues) { + rte_errno = -EINVAL ; +return -1 ; + } + + ev_queue = &dlb2->ev_queues[queue_id]; + +if (!ev_queue->setup_done && + ev_queue->qm_queue.config_state !=DLB2_PREV_CONFIGURED ) { + rte_errno = -EINVAL ; +return -1 ; + } + + port_is_dir = ev_port->qm_port.is_directed; + queue_is_dir = ev_queue->qm_queue.is_directed; + +if (port_is_dir != queue_is_dir) { +DLB2_LOG_ERR ("%s queue %u can't link to %s port %u\n" , + queue_is_dir ?"DIR" :"LDB" , ev_queue->id, + port_is_dir ?"DIR" :"LDB" , ev_port->id); + + rte_errno = -EINVAL ; +return -1 ; + } + +/* Check if there is space for the requested link */ +if (!link_exists && index ==-1 ) { +DLB2_LOG_ERR ("no space for new link\n" ); + rte_errno = -ENOSPC ; +return -1 ; + } + +/* Check if the directed port is already linked */ +if (ev_port->qm_port.is_directed && ev_port->num_links >0 && + !link_exists) { +DLB2_LOG_ERR ("Can't link DIR port %d to >1 queues\n" , + ev_port->id); + rte_errno = -EINVAL ; +return -1 ; + } + +/* Check if the directed queue is already linked */ +if (ev_queue->qm_queue.is_directed && ev_queue->num_links >0 && + !link_exists) { +DLB2_LOG_ERR ("Can't link DIR queue %d to >1 ports\n" , + ev_queue->id); + rte_errno = -EINVAL ; +return -1 ; + } + +return 0 ; +} + +static int +dlb2_eventdev_port_link (struct rte_eventdev *dev,void *event_port, +const uint8_t queues[],const uint8_t priorities[], +uint16_t nb_links) + +{ +struct dlb2_eventdev_port *ev_port = event_port; +struct dlb2_eventdev *dlb2; +int i, j; + +RTE_SET_USED (dev); + +if (ev_port ==NULL ) { +DLB2_LOG_ERR ("dlb2: evport not setup\n" ); + rte_errno = -EINVAL ; +return 0 ; + } + +if (!ev_port->setup_done && + ev_port->qm_port.config_state !=DLB2_PREV_CONFIGURED ) { +DLB2_LOG_ERR ("dlb2: evport not setup\n" ); + rte_errno = -EINVAL ; +return 0 ; + } + +/* Note: rte_event_port_link() ensures the PMD won't receive a NULL +* queues pointer. +*/ +if (nb_links ==0 ) { +DLB2_LOG_DBG ("dlb2: nb_links is 0\n" ); +return 0 ;/* Ignore and return success */ + } + + dlb2 = ev_port->dlb2; + +DLB2_LOG_DBG ("Linking %u queues to %s port %d\n" , + nb_links, + ev_port->qm_port.is_directed ?"DIR" :"LDB" , + ev_port->id); + +for (i =0 ; i < nb_links; i++) { +struct dlb2_eventdev_queue *ev_queue; +uint8_t queue_id, prio; +bool found = false; +int index =-1 ; + + queue_id = queues[i]; + prio = priorities[i]; + +/* Check if the link already exists. */ +for (j =0 ; j <DLB2_MAX_NUM_QIDS_PER_LDB_CQ ; j++) +if (ev_port->link[j].valid) { +if (ev_port->link[j].queue_id == queue_id) { + found = true; + index = j; +break ; + } + }else if (index ==-1 ) { + index = j; + } + +/* could not link */ +if (index ==-1 ) +break ; + +/* Check if already linked at the requested priority */ +if (found && ev_port->link[j].priority == prio) +continue ; + +if (dlb2_validate_port_link (ev_port, queue_id, found, index)) +break ;/* return index of offending queue */ + + ev_queue = &dlb2->ev_queues[queue_id]; + +if (dlb2_do_port_link (dev, ev_queue, ev_port, prio)) +break ;/* return index of offending queue */ + + ev_queue->num_links++; + + ev_port->link[index].queue_id = queue_id; + ev_port->link[index].priority = prio; + ev_port->link[index].valid = true; +/* Entry already exists? If so, then must be prio change */ +if (!found) + ev_port->num_links++; + } +return i; +} +static void dlb2_entry_points_init (struct rte_eventdev *dev) {
@@ -1507,6 +1808,7 @@ dlb2_entry_points_init(struct rte_eventdev *dev) .queue_setup = dlb2_eventdev_queue_setup, .port_def_conf = dlb2_eventdev_port_default_conf_get, .port_setup = dlb2_eventdev_port_setup, + .port_link = dlb2_eventdev_port_link, .dump = dlb2_eventdev_dump, .xstats_get = dlb2_eventdev_xstats_get, .xstats_get_names = dlb2_eventdev_xstats_get_names,
drivers/event/dlb2/dlb2_iface.c +6 -0
@@ -51,3 +51,9 @@ int (*dlb2_iface_ldb_port_create)(struct dlb2_hw_dev *handle,int (*dlb2_iface_dir_port_create)(struct dlb2_hw_dev *handle,struct dlb2_create_dir_port_args *cfg,enum dlb2_cq_poll_modes poll_mode); + +int (*dlb2_iface_dir_queue_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_dir_queue_args *cfg); + +int (*dlb2_iface_map_qid)(struct dlb2_hw_dev *handle, +struct dlb2_map_qid_args *cfg);
drivers/event/dlb2/dlb2_iface.h +6 -0
@@ -50,4 +50,10 @@ extern int (*dlb2_iface_ldb_port_create)(struct dlb2_hw_dev *handle,extern int (*dlb2_iface_dir_port_create)(struct dlb2_hw_dev *handle,struct dlb2_create_dir_port_args *cfg,enum dlb2_cq_poll_modes poll_mode); + +extern int (*dlb2_iface_dir_queue_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_dir_queue_args *cfg); + +extern int (*dlb2_iface_map_qid)(struct dlb2_hw_dev *handle, +struct dlb2_map_qid_args *cfg);#endif /* _DLB2_IFACE_H_ */
drivers/event/dlb2/pf/base/dlb2_resource.c +633 -0
636 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_main.c +10 -0
@@ -651,3 +651,13 @@ dlb2_pf_create_dir_port(struct dlb2_hw *hw,NOT_VF_REQ , PF_ID_ZERO); } + +int +dlb2_pf_create_dir_queue (struct dlb2_hw *hw, +u32 id, +struct dlb2_create_dir_queue_args *args, +struct dlb2_cmd_response *resp) +{ +return dlb2_hw_create_dir_queue (hw, id, args, resp,NOT_VF_REQ , +PF_ID_ZERO ); +}
drivers/event/dlb2/pf/dlb2_pf.c +50 -0
63 lines not on this page · raw message
Signature · 1 line
2.6.4
PATCH v9 15/23 event/dlb2: add port unlink and port unlinks in progress
In reply to Timothy McDanielAdd supports for the port unlink(s) eventdev entry points. The unlink operation is an asynchronous operation executed by a control thread, and the unlinks-in-progress function reads a counter shared with the control thread.
--- drivers/event/dlb2/dlb2.c | 163 +++++++++++++++++ drivers/event/dlb2/dlb2_iface.c | 6 + drivers/event/dlb2/dlb2_iface.h | 6 + drivers/event/dlb2/pf/base/dlb2_resource.c | 283 +++++++++++++++++++++++++++++ drivers/event/dlb2/pf/dlb2_pf.c | 51 ++++++ 5 files changed, 509 insertions(+)
drivers/event/dlb2/dlb2.c +163 -0
@@ -1797,6 +1797,166 @@ dlb2_eventdev_port_link(struct rte_eventdev *dev, void *event_port,return i; } +static int16_t +dlb2_hw_unmap_ldb_qid_from_port (struct dlb2_hw_dev *handle, +uint32_t qm_port_id, +uint16_t qm_qid) +{ +struct dlb2_unmap_qid_args cfg; +int32_t ret; + +if (handle ==NULL ) +return -EINVAL ; + + cfg.port_id = qm_port_id; + cfg.qid = qm_qid; + + ret =dlb2_iface_unmap_qid (handle, &cfg); +if (ret <0 ) +DLB2_LOG_ERR ("dlb2: unmap qid error, ret=%d (driver status: %s)\n" , + ret, dlb2_error_strings[cfg.response.status]); + +return ret; +} + +static int +dlb2_event_queue_detach_ldb (struct dlb2_eventdev *dlb2, +struct dlb2_eventdev_port *ev_port, +struct dlb2_eventdev_queue *ev_queue) +{ +int ret, i; + +/* Don't unlink until start time. */ +if (dlb2->run_state ==DLB2_RUN_STATE_STOPPED ) +return 0 ; + +for (i =0 ; i <DLB2_MAX_NUM_QIDS_PER_LDB_CQ ; i++) { +if (ev_port->link[i].valid && + ev_port->link[i].queue_id == ev_queue->id) +break ;/* found */ + } + +/* This is expected with eventdev API! +* It blindly attemmpts to unmap all queues. +*/ +if (i ==DLB2_MAX_NUM_QIDS_PER_LDB_CQ ) { +DLB2_LOG_DBG ("dlb2: ignoring LB QID %d not mapped for qm_port %d.\n" , + ev_queue->qm_queue.id, + ev_port->qm_port.id); +return 0 ; + } + + ret =dlb2_hw_unmap_ldb_qid_from_port (&dlb2->qm_instance, + ev_port->qm_port.id, + ev_queue->qm_queue.id); +if (!ret) + ev_port->link[i].mapped = false; + +return ret; +} + +static int +dlb2_eventdev_port_unlink (struct rte_eventdev *dev,void *event_port, +uint8_t queues[],uint16_t nb_unlinks) +{ +struct dlb2_eventdev_port *ev_port = event_port; +struct dlb2_eventdev *dlb2; +int i; + +RTE_SET_USED (dev); + +if (!ev_port->setup_done) { +DLB2_LOG_ERR ("dlb2: evport %d is not configured\n" , + ev_port->id); + rte_errno = -EINVAL ; +return 0 ; + } + +if (queues ==NULL || nb_unlinks ==0 ) { +DLB2_LOG_DBG ("dlb2: queues is NULL or nb_unlinks is 0\n" ); +return 0 ;/* Ignore and return success */ + } + +/* FIXME: How to handle unlink on a directed port? */ +if (ev_port->qm_port.is_directed) { +DLB2_LOG_DBG ("dlb2: ignore unlink from dir port %d\n" , + ev_port->id); + rte_errno =0 ; +return nb_unlinks;/* as if success */ + } + + dlb2 = ev_port->dlb2; + +for (i =0 ; i < nb_unlinks; i++) { +struct dlb2_eventdev_queue *ev_queue; +int ret, j; + +if (queues[i] >= dlb2->num_queues) { +DLB2_LOG_ERR ("dlb2: invalid queue id %d\n" , queues[i]); + rte_errno = -EINVAL ; +return i;/* return index of offending queue */ + } + + ev_queue = &dlb2->ev_queues[queues[i]]; + +/* Does a link exist? */ +for (j =0 ; j <DLB2_MAX_NUM_QIDS_PER_LDB_CQ ; j++) +if (ev_port->link[j].queue_id == queues[i] && + ev_port->link[j].valid) +break ; + +if (j ==DLB2_MAX_NUM_QIDS_PER_LDB_CQ ) +continue ; + + ret =dlb2_event_queue_detach_ldb (dlb2, ev_port, ev_queue); +if (ret) { +DLB2_LOG_ERR ("unlink err=%d for port %d queue %d\n" , + ret, ev_port->id, queues[i]); + rte_errno = -ENOENT ; +return i;/* return index of offending queue */ + } + + ev_port->link[j].valid = false; + ev_port->num_links--; + ev_queue->num_links--; + } + +return nb_unlinks; +} + +static int +dlb2_eventdev_port_unlinks_in_progress (struct rte_eventdev *dev, +void *event_port) +{ +struct dlb2_eventdev_port *ev_port = event_port; +struct dlb2_eventdev *dlb2; +struct dlb2_hw_dev *handle; +struct dlb2_pending_port_unmaps_args cfg; +int ret; + +RTE_SET_USED (dev); + +if (!ev_port->setup_done) { +DLB2_LOG_ERR ("dlb2: evport %d is not configured\n" , + ev_port->id); + rte_errno = -EINVAL ; +return 0 ; + } + + cfg.port_id = ev_port->qm_port.id; + dlb2 = ev_port->dlb2; + handle = &dlb2->qm_instance; + ret =dlb2_iface_pending_port_unmaps (handle, &cfg); + +if (ret <0 ) { +DLB2_LOG_ERR ("dlb2: num_unlinks_in_progress ret=%d (driver status: %s)\n" , + ret, dlb2_error_strings[cfg.response.status]); +return ret; + } + +return cfg.response.id; +} +static void dlb2_entry_points_init (struct rte_eventdev *dev) {
@@ -1809,6 +1969,9 @@ dlb2_entry_points_init(struct rte_eventdev *dev) .port_def_conf = dlb2_eventdev_port_default_conf_get, .port_setup = dlb2_eventdev_port_setup, .port_link = dlb2_eventdev_port_link, + .port_unlink = dlb2_eventdev_port_unlink, + .port_unlinks_in_progress = + dlb2_eventdev_port_unlinks_in_progress, .dump = dlb2_eventdev_dump, .xstats_get = dlb2_eventdev_xstats_get, .xstats_get_names = dlb2_eventdev_xstats_get_names,
drivers/event/dlb2/dlb2_iface.c +6 -0
@@ -57,3 +57,9 @@ int (*dlb2_iface_dir_queue_create)(struct dlb2_hw_dev *handle,int (*dlb2_iface_map_qid)(struct dlb2_hw_dev *handle,struct dlb2_map_qid_args *cfg); + +int (*dlb2_iface_unmap_qid)(struct dlb2_hw_dev *handle, +struct dlb2_unmap_qid_args *cfg); + +int (*dlb2_iface_pending_port_unmaps)(struct dlb2_hw_dev *handle, +struct dlb2_pending_port_unmaps_args *args);
drivers/event/dlb2/dlb2_iface.h +6 -0
@@ -56,4 +56,10 @@ extern int (*dlb2_iface_dir_queue_create)(struct dlb2_hw_dev *handle,extern int (*dlb2_iface_map_qid)(struct dlb2_hw_dev *handle,struct dlb2_map_qid_args *cfg); + +extern int (*dlb2_iface_unmap_qid)(struct dlb2_hw_dev *handle, +struct dlb2_unmap_qid_args *cfg); + +extern int (*dlb2_iface_pending_port_unmaps)(struct dlb2_hw_dev *handle, +struct dlb2_pending_port_unmaps_args *args);#endif /* _DLB2_IFACE_H_ */
drivers/event/dlb2/pf/base/dlb2_resource.c +283 -0
286 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_pf.c +51 -0
63 lines not on this page · raw message
Signature · 1 line
2.6.4
PATCH v9 16/23 event/dlb2: add eventdev start
In reply to Timothy McDanielAdd support for the eventdev start entry point.
We delay initializing some resources until
eventdev start, since the number of linked queues can be used to determine if we are dealing with a ldb or dir resource. If this is a device restart, then the previous configuration will be reapplied.
--- drivers/event/dlb2/dlb2.c | 133 +++++++++++++++++++++++++++++ drivers/event/dlb2/dlb2_iface.c | 3 + drivers/event/dlb2/dlb2_iface.h | 3 + drivers/event/dlb2/pf/base/dlb2_resource.c | 123 ++++++++++++++++++++++++++ drivers/event/dlb2/pf/dlb2_main.c | 10 +++ drivers/event/dlb2/pf/dlb2_pf.c | 25 ++++++ 6 files changed, 297 insertions(+)
drivers/event/dlb2/dlb2.c +133 -0
@@ -1957,6 +1957,138 @@ dlb2_eventdev_port_unlinks_in_progress(struct rte_eventdev *dev,return cfg.response.id; } +static int +dlb2_eventdev_reapply_configuration (struct rte_eventdev *dev) +{ +struct dlb2_eventdev *dlb2 =dlb2_pmd_priv (dev); +int ret, i; + +/* If an event queue or port was previously configured, but hasn't been +* reconfigured, reapply its original configuration. +*/ +for (i =0 ; i < dlb2->num_queues; i++) { +struct dlb2_eventdev_queue *ev_queue; + + ev_queue = &dlb2->ev_queues[i]; + +if (ev_queue->qm_queue.config_state !=DLB2_PREV_CONFIGURED ) +continue ; + + ret =dlb2_eventdev_queue_setup (dev, i, &ev_queue->conf); +if (ret <0 ) { +DLB2_LOG_ERR ("dlb2: failed to reconfigure queue %d" , i); +return ret; + } + } + +for (i =0 ; i < dlb2->num_ports; i++) { +struct dlb2_eventdev_port *ev_port = &dlb2->ev_ports[i]; + +if (ev_port->qm_port.config_state !=DLB2_PREV_CONFIGURED ) +continue ; + + ret =dlb2_eventdev_port_setup (dev, i, &ev_port->conf); +if (ret <0 ) { +DLB2_LOG_ERR ("dlb2: failed to reconfigure ev_port %d" , + i); +return ret; + } + } + +return 0 ; +} + +static int +dlb2_eventdev_apply_port_links (struct rte_eventdev *dev) +{ +struct dlb2_eventdev *dlb2 =dlb2_pmd_priv (dev); +int i; + +/* Perform requested port->queue links */ +for (i =0 ; i < dlb2->num_ports; i++) { +struct dlb2_eventdev_port *ev_port = &dlb2->ev_ports[i]; +int j; + +for (j =0 ; j <DLB2_MAX_NUM_QIDS_PER_LDB_CQ ; j++) { +struct dlb2_eventdev_queue *ev_queue; +uint8_t prio, queue_id; + +if (!ev_port->link[j].valid) +continue ; + + prio = ev_port->link[j].priority; + queue_id = ev_port->link[j].queue_id; + +if (dlb2_validate_port_link (ev_port, queue_id, true, j)) +return -EINVAL ; + + ev_queue = &dlb2->ev_queues[queue_id]; + +if (dlb2_do_port_link (dev, ev_queue, ev_port, prio)) +return -EINVAL ; + } + } + +return 0 ; +} + +static int +dlb2_eventdev_start (struct rte_eventdev *dev) +{ +struct dlb2_eventdev *dlb2 =dlb2_pmd_priv (dev); +struct dlb2_hw_dev *handle = &dlb2->qm_instance; +struct dlb2_start_domain_args cfg; +int ret, i; + +rte_spinlock_lock (&dlb2->qm_instance.resource_lock); +if (dlb2->run_state !=DLB2_RUN_STATE_STOPPED ) { +DLB2_LOG_ERR ("bad state %d for dev_start\n" , + (int )dlb2->run_state); +rte_spinlock_unlock (&dlb2->qm_instance.resource_lock); +return -EINVAL ; + } + dlb2->run_state =DLB2_RUN_STATE_STARTING ; +rte_spinlock_unlock (&dlb2->qm_instance.resource_lock); + +/* If the device was configured more than once, some event ports and/or +* queues may need to be reconfigured. +*/ + ret =dlb2_eventdev_reapply_configuration (dev); +if (ret) +return ret; + +/* The DLB PMD delays port links until the device is started. */ + ret =dlb2_eventdev_apply_port_links (dev); +if (ret) +return ret; + +for (i =0 ; i < dlb2->num_ports; i++) { +if (!dlb2->ev_ports[i].setup_done) { +DLB2_LOG_ERR ("dlb2: port %d not setup" , i); +return -ESTALE ; + } + } + +for (i =0 ; i < dlb2->num_queues; i++) { +if (dlb2->ev_queues[i].num_links ==0 ) { +DLB2_LOG_ERR ("dlb2: queue %d is not linked" , i); +return -ENOLINK ; + } + } + + ret =dlb2_iface_sched_domain_start (handle, &cfg); +if (ret <0 ) { +DLB2_LOG_ERR ("dlb2: sched_domain_start ret=%d (driver status: %s)\n" , + ret, dlb2_error_strings[cfg.response.status]); +return ret; + } + + dlb2->run_state =DLB2_RUN_STATE_STARTED ; +DLB2_LOG_DBG ("dlb2: sched_domain_start completed OK\n" ); + +return 0 ; +} +static void dlb2_entry_points_init (struct rte_eventdev *dev) {
@@ -1964,6 +2096,7 @@ dlb2_entry_points_init(struct rte_eventdev *dev)static struct rte_eventdev_ops dlb2_eventdev_entry_ops = { .dev_infos_get = dlb2_eventdev_info_get, .dev_configure = dlb2_eventdev_configure, + .dev_start = dlb2_eventdev_start, .queue_def_conf = dlb2_eventdev_queue_default_conf_get, .queue_setup = dlb2_eventdev_queue_setup, .port_def_conf = dlb2_eventdev_port_default_conf_get,
drivers/event/dlb2/dlb2_iface.c +3 -0
@@ -63,3 +63,6 @@ int (*dlb2_iface_unmap_qid)(struct dlb2_hw_dev *handle,int (*dlb2_iface_pending_port_unmaps)(struct dlb2_hw_dev *handle,struct dlb2_pending_port_unmaps_args *args); + +int (*dlb2_iface_sched_domain_start)(struct dlb2_hw_dev *handle, +struct dlb2_start_domain_args *cfg);
drivers/event/dlb2/dlb2_iface.h +3 -0
@@ -62,4 +62,7 @@ extern int (*dlb2_iface_unmap_qid)(struct dlb2_hw_dev *handle,extern int (*dlb2_iface_pending_port_unmaps)(struct dlb2_hw_dev *handle,struct dlb2_pending_port_unmaps_args *args); + +extern int (*dlb2_iface_sched_domain_start)(struct dlb2_hw_dev *handle, +struct dlb2_start_domain_args *cfg);#endif /* _DLB2_IFACE_H_ */
drivers/event/dlb2/pf/base/dlb2_resource.c +123 -0
126 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_main.c +10 -0
@@ -661,3 +661,13 @@ dlb2_pf_create_dir_queue(struct dlb2_hw *hw,return dlb2_hw_create_dir_queue (hw, id, args, resp,NOT_VF_REQ ,PF_ID_ZERO ); } + +int +dlb2_pf_start_domain (struct dlb2_hw *hw, +u32 id, +struct dlb2_start_domain_args *args, +struct dlb2_cmd_response *resp) +{ +return dlb2_hw_start_domain (hw, id, args, resp,NOT_VF_REQ , +PF_ID_ZERO ); +}
drivers/event/dlb2/pf/dlb2_pf.c +25 -0
@@ -503,6 +503,30 @@ dlb2_pf_pending_port_unmaps(struct dlb2_hw_dev *handle,return ret; } + +static int +dlb2_pf_sched_domain_start (struct dlb2_hw_dev *handle, +struct dlb2_start_domain_args *cfg) +{ +struct dlb2_dev *dlb2_dev = (struct dlb2_dev *)handle->pf_dev; +struct dlb2_cmd_response response = {0 }; +int ret; + +DLB2_INFO (dev->dlb2_device,"Entering %s()\n" , __func__); + + ret =dlb2_pf_start_domain (&dlb2_dev->hw, + handle->domain_id, + cfg, + &response); + + cfg->response = response; + +DLB2_INFO (dev->dlb2_device,"Exiting %s() with ret=%d\n" , + __func__, ret); + +return ret; +} +static void dlb2_pf_iface_fn_ptrs_init (void ) {
@@ -520,6 +544,7 @@ dlb2_pf_iface_fn_ptrs_init(void) dlb2_iface_dir_port_create = dlb2_pf_dir_port_create; dlb2_iface_map_qid = dlb2_pf_map_qid; dlb2_iface_unmap_qid = dlb2_pf_unmap_qid; + dlb2_iface_sched_domain_start = dlb2_pf_sched_domain_start; dlb2_iface_pending_port_unmaps = dlb2_pf_pending_port_unmaps; dlb2_iface_get_sn_allocation = dlb2_pf_get_sn_allocation; dlb2_iface_set_sn_allocation = dlb2_pf_set_sn_allocation;
Signature · 1 line
2.6.4
PATCH v9 17/23 event/dlb2: add enqueue and its burst variants
In reply to Timothy McDanielAdd support for enqueue and its variants.
--- doc/guides/eventdevs/dlb2.rst | 118 +++++++++ drivers/event/dlb2/dlb2.c | 540 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 658 insertions(+)
doc/guides/eventdevs/dlb2.rst +118 -0
@@ -163,6 +163,124 @@ Flow ID The flow ID field is preserved in the event when it is scheduled in the DLB2. +Hardware Credits +~~~~~~~~~~~~~~~~ + +DLB2 uses a hardware credit scheme to prevent software from overflowing hardware +event storage, with each unit of storage represented by a credit. A port spends +a credit to enqueue an event, and hardware refills the ports with credits as the +events are scheduled to ports. Refills come from credit pools, and each port is +a member of a load-balanced credit pool and a directed credit pool. The +load-balanced credits are used to enqueue to load-balanced queues, and directed +credits are used for directed queues. + +A DLB2 eventdev contains one load-balanced and one directed credit pool. These +pools' sizes are controlled by the nb_events_limit field in struct +rte_event_dev_config. The load-balanced pool is sized to contain +nb_events_limit credits, and the directed pool is sized to contain +nb_events_limit/4 credits. The directed pool size can be overridden with the +num_dir_credits vdev argument, like so: + + .. code-block:: console + + --vdev=dlb1_event,num_dir_credits=<value> + +This can be used if the default allocation is too low or too high for the +specific application needs. The PMD also supports a vdev arg that limits the +max_num_events reported by rte_event_dev_info_get(): + + .. code-block:: console + + --vdev=dlb1_event,max_num_events=<value> + +By default, max_num_events is reported as the total available load-balanced +credits. If multiple DLB2-based applications are being used, it may be desirable +to control how many load-balanced credits each application uses, particularly +when application(s) are written to configure nb_events_limit equal to the +reported max_num_events. + +Each port is a member of both credit pools. A port's credit allocation is +defined by its low watermark, high watermark, and refill quanta. These three +parameters are calculated by the dlb PMD like so: + +- The load-balanced high watermark is set to the port's enqueue_depth. + The directed high watermark is set to the minimum of the enqueue_depth and + the directed pool size divided by the total number of ports. +- The refill quanta is set to half the high watermark. +- The low watermark is set to the minimum of 16 and the refill quanta. + +When the eventdev is started, each port is pre-allocated a high watermark's +worth of credits. For example, if an eventdev contains four ports with enqueue +depths of 32 and a load-balanced credit pool size of 4096, each port will start +with 32 load-balanced credits, and there will be 3968 credits available to +replenish the ports. Thus, a single port is not capable of enqueueing up to the +nb_events_limit (without any events being dequeued), since the other ports are +retaining their initial credit allocation; in short, all ports must enqueue in +order to reach the limit. + +If a port attempts to enqueue and has no credits available, the enqueue +operation will fail and the application must retry the enqueue. Credits are +replenished asynchronously by the DLB2 hardware. + +Software Credits +~~~~~~~~~~~~~~~~ + +The DLB2 is a "closed system" event dev, and the DLB2 PMD layers a software +credit scheme on top of the hardware credit scheme in order to comply with +the per-port backpressure described in the eventdev API. + +The DLB2's hardware scheme is local to a queue/pipeline stage: a port spends a +credit when it enqueues to a queue, and credits are later replenished after the +events are dequeued and released. + +In the software credit scheme, a credit is consumed when a new (.op = +RTE_EVENT_OP_NEW) event is injected into the system, and the credit is +replenished when the event is released from the system (either explicitly with +RTE_EVENT_OP_RELEASE or implicitly in dequeue_burst()). + +In this model, an event is "in the system" from its first enqueue into eventdev +until it is last dequeued. If the event goes through multiple event queues, it +is still considered "in the system" while a worker thread is processing it. + +A port will fail to enqueue if the number of events in the system exceeds its +``new_event_threshold`` (specified at port setup time). A port will also fail +to enqueue if it lacks enough hardware credits to enqueue; load-balanced +credits are used to enqueue to a load-balanced queue, and directed credits are +used to enqueue to a directed queue. + +The out-of-credit situations are typically transient, and an eventdev +application using the DLB2 ought to retry its enqueues if they fail. +If enqueue fails, DLB2 PMD sets rte_errno as follows: + +- -ENOSPC: Credit exhaustion (either hardware or software) +- -EINVAL: Invalid argument, such as port ID, queue ID, or sched_type. + +Depending on the pipeline the application has constructed, it's possible to +enter a credit deadlock scenario wherein the worker thread lacks the credit +to enqueue an event, and it must dequeue an event before it can recover the +credit. If the worker thread retries its enqueue indefinitely, it will not +make forward progress. Such deadlock is possible if the application has event +"loops", in which an event in dequeued from queue A and later enqueued back to +queue A. + +Due to this, workers should stop retrying after a time, release the events it +is attempting to enqueue, and dequeue more events. It is important that the +worker release the events and don't simply set them aside to retry the enqueue +again later, because the port has limited history list size (by default, twice +the port's dequeue_depth). + +Priority +~~~~~~~~ + +The DLB2 supports event priority and per-port queue service priority, as +described in the eventdev header file. The DLB2 does not support 'global' event +queue priority established at queue creation time. + +DLB2 supports 8 event and queue service priority levels. For both priority +types, the PMD uses the upper three bits of the priority field to determine the +DLB2 priority, discarding the 5 least significant bits. The 5 least significant +event priority bits are not preserved when an event is enqueued. + Reconfiguration ~~~~~~~~~~~~~~~
drivers/event/dlb2/dlb2.c +540 -0
553 lines not on this page · raw message
Signature · 1 line
2.6.4
PATCH v9 18/23 event/dlb2: add dequeue and its burst variants
In reply to Timothy McDanielAdd support for dequeue, dequeue_burst, ...
DLB2 does not currently support interrupts, but instead use umonitor/umwait if supported by the processor. This allows the software to monitor and wait on writes to a cache-line.
DLB2 supports normal and sparse cq mode. In normal mode the hardware will pack 4 QEs into each cache line. In sparse cq mode, the hardware will only populate one QE per cache line. Software must be aware of the cq mode, and take the appropriate actions, based on the mode.
--- doc/guides/eventdevs/dlb2.rst | 21 ++ drivers/event/dlb2/dlb2.c | 783 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 804 insertions(+)
doc/guides/eventdevs/dlb2.rst +21 -0
@@ -314,6 +314,27 @@ The PMD does not support the following configuration sequences: This sequence is not supported because the event device must be reconfigured before its ports or queues can be. +Deferred Scheduling +~~~~~~~~~~~~~~~~~~~ + +The DLB2 PMD's default behavior for managing a CQ is to "pop" the CQ once per +dequeued event before returning from rte_event_dequeue_burst(). This frees the +corresponding entries in the CQ, which enables the DLB2 to schedule more events +to it. + +To support applications seeking finer-grained scheduling control -- for example +deferring scheduling to get the best possible priority scheduling and +load-balancing -- the PMD supports a deferred scheduling mode. In this mode, +the CQ entry is not popped until the *subsequent* rte_event_dequeue_burst() +call. This mode only applies to load-balanced event ports with dequeue depth of +1. + +To enable deferred scheduling, use the defer_sched vdev argument like so: + + .. code-block:: console + + --vdev=dlb1_event,defer_sched=on + Atomic Inflights Allocation ~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/event/dlb2/dlb2.c +783 -0
810 lines not on this page · raw message
Signature · 1 line
2.6.4
PATCH v9 19/23 event/dlb2: add eventdev stop and close
In reply to Timothy McDanielAdd support for eventdev stop and close entry points.
--- drivers/event/dlb2/dlb2.c | 257 +++++++++++++++++++++++++++-- drivers/event/dlb2/dlb2_iface.c | 6 + drivers/event/dlb2/dlb2_iface.h | 6 + drivers/event/dlb2/pf/base/dlb2_resource.c | 91 ++++++++++ drivers/event/dlb2/pf/dlb2_pf.c | 52 ++++++ 5 files changed, 396 insertions(+), 16 deletions(-)
drivers/event/dlb2/dlb2.c +241 -16
@@ -71,21 +71,6 @@ static struct rte_event_dev_info evdev_dlb2_default_info = {struct process_local_port_data dlb2_port[DLB2_MAX_NUM_PORTS ][DLB2_NUM_PORT_TYPES ]; -/* -* DUMMY - added so that xstats path will compile/link. -* Will be replaced by real version in a subsequent -* patch. -*/ -uint32_t -dlb2_get_queue_depth (struct dlb2_eventdev *dlb2, -struct dlb2_eventdev_queue *queue) -{ -RTE_SET_USED (dlb2); -RTE_SET_USED (queue); - -return 0 ; -} -static void dlb2_free_qe_mem (struct dlb2_port *qm_port) {
@@ -1878,7 +1863,6 @@ dlb2_eventdev_port_unlink(struct rte_eventdev *dev, void *event_port,return 0 ;/* Ignore and return success */ } -/* FIXME: How to handle unlink on a directed port? */ if (ev_port->qm_port.is_directed) {DLB2_LOG_DBG ("dlb2: ignore unlink from dir port %d\n" , ev_port->id);
@@ -3396,6 +3380,245 @@ dlb2_event_dequeue_sparse(void *event_port, struct rte_event *ev, }static void +dlb2_flush_port (struct rte_eventdev *dev,int port_id) +{ +struct dlb2_eventdev *dlb2 =dlb2_pmd_priv (dev); +eventdev_stop_flush_t flush; +struct rte_event ev; +uint8_t dev_id; +void *arg; +int i; + + flush = dev->dev_ops->dev_stop_flush; + dev_id = dev->data->dev_id; + arg = dev->data->dev_stop_flush_arg; + +while (rte_event_dequeue_burst (dev_id, port_id, &ev,1 ,0 )) { +if (flush) +flush (dev_id, ev, arg); + +if (dlb2->ev_ports[port_id].qm_port.is_directed) +continue ; + + ev.op =RTE_EVENT_OP_RELEASE ; + +rte_event_enqueue_burst (dev_id, port_id, &ev,1 ); + } + +/* Enqueue any additional outstanding releases */ + ev.op =RTE_EVENT_OP_RELEASE ; + +for (i = dlb2->ev_ports[port_id].outstanding_releases; i >0 ; i--) +rte_event_enqueue_burst (dev_id, port_id, &ev,1 ); +} + +static uint32_t +dlb2_get_ldb_queue_depth (struct dlb2_eventdev *dlb2, +struct dlb2_eventdev_queue *queue) +{ +struct dlb2_hw_dev *handle = &dlb2->qm_instance; +struct dlb2_get_ldb_queue_depth_args cfg; +int ret; + + cfg.queue_id = queue->qm_queue.id; + + ret =dlb2_iface_get_ldb_queue_depth (handle, &cfg); +if (ret <0 ) { +DLB2_LOG_ERR ("dlb2: get_ldb_queue_depth ret=%d (driver status: %s)\n" , + ret, dlb2_error_strings[cfg.response.status]); +return ret; + } + +return cfg.response.id; +} + +static uint32_t +dlb2_get_dir_queue_depth (struct dlb2_eventdev *dlb2, +struct dlb2_eventdev_queue *queue) +{ +struct dlb2_hw_dev *handle = &dlb2->qm_instance; +struct dlb2_get_dir_queue_depth_args cfg; +int ret; + + cfg.queue_id = queue->qm_queue.id; + + ret =dlb2_iface_get_dir_queue_depth (handle, &cfg); +if (ret <0 ) { +DLB2_LOG_ERR ("dlb2: get_dir_queue_depth ret=%d (driver status: %s)\n" , + ret, dlb2_error_strings[cfg.response.status]); +return ret; + } + +return cfg.response.id; +} + +uint32_t +dlb2_get_queue_depth (struct dlb2_eventdev *dlb2, +struct dlb2_eventdev_queue *queue) +{ +if (queue->qm_queue.is_directed) +return dlb2_get_dir_queue_depth (dlb2, queue); +else +return dlb2_get_ldb_queue_depth (dlb2, queue); +} + +static bool +dlb2_queue_is_empty (struct dlb2_eventdev *dlb2, +struct dlb2_eventdev_queue *queue) +{ +return dlb2_get_queue_depth (dlb2, queue) ==0 ; +} + +static bool +dlb2_linked_queues_empty (struct dlb2_eventdev *dlb2) +{ +int i; + +for (i =0 ; i < dlb2->num_queues; i++) { +if (dlb2->ev_queues[i].num_links ==0 ) +continue ; +if (!dlb2_queue_is_empty (dlb2, &dlb2->ev_queues[i])) +return false; + } + +return true; +} + +static bool +dlb2_queues_empty (struct dlb2_eventdev *dlb2) +{ +int i; + +for (i =0 ; i < dlb2->num_queues; i++) { +if (!dlb2_queue_is_empty (dlb2, &dlb2->ev_queues[i])) +return false; + } + +return true; +} + +static void +dlb2_drain (struct rte_eventdev *dev) +{ +struct dlb2_eventdev *dlb2 =dlb2_pmd_priv (dev); +struct dlb2_eventdev_port *ev_port =NULL ; +uint8_t dev_id; +int i; + + dev_id = dev->data->dev_id; + +while (!dlb2_linked_queues_empty (dlb2)) { +/* Flush all the ev_ports, which will drain all their connected +* queues. +*/ +for (i =0 ; i < dlb2->num_ports; i++) +dlb2_flush_port (dev, i); + } + +/* The queues are empty, but there may be events left in the ports. */ +for (i =0 ; i < dlb2->num_ports; i++) +dlb2_flush_port (dev, i); + +/* If the domain's queues are empty, we're done. */ +if (dlb2_queues_empty (dlb2)) +return ; + +/* Else, there must be at least one unlinked load-balanced queue. +* Select a load-balanced port with which to drain the unlinked +* queue(s). +*/ +for (i =0 ; i < dlb2->num_ports; i++) { + ev_port = &dlb2->ev_ports[i]; + +if (!ev_port->qm_port.is_directed) +break ; + } + +if (i == dlb2->num_ports) { +DLB2_LOG_ERR ("internal error: no LDB ev_ports\n" ); +return ; + } + + rte_errno =0 ; +rte_event_port_unlink (dev_id, ev_port->id,NULL ,0 ); + +if (rte_errno) { +DLB2_LOG_ERR ("internal error: failed to unlink ev_port %d\n" , + ev_port->id); +return ; + } + +for (i =0 ; i < dlb2->num_queues; i++) { +uint8_t qid, prio; +int ret; + +if (dlb2_queue_is_empty (dlb2, &dlb2->ev_queues[i])) +continue ; + + qid = i; + prio =0 ; + +/* Link the ev_port to the queue */ + ret =rte_event_port_link (dev_id, ev_port->id, &qid, &prio,1 ); +if (ret !=1 ) { +DLB2_LOG_ERR ("internal error: failed to link ev_port %d to queue %d\n" , + ev_port->id, qid); +return ; + } + +/* Flush the queue */ +while (!dlb2_queue_is_empty (dlb2, &dlb2->ev_queues[i])) +dlb2_flush_port (dev, ev_port->id); + +/* Drain any extant events in the ev_port. */ +dlb2_flush_port (dev, ev_port->id); + +/* Unlink the ev_port from the queue */ + ret =rte_event_port_unlink (dev_id, ev_port->id, &qid,1 ); +if (ret !=1 ) { +DLB2_LOG_ERR ("internal error: failed to unlink ev_port %d to queue %d\n" , + ev_port->id, qid); +return ; + } + } +} + +static void +dlb2_eventdev_stop (struct rte_eventdev *dev) +{ +struct dlb2_eventdev *dlb2 =dlb2_pmd_priv (dev); + +rte_spinlock_lock (&dlb2->qm_instance.resource_lock); + +if (dlb2->run_state ==DLB2_RUN_STATE_STOPPED ) { +DLB2_LOG_DBG ("Internal error: already stopped\n" ); +rte_spinlock_unlock (&dlb2->qm_instance.resource_lock); +return ; + }else if (dlb2->run_state !=DLB2_RUN_STATE_STARTED ) { +DLB2_LOG_ERR ("Internal error: bad state %d for dev_stop\n" , + (int )dlb2->run_state); +rte_spinlock_unlock (&dlb2->qm_instance.resource_lock); +return ; + } + + dlb2->run_state =DLB2_RUN_STATE_STOPPING ; + +rte_spinlock_unlock (&dlb2->qm_instance.resource_lock); + +dlb2_drain (dev); + + dlb2->run_state =DLB2_RUN_STATE_STOPPED ; +} + +static int +dlb2_eventdev_close (struct rte_eventdev *dev) +{ +dlb2_hw_reset_sched_domain (dev, false); + +return 0 ; +} + +static void dlb2_entry_points_init (struct rte_eventdev *dev) {struct dlb2_eventdev *dlb2;
@@ -3405,6 +3628,8 @@ dlb2_entry_points_init(struct rte_eventdev *dev) .dev_infos_get = dlb2_eventdev_info_get, .dev_configure = dlb2_eventdev_configure, .dev_start = dlb2_eventdev_start, + .dev_stop = dlb2_eventdev_stop, + .dev_close = dlb2_eventdev_close, .queue_def_conf = dlb2_eventdev_queue_default_conf_get, .queue_setup = dlb2_eventdev_queue_setup, .port_def_conf = dlb2_eventdev_port_default_conf_get,
drivers/event/dlb2/dlb2_iface.c +6 -0
@@ -66,3 +66,9 @@ int (*dlb2_iface_pending_port_unmaps)(struct dlb2_hw_dev *handle,int (*dlb2_iface_sched_domain_start)(struct dlb2_hw_dev *handle,struct dlb2_start_domain_args *cfg); + +int (*dlb2_iface_get_ldb_queue_depth)(struct dlb2_hw_dev *handle, +struct dlb2_get_ldb_queue_depth_args *args); + +int (*dlb2_iface_get_dir_queue_depth)(struct dlb2_hw_dev *handle, +struct dlb2_get_dir_queue_depth_args *args);
drivers/event/dlb2/dlb2_iface.h +6 -0
@@ -65,4 +65,10 @@ extern int (*dlb2_iface_pending_port_unmaps)(struct dlb2_hw_dev *handle,extern int (*dlb2_iface_sched_domain_start)(struct dlb2_hw_dev *handle,struct dlb2_start_domain_args *cfg); + +extern int (*dlb2_iface_get_ldb_queue_depth)(struct dlb2_hw_dev *handle, +struct dlb2_get_ldb_queue_depth_args *args); + +extern int (*dlb2_iface_get_dir_queue_depth)(struct dlb2_hw_dev *handle, +struct dlb2_get_dir_queue_depth_args *args);#endif /* _DLB2_IFACE_H_ */
drivers/event/dlb2/pf/base/dlb2_resource.c +91 -0
94 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_pf.c +52 -0
64 lines not on this page · raw message
Signature · 1 line
2.6.4
PATCH v9 20/23 event/dlb2: add PMD's token pop public interface
In reply to Timothy McDanielThe PMD uses a public interface to allow applications to control the token pop mode. Supported token pop modes are as follows, and they impact core scheduling affinity for ldb ports.
AUTO_POP: Pop the CQ tokens immediately after dequeueing.DELAYED_POP: Pop CQ tokens after (dequeue_depth - 1) events
are released. Supported on load-balanced ports only.DEFERRED_POP: Pop the CQ tokens during next dequeue operation.
--- doc/api/doxy-api-index.md | 3 +- drivers/event/dlb2/dlb2.c | 65 +++++++++++++++++++++++++++++++---- drivers/event/dlb2/dlb2_priv.h | 3 ++ drivers/event/dlb2/meson.build | 5 ++- drivers/event/dlb2/rte_pmd_dlb2.c | 39 +++++++++++++++++++++ drivers/event/dlb2/rte_pmd_dlb2.h | 72 +++++++++++++++++++++++++++++++++++++++ drivers/event/dlb2/version.map | 6 ++++ 7 files changed, 185 insertions(+), 8 deletions(-) create mode 100644 drivers/event/dlb2/rte_pmd_dlb2.c create mode 100644 drivers/event/dlb2/rte_pmd_dlb2.h
doc/api/doxy-api-index.md +2 -1
@@ -51,7 +51,8 @@ The public API headers are grouped by topics: [dpaa2_mempool] (@ref rte_dpaa2_mempool.h), [dpaa2_cmdif] (@ref rte_pmd_dpaa2_cmdif.h), [dpaa2_qdma] (@ref rte_pmd_dpaa2_qdma.h), - [crypto_scheduler] (@ref rte_cryptodev_scheduler.h) + [crypto_scheduler] (@ref rte_cryptodev_scheduler.h), + [dlb2] (@ref rte_pmd_dlb2.h) - **memory**: [memseg] (@ref rte_memory.h),
drivers/event/dlb2/dlb2.c +59 -6
154 lines not on this page · raw message
drivers/event/dlb2/dlb2_priv.h +3 -0
@@ -12,6 +12,7 @@#include <rte_config.h> #include "dlb2_user.h" #include "dlb2_log.h" +#include "rte_pmd_dlb2.h" #ifndef RTE_LIBRTE_PMD_DLB2_QUELL_STATS #define DLB2_INC_STAT (_stat, _incr_val) ((_stat) += _incr_val)
@@ -290,6 +291,7 @@ struct dlb2_port {bool gen_bit;uint16_t dir_credits;uint32_t dequeue_depth; +enum dlb2_token_pop_mode token_pop_mode;union dlb2_port_config cfg;uint32_t *credit_pool[DLB2_NUM_QUEUE_TYPES ];/* use __atomic builtins */ uint16_t cached_ldb_credits;
@@ -298,6 +300,7 @@ struct dlb2_port {bool int_armed;uint16_t owed_tokens;int16_t issued_releases; +int16_t token_pop_thresh;int cq_depth;uint16_t cq_idx;uint16_t cq_idx_unmasked;
drivers/event/dlb2/meson.build +4 -1
@@ -1,3 +1,4 @@ + # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2019-2020 Intel Corporation
@@ -12,7 +13,9 @@ sources = files('dlb2.c', 'dlb2_xstats.c', 'pf/dlb2_main.c', 'pf/dlb2_pf.c', - 'pf/base/dlb2_resource.c' + 'pf/base/dlb2_resource.c', + 'rte_pmd_dlb2.c' ) deps += ['mbuf', 'mempool', 'ring', 'pci', 'bus_pci'] +install_headers('rte_pmd_dlb2.h')
drivers/event/dlb2/rte_pmd_dlb2.c new file +39 -0
@@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2020 Intel Corporation +*/ + +#include <rte_eventdev.h> +#include <rte_eventdev_pmd.h> + +#include "rte_pmd_dlb2.h" +#include "dlb2_priv.h" +#include "dlb2_inline_fns.h" + +int +rte_pmd_dlb2_set_token_pop_mode (uint8_t dev_id, +uint8_t port_id, +enum dlb2_token_pop_mode mode) +{ +struct dlb2_eventdev *dlb2; +struct rte_eventdev *dev; + +RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET (dev_id, -EINVAL ); + dev = &rte_eventdevs[dev_id]; + + dlb2 =dlb2_pmd_priv (dev); + +if (mode >=NUM_TOKEN_POP_MODES ) +return -EINVAL ; + +/* The event device must be configured, but not yet started */ +if (!dlb2->configured || dlb2->run_state !=DLB2_RUN_STATE_STOPPED ) +return -EINVAL ; + +/* The token pop mode must be set before configuring the port */ +if (port_id >= dlb2->num_ports || dlb2->ev_ports[port_id].setup_done) +return -EINVAL ; + + dlb2->ev_ports[port_id].qm_port.token_pop_mode = mode; + +return 0 ; +}
drivers/event/dlb2/rte_pmd_dlb2.h new file +72 -0
72 lines not on this page · raw message
drivers/event/dlb2/version.map +6 -0
@@ -1,3 +1,9 @@ DPDK_21 { local: *; }; + +EXPERIMENTAL { + global: + + rte_pmd_dlb2_set_token_pop_mode; +};
Signature · 1 line
2.6.4
PATCH v9 21/23 event/dlb2: add PMD self-tests
In reply to Timothy McDanielAdd a variety of self-tests for both ldb and directed ports/queues, as well as configure, start, stop, link, etc...
--- app/test/test_eventdev.c | 7 + drivers/event/dlb2/dlb2.c | 1 + drivers/event/dlb2/dlb2_selftest.c | 1524 ++++++++++++++++++++++++++++++++++++ drivers/event/dlb2/meson.build | 3 +- 4 files changed, 1534 insertions(+), 1 deletion(-) create mode 100644 drivers/event/dlb2/dlb2_selftest.c
app/test/test_eventdev.c +7 -0
@@ -1030,6 +1030,12 @@ test_eventdev_selftest_dpaa2(void)return test_eventdev_selftest_impl ("event_dpaa2" ,"" ); } +static int +test_eventdev_selftest_dlb2 (void ) +{ +return test_eventdev_selftest_impl ("dlb2_event" ,"" ); +} +REGISTER_TEST_COMMAND (eventdev_common_autotest, test_eventdev_common);REGISTER_TEST_COMMAND (eventdev_selftest_sw, test_eventdev_selftest_sw); REGISTER_TEST_COMMAND(eventdev_selftest_octeontx,
@@ -1037,3 +1043,4 @@ REGISTER_TEST_COMMAND(eventdev_selftest_octeontx,REGISTER_TEST_COMMAND (eventdev_selftest_octeontx2, test_eventdev_selftest_octeontx2);REGISTER_TEST_COMMAND (eventdev_selftest_dpaa2, test_eventdev_selftest_dpaa2); +REGISTER_TEST_COMMAND (eventdev_selftest_dlb2, test_eventdev_selftest_dlb2);
drivers/event/dlb2/dlb2.c +1 -0
@@ -3692,6 +3692,7 @@ dlb2_entry_points_init(struct rte_eventdev *dev) .xstats_get_names = dlb2_eventdev_xstats_get_names, .xstats_get_by_name = dlb2_eventdev_xstats_get_by_name, .xstats_reset = dlb2_eventdev_xstats_reset, + .dev_selftest = test_dlb2_eventdev, };/* Expose PMD's eventdev interface */
drivers/event/dlb2/dlb2_selftest.c new file +1524 -0
1,524 lines not on this page · raw message
drivers/event/dlb2/meson.build +2 -1
@@ -14,7 +14,8 @@ sources = files('dlb2.c', 'pf/dlb2_main.c', 'pf/dlb2_pf.c', 'pf/base/dlb2_resource.c', - 'rte_pmd_dlb2.c' + 'rte_pmd_dlb2.c', + 'dlb2_selftest.c' ) deps += ['mbuf', 'mempool', 'ring', 'pci', 'bus_pci']
Signature · 1 line
2.6.4
PATCH v9 22/23 event/dlb2: add queue and port release
In reply to Timothy McDanielDLB does not support reconfiguring individual queues or ports on the fly. The entire device must be reconfigured. Previously allocated port QE and memzone memory
is freed in this patch.
--- drivers/event/dlb2/dlb2.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/event/dlb2/dlb2.c +24 -0
@@ -3668,6 +3668,28 @@ dlb2_eventdev_close(struct rte_eventdev *dev) }static void +dlb2_eventdev_queue_release (struct rte_eventdev *dev,uint8_t id) +{ +RTE_SET_USED (dev); +RTE_SET_USED (id); + +/* This function intentionally left blank. */ +} + +static void +dlb2_eventdev_port_release (void *port) +{ +struct dlb2_eventdev_port *ev_port = port; +struct dlb2_port *qm_port; + +if (ev_port) { + qm_port = &ev_port->qm_port; +if (qm_port->config_state ==DLB2_CONFIGURED ) +dlb2_free_qe_mem (qm_port); + } +} + +static void dlb2_entry_points_init (struct rte_eventdev *dev) {struct dlb2_eventdev *dlb2;
@@ -3681,8 +3703,10 @@ dlb2_entry_points_init(struct rte_eventdev *dev) .dev_close = dlb2_eventdev_close, .queue_def_conf = dlb2_eventdev_queue_default_conf_get, .queue_setup = dlb2_eventdev_queue_setup, + .queue_release = dlb2_eventdev_queue_release, .port_def_conf = dlb2_eventdev_port_default_conf_get, .port_setup = dlb2_eventdev_port_setup, + .port_release = dlb2_eventdev_port_release, .port_link = dlb2_eventdev_port_link, .port_unlink = dlb2_eventdev_port_unlink, .port_unlinks_in_progress =
Signature · 1 line
2.6.4
PATCH v9 23/23 event/dlb2: add timeout ticks entry point
In reply to Timothy McDanielAdds the timeout ticks conversion function.
--- drivers/event/dlb2/dlb2.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/event/dlb2/dlb2.c +13 -0
@@ -3689,6 +3689,18 @@ dlb2_eventdev_port_release(void *port) } } +static int +dlb2_eventdev_timeout_ticks (struct rte_eventdev *dev,uint64_t ns, +uint64_t *timeout_ticks) +{ +RTE_SET_USED (dev); +uint64_t cycles_per_ns =rte_get_timer_hz () /1E9 ; + + *timeout_ticks = ns * cycles_per_ns; + +return 0 ; +} +static void dlb2_entry_points_init (struct rte_eventdev *dev) {
@@ -3711,6 +3723,7 @@ dlb2_entry_points_init(struct rte_eventdev *dev) .port_unlink = dlb2_eventdev_port_unlink, .port_unlinks_in_progress = dlb2_eventdev_port_unlinks_in_progress, + .timeout_ticks = dlb2_eventdev_timeout_ticks, .dump = dlb2_eventdev_dump, .xstats_get = dlb2_eventdev_xstats_get, .xstats_get_names = dlb2_eventdev_xstats_get_names,
Signature · 1 line
2.6.4
v10 cover Add DLB2 PMD
In reply to Timothy McDanielThe following patch series adds support for a new eventdev PMD. The DLB2 PMD adds support for the Intel Dynamic Load Balancer 2.0 (DLB2) hardware.
The DLB2 is a PCIe device that provides load-balanced, prioritized scheduling of core-to-core communication. The device consists of queues and arbiters that connect producer and consumer cores, and implements load-balanced queueing features including:
- Lock-free multi-producer/multi-consumer operation.
- Multiple priority levels for varying traffic types.
- 'Direct' traffic (i.e. multi-producer/single-consumer)
- Simple unordered load-balanced distribution.
- Atomic lock-free load balancing across multiple consumers.
- Queue element reordering feature allowing ordered load-balanced distribution.
The DLB2 hardware supports both load balanced and directed ports and queues. Unlike other eventdev devices already in the repo, not all DLB2 ports and queues are equally capable. In particular, directed ports are limited to a single link, and must be connected to a directed queue. Additionally, even though LDB ports may link multiple queues,
the number of queues that may be linked is limited by hardware.
While reviewing the code, please be aware that this PMD has full control over the DLB2 hardware. Intel will be extending the DLB2 PMD in the future (not as part of this first series) with a mode that we refer to as the bifurcated PMD. The bifurcated PMD communicates with a kernel driver to configure the device, ports, and queues, and memory maps device MMIO so datapath operations occur purely in user-space. Note that the DLB2 hardware is a successor of the DLB hardware, and as such is structured similarly, both in terms of code layout and implementation.
The framework to support both the PF PMD and bifurcated PMD exists in this patchset, and is why the iface.[ch] layer is present.
Changes since V9
================
Address comments from David Marchand:
- this patch-set is based on Nov 1, 2020 dpdk-next-eventdev
- fix docs build (doxy-api.conf.in and doxy-api-index.md)
- restore blank line in MAINTAINERS file
- move dlb announcement in release_20_11.rst after ethdev
- use headers = files() for exported meson public headers
- fix a typo in 'add documentation ..." commit message
- use eal version of cldemote
- convert a couple of printfs to LOG messages
- all patches build incrementally (gcc), and checkpatches reports success
- I am not able to run clang locally. If clang errors are still present I will ask IT to install clang on a build server tomorrow.
Changes since V8:
=================
- Fixed format errors in doc/api/doxy-api-index.md
- Delayed introduction of dlb2_consume_qe_immediate until add-dequeue-and-its-burst-variants.patch
- Delayed introduction of dlb2_construct_token_pop_qe until add-PMD-s-token-pop-public-interface.patch
Changes since V7:
================
- fix CENTOS build error: use __m128i instead of __v2di with _mm_stream_si128
- deleted unused dlb2_umwait and dlb2_umonitor functions
Changes since V6:
=================
- removed unused function, fixing build error
- fixed typo in port_setup commit message
- this patch series is based on dpdk-next-eventdev
Changes since V5:
================
- convert to use rte_power_monitor patches
- replace __builtin_ia32_movntdq() with _mm_stream_si128()
- remove unused functions in dlb_selftest.c
- workaround for RHEL 7 gcc brace bug
Changes since V4:
================
- moved introduction of dlb in relnotes_20_11 to first patch in series
- fixed underlines in dlb.rst that were too short
- note that the code still uses its private byte-encoded versions of umonitor/umwait, rather than the new functions in the power patch that are built on top of those intrinsics. This is intentional.
Changes since V3:
================
- updated MAINTAINERS file to alphabetically insert DLB
- don't create RTE_ symbols in pmd
- converted to use version.map scheme
- converted to use .._master_lcore instead of .._main_lcore
- this patch set is based on dpdk-next-eventdev
Changes since V2:
================
- fixed meson conditional build. Moved test into driver’s meson.build file instead of event/meson.build
- documentation is populated as associated code is introduced
- add log_register in add dynamic logging patch
- rename RTE_xxx symbol(s) as DLB2_xxx
- replaced function ptr enqueue_four with direct call to movdir64b
- remove unused port_pages
- broke up probe patch into 3 smaller patches for easier review
- changed param order of movdir64b/movntdq to match intrinsics
- added self to MAINTAINERS files
- squashed announcement of availability into last patch in series
- correct spelling errors and delete repeated words
- DPDK_21.0 -> DPDK 21 in map file
- add experimental banner to public structs and APIs
Changes since V1:
=================
- implement changes requested in code reviews by Gage Eads and Mike Chen
- fix a memzone leak
- convert to use eal rte-cpuflags patch from Liang Ma
Known Issues:
- the documentation contained in dlb2.rst is not complete, and should be updated to include command line parameters (class of service, etc ...).
Depends-on: patch-82202 ("eventdev: increase MAX QUEUES PER DEV to 255")
Timothy McDaniel (23):
event/dlb2: add documentation and meson build infrastructure event/dlb2: add dynamic logging
event/dlb2: add private data structures and constants event/dlb2: add definitions shared with LKM or shared code event/dlb2: add inline functions
event/dlb2: add eventdev probe
event/dlb2: add flexible interface
event/dlb2: add probe-time hardware init event/dlb2: add xstats
event/dlb2: add infos get and configure event/dlb2: add queue and port default conf event/dlb2: add queue setup
event/dlb2: add port setup
event/dlb2: add port link
event/dlb2: add port unlink and port unlinks in progress event/dlb2: add eventdev start
event/dlb2: add enqueue and its burst variants event/dlb2: add dequeue and its burst variants event/dlb2: add eventdev stop and close event/dlb2: add PMD's token pop public interface event/dlb2: add PMD self-tests
event/dlb2: add queue and port release
event/dlb2: add timeout ticks entry point
MAINTAINERS | 5 + app/test/test_eventdev.c | 7 + config/rte_config.h | 7 + doc/api/doxy-api-index.md | 3 +- doc/api/doxy-api.conf.in | 1 + doc/guides/eventdevs/dlb2.rst | 365 ++ doc/guides/eventdevs/index.rst | 1 + doc/guides/rel_notes/release_20_11.rst | 5 + drivers/event/dlb2/dlb2.c | 3947 ++++++++++++++++ drivers/event/dlb2/dlb2_iface.c | 74 + drivers/event/dlb2/dlb2_iface.h | 74 + drivers/event/dlb2/dlb2_inline_fns.h | 33 + drivers/event/dlb2/dlb2_log.h | 25 + drivers/event/dlb2/dlb2_priv.h | 578 +++ drivers/event/dlb2/dlb2_selftest.c | 1524 ++++++ drivers/event/dlb2/dlb2_user.h | 679 +++ drivers/event/dlb2/dlb2_xstats.c | 1235 +++++ drivers/event/dlb2/meson.build | 23 + drivers/event/dlb2/pf/base/dlb2_hw_types.h | 367 ++ drivers/event/dlb2/pf/base/dlb2_mbox.h | 596 +++ drivers/event/dlb2/pf/base/dlb2_osdep.h | 230 + drivers/event/dlb2/pf/base/dlb2_osdep_bitmap.h | 440 ++ drivers/event/dlb2/pf/base/dlb2_osdep_list.h | 131 + drivers/event/dlb2/pf/base/dlb2_osdep_types.h | 31 + drivers/event/dlb2/pf/base/dlb2_regs.h | 2527 ++++++++++ drivers/event/dlb2/pf/base/dlb2_resource.c | 6027 ++++++++++++++++++++++++ drivers/event/dlb2/pf/base/dlb2_resource.h | 1913 ++++++++ drivers/event/dlb2/pf/dlb2_main.c | 673 +++ drivers/event/dlb2/pf/dlb2_main.h | 97 + drivers/event/dlb2/pf/dlb2_pf.c | 728 +++ drivers/event/dlb2/rte_pmd_dlb2.c | 39 + drivers/event/dlb2/rte_pmd_dlb2.h | 72 + drivers/event/dlb2/version.map | 9 + drivers/event/meson.build | 3 +- 34 files changed, 22467 insertions(+), 2 deletions(-) create mode 100644 doc/guides/eventdevs/dlb2.rst create mode 100644 drivers/event/dlb2/dlb2.c create mode 100644 drivers/event/dlb2/dlb2_iface.c create mode 100644 drivers/event/dlb2/dlb2_iface.h create mode 100644 drivers/event/dlb2/dlb2_inline_fns.h create mode 100644 drivers/event/dlb2/dlb2_log.h create mode 100644 drivers/event/dlb2/dlb2_priv.h create mode 100644 drivers/event/dlb2/dlb2_selftest.c create mode 100644 drivers/event/dlb2/dlb2_user.h create mode 100644 drivers/event/dlb2/dlb2_xstats.c create mode 100644 drivers/event/dlb2/meson.build create mode 100644 drivers/event/dlb2/pf/base/dlb2_hw_types.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_mbox.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_osdep.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_osdep_bitmap.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_osdep_list.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_osdep_types.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_regs.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_resource.c create mode 100644 drivers/event/dlb2/pf/base/dlb2_resource.h create mode 100644 drivers/event/dlb2/pf/dlb2_main.c create mode 100644 drivers/event/dlb2/pf/dlb2_main.h create mode 100644 drivers/event/dlb2/pf/dlb2_pf.c create mode 100644 drivers/event/dlb2/rte_pmd_dlb2.c create mode 100644 drivers/event/dlb2/rte_pmd_dlb2.h create mode 100644 drivers/event/dlb2/version.map
Signature · 1 line
2.6.4
PATCH v10 1/23 event/dlb2: add documentation and meson build infrastructure
Adds the meson build infrastructure, which includes compile-time constants in rte_config.h. DLB2 is only supported on Linux 64 bit X86 platforms at this time.
Adds announcement of availability for the new driver for Intel Dynamic Load Balancer 2.0 hardware.
--- MAINTAINERS | 5 +++++ config/rte_config.h | 7 ++++++ doc/guides/eventdevs/dlb2.rst | 40 ++++++++++++++++++++++++++++++++++ doc/guides/eventdevs/index.rst | 1 + doc/guides/rel_notes/release_20_11.rst | 5 +++++ drivers/event/dlb2/meson.build | 15 +++++++++++++ drivers/event/dlb2/version.map | 3 +++ drivers/event/meson.build | 3 ++- 8 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 doc/guides/eventdevs/dlb2.rst create mode 100644 drivers/event/dlb2/meson.build create mode 100644 drivers/event/dlb2/version.map
MAINTAINERS +5 -0
@@ -1176,6 +1176,11 @@ Cavium OCTEON TX timvf M: Pavan Nikhilesh <[email protected]> F: drivers/event/octeontx/timvf_* +Intel DLB2 +M: Timothy McDaniel <[email protected]> +F: drivers/event/dlb2/ +F: doc/guides/eventdevs/dlb2.rst + Marvell OCTEON TX2 M: Pavan Nikhilesh <[email protected]> M: Jerin Jacob <[email protected]>
config/rte_config.h +7 -0
@@ -135,4 +135,11 @@/* QEDE PMD defines */ #define RTE_LIBRTE_QEDE_FW "" +/* DLB2 defines */ +#define RTE_LIBRTE_PMD_DLB2_POLL_INTERVAL 1000 +#define RTE_LIBRTE_PMD_DLB2_UMWAIT_CTL_STATE 0 +#undef RTE_LIBRTE_PMD_DLB2_QUELL_STATS +#define RTE_LIBRTE_PMD_DLB2_SW_CREDIT_QUANTA 32 +#define RTE_PMD_DLB2_DEFAULT_DEPTH_THRESH 256 +#endif /* _RTE_CONFIG_H_ */
doc/guides/eventdevs/dlb2.rst new file +40 -0
@@ -0,0 +1,40 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright(c) 2020 Intel Corporation. + +Driver for the Intel® Dynamic Load Balancer (DLB2) +================================================== + +The DPDK dlb poll mode driver supports the Intel® Dynamic Load Balancer. + +Prerequisites +------------- + +Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup +the basic DPDK environment. + +Configuration +------------- + +The DLB2 PF PMD is a user-space PMD that uses VFIO to gain direct +device access. To use this operation mode, the PCIe PF device must be bound +to a DPDK-compatible VFIO driver, such as vfio-pci. + +Eventdev API Notes +------------------ + +The DLB2 provides the functions of a DPDK event device; specifically, it +supports atomic, ordered, and parallel scheduling events from queues to ports. +However, the DLB2 hardware is not a perfect match to the eventdev API. Some DLB2 +features are abstracted by the PMD such as directed ports. + +In general the dlb PMD is designed for ease-of-use and does not require a +detailed understanding of the hardware, but these details are important when +writing high-performance code. This section describes the places where the +eventdev API and DLB2 misalign. + +Flow ID +~~~~~~~ + +The flow ID field is preserved in the event when it is scheduled in the +DLB2. +
doc/guides/eventdevs/index.rst +1 -0
@@ -11,6 +11,7 @@ application through the eventdev API. :maxdepth: 2 :numbered: + dlb2 dpaa dpaa2 dsw
doc/guides/rel_notes/release_20_11.rst +5 -0
@@ -295,6 +295,11 @@ New Features Added performance tuning arguments to allow tuning the scheduler for better throughtput in high core count use cases. +* **Added a new driver for the Intel Dynamic Load Balancer v2.0 device.** + + Added the new ``dlb2`` eventdev driver for the Intel DLB V2.0 device. See the + :doc:`../eventdevs/dlb2` eventdev guide for more details on this new driver. + * **Updated ioat rawdev driver** The ioat rawdev driver has been updated and enhanced. Changes include:
drivers/event/dlb2/meson.build new file +15 -0
@@ -0,0 +1,15 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2019-2020 Intel Corporation + +if not is_linux or not dpdk_conf.has('RTE_ARCH_X86_64') + build = false + reason = 'only supported on ARCH_X86_64 Linux' + subdir_done() +endif + +sources = files( +) + +headers = files() + +deps += ['mbuf', 'mempool', 'ring', 'pci', 'bus_pci']
drivers/event/dlb2/version.map new file +3 -0
@@ -0,0 +1,3 @@ +DPDK_21 { + local: *; +};
drivers/event/meson.build +2 -1
@@ -5,7 +5,8 @@ if is_windows subdir_done() endif -drivers = ['dpaa', 'dpaa2', 'octeontx2', 'opdl', 'skeleton', 'sw', 'dsw'] +drivers = ['dlb2', 'dpaa', 'dpaa2', 'octeontx2', 'opdl', 'skeleton', 'sw', + 'dsw'] if not (toolchain == 'gcc' and cc.version().version_compare('<4.8.6') and dpdk_conf.has('RTE_ARCH_ARM64')) drivers += 'octeontx'
Signature · 1 line
2.6.4
PATCH v10 2/23 event/dlb2: add dynamic logging
In reply to Timothy McDanielThis commit adds base support for dynamic logging. The default log level is NOTICE. Dynamic logging is used exclusively throughout this patchset.
--- drivers/event/dlb2/dlb2.c | 7 +++++++ drivers/event/dlb2/dlb2_log.h | 25 +++++++++++++++++++++++++ drivers/event/dlb2/meson.build | 3 +-- 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 drivers/event/dlb2/dlb2.c create mode 100644 drivers/event/dlb2/dlb2_log.h
drivers/event/dlb2/dlb2.c new file +7 -0
@@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2016-2020 Intel Corporation +*/ + +#include <rte_log.h> + +RTE_LOG_REGISTER (eventdev_dlb2_log_level, pmd.event.dlb2,NOTICE );
drivers/event/dlb2/dlb2_log.h new file +25 -0
@@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2016-2020 Intel Corporation +*/ + +#ifndef _DLB2_EVDEV_LOG_H_ +#define _DLB2_EVDEV_LOG_H_ + +extern int eventdev_dlb2_log_level; + +/* Dynamic logging */ +#define DLB2_LOG_IMPL(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, eventdev_dlb2_log_level, "%s" fmt "\n", \ + __func__, ##args) + +#define DLB2_LOG_INFO(fmt, args...) \ + DLB2_LOG_IMPL(INFO, fmt, ## args) + +#define DLB2_LOG_ERR(fmt, args...) \ + DLB2_LOG_IMPL(ERR, fmt, ## args) + +/* remove debug logs at compile time unless actually debugging */ +#define DLB2_LOG_DBG(fmt, args...) \ + RTE_LOG_DP(DEBUG, PMD, fmt, ## args) + +#endif /* _DLB2_EVDEV_LOG_H_ */
drivers/event/dlb2/meson.build +1 -2
@@ -7,8 +7,7 @@ if not is_linux or not dpdk_conf.has('RTE_ARCH_X86_64') subdir_done() endif -sources = files( -) +sources = files('dlb2.c') headers = files()
Signature · 1 line
2.6.4
PATCH v10 3/23 event/dlb2: add private data structures and constants
In reply to Timothy McDanielThe header file dlb2_priv.h is used internally by the PMD. It include constants, macros for device resources, structure definitions for hardware interfaces and software state, and various forward-declarations. The header file rte_pmd_dlb2.h will be exported in a subsequent patch, but is included here due to a data structure dependency.
--- drivers/event/dlb2/dlb2_priv.h | 575 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 575 insertions(+) create mode 100644 drivers/event/dlb2/dlb2_priv.h
drivers/event/dlb2/dlb2_priv.h new file +575 -0
@@ -0,0 +1,575 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2016-2020 Intel Corporation +*/ + +#ifndef _DLB2_PRIV_H_ +#define _DLB2_PRIV_H_ + +#include <emmintrin.h> +#include <stdbool.h> + +#include <rte_eventdev.h> +#include <rte_config.h> +#include "dlb2_user.h" +#include "dlb2_log.h" + +#ifndef RTE_LIBRTE_PMD_DLB2_QUELL_STATS +#define DLB2_INC_STAT (_stat, _incr_val) ((_stat) += _incr_val) +#else +#define DLB2_INC_STAT (_stat, _incr_val) +#endif + +#define EVDEV_DLB2_NAME_PMD dlb2_event + +/* command line arg strings */ +#define NUMA_NODE_ARG "numa_node" +#define DLB2_MAX_NUM_EVENTS "max_num_events" +#define DLB2_NUM_DIR_CREDITS "num_dir_credits" +#define DEV_ID_ARG "dev_id" +#define DLB2_DEFER_SCHED_ARG "defer_sched" +#define DLB2_QID_DEPTH_THRESH_ARG "qid_depth_thresh" +#define DLB2_COS_ARG "cos" + +/* Begin HW related defines and structs */ + +#define DLB2_MAX_NUM_DOMAINS 32 +#define DLB2_MAX_NUM_VFS 16 +#define DLB2_MAX_NUM_LDB_QUEUES 32 +#define DLB2_MAX_NUM_LDB_PORTS 64 +#define DLB2_MAX_NUM_DIR_PORTS 64 +#define DLB2_MAX_NUM_DIR_QUEUES 64 +#define DLB2_MAX_NUM_FLOWS (64 * 1024) +#define DLB2_MAX_NUM_LDB_CREDITS (8 * 1024) +#define DLB2_MAX_NUM_DIR_CREDITS (2 * 1024) +#define DLB2_MAX_NUM_LDB_CREDIT_POOLS 64 +#define DLB2_MAX_NUM_DIR_CREDIT_POOLS 64 +#define DLB2_MAX_NUM_HIST_LIST_ENTRIES 2048 +#define DLB2_MAX_NUM_AQOS_ENTRIES 2048 +#define DLB2_MAX_NUM_QIDS_PER_LDB_CQ 8 +#define DLB2_QID_PRIORITIES 8 +#define DLB2_MAX_DEVICE_PATH 32 +#define DLB2_MIN_DEQUEUE_TIMEOUT_NS 1 +/* Note: "- 1" here to support the timeout range check in eventdev_autotest */ +#define DLB2_MAX_DEQUEUE_TIMEOUT_NS (UINT32_MAX - 1) +#define DLB2_SW_CREDIT_BATCH_SZ 32 +#define DLB2_NUM_SN_GROUPS 2 +#define DLB2_MAX_LDB_SN_ALLOC 1024 +#define DLB2_MAX_QUEUE_DEPTH_THRESHOLD 8191 + +/* 2048 total hist list entries and 64 total ldb ports, which +* makes for 2048/64 == 32 hist list entries per port. However, CQ +* depth must be a power of 2 and must also be >= HIST LIST entries. +* As a result we just limit the maximum dequeue depth to 32. +*/ +#define DLB2_MIN_CQ_DEPTH 1 +#define DLB2_MAX_CQ_DEPTH 32 +#define DLB2_MIN_HARDWARE_CQ_DEPTH 8 +#define DLB2_NUM_HIST_LIST_ENTRIES_PER_LDB_PORT \ + DLB2_MAX_CQ_DEPTH + +/* +* Static per queue/port provisioning values +*/ +#define DLB2_NUM_ATOMIC_INFLIGHTS_PER_QUEUE 64 + +#define CQ_BASE (is_dir) ((is_dir) ? DLB2_DIR_CQ_BASE : DLB2_LDB_CQ_BASE) +#define CQ_SIZE (is_dir) ((is_dir) ? DLB2_DIR_CQ_MAX_SIZE : \ + DLB2_LDB_CQ_MAX_SIZE) +#define PP_BASE (is_dir) ((is_dir) ? DLB2_DIR_PP_BASE : DLB2_LDB_PP_BASE) + +#define PAGE_SIZE (sysconf(_SC_PAGESIZE)) + +#define DLB2_NUM_QES_PER_CACHE_LINE 4 + +#define DLB2_MAX_ENQUEUE_DEPTH 64 +#define DLB2_MIN_ENQUEUE_DEPTH 4 + +#define DLB2_NAME_SIZE 64 + +#define DLB2_1K 1024 +#define DLB2_2K (2 * DLB2_1K) +#define DLB2_4K (4 * DLB2_1K) +#define DLB2_16K (16 * DLB2_1K) +#define DLB2_32K (32 * DLB2_1K) +#define DLB2_1MB (DLB2_1K * DLB2_1K) +#define DLB2_16MB (16 * DLB2_1MB) + +/* Use the upper 3 bits of the event priority to select the DLB2 priority */ +#define EV_TO_DLB2_PRIO (x) ((x) >> 5) +#define DLB2_TO_EV_PRIO (x) ((x) << 5) + +enum dlb2_hw_port_types { +DLB2_LDB_PORT , +DLB2_DIR_PORT , +DLB2_NUM_PORT_TYPES /* Must be last */ +}; + +enum dlb2_hw_queue_types { +DLB2_LDB_QUEUE , +DLB2_DIR_QUEUE , +DLB2_NUM_QUEUE_TYPES /* Must be last */ +}; + +#define PORT_TYPE (p) ((p)->is_directed ? DLB2_DIR_PORT : DLB2_LDB_PORT) + +/* Do not change - must match hardware! */ +enum dlb2_hw_sched_type { +DLB2_SCHED_ATOMIC =0 , +DLB2_SCHED_UNORDERED , +DLB2_SCHED_ORDERED , +DLB2_SCHED_DIRECTED , +/* DLB2_NUM_HW_SCHED_TYPES must be last */ +DLB2_NUM_HW_SCHED_TYPES +}; + +struct dlb2_hw_rsrcs { +int32_t nb_events_limit; +uint32_t num_queues;/* Total queues (lb + dir) */ +uint32_t num_ldb_queues;/* Number of available ldb queues */ +uint32_t num_ldb_ports;/* Number of load balanced ports */ +uint32_t num_dir_ports;/* Number of directed ports */ +uint32_t num_ldb_credits;/* Number of load balanced credits */ +uint32_t num_dir_credits;/* Number of directed credits */ +uint32_t reorder_window_size;/* Size of reorder window */ +}; + +struct dlb2_hw_resource_info { +/**> Max resources that can be provided */ +struct dlb2_hw_rsrcs hw_rsrc_max; +int num_sched_domains; +uint32_t socket_id; +}; + +enum dlb2_enqueue_type { +/**> +* New : Used to inject a new packet into the QM. +*/ +DLB2_ENQ_NEW , +/**> +* Forward : Enqueues a packet, and +* - if atomic: release any lock it holds in the QM +* - if ordered: release the packet for egress re-ordering +*/ +DLB2_ENQ_FWD , +/**> +* Enqueue Drop : Release an inflight packet. Must be called with +* event == NULL. Used to drop a packet. +* +* Note that all packets dequeued from a load-balanced port must be +* released, either with DLB2_ENQ_DROP or DLB2_ENQ_FWD. +*/ +DLB2_ENQ_DROP , + +/* marker for array sizing etc. */ + _DLB2_NB_ENQ_TYPES +}; + +/* hw-specific format - do not change */ + +struct dlb2_event_type { +uint8_t major:4 ; +uint8_t unused:4 ; +uint8_t sub; +}; + +union dlb2_opaque_data { +uint16_t opaque_data; +struct dlb2_event_type event_type; +}; + +struct dlb2_msg_info { +uint8_t qid; +uint8_t sched_type:2 ; +uint8_t priority:3 ; +uint8_t msg_type:3 ; +}; + +#define DLB2_NEW_CMD_BYTE 0x08 +#define DLB2_FWD_CMD_BYTE 0x0A +#define DLB2_COMP_CMD_BYTE 0x02 +#define DLB2_POP_CMD_BYTE 0x01 +#define DLB2_NOOP_CMD_BYTE 0x00 + +/* hw-specific format - do not change */ +struct dlb2_enqueue_qe { +uint64_t data; +/* Word 3 */ +union dlb2_opaque_data u; +uint8_t qid; +uint8_t sched_type:2 ; +uint8_t priority:3 ; +uint8_t msg_type:3 ; +/* Word 4 */ +uint16_t lock_id; +uint8_t meas_lat:1 ; +uint8_t rsvd1:2 ; +uint8_t no_dec:1 ; +uint8_t cmp_id:4 ; +union { +uint8_t cmd_byte; +struct { +uint8_t cq_token:1 ; +uint8_t qe_comp:1 ; +uint8_t qe_frag:1 ; +uint8_t qe_valid:1 ; +uint8_t rsvd3:1 ; +uint8_t error:1 ; +uint8_t rsvd:2 ; + }; + }; +}; + +/* hw-specific format - do not change */ +struct dlb2_cq_pop_qe { +uint64_t data; +union dlb2_opaque_data u; +uint8_t qid; +uint8_t sched_type:2 ; +uint8_t priority:3 ; +uint8_t msg_type:3 ; +uint16_t tokens:10 ; +uint16_t rsvd2:6 ; +uint8_t meas_lat:1 ; +uint8_t rsvd1:2 ; +uint8_t no_dec:1 ; +uint8_t cmp_id:4 ; +union { +uint8_t cmd_byte; +struct { +uint8_t cq_token:1 ; +uint8_t qe_comp:1 ; +uint8_t qe_frag:1 ; +uint8_t qe_valid:1 ; +uint8_t rsvd3:1 ; +uint8_t error:1 ; +uint8_t rsvd:2 ; + }; + }; +}; + +/* hw-specific format - do not change */ +struct dlb2_dequeue_qe { +uint64_t data; +union dlb2_opaque_data u; +uint8_t qid; +uint8_t sched_type:2 ; +uint8_t priority:3 ; +uint8_t msg_type:3 ; +uint16_t flow_id:16 ;/* was pp_id in v1 */ +uint8_t debug; +uint8_t cq_gen:1 ; +uint8_t qid_depth:2 ;/* 2 bits in v2 */ +uint8_t rsvd1:2 ; +uint8_t error:1 ; +uint8_t rsvd2:2 ; +}; + +union dlb2_port_config { +struct dlb2_create_ldb_port_args ldb; +struct dlb2_create_dir_port_args dir; +}; + +enum dlb2_port_state { +PORT_CLOSED , +PORT_STARTED , +PORT_STOPPED +}; + +enum dlb2_configuration_state { +/* The resource has not been configured */ +DLB2_NOT_CONFIGURED , +/* The resource was configured, but the device was stopped */ +DLB2_PREV_CONFIGURED , +/* The resource is currently configured */ +DLB2_CONFIGURED +}; + +struct dlb2_port { +uint32_t id; +bool is_directed; +bool gen_bit; +uint16_t dir_credits; +uint32_t dequeue_depth; +union dlb2_port_config cfg; +uint32_t *credit_pool[DLB2_NUM_QUEUE_TYPES ];/* use __atomic builtins */ +uint16_t cached_ldb_credits; +uint16_t ldb_credits; +uint16_t cached_dir_credits; +bool int_armed; +uint16_t owed_tokens; +int16_t issued_releases; +int cq_depth; +uint16_t cq_idx; +uint16_t cq_idx_unmasked; +uint16_t cq_depth_mask; +uint16_t gen_bit_shift; +enum dlb2_port_state state; +enum dlb2_configuration_state config_state; +int num_mapped_qids; +uint8_t *qid_mappings; +struct dlb2_enqueue_qe *qe4;/* Cache line's worth of QEs (4) */ +struct dlb2_enqueue_qe *int_arm_qe; +struct dlb2_cq_pop_qe *consume_qe; +struct dlb2_eventdev *dlb2;/* back ptr */ +struct dlb2_eventdev_port *ev_port;/* back ptr */ +}; + +/* Per-process per-port mmio and memory pointers */ +struct process_local_port_data { +uint64_t *pp_addr; +struct dlb2_dequeue_qe *cq_base; +const struct rte_memzone *mz; +bool mmaped; +}; + +struct dlb2_eventdev ; + +struct dlb2_config { +int configured; +int reserved; +uint32_t num_ldb_credits; +uint32_t num_dir_credits; +struct dlb2_create_sched_domain_args resources; +}; + +enum dlb2_cos { +DLB2_COS_DEFAULT =-1 , +DLB2_COS_0 =0 , +DLB2_COS_1 , +DLB2_COS_2 , +DLB2_COS_3 +}; + +struct dlb2_hw_dev { +struct dlb2_config cfg; +struct dlb2_hw_resource_info info; +void *pf_dev;/* opaque pointer to PF PMD dev (struct dlb2_dev) */ +uint32_t domain_id; +enum dlb2_cos cos_id; +rte_spinlock_t resource_lock;/* for MP support */ +} __rte_cache_aligned; + +/* End HW related defines and structs */ + +/* Begin DLB2 PMD Eventdev related defines and structs */ + +#define DLB2_MAX_NUM_QUEUES \ + (DLB2_MAX_NUM_DIR_QUEUES + DLB2_MAX_NUM_LDB_QUEUES) + +#define DLB2_MAX_NUM_PORTS (DLB2_MAX_NUM_DIR_PORTS + DLB2_MAX_NUM_LDB_PORTS) +#define DLB2_MAX_INPUT_QUEUE_DEPTH 256 + +/** Structure to hold the queue to port link establishment attributes */ + +struct dlb2_event_queue_link { +uint8_t queue_id; +uint8_t priority; +bool mapped; +bool valid; +}; + +struct dlb2_traffic_stats { +uint64_t rx_ok; +uint64_t rx_drop; +uint64_t rx_interrupt_wait; +uint64_t rx_umonitor_umwait; +uint64_t tx_ok; +uint64_t total_polls; +uint64_t zero_polls; +uint64_t tx_nospc_ldb_hw_credits; +uint64_t tx_nospc_dir_hw_credits; +uint64_t tx_nospc_inflight_max; +uint64_t tx_nospc_new_event_limit; +uint64_t tx_nospc_inflight_credits; +}; + +/* DLB2 HW sets the 2bit qid_depth in rx QEs based on the programmable depth +* threshold. The global default value in config/common_base (or rte_config.h) +* can be overridden on a per-qid basis using a vdev command line parameter. +* 3: depth > threshold +* 2: threshold >= depth > 3/4 threshold +* 1: 3/4 threshold >= depth > 1/2 threshold +* 0: depth <= 1/2 threshold. +*/ +#define DLB2_QID_DEPTH_LE50 0 +#define DLB2_QID_DEPTH_GT50_LE75 1 +#define DLB2_QID_DEPTH_GT75_LE100 2 +#define DLB2_QID_DEPTH_GT100 3 +#define DLB2_NUM_QID_DEPTH_STAT_VALS 4/* 2 bits */ + +struct dlb2_queue_stats { +uint64_t enq_ok; +uint64_t qid_depth[DLB2_NUM_QID_DEPTH_STAT_VALS ]; +}; + +struct dlb2_port_stats { +struct dlb2_traffic_stats traffic; +uint64_t tx_op_cnt[4 ];/* indexed by rte_event.op */ +uint64_t tx_implicit_rel; +uint64_t tx_sched_cnt[DLB2_NUM_HW_SCHED_TYPES ]; +uint64_t tx_invalid; +uint64_t rx_sched_cnt[DLB2_NUM_HW_SCHED_TYPES ]; +uint64_t rx_sched_invalid; +struct dlb2_queue_stats queue[DLB2_MAX_NUM_QUEUES ]; +}; + +struct dlb2_eventdev_port { +struct dlb2_port qm_port;/* hw specific data structure */ +struct rte_event_port_conf conf;/* user-supplied configuration */ +uint16_t inflight_credits;/* num credits this port has right now */ +uint16_t credit_update_quanta; +struct dlb2_eventdev *dlb2;/* backlink optimization */ + struct dlb2_port_stats stats __rte_cache_aligned; +struct dlb2_event_queue_link link[DLB2_MAX_NUM_QIDS_PER_LDB_CQ ]; +int num_links; +uint32_t id;/* port id */ +/* num releases yet to be completed on this port. +* Only applies to load-balanced ports. +*/ +uint16_t outstanding_releases; +uint16_t inflight_max;/* app requested max inflights for this port */ +/* setup_done is set when the event port is setup */ +bool setup_done; +/* enq_configured is set when the qm port is created */ +bool enq_configured; +uint8_t implicit_release;/* release events before dequeueing */ +} __rte_cache_aligned; + +struct dlb2_queue { +uint32_t num_qid_inflights;/* User config */ +uint32_t num_atm_inflights;/* User config */ +enum dlb2_configuration_state config_state; +int sched_type;/* LB queue only */ +uint32_t id; +bool is_directed; +}; + +struct dlb2_eventdev_queue { +struct dlb2_queue qm_queue; +struct rte_event_queue_conf conf;/* User config */ +int depth_threshold;/* use default if 0 */ +uint32_t id; +bool setup_done; +uint8_t num_links; +}; + +enum dlb2_run_state { +DLB2_RUN_STATE_STOPPED =0 , +DLB2_RUN_STATE_STOPPING , +DLB2_RUN_STATE_STARTING , +DLB2_RUN_STATE_STARTED +}; + +struct dlb2_eventdev { +struct dlb2_eventdev_port ev_ports[DLB2_MAX_NUM_PORTS ]; +struct dlb2_eventdev_queue ev_queues[DLB2_MAX_NUM_QUEUES ]; +uint8_t qm_ldb_to_ev_queue_id[DLB2_MAX_NUM_QUEUES ]; +uint8_t qm_dir_to_ev_queue_id[DLB2_MAX_NUM_QUEUES ]; +/* store num stats and offset of the stats for each queue */ +uint16_t xstats_count_per_qid[DLB2_MAX_NUM_QUEUES ]; +uint16_t xstats_offset_for_qid[DLB2_MAX_NUM_QUEUES ]; +/* store num stats and offset of the stats for each port */ +uint16_t xstats_count_per_port[DLB2_MAX_NUM_PORTS ]; +uint16_t xstats_offset_for_port[DLB2_MAX_NUM_PORTS ]; +struct dlb2_get_num_resources_args hw_rsrc_query_results; +uint32_t xstats_count_mode_queue; +struct dlb2_hw_dev qm_instance;/* strictly hw related */ +uint64_t global_dequeue_wait_ticks; +struct dlb2_xstats_entry *xstats; +struct rte_eventdev *event_dev;/* backlink to dev */ +uint32_t xstats_count_mode_dev; +uint32_t xstats_count_mode_port; +uint32_t xstats_count; +uint32_t inflights;/* use __atomic builtins */ +uint32_t new_event_limit; +int max_num_events_override; +int num_dir_credits_override; +volatile enum dlb2_run_state run_state; +uint16_t num_dir_queues;/* total num of evdev dir queues requested */ +uint16_t num_dir_credits; +uint16_t num_ldb_credits; +uint16_t num_queues;/* total queues */ +uint16_t num_ldb_queues;/* total num of evdev ldb queues requested */ +uint16_t num_ports;/* total num of evdev ports requested */ +uint16_t num_ldb_ports;/* total num of ldb ports requested */ +uint16_t num_dir_ports;/* total num of dir ports requested */ +bool umwait_allowed; +bool global_dequeue_wait;/* Not using per dequeue wait if true */ +bool defer_sched; +enum dlb2_cq_poll_modes poll_mode; +uint8_t revision; +bool configured; +uint16_t max_ldb_credits; +uint16_t max_dir_credits; + +/* force hw credit pool counters into exclusive cache lines */ + +/* use __atomic builtins */ /* shared hw cred */ + uint32_t ldb_credit_pool __rte_cache_aligned; +/* use __atomic builtins */ /* shared hw cred */ + uint32_t dir_credit_pool __rte_cache_aligned; +}; + +/* used for collecting and passing around the dev args */ +struct dlb2_qid_depth_thresholds { +int val[DLB2_MAX_NUM_QUEUES ]; +}; + +struct dlb2_devargs { +int socket_id; +int max_num_events; +int num_dir_credits_override; +int dev_id; +int defer_sched; +struct dlb2_qid_depth_thresholds qid_depth_thresholds; +enum dlb2_cos cos_id; +}; + +/* End Eventdev related defines and structs */ + +/* Forwards for non-inlined functions */ + +void dlb2_eventdev_dump (struct rte_eventdev *dev,FILE *f); + +int dlb2_xstats_init (struct dlb2_eventdev *dlb2); + +void dlb2_xstats_uninit (struct dlb2_eventdev *dlb2); + +int dlb2_eventdev_xstats_get (const struct rte_eventdev *dev, +enum rte_event_dev_xstats_mode mode,uint8_t queue_port_id, +const unsigned int ids[],uint64_t values[],unsigned int n); + +int dlb2_eventdev_xstats_get_names (const struct rte_eventdev *dev, +enum rte_event_dev_xstats_mode mode,uint8_t queue_port_id, +struct rte_event_dev_xstats_name *xstat_names, +unsigned int *ids,unsigned int size); + +uint64_t dlb2_eventdev_xstats_get_by_name (const struct rte_eventdev *dev, +const char *name,unsigned int *id); + +int dlb2_eventdev_xstats_reset (struct rte_eventdev *dev, +enum rte_event_dev_xstats_mode mode, +int16_t queue_port_id, +const uint32_t ids[], +uint32_t nb_ids); + +int test_dlb2_eventdev (void ); + +int dlb2_primary_eventdev_probe (struct rte_eventdev *dev, +const char *name, +struct dlb2_devargs *dlb2_args); + +int dlb2_secondary_eventdev_probe (struct rte_eventdev *dev, +const char *name); + +uint32_t dlb2_get_queue_depth (struct dlb2_eventdev *dlb2, +struct dlb2_eventdev_queue *queue); + +int dlb2_parse_params (const char *params, +const char *name, +struct dlb2_devargs *dlb2_args); + +/* Extern globals */ +extern struct process_local_port_data dlb2_port[][DLB2_NUM_PORT_TYPES ]; + +#endif /* _DLB2_PRIV_H_ */
Signature · 1 line
2.6.4
PATCH v10 4/23 event/dlb2: add definitions shared with LKM or shared code
In reply to Timothy McDanielAdd headers containing structs and constants shared between the PMD and the shared code. The term shared code refers to the code that implements the hardware interface. The shared code is introduced in the probe patch, and then is extended as additional eventdev PMD entry points are added to the patchset. In the case of the bifurcated PMD (to be introduced in the future), the shared code is contained in the Linux kernel module itself.
--- drivers/event/dlb2/dlb2_user.h | 679 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 679 insertions(+) create mode 100644 drivers/event/dlb2/dlb2_user.h
drivers/event/dlb2/dlb2_user.h new file +679 -0
@@ -0,0 +1,679 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2016-2020 Intel Corporation +*/ + +#ifndef __DLB2_USER_H +#define __DLB2_USER_H + +#define DLB2_MAX_NAME_LEN 64 + +#include <linux/types.h> + +enum dlb2_error { +DLB2_ST_SUCCESS =0 , +DLB2_ST_NAME_EXISTS , +DLB2_ST_DOMAIN_UNAVAILABLE , +DLB2_ST_LDB_PORTS_UNAVAILABLE , +DLB2_ST_DIR_PORTS_UNAVAILABLE , +DLB2_ST_LDB_QUEUES_UNAVAILABLE , +DLB2_ST_LDB_CREDITS_UNAVAILABLE , +DLB2_ST_DIR_CREDITS_UNAVAILABLE , +DLB2_ST_SEQUENCE_NUMBERS_UNAVAILABLE , +DLB2_ST_INVALID_DOMAIN_ID , +DLB2_ST_INVALID_QID_INFLIGHT_ALLOCATION , +DLB2_ST_ATOMIC_INFLIGHTS_UNAVAILABLE , +DLB2_ST_HIST_LIST_ENTRIES_UNAVAILABLE , +DLB2_ST_INVALID_LDB_QUEUE_ID , +DLB2_ST_INVALID_CQ_DEPTH , +DLB2_ST_INVALID_CQ_VIRT_ADDR , +DLB2_ST_INVALID_PORT_ID , +DLB2_ST_INVALID_QID , +DLB2_ST_INVALID_PRIORITY , +DLB2_ST_NO_QID_SLOTS_AVAILABLE , +DLB2_ST_INVALID_DIR_QUEUE_ID , +DLB2_ST_DIR_QUEUES_UNAVAILABLE , +DLB2_ST_DOMAIN_NOT_CONFIGURED , +DLB2_ST_INTERNAL_ERROR , +DLB2_ST_DOMAIN_IN_USE , +DLB2_ST_DOMAIN_NOT_FOUND , +DLB2_ST_QUEUE_NOT_FOUND , +DLB2_ST_DOMAIN_STARTED , +DLB2_ST_DOMAIN_NOT_STARTED , +DLB2_ST_LDB_PORT_REQUIRED_FOR_LDB_QUEUES , +DLB2_ST_DOMAIN_RESET_FAILED , +DLB2_ST_MBOX_ERROR , +DLB2_ST_INVALID_HIST_LIST_DEPTH , +DLB2_ST_NO_MEMORY , +DLB2_ST_INVALID_LOCK_ID_COMP_LEVEL , +DLB2_ST_INVALID_COS_ID , +}; + +static const char dlb2_error_strings[][128 ] = { +"DLB2_ST_SUCCESS" , +"DLB2_ST_NAME_EXISTS" , +"DLB2_ST_DOMAIN_UNAVAILABLE" , +"DLB2_ST_LDB_PORTS_UNAVAILABLE" , +"DLB2_ST_DIR_PORTS_UNAVAILABLE" , +"DLB2_ST_LDB_QUEUES_UNAVAILABLE" , +"DLB2_ST_LDB_CREDITS_UNAVAILABLE" , +"DLB2_ST_DIR_CREDITS_UNAVAILABLE" , +"DLB2_ST_SEQUENCE_NUMBERS_UNAVAILABLE" , +"DLB2_ST_INVALID_DOMAIN_ID" , +"DLB2_ST_INVALID_QID_INFLIGHT_ALLOCATION" , +"DLB2_ST_ATOMIC_INFLIGHTS_UNAVAILABLE" , +"DLB2_ST_HIST_LIST_ENTRIES_UNAVAILABLE" , +"DLB2_ST_INVALID_LDB_QUEUE_ID" , +"DLB2_ST_INVALID_CQ_DEPTH" , +"DLB2_ST_INVALID_CQ_VIRT_ADDR" , +"DLB2_ST_INVALID_PORT_ID" , +"DLB2_ST_INVALID_QID" , +"DLB2_ST_INVALID_PRIORITY" , +"DLB2_ST_NO_QID_SLOTS_AVAILABLE" , +"DLB2_ST_INVALID_DIR_QUEUE_ID" , +"DLB2_ST_DIR_QUEUES_UNAVAILABLE" , +"DLB2_ST_DOMAIN_NOT_CONFIGURED" , +"DLB2_ST_INTERNAL_ERROR" , +"DLB2_ST_DOMAIN_IN_USE" , +"DLB2_ST_DOMAIN_NOT_FOUND" , +"DLB2_ST_QUEUE_NOT_FOUND" , +"DLB2_ST_DOMAIN_STARTED" , +"DLB2_ST_DOMAIN_NOT_STARTED" , +"DLB2_ST_LDB_PORT_REQUIRED_FOR_LDB_QUEUES" , +"DLB2_ST_DOMAIN_RESET_FAILED" , +"DLB2_ST_MBOX_ERROR" , +"DLB2_ST_INVALID_HIST_LIST_DEPTH" , +"DLB2_ST_NO_MEMORY" , +"DLB2_ST_INVALID_LOCK_ID_COMP_LEVEL" , +"DLB2_ST_INVALID_COS_ID" , +}; + +struct dlb2_cmd_response { +__u32 status;/* Interpret using enum dlb2_error */ +__u32 id; +}; + +/*******************/ +/* 'dlb2' commands */ +/*******************/ + +#define DLB2_DEVICE_VERSION (x) (((x) >> 8) & 0xFF) +#define DLB2_DEVICE_REVISION (x) ((x) & 0xFF) + +enum dlb2_revisions { +DLB2_REV_A0 =0 , +}; + +/* +* DLB2_CMD_GET_DEVICE_VERSION: Query the DLB device version. +* +* This ioctl interface is the same in all driver versions and is always +* the first ioctl. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id[7:0]: Device revision. +* - response.id[15:8]: Device version. +*/ + +struct dlb2_get_device_version_args { +/* Output parameters */ +struct dlb2_cmd_response response; +}; + +/* +* DLB2_CMD_CREATE_SCHED_DOMAIN: Create a DLB 2.0 scheduling domain and reserve +* its hardware resources. This command returns the newly created domain +* ID and a file descriptor for accessing the domain. +* +* Input parameters: +* - num_ldb_queues: Number of load-balanced queues. +* - num_ldb_ports: Number of load-balanced ports that can be allocated from +* any class-of-service with available ports. +* - num_cos_ldb_ports[4]: Number of load-balanced ports from +* classes-of-service 0-3. +* - num_dir_ports: Number of directed ports. A directed port has one directed +* queue, so no num_dir_queues argument is necessary. +* - num_atomic_inflights: This specifies the amount of temporary atomic QE +* storage for the domain. This storage is divided among the domain's +* load-balanced queues that are configured for atomic scheduling. +* - num_hist_list_entries: Amount of history list storage. This is divided +* among the domain's CQs. +* - num_ldb_credits: Amount of load-balanced QE storage (QED). QEs occupy this +* space until they are scheduled to a load-balanced CQ. One credit +* represents the storage for one QE. +* - num_dir_credits: Amount of directed QE storage (DQED). QEs occupy this +* space until they are scheduled to a directed CQ. One credit represents +* the storage for one QE. +* - cos_strict: If set, return an error if there are insufficient ports in +* class-of-service N to satisfy the num_ldb_ports_cosN argument. If +* unset, attempt to fulfill num_ldb_ports_cosN arguments from other +* classes-of-service if class N does not contain enough free ports. +* - padding1: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: domain ID. +* - domain_fd: file descriptor for performing the domain's ioctl operations +* - padding0: Reserved for future use. +*/ +struct dlb2_create_sched_domain_args { +/* Output parameters */ +struct dlb2_cmd_response response; +__u32 domain_fd; +__u32 padding0; +/* Input parameters */ +__u32 num_ldb_queues; +__u32 num_ldb_ports; +__u32 num_cos_ldb_ports[4 ]; +__u32 num_dir_ports; +__u32 num_atomic_inflights; +__u32 num_hist_list_entries; +__u32 num_ldb_credits; +__u32 num_dir_credits; +__u8 cos_strict; +__u8 padding1[3 ]; +}; + +/* +* DLB2_CMD_GET_NUM_RESOURCES: Return the number of available resources +* (queues, ports, etc.) that this device owns. +* +* Output parameters: +* - num_domains: Number of available scheduling domains. +* - num_ldb_queues: Number of available load-balanced queues. +* - num_ldb_ports: Total number of available load-balanced ports. +* - num_cos_ldb_ports[4]: Number of available load-balanced ports from +* classes-of-service 0-3. +* - num_dir_ports: Number of available directed ports. There is one directed +* queue for every directed port. +* - num_atomic_inflights: Amount of available temporary atomic QE storage. +* - num_hist_list_entries: Amount of history list storage. +* - max_contiguous_hist_list_entries: History list storage is allocated in +* a contiguous chunk, and this return value is the longest available +* contiguous range of history list entries. +* - num_ldb_credits: Amount of available load-balanced QE storage. +* - num_dir_credits: Amount of available directed QE storage. +*/ +struct dlb2_get_num_resources_args { +/* Output parameters */ +__u32 num_sched_domains; +__u32 num_ldb_queues; +__u32 num_ldb_ports; +__u32 num_cos_ldb_ports[4 ]; +__u32 num_dir_ports; +__u32 num_atomic_inflights; +__u32 num_hist_list_entries; +__u32 max_contiguous_hist_list_entries; +__u32 num_ldb_credits; +__u32 num_dir_credits; +}; + +/* +* DLB2_CMD_SET_SN_ALLOCATION: Configure a sequence number group (PF only) +* +* Input parameters: +* - group: Sequence number group ID. +* - num: Number of sequence numbers per queue. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_set_sn_allocation_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 group; +__u32 num; +}; + +/* +* DLB2_CMD_GET_SN_ALLOCATION: Get a sequence number group's configuration +* +* Input parameters: +* - group: Sequence number group ID. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: Specified group's number of sequence numbers per queue. +*/ +struct dlb2_get_sn_allocation_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 group; +__u32 padding0; +}; + +/* +* DLB2_CMD_SET_COS_BW: Set a bandwidth allocation percentage for a +* load-balanced port class-of-service (PF only). +* +* Input parameters: +* - cos_id: class-of-service ID, between 0 and 3 (inclusive). +* - bandwidth: class-of-service bandwidth percentage. Total bandwidth +* percentages across all 4 classes cannot exceed 100%. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_set_cos_bw_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 cos_id; +__u32 bandwidth; +}; + +/* +* DLB2_CMD_GET_COS_BW: Get the bandwidth allocation percentage for a +* load-balanced port class-of-service. +* +* Input parameters: +* - cos_id: class-of-service ID, between 0 and 3 (inclusive). +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: Specified class's bandwidth percentage. +*/ +struct dlb2_get_cos_bw_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 cos_id; +__u32 padding0; +}; + +/* +* DLB2_CMD_GET_SN_OCCUPANCY: Get a sequence number group's occupancy +* +* Each sequence number group has one or more slots, depending on its +* configuration. I.e.: +* - If configured for 1024 sequence numbers per queue, the group has 1 slot +* - If configured for 512 sequence numbers per queue, the group has 2 slots +* ... +* - If configured for 32 sequence numbers per queue, the group has 32 slots +* +* This ioctl returns the group's number of in-use slots. If its occupancy is +* 0, the group's sequence number allocation can be reconfigured. +* +* Input parameters: +* - group: Sequence number group ID. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: Specified group's number of used slots. +*/ +struct dlb2_get_sn_occupancy_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 group; +__u32 padding0; +}; + +enum dlb2_cq_poll_modes { +DLB2_CQ_POLL_MODE_STD , +DLB2_CQ_POLL_MODE_SPARSE , + +/* NUM_DLB2_CQ_POLL_MODE must be last */ +NUM_DLB2_CQ_POLL_MODE , +}; + +/* +* DLB2_CMD_QUERY_CQ_POLL_MODE: Query the CQ poll mode setting +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: CQ poll mode (see enum dlb2_cq_poll_modes). +*/ +struct dlb2_query_cq_poll_mode_args { +/* Output parameters */ +struct dlb2_cmd_response response; +}; + +/********************************/ +/* 'scheduling domain' commands */ +/********************************/ + +/* +* DLB2_DOMAIN_CMD_CREATE_LDB_QUEUE: Configure a load-balanced queue. +* Input parameters: +* - num_atomic_inflights: This specifies the amount of temporary atomic QE +* storage for this queue. If zero, the queue will not support atomic +* scheduling. +* - num_sequence_numbers: This specifies the number of sequence numbers used +* by this queue. If zero, the queue will not support ordered scheduling. +* If non-zero, the queue will not support unordered scheduling. +* - num_qid_inflights: The maximum number of QEs that can be inflight +* (scheduled to a CQ but not completed) at any time. If +* num_sequence_numbers is non-zero, num_qid_inflights must be set equal +* to num_sequence_numbers. +* - lock_id_comp_level: Lock ID compression level. Specifies the number of +* unique lock IDs the queue should compress down to. Valid compression +* levels: 0, 64, 128, 256, 512, 1k, 2k, 4k, 64k. If lock_id_comp_level is +* 0, the queue won't compress its lock IDs. +* - depth_threshold: DLB sets two bits in the received QE to indicate the +* depth of the queue relative to the threshold before scheduling the +* QE to a CQ: +* - 2’b11: depth > threshold +* - 2’b10: threshold >= depth > 0.75 * threshold +* - 2’b01: 0.75 * threshold >= depth > 0.5 * threshold +* - 2’b00: depth <= 0.5 * threshold +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: Queue ID. +*/ +struct dlb2_create_ldb_queue_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 num_sequence_numbers; +__u32 num_qid_inflights; +__u32 num_atomic_inflights; +__u32 lock_id_comp_level; +__u32 depth_threshold; +__u32 padding0; +}; + +/* +* DLB2_DOMAIN_CMD_CREATE_DIR_QUEUE: Configure a directed queue. +* Input parameters: +* - port_id: Port ID. If the corresponding directed port is already created, +* specify its ID here. Else this argument must be 0xFFFFFFFF to indicate +* that the queue is being created before the port. +* - depth_threshold: DLB sets two bits in the received QE to indicate the +* depth of the queue relative to the threshold before scheduling the +* QE to a CQ: +* - 2’b11: depth > threshold +* - 2’b10: threshold >= depth > 0.75 * threshold +* - 2’b01: 0.75 * threshold >= depth > 0.5 * threshold +* - 2’b00: depth <= 0.5 * threshold +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: Queue ID. +*/ +struct dlb2_create_dir_queue_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__s32 port_id; +__u32 depth_threshold; +}; + +/* +* DLB2_DOMAIN_CMD_CREATE_LDB_PORT: Configure a load-balanced port. +* Input parameters: +* - cq_depth: Depth of the port's CQ. Must be a power-of-two between 8 and +* 1024, inclusive. +* - cq_depth_threshold: CQ depth interrupt threshold. A value of N means that +* the CQ interrupt won't fire until there are N or more outstanding CQ +* tokens. +* - num_hist_list_entries: Number of history list entries. This must be +* greater than or equal cq_depth. +* - cos_id: class-of-service to allocate this port from. Must be between 0 and +* 3, inclusive. +* - cos_strict: If set, return an error if there are no available ports in the +* requested class-of-service. Else, allocate the port from a different +* class-of-service if the requested class has no available ports. +* +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: port ID. +*/ + +struct dlb2_create_ldb_port_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u16 cq_depth; +__u16 cq_depth_threshold; +__u16 cq_history_list_size; +__u8 cos_id; +__u8 cos_strict; +}; + +/* +* DLB2_DOMAIN_CMD_CREATE_DIR_PORT: Configure a directed port. +* Input parameters: +* - cq_depth: Depth of the port's CQ. Must be a power-of-two between 8 and +* 1024, inclusive. +* - cq_depth_threshold: CQ depth interrupt threshold. A value of N means that +* the CQ interrupt won't fire until there are N or more outstanding CQ +* tokens. +* - qid: Queue ID. If the corresponding directed queue is already created, +* specify its ID here. Else this argument must be 0xFFFFFFFF to indicate +* that the port is being created before the queue. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: Port ID. +*/ +struct dlb2_create_dir_port_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u16 cq_depth; +__u16 cq_depth_threshold; +__s32 queue_id; +}; + +/* +* DLB2_DOMAIN_CMD_START_DOMAIN: Mark the end of the domain configuration. This +* must be called before passing QEs into the device, and no configuration +* ioctls can be issued once the domain has started. Sending QEs into the +* device before calling this ioctl will result in undefined behavior. +* Input parameters: +* - (None) +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_start_domain_args { +/* Output parameters */ +struct dlb2_cmd_response response; +}; + +/* +* DLB2_DOMAIN_CMD_MAP_QID: Map a load-balanced queue to a load-balanced port. +* Input parameters: +* - port_id: Load-balanced port ID. +* - qid: Load-balanced queue ID. +* - priority: Queue->port service priority. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_map_qid_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 port_id; +__u32 qid; +__u32 priority; +__u32 padding0; +}; + +/* +* DLB2_DOMAIN_CMD_UNMAP_QID: Unmap a load-balanced queue to a load-balanced +* port. +* Input parameters: +* - port_id: Load-balanced port ID. +* - qid: Load-balanced queue ID. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_unmap_qid_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 port_id; +__u32 qid; +}; + +/* +* DLB2_DOMAIN_CMD_ENABLE_LDB_PORT: Enable scheduling to a load-balanced port. +* Input parameters: +* - port_id: Load-balanced port ID. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_enable_ldb_port_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 port_id; +__u32 padding0; +}; + +/* +* DLB2_DOMAIN_CMD_ENABLE_DIR_PORT: Enable scheduling to a directed port. +* Input parameters: +* - port_id: Directed port ID. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_enable_dir_port_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 port_id; +}; + +/* +* DLB2_DOMAIN_CMD_DISABLE_LDB_PORT: Disable scheduling to a load-balanced +* port. +* Input parameters: +* - port_id: Load-balanced port ID. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_disable_ldb_port_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 port_id; +__u32 padding0; +}; + +/* +* DLB2_DOMAIN_CMD_DISABLE_DIR_PORT: Disable scheduling to a directed port. +* Input parameters: +* - port_id: Directed port ID. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_disable_dir_port_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 port_id; +__u32 padding0; +}; + +/* +* DLB2_DOMAIN_CMD_GET_LDB_QUEUE_DEPTH: Get a load-balanced queue's depth. +* Input parameters: +* - queue_id: The load-balanced queue ID. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: queue depth. +*/ +struct dlb2_get_ldb_queue_depth_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 queue_id; +__u32 padding0; +}; + +/* +* DLB2_DOMAIN_CMD_DIR_QUEUE_DEPTH: Get a directed queue's depth. +* Input parameters: +* - queue_id: The directed queue ID. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: queue depth. +*/ +struct dlb2_get_dir_queue_depth_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 queue_id; +__u32 padding0; +}; + +/* +* DLB2_DOMAIN_CMD_PENDING_PORT_UNMAPS: Get number of queue unmap operations in +* progress for a load-balanced port. +* +* Note: This is a snapshot; the number of unmap operations in progress +* is subject to change at any time. +* +* Input parameters: +* - port_id: Load-balanced port ID. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: number of unmaps in progress. +*/ +struct dlb2_pending_port_unmaps_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 port_id; +__u32 padding0; +}; + +/* +* Mapping sizes for memory mapping the consumer queue (CQ) memory space, and +* producer port (PP) MMIO space. +*/ +#define DLB2_CQ_SIZE 65536 +#define DLB2_PP_SIZE 4096 + + +#endif /* __DLB2_USER_H */
Signature · 1 line
2.6.4
PATCH v10 5/23 event/dlb2: add inline functions
In reply to Timothy McDanielAdd miscellaneous inline functions that may be called from multiple files. These functions include inline assembly of new x86 instructions, such as movdir64b, since they are not available as builtin functions in the minimum supported GCC version.
--- drivers/event/dlb2/dlb2_inline_fns.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 drivers/event/dlb2/dlb2_inline_fns.h
drivers/event/dlb2/dlb2_inline_fns.h new file +33 -0
@@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2016-2020 Intel Corporation +*/ + +#ifndef _DLB2_INLINE_FNS_H_ +#define _DLB2_INLINE_FNS_H_ + +/* Inline functions required in more than one source file. */ + +static inline struct dlb2_eventdev * +dlb2_pmd_priv (const struct rte_eventdev *eventdev) +{ +return eventdev->data->dev_private; +} + +static inline void +dlb2_movntdq_single (void *pp_addr,void *qe4) +{ +long long *_qe = (long long *)qe4; +__m128i src_data0 = (__m128i ){_qe[0 ], _qe[1 ]}; + +_mm_stream_si128 (pp_addr, src_data0); +} + +static inline void +dlb2_movdir64b (void *dest,void *src) +{ + asmvolatile (".byte 0x66, 0x0f, 0x38, 0xf8, 0x02" + : + :"a" (dest),"d" (src)); +} + +#endif /* _DLB2_INLINE_FNS_H_ */
Signature · 1 line
2.6.4
PATCH v10 6/23 event/dlb2: add eventdev probe
In reply to Timothy McDanielAdd the eventdev portion of probe, and parse command line options, but do not initialize hardware.
Changes since v2 patch-set probe:
Primary and secondary probe-time init has been removed, and will be introduced in subsequent patches contained in the v3 patch-set.
Hardware init has been moved to a subsequent patch in order to minimize the patch size. The files dlb2/pf/dlb2_pf.c and dlb2/pf/dlb_main.c include stubs of hardware init functions, and these will be replaced with the real versions when the hardware layer is committed.
Initialization of the flexible interface layer has been moved to a subsequent patch in order to minimize patch size.
--- drivers/event/dlb2/dlb2.c | 343 ++++ drivers/event/dlb2/meson.build | 5 +- drivers/event/dlb2/pf/base/dlb2_hw_types.h | 367 ++++ drivers/event/dlb2/pf/base/dlb2_mbox.h | 596 ++++++ drivers/event/dlb2/pf/base/dlb2_osdep.h | 230 +++ drivers/event/dlb2/pf/base/dlb2_osdep_bitmap.h | 440 +++++ drivers/event/dlb2/pf/base/dlb2_osdep_list.h | 131 ++ drivers/event/dlb2/pf/base/dlb2_osdep_types.h | 31 + drivers/event/dlb2/pf/base/dlb2_regs.h | 2527 ++++++++++++++++++++++++ drivers/event/dlb2/pf/base/dlb2_resource.h | 1913 ++++++++++++++++++ drivers/event/dlb2/pf/dlb2_main.c | 621 ++++++ drivers/event/dlb2/pf/dlb2_main.h | 98 + drivers/event/dlb2/pf/dlb2_pf.c | 196 ++ 13 files changed, 7497 insertions(+), 1 deletion(-) create mode 100644 drivers/event/dlb2/pf/base/dlb2_hw_types.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_mbox.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_osdep.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_osdep_bitmap.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_osdep_list.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_osdep_types.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_regs.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_resource.h create mode 100644 drivers/event/dlb2/pf/dlb2_main.c create mode 100644 drivers/event/dlb2/pf/dlb2_main.h create mode 100644 drivers/event/dlb2/pf/dlb2_pf.c
drivers/event/dlb2/dlb2.c +343 -0
@@ -2,6 +2,349 @@* Copyright(c) 2016-2020 Intel Corporation */ +#include <assert.h> +#include <errno.h> +#include <nmmintrin.h> +#include <pthread.h> +#include <stdint.h> +#include <stdbool.h> +#include <stdio.h> +#include <string.h> +#include <sys/mman.h> +#include <sys/fcntl.h> + +#include <rte_common.h> +#include <rte_config.h> +#include <rte_cycles.h> +#include <rte_debug.h> +#include <rte_dev.h> +#include <rte_errno.h> +#include <rte_eventdev.h> +#include <rte_eventdev_pmd.h> +#include <rte_io.h> +#include <rte_kvargs.h> #include <rte_log.h> +#include <rte_malloc.h> +#include <rte_mbuf.h> +#include <rte_prefetch.h> +#include <rte_ring.h> +#include <rte_string_fns.h> + +#include "dlb2_priv.h" +#include "dlb2_inline_fns.h" + +/* +* Resources exposed to eventdev. Some values overridden at runtime using +* values returned by the DLB kernel driver. +*/ +#if (RTE_EVENT_MAX_QUEUES_PER_DEV >UINT8_MAX ) +#error "RTE_EVENT_MAX_QUEUES_PER_DEV cannot fit in member max_event_queues" +#endif + +struct process_local_port_data +dlb2_port[DLB2_MAX_NUM_PORTS ][DLB2_NUM_PORT_TYPES ]; + +#define DLB2_BASE_10 10 + +static int +dlb2_string_to_int (int *result,const char *str) +{ +long ret; +char *endptr; + +if (str ==NULL || result ==NULL ) +return -EINVAL ; + + errno =0 ; + ret =strtol (str, &endptr,DLB2_BASE_10 ); +if (errno) +return -errno; + +/* long int and int may be different width for some architectures */ +if (ret <INT_MIN || ret >INT_MAX || endptr == str) +return -EINVAL ; + + *result = ret; +return 0 ; +} + +static int +set_numa_node(const char *key __rte_unused, const char *value, void *opaque) +{ +int *socket_id = opaque; +int ret; + + ret =dlb2_string_to_int (socket_id, value); +if (ret <0 ) +return ret; + +if (*socket_id >RTE_MAX_NUMA_NODES ) +return -EINVAL ; +return 0 ; +} + +static int +set_max_num_events(const char *key __rte_unused, +const char *value, +void *opaque) +{ +int *max_num_events = opaque; +int ret; + +if (value ==NULL || opaque ==NULL ) { +DLB2_LOG_ERR ("NULL pointer\n" ); +return -EINVAL ; + } + + ret =dlb2_string_to_int (max_num_events, value); +if (ret <0 ) +return ret; + +if (*max_num_events <0 || *max_num_events > +DLB2_MAX_NUM_LDB_CREDITS ) { +DLB2_LOG_ERR ("dlb2: max_num_events must be between 0 and %d\n" , +DLB2_MAX_NUM_LDB_CREDITS ); +return -EINVAL ; + } + +return 0 ; +} + +static int +set_num_dir_credits(const char *key __rte_unused, +const char *value, +void *opaque) +{ +int *num_dir_credits = opaque; +int ret; + +if (value ==NULL || opaque ==NULL ) { +DLB2_LOG_ERR ("NULL pointer\n" ); +return -EINVAL ; + } + + ret =dlb2_string_to_int (num_dir_credits, value); +if (ret <0 ) +return ret; + +if (*num_dir_credits <0 || + *num_dir_credits >DLB2_MAX_NUM_DIR_CREDITS ) { +DLB2_LOG_ERR ("dlb2: num_dir_credits must be between 0 and %d\n" , +DLB2_MAX_NUM_DIR_CREDITS ); +return -EINVAL ; + } + +return 0 ; +} + +static int +set_dev_id(const char *key __rte_unused, +const char *value, +void *opaque) +{ +int *dev_id = opaque; +int ret; + +if (value ==NULL || opaque ==NULL ) { +DLB2_LOG_ERR ("NULL pointer\n" ); +return -EINVAL ; + } + + ret =dlb2_string_to_int (dev_id, value); +if (ret <0 ) +return ret; + +return 0 ; +} + +static int +set_cos(const char *key __rte_unused, +const char *value, +void *opaque) +{ +enum dlb2_cos *cos_id = opaque; +int x =0 ; +int ret; + +if (value ==NULL || opaque ==NULL ) { +DLB2_LOG_ERR ("NULL pointer\n" ); +return -EINVAL ; + } + + ret =dlb2_string_to_int (&x, value); +if (ret <0 ) +return ret; + +if (x !=DLB2_COS_DEFAULT && (x <DLB2_COS_0 || x >DLB2_COS_3 )) { +DLB2_LOG_ERR ( +"COS %d out of range, must be DLB2_COS_DEFAULT or 0-3\n" , + x); +return -EINVAL ; + } + + *cos_id = x; + +return 0 ; +} + + +static int +set_qid_depth_thresh(const char *key __rte_unused, +const char *value, +void *opaque) +{ +struct dlb2_qid_depth_thresholds *qid_thresh = opaque; +int first, last, thresh, i; + +if (value ==NULL || opaque ==NULL ) { +DLB2_LOG_ERR ("NULL pointer\n" ); +return -EINVAL ; + } + +/* command line override may take one of the following 3 forms: +* qid_depth_thresh=all:<threshold_value> ... all queues +* qid_depth_thresh=qidA-qidB:<threshold_value> ... a range of queues +* qid_depth_thresh=qid:<threshold_value> ... just one queue +*/ +if (sscanf (value,"all:%d" , &thresh) ==1 ) { + first =0 ; + last =DLB2_MAX_NUM_QUEUES -1 ; + }else if (sscanf (value,"%d-%d:%d" , &first, &last, &thresh) ==3 ) { +/* we have everything we need */ + }else if (sscanf (value,"%d:%d" , &first, &thresh) ==2 ) { + last = first; + }else { +DLB2_LOG_ERR ("Error parsing qid depth devarg. Should be all:val, qid-qid:val, or qid:val\n" ); +return -EINVAL ; + } + +if (first > last || first <0 || last >=DLB2_MAX_NUM_QUEUES ) { +DLB2_LOG_ERR ("Error parsing qid depth devarg, invalid qid value\n" ); +return -EINVAL ; + } + +if (thresh <0 || thresh >DLB2_MAX_QUEUE_DEPTH_THRESHOLD ) { +DLB2_LOG_ERR ("Error parsing qid depth devarg, threshold > %d\n" , +DLB2_MAX_QUEUE_DEPTH_THRESHOLD ); +return -EINVAL ; + } + +for (i = first; i <= last; i++) + qid_thresh->val[i] = thresh;/* indexed by qid */ + +return 0 ; +} + +int +dlb2_primary_eventdev_probe (struct rte_eventdev *dev, +const char *name, +struct dlb2_devargs *dlb2_args) +{ +RTE_SET_USED (dev); +RTE_SET_USED (name); +RTE_SET_USED (dlb2_args); + +return 0 ; +} + +int +dlb2_secondary_eventdev_probe (struct rte_eventdev *dev, +const char *name) +{ +RTE_SET_USED (dev); +RTE_SET_USED (name); + +return 0 ; +} + +int +dlb2_parse_params (const char *params, +const char *name, +struct dlb2_devargs *dlb2_args) +{ +int ret =0 ; +static const char *const args[] = {NUMA_NODE_ARG , +DLB2_MAX_NUM_EVENTS , +DLB2_NUM_DIR_CREDITS , +DEV_ID_ARG , +DLB2_QID_DEPTH_THRESH_ARG , +DLB2_COS_ARG , +NULL }; + +if (params !=NULL && params[0 ] !='\0' ) { +struct rte_kvargs *kvlist =rte_kvargs_parse (params, args); + +if (kvlist ==NULL ) { +RTE_LOG (INFO ,PMD , +"Ignoring unsupported parameters when creating device '%s'\n" , + name); + }else { +int ret =rte_kvargs_process (kvlist,NUMA_NODE_ARG , + set_numa_node, + &dlb2_args->socket_id); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing numa node parameter" , + name); +rte_kvargs_free (kvlist); +return ret; + } + + ret =rte_kvargs_process (kvlist,DLB2_MAX_NUM_EVENTS , + set_max_num_events, + &dlb2_args->max_num_events); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing max_num_events parameter" , + name); +rte_kvargs_free (kvlist); +return ret; + } + + ret =rte_kvargs_process (kvlist, +DLB2_NUM_DIR_CREDITS , + set_num_dir_credits, + &dlb2_args->num_dir_credits_override); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing num_dir_credits parameter" , + name); +rte_kvargs_free (kvlist); +return ret; + } + + ret =rte_kvargs_process (kvlist,DEV_ID_ARG , + set_dev_id, + &dlb2_args->dev_id); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing dev_id parameter" , + name); +rte_kvargs_free (kvlist); +return ret; + } + + ret =rte_kvargs_process ( + kvlist, +DLB2_QID_DEPTH_THRESH_ARG , + set_qid_depth_thresh, + &dlb2_args->qid_depth_thresholds); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing qid_depth_thresh parameter" , + name); +rte_kvargs_free (kvlist); +return ret; + } + + ret =rte_kvargs_process (kvlist,DLB2_COS_ARG , + set_cos, + &dlb2_args->cos_id); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing cos parameter" , + name); +rte_kvargs_free (kvlist); +return ret; + } +rte_kvargs_free (kvlist); + } + } +return ret; +}RTE_LOG_REGISTER (eventdev_dlb2_log_level, pmd.event.dlb2,NOTICE );
drivers/event/dlb2/meson.build +4 -1
@@ -7,7 +7,10 @@ if not is_linux or not dpdk_conf.has('RTE_ARCH_X86_64') subdir_done() endif -sources = files('dlb2.c') +sources = files('dlb2.c', + 'pf/dlb2_main.c', + 'pf/dlb2_pf.c' +) headers = files()
drivers/event/dlb2/pf/base/dlb2_hw_types.h new file +367 -0
367 lines not on this page · raw message
drivers/event/dlb2/pf/base/dlb2_mbox.h new file +596 -0
596 lines not on this page · raw message
drivers/event/dlb2/pf/base/dlb2_osdep.h new file +230 -0
230 lines not on this page · raw message
drivers/event/dlb2/pf/base/dlb2_osdep_bitmap.h new file +440 -0
440 lines not on this page · raw message
drivers/event/dlb2/pf/base/dlb2_osdep_list.h new file +131 -0
131 lines not on this page · raw message
drivers/event/dlb2/pf/base/dlb2_osdep_types.h new file +31 -0
@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2016-2020 Intel Corporation +*/ + +#ifndef __DLB2_OSDEP_TYPES_H +#define __DLB2_OSDEP_TYPES_H + +#include <linux/types.h> + +#include <inttypes.h> +#include <ctype.h> +#include <stdint.h> +#include <stdbool.h> +#include <string.h> +#include <unistd.h> +#include <errno.h> + +/* Types for user mode PF PMD */ +typedef uint8_t u8 ; +typedef int8_t s8 ; +typedef uint16_t u16 ; +typedef int16_t s16 ; +typedef uint32_t u32 ; +typedef int32_t s32 ; +typedef uint64_t u64 ; + +#define __iomem + +/* END types for user mode PF PMD */ + +#endif /* __DLB2_OSDEP_TYPES_H */
drivers/event/dlb2/pf/base/dlb2_regs.h new file +2527 -0
845 lines not on this page · raw message
drivers/event/dlb2/pf/base/dlb2_resource.h new file +1913 -0
1,913 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_main.c new file +621 -0
621 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_main.h new file +98 -0
98 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_pf.c new file +196 -0
196 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.6.4
Part of the diff is not shown here. View the raw message.
PATCH v10 7/23 event/dlb2: add flexible interface
In reply to Timothy McDanielThis commit introduces the flexible interface. This interface allows the core code to operate in PF mode (direct hardware access) or bifurcated mode (hardware configured via kernel driver). This driver currently only supports PF mode but bifurcated mode will be added in a future DPDK patch-set. Note that the flexible interface is not used for data path operations, and thus there are no performance concerns related to the use of function pointers.
--- drivers/event/dlb2/dlb2_iface.c | 28 ++++++++++++++++++++++++++++ drivers/event/dlb2/dlb2_iface.h | 29 +++++++++++++++++++++++++++++ drivers/event/dlb2/meson.build | 1 + 3 files changed, 58 insertions(+) create mode 100644 drivers/event/dlb2/dlb2_iface.c create mode 100644 drivers/event/dlb2/dlb2_iface.h
drivers/event/dlb2/dlb2_iface.c new file +28 -0
@@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2016-2020 Intel Corporation +*/ + +#include <stdint.h> + +#include "dlb2_priv.h" + +/* DLB2 PMD Internal interface function pointers. +* If VDEV (bifurcated PMD), these will resolve to functions that issue ioctls +* serviced by DLB kernel module. +* If PCI (PF PMD), these will be implemented locally in user mode. +*/ + +void (*dlb2_iface_low_level_io_init)(void ); + +int (*dlb2_iface_open)(struct dlb2_hw_dev *handle,const char *name); + +int (*dlb2_iface_get_device_version)(struct dlb2_hw_dev *handle, +uint8_t *revision); + +void (*dlb2_iface_hardware_init)(struct dlb2_hw_dev *handle); + +int (*dlb2_iface_get_cq_poll_mode)(struct dlb2_hw_dev *handle, +enum dlb2_cq_poll_modes *mode); + +int (*dlb2_iface_get_num_resources)(struct dlb2_hw_dev *handle, +struct dlb2_get_num_resources_args *rsrcs);
drivers/event/dlb2/dlb2_iface.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2016-2020 Intel Corporation +*/ + +#ifndef _DLB2_IFACE_H_ +#define _DLB2_IFACE_H_ + +/* DLB2 PMD Internal interface function pointers. +* If VDEV (bifurcated PMD), these will resolve to functions that issue ioctls +* serviced by DLB kernel module. +* If PCI (PF PMD), these will be implemented locally in user mode. +*/ + +extern void (*dlb2_iface_low_level_io_init)(void ); + +extern int (*dlb2_iface_open)(struct dlb2_hw_dev *handle,const char *name); + +extern int (*dlb2_iface_get_device_version)(struct dlb2_hw_dev *handle, +uint8_t *revision); + +extern void (*dlb2_iface_hardware_init)(struct dlb2_hw_dev *handle); + +extern int (*dlb2_iface_get_cq_poll_mode)(struct dlb2_hw_dev *handle, +enum dlb2_cq_poll_modes *mode); + +extern int (*dlb2_iface_get_num_resources)(struct dlb2_hw_dev *handle, +struct dlb2_get_num_resources_args *rsrcs); + +#endif /* _DLB2_IFACE_H_ */
drivers/event/dlb2/meson.build +1 -0
@@ -8,6 +8,7 @@ if not is_linux or not dpdk_conf.has('RTE_ARCH_X86_64') endif sources = files('dlb2.c', + 'dlb2_iface.c', 'pf/dlb2_main.c', 'pf/dlb2_pf.c' )
Signature · 1 line
2.6.4
PATCH v10 8/23 event/dlb2: add probe-time hardware init
In reply to Timothy McDanielThis commit adds probe-time low level hardware initialization. It also adds probe-time init for both primary and secondary DPDK processes.
--- drivers/event/dlb2/dlb2.c | 188 +++++++++++++++++++- drivers/event/dlb2/meson.build | 3 +- drivers/event/dlb2/pf/base/dlb2_resource.c | 274 +++++++++++++++++++++++++++++ drivers/event/dlb2/pf/dlb2_main.c | 23 +-- drivers/event/dlb2/pf/dlb2_main.h | 1 - drivers/event/dlb2/pf/dlb2_pf.c | 78 ++++++-- 6 files changed, 523 insertions(+), 44 deletions(-) create mode 100644 drivers/event/dlb2/pf/base/dlb2_resource.c
drivers/event/dlb2/dlb2.c +183 -5
@@ -31,6 +31,7 @@#include <rte_string_fns.h> #include "dlb2_priv.h" +#include "dlb2_iface.h" #include "dlb2_inline_fns.h" /*
@@ -40,10 +41,108 @@#if (RTE_EVENT_MAX_QUEUES_PER_DEV >UINT8_MAX )#error "RTE_EVENT_MAX_QUEUES_PER_DEV cannot fit in member max_event_queues"#endif +static struct rte_event_dev_info evdev_dlb2_default_info = { + .driver_name ="" ,/* probe will set */ + .min_dequeue_timeout_ns =DLB2_MIN_DEQUEUE_TIMEOUT_NS , + .max_dequeue_timeout_ns =DLB2_MAX_DEQUEUE_TIMEOUT_NS , +#if (RTE_EVENT_MAX_QUEUES_PER_DEV < DLB2_MAX_NUM_LDB_QUEUES) + .max_event_queues =RTE_EVENT_MAX_QUEUES_PER_DEV , +#else + .max_event_queues =DLB2_MAX_NUM_LDB_QUEUES , +#endif + .max_event_queue_flows =DLB2_MAX_NUM_FLOWS , + .max_event_queue_priority_levels =DLB2_QID_PRIORITIES , + .max_event_priority_levels =DLB2_QID_PRIORITIES , + .max_event_ports =DLB2_MAX_NUM_LDB_PORTS , + .max_event_port_dequeue_depth =DLB2_MAX_CQ_DEPTH , + .max_event_port_enqueue_depth =DLB2_MAX_ENQUEUE_DEPTH , + .max_event_port_links =DLB2_MAX_NUM_QIDS_PER_LDB_CQ , + .max_num_events =DLB2_MAX_NUM_LDB_CREDITS , + .max_single_link_event_port_queue_pairs =DLB2_MAX_NUM_DIR_PORTS , + .event_dev_cap = (RTE_EVENT_DEV_CAP_QUEUE_QOS | +RTE_EVENT_DEV_CAP_EVENT_QOS | +RTE_EVENT_DEV_CAP_BURST_MODE | +RTE_EVENT_DEV_CAP_DISTRIBUTED_SCHED | +RTE_EVENT_DEV_CAP_IMPLICIT_RELEASE_DISABLE | +RTE_EVENT_DEV_CAP_QUEUE_ALL_TYPES ), +};struct process_local_port_data dlb2_port[DLB2_MAX_NUM_PORTS ][DLB2_NUM_PORT_TYPES ]; +/* override defaults with value(s) provided on command line */ +static void +dlb2_init_queue_depth_thresholds (struct dlb2_eventdev *dlb2, +int *qid_depth_thresholds) +{ +int q; + +for (q =0 ; q <DLB2_MAX_NUM_QUEUES ; q++) { +if (qid_depth_thresholds[q] !=0 ) + dlb2->ev_queues[q].depth_threshold = + qid_depth_thresholds[q]; + } +} + +static int +dlb2_hw_query_resources (struct dlb2_eventdev *dlb2) +{ +struct dlb2_hw_dev *handle = &dlb2->qm_instance; +struct dlb2_hw_resource_info *dlb2_info = &handle->info; +int ret; + +/* Query driver resources provisioned for this device */ + + ret =dlb2_iface_get_num_resources (handle, + &dlb2->hw_rsrc_query_results); +if (ret) { +DLB2_LOG_ERR ("ioctl get dlb2 num resources, err=%d\n" , ret); +return ret; + } + +/* Complete filling in device resource info returned to evdev app, +* overriding any default values. +* The capabilities (CAPs) were set at compile time. +*/ + + evdev_dlb2_default_info.max_event_queues = + dlb2->hw_rsrc_query_results.num_ldb_queues; + + evdev_dlb2_default_info.max_event_ports = + dlb2->hw_rsrc_query_results.num_ldb_ports; + + evdev_dlb2_default_info.max_num_events = + dlb2->hw_rsrc_query_results.num_ldb_credits; + +/* Save off values used when creating the scheduling domain. */ + + handle->info.num_sched_domains = + dlb2->hw_rsrc_query_results.num_sched_domains; + + handle->info.hw_rsrc_max.nb_events_limit = + dlb2->hw_rsrc_query_results.num_ldb_credits; + + handle->info.hw_rsrc_max.num_queues = + dlb2->hw_rsrc_query_results.num_ldb_queues + + dlb2->hw_rsrc_query_results.num_dir_ports; + + handle->info.hw_rsrc_max.num_ldb_queues = + dlb2->hw_rsrc_query_results.num_ldb_queues; + + handle->info.hw_rsrc_max.num_ldb_ports = + dlb2->hw_rsrc_query_results.num_ldb_ports; + + handle->info.hw_rsrc_max.num_dir_ports = + dlb2->hw_rsrc_query_results.num_dir_ports; + + handle->info.hw_rsrc_max.reorder_window_size = + dlb2->hw_rsrc_query_results.num_hist_list_entries; + +rte_memcpy (dlb2_info, &handle->info.hw_rsrc_max,sizeof (*dlb2_info)); + +return 0 ; +} +#define DLB2_BASE_10 10 static int
@@ -235,14 +334,71 @@ set_qid_depth_thresh(const char *key __rte_unused,return 0 ; } +static void +dlb2_entry_points_init (struct rte_eventdev *dev) +{ +RTE_SET_USED (dev); + +/* Eventdev PMD entry points */ +} +int dlb2_primary_eventdev_probe (struct rte_eventdev *dev,const char *name,struct dlb2_devargs *dlb2_args) { -RTE_SET_USED (dev); -RTE_SET_USED (name); -RTE_SET_USED (dlb2_args); +struct dlb2_eventdev *dlb2; +int err; + + dlb2 = dev->data->dev_private; + + dlb2->event_dev = dev;/* backlink */ + + evdev_dlb2_default_info.driver_name = name; + + dlb2->max_num_events_override = dlb2_args->max_num_events; + dlb2->num_dir_credits_override = dlb2_args->num_dir_credits_override; + dlb2->qm_instance.cos_id = dlb2_args->cos_id; + + err =dlb2_iface_open (&dlb2->qm_instance, name); +if (err <0 ) { +DLB2_LOG_ERR ("could not open event hardware device, err=%d\n" , + err); +return err; + } + + err =dlb2_iface_get_device_version (&dlb2->qm_instance, + &dlb2->revision); +if (err <0 ) { +DLB2_LOG_ERR ("dlb2: failed to get the device version, err=%d\n" , + err); +return err; + } + + err =dlb2_hw_query_resources (dlb2); +if (err) { +DLB2_LOG_ERR ("get resources err=%d for %s\n" , + err, name); +return err; + } + +dlb2_iface_hardware_init (&dlb2->qm_instance); + + err =dlb2_iface_get_cq_poll_mode (&dlb2->qm_instance, &dlb2->poll_mode); +if (err <0 ) { +DLB2_LOG_ERR ("dlb2: failed to get the poll mode, err=%d\n" , + err); +return err; + } + +rte_spinlock_init (&dlb2->qm_instance.resource_lock); + +dlb2_iface_low_level_io_init (); + +dlb2_entry_points_init (dev); + +dlb2_init_queue_depth_thresholds (dlb2, + dlb2_args->qid_depth_thresholds.val);return 0 ; }
@@ -251,8 +407,30 @@ int dlb2_secondary_eventdev_probe(struct rte_eventdev *dev, const char *name) { -RTE_SET_USED (dev); -RTE_SET_USED (name); + struct dlb2_eventdev *dlb2; +int err; + + dlb2 = dev->data->dev_private; + + evdev_dlb2_default_info.driver_name = name; + + err =dlb2_iface_open (&dlb2->qm_instance, name); +if (err <0 ) { +DLB2_LOG_ERR ("could not open event hardware device, err=%d\n" , + err); +return err; + } + + err =dlb2_hw_query_resources (dlb2); +if (err) { +DLB2_LOG_ERR ("get resources err=%d for %s\n" , + err, name); +return err; + } + +dlb2_iface_low_level_io_init (); + +dlb2_entry_points_init (dev);return 0 ; }
drivers/event/dlb2/meson.build +2 -1
@@ -10,7 +10,8 @@ endif sources = files('dlb2.c', 'dlb2_iface.c', 'pf/dlb2_main.c', - 'pf/dlb2_pf.c' + 'pf/dlb2_pf.c', + 'pf/base/dlb2_resource.c' ) headers = files()
drivers/event/dlb2/pf/base/dlb2_resource.c new file +274 -0
274 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_main.c +1 -22
@@ -19,6 +19,7 @@#include "dlb2_main.h" #include "../dlb2_user.h" #include "../dlb2_priv.h" +#include "../dlb2_iface.h" #include "../dlb2_inline_fns.h" #define PF_ID_ZERO 0/* PF ONLY! */
@@ -72,27 +73,6 @@#define DLB2_PCI_ACS_UF 0x10#define DLB2_PCI_ACS_EC 0x20 -/* Stubs: Allow building partial probe patch */ -void dlb2_resource_free (struct dlb2_hw *hw) -{ -RTE_SET_USED (hw); -} - -int dlb2_resource_init (struct dlb2_hw *hw) -{ -int ret =0 ; -RTE_SET_USED (hw); - -return ret; -} - -void dlb2_clr_pmcsr_disable (struct dlb2_hw *hw) -{ -RTE_SET_USED (hw); -} - -/* End stubs */ -static int dlb2_pci_find_ext_capability (struct rte_pci_device *pdev,uint32_t id) {
@@ -149,7 +129,6 @@ static int dlb2_pf_init_driver_state(struct dlb2_dev *dlb2_dev) {rte_spinlock_init (&dlb2_dev->resource_mutex); -rte_spinlock_init (&dlb2_dev->measurement_lock);return 0 ; }
drivers/event/dlb2/pf/dlb2_main.h +0 -1
@@ -38,7 +38,6 @@ struct dlb2_dev {* hardware registers. */ rte_spinlock_t resource_mutex; -rte_spinlock_t measurement_lock;bool worker_launched;u8 revision; };
drivers/event/dlb2/pf/dlb2_pf.c +63 -15
104 lines not on this page · raw message
Signature · 1 line
2.6.4
PATCH v10 9/23 event/dlb2: add xstats
In reply to Timothy McDanielAdd support for DLB2 xstats. Perform initialization and add standard xstats entry points.
--- drivers/event/dlb2/dlb2.c | 35 +- drivers/event/dlb2/dlb2_xstats.c | 1235 ++++++++++++++++++++++++++++++++++++++ drivers/event/dlb2/meson.build | 1 + 3 files changed, 1268 insertions(+), 3 deletions(-) create mode 100644 drivers/event/dlb2/dlb2_xstats.c
drivers/event/dlb2/dlb2.c +32 -3
@@ -70,6 +70,21 @@ static struct rte_event_dev_info evdev_dlb2_default_info = {struct process_local_port_data dlb2_port[DLB2_MAX_NUM_PORTS ][DLB2_NUM_PORT_TYPES ]; +/* +* DUMMY - added so that xstats path will compile/link. +* Will be replaced by real version in a subsequent +* patch. +*/ +uint32_t +dlb2_get_queue_depth (struct dlb2_eventdev *dlb2, +struct dlb2_eventdev_queue *queue) +{ +RTE_SET_USED (dlb2); +RTE_SET_USED (queue); + +return 0 ; +} +/* override defaults with value(s) provided on command line */ static void dlb2_init_queue_depth_thresholds(struct dlb2_eventdev *dlb2,
@@ -337,9 +352,16 @@ set_qid_depth_thresh(const char *key __rte_unused,static void dlb2_entry_points_init (struct rte_eventdev *dev) { -RTE_SET_USED (dev); - -/* Eventdev PMD entry points */ +/* Expose PMD's eventdev interface */ +static struct rte_eventdev_ops dlb2_eventdev_entry_ops = { + .dump = dlb2_eventdev_dump, + .xstats_get = dlb2_eventdev_xstats_get, + .xstats_get_names = dlb2_eventdev_xstats_get_names, + .xstats_get_by_name = dlb2_eventdev_xstats_get_by_name, + .xstats_reset = dlb2_eventdev_xstats_reset, + }; + + dev->dev_ops = &dlb2_eventdev_entry_ops; }int
@@ -391,6 +413,13 @@ dlb2_primary_eventdev_probe(struct rte_eventdev *dev,return err; } +/* Complete xtstats runtime initialization */ + err =dlb2_xstats_init (dlb2); +if (err) { +DLB2_LOG_ERR ("dlb2: failed to init xstats, err=%d\n" , err); +return err; + } +rte_spinlock_init (&dlb2->qm_instance.resource_lock);dlb2_iface_low_level_io_init ();
drivers/event/dlb2/dlb2_xstats.c new file +1235 -0
1,235 lines not on this page · raw message
drivers/event/dlb2/meson.build +1 -0
@@ -9,6 +9,7 @@ endif sources = files('dlb2.c', 'dlb2_iface.c', + 'dlb2_xstats.c', 'pf/dlb2_main.c', 'pf/dlb2_pf.c', 'pf/base/dlb2_resource.c'
Signature · 1 line
2.6.4
PATCH v10 10/23 event/dlb2: add infos get and configure
In reply to Timothy McDanielAdd support for configuring the DLB2 hardware.
In particular, this patch configures the DLB2 hardware's scheduling domain, such that it is provisioned with the requested number of ports and queues, provided sufficient resources are available. Individual queues and ports are configured later in port setup and eventdev start.
--- doc/guides/eventdevs/dlb2.rst | 116 + drivers/event/dlb2/dlb2.c | 313 +++ drivers/event/dlb2/dlb2_iface.c | 5 + drivers/event/dlb2/dlb2_iface.h | 4 + drivers/event/dlb2/pf/base/dlb2_resource.c | 3237 ++++++++++++++++++++++++++++ drivers/event/dlb2/pf/dlb2_main.c | 15 + drivers/event/dlb2/pf/dlb2_pf.c | 44 + 7 files changed, 3734 insertions(+)
doc/guides/eventdevs/dlb2.rst +116 -0
@@ -32,9 +32,125 @@ detailed understanding of the hardware, but these details are important when writing high-performance code. This section describes the places where the eventdev API and DLB2 misalign. +Scheduling Domain Configuration +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +There are 32 scheduling domainis the DLB2. +When one is configured, it allocates load-balanced and +directed queues, ports, credits, and other hardware resources. Some +resource allocations are user-controlled -- the number of queues, for example +-- and others, like credit pools (one directed and one load-balanced pool per +scheduling domain), are not. + +The DLB2 is a closed system eventdev, and as such the ``nb_events_limit`` device +setup argument and the per-port ``new_event_threshold`` argument apply as +defined in the eventdev header file. The limit is applied to all enqueues, +regardless of whether it will consume a directed or load-balanced credit. + +Load-balanced and Directed Ports +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +DLB2 ports come in two flavors: load-balanced and directed. The eventdev API +does not have the same concept, but it has a similar one: ports and queues that +are singly-linked (i.e. linked to a single queue or port, respectively). + +The ``rte_event_dev_info_get()`` function reports the number of available +event ports and queues (among other things). For the DLB2 PMD, max_event_ports +and max_event_queues report the number of available load-balanced ports and +queues, and max_single_link_event_port_queue_pairs reports the number of +available directed ports and queues. + +When a scheduling domain is created in ``rte_event_dev_configure()``, the user +specifies ``nb_event_ports`` and ``nb_single_link_event_port_queues``, which +control the total number of ports (load-balanced and directed) and the number +of directed ports. Hence, the number of requested load-balanced ports is +``nb_event_ports - nb_single_link_event_ports``. The ``nb_event_queues`` field +specifies the total number of queues (load-balanced and directed). The number +of directed queues comes from ``nb_single_link_event_port_queues``, since +directed ports and queues come in pairs. + +When a port is setup, the ``RTE_EVENT_PORT_CFG_SINGLE_LINK`` flag determines +whether it should be configured as a directed (the flag is set) or a +load-balanced (the flag is unset) port. Similarly, the +``RTE_EVENT_QUEUE_CFG_SINGLE_LINK`` queue configuration flag controls +whether it is a directed or load-balanced queue. + +Load-balanced ports can only be linked to load-balanced queues, and directed +ports can only be linked to directed queues. Furthermore, directed ports can +only be linked to a single directed queue (and vice versa), and that link +cannot change after the eventdev is started. + +The eventdev API does not have a directed scheduling type. To support directed +traffic, the dlb PMD detects when an event is being sent to a directed queue +and overrides its scheduling type. Note that the originally selected scheduling +type (atomic, ordered, or parallel) is not preserved, and an event's sched_type +will be set to ``RTE_SCHED_TYPE_ATOMIC`` when it is dequeued from a directed +port. + Flow ID ~~~~~~~ The flow ID field is preserved in the event when it is scheduled in the DLB2. +Reconfiguration +~~~~~~~~~~~~~~~ + +The Eventdev API allows one to reconfigure a device, its ports, and its queues +by first stopping the device, calling the configuration function(s), then +restarting the device. The DLB2 does not support configuring an individual queue +or port without first reconfiguring the entire device, however, so there are +certain reconfiguration sequences that are valid in the eventdev API but not +supported by the PMD. + +Specifically, the PMD supports the following configuration sequence: +1. Configure and start the device +2. Stop the device +3. (Optional) Reconfigure the device +4. (Optional) If step 3 is run: + + a. Setup queue(s). The reconfigured queue(s) lose their previous port links. + b. The reconfigured port(s) lose their previous queue links. + +5. (Optional, only if steps 4a and 4b are run) Link port(s) to queue(s) +6. Restart the device. If the device is reconfigured in step 3 but one or more + of its ports or queues are not, the PMD will apply their previous + configuration (including port->queue links) at this time. + +The PMD does not support the following configuration sequences: +1. Configure and start the device +2. Stop the device +3. Setup queue or setup port +4. Start the device + +This sequence is not supported because the event device must be reconfigured +before its ports or queues can be. + +Atomic Inflights Allocation +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In the last stage prior to scheduling an atomic event to a CQ, DLB2 holds the +inflight event in a temporary buffer that is divided among load-balanced +queues. If a queue's atomic buffer storage fills up, this can result in +head-of-line-blocking. For example: + +- An LDB queue allocated N atomic buffer entries +- All N entries are filled with events from flow X, which is pinned to CQ 0. + +Until CQ 0 releases 1+ events, no other atomic flows for that LDB queue can be +scheduled. The likelihood of this case depends on the eventdev configuration, +traffic behavior, event processing latency, potential for a worker to be +interrupted or otherwise delayed, etc. + +By default, the PMD allocates 16 buffer entries for each load-balanced queue, +which provides an even division across all 128 queues but potentially wastes +buffer space (e.g. if not all queues are used, or aren't used for atomic +scheduling). + +The PMD provides a dev arg to override the default per-queue allocation. To +increase a vdev's per-queue atomic-inflight allocation to (for example) 64: + + .. code-block:: console + + --vdev=dlb1_event,atm_inflights=64 +
drivers/event/dlb2/dlb2.c +313 -0
329 lines not on this page · raw message
drivers/event/dlb2/dlb2_iface.c +5 -0
@@ -26,3 +26,8 @@ int (*dlb2_iface_get_cq_poll_mode)(struct dlb2_hw_dev *handle,int (*dlb2_iface_get_num_resources)(struct dlb2_hw_dev *handle,struct dlb2_get_num_resources_args *rsrcs); + +int (*dlb2_iface_sched_domain_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_sched_domain_args *args); + +void (*dlb2_iface_domain_reset)(struct dlb2_eventdev *dlb2);
drivers/event/dlb2/dlb2_iface.h +4 -0
@@ -26,4 +26,8 @@ extern int (*dlb2_iface_get_cq_poll_mode)(struct dlb2_hw_dev *handle,extern int (*dlb2_iface_get_num_resources)(struct dlb2_hw_dev *handle,struct dlb2_get_num_resources_args *rsrcs); +extern int (*dlb2_iface_sched_domain_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_sched_domain_args *args); + +extern void (*dlb2_iface_domain_reset)(struct dlb2_eventdev *dlb2);#endif /* _DLB2_IFACE_H_ */
drivers/event/dlb2/pf/base/dlb2_resource.c +3237 -0
2,530 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_pf.c +44 -0
44 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.6.4
Part of the diff is not shown here. View the raw message.
PATCH v10 11/23 event/dlb2: add queue and port default conf
In reply to Timothy McDanielAdd support for getting the queue and port default configuration.
--- drivers/event/dlb2/dlb2.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
drivers/event/dlb2/dlb2.c +30 -0
@@ -661,12 +661,42 @@ dlb2_eventdev_configure(const struct rte_eventdev *dev) }static void +dlb2_eventdev_port_default_conf_get (struct rte_eventdev *dev, +uint8_t port_id, +struct rte_event_port_conf *port_conf) +{ +RTE_SET_USED (port_id); +struct dlb2_eventdev *dlb2 =dlb2_pmd_priv (dev); + + port_conf->new_event_threshold = dlb2->new_event_limit; + port_conf->dequeue_depth =32 ; + port_conf->enqueue_depth =DLB2_MAX_ENQUEUE_DEPTH ; + port_conf->event_port_cfg =0 ; +} + +static void +dlb2_eventdev_queue_default_conf_get (struct rte_eventdev *dev, +uint8_t queue_id, +struct rte_event_queue_conf *queue_conf) +{ +RTE_SET_USED (dev); +RTE_SET_USED (queue_id); + + queue_conf->nb_atomic_flows =1024 ; + queue_conf->nb_atomic_order_sequences =64 ; + queue_conf->event_queue_cfg =0 ; + queue_conf->priority =0 ; +} + +static void dlb2_entry_points_init (struct rte_eventdev *dev) {/* Expose PMD's eventdev interface */ static struct rte_eventdev_ops dlb2_eventdev_entry_ops = { .dev_infos_get = dlb2_eventdev_info_get, .dev_configure = dlb2_eventdev_configure, + .queue_def_conf = dlb2_eventdev_queue_default_conf_get, + .port_def_conf = dlb2_eventdev_port_default_conf_get, .dump = dlb2_eventdev_dump, .xstats_get = dlb2_eventdev_xstats_get, .xstats_get_names = dlb2_eventdev_xstats_get_names,
Signature · 1 line
2.6.4
PATCH v10 12/23 event/dlb2: add queue setup
In reply to Timothy McDanielLoad balanced (ldb) queues are setup here. Directed queues are not set up until link time, at which point we know the directed port ID. Directed queue setup will only fail if this queue is already setup or there are no directed queues left to configure.
--- doc/guides/eventdevs/dlb2.rst | 73 +++-- drivers/event/dlb2/dlb2.c | 312 +++++++++++++++++++ drivers/event/dlb2/dlb2_iface.c | 12 + drivers/event/dlb2/dlb2_iface.h | 12 + drivers/event/dlb2/pf/base/dlb2_resource.c | 464 +++++++++++++++++++++++++++++ drivers/event/dlb2/pf/dlb2_main.c | 10 + drivers/event/dlb2/pf/dlb2_pf.c | 82 +++++ 7 files changed, 926 insertions(+), 39 deletions(-)
doc/guides/eventdevs/dlb2.rst +34 -39
@@ -47,45 +47,40 @@ setup argument and the per-port ``new_event_threshold`` argument apply as defined in the eventdev header file. The limit is applied to all enqueues, regardless of whether it will consume a directed or load-balanced credit. -Load-balanced and Directed Ports -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -DLB2 ports come in two flavors: load-balanced and directed. The eventdev API -does not have the same concept, but it has a similar one: ports and queues that -are singly-linked (i.e. linked to a single queue or port, respectively). - -The ``rte_event_dev_info_get()`` function reports the number of available -event ports and queues (among other things). For the DLB2 PMD, max_event_ports -and max_event_queues report the number of available load-balanced ports and -queues, and max_single_link_event_port_queue_pairs reports the number of -available directed ports and queues. - -When a scheduling domain is created in ``rte_event_dev_configure()``, the user -specifies ``nb_event_ports`` and ``nb_single_link_event_port_queues``, which -control the total number of ports (load-balanced and directed) and the number -of directed ports. Hence, the number of requested load-balanced ports is -``nb_event_ports - nb_single_link_event_ports``. The ``nb_event_queues`` field -specifies the total number of queues (load-balanced and directed). The number -of directed queues comes from ``nb_single_link_event_port_queues``, since -directed ports and queues come in pairs. - -When a port is setup, the ``RTE_EVENT_PORT_CFG_SINGLE_LINK`` flag determines -whether it should be configured as a directed (the flag is set) or a -load-balanced (the flag is unset) port. Similarly, the -``RTE_EVENT_QUEUE_CFG_SINGLE_LINK`` queue configuration flag controls -whether it is a directed or load-balanced queue. - -Load-balanced ports can only be linked to load-balanced queues, and directed -ports can only be linked to directed queues. Furthermore, directed ports can -only be linked to a single directed queue (and vice versa), and that link -cannot change after the eventdev is started. - -The eventdev API does not have a directed scheduling type. To support directed -traffic, the dlb PMD detects when an event is being sent to a directed queue -and overrides its scheduling type. Note that the originally selected scheduling -type (atomic, ordered, or parallel) is not preserved, and an event's sched_type -will be set to ``RTE_SCHED_TYPE_ATOMIC`` when it is dequeued from a directed -port. +Load-Balanced Queues +~~~~~~~~~~~~~~~~~~~~ + +A load-balanced queue can support atomic and ordered scheduling, or atomic and +unordered scheduling, but not atomic and unordered and ordered scheduling. A +queue's scheduling types are controlled by the event queue configuration. + +If the user sets the ``RTE_EVENT_QUEUE_CFG_ALL_TYPES`` flag, the +``nb_atomic_order_sequences`` determines the supported scheduling types. +With non-zero ``nb_atomic_order_sequences``, the queue is configured for atomic +and ordered scheduling. In this case, ``RTE_SCHED_TYPE_PARALLEL`` scheduling is +supported by scheduling those events as ordered events. Note that when the +event is dequeued, its sched_type will be ``RTE_SCHED_TYPE_ORDERED``. Else if +``nb_atomic_order_sequences`` is zero, the queue is configured for atomic and +unordered scheduling. In this case, ``RTE_SCHED_TYPE_ORDERED`` is unsupported. + +If the ``RTE_EVENT_QUEUE_CFG_ALL_TYPES`` flag is not set, schedule_type +dictates the queue's scheduling type. + +The ``nb_atomic_order_sequences`` queue configuration field sets the ordered +queue's reorder buffer size. DLB2 has 4 groups of ordered queues, where each +group is configured to contain either 1 queue with 1024 reorder entries, 2 +queues with 512 reorder entries, and so on down to 32 queues with 32 entries. + +When a load-balanced queue is created, the PMD will configure a new sequence +number group on-demand if num_sequence_numbers does not match a pre-existing +group with available reorder buffer entries. If all sequence number groups are +in use, no new group will be created and queue configuration will fail. (Note +that when the PMD is used with a virtual DLB2 device, it cannot change the +sequence number configuration.) + +The queue's ``nb_atomic_flows`` parameter is ignored by the DLB2 PMD, because +the DLB2 does not limit the number of flows a queue can track. In the DLB2, all +load-balanced queues can use the full 16-bit flow ID range. Flow ID ~~~~~~~
drivers/event/dlb2/dlb2.c +312 -0
324 lines not on this page · raw message
drivers/event/dlb2/dlb2_iface.c +12 -0
@@ -31,3 +31,15 @@ int (*dlb2_iface_sched_domain_create)(struct dlb2_hw_dev *handle, struct dlb2_create_sched_domain_args *args);void (*dlb2_iface_domain_reset)(struct dlb2_eventdev *dlb2); + +int (*dlb2_iface_ldb_queue_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_ldb_queue_args *cfg); + +int (*dlb2_iface_get_sn_allocation)(struct dlb2_hw_dev *handle, +struct dlb2_get_sn_allocation_args *args); + +int (*dlb2_iface_set_sn_allocation)(struct dlb2_hw_dev *handle, +struct dlb2_set_sn_allocation_args *args); + +int (*dlb2_iface_get_sn_occupancy)(struct dlb2_hw_dev *handle, +struct dlb2_get_sn_occupancy_args *args);
drivers/event/dlb2/dlb2_iface.h +12 -0
@@ -30,4 +30,16 @@ extern int (*dlb2_iface_sched_domain_create)(struct dlb2_hw_dev *handle, struct dlb2_create_sched_domain_args *args);extern void (*dlb2_iface_domain_reset)(struct dlb2_eventdev *dlb2); + +extern int (*dlb2_iface_ldb_queue_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_ldb_queue_args *cfg); + +extern int (*dlb2_iface_get_sn_allocation)(struct dlb2_hw_dev *handle, +struct dlb2_get_sn_allocation_args *args); + +extern int (*dlb2_iface_set_sn_allocation)(struct dlb2_hw_dev *handle, +struct dlb2_set_sn_allocation_args *args); + +extern int (*dlb2_iface_get_sn_occupancy)(struct dlb2_hw_dev *handle, +struct dlb2_get_sn_occupancy_args *args);#endif /* _DLB2_IFACE_H_ */
drivers/event/dlb2/pf/base/dlb2_resource.c +464 -0
467 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_main.c +10 -0
@@ -613,3 +613,13 @@ dlb2_pf_reset_domain(struct dlb2_hw *hw, u32 id) {return dlb2_reset_domain (hw, id,NOT_VF_REQ ,PF_ID_ZERO ); } + +int +dlb2_pf_create_ldb_queue (struct dlb2_hw *hw, +u32 id, +struct dlb2_create_ldb_queue_args *args, +struct dlb2_cmd_response *resp) +{ +return dlb2_hw_create_ldb_queue (hw, id, args, resp,NOT_VF_REQ , +PF_ID_ZERO ); +}
drivers/event/dlb2/pf/dlb2_pf.c +82 -0
94 lines not on this page · raw message
Signature · 1 line
2.6.4
PATCH v10 13/23 event/dlb2: add port setup
In reply to Timothy McDanielConfigure the load balanced (ldb) or directed (dir) port. The consumer queue (CQ) and producer port (PP) are also set up here.
--- doc/guides/eventdevs/dlb2.rst | 75 +++ drivers/event/dlb2/dlb2.c | 498 ++++++++++++++++ drivers/event/dlb2/dlb2_iface.c | 8 + drivers/event/dlb2/dlb2_iface.h | 8 + drivers/event/dlb2/pf/base/dlb2_resource.c | 922 +++++++++++++++++++++++++++++ drivers/event/dlb2/pf/dlb2_main.c | 28 + drivers/event/dlb2/pf/dlb2_pf.c | 180 ++++++ 7 files changed, 1719 insertions(+)
doc/guides/eventdevs/dlb2.rst +75 -0
@@ -82,6 +82,81 @@ The queue's ``nb_atomic_flows`` parameter is ignored by the DLB2 PMD, because the DLB2 does not limit the number of flows a queue can track. In the DLB2, all load-balanced queues can use the full 16-bit flow ID range. +Load-Balanced Queues +~~~~~~~~~~~~~~~~~~~~ + +A load-balanced queue can support atomic and ordered scheduling, or atomic and +unordered scheduling, but not atomic and unordered and ordered scheduling. A +queue's scheduling types are controlled by the event queue configuration. + +If the user sets the ``RTE_EVENT_QUEUE_CFG_ALL_TYPES`` flag, the +``nb_atomic_order_sequences`` determines the supported scheduling types. +With non-zero ``nb_atomic_order_sequences``, the queue is configured for atomic +and ordered scheduling. In this case, ``RTE_SCHED_TYPE_PARALLEL`` scheduling is +supported by scheduling those events as ordered events. Note that when the +event is dequeued, its sched_type will be ``RTE_SCHED_TYPE_ORDERED``. Else if +``nb_atomic_order_sequences`` is zero, the queue is configured for atomic and +unordered scheduling. In this case, ``RTE_SCHED_TYPE_ORDERED`` is unsupported. + +If the ``RTE_EVENT_QUEUE_CFG_ALL_TYPES`` flag is not set, schedule_type +dictates the queue's scheduling type. + +The ``nb_atomic_order_sequences`` queue configuration field sets the ordered +queue's reorder buffer size. DLB2 has 4 groups of ordered queues, where each +group is configured to contain either 1 queue with 1024 reorder entries, 2 +queues with 512 reorder entries, and so on down to 32 queues with 32 entries. + +When a load-balanced queue is created, the PMD will configure a new sequence +number group on-demand if num_sequence_numbers does not match a pre-existing +group with available reorder buffer entries. If all sequence number groups are +in use, no new group will be created and queue configuration will fail. (Note +that when the PMD is used with a virtual DLB2 device, it cannot change the +sequence number configuration.) + +The queue's ``nb_atomic_flows`` parameter is ignored by the DLB2 PMD, because +the DLB2 does not limit the number of flows a queue can track. In the DLB2, all +load-balanced queues can use the full 16-bit flow ID range. + +Load-balanced and Directed Ports +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +DLB2 ports come in two flavors: load-balanced and directed. The eventdev API +does not have the same concept, but it has a similar one: ports and queues that +are singly-linked (i.e. linked to a single queue or port, respectively). + +The ``rte_event_dev_info_get()`` function reports the number of available +event ports and queues (among other things). For the DLB2 PMD, max_event_ports +and max_event_queues report the number of available load-balanced ports and +queues, and max_single_link_event_port_queue_pairs reports the number of +available directed ports and queues. + +When a scheduling domain is created in ``rte_event_dev_configure()``, the user +specifies ``nb_event_ports`` and ``nb_single_link_event_port_queues``, which +control the total number of ports (load-balanced and directed) and the number +of directed ports. Hence, the number of requested load-balanced ports is +``nb_event_ports - nb_single_link_event_ports``. The ``nb_event_queues`` field +specifies the total number of queues (load-balanced and directed). The number +of directed queues comes from ``nb_single_link_event_port_queues``, since +directed ports and queues come in pairs. + +When a port is setup, the ``RTE_EVENT_PORT_CFG_SINGLE_LINK`` flag determines +whether it should be configured as a directed (the flag is set) or a +load-balanced (the flag is unset) port. Similarly, the +``RTE_EVENT_QUEUE_CFG_SINGLE_LINK`` queue configuration flag controls +whether it is a directed or load-balanced queue. + +Load-balanced ports can only be linked to load-balanced queues, and directed +ports can only be linked to directed queues. Furthermore, directed ports can +only be linked to a single directed queue (and vice versa), and that link +cannot change after the eventdev is started. + +The eventdev API does not have a directed scheduling type. To support directed +traffic, the dlb PMD detects when an event is being sent to a directed queue +and overrides its scheduling type. Note that the originally selected scheduling +type (atomic, ordered, or parallel) is not preserved, and an event's sched_type +will be set to ``RTE_SCHED_TYPE_ATOMIC`` when it is dequeued from a directed +port. + Flow ID ~~~~~~~
drivers/event/dlb2/dlb2.c +498 -0
510 lines not on this page · raw message
drivers/event/dlb2/dlb2_iface.c +8 -0
@@ -43,3 +43,11 @@ int (*dlb2_iface_set_sn_allocation)(struct dlb2_hw_dev *handle,int (*dlb2_iface_get_sn_occupancy)(struct dlb2_hw_dev *handle,struct dlb2_get_sn_occupancy_args *args); + +int (*dlb2_iface_ldb_port_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_ldb_port_args *cfg, +enum dlb2_cq_poll_modes poll_mode); + +int (*dlb2_iface_dir_port_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_dir_port_args *cfg, +enum dlb2_cq_poll_modes poll_mode);
drivers/event/dlb2/dlb2_iface.h +8 -0
@@ -42,4 +42,12 @@ extern int (*dlb2_iface_set_sn_allocation)(struct dlb2_hw_dev *handle,extern int (*dlb2_iface_get_sn_occupancy)(struct dlb2_hw_dev *handle,struct dlb2_get_sn_occupancy_args *args); + +extern int (*dlb2_iface_ldb_port_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_ldb_port_args *cfg, +enum dlb2_cq_poll_modes poll_mode); + +extern int (*dlb2_iface_dir_port_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_dir_port_args *cfg, +enum dlb2_cq_poll_modes poll_mode);#endif /* _DLB2_IFACE_H_ */
drivers/event/dlb2/pf/base/dlb2_resource.c +922 -0
925 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_main.c +28 -0
@@ -623,3 +623,31 @@ dlb2_pf_create_ldb_queue(struct dlb2_hw *hw,return dlb2_hw_create_ldb_queue (hw, id, args, resp,NOT_VF_REQ ,PF_ID_ZERO ); } + +int +dlb2_pf_create_ldb_port (struct dlb2_hw *hw, +u32 id, +struct dlb2_create_ldb_port_args *args, +uintptr_t cq_dma_base, +struct dlb2_cmd_response *resp) +{ +return dlb2_hw_create_ldb_port (hw, id, args, + cq_dma_base, + resp, +NOT_VF_REQ , +PF_ID_ZERO ); +} + +int +dlb2_pf_create_dir_port (struct dlb2_hw *hw, +u32 id, +struct dlb2_create_dir_port_args *args, +uintptr_t cq_dma_base, +struct dlb2_cmd_response *resp) +{ +return dlb2_hw_create_dir_port (hw, id, args, + cq_dma_base, + resp, +NOT_VF_REQ , +PF_ID_ZERO ); +}
drivers/event/dlb2/pf/dlb2_pf.c +180 -0
192 lines not on this page · raw message
Signature · 1 line
2.6.4
PATCH v10 14/23 event/dlb2: add port link
In reply to Timothy McDanielAdd port link entry point. Directed queues are identified and created at this stage. Their setup deferred until link-time, at which point we know the directed port ID. Directed queue setup will only fail if this queue is already setup or there are no directed queues left to configure.
--- drivers/event/dlb2/dlb2.c | 302 ++++++++++++++ drivers/event/dlb2/dlb2_iface.c | 6 + drivers/event/dlb2/dlb2_iface.h | 6 + drivers/event/dlb2/pf/base/dlb2_resource.c | 633 +++++++++++++++++++++++++++++ drivers/event/dlb2/pf/dlb2_main.c | 10 + drivers/event/dlb2/pf/dlb2_pf.c | 50 +++ 6 files changed, 1007 insertions(+)
drivers/event/dlb2/dlb2.c +302 -0
@@ -1496,6 +1496,307 @@ dlb2_eventdev_port_setup(struct rte_eventdev *dev,return 0 ; } +static int16_t +dlb2_hw_map_ldb_qid_to_port (struct dlb2_hw_dev *handle, +uint32_t qm_port_id, +uint16_t qm_qid, +uint8_t priority) +{ +struct dlb2_map_qid_args cfg; +int32_t ret; + +if (handle ==NULL ) +return -EINVAL ; + +/* Build message */ + cfg.port_id = qm_port_id; + cfg.qid = qm_qid; + cfg.priority =EV_TO_DLB2_PRIO (priority); + + ret =dlb2_iface_map_qid (handle, &cfg); +if (ret <0 ) { +DLB2_LOG_ERR ("dlb2: map qid error, ret=%d (driver status: %s)\n" , + ret, dlb2_error_strings[cfg.response.status]); +DLB2_LOG_ERR ("dlb2: grp=%d, qm_port=%d, qm_qid=%d prio=%d\n" , + handle->domain_id, cfg.port_id, + cfg.qid, + cfg.priority); + }else { +DLB2_LOG_DBG ("dlb2: mapped queue %d to qm_port %d\n" , + qm_qid, qm_port_id); + } + +return ret; +} + +static int +dlb2_event_queue_join_ldb (struct dlb2_eventdev *dlb2, +struct dlb2_eventdev_port *ev_port, +struct dlb2_eventdev_queue *ev_queue, +uint8_t priority) +{ +int first_avail =-1 ; +int ret, i; + +for (i =0 ; i <DLB2_MAX_NUM_QIDS_PER_LDB_CQ ; i++) { +if (ev_port->link[i].valid) { +if (ev_port->link[i].queue_id == ev_queue->id && + ev_port->link[i].priority == priority) { +if (ev_port->link[i].mapped) +return 0 ;/* already mapped */ + first_avail = i; + } + }else if (first_avail ==-1 ) + first_avail = i; + } +if (first_avail ==-1 ) { +DLB2_LOG_ERR ("dlb2: qm_port %d has no available QID slots.\n" , + ev_port->qm_port.id); +return -EINVAL ; + } + + ret =dlb2_hw_map_ldb_qid_to_port (&dlb2->qm_instance, + ev_port->qm_port.id, + ev_queue->qm_queue.id, + priority); + +if (!ret) + ev_port->link[first_avail].mapped = true; + +return ret; +} + +static int32_t +dlb2_hw_create_dir_queue (struct dlb2_eventdev *dlb2, +struct dlb2_eventdev_queue *ev_queue, +int32_t qm_port_id) +{ +struct dlb2_hw_dev *handle = &dlb2->qm_instance; +struct dlb2_create_dir_queue_args cfg; +int32_t ret; + +/* The directed port is always configured before its queue */ + cfg.port_id = qm_port_id; + +if (ev_queue->depth_threshold ==0 ) { + cfg.depth_threshold =RTE_PMD_DLB2_DEFAULT_DEPTH_THRESH ; + ev_queue->depth_threshold =RTE_PMD_DLB2_DEFAULT_DEPTH_THRESH ; + }else + cfg.depth_threshold = ev_queue->depth_threshold; + + ret =dlb2_iface_dir_queue_create (handle, &cfg); +if (ret <0 ) { +DLB2_LOG_ERR ("dlb2: create DIR event queue error, ret=%d (driver status: %s)\n" , + ret, dlb2_error_strings[cfg.response.status]); +return -EINVAL ; + } + +return cfg.response.id; +} + +static int +dlb2_eventdev_dir_queue_setup (struct dlb2_eventdev *dlb2, +struct dlb2_eventdev_queue *ev_queue, +struct dlb2_eventdev_port *ev_port) +{ +int32_t qm_qid; + + qm_qid =dlb2_hw_create_dir_queue (dlb2, ev_queue, ev_port->qm_port.id); + +if (qm_qid <0 ) { +DLB2_LOG_ERR ("Failed to create the DIR queue\n" ); +return qm_qid; + } + + dlb2->qm_dir_to_ev_queue_id[qm_qid] = ev_queue->id; + + ev_queue->qm_queue.id = qm_qid; + +return 0 ; +} + +static int +dlb2_do_port_link (struct rte_eventdev *dev, +struct dlb2_eventdev_queue *ev_queue, +struct dlb2_eventdev_port *ev_port, +uint8_t prio) +{ +struct dlb2_eventdev *dlb2 =dlb2_pmd_priv (dev); +int err; + +/* Don't link until start time. */ +if (dlb2->run_state ==DLB2_RUN_STATE_STOPPED ) +return 0 ; + +if (ev_queue->qm_queue.is_directed) + err =dlb2_eventdev_dir_queue_setup (dlb2, ev_queue, ev_port); +else + err =dlb2_event_queue_join_ldb (dlb2, ev_port, ev_queue, prio); + +if (err) { +DLB2_LOG_ERR ("port link failure for %s ev_q %d, ev_port %d\n" , + ev_queue->qm_queue.is_directed ?"DIR" :"LDB" , + ev_queue->id, ev_port->id); + + rte_errno = err; +return -1 ; + } + +return 0 ; +} + +static int +dlb2_validate_port_link (struct dlb2_eventdev_port *ev_port, +uint8_t queue_id, +bool link_exists, +int index) +{ +struct dlb2_eventdev *dlb2 = ev_port->dlb2; +struct dlb2_eventdev_queue *ev_queue; +bool port_is_dir, queue_is_dir; + +if (queue_id > dlb2->num_queues) { + rte_errno = -EINVAL ; +return -1 ; + } + + ev_queue = &dlb2->ev_queues[queue_id]; + +if (!ev_queue->setup_done && + ev_queue->qm_queue.config_state !=DLB2_PREV_CONFIGURED ) { + rte_errno = -EINVAL ; +return -1 ; + } + + port_is_dir = ev_port->qm_port.is_directed; + queue_is_dir = ev_queue->qm_queue.is_directed; + +if (port_is_dir != queue_is_dir) { +DLB2_LOG_ERR ("%s queue %u can't link to %s port %u\n" , + queue_is_dir ?"DIR" :"LDB" , ev_queue->id, + port_is_dir ?"DIR" :"LDB" , ev_port->id); + + rte_errno = -EINVAL ; +return -1 ; + } + +/* Check if there is space for the requested link */ +if (!link_exists && index ==-1 ) { +DLB2_LOG_ERR ("no space for new link\n" ); + rte_errno = -ENOSPC ; +return -1 ; + } + +/* Check if the directed port is already linked */ +if (ev_port->qm_port.is_directed && ev_port->num_links >0 && + !link_exists) { +DLB2_LOG_ERR ("Can't link DIR port %d to >1 queues\n" , + ev_port->id); + rte_errno = -EINVAL ; +return -1 ; + } + +/* Check if the directed queue is already linked */ +if (ev_queue->qm_queue.is_directed && ev_queue->num_links >0 && + !link_exists) { +DLB2_LOG_ERR ("Can't link DIR queue %d to >1 ports\n" , + ev_queue->id); + rte_errno = -EINVAL ; +return -1 ; + } + +return 0 ; +} + +static int +dlb2_eventdev_port_link (struct rte_eventdev *dev,void *event_port, +const uint8_t queues[],const uint8_t priorities[], +uint16_t nb_links) + +{ +struct dlb2_eventdev_port *ev_port = event_port; +struct dlb2_eventdev *dlb2; +int i, j; + +RTE_SET_USED (dev); + +if (ev_port ==NULL ) { +DLB2_LOG_ERR ("dlb2: evport not setup\n" ); + rte_errno = -EINVAL ; +return 0 ; + } + +if (!ev_port->setup_done && + ev_port->qm_port.config_state !=DLB2_PREV_CONFIGURED ) { +DLB2_LOG_ERR ("dlb2: evport not setup\n" ); + rte_errno = -EINVAL ; +return 0 ; + } + +/* Note: rte_event_port_link() ensures the PMD won't receive a NULL +* queues pointer. +*/ +if (nb_links ==0 ) { +DLB2_LOG_DBG ("dlb2: nb_links is 0\n" ); +return 0 ;/* Ignore and return success */ + } + + dlb2 = ev_port->dlb2; + +DLB2_LOG_DBG ("Linking %u queues to %s port %d\n" , + nb_links, + ev_port->qm_port.is_directed ?"DIR" :"LDB" , + ev_port->id); + +for (i =0 ; i < nb_links; i++) { +struct dlb2_eventdev_queue *ev_queue; +uint8_t queue_id, prio; +bool found = false; +int index =-1 ; + + queue_id = queues[i]; + prio = priorities[i]; + +/* Check if the link already exists. */ +for (j =0 ; j <DLB2_MAX_NUM_QIDS_PER_LDB_CQ ; j++) +if (ev_port->link[j].valid) { +if (ev_port->link[j].queue_id == queue_id) { + found = true; + index = j; +break ; + } + }else if (index ==-1 ) { + index = j; + } + +/* could not link */ +if (index ==-1 ) +break ; + +/* Check if already linked at the requested priority */ +if (found && ev_port->link[j].priority == prio) +continue ; + +if (dlb2_validate_port_link (ev_port, queue_id, found, index)) +break ;/* return index of offending queue */ + + ev_queue = &dlb2->ev_queues[queue_id]; + +if (dlb2_do_port_link (dev, ev_queue, ev_port, prio)) +break ;/* return index of offending queue */ + + ev_queue->num_links++; + + ev_port->link[index].queue_id = queue_id; + ev_port->link[index].priority = prio; + ev_port->link[index].valid = true; +/* Entry already exists? If so, then must be prio change */ +if (!found) + ev_port->num_links++; + } +return i; +} +static void dlb2_entry_points_init (struct rte_eventdev *dev) {
@@ -1507,6 +1808,7 @@ dlb2_entry_points_init(struct rte_eventdev *dev) .queue_setup = dlb2_eventdev_queue_setup, .port_def_conf = dlb2_eventdev_port_default_conf_get, .port_setup = dlb2_eventdev_port_setup, + .port_link = dlb2_eventdev_port_link, .dump = dlb2_eventdev_dump, .xstats_get = dlb2_eventdev_xstats_get, .xstats_get_names = dlb2_eventdev_xstats_get_names,
drivers/event/dlb2/dlb2_iface.c +6 -0
@@ -51,3 +51,9 @@ int (*dlb2_iface_ldb_port_create)(struct dlb2_hw_dev *handle,int (*dlb2_iface_dir_port_create)(struct dlb2_hw_dev *handle,struct dlb2_create_dir_port_args *cfg,enum dlb2_cq_poll_modes poll_mode); + +int (*dlb2_iface_dir_queue_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_dir_queue_args *cfg); + +int (*dlb2_iface_map_qid)(struct dlb2_hw_dev *handle, +struct dlb2_map_qid_args *cfg);
drivers/event/dlb2/dlb2_iface.h +6 -0
@@ -50,4 +50,10 @@ extern int (*dlb2_iface_ldb_port_create)(struct dlb2_hw_dev *handle,extern int (*dlb2_iface_dir_port_create)(struct dlb2_hw_dev *handle,struct dlb2_create_dir_port_args *cfg,enum dlb2_cq_poll_modes poll_mode); + +extern int (*dlb2_iface_dir_queue_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_dir_queue_args *cfg); + +extern int (*dlb2_iface_map_qid)(struct dlb2_hw_dev *handle, +struct dlb2_map_qid_args *cfg);#endif /* _DLB2_IFACE_H_ */
drivers/event/dlb2/pf/base/dlb2_resource.c +633 -0
636 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_main.c +10 -0
@@ -651,3 +651,13 @@ dlb2_pf_create_dir_port(struct dlb2_hw *hw,NOT_VF_REQ , PF_ID_ZERO); } + +int +dlb2_pf_create_dir_queue (struct dlb2_hw *hw, +u32 id, +struct dlb2_create_dir_queue_args *args, +struct dlb2_cmd_response *resp) +{ +return dlb2_hw_create_dir_queue (hw, id, args, resp,NOT_VF_REQ , +PF_ID_ZERO ); +}
drivers/event/dlb2/pf/dlb2_pf.c +50 -0
63 lines not on this page · raw message
Signature · 1 line
2.6.4
PATCH v10 15/23 event/dlb2: add port unlink and port unlinks in progress
In reply to Timothy McDanielAdd supports for the port unlink(s) eventdev entry points. The unlink operation is an asynchronous operation executed by a control thread, and the unlinks-in-progress function reads a counter shared with the control thread.
--- drivers/event/dlb2/dlb2.c | 163 +++++++++++++++++ drivers/event/dlb2/dlb2_iface.c | 6 + drivers/event/dlb2/dlb2_iface.h | 6 + drivers/event/dlb2/pf/base/dlb2_resource.c | 283 +++++++++++++++++++++++++++++ drivers/event/dlb2/pf/dlb2_pf.c | 51 ++++++ 5 files changed, 509 insertions(+)
drivers/event/dlb2/dlb2.c +163 -0
@@ -1797,6 +1797,166 @@ dlb2_eventdev_port_link(struct rte_eventdev *dev, void *event_port,return i; } +static int16_t +dlb2_hw_unmap_ldb_qid_from_port (struct dlb2_hw_dev *handle, +uint32_t qm_port_id, +uint16_t qm_qid) +{ +struct dlb2_unmap_qid_args cfg; +int32_t ret; + +if (handle ==NULL ) +return -EINVAL ; + + cfg.port_id = qm_port_id; + cfg.qid = qm_qid; + + ret =dlb2_iface_unmap_qid (handle, &cfg); +if (ret <0 ) +DLB2_LOG_ERR ("dlb2: unmap qid error, ret=%d (driver status: %s)\n" , + ret, dlb2_error_strings[cfg.response.status]); + +return ret; +} + +static int +dlb2_event_queue_detach_ldb (struct dlb2_eventdev *dlb2, +struct dlb2_eventdev_port *ev_port, +struct dlb2_eventdev_queue *ev_queue) +{ +int ret, i; + +/* Don't unlink until start time. */ +if (dlb2->run_state ==DLB2_RUN_STATE_STOPPED ) +return 0 ; + +for (i =0 ; i <DLB2_MAX_NUM_QIDS_PER_LDB_CQ ; i++) { +if (ev_port->link[i].valid && + ev_port->link[i].queue_id == ev_queue->id) +break ;/* found */ + } + +/* This is expected with eventdev API! +* It blindly attemmpts to unmap all queues. +*/ +if (i ==DLB2_MAX_NUM_QIDS_PER_LDB_CQ ) { +DLB2_LOG_DBG ("dlb2: ignoring LB QID %d not mapped for qm_port %d.\n" , + ev_queue->qm_queue.id, + ev_port->qm_port.id); +return 0 ; + } + + ret =dlb2_hw_unmap_ldb_qid_from_port (&dlb2->qm_instance, + ev_port->qm_port.id, + ev_queue->qm_queue.id); +if (!ret) + ev_port->link[i].mapped = false; + +return ret; +} + +static int +dlb2_eventdev_port_unlink (struct rte_eventdev *dev,void *event_port, +uint8_t queues[],uint16_t nb_unlinks) +{ +struct dlb2_eventdev_port *ev_port = event_port; +struct dlb2_eventdev *dlb2; +int i; + +RTE_SET_USED (dev); + +if (!ev_port->setup_done) { +DLB2_LOG_ERR ("dlb2: evport %d is not configured\n" , + ev_port->id); + rte_errno = -EINVAL ; +return 0 ; + } + +if (queues ==NULL || nb_unlinks ==0 ) { +DLB2_LOG_DBG ("dlb2: queues is NULL or nb_unlinks is 0\n" ); +return 0 ;/* Ignore and return success */ + } + +/* FIXME: How to handle unlink on a directed port? */ +if (ev_port->qm_port.is_directed) { +DLB2_LOG_DBG ("dlb2: ignore unlink from dir port %d\n" , + ev_port->id); + rte_errno =0 ; +return nb_unlinks;/* as if success */ + } + + dlb2 = ev_port->dlb2; + +for (i =0 ; i < nb_unlinks; i++) { +struct dlb2_eventdev_queue *ev_queue; +int ret, j; + +if (queues[i] >= dlb2->num_queues) { +DLB2_LOG_ERR ("dlb2: invalid queue id %d\n" , queues[i]); + rte_errno = -EINVAL ; +return i;/* return index of offending queue */ + } + + ev_queue = &dlb2->ev_queues[queues[i]]; + +/* Does a link exist? */ +for (j =0 ; j <DLB2_MAX_NUM_QIDS_PER_LDB_CQ ; j++) +if (ev_port->link[j].queue_id == queues[i] && + ev_port->link[j].valid) +break ; + +if (j ==DLB2_MAX_NUM_QIDS_PER_LDB_CQ ) +continue ; + + ret =dlb2_event_queue_detach_ldb (dlb2, ev_port, ev_queue); +if (ret) { +DLB2_LOG_ERR ("unlink err=%d for port %d queue %d\n" , + ret, ev_port->id, queues[i]); + rte_errno = -ENOENT ; +return i;/* return index of offending queue */ + } + + ev_port->link[j].valid = false; + ev_port->num_links--; + ev_queue->num_links--; + } + +return nb_unlinks; +} + +static int +dlb2_eventdev_port_unlinks_in_progress (struct rte_eventdev *dev, +void *event_port) +{ +struct dlb2_eventdev_port *ev_port = event_port; +struct dlb2_eventdev *dlb2; +struct dlb2_hw_dev *handle; +struct dlb2_pending_port_unmaps_args cfg; +int ret; + +RTE_SET_USED (dev); + +if (!ev_port->setup_done) { +DLB2_LOG_ERR ("dlb2: evport %d is not configured\n" , + ev_port->id); + rte_errno = -EINVAL ; +return 0 ; + } + + cfg.port_id = ev_port->qm_port.id; + dlb2 = ev_port->dlb2; + handle = &dlb2->qm_instance; + ret =dlb2_iface_pending_port_unmaps (handle, &cfg); + +if (ret <0 ) { +DLB2_LOG_ERR ("dlb2: num_unlinks_in_progress ret=%d (driver status: %s)\n" , + ret, dlb2_error_strings[cfg.response.status]); +return ret; + } + +return cfg.response.id; +} +static void dlb2_entry_points_init (struct rte_eventdev *dev) {
@@ -1809,6 +1969,9 @@ dlb2_entry_points_init(struct rte_eventdev *dev) .port_def_conf = dlb2_eventdev_port_default_conf_get, .port_setup = dlb2_eventdev_port_setup, .port_link = dlb2_eventdev_port_link, + .port_unlink = dlb2_eventdev_port_unlink, + .port_unlinks_in_progress = + dlb2_eventdev_port_unlinks_in_progress, .dump = dlb2_eventdev_dump, .xstats_get = dlb2_eventdev_xstats_get, .xstats_get_names = dlb2_eventdev_xstats_get_names,
drivers/event/dlb2/dlb2_iface.c +6 -0
@@ -57,3 +57,9 @@ int (*dlb2_iface_dir_queue_create)(struct dlb2_hw_dev *handle,int (*dlb2_iface_map_qid)(struct dlb2_hw_dev *handle,struct dlb2_map_qid_args *cfg); + +int (*dlb2_iface_unmap_qid)(struct dlb2_hw_dev *handle, +struct dlb2_unmap_qid_args *cfg); + +int (*dlb2_iface_pending_port_unmaps)(struct dlb2_hw_dev *handle, +struct dlb2_pending_port_unmaps_args *args);
drivers/event/dlb2/dlb2_iface.h +6 -0
@@ -56,4 +56,10 @@ extern int (*dlb2_iface_dir_queue_create)(struct dlb2_hw_dev *handle,extern int (*dlb2_iface_map_qid)(struct dlb2_hw_dev *handle,struct dlb2_map_qid_args *cfg); + +extern int (*dlb2_iface_unmap_qid)(struct dlb2_hw_dev *handle, +struct dlb2_unmap_qid_args *cfg); + +extern int (*dlb2_iface_pending_port_unmaps)(struct dlb2_hw_dev *handle, +struct dlb2_pending_port_unmaps_args *args);#endif /* _DLB2_IFACE_H_ */
drivers/event/dlb2/pf/base/dlb2_resource.c +283 -0
286 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_pf.c +51 -0
63 lines not on this page · raw message
Signature · 1 line
2.6.4
PATCH v10 16/23 event/dlb2: add eventdev start
In reply to Timothy McDanielAdd support for the eventdev start entry point.
We delay initializing some resources until
eventdev start, since the number of linked queues can be used to determine if we are dealing with a ldb or dir resource. If this is a device restart, then the previous configuration will be reapplied.
--- drivers/event/dlb2/dlb2.c | 133 +++++++++++++++++++++++++++++ drivers/event/dlb2/dlb2_iface.c | 3 + drivers/event/dlb2/dlb2_iface.h | 3 + drivers/event/dlb2/pf/base/dlb2_resource.c | 123 ++++++++++++++++++++++++++ drivers/event/dlb2/pf/dlb2_main.c | 10 +++ drivers/event/dlb2/pf/dlb2_pf.c | 25 ++++++ 6 files changed, 297 insertions(+)
drivers/event/dlb2/dlb2.c +133 -0
@@ -1957,6 +1957,138 @@ dlb2_eventdev_port_unlinks_in_progress(struct rte_eventdev *dev,return cfg.response.id; } +static int +dlb2_eventdev_reapply_configuration (struct rte_eventdev *dev) +{ +struct dlb2_eventdev *dlb2 =dlb2_pmd_priv (dev); +int ret, i; + +/* If an event queue or port was previously configured, but hasn't been +* reconfigured, reapply its original configuration. +*/ +for (i =0 ; i < dlb2->num_queues; i++) { +struct dlb2_eventdev_queue *ev_queue; + + ev_queue = &dlb2->ev_queues[i]; + +if (ev_queue->qm_queue.config_state !=DLB2_PREV_CONFIGURED ) +continue ; + + ret =dlb2_eventdev_queue_setup (dev, i, &ev_queue->conf); +if (ret <0 ) { +DLB2_LOG_ERR ("dlb2: failed to reconfigure queue %d" , i); +return ret; + } + } + +for (i =0 ; i < dlb2->num_ports; i++) { +struct dlb2_eventdev_port *ev_port = &dlb2->ev_ports[i]; + +if (ev_port->qm_port.config_state !=DLB2_PREV_CONFIGURED ) +continue ; + + ret =dlb2_eventdev_port_setup (dev, i, &ev_port->conf); +if (ret <0 ) { +DLB2_LOG_ERR ("dlb2: failed to reconfigure ev_port %d" , + i); +return ret; + } + } + +return 0 ; +} + +static int +dlb2_eventdev_apply_port_links (struct rte_eventdev *dev) +{ +struct dlb2_eventdev *dlb2 =dlb2_pmd_priv (dev); +int i; + +/* Perform requested port->queue links */ +for (i =0 ; i < dlb2->num_ports; i++) { +struct dlb2_eventdev_port *ev_port = &dlb2->ev_ports[i]; +int j; + +for (j =0 ; j <DLB2_MAX_NUM_QIDS_PER_LDB_CQ ; j++) { +struct dlb2_eventdev_queue *ev_queue; +uint8_t prio, queue_id; + +if (!ev_port->link[j].valid) +continue ; + + prio = ev_port->link[j].priority; + queue_id = ev_port->link[j].queue_id; + +if (dlb2_validate_port_link (ev_port, queue_id, true, j)) +return -EINVAL ; + + ev_queue = &dlb2->ev_queues[queue_id]; + +if (dlb2_do_port_link (dev, ev_queue, ev_port, prio)) +return -EINVAL ; + } + } + +return 0 ; +} + +static int +dlb2_eventdev_start (struct rte_eventdev *dev) +{ +struct dlb2_eventdev *dlb2 =dlb2_pmd_priv (dev); +struct dlb2_hw_dev *handle = &dlb2->qm_instance; +struct dlb2_start_domain_args cfg; +int ret, i; + +rte_spinlock_lock (&dlb2->qm_instance.resource_lock); +if (dlb2->run_state !=DLB2_RUN_STATE_STOPPED ) { +DLB2_LOG_ERR ("bad state %d for dev_start\n" , + (int )dlb2->run_state); +rte_spinlock_unlock (&dlb2->qm_instance.resource_lock); +return -EINVAL ; + } + dlb2->run_state =DLB2_RUN_STATE_STARTING ; +rte_spinlock_unlock (&dlb2->qm_instance.resource_lock); + +/* If the device was configured more than once, some event ports and/or +* queues may need to be reconfigured. +*/ + ret =dlb2_eventdev_reapply_configuration (dev); +if (ret) +return ret; + +/* The DLB PMD delays port links until the device is started. */ + ret =dlb2_eventdev_apply_port_links (dev); +if (ret) +return ret; + +for (i =0 ; i < dlb2->num_ports; i++) { +if (!dlb2->ev_ports[i].setup_done) { +DLB2_LOG_ERR ("dlb2: port %d not setup" , i); +return -ESTALE ; + } + } + +for (i =0 ; i < dlb2->num_queues; i++) { +if (dlb2->ev_queues[i].num_links ==0 ) { +DLB2_LOG_ERR ("dlb2: queue %d is not linked" , i); +return -ENOLINK ; + } + } + + ret =dlb2_iface_sched_domain_start (handle, &cfg); +if (ret <0 ) { +DLB2_LOG_ERR ("dlb2: sched_domain_start ret=%d (driver status: %s)\n" , + ret, dlb2_error_strings[cfg.response.status]); +return ret; + } + + dlb2->run_state =DLB2_RUN_STATE_STARTED ; +DLB2_LOG_DBG ("dlb2: sched_domain_start completed OK\n" ); + +return 0 ; +} +static void dlb2_entry_points_init (struct rte_eventdev *dev) {
@@ -1964,6 +2096,7 @@ dlb2_entry_points_init(struct rte_eventdev *dev)static struct rte_eventdev_ops dlb2_eventdev_entry_ops = { .dev_infos_get = dlb2_eventdev_info_get, .dev_configure = dlb2_eventdev_configure, + .dev_start = dlb2_eventdev_start, .queue_def_conf = dlb2_eventdev_queue_default_conf_get, .queue_setup = dlb2_eventdev_queue_setup, .port_def_conf = dlb2_eventdev_port_default_conf_get,
drivers/event/dlb2/dlb2_iface.c +3 -0
@@ -63,3 +63,6 @@ int (*dlb2_iface_unmap_qid)(struct dlb2_hw_dev *handle,int (*dlb2_iface_pending_port_unmaps)(struct dlb2_hw_dev *handle,struct dlb2_pending_port_unmaps_args *args); + +int (*dlb2_iface_sched_domain_start)(struct dlb2_hw_dev *handle, +struct dlb2_start_domain_args *cfg);
drivers/event/dlb2/dlb2_iface.h +3 -0
@@ -62,4 +62,7 @@ extern int (*dlb2_iface_unmap_qid)(struct dlb2_hw_dev *handle,extern int (*dlb2_iface_pending_port_unmaps)(struct dlb2_hw_dev *handle,struct dlb2_pending_port_unmaps_args *args); + +extern int (*dlb2_iface_sched_domain_start)(struct dlb2_hw_dev *handle, +struct dlb2_start_domain_args *cfg);#endif /* _DLB2_IFACE_H_ */
drivers/event/dlb2/pf/base/dlb2_resource.c +123 -0
126 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_main.c +10 -0
@@ -661,3 +661,13 @@ dlb2_pf_create_dir_queue(struct dlb2_hw *hw,return dlb2_hw_create_dir_queue (hw, id, args, resp,NOT_VF_REQ ,PF_ID_ZERO ); } + +int +dlb2_pf_start_domain (struct dlb2_hw *hw, +u32 id, +struct dlb2_start_domain_args *args, +struct dlb2_cmd_response *resp) +{ +return dlb2_hw_start_domain (hw, id, args, resp,NOT_VF_REQ , +PF_ID_ZERO ); +}
drivers/event/dlb2/pf/dlb2_pf.c +25 -0
@@ -503,6 +503,30 @@ dlb2_pf_pending_port_unmaps(struct dlb2_hw_dev *handle,return ret; } + +static int +dlb2_pf_sched_domain_start (struct dlb2_hw_dev *handle, +struct dlb2_start_domain_args *cfg) +{ +struct dlb2_dev *dlb2_dev = (struct dlb2_dev *)handle->pf_dev; +struct dlb2_cmd_response response = {0 }; +int ret; + +DLB2_INFO (dev->dlb2_device,"Entering %s()\n" , __func__); + + ret =dlb2_pf_start_domain (&dlb2_dev->hw, + handle->domain_id, + cfg, + &response); + + cfg->response = response; + +DLB2_INFO (dev->dlb2_device,"Exiting %s() with ret=%d\n" , + __func__, ret); + +return ret; +} +static void dlb2_pf_iface_fn_ptrs_init (void ) {
@@ -520,6 +544,7 @@ dlb2_pf_iface_fn_ptrs_init(void) dlb2_iface_dir_port_create = dlb2_pf_dir_port_create; dlb2_iface_map_qid = dlb2_pf_map_qid; dlb2_iface_unmap_qid = dlb2_pf_unmap_qid; + dlb2_iface_sched_domain_start = dlb2_pf_sched_domain_start; dlb2_iface_pending_port_unmaps = dlb2_pf_pending_port_unmaps; dlb2_iface_get_sn_allocation = dlb2_pf_get_sn_allocation; dlb2_iface_set_sn_allocation = dlb2_pf_set_sn_allocation;
Signature · 1 line
2.6.4
PATCH v10 17/23 event/dlb2: add enqueue and its burst variants
In reply to Timothy McDanielAdd support for enqueue and its variants.
--- doc/guides/eventdevs/dlb2.rst | 118 +++++++++ drivers/event/dlb2/dlb2.c | 540 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 658 insertions(+)
doc/guides/eventdevs/dlb2.rst +118 -0
@@ -163,6 +163,124 @@ Flow ID The flow ID field is preserved in the event when it is scheduled in the DLB2. +Hardware Credits +~~~~~~~~~~~~~~~~ + +DLB2 uses a hardware credit scheme to prevent software from overflowing hardware +event storage, with each unit of storage represented by a credit. A port spends +a credit to enqueue an event, and hardware refills the ports with credits as the +events are scheduled to ports. Refills come from credit pools, and each port is +a member of a load-balanced credit pool and a directed credit pool. The +load-balanced credits are used to enqueue to load-balanced queues, and directed +credits are used for directed queues. + +A DLB2 eventdev contains one load-balanced and one directed credit pool. These +pools' sizes are controlled by the nb_events_limit field in struct +rte_event_dev_config. The load-balanced pool is sized to contain +nb_events_limit credits, and the directed pool is sized to contain +nb_events_limit/4 credits. The directed pool size can be overridden with the +num_dir_credits vdev argument, like so: + + .. code-block:: console + + --vdev=dlb1_event,num_dir_credits=<value> + +This can be used if the default allocation is too low or too high for the +specific application needs. The PMD also supports a vdev arg that limits the +max_num_events reported by rte_event_dev_info_get(): + + .. code-block:: console + + --vdev=dlb1_event,max_num_events=<value> + +By default, max_num_events is reported as the total available load-balanced +credits. If multiple DLB2-based applications are being used, it may be desirable +to control how many load-balanced credits each application uses, particularly +when application(s) are written to configure nb_events_limit equal to the +reported max_num_events. + +Each port is a member of both credit pools. A port's credit allocation is +defined by its low watermark, high watermark, and refill quanta. These three +parameters are calculated by the dlb PMD like so: + +- The load-balanced high watermark is set to the port's enqueue_depth. + The directed high watermark is set to the minimum of the enqueue_depth and + the directed pool size divided by the total number of ports. +- The refill quanta is set to half the high watermark. +- The low watermark is set to the minimum of 16 and the refill quanta. + +When the eventdev is started, each port is pre-allocated a high watermark's +worth of credits. For example, if an eventdev contains four ports with enqueue +depths of 32 and a load-balanced credit pool size of 4096, each port will start +with 32 load-balanced credits, and there will be 3968 credits available to +replenish the ports. Thus, a single port is not capable of enqueueing up to the +nb_events_limit (without any events being dequeued), since the other ports are +retaining their initial credit allocation; in short, all ports must enqueue in +order to reach the limit. + +If a port attempts to enqueue and has no credits available, the enqueue +operation will fail and the application must retry the enqueue. Credits are +replenished asynchronously by the DLB2 hardware. + +Software Credits +~~~~~~~~~~~~~~~~ + +The DLB2 is a "closed system" event dev, and the DLB2 PMD layers a software +credit scheme on top of the hardware credit scheme in order to comply with +the per-port backpressure described in the eventdev API. + +The DLB2's hardware scheme is local to a queue/pipeline stage: a port spends a +credit when it enqueues to a queue, and credits are later replenished after the +events are dequeued and released. + +In the software credit scheme, a credit is consumed when a new (.op = +RTE_EVENT_OP_NEW) event is injected into the system, and the credit is +replenished when the event is released from the system (either explicitly with +RTE_EVENT_OP_RELEASE or implicitly in dequeue_burst()). + +In this model, an event is "in the system" from its first enqueue into eventdev +until it is last dequeued. If the event goes through multiple event queues, it +is still considered "in the system" while a worker thread is processing it. + +A port will fail to enqueue if the number of events in the system exceeds its +``new_event_threshold`` (specified at port setup time). A port will also fail +to enqueue if it lacks enough hardware credits to enqueue; load-balanced +credits are used to enqueue to a load-balanced queue, and directed credits are +used to enqueue to a directed queue. + +The out-of-credit situations are typically transient, and an eventdev +application using the DLB2 ought to retry its enqueues if they fail. +If enqueue fails, DLB2 PMD sets rte_errno as follows: + +- -ENOSPC: Credit exhaustion (either hardware or software) +- -EINVAL: Invalid argument, such as port ID, queue ID, or sched_type. + +Depending on the pipeline the application has constructed, it's possible to +enter a credit deadlock scenario wherein the worker thread lacks the credit +to enqueue an event, and it must dequeue an event before it can recover the +credit. If the worker thread retries its enqueue indefinitely, it will not +make forward progress. Such deadlock is possible if the application has event +"loops", in which an event in dequeued from queue A and later enqueued back to +queue A. + +Due to this, workers should stop retrying after a time, release the events it +is attempting to enqueue, and dequeue more events. It is important that the +worker release the events and don't simply set them aside to retry the enqueue +again later, because the port has limited history list size (by default, twice +the port's dequeue_depth). + +Priority +~~~~~~~~ + +The DLB2 supports event priority and per-port queue service priority, as +described in the eventdev header file. The DLB2 does not support 'global' event +queue priority established at queue creation time. + +DLB2 supports 8 event and queue service priority levels. For both priority +types, the PMD uses the upper three bits of the priority field to determine the +DLB2 priority, discarding the 5 least significant bits. The 5 least significant +event priority bits are not preserved when an event is enqueued. + Reconfiguration ~~~~~~~~~~~~~~~
drivers/event/dlb2/dlb2.c +540 -0
553 lines not on this page · raw message
Signature · 1 line
2.6.4
PATCH v10 18/23 event/dlb2: add dequeue and its burst variants
In reply to Timothy McDanielAdd support for dequeue, dequeue_burst, ...
DLB2 does not currently support interrupts, but instead use umonitor/umwait if supported by the processor. This allows the software to monitor and wait on writes to a cache-line.
DLB2 supports normal and sparse cq mode. In normal mode the hardware will pack 4 QEs into each cache line. In sparse cq mode, the hardware will only populate one QE per cache line. Software must be aware of the cq mode, and take the appropriate actions, based on the mode.
--- doc/guides/eventdevs/dlb2.rst | 21 ++ drivers/event/dlb2/dlb2.c | 783 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 804 insertions(+)
doc/guides/eventdevs/dlb2.rst +21 -0
@@ -314,6 +314,27 @@ The PMD does not support the following configuration sequences: This sequence is not supported because the event device must be reconfigured before its ports or queues can be. +Deferred Scheduling +~~~~~~~~~~~~~~~~~~~ + +The DLB2 PMD's default behavior for managing a CQ is to "pop" the CQ once per +dequeued event before returning from rte_event_dequeue_burst(). This frees the +corresponding entries in the CQ, which enables the DLB2 to schedule more events +to it. + +To support applications seeking finer-grained scheduling control -- for example +deferring scheduling to get the best possible priority scheduling and +load-balancing -- the PMD supports a deferred scheduling mode. In this mode, +the CQ entry is not popped until the *subsequent* rte_event_dequeue_burst() +call. This mode only applies to load-balanced event ports with dequeue depth of +1. + +To enable deferred scheduling, use the defer_sched vdev argument like so: + + .. code-block:: console + + --vdev=dlb1_event,defer_sched=on + Atomic Inflights Allocation ~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/event/dlb2/dlb2.c +783 -0
810 lines not on this page · raw message
Signature · 1 line
2.6.4
PATCH v10 19/23 event/dlb2: add eventdev stop and close
In reply to Timothy McDanielAdd support for eventdev stop and close entry points.
--- drivers/event/dlb2/dlb2.c | 257 +++++++++++++++++++++++++++-- drivers/event/dlb2/dlb2_iface.c | 6 + drivers/event/dlb2/dlb2_iface.h | 6 + drivers/event/dlb2/pf/base/dlb2_resource.c | 91 ++++++++++ drivers/event/dlb2/pf/dlb2_pf.c | 52 ++++++ 5 files changed, 396 insertions(+), 16 deletions(-)
drivers/event/dlb2/dlb2.c +241 -16
@@ -71,21 +71,6 @@ static struct rte_event_dev_info evdev_dlb2_default_info = {struct process_local_port_data dlb2_port[DLB2_MAX_NUM_PORTS ][DLB2_NUM_PORT_TYPES ]; -/* -* DUMMY - added so that xstats path will compile/link. -* Will be replaced by real version in a subsequent -* patch. -*/ -uint32_t -dlb2_get_queue_depth (struct dlb2_eventdev *dlb2, -struct dlb2_eventdev_queue *queue) -{ -RTE_SET_USED (dlb2); -RTE_SET_USED (queue); - -return 0 ; -} -static void dlb2_free_qe_mem (struct dlb2_port *qm_port) {
@@ -1878,7 +1863,6 @@ dlb2_eventdev_port_unlink(struct rte_eventdev *dev, void *event_port,return 0 ;/* Ignore and return success */ } -/* FIXME: How to handle unlink on a directed port? */ if (ev_port->qm_port.is_directed) {DLB2_LOG_DBG ("dlb2: ignore unlink from dir port %d\n" , ev_port->id);
@@ -3396,6 +3380,245 @@ dlb2_event_dequeue_sparse(void *event_port, struct rte_event *ev, }static void +dlb2_flush_port (struct rte_eventdev *dev,int port_id) +{ +struct dlb2_eventdev *dlb2 =dlb2_pmd_priv (dev); +eventdev_stop_flush_t flush; +struct rte_event ev; +uint8_t dev_id; +void *arg; +int i; + + flush = dev->dev_ops->dev_stop_flush; + dev_id = dev->data->dev_id; + arg = dev->data->dev_stop_flush_arg; + +while (rte_event_dequeue_burst (dev_id, port_id, &ev,1 ,0 )) { +if (flush) +flush (dev_id, ev, arg); + +if (dlb2->ev_ports[port_id].qm_port.is_directed) +continue ; + + ev.op =RTE_EVENT_OP_RELEASE ; + +rte_event_enqueue_burst (dev_id, port_id, &ev,1 ); + } + +/* Enqueue any additional outstanding releases */ + ev.op =RTE_EVENT_OP_RELEASE ; + +for (i = dlb2->ev_ports[port_id].outstanding_releases; i >0 ; i--) +rte_event_enqueue_burst (dev_id, port_id, &ev,1 ); +} + +static uint32_t +dlb2_get_ldb_queue_depth (struct dlb2_eventdev *dlb2, +struct dlb2_eventdev_queue *queue) +{ +struct dlb2_hw_dev *handle = &dlb2->qm_instance; +struct dlb2_get_ldb_queue_depth_args cfg; +int ret; + + cfg.queue_id = queue->qm_queue.id; + + ret =dlb2_iface_get_ldb_queue_depth (handle, &cfg); +if (ret <0 ) { +DLB2_LOG_ERR ("dlb2: get_ldb_queue_depth ret=%d (driver status: %s)\n" , + ret, dlb2_error_strings[cfg.response.status]); +return ret; + } + +return cfg.response.id; +} + +static uint32_t +dlb2_get_dir_queue_depth (struct dlb2_eventdev *dlb2, +struct dlb2_eventdev_queue *queue) +{ +struct dlb2_hw_dev *handle = &dlb2->qm_instance; +struct dlb2_get_dir_queue_depth_args cfg; +int ret; + + cfg.queue_id = queue->qm_queue.id; + + ret =dlb2_iface_get_dir_queue_depth (handle, &cfg); +if (ret <0 ) { +DLB2_LOG_ERR ("dlb2: get_dir_queue_depth ret=%d (driver status: %s)\n" , + ret, dlb2_error_strings[cfg.response.status]); +return ret; + } + +return cfg.response.id; +} + +uint32_t +dlb2_get_queue_depth (struct dlb2_eventdev *dlb2, +struct dlb2_eventdev_queue *queue) +{ +if (queue->qm_queue.is_directed) +return dlb2_get_dir_queue_depth (dlb2, queue); +else +return dlb2_get_ldb_queue_depth (dlb2, queue); +} + +static bool +dlb2_queue_is_empty (struct dlb2_eventdev *dlb2, +struct dlb2_eventdev_queue *queue) +{ +return dlb2_get_queue_depth (dlb2, queue) ==0 ; +} + +static bool +dlb2_linked_queues_empty (struct dlb2_eventdev *dlb2) +{ +int i; + +for (i =0 ; i < dlb2->num_queues; i++) { +if (dlb2->ev_queues[i].num_links ==0 ) +continue ; +if (!dlb2_queue_is_empty (dlb2, &dlb2->ev_queues[i])) +return false; + } + +return true; +} + +static bool +dlb2_queues_empty (struct dlb2_eventdev *dlb2) +{ +int i; + +for (i =0 ; i < dlb2->num_queues; i++) { +if (!dlb2_queue_is_empty (dlb2, &dlb2->ev_queues[i])) +return false; + } + +return true; +} + +static void +dlb2_drain (struct rte_eventdev *dev) +{ +struct dlb2_eventdev *dlb2 =dlb2_pmd_priv (dev); +struct dlb2_eventdev_port *ev_port =NULL ; +uint8_t dev_id; +int i; + + dev_id = dev->data->dev_id; + +while (!dlb2_linked_queues_empty (dlb2)) { +/* Flush all the ev_ports, which will drain all their connected +* queues. +*/ +for (i =0 ; i < dlb2->num_ports; i++) +dlb2_flush_port (dev, i); + } + +/* The queues are empty, but there may be events left in the ports. */ +for (i =0 ; i < dlb2->num_ports; i++) +dlb2_flush_port (dev, i); + +/* If the domain's queues are empty, we're done. */ +if (dlb2_queues_empty (dlb2)) +return ; + +/* Else, there must be at least one unlinked load-balanced queue. +* Select a load-balanced port with which to drain the unlinked +* queue(s). +*/ +for (i =0 ; i < dlb2->num_ports; i++) { + ev_port = &dlb2->ev_ports[i]; + +if (!ev_port->qm_port.is_directed) +break ; + } + +if (i == dlb2->num_ports) { +DLB2_LOG_ERR ("internal error: no LDB ev_ports\n" ); +return ; + } + + rte_errno =0 ; +rte_event_port_unlink (dev_id, ev_port->id,NULL ,0 ); + +if (rte_errno) { +DLB2_LOG_ERR ("internal error: failed to unlink ev_port %d\n" , + ev_port->id); +return ; + } + +for (i =0 ; i < dlb2->num_queues; i++) { +uint8_t qid, prio; +int ret; + +if (dlb2_queue_is_empty (dlb2, &dlb2->ev_queues[i])) +continue ; + + qid = i; + prio =0 ; + +/* Link the ev_port to the queue */ + ret =rte_event_port_link (dev_id, ev_port->id, &qid, &prio,1 ); +if (ret !=1 ) { +DLB2_LOG_ERR ("internal error: failed to link ev_port %d to queue %d\n" , + ev_port->id, qid); +return ; + } + +/* Flush the queue */ +while (!dlb2_queue_is_empty (dlb2, &dlb2->ev_queues[i])) +dlb2_flush_port (dev, ev_port->id); + +/* Drain any extant events in the ev_port. */ +dlb2_flush_port (dev, ev_port->id); + +/* Unlink the ev_port from the queue */ + ret =rte_event_port_unlink (dev_id, ev_port->id, &qid,1 ); +if (ret !=1 ) { +DLB2_LOG_ERR ("internal error: failed to unlink ev_port %d to queue %d\n" , + ev_port->id, qid); +return ; + } + } +} + +static void +dlb2_eventdev_stop (struct rte_eventdev *dev) +{ +struct dlb2_eventdev *dlb2 =dlb2_pmd_priv (dev); + +rte_spinlock_lock (&dlb2->qm_instance.resource_lock); + +if (dlb2->run_state ==DLB2_RUN_STATE_STOPPED ) { +DLB2_LOG_DBG ("Internal error: already stopped\n" ); +rte_spinlock_unlock (&dlb2->qm_instance.resource_lock); +return ; + }else if (dlb2->run_state !=DLB2_RUN_STATE_STARTED ) { +DLB2_LOG_ERR ("Internal error: bad state %d for dev_stop\n" , + (int )dlb2->run_state); +rte_spinlock_unlock (&dlb2->qm_instance.resource_lock); +return ; + } + + dlb2->run_state =DLB2_RUN_STATE_STOPPING ; + +rte_spinlock_unlock (&dlb2->qm_instance.resource_lock); + +dlb2_drain (dev); + + dlb2->run_state =DLB2_RUN_STATE_STOPPED ; +} + +static int +dlb2_eventdev_close (struct rte_eventdev *dev) +{ +dlb2_hw_reset_sched_domain (dev, false); + +return 0 ; +} + +static void dlb2_entry_points_init (struct rte_eventdev *dev) {struct dlb2_eventdev *dlb2;
@@ -3405,6 +3628,8 @@ dlb2_entry_points_init(struct rte_eventdev *dev) .dev_infos_get = dlb2_eventdev_info_get, .dev_configure = dlb2_eventdev_configure, .dev_start = dlb2_eventdev_start, + .dev_stop = dlb2_eventdev_stop, + .dev_close = dlb2_eventdev_close, .queue_def_conf = dlb2_eventdev_queue_default_conf_get, .queue_setup = dlb2_eventdev_queue_setup, .port_def_conf = dlb2_eventdev_port_default_conf_get,
drivers/event/dlb2/dlb2_iface.c +6 -0
@@ -66,3 +66,9 @@ int (*dlb2_iface_pending_port_unmaps)(struct dlb2_hw_dev *handle,int (*dlb2_iface_sched_domain_start)(struct dlb2_hw_dev *handle,struct dlb2_start_domain_args *cfg); + +int (*dlb2_iface_get_ldb_queue_depth)(struct dlb2_hw_dev *handle, +struct dlb2_get_ldb_queue_depth_args *args); + +int (*dlb2_iface_get_dir_queue_depth)(struct dlb2_hw_dev *handle, +struct dlb2_get_dir_queue_depth_args *args);
drivers/event/dlb2/dlb2_iface.h +6 -0
@@ -65,4 +65,10 @@ extern int (*dlb2_iface_pending_port_unmaps)(struct dlb2_hw_dev *handle,extern int (*dlb2_iface_sched_domain_start)(struct dlb2_hw_dev *handle,struct dlb2_start_domain_args *cfg); + +extern int (*dlb2_iface_get_ldb_queue_depth)(struct dlb2_hw_dev *handle, +struct dlb2_get_ldb_queue_depth_args *args); + +extern int (*dlb2_iface_get_dir_queue_depth)(struct dlb2_hw_dev *handle, +struct dlb2_get_dir_queue_depth_args *args);#endif /* _DLB2_IFACE_H_ */
drivers/event/dlb2/pf/base/dlb2_resource.c +91 -0
94 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_pf.c +52 -0
64 lines not on this page · raw message
Signature · 1 line
2.6.4
PATCH v10 20/23 event/dlb2: add PMD's token pop public interface
In reply to Timothy McDanielThe PMD uses a public interface to allow applications to control the token pop mode. Supported token pop modes are as follows, and they impact core scheduling affinity for ldb ports.
AUTO_POP: Pop the CQ tokens immediately after dequeueing.DELAYED_POP: Pop CQ tokens after (dequeue_depth - 1) events
are released. Supported on load-balanced ports only.DEFERRED_POP: Pop the CQ tokens during next dequeue operation.
--- doc/api/doxy-api-index.md | 3 +- doc/api/doxy-api.conf.in | 1 + drivers/event/dlb2/dlb2.c | 65 +++++++++++++++++++++++++++++++---- drivers/event/dlb2/dlb2_priv.h | 3 ++ drivers/event/dlb2/meson.build | 6 ++-- drivers/event/dlb2/rte_pmd_dlb2.c | 39 +++++++++++++++++++++ drivers/event/dlb2/rte_pmd_dlb2.h | 72 +++++++++++++++++++++++++++++++++++++++ drivers/event/dlb2/version.map | 6 ++++ 8 files changed, 186 insertions(+), 9 deletions(-) create mode 100644 drivers/event/dlb2/rte_pmd_dlb2.c create mode 100644 drivers/event/dlb2/rte_pmd_dlb2.h
doc/api/doxy-api-index.md +2 -1
@@ -52,7 +52,8 @@ The public API headers are grouped by topics: [dpaa2_mempool] (@ref rte_dpaa2_mempool.h), [dpaa2_cmdif] (@ref rte_pmd_dpaa2_cmdif.h), [dpaa2_qdma] (@ref rte_pmd_dpaa2_qdma.h), - [crypto_scheduler] (@ref rte_cryptodev_scheduler.h) + [crypto_scheduler] (@ref rte_cryptodev_scheduler.h), + [dlb2] (@ref rte_pmd_dlb2.h) - **memory**: [memseg] (@ref rte_memory.h),
doc/api/doxy-api.conf.in +1 -0
@@ -7,6 +7,7 @@ USE_MDFILE_AS_MAINPAGE = @TOPDIR@/doc/api/doxy-api-index.md INPUT = @TOPDIR@/doc/api/doxy-api-index.md \ @TOPDIR@/drivers/bus/vdev \ @TOPDIR@/drivers/crypto/scheduler \ + @TOPDIR@/drivers/event/dlb2 \ @TOPDIR@/drivers/mempool/dpaa2 \ @TOPDIR@/drivers/net/ark \ @TOPDIR@/drivers/net/bnxt \
drivers/event/dlb2/dlb2.c +59 -6
154 lines not on this page · raw message
drivers/event/dlb2/dlb2_priv.h +3 -0
@@ -12,6 +12,7 @@#include <rte_config.h> #include "dlb2_user.h" #include "dlb2_log.h" +#include "rte_pmd_dlb2.h" #ifndef RTE_LIBRTE_PMD_DLB2_QUELL_STATS #define DLB2_INC_STAT (_stat, _incr_val) ((_stat) += _incr_val)
@@ -290,6 +291,7 @@ struct dlb2_port {bool gen_bit;uint16_t dir_credits;uint32_t dequeue_depth; +enum dlb2_token_pop_mode token_pop_mode;union dlb2_port_config cfg;uint32_t *credit_pool[DLB2_NUM_QUEUE_TYPES ];/* use __atomic builtins */ uint16_t cached_ldb_credits;
@@ -298,6 +300,7 @@ struct dlb2_port {bool int_armed;uint16_t owed_tokens;int16_t issued_releases; +int16_t token_pop_thresh;int cq_depth;uint16_t cq_idx;uint16_t cq_idx_unmasked;
drivers/event/dlb2/meson.build +4 -2
@@ -1,3 +1,4 @@ + # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2019-2020 Intel Corporation
@@ -12,9 +13,10 @@ sources = files('dlb2.c', 'dlb2_xstats.c', 'pf/dlb2_main.c', 'pf/dlb2_pf.c', - 'pf/base/dlb2_resource.c' + 'pf/base/dlb2_resource.c', + 'rte_pmd_dlb2.c' ) -headers = files() +headers = files('rte_pmd_dlb2.h') deps += ['mbuf', 'mempool', 'ring', 'pci', 'bus_pci']
drivers/event/dlb2/rte_pmd_dlb2.c new file +39 -0
@@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2020 Intel Corporation +*/ + +#include <rte_eventdev.h> +#include <rte_eventdev_pmd.h> + +#include "rte_pmd_dlb2.h" +#include "dlb2_priv.h" +#include "dlb2_inline_fns.h" + +int +rte_pmd_dlb2_set_token_pop_mode (uint8_t dev_id, +uint8_t port_id, +enum dlb2_token_pop_mode mode) +{ +struct dlb2_eventdev *dlb2; +struct rte_eventdev *dev; + +RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET (dev_id, -EINVAL ); + dev = &rte_eventdevs[dev_id]; + + dlb2 =dlb2_pmd_priv (dev); + +if (mode >=NUM_TOKEN_POP_MODES ) +return -EINVAL ; + +/* The event device must be configured, but not yet started */ +if (!dlb2->configured || dlb2->run_state !=DLB2_RUN_STATE_STOPPED ) +return -EINVAL ; + +/* The token pop mode must be set before configuring the port */ +if (port_id >= dlb2->num_ports || dlb2->ev_ports[port_id].setup_done) +return -EINVAL ; + + dlb2->ev_ports[port_id].qm_port.token_pop_mode = mode; + +return 0 ; +}
drivers/event/dlb2/rte_pmd_dlb2.h new file +72 -0
72 lines not on this page · raw message
drivers/event/dlb2/version.map +6 -0
@@ -1,3 +1,9 @@ DPDK_21 { local: *; }; + +EXPERIMENTAL { + global: + + rte_pmd_dlb2_set_token_pop_mode; +};
Signature · 1 line
2.6.4
PATCH v10 21/23 event/dlb2: add PMD self-tests
In reply to Timothy McDanielAdd a variety of self-tests for both ldb and directed ports/queues, as well as configure, start, stop, link, etc...
--- app/test/test_eventdev.c | 7 + drivers/event/dlb2/dlb2.c | 1 + drivers/event/dlb2/dlb2_selftest.c | 1524 ++++++++++++++++++++++++++++++++++++ drivers/event/dlb2/meson.build | 3 +- 4 files changed, 1534 insertions(+), 1 deletion(-) create mode 100644 drivers/event/dlb2/dlb2_selftest.c
app/test/test_eventdev.c +7 -0
@@ -1030,6 +1030,12 @@ test_eventdev_selftest_dpaa2(void)return test_eventdev_selftest_impl ("event_dpaa2" ,"" ); } +static int +test_eventdev_selftest_dlb2 (void ) +{ +return test_eventdev_selftest_impl ("dlb2_event" ,"" ); +} +REGISTER_TEST_COMMAND (eventdev_common_autotest, test_eventdev_common);REGISTER_TEST_COMMAND (eventdev_selftest_sw, test_eventdev_selftest_sw); REGISTER_TEST_COMMAND(eventdev_selftest_octeontx,
@@ -1037,3 +1043,4 @@ REGISTER_TEST_COMMAND(eventdev_selftest_octeontx,REGISTER_TEST_COMMAND (eventdev_selftest_octeontx2, test_eventdev_selftest_octeontx2);REGISTER_TEST_COMMAND (eventdev_selftest_dpaa2, test_eventdev_selftest_dpaa2); +REGISTER_TEST_COMMAND (eventdev_selftest_dlb2, test_eventdev_selftest_dlb2);
drivers/event/dlb2/dlb2.c +1 -0
@@ -3692,6 +3692,7 @@ dlb2_entry_points_init(struct rte_eventdev *dev) .xstats_get_names = dlb2_eventdev_xstats_get_names, .xstats_get_by_name = dlb2_eventdev_xstats_get_by_name, .xstats_reset = dlb2_eventdev_xstats_reset, + .dev_selftest = test_dlb2_eventdev, };/* Expose PMD's eventdev interface */
drivers/event/dlb2/dlb2_selftest.c new file +1524 -0
1,524 lines not on this page · raw message
drivers/event/dlb2/meson.build +2 -1
@@ -14,7 +14,8 @@ sources = files('dlb2.c', 'pf/dlb2_main.c', 'pf/dlb2_pf.c', 'pf/base/dlb2_resource.c', - 'rte_pmd_dlb2.c' + 'rte_pmd_dlb2.c', + 'dlb2_selftest.c' ) headers = files('rte_pmd_dlb2.h')
Signature · 1 line
2.6.4
PATCH v10 22/23 event/dlb2: add queue and port release
In reply to Timothy McDanielDLB does not support reconfiguring individual queues or ports on the fly. The entire device must be reconfigured. Previously allocated port QE and memzone memory
is freed in this patch.
--- drivers/event/dlb2/dlb2.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/event/dlb2/dlb2.c +24 -0
@@ -3668,6 +3668,28 @@ dlb2_eventdev_close(struct rte_eventdev *dev) }static void +dlb2_eventdev_queue_release (struct rte_eventdev *dev,uint8_t id) +{ +RTE_SET_USED (dev); +RTE_SET_USED (id); + +/* This function intentionally left blank. */ +} + +static void +dlb2_eventdev_port_release (void *port) +{ +struct dlb2_eventdev_port *ev_port = port; +struct dlb2_port *qm_port; + +if (ev_port) { + qm_port = &ev_port->qm_port; +if (qm_port->config_state ==DLB2_CONFIGURED ) +dlb2_free_qe_mem (qm_port); + } +} + +static void dlb2_entry_points_init (struct rte_eventdev *dev) {struct dlb2_eventdev *dlb2;
@@ -3681,8 +3703,10 @@ dlb2_entry_points_init(struct rte_eventdev *dev) .dev_close = dlb2_eventdev_close, .queue_def_conf = dlb2_eventdev_queue_default_conf_get, .queue_setup = dlb2_eventdev_queue_setup, + .queue_release = dlb2_eventdev_queue_release, .port_def_conf = dlb2_eventdev_port_default_conf_get, .port_setup = dlb2_eventdev_port_setup, + .port_release = dlb2_eventdev_port_release, .port_link = dlb2_eventdev_port_link, .port_unlink = dlb2_eventdev_port_unlink, .port_unlinks_in_progress =
Signature · 1 line
2.6.4
PATCH v10 23/23 event/dlb2: add timeout ticks entry point
In reply to Timothy McDanielAdds the timeout ticks conversion function.
--- drivers/event/dlb2/dlb2.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/event/dlb2/dlb2.c +13 -0
@@ -3689,6 +3689,18 @@ dlb2_eventdev_port_release(void *port) } } +static int +dlb2_eventdev_timeout_ticks (struct rte_eventdev *dev,uint64_t ns, +uint64_t *timeout_ticks) +{ +RTE_SET_USED (dev); +uint64_t cycles_per_ns =rte_get_timer_hz () /1E9 ; + + *timeout_ticks = ns * cycles_per_ns; + +return 0 ; +} +static void dlb2_entry_points_init (struct rte_eventdev *dev) {
@@ -3711,6 +3723,7 @@ dlb2_entry_points_init(struct rte_eventdev *dev) .port_unlink = dlb2_eventdev_port_unlink, .port_unlinks_in_progress = dlb2_eventdev_port_unlinks_in_progress, + .timeout_ticks = dlb2_eventdev_timeout_ticks, .dump = dlb2_eventdev_dump, .xstats_get = dlb2_eventdev_xstats_get, .xstats_get_names = dlb2_eventdev_xstats_get_names,
Signature · 1 line
2.6.4
v11 cover Add DLB2 PMD
In reply to Timothy McDanielThe following patch series adds support for a new eventdev PMD. The DLB2 PMD adds support for the Intel Dynamic Load Balancer 2.0 (DLB2) hardware.
The DLB2 is a PCIe device that provides load-balanced, prioritized scheduling of core-to-core communication. The device consists of queues and arbiters that connect producer and consumer cores, and implements load-balanced queueing features including:
- Lock-free multi-producer/multi-consumer operation.
- Multiple priority levels for varying traffic types.
- 'Direct' traffic (i.e. multi-producer/single-consumer)
- Simple unordered load-balanced distribution.
- Atomic lock-free load balancing across multiple consumers.
- Queue element reordering feature allowing ordered load-balanced distribution.
The DLB2 hardware supports both load balanced and directed ports and queues. Unlike other eventdev devices already in the repo, not all DLB2 ports and queues are equally capable. In particular, directed ports are limited to a single link, and must be connected to a directed queue. Additionally, even though LDB ports may link multiple queues,
the number of queues that may be linked is limited by hardware.
While reviewing the code, please be aware that this PMD has full control over the DLB2 hardware. Intel will be extending the DLB2 PMD in the future (not as part of this first series) with a mode that we refer to as the bifurcated PMD. The bifurcated PMD communicates with a kernel driver to configure the device, ports, and queues, and memory maps device MMIO so datapath operations occur purely in user-space. Note that the DLB2 hardware is a successor of the DLB hardware, and as such is structured similarly, both in terms of code layout and implementation.
The framework to support both the PF PMD and bifurcated PMD exists in this patchset, and is why the iface.[ch] layer is present.
Changes since V10
=================
- converted printfs in dlb2/pf/dlb2_main.c to DLB2_LOG
- fixed a repeated word error in dlb2/pf/base/osdep_bitmap.h
- caught up with marking the patches that Gage reviewed
Changes since V9
================
Address comments from David Marchand:
- this patch-set is based on Nov 1, 2020 dpdk-next-eventdev
- fix docs build (doxy-api.conf.in and doxy-api-index.md)
- restore blank line in MAINTAINERS file
- move dlb announcement in release_20_11.rst after ethdev
- use headers = files() for exported meson public headers
- fix a typo in 'add documentation ..." commit message
- use eal version of cldemote
- convert a couple of printfs to LOG messages
- all patches build incrementally (gcc), and checkpatches reports success
- I am not able to run clang locally. If clang errors are still present I will ask IT to install clang on a build server tomorrow.
Changes since V8:
=================
- Fixed format errors in doc/api/doxy-api-index.md
- Delayed introduction of dlb2_consume_qe_immediate until add-dequeue-and-its-burst-variants.patch
- Delayed introduction of dlb2_construct_token_pop_qe until add-PMD-s-token-pop-public-interface.patch
Changes since V7:
================
- fix CENTOS build error: use __m128i instead of __v2di with _mm_stream_si128
- deleted unused dlb2_umwait and dlb2_umonitor functions
Changes since V6:
=================
- removed unused function, fixing build error
- fixed typo in port_setup commit message
- this patch series is based on dpdk-next-eventdev
Changes since V5:
================
- convert to use rte_power_monitor patches
- replace __builtin_ia32_movntdq() with _mm_stream_si128()
- remove unused functions in dlb_selftest.c
- workaround for RHEL 7 gcc brace bug
Changes since V4:
================
- moved introduction of dlb in relnotes_20_11 to first patch in series
- fixed underlines in dlb.rst that were too short
- note that the code still uses its private byte-encoded versions of umonitor/umwait, rather than the new functions in the power patch that are built on top of those intrinsics. This is intentional.
Changes since V3:
================
- updated MAINTAINERS file to alphabetically insert DLB
- don't create RTE_ symbols in pmd
- converted to use version.map scheme
- converted to use .._master_lcore instead of .._main_lcore
- this patch set is based on dpdk-next-eventdev
Changes since V2:
================
- fixed meson conditional build. Moved test into driver’s meson.build file instead of event/meson.build
- documentation is populated as associated code is introduced
- add log_register in add dynamic logging patch
- rename RTE_xxx symbol(s) as DLB2_xxx
- replaced function ptr enqueue_four with direct call to movdir64b
- remove unused port_pages
- broke up probe patch into 3 smaller patches for easier review
- changed param order of movdir64b/movntdq to match intrinsics
- added self to MAINTAINERS files
- squashed announcement of availability into last patch in series
- correct spelling errors and delete repeated words
- DPDK_21.0 -> DPDK 21 in map file
- add experimental banner to public structs and APIs
Changes since V1:
=================
- implement changes requested in code reviews by Gage Eads and Mike Chen
- fix a memzone leak
- convert to use eal rte-cpuflags patch from Liang Ma
Known Issues:
- the documentation contained in dlb2.rst is not complete, and should be updated to include command line parameters (class of service, etc ...).
Depends-on: patch-82202 ("eventdev: increase MAX QUEUES PER DEV to 255")
Timothy McDaniel (23):
event/dlb2: add documentation and meson build infrastructure event/dlb2: add dynamic logging
event/dlb2: add private data structures and constants event/dlb2: add definitions shared with LKM or shared code event/dlb2: add inline functions
event/dlb2: add eventdev probe
event/dlb2: add flexible interface
event/dlb2: add probe-time hardware init event/dlb2: add xstats
event/dlb2: add infos get and configure event/dlb2: add queue and port default conf event/dlb2: add queue setup
event/dlb2: add port setup
event/dlb2: add port link
event/dlb2: add port unlink and port unlinks in progress event/dlb2: add eventdev start
event/dlb2: add enqueue and its burst variants event/dlb2: add dequeue and its burst variants event/dlb2: add eventdev stop and close event/dlb2: add PMD's token pop public interface event/dlb2: add PMD self-tests
event/dlb2: add queue and port release
event/dlb2: add timeout ticks entry point
MAINTAINERS | 5 + app/test/test_eventdev.c | 7 + config/rte_config.h | 7 + doc/api/doxy-api-index.md | 3 +- doc/api/doxy-api.conf.in | 1 + doc/guides/eventdevs/dlb2.rst | 365 ++ doc/guides/eventdevs/index.rst | 1 + doc/guides/rel_notes/release_20_11.rst | 5 + drivers/event/dlb2/dlb2.c | 3947 ++++++++++++++++ drivers/event/dlb2/dlb2_iface.c | 74 + drivers/event/dlb2/dlb2_iface.h | 74 + drivers/event/dlb2/dlb2_inline_fns.h | 33 + drivers/event/dlb2/dlb2_log.h | 25 + drivers/event/dlb2/dlb2_priv.h | 578 +++ drivers/event/dlb2/dlb2_selftest.c | 1524 ++++++ drivers/event/dlb2/dlb2_user.h | 679 +++ drivers/event/dlb2/dlb2_xstats.c | 1235 +++++ drivers/event/dlb2/meson.build | 23 + drivers/event/dlb2/pf/base/dlb2_hw_types.h | 367 ++ drivers/event/dlb2/pf/base/dlb2_mbox.h | 596 +++ drivers/event/dlb2/pf/base/dlb2_osdep.h | 230 + drivers/event/dlb2/pf/base/dlb2_osdep_bitmap.h | 440 ++ drivers/event/dlb2/pf/base/dlb2_osdep_list.h | 131 + drivers/event/dlb2/pf/base/dlb2_osdep_types.h | 31 + drivers/event/dlb2/pf/base/dlb2_regs.h | 2527 ++++++++++ drivers/event/dlb2/pf/base/dlb2_resource.c | 6027 ++++++++++++++++++++++++ drivers/event/dlb2/pf/base/dlb2_resource.h | 1913 ++++++++ drivers/event/dlb2/pf/dlb2_main.c | 673 +++ drivers/event/dlb2/pf/dlb2_main.h | 97 + drivers/event/dlb2/pf/dlb2_pf.c | 728 +++ drivers/event/dlb2/rte_pmd_dlb2.c | 39 + drivers/event/dlb2/rte_pmd_dlb2.h | 72 + drivers/event/dlb2/version.map | 9 + drivers/event/meson.build | 3 +- 34 files changed, 22467 insertions(+), 2 deletions(-) create mode 100644 doc/guides/eventdevs/dlb2.rst create mode 100644 drivers/event/dlb2/dlb2.c create mode 100644 drivers/event/dlb2/dlb2_iface.c create mode 100644 drivers/event/dlb2/dlb2_iface.h create mode 100644 drivers/event/dlb2/dlb2_inline_fns.h create mode 100644 drivers/event/dlb2/dlb2_log.h create mode 100644 drivers/event/dlb2/dlb2_priv.h create mode 100644 drivers/event/dlb2/dlb2_selftest.c create mode 100644 drivers/event/dlb2/dlb2_user.h create mode 100644 drivers/event/dlb2/dlb2_xstats.c create mode 100644 drivers/event/dlb2/meson.build create mode 100644 drivers/event/dlb2/pf/base/dlb2_hw_types.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_mbox.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_osdep.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_osdep_bitmap.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_osdep_list.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_osdep_types.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_regs.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_resource.c create mode 100644 drivers/event/dlb2/pf/base/dlb2_resource.h create mode 100644 drivers/event/dlb2/pf/dlb2_main.c create mode 100644 drivers/event/dlb2/pf/dlb2_main.h create mode 100644 drivers/event/dlb2/pf/dlb2_pf.c create mode 100644 drivers/event/dlb2/rte_pmd_dlb2.c create mode 100644 drivers/event/dlb2/rte_pmd_dlb2.h create mode 100644 drivers/event/dlb2/version.map
Signature · 1 line
2.6.4
PATCH v11 1/23 event/dlb2: add documentation and meson build infrastructure
Adds the meson build infrastructure, which includes compile-time constants in rte_config.h. DLB2 is only supported on Linux 64 bit X86 platforms at this time.
Adds announcement of availability for the new driver for Intel Dynamic Load Balancer 2.0 hardware.
--- MAINTAINERS | 5 +++++ config/rte_config.h | 7 ++++++ doc/guides/eventdevs/dlb2.rst | 40 ++++++++++++++++++++++++++++++++++ doc/guides/eventdevs/index.rst | 1 + doc/guides/rel_notes/release_20_11.rst | 5 +++++ drivers/event/dlb2/meson.build | 15 +++++++++++++ drivers/event/dlb2/version.map | 3 +++ drivers/event/meson.build | 3 ++- 8 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 doc/guides/eventdevs/dlb2.rst create mode 100644 drivers/event/dlb2/meson.build create mode 100644 drivers/event/dlb2/version.map
MAINTAINERS +5 -0
@@ -1176,6 +1176,11 @@ Cavium OCTEON TX timvf M: Pavan Nikhilesh <[email protected]> F: drivers/event/octeontx/timvf_* +Intel DLB2 +M: Timothy McDaniel <[email protected]> +F: drivers/event/dlb2/ +F: doc/guides/eventdevs/dlb2.rst + Marvell OCTEON TX2 M: Pavan Nikhilesh <[email protected]> M: Jerin Jacob <[email protected]>
config/rte_config.h +7 -0
@@ -135,4 +135,11 @@/* QEDE PMD defines */ #define RTE_LIBRTE_QEDE_FW "" +/* DLB2 defines */ +#define RTE_LIBRTE_PMD_DLB2_POLL_INTERVAL 1000 +#define RTE_LIBRTE_PMD_DLB2_UMWAIT_CTL_STATE 0 +#undef RTE_LIBRTE_PMD_DLB2_QUELL_STATS +#define RTE_LIBRTE_PMD_DLB2_SW_CREDIT_QUANTA 32 +#define RTE_PMD_DLB2_DEFAULT_DEPTH_THRESH 256 +#endif /* _RTE_CONFIG_H_ */
doc/guides/eventdevs/dlb2.rst new file +40 -0
@@ -0,0 +1,40 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright(c) 2020 Intel Corporation. + +Driver for the Intel® Dynamic Load Balancer (DLB2) +================================================== + +The DPDK dlb poll mode driver supports the Intel® Dynamic Load Balancer. + +Prerequisites +------------- + +Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup +the basic DPDK environment. + +Configuration +------------- + +The DLB2 PF PMD is a user-space PMD that uses VFIO to gain direct +device access. To use this operation mode, the PCIe PF device must be bound +to a DPDK-compatible VFIO driver, such as vfio-pci. + +Eventdev API Notes +------------------ + +The DLB2 provides the functions of a DPDK event device; specifically, it +supports atomic, ordered, and parallel scheduling events from queues to ports. +However, the DLB2 hardware is not a perfect match to the eventdev API. Some DLB2 +features are abstracted by the PMD such as directed ports. + +In general the dlb PMD is designed for ease-of-use and does not require a +detailed understanding of the hardware, but these details are important when +writing high-performance code. This section describes the places where the +eventdev API and DLB2 misalign. + +Flow ID +~~~~~~~ + +The flow ID field is preserved in the event when it is scheduled in the +DLB2. +
doc/guides/eventdevs/index.rst +1 -0
@@ -11,6 +11,7 @@ application through the eventdev API. :maxdepth: 2 :numbered: + dlb2 dpaa dpaa2 dsw
doc/guides/rel_notes/release_20_11.rst +5 -0
@@ -295,6 +295,11 @@ New Features Added performance tuning arguments to allow tuning the scheduler for better throughtput in high core count use cases. +* **Added a new driver for the Intel Dynamic Load Balancer v2.0 device.** + + Added the new ``dlb2`` eventdev driver for the Intel DLB V2.0 device. See the + :doc:`../eventdevs/dlb2` eventdev guide for more details on this new driver. + * **Updated ioat rawdev driver** The ioat rawdev driver has been updated and enhanced. Changes include:
drivers/event/dlb2/meson.build new file +15 -0
@@ -0,0 +1,15 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2019-2020 Intel Corporation + +if not is_linux or not dpdk_conf.has('RTE_ARCH_X86_64') + build = false + reason = 'only supported on ARCH_X86_64 Linux' + subdir_done() +endif + +sources = files( +) + +headers = files() + +deps += ['mbuf', 'mempool', 'ring', 'pci', 'bus_pci']
drivers/event/dlb2/version.map new file +3 -0
@@ -0,0 +1,3 @@ +DPDK_21 { + local: *; +};
drivers/event/meson.build +2 -1
@@ -5,7 +5,8 @@ if is_windows subdir_done() endif -drivers = ['dpaa', 'dpaa2', 'octeontx2', 'opdl', 'skeleton', 'sw', 'dsw'] +drivers = ['dlb2', 'dpaa', 'dpaa2', 'octeontx2', 'opdl', 'skeleton', 'sw', + 'dsw'] if not (toolchain == 'gcc' and cc.version().version_compare('<4.8.6') and dpdk_conf.has('RTE_ARCH_ARM64')) drivers += 'octeontx'
Signature · 1 line
2.6.4
PATCH v11 2/23 event/dlb2: add dynamic logging
In reply to Timothy McDanielThis commit adds base support for dynamic logging. The default log level is NOTICE. Dynamic logging is used exclusively throughout this patchset.
--- drivers/event/dlb2/dlb2.c | 7 +++++++ drivers/event/dlb2/dlb2_log.h | 25 +++++++++++++++++++++++++ drivers/event/dlb2/meson.build | 3 +-- 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 drivers/event/dlb2/dlb2.c create mode 100644 drivers/event/dlb2/dlb2_log.h
drivers/event/dlb2/dlb2.c new file +7 -0
@@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2016-2020 Intel Corporation +*/ + +#include <rte_log.h> + +RTE_LOG_REGISTER (eventdev_dlb2_log_level, pmd.event.dlb2,NOTICE );
drivers/event/dlb2/dlb2_log.h new file +25 -0
@@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2016-2020 Intel Corporation +*/ + +#ifndef _DLB2_EVDEV_LOG_H_ +#define _DLB2_EVDEV_LOG_H_ + +extern int eventdev_dlb2_log_level; + +/* Dynamic logging */ +#define DLB2_LOG_IMPL(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, eventdev_dlb2_log_level, "%s" fmt "\n", \ + __func__, ##args) + +#define DLB2_LOG_INFO(fmt, args...) \ + DLB2_LOG_IMPL(INFO, fmt, ## args) + +#define DLB2_LOG_ERR(fmt, args...) \ + DLB2_LOG_IMPL(ERR, fmt, ## args) + +/* remove debug logs at compile time unless actually debugging */ +#define DLB2_LOG_DBG(fmt, args...) \ + RTE_LOG_DP(DEBUG, PMD, fmt, ## args) + +#endif /* _DLB2_EVDEV_LOG_H_ */
drivers/event/dlb2/meson.build +1 -2
@@ -7,8 +7,7 @@ if not is_linux or not dpdk_conf.has('RTE_ARCH_X86_64') subdir_done() endif -sources = files( -) +sources = files('dlb2.c') headers = files()
Signature · 1 line
2.6.4
PATCH v11 3/23 event/dlb2: add private data structures and constants
In reply to Timothy McDanielThe header file dlb2_priv.h is used internally by the PMD. It include constants, macros for device resources, structure definitions for hardware interfaces and software state, and various forward-declarations. The header file rte_pmd_dlb2.h will be exported in a subsequent patch, but is included here due to a data structure dependency.
--- drivers/event/dlb2/dlb2_priv.h | 575 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 575 insertions(+) create mode 100644 drivers/event/dlb2/dlb2_priv.h
drivers/event/dlb2/dlb2_priv.h new file +575 -0
@@ -0,0 +1,575 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2016-2020 Intel Corporation +*/ + +#ifndef _DLB2_PRIV_H_ +#define _DLB2_PRIV_H_ + +#include <emmintrin.h> +#include <stdbool.h> + +#include <rte_eventdev.h> +#include <rte_config.h> +#include "dlb2_user.h" +#include "dlb2_log.h" + +#ifndef RTE_LIBRTE_PMD_DLB2_QUELL_STATS +#define DLB2_INC_STAT (_stat, _incr_val) ((_stat) += _incr_val) +#else +#define DLB2_INC_STAT (_stat, _incr_val) +#endif + +#define EVDEV_DLB2_NAME_PMD dlb2_event + +/* command line arg strings */ +#define NUMA_NODE_ARG "numa_node" +#define DLB2_MAX_NUM_EVENTS "max_num_events" +#define DLB2_NUM_DIR_CREDITS "num_dir_credits" +#define DEV_ID_ARG "dev_id" +#define DLB2_DEFER_SCHED_ARG "defer_sched" +#define DLB2_QID_DEPTH_THRESH_ARG "qid_depth_thresh" +#define DLB2_COS_ARG "cos" + +/* Begin HW related defines and structs */ + +#define DLB2_MAX_NUM_DOMAINS 32 +#define DLB2_MAX_NUM_VFS 16 +#define DLB2_MAX_NUM_LDB_QUEUES 32 +#define DLB2_MAX_NUM_LDB_PORTS 64 +#define DLB2_MAX_NUM_DIR_PORTS 64 +#define DLB2_MAX_NUM_DIR_QUEUES 64 +#define DLB2_MAX_NUM_FLOWS (64 * 1024) +#define DLB2_MAX_NUM_LDB_CREDITS (8 * 1024) +#define DLB2_MAX_NUM_DIR_CREDITS (2 * 1024) +#define DLB2_MAX_NUM_LDB_CREDIT_POOLS 64 +#define DLB2_MAX_NUM_DIR_CREDIT_POOLS 64 +#define DLB2_MAX_NUM_HIST_LIST_ENTRIES 2048 +#define DLB2_MAX_NUM_AQOS_ENTRIES 2048 +#define DLB2_MAX_NUM_QIDS_PER_LDB_CQ 8 +#define DLB2_QID_PRIORITIES 8 +#define DLB2_MAX_DEVICE_PATH 32 +#define DLB2_MIN_DEQUEUE_TIMEOUT_NS 1 +/* Note: "- 1" here to support the timeout range check in eventdev_autotest */ +#define DLB2_MAX_DEQUEUE_TIMEOUT_NS (UINT32_MAX - 1) +#define DLB2_SW_CREDIT_BATCH_SZ 32 +#define DLB2_NUM_SN_GROUPS 2 +#define DLB2_MAX_LDB_SN_ALLOC 1024 +#define DLB2_MAX_QUEUE_DEPTH_THRESHOLD 8191 + +/* 2048 total hist list entries and 64 total ldb ports, which +* makes for 2048/64 == 32 hist list entries per port. However, CQ +* depth must be a power of 2 and must also be >= HIST LIST entries. +* As a result we just limit the maximum dequeue depth to 32. +*/ +#define DLB2_MIN_CQ_DEPTH 1 +#define DLB2_MAX_CQ_DEPTH 32 +#define DLB2_MIN_HARDWARE_CQ_DEPTH 8 +#define DLB2_NUM_HIST_LIST_ENTRIES_PER_LDB_PORT \ + DLB2_MAX_CQ_DEPTH + +/* +* Static per queue/port provisioning values +*/ +#define DLB2_NUM_ATOMIC_INFLIGHTS_PER_QUEUE 64 + +#define CQ_BASE (is_dir) ((is_dir) ? DLB2_DIR_CQ_BASE : DLB2_LDB_CQ_BASE) +#define CQ_SIZE (is_dir) ((is_dir) ? DLB2_DIR_CQ_MAX_SIZE : \ + DLB2_LDB_CQ_MAX_SIZE) +#define PP_BASE (is_dir) ((is_dir) ? DLB2_DIR_PP_BASE : DLB2_LDB_PP_BASE) + +#define PAGE_SIZE (sysconf(_SC_PAGESIZE)) + +#define DLB2_NUM_QES_PER_CACHE_LINE 4 + +#define DLB2_MAX_ENQUEUE_DEPTH 64 +#define DLB2_MIN_ENQUEUE_DEPTH 4 + +#define DLB2_NAME_SIZE 64 + +#define DLB2_1K 1024 +#define DLB2_2K (2 * DLB2_1K) +#define DLB2_4K (4 * DLB2_1K) +#define DLB2_16K (16 * DLB2_1K) +#define DLB2_32K (32 * DLB2_1K) +#define DLB2_1MB (DLB2_1K * DLB2_1K) +#define DLB2_16MB (16 * DLB2_1MB) + +/* Use the upper 3 bits of the event priority to select the DLB2 priority */ +#define EV_TO_DLB2_PRIO (x) ((x) >> 5) +#define DLB2_TO_EV_PRIO (x) ((x) << 5) + +enum dlb2_hw_port_types { +DLB2_LDB_PORT , +DLB2_DIR_PORT , +DLB2_NUM_PORT_TYPES /* Must be last */ +}; + +enum dlb2_hw_queue_types { +DLB2_LDB_QUEUE , +DLB2_DIR_QUEUE , +DLB2_NUM_QUEUE_TYPES /* Must be last */ +}; + +#define PORT_TYPE (p) ((p)->is_directed ? DLB2_DIR_PORT : DLB2_LDB_PORT) + +/* Do not change - must match hardware! */ +enum dlb2_hw_sched_type { +DLB2_SCHED_ATOMIC =0 , +DLB2_SCHED_UNORDERED , +DLB2_SCHED_ORDERED , +DLB2_SCHED_DIRECTED , +/* DLB2_NUM_HW_SCHED_TYPES must be last */ +DLB2_NUM_HW_SCHED_TYPES +}; + +struct dlb2_hw_rsrcs { +int32_t nb_events_limit; +uint32_t num_queues;/* Total queues (lb + dir) */ +uint32_t num_ldb_queues;/* Number of available ldb queues */ +uint32_t num_ldb_ports;/* Number of load balanced ports */ +uint32_t num_dir_ports;/* Number of directed ports */ +uint32_t num_ldb_credits;/* Number of load balanced credits */ +uint32_t num_dir_credits;/* Number of directed credits */ +uint32_t reorder_window_size;/* Size of reorder window */ +}; + +struct dlb2_hw_resource_info { +/**> Max resources that can be provided */ +struct dlb2_hw_rsrcs hw_rsrc_max; +int num_sched_domains; +uint32_t socket_id; +}; + +enum dlb2_enqueue_type { +/**> +* New : Used to inject a new packet into the QM. +*/ +DLB2_ENQ_NEW , +/**> +* Forward : Enqueues a packet, and +* - if atomic: release any lock it holds in the QM +* - if ordered: release the packet for egress re-ordering +*/ +DLB2_ENQ_FWD , +/**> +* Enqueue Drop : Release an inflight packet. Must be called with +* event == NULL. Used to drop a packet. +* +* Note that all packets dequeued from a load-balanced port must be +* released, either with DLB2_ENQ_DROP or DLB2_ENQ_FWD. +*/ +DLB2_ENQ_DROP , + +/* marker for array sizing etc. */ + _DLB2_NB_ENQ_TYPES +}; + +/* hw-specific format - do not change */ + +struct dlb2_event_type { +uint8_t major:4 ; +uint8_t unused:4 ; +uint8_t sub; +}; + +union dlb2_opaque_data { +uint16_t opaque_data; +struct dlb2_event_type event_type; +}; + +struct dlb2_msg_info { +uint8_t qid; +uint8_t sched_type:2 ; +uint8_t priority:3 ; +uint8_t msg_type:3 ; +}; + +#define DLB2_NEW_CMD_BYTE 0x08 +#define DLB2_FWD_CMD_BYTE 0x0A +#define DLB2_COMP_CMD_BYTE 0x02 +#define DLB2_POP_CMD_BYTE 0x01 +#define DLB2_NOOP_CMD_BYTE 0x00 + +/* hw-specific format - do not change */ +struct dlb2_enqueue_qe { +uint64_t data; +/* Word 3 */ +union dlb2_opaque_data u; +uint8_t qid; +uint8_t sched_type:2 ; +uint8_t priority:3 ; +uint8_t msg_type:3 ; +/* Word 4 */ +uint16_t lock_id; +uint8_t meas_lat:1 ; +uint8_t rsvd1:2 ; +uint8_t no_dec:1 ; +uint8_t cmp_id:4 ; +union { +uint8_t cmd_byte; +struct { +uint8_t cq_token:1 ; +uint8_t qe_comp:1 ; +uint8_t qe_frag:1 ; +uint8_t qe_valid:1 ; +uint8_t rsvd3:1 ; +uint8_t error:1 ; +uint8_t rsvd:2 ; + }; + }; +}; + +/* hw-specific format - do not change */ +struct dlb2_cq_pop_qe { +uint64_t data; +union dlb2_opaque_data u; +uint8_t qid; +uint8_t sched_type:2 ; +uint8_t priority:3 ; +uint8_t msg_type:3 ; +uint16_t tokens:10 ; +uint16_t rsvd2:6 ; +uint8_t meas_lat:1 ; +uint8_t rsvd1:2 ; +uint8_t no_dec:1 ; +uint8_t cmp_id:4 ; +union { +uint8_t cmd_byte; +struct { +uint8_t cq_token:1 ; +uint8_t qe_comp:1 ; +uint8_t qe_frag:1 ; +uint8_t qe_valid:1 ; +uint8_t rsvd3:1 ; +uint8_t error:1 ; +uint8_t rsvd:2 ; + }; + }; +}; + +/* hw-specific format - do not change */ +struct dlb2_dequeue_qe { +uint64_t data; +union dlb2_opaque_data u; +uint8_t qid; +uint8_t sched_type:2 ; +uint8_t priority:3 ; +uint8_t msg_type:3 ; +uint16_t flow_id:16 ;/* was pp_id in v1 */ +uint8_t debug; +uint8_t cq_gen:1 ; +uint8_t qid_depth:2 ;/* 2 bits in v2 */ +uint8_t rsvd1:2 ; +uint8_t error:1 ; +uint8_t rsvd2:2 ; +}; + +union dlb2_port_config { +struct dlb2_create_ldb_port_args ldb; +struct dlb2_create_dir_port_args dir; +}; + +enum dlb2_port_state { +PORT_CLOSED , +PORT_STARTED , +PORT_STOPPED +}; + +enum dlb2_configuration_state { +/* The resource has not been configured */ +DLB2_NOT_CONFIGURED , +/* The resource was configured, but the device was stopped */ +DLB2_PREV_CONFIGURED , +/* The resource is currently configured */ +DLB2_CONFIGURED +}; + +struct dlb2_port { +uint32_t id; +bool is_directed; +bool gen_bit; +uint16_t dir_credits; +uint32_t dequeue_depth; +union dlb2_port_config cfg; +uint32_t *credit_pool[DLB2_NUM_QUEUE_TYPES ];/* use __atomic builtins */ +uint16_t cached_ldb_credits; +uint16_t ldb_credits; +uint16_t cached_dir_credits; +bool int_armed; +uint16_t owed_tokens; +int16_t issued_releases; +int cq_depth; +uint16_t cq_idx; +uint16_t cq_idx_unmasked; +uint16_t cq_depth_mask; +uint16_t gen_bit_shift; +enum dlb2_port_state state; +enum dlb2_configuration_state config_state; +int num_mapped_qids; +uint8_t *qid_mappings; +struct dlb2_enqueue_qe *qe4;/* Cache line's worth of QEs (4) */ +struct dlb2_enqueue_qe *int_arm_qe; +struct dlb2_cq_pop_qe *consume_qe; +struct dlb2_eventdev *dlb2;/* back ptr */ +struct dlb2_eventdev_port *ev_port;/* back ptr */ +}; + +/* Per-process per-port mmio and memory pointers */ +struct process_local_port_data { +uint64_t *pp_addr; +struct dlb2_dequeue_qe *cq_base; +const struct rte_memzone *mz; +bool mmaped; +}; + +struct dlb2_eventdev ; + +struct dlb2_config { +int configured; +int reserved; +uint32_t num_ldb_credits; +uint32_t num_dir_credits; +struct dlb2_create_sched_domain_args resources; +}; + +enum dlb2_cos { +DLB2_COS_DEFAULT =-1 , +DLB2_COS_0 =0 , +DLB2_COS_1 , +DLB2_COS_2 , +DLB2_COS_3 +}; + +struct dlb2_hw_dev { +struct dlb2_config cfg; +struct dlb2_hw_resource_info info; +void *pf_dev;/* opaque pointer to PF PMD dev (struct dlb2_dev) */ +uint32_t domain_id; +enum dlb2_cos cos_id; +rte_spinlock_t resource_lock;/* for MP support */ +} __rte_cache_aligned; + +/* End HW related defines and structs */ + +/* Begin DLB2 PMD Eventdev related defines and structs */ + +#define DLB2_MAX_NUM_QUEUES \ + (DLB2_MAX_NUM_DIR_QUEUES + DLB2_MAX_NUM_LDB_QUEUES) + +#define DLB2_MAX_NUM_PORTS (DLB2_MAX_NUM_DIR_PORTS + DLB2_MAX_NUM_LDB_PORTS) +#define DLB2_MAX_INPUT_QUEUE_DEPTH 256 + +/** Structure to hold the queue to port link establishment attributes */ + +struct dlb2_event_queue_link { +uint8_t queue_id; +uint8_t priority; +bool mapped; +bool valid; +}; + +struct dlb2_traffic_stats { +uint64_t rx_ok; +uint64_t rx_drop; +uint64_t rx_interrupt_wait; +uint64_t rx_umonitor_umwait; +uint64_t tx_ok; +uint64_t total_polls; +uint64_t zero_polls; +uint64_t tx_nospc_ldb_hw_credits; +uint64_t tx_nospc_dir_hw_credits; +uint64_t tx_nospc_inflight_max; +uint64_t tx_nospc_new_event_limit; +uint64_t tx_nospc_inflight_credits; +}; + +/* DLB2 HW sets the 2bit qid_depth in rx QEs based on the programmable depth +* threshold. The global default value in config/common_base (or rte_config.h) +* can be overridden on a per-qid basis using a vdev command line parameter. +* 3: depth > threshold +* 2: threshold >= depth > 3/4 threshold +* 1: 3/4 threshold >= depth > 1/2 threshold +* 0: depth <= 1/2 threshold. +*/ +#define DLB2_QID_DEPTH_LE50 0 +#define DLB2_QID_DEPTH_GT50_LE75 1 +#define DLB2_QID_DEPTH_GT75_LE100 2 +#define DLB2_QID_DEPTH_GT100 3 +#define DLB2_NUM_QID_DEPTH_STAT_VALS 4/* 2 bits */ + +struct dlb2_queue_stats { +uint64_t enq_ok; +uint64_t qid_depth[DLB2_NUM_QID_DEPTH_STAT_VALS ]; +}; + +struct dlb2_port_stats { +struct dlb2_traffic_stats traffic; +uint64_t tx_op_cnt[4 ];/* indexed by rte_event.op */ +uint64_t tx_implicit_rel; +uint64_t tx_sched_cnt[DLB2_NUM_HW_SCHED_TYPES ]; +uint64_t tx_invalid; +uint64_t rx_sched_cnt[DLB2_NUM_HW_SCHED_TYPES ]; +uint64_t rx_sched_invalid; +struct dlb2_queue_stats queue[DLB2_MAX_NUM_QUEUES ]; +}; + +struct dlb2_eventdev_port { +struct dlb2_port qm_port;/* hw specific data structure */ +struct rte_event_port_conf conf;/* user-supplied configuration */ +uint16_t inflight_credits;/* num credits this port has right now */ +uint16_t credit_update_quanta; +struct dlb2_eventdev *dlb2;/* backlink optimization */ + struct dlb2_port_stats stats __rte_cache_aligned; +struct dlb2_event_queue_link link[DLB2_MAX_NUM_QIDS_PER_LDB_CQ ]; +int num_links; +uint32_t id;/* port id */ +/* num releases yet to be completed on this port. +* Only applies to load-balanced ports. +*/ +uint16_t outstanding_releases; +uint16_t inflight_max;/* app requested max inflights for this port */ +/* setup_done is set when the event port is setup */ +bool setup_done; +/* enq_configured is set when the qm port is created */ +bool enq_configured; +uint8_t implicit_release;/* release events before dequeueing */ +} __rte_cache_aligned; + +struct dlb2_queue { +uint32_t num_qid_inflights;/* User config */ +uint32_t num_atm_inflights;/* User config */ +enum dlb2_configuration_state config_state; +int sched_type;/* LB queue only */ +uint32_t id; +bool is_directed; +}; + +struct dlb2_eventdev_queue { +struct dlb2_queue qm_queue; +struct rte_event_queue_conf conf;/* User config */ +int depth_threshold;/* use default if 0 */ +uint32_t id; +bool setup_done; +uint8_t num_links; +}; + +enum dlb2_run_state { +DLB2_RUN_STATE_STOPPED =0 , +DLB2_RUN_STATE_STOPPING , +DLB2_RUN_STATE_STARTING , +DLB2_RUN_STATE_STARTED +}; + +struct dlb2_eventdev { +struct dlb2_eventdev_port ev_ports[DLB2_MAX_NUM_PORTS ]; +struct dlb2_eventdev_queue ev_queues[DLB2_MAX_NUM_QUEUES ]; +uint8_t qm_ldb_to_ev_queue_id[DLB2_MAX_NUM_QUEUES ]; +uint8_t qm_dir_to_ev_queue_id[DLB2_MAX_NUM_QUEUES ]; +/* store num stats and offset of the stats for each queue */ +uint16_t xstats_count_per_qid[DLB2_MAX_NUM_QUEUES ]; +uint16_t xstats_offset_for_qid[DLB2_MAX_NUM_QUEUES ]; +/* store num stats and offset of the stats for each port */ +uint16_t xstats_count_per_port[DLB2_MAX_NUM_PORTS ]; +uint16_t xstats_offset_for_port[DLB2_MAX_NUM_PORTS ]; +struct dlb2_get_num_resources_args hw_rsrc_query_results; +uint32_t xstats_count_mode_queue; +struct dlb2_hw_dev qm_instance;/* strictly hw related */ +uint64_t global_dequeue_wait_ticks; +struct dlb2_xstats_entry *xstats; +struct rte_eventdev *event_dev;/* backlink to dev */ +uint32_t xstats_count_mode_dev; +uint32_t xstats_count_mode_port; +uint32_t xstats_count; +uint32_t inflights;/* use __atomic builtins */ +uint32_t new_event_limit; +int max_num_events_override; +int num_dir_credits_override; +volatile enum dlb2_run_state run_state; +uint16_t num_dir_queues;/* total num of evdev dir queues requested */ +uint16_t num_dir_credits; +uint16_t num_ldb_credits; +uint16_t num_queues;/* total queues */ +uint16_t num_ldb_queues;/* total num of evdev ldb queues requested */ +uint16_t num_ports;/* total num of evdev ports requested */ +uint16_t num_ldb_ports;/* total num of ldb ports requested */ +uint16_t num_dir_ports;/* total num of dir ports requested */ +bool umwait_allowed; +bool global_dequeue_wait;/* Not using per dequeue wait if true */ +bool defer_sched; +enum dlb2_cq_poll_modes poll_mode; +uint8_t revision; +bool configured; +uint16_t max_ldb_credits; +uint16_t max_dir_credits; + +/* force hw credit pool counters into exclusive cache lines */ + +/* use __atomic builtins */ /* shared hw cred */ + uint32_t ldb_credit_pool __rte_cache_aligned; +/* use __atomic builtins */ /* shared hw cred */ + uint32_t dir_credit_pool __rte_cache_aligned; +}; + +/* used for collecting and passing around the dev args */ +struct dlb2_qid_depth_thresholds { +int val[DLB2_MAX_NUM_QUEUES ]; +}; + +struct dlb2_devargs { +int socket_id; +int max_num_events; +int num_dir_credits_override; +int dev_id; +int defer_sched; +struct dlb2_qid_depth_thresholds qid_depth_thresholds; +enum dlb2_cos cos_id; +}; + +/* End Eventdev related defines and structs */ + +/* Forwards for non-inlined functions */ + +void dlb2_eventdev_dump (struct rte_eventdev *dev,FILE *f); + +int dlb2_xstats_init (struct dlb2_eventdev *dlb2); + +void dlb2_xstats_uninit (struct dlb2_eventdev *dlb2); + +int dlb2_eventdev_xstats_get (const struct rte_eventdev *dev, +enum rte_event_dev_xstats_mode mode,uint8_t queue_port_id, +const unsigned int ids[],uint64_t values[],unsigned int n); + +int dlb2_eventdev_xstats_get_names (const struct rte_eventdev *dev, +enum rte_event_dev_xstats_mode mode,uint8_t queue_port_id, +struct rte_event_dev_xstats_name *xstat_names, +unsigned int *ids,unsigned int size); + +uint64_t dlb2_eventdev_xstats_get_by_name (const struct rte_eventdev *dev, +const char *name,unsigned int *id); + +int dlb2_eventdev_xstats_reset (struct rte_eventdev *dev, +enum rte_event_dev_xstats_mode mode, +int16_t queue_port_id, +const uint32_t ids[], +uint32_t nb_ids); + +int test_dlb2_eventdev (void ); + +int dlb2_primary_eventdev_probe (struct rte_eventdev *dev, +const char *name, +struct dlb2_devargs *dlb2_args); + +int dlb2_secondary_eventdev_probe (struct rte_eventdev *dev, +const char *name); + +uint32_t dlb2_get_queue_depth (struct dlb2_eventdev *dlb2, +struct dlb2_eventdev_queue *queue); + +int dlb2_parse_params (const char *params, +const char *name, +struct dlb2_devargs *dlb2_args); + +/* Extern globals */ +extern struct process_local_port_data dlb2_port[][DLB2_NUM_PORT_TYPES ]; + +#endif /* _DLB2_PRIV_H_ */
Signature · 1 line
2.6.4
PATCH v11 4/23 event/dlb2: add definitions shared with LKM or shared code
In reply to Timothy McDanielAdd headers containing structs and constants shared between the PMD and the shared code. The term shared code refers to the code that implements the hardware interface. The shared code is introduced in the probe patch, and then is extended as additional eventdev PMD entry points are added to the patchset. In the case of the bifurcated PMD (to be introduced in the future), the shared code is contained in the Linux kernel module itself.
--- drivers/event/dlb2/dlb2_user.h | 679 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 679 insertions(+) create mode 100644 drivers/event/dlb2/dlb2_user.h
drivers/event/dlb2/dlb2_user.h new file +679 -0
@@ -0,0 +1,679 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2016-2020 Intel Corporation +*/ + +#ifndef __DLB2_USER_H +#define __DLB2_USER_H + +#define DLB2_MAX_NAME_LEN 64 + +#include <linux/types.h> + +enum dlb2_error { +DLB2_ST_SUCCESS =0 , +DLB2_ST_NAME_EXISTS , +DLB2_ST_DOMAIN_UNAVAILABLE , +DLB2_ST_LDB_PORTS_UNAVAILABLE , +DLB2_ST_DIR_PORTS_UNAVAILABLE , +DLB2_ST_LDB_QUEUES_UNAVAILABLE , +DLB2_ST_LDB_CREDITS_UNAVAILABLE , +DLB2_ST_DIR_CREDITS_UNAVAILABLE , +DLB2_ST_SEQUENCE_NUMBERS_UNAVAILABLE , +DLB2_ST_INVALID_DOMAIN_ID , +DLB2_ST_INVALID_QID_INFLIGHT_ALLOCATION , +DLB2_ST_ATOMIC_INFLIGHTS_UNAVAILABLE , +DLB2_ST_HIST_LIST_ENTRIES_UNAVAILABLE , +DLB2_ST_INVALID_LDB_QUEUE_ID , +DLB2_ST_INVALID_CQ_DEPTH , +DLB2_ST_INVALID_CQ_VIRT_ADDR , +DLB2_ST_INVALID_PORT_ID , +DLB2_ST_INVALID_QID , +DLB2_ST_INVALID_PRIORITY , +DLB2_ST_NO_QID_SLOTS_AVAILABLE , +DLB2_ST_INVALID_DIR_QUEUE_ID , +DLB2_ST_DIR_QUEUES_UNAVAILABLE , +DLB2_ST_DOMAIN_NOT_CONFIGURED , +DLB2_ST_INTERNAL_ERROR , +DLB2_ST_DOMAIN_IN_USE , +DLB2_ST_DOMAIN_NOT_FOUND , +DLB2_ST_QUEUE_NOT_FOUND , +DLB2_ST_DOMAIN_STARTED , +DLB2_ST_DOMAIN_NOT_STARTED , +DLB2_ST_LDB_PORT_REQUIRED_FOR_LDB_QUEUES , +DLB2_ST_DOMAIN_RESET_FAILED , +DLB2_ST_MBOX_ERROR , +DLB2_ST_INVALID_HIST_LIST_DEPTH , +DLB2_ST_NO_MEMORY , +DLB2_ST_INVALID_LOCK_ID_COMP_LEVEL , +DLB2_ST_INVALID_COS_ID , +}; + +static const char dlb2_error_strings[][128 ] = { +"DLB2_ST_SUCCESS" , +"DLB2_ST_NAME_EXISTS" , +"DLB2_ST_DOMAIN_UNAVAILABLE" , +"DLB2_ST_LDB_PORTS_UNAVAILABLE" , +"DLB2_ST_DIR_PORTS_UNAVAILABLE" , +"DLB2_ST_LDB_QUEUES_UNAVAILABLE" , +"DLB2_ST_LDB_CREDITS_UNAVAILABLE" , +"DLB2_ST_DIR_CREDITS_UNAVAILABLE" , +"DLB2_ST_SEQUENCE_NUMBERS_UNAVAILABLE" , +"DLB2_ST_INVALID_DOMAIN_ID" , +"DLB2_ST_INVALID_QID_INFLIGHT_ALLOCATION" , +"DLB2_ST_ATOMIC_INFLIGHTS_UNAVAILABLE" , +"DLB2_ST_HIST_LIST_ENTRIES_UNAVAILABLE" , +"DLB2_ST_INVALID_LDB_QUEUE_ID" , +"DLB2_ST_INVALID_CQ_DEPTH" , +"DLB2_ST_INVALID_CQ_VIRT_ADDR" , +"DLB2_ST_INVALID_PORT_ID" , +"DLB2_ST_INVALID_QID" , +"DLB2_ST_INVALID_PRIORITY" , +"DLB2_ST_NO_QID_SLOTS_AVAILABLE" , +"DLB2_ST_INVALID_DIR_QUEUE_ID" , +"DLB2_ST_DIR_QUEUES_UNAVAILABLE" , +"DLB2_ST_DOMAIN_NOT_CONFIGURED" , +"DLB2_ST_INTERNAL_ERROR" , +"DLB2_ST_DOMAIN_IN_USE" , +"DLB2_ST_DOMAIN_NOT_FOUND" , +"DLB2_ST_QUEUE_NOT_FOUND" , +"DLB2_ST_DOMAIN_STARTED" , +"DLB2_ST_DOMAIN_NOT_STARTED" , +"DLB2_ST_LDB_PORT_REQUIRED_FOR_LDB_QUEUES" , +"DLB2_ST_DOMAIN_RESET_FAILED" , +"DLB2_ST_MBOX_ERROR" , +"DLB2_ST_INVALID_HIST_LIST_DEPTH" , +"DLB2_ST_NO_MEMORY" , +"DLB2_ST_INVALID_LOCK_ID_COMP_LEVEL" , +"DLB2_ST_INVALID_COS_ID" , +}; + +struct dlb2_cmd_response { +__u32 status;/* Interpret using enum dlb2_error */ +__u32 id; +}; + +/*******************/ +/* 'dlb2' commands */ +/*******************/ + +#define DLB2_DEVICE_VERSION (x) (((x) >> 8) & 0xFF) +#define DLB2_DEVICE_REVISION (x) ((x) & 0xFF) + +enum dlb2_revisions { +DLB2_REV_A0 =0 , +}; + +/* +* DLB2_CMD_GET_DEVICE_VERSION: Query the DLB device version. +* +* This ioctl interface is the same in all driver versions and is always +* the first ioctl. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id[7:0]: Device revision. +* - response.id[15:8]: Device version. +*/ + +struct dlb2_get_device_version_args { +/* Output parameters */ +struct dlb2_cmd_response response; +}; + +/* +* DLB2_CMD_CREATE_SCHED_DOMAIN: Create a DLB 2.0 scheduling domain and reserve +* its hardware resources. This command returns the newly created domain +* ID and a file descriptor for accessing the domain. +* +* Input parameters: +* - num_ldb_queues: Number of load-balanced queues. +* - num_ldb_ports: Number of load-balanced ports that can be allocated from +* any class-of-service with available ports. +* - num_cos_ldb_ports[4]: Number of load-balanced ports from +* classes-of-service 0-3. +* - num_dir_ports: Number of directed ports. A directed port has one directed +* queue, so no num_dir_queues argument is necessary. +* - num_atomic_inflights: This specifies the amount of temporary atomic QE +* storage for the domain. This storage is divided among the domain's +* load-balanced queues that are configured for atomic scheduling. +* - num_hist_list_entries: Amount of history list storage. This is divided +* among the domain's CQs. +* - num_ldb_credits: Amount of load-balanced QE storage (QED). QEs occupy this +* space until they are scheduled to a load-balanced CQ. One credit +* represents the storage for one QE. +* - num_dir_credits: Amount of directed QE storage (DQED). QEs occupy this +* space until they are scheduled to a directed CQ. One credit represents +* the storage for one QE. +* - cos_strict: If set, return an error if there are insufficient ports in +* class-of-service N to satisfy the num_ldb_ports_cosN argument. If +* unset, attempt to fulfill num_ldb_ports_cosN arguments from other +* classes-of-service if class N does not contain enough free ports. +* - padding1: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: domain ID. +* - domain_fd: file descriptor for performing the domain's ioctl operations +* - padding0: Reserved for future use. +*/ +struct dlb2_create_sched_domain_args { +/* Output parameters */ +struct dlb2_cmd_response response; +__u32 domain_fd; +__u32 padding0; +/* Input parameters */ +__u32 num_ldb_queues; +__u32 num_ldb_ports; +__u32 num_cos_ldb_ports[4 ]; +__u32 num_dir_ports; +__u32 num_atomic_inflights; +__u32 num_hist_list_entries; +__u32 num_ldb_credits; +__u32 num_dir_credits; +__u8 cos_strict; +__u8 padding1[3 ]; +}; + +/* +* DLB2_CMD_GET_NUM_RESOURCES: Return the number of available resources +* (queues, ports, etc.) that this device owns. +* +* Output parameters: +* - num_domains: Number of available scheduling domains. +* - num_ldb_queues: Number of available load-balanced queues. +* - num_ldb_ports: Total number of available load-balanced ports. +* - num_cos_ldb_ports[4]: Number of available load-balanced ports from +* classes-of-service 0-3. +* - num_dir_ports: Number of available directed ports. There is one directed +* queue for every directed port. +* - num_atomic_inflights: Amount of available temporary atomic QE storage. +* - num_hist_list_entries: Amount of history list storage. +* - max_contiguous_hist_list_entries: History list storage is allocated in +* a contiguous chunk, and this return value is the longest available +* contiguous range of history list entries. +* - num_ldb_credits: Amount of available load-balanced QE storage. +* - num_dir_credits: Amount of available directed QE storage. +*/ +struct dlb2_get_num_resources_args { +/* Output parameters */ +__u32 num_sched_domains; +__u32 num_ldb_queues; +__u32 num_ldb_ports; +__u32 num_cos_ldb_ports[4 ]; +__u32 num_dir_ports; +__u32 num_atomic_inflights; +__u32 num_hist_list_entries; +__u32 max_contiguous_hist_list_entries; +__u32 num_ldb_credits; +__u32 num_dir_credits; +}; + +/* +* DLB2_CMD_SET_SN_ALLOCATION: Configure a sequence number group (PF only) +* +* Input parameters: +* - group: Sequence number group ID. +* - num: Number of sequence numbers per queue. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_set_sn_allocation_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 group; +__u32 num; +}; + +/* +* DLB2_CMD_GET_SN_ALLOCATION: Get a sequence number group's configuration +* +* Input parameters: +* - group: Sequence number group ID. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: Specified group's number of sequence numbers per queue. +*/ +struct dlb2_get_sn_allocation_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 group; +__u32 padding0; +}; + +/* +* DLB2_CMD_SET_COS_BW: Set a bandwidth allocation percentage for a +* load-balanced port class-of-service (PF only). +* +* Input parameters: +* - cos_id: class-of-service ID, between 0 and 3 (inclusive). +* - bandwidth: class-of-service bandwidth percentage. Total bandwidth +* percentages across all 4 classes cannot exceed 100%. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_set_cos_bw_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 cos_id; +__u32 bandwidth; +}; + +/* +* DLB2_CMD_GET_COS_BW: Get the bandwidth allocation percentage for a +* load-balanced port class-of-service. +* +* Input parameters: +* - cos_id: class-of-service ID, between 0 and 3 (inclusive). +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: Specified class's bandwidth percentage. +*/ +struct dlb2_get_cos_bw_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 cos_id; +__u32 padding0; +}; + +/* +* DLB2_CMD_GET_SN_OCCUPANCY: Get a sequence number group's occupancy +* +* Each sequence number group has one or more slots, depending on its +* configuration. I.e.: +* - If configured for 1024 sequence numbers per queue, the group has 1 slot +* - If configured for 512 sequence numbers per queue, the group has 2 slots +* ... +* - If configured for 32 sequence numbers per queue, the group has 32 slots +* +* This ioctl returns the group's number of in-use slots. If its occupancy is +* 0, the group's sequence number allocation can be reconfigured. +* +* Input parameters: +* - group: Sequence number group ID. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: Specified group's number of used slots. +*/ +struct dlb2_get_sn_occupancy_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 group; +__u32 padding0; +}; + +enum dlb2_cq_poll_modes { +DLB2_CQ_POLL_MODE_STD , +DLB2_CQ_POLL_MODE_SPARSE , + +/* NUM_DLB2_CQ_POLL_MODE must be last */ +NUM_DLB2_CQ_POLL_MODE , +}; + +/* +* DLB2_CMD_QUERY_CQ_POLL_MODE: Query the CQ poll mode setting +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: CQ poll mode (see enum dlb2_cq_poll_modes). +*/ +struct dlb2_query_cq_poll_mode_args { +/* Output parameters */ +struct dlb2_cmd_response response; +}; + +/********************************/ +/* 'scheduling domain' commands */ +/********************************/ + +/* +* DLB2_DOMAIN_CMD_CREATE_LDB_QUEUE: Configure a load-balanced queue. +* Input parameters: +* - num_atomic_inflights: This specifies the amount of temporary atomic QE +* storage for this queue. If zero, the queue will not support atomic +* scheduling. +* - num_sequence_numbers: This specifies the number of sequence numbers used +* by this queue. If zero, the queue will not support ordered scheduling. +* If non-zero, the queue will not support unordered scheduling. +* - num_qid_inflights: The maximum number of QEs that can be inflight +* (scheduled to a CQ but not completed) at any time. If +* num_sequence_numbers is non-zero, num_qid_inflights must be set equal +* to num_sequence_numbers. +* - lock_id_comp_level: Lock ID compression level. Specifies the number of +* unique lock IDs the queue should compress down to. Valid compression +* levels: 0, 64, 128, 256, 512, 1k, 2k, 4k, 64k. If lock_id_comp_level is +* 0, the queue won't compress its lock IDs. +* - depth_threshold: DLB sets two bits in the received QE to indicate the +* depth of the queue relative to the threshold before scheduling the +* QE to a CQ: +* - 2’b11: depth > threshold +* - 2’b10: threshold >= depth > 0.75 * threshold +* - 2’b01: 0.75 * threshold >= depth > 0.5 * threshold +* - 2’b00: depth <= 0.5 * threshold +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: Queue ID. +*/ +struct dlb2_create_ldb_queue_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 num_sequence_numbers; +__u32 num_qid_inflights; +__u32 num_atomic_inflights; +__u32 lock_id_comp_level; +__u32 depth_threshold; +__u32 padding0; +}; + +/* +* DLB2_DOMAIN_CMD_CREATE_DIR_QUEUE: Configure a directed queue. +* Input parameters: +* - port_id: Port ID. If the corresponding directed port is already created, +* specify its ID here. Else this argument must be 0xFFFFFFFF to indicate +* that the queue is being created before the port. +* - depth_threshold: DLB sets two bits in the received QE to indicate the +* depth of the queue relative to the threshold before scheduling the +* QE to a CQ: +* - 2’b11: depth > threshold +* - 2’b10: threshold >= depth > 0.75 * threshold +* - 2’b01: 0.75 * threshold >= depth > 0.5 * threshold +* - 2’b00: depth <= 0.5 * threshold +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: Queue ID. +*/ +struct dlb2_create_dir_queue_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__s32 port_id; +__u32 depth_threshold; +}; + +/* +* DLB2_DOMAIN_CMD_CREATE_LDB_PORT: Configure a load-balanced port. +* Input parameters: +* - cq_depth: Depth of the port's CQ. Must be a power-of-two between 8 and +* 1024, inclusive. +* - cq_depth_threshold: CQ depth interrupt threshold. A value of N means that +* the CQ interrupt won't fire until there are N or more outstanding CQ +* tokens. +* - num_hist_list_entries: Number of history list entries. This must be +* greater than or equal cq_depth. +* - cos_id: class-of-service to allocate this port from. Must be between 0 and +* 3, inclusive. +* - cos_strict: If set, return an error if there are no available ports in the +* requested class-of-service. Else, allocate the port from a different +* class-of-service if the requested class has no available ports. +* +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: port ID. +*/ + +struct dlb2_create_ldb_port_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u16 cq_depth; +__u16 cq_depth_threshold; +__u16 cq_history_list_size; +__u8 cos_id; +__u8 cos_strict; +}; + +/* +* DLB2_DOMAIN_CMD_CREATE_DIR_PORT: Configure a directed port. +* Input parameters: +* - cq_depth: Depth of the port's CQ. Must be a power-of-two between 8 and +* 1024, inclusive. +* - cq_depth_threshold: CQ depth interrupt threshold. A value of N means that +* the CQ interrupt won't fire until there are N or more outstanding CQ +* tokens. +* - qid: Queue ID. If the corresponding directed queue is already created, +* specify its ID here. Else this argument must be 0xFFFFFFFF to indicate +* that the port is being created before the queue. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: Port ID. +*/ +struct dlb2_create_dir_port_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u16 cq_depth; +__u16 cq_depth_threshold; +__s32 queue_id; +}; + +/* +* DLB2_DOMAIN_CMD_START_DOMAIN: Mark the end of the domain configuration. This +* must be called before passing QEs into the device, and no configuration +* ioctls can be issued once the domain has started. Sending QEs into the +* device before calling this ioctl will result in undefined behavior. +* Input parameters: +* - (None) +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_start_domain_args { +/* Output parameters */ +struct dlb2_cmd_response response; +}; + +/* +* DLB2_DOMAIN_CMD_MAP_QID: Map a load-balanced queue to a load-balanced port. +* Input parameters: +* - port_id: Load-balanced port ID. +* - qid: Load-balanced queue ID. +* - priority: Queue->port service priority. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_map_qid_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 port_id; +__u32 qid; +__u32 priority; +__u32 padding0; +}; + +/* +* DLB2_DOMAIN_CMD_UNMAP_QID: Unmap a load-balanced queue to a load-balanced +* port. +* Input parameters: +* - port_id: Load-balanced port ID. +* - qid: Load-balanced queue ID. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_unmap_qid_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 port_id; +__u32 qid; +}; + +/* +* DLB2_DOMAIN_CMD_ENABLE_LDB_PORT: Enable scheduling to a load-balanced port. +* Input parameters: +* - port_id: Load-balanced port ID. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_enable_ldb_port_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 port_id; +__u32 padding0; +}; + +/* +* DLB2_DOMAIN_CMD_ENABLE_DIR_PORT: Enable scheduling to a directed port. +* Input parameters: +* - port_id: Directed port ID. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_enable_dir_port_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 port_id; +}; + +/* +* DLB2_DOMAIN_CMD_DISABLE_LDB_PORT: Disable scheduling to a load-balanced +* port. +* Input parameters: +* - port_id: Load-balanced port ID. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_disable_ldb_port_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 port_id; +__u32 padding0; +}; + +/* +* DLB2_DOMAIN_CMD_DISABLE_DIR_PORT: Disable scheduling to a directed port. +* Input parameters: +* - port_id: Directed port ID. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +*/ +struct dlb2_disable_dir_port_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 port_id; +__u32 padding0; +}; + +/* +* DLB2_DOMAIN_CMD_GET_LDB_QUEUE_DEPTH: Get a load-balanced queue's depth. +* Input parameters: +* - queue_id: The load-balanced queue ID. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: queue depth. +*/ +struct dlb2_get_ldb_queue_depth_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 queue_id; +__u32 padding0; +}; + +/* +* DLB2_DOMAIN_CMD_DIR_QUEUE_DEPTH: Get a directed queue's depth. +* Input parameters: +* - queue_id: The directed queue ID. +* - padding0: Reserved for future use. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: queue depth. +*/ +struct dlb2_get_dir_queue_depth_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 queue_id; +__u32 padding0; +}; + +/* +* DLB2_DOMAIN_CMD_PENDING_PORT_UNMAPS: Get number of queue unmap operations in +* progress for a load-balanced port. +* +* Note: This is a snapshot; the number of unmap operations in progress +* is subject to change at any time. +* +* Input parameters: +* - port_id: Load-balanced port ID. +* +* Output parameters: +* - response.status: Detailed error code. In certain cases, such as if the +* ioctl request arg is invalid, the driver won't set status. +* - response.id: number of unmaps in progress. +*/ +struct dlb2_pending_port_unmaps_args { +/* Output parameters */ +struct dlb2_cmd_response response; +/* Input parameters */ +__u32 port_id; +__u32 padding0; +}; + +/* +* Mapping sizes for memory mapping the consumer queue (CQ) memory space, and +* producer port (PP) MMIO space. +*/ +#define DLB2_CQ_SIZE 65536 +#define DLB2_PP_SIZE 4096 + + +#endif /* __DLB2_USER_H */
Signature · 1 line
2.6.4
PATCH v11 5/23 event/dlb2: add inline functions
In reply to Timothy McDanielAdd miscellaneous inline functions that may be called from multiple files. These functions include inline assembly of new x86 instructions, such as movdir64b, since they are not available as builtin functions in the minimum supported GCC version.
--- drivers/event/dlb2/dlb2_inline_fns.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 drivers/event/dlb2/dlb2_inline_fns.h
drivers/event/dlb2/dlb2_inline_fns.h new file +33 -0
@@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2016-2020 Intel Corporation +*/ + +#ifndef _DLB2_INLINE_FNS_H_ +#define _DLB2_INLINE_FNS_H_ + +/* Inline functions required in more than one source file. */ + +static inline struct dlb2_eventdev * +dlb2_pmd_priv (const struct rte_eventdev *eventdev) +{ +return eventdev->data->dev_private; +} + +static inline void +dlb2_movntdq_single (void *pp_addr,void *qe4) +{ +long long *_qe = (long long *)qe4; +__m128i src_data0 = (__m128i ){_qe[0 ], _qe[1 ]}; + +_mm_stream_si128 (pp_addr, src_data0); +} + +static inline void +dlb2_movdir64b (void *dest,void *src) +{ + asmvolatile (".byte 0x66, 0x0f, 0x38, 0xf8, 0x02" + : + :"a" (dest),"d" (src)); +} + +#endif /* _DLB2_INLINE_FNS_H_ */
Signature · 1 line
2.6.4
PATCH v11 6/23 event/dlb2: add eventdev probe
In reply to Timothy McDanielAdd the eventdev portion of probe, and parse command line options, but do not initialize hardware.
--- drivers/event/dlb2/dlb2.c | 343 ++++ drivers/event/dlb2/meson.build | 5 +- drivers/event/dlb2/pf/base/dlb2_hw_types.h | 367 ++++ drivers/event/dlb2/pf/base/dlb2_mbox.h | 596 ++++++ drivers/event/dlb2/pf/base/dlb2_osdep.h | 230 +++ drivers/event/dlb2/pf/base/dlb2_osdep_bitmap.h | 440 +++++ drivers/event/dlb2/pf/base/dlb2_osdep_list.h | 131 ++ drivers/event/dlb2/pf/base/dlb2_osdep_types.h | 31 + drivers/event/dlb2/pf/base/dlb2_regs.h | 2527 ++++++++++++++++++++++++ drivers/event/dlb2/pf/base/dlb2_resource.h | 1913 ++++++++++++++++++ drivers/event/dlb2/pf/dlb2_main.c | 621 ++++++ drivers/event/dlb2/pf/dlb2_main.h | 98 + drivers/event/dlb2/pf/dlb2_pf.c | 196 ++ 13 files changed, 7497 insertions(+), 1 deletion(-) create mode 100644 drivers/event/dlb2/pf/base/dlb2_hw_types.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_mbox.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_osdep.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_osdep_bitmap.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_osdep_list.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_osdep_types.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_regs.h create mode 100644 drivers/event/dlb2/pf/base/dlb2_resource.h create mode 100644 drivers/event/dlb2/pf/dlb2_main.c create mode 100644 drivers/event/dlb2/pf/dlb2_main.h create mode 100644 drivers/event/dlb2/pf/dlb2_pf.c
drivers/event/dlb2/dlb2.c +343 -0
@@ -2,6 +2,349 @@* Copyright(c) 2016-2020 Intel Corporation */ +#include <assert.h> +#include <errno.h> +#include <nmmintrin.h> +#include <pthread.h> +#include <stdint.h> +#include <stdbool.h> +#include <stdio.h> +#include <string.h> +#include <sys/mman.h> +#include <sys/fcntl.h> + +#include <rte_common.h> +#include <rte_config.h> +#include <rte_cycles.h> +#include <rte_debug.h> +#include <rte_dev.h> +#include <rte_errno.h> +#include <rte_eventdev.h> +#include <rte_eventdev_pmd.h> +#include <rte_io.h> +#include <rte_kvargs.h> #include <rte_log.h> +#include <rte_malloc.h> +#include <rte_mbuf.h> +#include <rte_prefetch.h> +#include <rte_ring.h> +#include <rte_string_fns.h> + +#include "dlb2_priv.h" +#include "dlb2_inline_fns.h" + +/* +* Resources exposed to eventdev. Some values overridden at runtime using +* values returned by the DLB kernel driver. +*/ +#if (RTE_EVENT_MAX_QUEUES_PER_DEV >UINT8_MAX ) +#error "RTE_EVENT_MAX_QUEUES_PER_DEV cannot fit in member max_event_queues" +#endif + +struct process_local_port_data +dlb2_port[DLB2_MAX_NUM_PORTS ][DLB2_NUM_PORT_TYPES ]; + +#define DLB2_BASE_10 10 + +static int +dlb2_string_to_int (int *result,const char *str) +{ +long ret; +char *endptr; + +if (str ==NULL || result ==NULL ) +return -EINVAL ; + + errno =0 ; + ret =strtol (str, &endptr,DLB2_BASE_10 ); +if (errno) +return -errno; + +/* long int and int may be different width for some architectures */ +if (ret <INT_MIN || ret >INT_MAX || endptr == str) +return -EINVAL ; + + *result = ret; +return 0 ; +} + +static int +set_numa_node(const char *key __rte_unused, const char *value, void *opaque) +{ +int *socket_id = opaque; +int ret; + + ret =dlb2_string_to_int (socket_id, value); +if (ret <0 ) +return ret; + +if (*socket_id >RTE_MAX_NUMA_NODES ) +return -EINVAL ; +return 0 ; +} + +static int +set_max_num_events(const char *key __rte_unused, +const char *value, +void *opaque) +{ +int *max_num_events = opaque; +int ret; + +if (value ==NULL || opaque ==NULL ) { +DLB2_LOG_ERR ("NULL pointer\n" ); +return -EINVAL ; + } + + ret =dlb2_string_to_int (max_num_events, value); +if (ret <0 ) +return ret; + +if (*max_num_events <0 || *max_num_events > +DLB2_MAX_NUM_LDB_CREDITS ) { +DLB2_LOG_ERR ("dlb2: max_num_events must be between 0 and %d\n" , +DLB2_MAX_NUM_LDB_CREDITS ); +return -EINVAL ; + } + +return 0 ; +} + +static int +set_num_dir_credits(const char *key __rte_unused, +const char *value, +void *opaque) +{ +int *num_dir_credits = opaque; +int ret; + +if (value ==NULL || opaque ==NULL ) { +DLB2_LOG_ERR ("NULL pointer\n" ); +return -EINVAL ; + } + + ret =dlb2_string_to_int (num_dir_credits, value); +if (ret <0 ) +return ret; + +if (*num_dir_credits <0 || + *num_dir_credits >DLB2_MAX_NUM_DIR_CREDITS ) { +DLB2_LOG_ERR ("dlb2: num_dir_credits must be between 0 and %d\n" , +DLB2_MAX_NUM_DIR_CREDITS ); +return -EINVAL ; + } + +return 0 ; +} + +static int +set_dev_id(const char *key __rte_unused, +const char *value, +void *opaque) +{ +int *dev_id = opaque; +int ret; + +if (value ==NULL || opaque ==NULL ) { +DLB2_LOG_ERR ("NULL pointer\n" ); +return -EINVAL ; + } + + ret =dlb2_string_to_int (dev_id, value); +if (ret <0 ) +return ret; + +return 0 ; +} + +static int +set_cos(const char *key __rte_unused, +const char *value, +void *opaque) +{ +enum dlb2_cos *cos_id = opaque; +int x =0 ; +int ret; + +if (value ==NULL || opaque ==NULL ) { +DLB2_LOG_ERR ("NULL pointer\n" ); +return -EINVAL ; + } + + ret =dlb2_string_to_int (&x, value); +if (ret <0 ) +return ret; + +if (x !=DLB2_COS_DEFAULT && (x <DLB2_COS_0 || x >DLB2_COS_3 )) { +DLB2_LOG_ERR ( +"COS %d out of range, must be DLB2_COS_DEFAULT or 0-3\n" , + x); +return -EINVAL ; + } + + *cos_id = x; + +return 0 ; +} + + +static int +set_qid_depth_thresh(const char *key __rte_unused, +const char *value, +void *opaque) +{ +struct dlb2_qid_depth_thresholds *qid_thresh = opaque; +int first, last, thresh, i; + +if (value ==NULL || opaque ==NULL ) { +DLB2_LOG_ERR ("NULL pointer\n" ); +return -EINVAL ; + } + +/* command line override may take one of the following 3 forms: +* qid_depth_thresh=all:<threshold_value> ... all queues +* qid_depth_thresh=qidA-qidB:<threshold_value> ... a range of queues +* qid_depth_thresh=qid:<threshold_value> ... just one queue +*/ +if (sscanf (value,"all:%d" , &thresh) ==1 ) { + first =0 ; + last =DLB2_MAX_NUM_QUEUES -1 ; + }else if (sscanf (value,"%d-%d:%d" , &first, &last, &thresh) ==3 ) { +/* we have everything we need */ + }else if (sscanf (value,"%d:%d" , &first, &thresh) ==2 ) { + last = first; + }else { +DLB2_LOG_ERR ("Error parsing qid depth devarg. Should be all:val, qid-qid:val, or qid:val\n" ); +return -EINVAL ; + } + +if (first > last || first <0 || last >=DLB2_MAX_NUM_QUEUES ) { +DLB2_LOG_ERR ("Error parsing qid depth devarg, invalid qid value\n" ); +return -EINVAL ; + } + +if (thresh <0 || thresh >DLB2_MAX_QUEUE_DEPTH_THRESHOLD ) { +DLB2_LOG_ERR ("Error parsing qid depth devarg, threshold > %d\n" , +DLB2_MAX_QUEUE_DEPTH_THRESHOLD ); +return -EINVAL ; + } + +for (i = first; i <= last; i++) + qid_thresh->val[i] = thresh;/* indexed by qid */ + +return 0 ; +} + +int +dlb2_primary_eventdev_probe (struct rte_eventdev *dev, +const char *name, +struct dlb2_devargs *dlb2_args) +{ +RTE_SET_USED (dev); +RTE_SET_USED (name); +RTE_SET_USED (dlb2_args); + +return 0 ; +} + +int +dlb2_secondary_eventdev_probe (struct rte_eventdev *dev, +const char *name) +{ +RTE_SET_USED (dev); +RTE_SET_USED (name); + +return 0 ; +} + +int +dlb2_parse_params (const char *params, +const char *name, +struct dlb2_devargs *dlb2_args) +{ +int ret =0 ; +static const char *const args[] = {NUMA_NODE_ARG , +DLB2_MAX_NUM_EVENTS , +DLB2_NUM_DIR_CREDITS , +DEV_ID_ARG , +DLB2_QID_DEPTH_THRESH_ARG , +DLB2_COS_ARG , +NULL }; + +if (params !=NULL && params[0 ] !='\0' ) { +struct rte_kvargs *kvlist =rte_kvargs_parse (params, args); + +if (kvlist ==NULL ) { +RTE_LOG (INFO ,PMD , +"Ignoring unsupported parameters when creating device '%s'\n" , + name); + }else { +int ret =rte_kvargs_process (kvlist,NUMA_NODE_ARG , + set_numa_node, + &dlb2_args->socket_id); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing numa node parameter" , + name); +rte_kvargs_free (kvlist); +return ret; + } + + ret =rte_kvargs_process (kvlist,DLB2_MAX_NUM_EVENTS , + set_max_num_events, + &dlb2_args->max_num_events); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing max_num_events parameter" , + name); +rte_kvargs_free (kvlist); +return ret; + } + + ret =rte_kvargs_process (kvlist, +DLB2_NUM_DIR_CREDITS , + set_num_dir_credits, + &dlb2_args->num_dir_credits_override); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing num_dir_credits parameter" , + name); +rte_kvargs_free (kvlist); +return ret; + } + + ret =rte_kvargs_process (kvlist,DEV_ID_ARG , + set_dev_id, + &dlb2_args->dev_id); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing dev_id parameter" , + name); +rte_kvargs_free (kvlist); +return ret; + } + + ret =rte_kvargs_process ( + kvlist, +DLB2_QID_DEPTH_THRESH_ARG , + set_qid_depth_thresh, + &dlb2_args->qid_depth_thresholds); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing qid_depth_thresh parameter" , + name); +rte_kvargs_free (kvlist); +return ret; + } + + ret =rte_kvargs_process (kvlist,DLB2_COS_ARG , + set_cos, + &dlb2_args->cos_id); +if (ret !=0 ) { +DLB2_LOG_ERR ("%s: Error parsing cos parameter" , + name); +rte_kvargs_free (kvlist); +return ret; + } +rte_kvargs_free (kvlist); + } + } +return ret; +}RTE_LOG_REGISTER (eventdev_dlb2_log_level, pmd.event.dlb2,NOTICE );
drivers/event/dlb2/meson.build +4 -1
@@ -7,7 +7,10 @@ if not is_linux or not dpdk_conf.has('RTE_ARCH_X86_64') subdir_done() endif -sources = files('dlb2.c') +sources = files('dlb2.c', + 'pf/dlb2_main.c', + 'pf/dlb2_pf.c' +) headers = files()
drivers/event/dlb2/pf/base/dlb2_hw_types.h new file +367 -0
367 lines not on this page · raw message
drivers/event/dlb2/pf/base/dlb2_mbox.h new file +596 -0
596 lines not on this page · raw message
drivers/event/dlb2/pf/base/dlb2_osdep.h new file +230 -0
230 lines not on this page · raw message
drivers/event/dlb2/pf/base/dlb2_osdep_bitmap.h new file +440 -0
440 lines not on this page · raw message
drivers/event/dlb2/pf/base/dlb2_osdep_list.h new file +131 -0
131 lines not on this page · raw message
drivers/event/dlb2/pf/base/dlb2_osdep_types.h new file +31 -0
@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2016-2020 Intel Corporation +*/ + +#ifndef __DLB2_OSDEP_TYPES_H +#define __DLB2_OSDEP_TYPES_H + +#include <linux/types.h> + +#include <inttypes.h> +#include <ctype.h> +#include <stdint.h> +#include <stdbool.h> +#include <string.h> +#include <unistd.h> +#include <errno.h> + +/* Types for user mode PF PMD */ +typedef uint8_t u8 ; +typedef int8_t s8 ; +typedef uint16_t u16 ; +typedef int16_t s16 ; +typedef uint32_t u32 ; +typedef int32_t s32 ; +typedef uint64_t u64 ; + +#define __iomem + +/* END types for user mode PF PMD */ + +#endif /* __DLB2_OSDEP_TYPES_H */
drivers/event/dlb2/pf/base/dlb2_regs.h new file +2527 -0
845 lines not on this page · raw message
drivers/event/dlb2/pf/base/dlb2_resource.h new file +1913 -0
1,913 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_main.c new file +621 -0
621 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_main.h new file +98 -0
98 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_pf.c new file +196 -0
196 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.6.4
Part of the diff is not shown here. View the raw message.
PATCH v11 7/23 event/dlb2: add flexible interface
In reply to Timothy McDanielThis commit introduces the flexible interface. This interface allows the core code to operate in PF mode (direct hardware access) or bifurcated mode (hardware configured via kernel driver). This driver currently only supports PF mode but bifurcated mode will be added in a future DPDK patch-set. Note that the flexible interface is not used for data path operations, and thus there are no performance concerns related to the use of function pointers.
--- drivers/event/dlb2/dlb2_iface.c | 28 ++++++++++++++++++++++++++++ drivers/event/dlb2/dlb2_iface.h | 29 +++++++++++++++++++++++++++++ drivers/event/dlb2/meson.build | 1 + 3 files changed, 58 insertions(+) create mode 100644 drivers/event/dlb2/dlb2_iface.c create mode 100644 drivers/event/dlb2/dlb2_iface.h
drivers/event/dlb2/dlb2_iface.c new file +28 -0
@@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2016-2020 Intel Corporation +*/ + +#include <stdint.h> + +#include "dlb2_priv.h" + +/* DLB2 PMD Internal interface function pointers. +* If VDEV (bifurcated PMD), these will resolve to functions that issue ioctls +* serviced by DLB kernel module. +* If PCI (PF PMD), these will be implemented locally in user mode. +*/ + +void (*dlb2_iface_low_level_io_init)(void ); + +int (*dlb2_iface_open)(struct dlb2_hw_dev *handle,const char *name); + +int (*dlb2_iface_get_device_version)(struct dlb2_hw_dev *handle, +uint8_t *revision); + +void (*dlb2_iface_hardware_init)(struct dlb2_hw_dev *handle); + +int (*dlb2_iface_get_cq_poll_mode)(struct dlb2_hw_dev *handle, +enum dlb2_cq_poll_modes *mode); + +int (*dlb2_iface_get_num_resources)(struct dlb2_hw_dev *handle, +struct dlb2_get_num_resources_args *rsrcs);
drivers/event/dlb2/dlb2_iface.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2016-2020 Intel Corporation +*/ + +#ifndef _DLB2_IFACE_H_ +#define _DLB2_IFACE_H_ + +/* DLB2 PMD Internal interface function pointers. +* If VDEV (bifurcated PMD), these will resolve to functions that issue ioctls +* serviced by DLB kernel module. +* If PCI (PF PMD), these will be implemented locally in user mode. +*/ + +extern void (*dlb2_iface_low_level_io_init)(void ); + +extern int (*dlb2_iface_open)(struct dlb2_hw_dev *handle,const char *name); + +extern int (*dlb2_iface_get_device_version)(struct dlb2_hw_dev *handle, +uint8_t *revision); + +extern void (*dlb2_iface_hardware_init)(struct dlb2_hw_dev *handle); + +extern int (*dlb2_iface_get_cq_poll_mode)(struct dlb2_hw_dev *handle, +enum dlb2_cq_poll_modes *mode); + +extern int (*dlb2_iface_get_num_resources)(struct dlb2_hw_dev *handle, +struct dlb2_get_num_resources_args *rsrcs); + +#endif /* _DLB2_IFACE_H_ */
drivers/event/dlb2/meson.build +1 -0
@@ -8,6 +8,7 @@ if not is_linux or not dpdk_conf.has('RTE_ARCH_X86_64') endif sources = files('dlb2.c', + 'dlb2_iface.c', 'pf/dlb2_main.c', 'pf/dlb2_pf.c' )
Signature · 1 line
2.6.4
PATCH v11 8/23 event/dlb2: add probe-time hardware init
In reply to Timothy McDanielThis commit adds probe-time low level hardware initialization. It also adds probe-time init for both primary and secondary DPDK processes.
--- drivers/event/dlb2/dlb2.c | 188 +++++++++++++++++++- drivers/event/dlb2/meson.build | 3 +- drivers/event/dlb2/pf/base/dlb2_resource.c | 274 +++++++++++++++++++++++++++++ drivers/event/dlb2/pf/dlb2_main.c | 23 +-- drivers/event/dlb2/pf/dlb2_main.h | 1 - drivers/event/dlb2/pf/dlb2_pf.c | 78 ++++++-- 6 files changed, 523 insertions(+), 44 deletions(-) create mode 100644 drivers/event/dlb2/pf/base/dlb2_resource.c
drivers/event/dlb2/dlb2.c +183 -5
@@ -31,6 +31,7 @@#include <rte_string_fns.h> #include "dlb2_priv.h" +#include "dlb2_iface.h" #include "dlb2_inline_fns.h" /*
@@ -40,10 +41,108 @@#if (RTE_EVENT_MAX_QUEUES_PER_DEV >UINT8_MAX )#error "RTE_EVENT_MAX_QUEUES_PER_DEV cannot fit in member max_event_queues"#endif +static struct rte_event_dev_info evdev_dlb2_default_info = { + .driver_name ="" ,/* probe will set */ + .min_dequeue_timeout_ns =DLB2_MIN_DEQUEUE_TIMEOUT_NS , + .max_dequeue_timeout_ns =DLB2_MAX_DEQUEUE_TIMEOUT_NS , +#if (RTE_EVENT_MAX_QUEUES_PER_DEV < DLB2_MAX_NUM_LDB_QUEUES) + .max_event_queues =RTE_EVENT_MAX_QUEUES_PER_DEV , +#else + .max_event_queues =DLB2_MAX_NUM_LDB_QUEUES , +#endif + .max_event_queue_flows =DLB2_MAX_NUM_FLOWS , + .max_event_queue_priority_levels =DLB2_QID_PRIORITIES , + .max_event_priority_levels =DLB2_QID_PRIORITIES , + .max_event_ports =DLB2_MAX_NUM_LDB_PORTS , + .max_event_port_dequeue_depth =DLB2_MAX_CQ_DEPTH , + .max_event_port_enqueue_depth =DLB2_MAX_ENQUEUE_DEPTH , + .max_event_port_links =DLB2_MAX_NUM_QIDS_PER_LDB_CQ , + .max_num_events =DLB2_MAX_NUM_LDB_CREDITS , + .max_single_link_event_port_queue_pairs =DLB2_MAX_NUM_DIR_PORTS , + .event_dev_cap = (RTE_EVENT_DEV_CAP_QUEUE_QOS | +RTE_EVENT_DEV_CAP_EVENT_QOS | +RTE_EVENT_DEV_CAP_BURST_MODE | +RTE_EVENT_DEV_CAP_DISTRIBUTED_SCHED | +RTE_EVENT_DEV_CAP_IMPLICIT_RELEASE_DISABLE | +RTE_EVENT_DEV_CAP_QUEUE_ALL_TYPES ), +};struct process_local_port_data dlb2_port[DLB2_MAX_NUM_PORTS ][DLB2_NUM_PORT_TYPES ]; +/* override defaults with value(s) provided on command line */ +static void +dlb2_init_queue_depth_thresholds (struct dlb2_eventdev *dlb2, +int *qid_depth_thresholds) +{ +int q; + +for (q =0 ; q <DLB2_MAX_NUM_QUEUES ; q++) { +if (qid_depth_thresholds[q] !=0 ) + dlb2->ev_queues[q].depth_threshold = + qid_depth_thresholds[q]; + } +} + +static int +dlb2_hw_query_resources (struct dlb2_eventdev *dlb2) +{ +struct dlb2_hw_dev *handle = &dlb2->qm_instance; +struct dlb2_hw_resource_info *dlb2_info = &handle->info; +int ret; + +/* Query driver resources provisioned for this device */ + + ret =dlb2_iface_get_num_resources (handle, + &dlb2->hw_rsrc_query_results); +if (ret) { +DLB2_LOG_ERR ("ioctl get dlb2 num resources, err=%d\n" , ret); +return ret; + } + +/* Complete filling in device resource info returned to evdev app, +* overriding any default values. +* The capabilities (CAPs) were set at compile time. +*/ + + evdev_dlb2_default_info.max_event_queues = + dlb2->hw_rsrc_query_results.num_ldb_queues; + + evdev_dlb2_default_info.max_event_ports = + dlb2->hw_rsrc_query_results.num_ldb_ports; + + evdev_dlb2_default_info.max_num_events = + dlb2->hw_rsrc_query_results.num_ldb_credits; + +/* Save off values used when creating the scheduling domain. */ + + handle->info.num_sched_domains = + dlb2->hw_rsrc_query_results.num_sched_domains; + + handle->info.hw_rsrc_max.nb_events_limit = + dlb2->hw_rsrc_query_results.num_ldb_credits; + + handle->info.hw_rsrc_max.num_queues = + dlb2->hw_rsrc_query_results.num_ldb_queues + + dlb2->hw_rsrc_query_results.num_dir_ports; + + handle->info.hw_rsrc_max.num_ldb_queues = + dlb2->hw_rsrc_query_results.num_ldb_queues; + + handle->info.hw_rsrc_max.num_ldb_ports = + dlb2->hw_rsrc_query_results.num_ldb_ports; + + handle->info.hw_rsrc_max.num_dir_ports = + dlb2->hw_rsrc_query_results.num_dir_ports; + + handle->info.hw_rsrc_max.reorder_window_size = + dlb2->hw_rsrc_query_results.num_hist_list_entries; + +rte_memcpy (dlb2_info, &handle->info.hw_rsrc_max,sizeof (*dlb2_info)); + +return 0 ; +} +#define DLB2_BASE_10 10 static int
@@ -235,14 +334,71 @@ set_qid_depth_thresh(const char *key __rte_unused,return 0 ; } +static void +dlb2_entry_points_init (struct rte_eventdev *dev) +{ +RTE_SET_USED (dev); + +/* Eventdev PMD entry points */ +} +int dlb2_primary_eventdev_probe (struct rte_eventdev *dev,const char *name,struct dlb2_devargs *dlb2_args) { -RTE_SET_USED (dev); -RTE_SET_USED (name); -RTE_SET_USED (dlb2_args); +struct dlb2_eventdev *dlb2; +int err; + + dlb2 = dev->data->dev_private; + + dlb2->event_dev = dev;/* backlink */ + + evdev_dlb2_default_info.driver_name = name; + + dlb2->max_num_events_override = dlb2_args->max_num_events; + dlb2->num_dir_credits_override = dlb2_args->num_dir_credits_override; + dlb2->qm_instance.cos_id = dlb2_args->cos_id; + + err =dlb2_iface_open (&dlb2->qm_instance, name); +if (err <0 ) { +DLB2_LOG_ERR ("could not open event hardware device, err=%d\n" , + err); +return err; + } + + err =dlb2_iface_get_device_version (&dlb2->qm_instance, + &dlb2->revision); +if (err <0 ) { +DLB2_LOG_ERR ("dlb2: failed to get the device version, err=%d\n" , + err); +return err; + } + + err =dlb2_hw_query_resources (dlb2); +if (err) { +DLB2_LOG_ERR ("get resources err=%d for %s\n" , + err, name); +return err; + } + +dlb2_iface_hardware_init (&dlb2->qm_instance); + + err =dlb2_iface_get_cq_poll_mode (&dlb2->qm_instance, &dlb2->poll_mode); +if (err <0 ) { +DLB2_LOG_ERR ("dlb2: failed to get the poll mode, err=%d\n" , + err); +return err; + } + +rte_spinlock_init (&dlb2->qm_instance.resource_lock); + +dlb2_iface_low_level_io_init (); + +dlb2_entry_points_init (dev); + +dlb2_init_queue_depth_thresholds (dlb2, + dlb2_args->qid_depth_thresholds.val);return 0 ; }
@@ -251,8 +407,30 @@ int dlb2_secondary_eventdev_probe(struct rte_eventdev *dev, const char *name) { -RTE_SET_USED (dev); -RTE_SET_USED (name); + struct dlb2_eventdev *dlb2; +int err; + + dlb2 = dev->data->dev_private; + + evdev_dlb2_default_info.driver_name = name; + + err =dlb2_iface_open (&dlb2->qm_instance, name); +if (err <0 ) { +DLB2_LOG_ERR ("could not open event hardware device, err=%d\n" , + err); +return err; + } + + err =dlb2_hw_query_resources (dlb2); +if (err) { +DLB2_LOG_ERR ("get resources err=%d for %s\n" , + err, name); +return err; + } + +dlb2_iface_low_level_io_init (); + +dlb2_entry_points_init (dev);return 0 ; }
drivers/event/dlb2/meson.build +2 -1
@@ -10,7 +10,8 @@ endif sources = files('dlb2.c', 'dlb2_iface.c', 'pf/dlb2_main.c', - 'pf/dlb2_pf.c' + 'pf/dlb2_pf.c', + 'pf/base/dlb2_resource.c' ) headers = files()
drivers/event/dlb2/pf/base/dlb2_resource.c new file +274 -0
274 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_main.c +1 -22
@@ -19,6 +19,7 @@#include "dlb2_main.h" #include "../dlb2_user.h" #include "../dlb2_priv.h" +#include "../dlb2_iface.h" #include "../dlb2_inline_fns.h" #define PF_ID_ZERO 0/* PF ONLY! */
@@ -72,27 +73,6 @@#define DLB2_PCI_ACS_UF 0x10#define DLB2_PCI_ACS_EC 0x20 -/* Stubs: Allow building partial probe patch */ -void dlb2_resource_free (struct dlb2_hw *hw) -{ -RTE_SET_USED (hw); -} - -int dlb2_resource_init (struct dlb2_hw *hw) -{ -int ret =0 ; -RTE_SET_USED (hw); - -return ret; -} - -void dlb2_clr_pmcsr_disable (struct dlb2_hw *hw) -{ -RTE_SET_USED (hw); -} - -/* End stubs */ -static int dlb2_pci_find_ext_capability (struct rte_pci_device *pdev,uint32_t id) {
@@ -149,7 +129,6 @@ static int dlb2_pf_init_driver_state(struct dlb2_dev *dlb2_dev) {rte_spinlock_init (&dlb2_dev->resource_mutex); -rte_spinlock_init (&dlb2_dev->measurement_lock);return 0 ; }
drivers/event/dlb2/pf/dlb2_main.h +0 -1
@@ -38,7 +38,6 @@ struct dlb2_dev {* hardware registers. */ rte_spinlock_t resource_mutex; -rte_spinlock_t measurement_lock;bool worker_launched;u8 revision; };
drivers/event/dlb2/pf/dlb2_pf.c +63 -15
104 lines not on this page · raw message
Signature · 1 line
2.6.4
PATCH v11 9/23 event/dlb2: add xstats
In reply to Timothy McDanielAdd support for DLB2 xstats. Perform initialization and add standard xstats entry points.
--- drivers/event/dlb2/dlb2.c | 35 +- drivers/event/dlb2/dlb2_xstats.c | 1235 ++++++++++++++++++++++++++++++++++++++ drivers/event/dlb2/meson.build | 1 + 3 files changed, 1268 insertions(+), 3 deletions(-) create mode 100644 drivers/event/dlb2/dlb2_xstats.c
drivers/event/dlb2/dlb2.c +32 -3
@@ -70,6 +70,21 @@ static struct rte_event_dev_info evdev_dlb2_default_info = {struct process_local_port_data dlb2_port[DLB2_MAX_NUM_PORTS ][DLB2_NUM_PORT_TYPES ]; +/* +* DUMMY - added so that xstats path will compile/link. +* Will be replaced by real version in a subsequent +* patch. +*/ +uint32_t +dlb2_get_queue_depth (struct dlb2_eventdev *dlb2, +struct dlb2_eventdev_queue *queue) +{ +RTE_SET_USED (dlb2); +RTE_SET_USED (queue); + +return 0 ; +} +/* override defaults with value(s) provided on command line */ static void dlb2_init_queue_depth_thresholds(struct dlb2_eventdev *dlb2,
@@ -337,9 +352,16 @@ set_qid_depth_thresh(const char *key __rte_unused,static void dlb2_entry_points_init (struct rte_eventdev *dev) { -RTE_SET_USED (dev); - -/* Eventdev PMD entry points */ +/* Expose PMD's eventdev interface */ +static struct rte_eventdev_ops dlb2_eventdev_entry_ops = { + .dump = dlb2_eventdev_dump, + .xstats_get = dlb2_eventdev_xstats_get, + .xstats_get_names = dlb2_eventdev_xstats_get_names, + .xstats_get_by_name = dlb2_eventdev_xstats_get_by_name, + .xstats_reset = dlb2_eventdev_xstats_reset, + }; + + dev->dev_ops = &dlb2_eventdev_entry_ops; }int
@@ -391,6 +413,13 @@ dlb2_primary_eventdev_probe(struct rte_eventdev *dev,return err; } +/* Complete xtstats runtime initialization */ + err =dlb2_xstats_init (dlb2); +if (err) { +DLB2_LOG_ERR ("dlb2: failed to init xstats, err=%d\n" , err); +return err; + } +rte_spinlock_init (&dlb2->qm_instance.resource_lock);dlb2_iface_low_level_io_init ();
drivers/event/dlb2/dlb2_xstats.c new file +1235 -0
1,235 lines not on this page · raw message
drivers/event/dlb2/meson.build +1 -0
@@ -9,6 +9,7 @@ endif sources = files('dlb2.c', 'dlb2_iface.c', + 'dlb2_xstats.c', 'pf/dlb2_main.c', 'pf/dlb2_pf.c', 'pf/base/dlb2_resource.c'
Signature · 1 line
2.6.4
PATCH v11 10/23 event/dlb2: add infos get and configure
In reply to Timothy McDanielAdd support for configuring the DLB2 hardware.
In particular, this patch configures the DLB2 hardware's scheduling domain, such that it is provisioned with the requested number of ports and queues, provided sufficient resources are available. Individual queues and ports are configured later in port setup and eventdev start.
--- doc/guides/eventdevs/dlb2.rst | 116 + drivers/event/dlb2/dlb2.c | 313 +++ drivers/event/dlb2/dlb2_iface.c | 5 + drivers/event/dlb2/dlb2_iface.h | 4 + drivers/event/dlb2/pf/base/dlb2_resource.c | 3237 ++++++++++++++++++++++++++++ drivers/event/dlb2/pf/dlb2_main.c | 15 + drivers/event/dlb2/pf/dlb2_pf.c | 44 + 7 files changed, 3734 insertions(+)
doc/guides/eventdevs/dlb2.rst +116 -0
@@ -32,9 +32,125 @@ detailed understanding of the hardware, but these details are important when writing high-performance code. This section describes the places where the eventdev API and DLB2 misalign. +Scheduling Domain Configuration +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +There are 32 scheduling domainis the DLB2. +When one is configured, it allocates load-balanced and +directed queues, ports, credits, and other hardware resources. Some +resource allocations are user-controlled -- the number of queues, for example +-- and others, like credit pools (one directed and one load-balanced pool per +scheduling domain), are not. + +The DLB2 is a closed system eventdev, and as such the ``nb_events_limit`` device +setup argument and the per-port ``new_event_threshold`` argument apply as +defined in the eventdev header file. The limit is applied to all enqueues, +regardless of whether it will consume a directed or load-balanced credit. + +Load-balanced and Directed Ports +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +DLB2 ports come in two flavors: load-balanced and directed. The eventdev API +does not have the same concept, but it has a similar one: ports and queues that +are singly-linked (i.e. linked to a single queue or port, respectively). + +The ``rte_event_dev_info_get()`` function reports the number of available +event ports and queues (among other things). For the DLB2 PMD, max_event_ports +and max_event_queues report the number of available load-balanced ports and +queues, and max_single_link_event_port_queue_pairs reports the number of +available directed ports and queues. + +When a scheduling domain is created in ``rte_event_dev_configure()``, the user +specifies ``nb_event_ports`` and ``nb_single_link_event_port_queues``, which +control the total number of ports (load-balanced and directed) and the number +of directed ports. Hence, the number of requested load-balanced ports is +``nb_event_ports - nb_single_link_event_ports``. The ``nb_event_queues`` field +specifies the total number of queues (load-balanced and directed). The number +of directed queues comes from ``nb_single_link_event_port_queues``, since +directed ports and queues come in pairs. + +When a port is setup, the ``RTE_EVENT_PORT_CFG_SINGLE_LINK`` flag determines +whether it should be configured as a directed (the flag is set) or a +load-balanced (the flag is unset) port. Similarly, the +``RTE_EVENT_QUEUE_CFG_SINGLE_LINK`` queue configuration flag controls +whether it is a directed or load-balanced queue. + +Load-balanced ports can only be linked to load-balanced queues, and directed +ports can only be linked to directed queues. Furthermore, directed ports can +only be linked to a single directed queue (and vice versa), and that link +cannot change after the eventdev is started. + +The eventdev API does not have a directed scheduling type. To support directed +traffic, the dlb PMD detects when an event is being sent to a directed queue +and overrides its scheduling type. Note that the originally selected scheduling +type (atomic, ordered, or parallel) is not preserved, and an event's sched_type +will be set to ``RTE_SCHED_TYPE_ATOMIC`` when it is dequeued from a directed +port. + Flow ID ~~~~~~~ The flow ID field is preserved in the event when it is scheduled in the DLB2. +Reconfiguration +~~~~~~~~~~~~~~~ + +The Eventdev API allows one to reconfigure a device, its ports, and its queues +by first stopping the device, calling the configuration function(s), then +restarting the device. The DLB2 does not support configuring an individual queue +or port without first reconfiguring the entire device, however, so there are +certain reconfiguration sequences that are valid in the eventdev API but not +supported by the PMD. + +Specifically, the PMD supports the following configuration sequence: +1. Configure and start the device +2. Stop the device +3. (Optional) Reconfigure the device +4. (Optional) If step 3 is run: + + a. Setup queue(s). The reconfigured queue(s) lose their previous port links. + b. The reconfigured port(s) lose their previous queue links. + +5. (Optional, only if steps 4a and 4b are run) Link port(s) to queue(s) +6. Restart the device. If the device is reconfigured in step 3 but one or more + of its ports or queues are not, the PMD will apply their previous + configuration (including port->queue links) at this time. + +The PMD does not support the following configuration sequences: +1. Configure and start the device +2. Stop the device +3. Setup queue or setup port +4. Start the device + +This sequence is not supported because the event device must be reconfigured +before its ports or queues can be. + +Atomic Inflights Allocation +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In the last stage prior to scheduling an atomic event to a CQ, DLB2 holds the +inflight event in a temporary buffer that is divided among load-balanced +queues. If a queue's atomic buffer storage fills up, this can result in +head-of-line-blocking. For example: + +- An LDB queue allocated N atomic buffer entries +- All N entries are filled with events from flow X, which is pinned to CQ 0. + +Until CQ 0 releases 1+ events, no other atomic flows for that LDB queue can be +scheduled. The likelihood of this case depends on the eventdev configuration, +traffic behavior, event processing latency, potential for a worker to be +interrupted or otherwise delayed, etc. + +By default, the PMD allocates 16 buffer entries for each load-balanced queue, +which provides an even division across all 128 queues but potentially wastes +buffer space (e.g. if not all queues are used, or aren't used for atomic +scheduling). + +The PMD provides a dev arg to override the default per-queue allocation. To +increase a vdev's per-queue atomic-inflight allocation to (for example) 64: + + .. code-block:: console + + --vdev=dlb1_event,atm_inflights=64 +
drivers/event/dlb2/dlb2.c +313 -0
329 lines not on this page · raw message
drivers/event/dlb2/dlb2_iface.c +5 -0
@@ -26,3 +26,8 @@ int (*dlb2_iface_get_cq_poll_mode)(struct dlb2_hw_dev *handle,int (*dlb2_iface_get_num_resources)(struct dlb2_hw_dev *handle,struct dlb2_get_num_resources_args *rsrcs); + +int (*dlb2_iface_sched_domain_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_sched_domain_args *args); + +void (*dlb2_iface_domain_reset)(struct dlb2_eventdev *dlb2);
drivers/event/dlb2/dlb2_iface.h +4 -0
@@ -26,4 +26,8 @@ extern int (*dlb2_iface_get_cq_poll_mode)(struct dlb2_hw_dev *handle,extern int (*dlb2_iface_get_num_resources)(struct dlb2_hw_dev *handle,struct dlb2_get_num_resources_args *rsrcs); +extern int (*dlb2_iface_sched_domain_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_sched_domain_args *args); + +extern void (*dlb2_iface_domain_reset)(struct dlb2_eventdev *dlb2);#endif /* _DLB2_IFACE_H_ */
drivers/event/dlb2/pf/base/dlb2_resource.c +3237 -0
2,530 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_pf.c +44 -0
44 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.6.4
Part of the diff is not shown here. View the raw message.
PATCH v11 11/23 event/dlb2: add queue and port default conf
In reply to Timothy McDanielAdd support for getting the queue and port default configuration.
--- drivers/event/dlb2/dlb2.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
drivers/event/dlb2/dlb2.c +30 -0
@@ -661,12 +661,42 @@ dlb2_eventdev_configure(const struct rte_eventdev *dev) }static void +dlb2_eventdev_port_default_conf_get (struct rte_eventdev *dev, +uint8_t port_id, +struct rte_event_port_conf *port_conf) +{ +RTE_SET_USED (port_id); +struct dlb2_eventdev *dlb2 =dlb2_pmd_priv (dev); + + port_conf->new_event_threshold = dlb2->new_event_limit; + port_conf->dequeue_depth =32 ; + port_conf->enqueue_depth =DLB2_MAX_ENQUEUE_DEPTH ; + port_conf->event_port_cfg =0 ; +} + +static void +dlb2_eventdev_queue_default_conf_get (struct rte_eventdev *dev, +uint8_t queue_id, +struct rte_event_queue_conf *queue_conf) +{ +RTE_SET_USED (dev); +RTE_SET_USED (queue_id); + + queue_conf->nb_atomic_flows =1024 ; + queue_conf->nb_atomic_order_sequences =64 ; + queue_conf->event_queue_cfg =0 ; + queue_conf->priority =0 ; +} + +static void dlb2_entry_points_init (struct rte_eventdev *dev) {/* Expose PMD's eventdev interface */ static struct rte_eventdev_ops dlb2_eventdev_entry_ops = { .dev_infos_get = dlb2_eventdev_info_get, .dev_configure = dlb2_eventdev_configure, + .queue_def_conf = dlb2_eventdev_queue_default_conf_get, + .port_def_conf = dlb2_eventdev_port_default_conf_get, .dump = dlb2_eventdev_dump, .xstats_get = dlb2_eventdev_xstats_get, .xstats_get_names = dlb2_eventdev_xstats_get_names,
Signature · 1 line
2.6.4
PATCH v11 12/23 event/dlb2: add queue setup
In reply to Timothy McDanielLoad balanced (ldb) queues are setup here. Directed queues are not set up until link time, at which point we know the directed port ID. Directed queue setup will only fail if this queue is already setup or there are no directed queues left to configure.
--- doc/guides/eventdevs/dlb2.rst | 73 +++-- drivers/event/dlb2/dlb2.c | 312 +++++++++++++++++++ drivers/event/dlb2/dlb2_iface.c | 12 + drivers/event/dlb2/dlb2_iface.h | 12 + drivers/event/dlb2/pf/base/dlb2_resource.c | 464 +++++++++++++++++++++++++++++ drivers/event/dlb2/pf/dlb2_main.c | 10 + drivers/event/dlb2/pf/dlb2_pf.c | 82 +++++ 7 files changed, 926 insertions(+), 39 deletions(-)
doc/guides/eventdevs/dlb2.rst +34 -39
@@ -47,45 +47,40 @@ setup argument and the per-port ``new_event_threshold`` argument apply as defined in the eventdev header file. The limit is applied to all enqueues, regardless of whether it will consume a directed or load-balanced credit. -Load-balanced and Directed Ports -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -DLB2 ports come in two flavors: load-balanced and directed. The eventdev API -does not have the same concept, but it has a similar one: ports and queues that -are singly-linked (i.e. linked to a single queue or port, respectively). - -The ``rte_event_dev_info_get()`` function reports the number of available -event ports and queues (among other things). For the DLB2 PMD, max_event_ports -and max_event_queues report the number of available load-balanced ports and -queues, and max_single_link_event_port_queue_pairs reports the number of -available directed ports and queues. - -When a scheduling domain is created in ``rte_event_dev_configure()``, the user -specifies ``nb_event_ports`` and ``nb_single_link_event_port_queues``, which -control the total number of ports (load-balanced and directed) and the number -of directed ports. Hence, the number of requested load-balanced ports is -``nb_event_ports - nb_single_link_event_ports``. The ``nb_event_queues`` field -specifies the total number of queues (load-balanced and directed). The number -of directed queues comes from ``nb_single_link_event_port_queues``, since -directed ports and queues come in pairs. - -When a port is setup, the ``RTE_EVENT_PORT_CFG_SINGLE_LINK`` flag determines -whether it should be configured as a directed (the flag is set) or a -load-balanced (the flag is unset) port. Similarly, the -``RTE_EVENT_QUEUE_CFG_SINGLE_LINK`` queue configuration flag controls -whether it is a directed or load-balanced queue. - -Load-balanced ports can only be linked to load-balanced queues, and directed -ports can only be linked to directed queues. Furthermore, directed ports can -only be linked to a single directed queue (and vice versa), and that link -cannot change after the eventdev is started. - -The eventdev API does not have a directed scheduling type. To support directed -traffic, the dlb PMD detects when an event is being sent to a directed queue -and overrides its scheduling type. Note that the originally selected scheduling -type (atomic, ordered, or parallel) is not preserved, and an event's sched_type -will be set to ``RTE_SCHED_TYPE_ATOMIC`` when it is dequeued from a directed -port. +Load-Balanced Queues +~~~~~~~~~~~~~~~~~~~~ + +A load-balanced queue can support atomic and ordered scheduling, or atomic and +unordered scheduling, but not atomic and unordered and ordered scheduling. A +queue's scheduling types are controlled by the event queue configuration. + +If the user sets the ``RTE_EVENT_QUEUE_CFG_ALL_TYPES`` flag, the +``nb_atomic_order_sequences`` determines the supported scheduling types. +With non-zero ``nb_atomic_order_sequences``, the queue is configured for atomic +and ordered scheduling. In this case, ``RTE_SCHED_TYPE_PARALLEL`` scheduling is +supported by scheduling those events as ordered events. Note that when the +event is dequeued, its sched_type will be ``RTE_SCHED_TYPE_ORDERED``. Else if +``nb_atomic_order_sequences`` is zero, the queue is configured for atomic and +unordered scheduling. In this case, ``RTE_SCHED_TYPE_ORDERED`` is unsupported. + +If the ``RTE_EVENT_QUEUE_CFG_ALL_TYPES`` flag is not set, schedule_type +dictates the queue's scheduling type. + +The ``nb_atomic_order_sequences`` queue configuration field sets the ordered +queue's reorder buffer size. DLB2 has 4 groups of ordered queues, where each +group is configured to contain either 1 queue with 1024 reorder entries, 2 +queues with 512 reorder entries, and so on down to 32 queues with 32 entries. + +When a load-balanced queue is created, the PMD will configure a new sequence +number group on-demand if num_sequence_numbers does not match a pre-existing +group with available reorder buffer entries. If all sequence number groups are +in use, no new group will be created and queue configuration will fail. (Note +that when the PMD is used with a virtual DLB2 device, it cannot change the +sequence number configuration.) + +The queue's ``nb_atomic_flows`` parameter is ignored by the DLB2 PMD, because +the DLB2 does not limit the number of flows a queue can track. In the DLB2, all +load-balanced queues can use the full 16-bit flow ID range. Flow ID ~~~~~~~
drivers/event/dlb2/dlb2.c +312 -0
324 lines not on this page · raw message
drivers/event/dlb2/dlb2_iface.c +12 -0
@@ -31,3 +31,15 @@ int (*dlb2_iface_sched_domain_create)(struct dlb2_hw_dev *handle, struct dlb2_create_sched_domain_args *args);void (*dlb2_iface_domain_reset)(struct dlb2_eventdev *dlb2); + +int (*dlb2_iface_ldb_queue_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_ldb_queue_args *cfg); + +int (*dlb2_iface_get_sn_allocation)(struct dlb2_hw_dev *handle, +struct dlb2_get_sn_allocation_args *args); + +int (*dlb2_iface_set_sn_allocation)(struct dlb2_hw_dev *handle, +struct dlb2_set_sn_allocation_args *args); + +int (*dlb2_iface_get_sn_occupancy)(struct dlb2_hw_dev *handle, +struct dlb2_get_sn_occupancy_args *args);
drivers/event/dlb2/dlb2_iface.h +12 -0
@@ -30,4 +30,16 @@ extern int (*dlb2_iface_sched_domain_create)(struct dlb2_hw_dev *handle, struct dlb2_create_sched_domain_args *args);extern void (*dlb2_iface_domain_reset)(struct dlb2_eventdev *dlb2); + +extern int (*dlb2_iface_ldb_queue_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_ldb_queue_args *cfg); + +extern int (*dlb2_iface_get_sn_allocation)(struct dlb2_hw_dev *handle, +struct dlb2_get_sn_allocation_args *args); + +extern int (*dlb2_iface_set_sn_allocation)(struct dlb2_hw_dev *handle, +struct dlb2_set_sn_allocation_args *args); + +extern int (*dlb2_iface_get_sn_occupancy)(struct dlb2_hw_dev *handle, +struct dlb2_get_sn_occupancy_args *args);#endif /* _DLB2_IFACE_H_ */
drivers/event/dlb2/pf/base/dlb2_resource.c +464 -0
467 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_main.c +10 -0
@@ -613,3 +613,13 @@ dlb2_pf_reset_domain(struct dlb2_hw *hw, u32 id) {return dlb2_reset_domain (hw, id,NOT_VF_REQ ,PF_ID_ZERO ); } + +int +dlb2_pf_create_ldb_queue (struct dlb2_hw *hw, +u32 id, +struct dlb2_create_ldb_queue_args *args, +struct dlb2_cmd_response *resp) +{ +return dlb2_hw_create_ldb_queue (hw, id, args, resp,NOT_VF_REQ , +PF_ID_ZERO ); +}
drivers/event/dlb2/pf/dlb2_pf.c +82 -0
94 lines not on this page · raw message
Signature · 1 line
2.6.4
PATCH v11 13/23 event/dlb2: add port setup
In reply to Timothy McDanielConfigure the load balanced (ldb) or directed (dir) port. The consumer queue (CQ) and producer port (PP) are also set up here.
--- doc/guides/eventdevs/dlb2.rst | 75 +++ drivers/event/dlb2/dlb2.c | 498 ++++++++++++++++ drivers/event/dlb2/dlb2_iface.c | 8 + drivers/event/dlb2/dlb2_iface.h | 8 + drivers/event/dlb2/pf/base/dlb2_resource.c | 922 +++++++++++++++++++++++++++++ drivers/event/dlb2/pf/dlb2_main.c | 28 + drivers/event/dlb2/pf/dlb2_pf.c | 180 ++++++ 7 files changed, 1719 insertions(+)
doc/guides/eventdevs/dlb2.rst +75 -0
@@ -82,6 +82,81 @@ The queue's ``nb_atomic_flows`` parameter is ignored by the DLB2 PMD, because the DLB2 does not limit the number of flows a queue can track. In the DLB2, all load-balanced queues can use the full 16-bit flow ID range. +Load-Balanced Queues +~~~~~~~~~~~~~~~~~~~~ + +A load-balanced queue can support atomic and ordered scheduling, or atomic and +unordered scheduling, but not atomic and unordered and ordered scheduling. A +queue's scheduling types are controlled by the event queue configuration. + +If the user sets the ``RTE_EVENT_QUEUE_CFG_ALL_TYPES`` flag, the +``nb_atomic_order_sequences`` determines the supported scheduling types. +With non-zero ``nb_atomic_order_sequences``, the queue is configured for atomic +and ordered scheduling. In this case, ``RTE_SCHED_TYPE_PARALLEL`` scheduling is +supported by scheduling those events as ordered events. Note that when the +event is dequeued, its sched_type will be ``RTE_SCHED_TYPE_ORDERED``. Else if +``nb_atomic_order_sequences`` is zero, the queue is configured for atomic and +unordered scheduling. In this case, ``RTE_SCHED_TYPE_ORDERED`` is unsupported. + +If the ``RTE_EVENT_QUEUE_CFG_ALL_TYPES`` flag is not set, schedule_type +dictates the queue's scheduling type. + +The ``nb_atomic_order_sequences`` queue configuration field sets the ordered +queue's reorder buffer size. DLB2 has 4 groups of ordered queues, where each +group is configured to contain either 1 queue with 1024 reorder entries, 2 +queues with 512 reorder entries, and so on down to 32 queues with 32 entries. + +When a load-balanced queue is created, the PMD will configure a new sequence +number group on-demand if num_sequence_numbers does not match a pre-existing +group with available reorder buffer entries. If all sequence number groups are +in use, no new group will be created and queue configuration will fail. (Note +that when the PMD is used with a virtual DLB2 device, it cannot change the +sequence number configuration.) + +The queue's ``nb_atomic_flows`` parameter is ignored by the DLB2 PMD, because +the DLB2 does not limit the number of flows a queue can track. In the DLB2, all +load-balanced queues can use the full 16-bit flow ID range. + +Load-balanced and Directed Ports +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +DLB2 ports come in two flavors: load-balanced and directed. The eventdev API +does not have the same concept, but it has a similar one: ports and queues that +are singly-linked (i.e. linked to a single queue or port, respectively). + +The ``rte_event_dev_info_get()`` function reports the number of available +event ports and queues (among other things). For the DLB2 PMD, max_event_ports +and max_event_queues report the number of available load-balanced ports and +queues, and max_single_link_event_port_queue_pairs reports the number of +available directed ports and queues. + +When a scheduling domain is created in ``rte_event_dev_configure()``, the user +specifies ``nb_event_ports`` and ``nb_single_link_event_port_queues``, which +control the total number of ports (load-balanced and directed) and the number +of directed ports. Hence, the number of requested load-balanced ports is +``nb_event_ports - nb_single_link_event_ports``. The ``nb_event_queues`` field +specifies the total number of queues (load-balanced and directed). The number +of directed queues comes from ``nb_single_link_event_port_queues``, since +directed ports and queues come in pairs. + +When a port is setup, the ``RTE_EVENT_PORT_CFG_SINGLE_LINK`` flag determines +whether it should be configured as a directed (the flag is set) or a +load-balanced (the flag is unset) port. Similarly, the +``RTE_EVENT_QUEUE_CFG_SINGLE_LINK`` queue configuration flag controls +whether it is a directed or load-balanced queue. + +Load-balanced ports can only be linked to load-balanced queues, and directed +ports can only be linked to directed queues. Furthermore, directed ports can +only be linked to a single directed queue (and vice versa), and that link +cannot change after the eventdev is started. + +The eventdev API does not have a directed scheduling type. To support directed +traffic, the dlb PMD detects when an event is being sent to a directed queue +and overrides its scheduling type. Note that the originally selected scheduling +type (atomic, ordered, or parallel) is not preserved, and an event's sched_type +will be set to ``RTE_SCHED_TYPE_ATOMIC`` when it is dequeued from a directed +port. + Flow ID ~~~~~~~
drivers/event/dlb2/dlb2.c +498 -0
510 lines not on this page · raw message
drivers/event/dlb2/dlb2_iface.c +8 -0
@@ -43,3 +43,11 @@ int (*dlb2_iface_set_sn_allocation)(struct dlb2_hw_dev *handle,int (*dlb2_iface_get_sn_occupancy)(struct dlb2_hw_dev *handle,struct dlb2_get_sn_occupancy_args *args); + +int (*dlb2_iface_ldb_port_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_ldb_port_args *cfg, +enum dlb2_cq_poll_modes poll_mode); + +int (*dlb2_iface_dir_port_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_dir_port_args *cfg, +enum dlb2_cq_poll_modes poll_mode);
drivers/event/dlb2/dlb2_iface.h +8 -0
@@ -42,4 +42,12 @@ extern int (*dlb2_iface_set_sn_allocation)(struct dlb2_hw_dev *handle,extern int (*dlb2_iface_get_sn_occupancy)(struct dlb2_hw_dev *handle,struct dlb2_get_sn_occupancy_args *args); + +extern int (*dlb2_iface_ldb_port_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_ldb_port_args *cfg, +enum dlb2_cq_poll_modes poll_mode); + +extern int (*dlb2_iface_dir_port_create)(struct dlb2_hw_dev *handle, +struct dlb2_create_dir_port_args *cfg, +enum dlb2_cq_poll_modes poll_mode);#endif /* _DLB2_IFACE_H_ */
drivers/event/dlb2/pf/base/dlb2_resource.c +922 -0
925 lines not on this page · raw message
drivers/event/dlb2/pf/dlb2_main.c +28 -0
@@ -623,3 +623,31 @@ dlb2_pf_create_ldb_queue(struct dlb2_hw *hw,return dlb2_hw_create_ldb_queue (hw, id, args, resp,NOT_VF_REQ ,PF_ID_ZERO ); } + +int +dlb2_pf_create_ldb_port (struct dlb2_hw *hw, +u32 id, +struct dlb2_create_ldb_port_args *args, +uintptr_t cq_dma_base, +struct dlb2_cmd_response *resp) +{ +return dlb2_hw_create_ldb_port (hw, id, args, + cq_dma_base, + resp, +NOT_VF_REQ , +PF_ID_ZERO ); +} + +int +dlb2_pf_create_dir_port (struct dlb2_hw *hw, +u32 id, +struct dlb2_create_dir_port_args *args, +uintptr_t cq_dma_base, +struct dlb2_cmd_response *resp) +{ +return dlb2_hw_create_dir_port (hw, id, args, + cq_dma_base, + resp, +NOT_VF_REQ , +PF_ID_ZERO ); +}
drivers/event/dlb2/pf/dlb2_pf.c +180 -0
192 lines not on this page · raw message
Signature · 1 line
2.6.4