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 D7AC1A046B for ; Tue, 25 Jun 2019 17:34:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 90ABE1BB14; Tue, 25 Jun 2019 17:32:25 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 4D2041BA90 for ; Tue, 25 Jun 2019 17:32:13 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jun 2019 08:32:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,416,1557212400"; d="scan'208";a="166711482" Received: from silpixa00381635.ir.intel.com (HELO silpixa00381635.ger.corp.intel.com) ([10.237.223.4]) by orsmga006.jf.intel.com with ESMTP; 25 Jun 2019 08:32:11 -0700 From: Jasvinder Singh To: dev@dpdk.org Cc: cristian.dumitrescu@intel.com, Abraham Tovar , Lukasz Krakowiak Date: Tue, 25 Jun 2019 16:31:58 +0100 Message-Id: <20190625153217.24301-10-jasvinder.singh@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190625153217.24301-1-jasvinder.singh@intel.com> References: <20190528120553.2992-2-lukaszx.krakowiak@intel.com> <20190625153217.24301-1-jasvinder.singh@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 09/28] sched: update pkt read and write API 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" Update run time packet read and write api implementation 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 | 32 +++++++++++++++++--------------- lib/librte_sched/rte_sched.h | 8 ++++---- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index 1999bbfa3..cd82fd918 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -1433,17 +1433,15 @@ rte_sched_port_pipe_profile_add(struct rte_sched_port *port, static inline uint32_t rte_sched_port_qindex(struct rte_sched_port *port, + struct rte_sched_subport *s, uint32_t subport, uint32_t pipe, - uint32_t traffic_class, uint32_t queue) { return ((subport & (port->n_subports_per_port - 1)) << - (port->n_pipes_per_subport_log2 + 4)) | - ((pipe & (port->n_pipes_per_subport - 1)) << 4) | - ((traffic_class & - (RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE - 1)) << 2) | - (queue & (RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS - 1)); + (port->max_subport_pipes_log2 + 4)) | + ((pipe & (s->n_subport_pipes - 1)) << 4) | + (queue & (RTE_SCHED_QUEUES_PER_PIPE - 1)); } void @@ -1453,9 +1451,9 @@ rte_sched_port_pkt_write(struct rte_sched_port *port, uint32_t traffic_class, uint32_t queue, enum rte_color color) { - uint32_t queue_id = rte_sched_port_qindex(port, subport, pipe, - traffic_class, queue); - rte_mbuf_sched_set(pkt, queue_id, traffic_class, (uint8_t)color); + struct rte_sched_subport *s = port->subports[subport]; + uint32_t qindex = rte_sched_port_qindex(port, s, subport, pipe, queue); + rte_mbuf_sched_set(pkt, qindex, traffic_class, (uint8_t)color); } void @@ -1464,13 +1462,17 @@ rte_sched_port_pkt_read_tree_path(struct rte_sched_port *port, uint32_t *subport, uint32_t *pipe, uint32_t *traffic_class, uint32_t *queue) { - uint32_t queue_id = rte_mbuf_sched_queue_get(pkt); + struct rte_sched_subport *s; + uint32_t qindex = rte_mbuf_sched_queue_get(pkt); + uint32_t tc_id = rte_mbuf_sched_traffic_class_get(pkt); + + *subport = (qindex >> (port->max_subport_pipes_log2 + 4)) & + (port->n_subports_per_port - 1); - *subport = queue_id >> (port->n_pipes_per_subport_log2 + 4); - *pipe = (queue_id >> 4) & (port->n_pipes_per_subport - 1); - *traffic_class = (queue_id >> 2) & - (RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE - 1); - *queue = queue_id & (RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS - 1); + s = port->subports[*subport]; + *pipe = (qindex >> 4) & (s->n_subport_pipes - 1); + *traffic_class = tc_id; + *queue = qindex & (RTE_SCHED_QUEUES_PER_PIPE - 1); } enum rte_color diff --git a/lib/librte_sched/rte_sched.h b/lib/librte_sched/rte_sched.h index 121e1f669..6a6ea84aa 100644 --- a/lib/librte_sched/rte_sched.h +++ b/lib/librte_sched/rte_sched.h @@ -421,9 +421,9 @@ rte_sched_queue_read_stats(struct rte_sched_port *port, * @param pipe * Pipe ID within subport * @param traffic_class - * Traffic class ID within pipe (0 .. 3) + * Traffic class ID within pipe (0 .. 8) * @param queue - * Queue ID within pipe traffic class (0 .. 3) + * Queue ID within pipe traffic class (0 .. 15) * @param color * Packet color set */ @@ -448,9 +448,9 @@ rte_sched_port_pkt_write(struct rte_sched_port *port, * @param pipe * Pipe ID within subport * @param traffic_class - * Traffic class ID within pipe (0 .. 3) + * Traffic class ID within pipe (0 .. 8) * @param queue - * Queue ID within pipe traffic class (0 .. 3) + * Queue ID within pipe traffic class (0 .. 15) * */ void -- 2.21.0