X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fevent%2Fsw%2Fsw_evdev.h;h=7c77b249569ddb0a9b6333f38cefc80f10ac39f2;hb=1cbc164ebd8a11a5e850454d7425f01612a74bc4;hp=61c671d622d24cb275b5482e53a6a1e64da2c09f;hpb=c1ad03df7ad5c05e2a12dc07f5f1417197515ded;p=dpdk.git diff --git a/drivers/event/sw/sw_evdev.h b/drivers/event/sw/sw_evdev.h index 61c671d622..7c77b24956 100644 --- a/drivers/event/sw/sw_evdev.h +++ b/drivers/event/sw/sw_evdev.h @@ -1,40 +1,13 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2016-2017 Intel Corporation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2016-2017 Intel Corporation */ #ifndef _SW_EVDEV_H_ #define _SW_EVDEV_H_ +#include "sw_evdev_log.h" #include -#include +#include #include #define SW_DEFAULT_CREDIT_QUANTA 32 @@ -49,6 +22,10 @@ #define MAX_SW_PROD_Q_DEPTH 4096 #define SW_FRAGMENTS_MAX 16 +/* Should be power-of-two minus one, to leave room for the next pointer */ +#define SW_EVS_PER_Q_CHUNK 255 +#define SW_Q_CHUNK_SIZE ((SW_EVS_PER_Q_CHUNK + 1) * sizeof(struct rte_event)) + /* report dequeue burst sizes in buckets */ #define SW_DEQ_STAT_BUCKET_SHIFT 2 /* how many packets pulled from port by sched */ @@ -59,6 +36,7 @@ #define EVENTDEV_NAME_SW_PMD event_sw #define SW_PMD_NAME RTE_STR(event_sw) +#define SW_PMD_NAME_MAX 64 #define SW_SCHED_TYPE_DIRECT (RTE_SCHED_TYPE_PARALLEL + 1) @@ -87,26 +65,6 @@ static const uint8_t sw_qe_flag_map[] = { QE_FLAG_VALID | QE_FLAG_COMPLETE | QE_FLAG_NOT_EOP, }; -#ifdef RTE_LIBRTE_PMD_EVDEV_SW_DEBUG -#define SW_LOG_INFO(fmt, args...) \ - RTE_LOG(INFO, EVENTDEV, "[%s] %s() line %u: " fmt "\n", \ - SW_PMD_NAME, \ - __func__, __LINE__, ## args) - -#define SW_LOG_DBG(fmt, args...) \ - RTE_LOG(DEBUG, EVENTDEV, "[%s] %s() line %u: " fmt "\n", \ - SW_PMD_NAME, \ - __func__, __LINE__, ## args) -#else -#define SW_LOG_INFO(fmt, args...) -#define SW_LOG_DBG(fmt, args...) -#endif - -#define SW_LOG_ERR(fmt, args...) \ - RTE_LOG(ERR, EVENTDEV, "[%s] %s() line %u: " fmt "\n", \ - SW_PMD_NAME, \ - __func__, __LINE__, ## args) - /* Records basic event stats at a given point. Used in port and qid structs */ struct sw_point_stats { uint64_t rx_pkts; @@ -129,6 +87,14 @@ struct reorder_buffer_entry { struct rte_event fragments[SW_FRAGMENTS_MAX]; }; +struct sw_iq { + struct sw_queue_chunk *head; + struct sw_queue_chunk *tail; + uint16_t head_idx; + uint16_t tail_idx; + uint16_t count; +}; + struct sw_qid { /* set when the QID has been initialized */ uint8_t initialized; @@ -141,7 +107,7 @@ struct sw_qid { struct sw_point_stats stats; /* Internal priority rings for packets */ - struct iq_ring *iq[SW_IQS_MAX]; + struct sw_iq iq[SW_IQS_MAX]; uint32_t iq_pkt_mask; /* A mask to indicate packets in an IQ */ uint64_t iq_pkt_count[SW_IQS_MAX]; @@ -149,6 +115,7 @@ struct sw_qid { uint32_t cq_num_mapped_cqs; uint32_t cq_next_tx; /* cq to write next (non-atomic) packet */ uint32_t cq_map[SW_PORTS_MAX]; + uint64_t to_port[SW_PORTS_MAX]; /* Track flow ids for atomic load balancing */ struct sw_fid_t fids[SW_QID_NUM_FIDS]; @@ -181,6 +148,14 @@ struct sw_port { /* A numeric ID for the port */ uint8_t id; + /* An atomic counter for when the port has been unlinked, and the + * scheduler has not yet acked this unlink - hence there may still be + * events in the buffers going to the port. When the unlinks in + * progress is read by the scheduler, no more events will be pushed to + * the port - hence the scheduler core can just assign zero. + */ + uint8_t unlinks_in_progress; + int16_t is_directed; /** Takes from a single directed QID */ /** * For loadbalanced we can optimise pulling packets from @@ -189,9 +164,9 @@ struct sw_port { int16_t num_ordered_qids; /** Ring and buffer for pulling events from workers for scheduling */ - struct qe_ring *rx_worker_ring __rte_cache_aligned; + struct rte_event_ring *rx_worker_ring __rte_cache_aligned; /** Ring and buffer for pushing packets to workers after scheduling */ - struct qe_ring *cq_worker_ring; + struct rte_event_ring *cq_worker_ring; /* hole */ @@ -199,6 +174,7 @@ struct sw_port { uint16_t outstanding_releases __rte_cache_aligned; uint16_t inflight_max; /* app requested max inflights for this port */ uint16_t inflight_credits; /* num credits this port has right now */ + uint8_t implicit_release; /* release events before dequeueing */ uint16_t last_dequeue_burst_sz; /* how big the burst was */ uint64_t last_dequeue_ticks; /* used to track burst processing time */ @@ -251,6 +227,8 @@ struct sw_evdev { /* Internal queues - one per logical queue */ struct sw_qid qids[RTE_EVENT_MAX_QUEUES_PER_DEV] __rte_cache_aligned; + struct sw_queue_chunk *chunk_list_head; + struct sw_queue_chunk *chunks; /* Cache how many packets are in each cq */ uint16_t cq_ring_space[SW_PORTS_MAX] __rte_cache_aligned; @@ -275,6 +253,9 @@ struct sw_evdev { /* store num stats and offset of the stats for each queue */ uint16_t xstats_count_per_qid[RTE_EVENT_MAX_QUEUES_PER_DEV]; uint16_t xstats_offset_for_qid[RTE_EVENT_MAX_QUEUES_PER_DEV]; + + uint32_t service_id; + char service_name[SW_PMD_NAME_MAX]; }; static inline struct sw_evdev * @@ -314,5 +295,6 @@ int sw_xstats_reset(struct rte_eventdev *dev, const uint32_t ids[], uint32_t nb_ids); +int test_sw_eventdev(void); #endif /* _SW_EVDEV_H_ */