From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87DACC04AB6 for ; Tue, 28 May 2019 12:16:18 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id EAAEF208CB for ; Tue, 28 May 2019 12:16:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EAAEF208CB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 755B01BAA0; Tue, 28 May 2019 14:09:01 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 807EF1B9BE for ; Tue, 28 May 2019 14:08:52 +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:52 -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:50 -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:52 +0200 Message-Id: <20190528120553.2992-27-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 26/27] examples/ip_pipeline: update ip pipeline sample app 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 ip pipeline sample app 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 --- examples/ip_pipeline/cli.c | 85 +++++++++++++------------- examples/ip_pipeline/tmgr.c | 21 +++---- examples/ip_pipeline/tmgr.h | 3 - lib/librte_pipeline/rte_table_action.c | 1 - lib/librte_pipeline/rte_table_action.h | 4 +- 5 files changed, 53 insertions(+), 61 deletions(-) diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c index bcf62fbf5..2f0ee2ec1 100644 --- a/examples/ip_pipeline/cli.c +++ b/examples/ip_pipeline/cli.c @@ -377,8 +377,11 @@ cmd_swq(char **tokens, static const char cmd_tmgr_subport_profile_help[] = "tmgr subport profile\n" " \n" -" \n" -" \n"; +" " +" \n" +" \n" +" pps \n" +" qsize "; static void cmd_tmgr_subport_profile(char **tokens, @@ -389,7 +392,7 @@ cmd_tmgr_subport_profile(char **tokens, struct rte_sched_subport_params p; int status, i; - if (n_tokens != 10) { + if (n_tokens != 34) { snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); return; } @@ -410,11 +413,32 @@ cmd_tmgr_subport_profile(char **tokens, return; } - if (parser_read_uint32(&p.tc_period, tokens[9]) != 0) { + if (parser_read_uint32(&p.tc_period, tokens[14]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "tc_period"); return; } + if (strcmp(tokens[15], "pps") != 0) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "pps"); + return; + } + + if (parser_read_uint32(&p.n_subport_pipes, tokens[16]) != 0) { + snprintf(out, out_size, MSG_ARG_INVALID, "n_subport_pipes"); + return; + } + + if (strcmp(tokens[17], "qsize") != 0) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "qsize"); + return; + } + + for (i = 0; i < RTE_SCHED_QUEUES_PER_PIPE; i++) + if (parser_read_uint16(&p.qsize[i], tokens[18 + i]) != 0) { + snprintf(out, out_size, MSG_ARG_INVALID, "qsize"); + return; + } + status = tmgr_subport_profile_add(&p); if (status != 0) { snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]); @@ -425,10 +449,11 @@ cmd_tmgr_subport_profile(char **tokens, static const char cmd_tmgr_pipe_profile_help[] = "tmgr pipe profile\n" " \n" -" \n" +" " +" \n" " \n" " \n" -" \n"; +" \n"; static void cmd_tmgr_pipe_profile(char **tokens, @@ -439,7 +464,7 @@ cmd_tmgr_pipe_profile(char **tokens, struct rte_sched_pipe_params p; int status, i; - if (n_tokens != 27) { + if (n_tokens != 24) { snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); return; } @@ -460,20 +485,20 @@ cmd_tmgr_pipe_profile(char **tokens, return; } - if (parser_read_uint32(&p.tc_period, tokens[9]) != 0) { + if (parser_read_uint32(&p.tc_period, tokens[14]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "tc_period"); return; } #ifdef RTE_SCHED_SUBPORT_TC_OV - if (parser_read_uint8(&p.tc_ov_weight, tokens[10]) != 0) { + if (parser_read_uint8(&p.tc_ov_weight, tokens[15]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "tc_ov_weight"); return; } #endif - for (i = 0; i < RTE_SCHED_QUEUES_PER_PIPE; i++) - if (parser_read_uint8(&p.wrr_weights[i], tokens[11 + i]) != 0) { + for (i = 0; i < RTE_SCHED_WRR_QUEUES_PER_PIPE; i++) + if (parser_read_uint8(&p.wrr_weights[i], tokens[16 + i]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "wrr_weights"); return; } @@ -489,8 +514,6 @@ static const char cmd_tmgr_help[] = "tmgr \n" " rate \n" " spp \n" -" pps \n" -" qsize \n" " fo \n" " mtu \n" " cpu \n"; @@ -504,9 +527,8 @@ cmd_tmgr(char **tokens, struct tmgr_port_params p; char *name; struct tmgr_port *tmgr_port; - int i; - if (n_tokens != 19) { + if (n_tokens != 12) { snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); return; } @@ -533,53 +555,32 @@ cmd_tmgr(char **tokens, return; } - if (strcmp(tokens[6], "pps") != 0) { - snprintf(out, out_size, MSG_ARG_NOT_FOUND, "pps"); - return; - } - - if (parser_read_uint32(&p.n_pipes_per_subport, tokens[7]) != 0) { - snprintf(out, out_size, MSG_ARG_INVALID, "n_pipes_per_subport"); - return; - } - - if (strcmp(tokens[8], "qsize") != 0) { - snprintf(out, out_size, MSG_ARG_NOT_FOUND, "qsize"); - return; - } - - for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) - if (parser_read_uint16(&p.qsize[i], tokens[9 + i]) != 0) { - snprintf(out, out_size, MSG_ARG_INVALID, "qsize"); - return; - } - - if (strcmp(tokens[13], "fo") != 0) { + if (strcmp(tokens[6], "fo") != 0) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, "fo"); return; } - if (parser_read_uint32(&p.frame_overhead, tokens[14]) != 0) { + if (parser_read_uint32(&p.frame_overhead, tokens[7]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "frame_overhead"); return; } - if (strcmp(tokens[15], "mtu") != 0) { + if (strcmp(tokens[8], "mtu") != 0) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, "mtu"); return; } - if (parser_read_uint32(&p.mtu, tokens[16]) != 0) { + if (parser_read_uint32(&p.mtu, tokens[9]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "mtu"); return; } - if (strcmp(tokens[17], "cpu") != 0) { + if (strcmp(tokens[10], "cpu") != 0) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, "cpu"); return; } - if (parser_read_uint32(&p.cpu_id, tokens[18]) != 0) { + if (parser_read_uint32(&p.cpu_id, tokens[11]) != 0) { snprintf(out, out_size, MSG_ARG_INVALID, "cpu_id"); return; } diff --git a/examples/ip_pipeline/tmgr.c b/examples/ip_pipeline/tmgr.c index 40cbf1d0a..538364580 100644 --- a/examples/ip_pipeline/tmgr.c +++ b/examples/ip_pipeline/tmgr.c @@ -47,7 +47,8 @@ int tmgr_subport_profile_add(struct rte_sched_subport_params *p) { /* Check input params */ - if (p == NULL) + if (p == NULL || + p->n_subport_pipes == 0) return -1; /* Save profile */ @@ -90,7 +91,6 @@ tmgr_port_create(const char *name, struct tmgr_port_params *params) tmgr_port_find(name) || (params == NULL) || (params->n_subports_per_port == 0) || - (params->n_pipes_per_subport == 0) || (params->cpu_id >= RTE_MAX_NUMA_NODES) || (n_subport_profiles == 0) || (n_pipe_profiles == 0)) @@ -103,18 +103,14 @@ tmgr_port_create(const char *name, struct tmgr_port_params *params) p.mtu = params->mtu; p.frame_overhead = params->frame_overhead; p.n_subports_per_port = params->n_subports_per_port; - p.n_pipes_per_subport = params->n_pipes_per_subport; - - for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) - p.qsize[i] = params->qsize[i]; - - p.pipe_profiles = pipe_profile; - p.n_pipe_profiles = n_pipe_profiles; s = rte_sched_port_config(&p); if (s == NULL) return NULL; + subport_profile[0].pipe_profiles = pipe_profile; + subport_profile[0].n_pipe_profiles = n_pipe_profiles; + for (i = 0; i < params->n_subports_per_port; i++) { int status; @@ -128,7 +124,7 @@ tmgr_port_create(const char *name, struct tmgr_port_params *params) return NULL; } - for (j = 0; j < params->n_pipes_per_subport; j++) { + for (j = 0; j < subport_profile[0].n_subport_pipes; j++) { status = rte_sched_pipe_config( s, i, @@ -153,7 +149,6 @@ tmgr_port_create(const char *name, struct tmgr_port_params *params) strlcpy(tmgr_port->name, name, sizeof(tmgr_port->name)); tmgr_port->s = s; tmgr_port->n_subports_per_port = params->n_subports_per_port; - tmgr_port->n_pipes_per_subport = params->n_pipes_per_subport; /* Node add to list */ TAILQ_INSERT_TAIL(&tmgr_port_list, tmgr_port, node); @@ -205,8 +200,8 @@ tmgr_pipe_config(const char *port_name, port = tmgr_port_find(port_name); if ((port == NULL) || (subport_id >= port->n_subports_per_port) || - (pipe_id_first >= port->n_pipes_per_subport) || - (pipe_id_last >= port->n_pipes_per_subport) || + (pipe_id_first >= subport_profile[0].n_subport_pipes) || + (pipe_id_last >= subport_profile[0].n_subport_pipes) || (pipe_id_first > pipe_id_last) || (pipe_profile_id >= n_pipe_profiles)) return -1; diff --git a/examples/ip_pipeline/tmgr.h b/examples/ip_pipeline/tmgr.h index 0b497e795..3a958492c 100644 --- a/examples/ip_pipeline/tmgr.h +++ b/examples/ip_pipeline/tmgr.h @@ -25,7 +25,6 @@ struct tmgr_port { char name[NAME_SIZE]; struct rte_sched_port *s; uint32_t n_subports_per_port; - uint32_t n_pipes_per_subport; }; TAILQ_HEAD(tmgr_port_list, tmgr_port); @@ -39,8 +38,6 @@ tmgr_port_find(const char *name); struct tmgr_port_params { uint32_t rate; uint32_t n_subports_per_port; - uint32_t n_pipes_per_subport; - uint16_t qsize[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]; uint32_t frame_overhead; uint32_t mtu; uint32_t cpu_id; diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index 9a65f3ded..c097ea681 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -401,7 +401,6 @@ pkt_work_tm(struct rte_mbuf *mbuf, { struct dscp_table_entry_data *dscp_entry = &dscp_table->entry[dscp]; uint32_t queue_id = data->queue_id | - (dscp_entry->tc << 2) | dscp_entry->tc_queue; rte_mbuf_sched_set(mbuf, queue_id, dscp_entry->tc, (uint8_t)dscp_entry->color); diff --git a/lib/librte_pipeline/rte_table_action.h b/lib/librte_pipeline/rte_table_action.h index cf6eeaa30..009e911cb 100644 --- a/lib/librte_pipeline/rte_table_action.h +++ b/lib/librte_pipeline/rte_table_action.h @@ -181,10 +181,10 @@ struct rte_table_action_lb_params { * RTE_TABLE_ACTION_MTR */ /** Max number of traffic classes (TCs). */ -#define RTE_TABLE_ACTION_TC_MAX 4 +#define RTE_TABLE_ACTION_TC_MAX 16 /** Max number of queues per traffic class. */ -#define RTE_TABLE_ACTION_TC_QUEUE_MAX 4 +#define RTE_TABLE_ACTION_TC_QUEUE_MAX 16 /** Differentiated Services Code Point (DSCP) translation table entry. */ struct rte_table_action_dscp_table_entry { -- 2.20.1