From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 05DC3A045E for ; Tue, 28 May 2019 14:13:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6CD681B9CC; Tue, 28 May 2019 14:08:42 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 1B5661B9AA for ; Tue, 28 May 2019 14:08:29 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 May 2019 05:08:29 -0700 X-ExtLoop1: 1 Received: from lkrakowx-mobl.ger.corp.intel.com ([10.103.104.99]) by fmsmga001.fm.intel.com with ESMTP; 28 May 2019 05:08:28 -0700 From: Lukasz Krakowiak To: cristian.dumitrescu@intel.com Cc: dev@dpdk.org, Jasvinder Singh , Abraham Tovar , Lukasz Krakowiak Date: Tue, 28 May 2019 14:05:40 +0200 Message-Id: <20190528120553.2992-15-lukaszx.krakowiak@intel.com> X-Mailer: git-send-email 2.19.2.windows.1 In-Reply-To: <20190528120553.2992-1-lukaszx.krakowiak@intel.com> References: <20190528120553.2992-1-lukaszx.krakowiak@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 14/27] sched: update grinder next pipe and tc functions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Jasvinder Singh Update implementation of grinder next pipe and tc functions to allow configuration flexiblity for pipe traffic classes and queues, and subport level configuration of the pipe parameters. Signed-off-by: Jasvinder Singh Signed-off-by: Abraham Tovar Signed-off-by: Lukasz Krakowiak --- lib/librte_sched/rte_sched.c | 115 ++++++++++++++++------------------- 1 file changed, 53 insertions(+), 62 deletions(-) diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index 32a5121cd..74a8e0a71 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -345,24 +345,6 @@ rte_sched_port_queues_per_port(struct rte_sched_port *port) return RTE_SCHED_QUEUES_PER_PIPE * port->n_pipes_per_subport * port->n_subports_per_port; } -static inline struct rte_mbuf ** -rte_sched_port_qbase(struct rte_sched_port *port, uint32_t qindex) -{ - uint32_t pindex = qindex >> 4; - uint32_t qpos = qindex & 0xF; - - return (port->queue_array + pindex * - port->qsize_sum + port->qsize_add[qpos]); -} - -static inline uint16_t -rte_sched_port_qsize(struct rte_sched_port *port, uint32_t qindex) -{ - uint32_t tc = (qindex >> 2) & 0x3; - - return port->qsize[tc]; -} - static int pipe_profile_check(struct rte_sched_pipe_params *params, uint32_t rate, uint16_t *qsize) @@ -2120,13 +2102,14 @@ grinder_schedule(struct rte_sched_port *port, uint32_t pos) #ifdef SCHED_VECTOR_SSE4 static inline int -grinder_pipe_exists(struct rte_sched_port *port, uint32_t base_pipe) +grinder_pipe_exists(struct rte_sched_subport *subport, uint32_t base_pipe) { __m128i index = _mm_set1_epi32(base_pipe); - __m128i pipes = _mm_load_si128((__m128i *)port->grinder_base_bmp_pos); + __m128i pipes = + _mm_load_si128((__m128i *)subport->grinder_base_bmp_pos); __m128i res = _mm_cmpeq_epi32(pipes, index); - pipes = _mm_load_si128((__m128i *)(port->grinder_base_bmp_pos + 4)); + pipes = _mm_load_si128((__m128i *)(subport->grinder_base_bmp_pos + 4)); pipes = _mm_cmpeq_epi32(pipes, index); res = _mm_or_si128(res, pipes); @@ -2139,10 +2122,10 @@ grinder_pipe_exists(struct rte_sched_port *port, uint32_t base_pipe) #elif defined(SCHED_VECTOR_NEON) static inline int -grinder_pipe_exists(struct rte_sched_port *port, uint32_t base_pipe) +grinder_pipe_exists(struct rte_sched_subport *subport, uint32_t base_pipe) { uint32x4_t index, pipes; - uint32_t *pos = (uint32_t *)port->grinder_base_bmp_pos; + uint32_t *pos = (uint32_t *)subport->grinder_base_bmp_pos; index = vmovq_n_u32(base_pipe); pipes = vld1q_u32(pos); @@ -2159,12 +2142,12 @@ grinder_pipe_exists(struct rte_sched_port *port, uint32_t base_pipe) #else static inline int -grinder_pipe_exists(struct rte_sched_port *port, uint32_t base_pipe) +grinder_pipe_exists(struct rte_sched_subport *subport, uint32_t base_pipe) { uint32_t i; for (i = 0; i < RTE_SCHED_PORT_N_GRINDERS; i++) { - if (port->grinder_base_bmp_pos[i] == base_pipe) + if (subport->grinder_base_bmp_pos[i] == base_pipe) return 1; } @@ -2231,47 +2214,54 @@ grinder_tccache_populate(struct rte_sched_subport *subport, uint32_t pos, } static inline int -grinder_next_tc(struct rte_sched_port *port, uint32_t pos) +grinder_next_tc(struct rte_sched_subport *subport, uint32_t pos) { - struct rte_sched_grinder *grinder = port->grinder + pos; + struct rte_sched_grinder *grinder = subport->grinder + pos; + struct rte_sched_pipe *pipe = grinder->pipe; struct rte_mbuf **qbase; uint32_t qindex; uint16_t qsize; + uint32_t i; if (grinder->tccache_r == grinder->tccache_w) return 0; qindex = grinder->tccache_qindex[grinder->tccache_r]; - qbase = rte_sched_port_qbase(port, qindex); - qsize = rte_sched_port_qsize(port, qindex); + grinder->tc_index = + (qindex < RTE_SCHED_TRAFFIC_CLASS_BE) ? + qindex : RTE_SCHED_TRAFFIC_CLASS_BE; - grinder->tc_index = (qindex >> 2) & 0x3; - grinder->qmask = grinder->tccache_qmask[grinder->tccache_r]; - grinder->qsize = qsize; + qbase = rte_sched_subport_qbase(subport, qindex); + if (grinder->tc_index < pipe->n_sp_queues) { + qsize = rte_sched_subport_qsize(subport, qindex); - grinder->qindex[0] = qindex; - grinder->qindex[1] = qindex + 1; - grinder->qindex[2] = qindex + 2; - grinder->qindex[3] = qindex + 3; + grinder->sp.qindex = qindex; + grinder->sp.queue = subport->queue + qindex; + grinder->sp.qbase = qbase; + grinder->sp.qsize = qsize; - grinder->queue[0] = port->queue + qindex; - grinder->queue[1] = port->queue + qindex + 1; - grinder->queue[2] = port->queue + qindex + 2; - grinder->queue[3] = port->queue + qindex + 3; + grinder->tccache_r++; + return 1; + } + + for (i = 0; i < pipe->n_be_queues; i++) { + qsize = rte_sched_subport_qsize(subport, qindex + i); - grinder->qbase[0] = qbase; - grinder->qbase[1] = qbase + qsize; - grinder->qbase[2] = qbase + 2 * qsize; - grinder->qbase[3] = qbase + 3 * qsize; + grinder->be.qindex[i] = qindex + i; + grinder->be.queue[i] = subport->queue + qindex + i; + grinder->be.qbase[i] = qbase + i * qsize; + grinder->be.qsize[i] = qsize; + } + grinder->be.qmask = grinder->tccache_qmask[grinder->tccache_r]; grinder->tccache_r++; return 1; } static inline int -grinder_next_pipe(struct rte_sched_port *port, uint32_t pos) +grinder_next_pipe(struct rte_sched_subport *subport, uint32_t pos) { - struct rte_sched_grinder *grinder = port->grinder + pos; + struct rte_sched_grinder *grinder = subport->grinder + pos; uint32_t pipe_qindex; uint16_t pipe_qmask; @@ -2284,22 +2274,23 @@ grinder_next_pipe(struct rte_sched_port *port, uint32_t pos) uint32_t bmp_pos = 0; /* Get another non-empty pipe group */ - if (unlikely(rte_bitmap_scan(port->bmp, &bmp_pos, &bmp_slab) <= 0)) + if (unlikely(rte_bitmap_scan(subport->bmp, &bmp_pos, &bmp_slab) + <= 0)) return 0; #ifdef RTE_SCHED_DEBUG - debug_check_queue_slab(port, bmp_pos, bmp_slab); + debug_check_queue_slab(subport, bmp_pos, bmp_slab); #endif /* Return if pipe group already in one of the other grinders */ - port->grinder_base_bmp_pos[pos] = RTE_SCHED_BMP_POS_INVALID; - if (unlikely(grinder_pipe_exists(port, bmp_pos))) + subport->grinder_base_bmp_pos[pos] = RTE_SCHED_BMP_POS_INVALID; + if (unlikely(grinder_pipe_exists(subport, bmp_pos))) return 0; - port->grinder_base_bmp_pos[pos] = bmp_pos; + subport->grinder_base_bmp_pos[pos] = bmp_pos; /* Install new pipe group into grinder's pipe cache */ - grinder_pcache_populate(port->subport, pos, bmp_pos, bmp_slab); + grinder_pcache_populate(subport, pos, bmp_pos, bmp_slab); pipe_qmask = grinder->pcache_qmask[0]; pipe_qindex = grinder->pcache_qindex[0]; @@ -2308,18 +2299,18 @@ grinder_next_pipe(struct rte_sched_port *port, uint32_t pos) /* Install new pipe in the grinder */ grinder->pindex = pipe_qindex >> 4; - grinder->subport = port->subport + (grinder->pindex / port->n_pipes_per_subport); - grinder->pipe = port->pipe + grinder->pindex; + grinder->subport = subport; + grinder->pipe = subport->pipe + grinder->pindex; grinder->pipe_params = NULL; /* to be set after the pipe structure is prefetched */ grinder->productive = 0; - grinder_tccache_populate(port->subport, pos, pipe_qindex, pipe_qmask); - grinder_next_tc(port, pos); + grinder_tccache_populate(subport, pos, pipe_qindex, pipe_qmask); + grinder_next_tc(subport, pos); /* Check for pipe exhaustion */ - if (grinder->pindex == port->pipe_loop) { - port->pipe_exhaustion = 1; - port->pipe_loop = RTE_SCHED_PIPE_INVALID; + if (grinder->pindex == subport->pipe_loop) { + subport->pipe_exhaustion = 1; + subport->pipe_loop = RTE_SCHED_PIPE_INVALID; } return 1; @@ -2455,7 +2446,7 @@ grinder_handle(struct rte_sched_port *port, uint32_t pos) switch (grinder->state) { case e_GRINDER_PREFETCH_PIPE: { - if (grinder_next_pipe(port, pos)) { + if (grinder_next_pipe(port->subport, pos)) { grinder_prefetch_pipe(port, pos); port->busy_grinders++; @@ -2502,7 +2493,7 @@ grinder_handle(struct rte_sched_port *port, uint32_t pos) grinder_wrr_store(port, pos); /* Look for another active TC within same pipe */ - if (grinder_next_tc(port, pos)) { + if (grinder_next_tc(port->subport, pos)) { grinder_prefetch_tc_queue_arrays(port, pos); grinder->state = e_GRINDER_PREFETCH_MBUF; @@ -2516,7 +2507,7 @@ grinder_handle(struct rte_sched_port *port, uint32_t pos) grinder_evict(port, pos); /* Look for another active pipe */ - if (grinder_next_pipe(port, pos)) { + if (grinder_next_pipe(port->subport, pos)) { grinder_prefetch_pipe(port, pos); grinder->state = e_GRINDER_PREFETCH_TC_QUEUE_ARRAYS; -- 2.20.1