From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E86B74237C; Thu, 12 Jan 2023 00:44:23 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3127C42D2C; Thu, 12 Jan 2023 00:44:08 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id F0DB542D21 for ; Thu, 12 Jan 2023 00:44:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673480647; x=1705016647; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/FJpuDdFs3Msf3e3Tzpcl8LC06xZ9o6cjfxKebEolsM=; b=eTJTwQPZtDHmDG4acOxQo3gKURCTZMtKDX/Knb3EsSy1KA9rcrgoaoBH JMI2hiFDImHr8L3SzniYfHugOmXaWNLGa9c0l0WkVMwv9TGAnfhKywbUw 7mBGTEQdieP2ZPquCPxLZLBh9pD9Ln1a4eyc1k6N1pqFIj97YDdwIsRXa SzXxglm5N72CqaK4nSGp4rSdAlYgbVeSkhoP/XIoF8ieulURuDdRoTvYU hotUvXSOLGZMzzB15NNiqixPhBtXuI9w07ygF3zEUvDcmpvah0pxQpNYc hEkK014aG57i9G9u3GjtDxyNVyqVc7AJFfR1PTtp5iRGfjziQkpZO93gx A==; X-IronPort-AV: E=McAfee;i="6500,9779,10586"; a="307088376" X-IronPort-AV: E=Sophos;i="5.96,318,1665471600"; d="scan'208";a="307088376" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jan 2023 15:44:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10586"; a="688129103" X-IronPort-AV: E=Sophos;i="5.96,318,1665471600"; d="scan'208";a="688129103" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com) ([10.237.222.53]) by orsmga008.jf.intel.com with ESMTP; 11 Jan 2023 15:44:03 -0800 From: Cristian Dumitrescu To: dev@dpdk.org Cc: Kamalakannan R Subject: [PATCH V2 03/11] examples/pipeline: streamline ring support Date: Wed, 11 Jan 2023 23:43:50 +0000 Message-Id: <20230111234358.133395-4-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230111234358.133395-1-cristian.dumitrescu@intel.com> References: <20230111205608.87953-1-cristian.dumitrescu@intel.com> <20230111234358.133395-1-cristian.dumitrescu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Remove redundant ring related code. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R --- examples/pipeline/cli.c | 24 ++++++++++------ examples/pipeline/obj.c | 63 ----------------------------------------- examples/pipeline/obj.h | 21 -------------- 3 files changed, 15 insertions(+), 93 deletions(-) diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c index c014598cf1..471dfbad38 100644 --- a/examples/pipeline/cli.c +++ b/examples/pipeline/cli.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -491,11 +492,11 @@ cmd_ring(char **tokens, uint32_t n_tokens, char *out, size_t out_size, - void *obj) + void *obj __rte_unused) { - struct ring_params p; + struct rte_ring *r; char *name; - struct ring *ring; + uint32_t size, numa_node; if (n_tokens != 6) { snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); @@ -504,28 +505,32 @@ cmd_ring(char **tokens, name = tokens[1]; - if (strcmp(tokens[2], "size") != 0) { + if (strcmp(tokens[2], "size")) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, "size"); return; } - if (parser_read_uint32(&p.size, tokens[3]) != 0) { + if (parser_read_uint32(&size, tokens[3])) { snprintf(out, out_size, MSG_ARG_INVALID, "size"); return; } - if (strcmp(tokens[4], "numa") != 0) { + if (strcmp(tokens[4], "numa")) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, "numa"); return; } - if (parser_read_uint32(&p.numa_node, tokens[5]) != 0) { + if (parser_read_uint32(&numa_node, tokens[5])) { snprintf(out, out_size, MSG_ARG_INVALID, "numa_node"); return; } - ring = ring_create(obj, name, &p); - if (!ring) { + r = rte_ring_create( + name, + size, + (int)numa_node, + RING_F_SP_ENQ | RING_F_SC_DEQ); + if (!r) { snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]); return; } @@ -2998,6 +3003,7 @@ cmd_help(char **tokens, "List of commands:\n" "\tmempool\n" "\tethdev\n" + "\tring\n" "\tpipeline codegen\n" "\tpipeline libbuild\n" "\tpipeline build\n" diff --git a/examples/pipeline/obj.c b/examples/pipeline/obj.c index 4aaec02d9c..f1a50133f4 100644 --- a/examples/pipeline/obj.c +++ b/examples/pipeline/obj.c @@ -24,17 +24,11 @@ */ TAILQ_HEAD(link_list, link); -/* - * ring - */ -TAILQ_HEAD(ring_list, ring); - /* * obj */ struct obj { struct link_list link_list; - struct ring_list ring_list; }; /* @@ -283,62 +277,6 @@ link_next(struct obj *obj, struct link *link) TAILQ_FIRST(&obj->link_list) : TAILQ_NEXT(link, node); } -/* - * ring - */ -struct ring * -ring_create(struct obj *obj, const char *name, struct ring_params *params) -{ - struct ring *ring; - struct rte_ring *r; - unsigned int flags = RING_F_SP_ENQ | RING_F_SC_DEQ; - - /* Check input params */ - if (!name || ring_find(obj, name) || !params || !params->size) - return NULL; - - /** - * Resource create - */ - r = rte_ring_create( - name, - params->size, - params->numa_node, - flags); - if (!r) - return NULL; - - /* Node allocation */ - ring = calloc(1, sizeof(struct ring)); - if (!ring) { - rte_ring_free(r); - return NULL; - } - - /* Node fill in */ - strlcpy(ring->name, name, sizeof(ring->name)); - - /* Node add to list */ - TAILQ_INSERT_TAIL(&obj->ring_list, ring, node); - - return ring; -} - -struct ring * -ring_find(struct obj *obj, const char *name) -{ - struct ring *ring; - - if (!obj || !name) - return NULL; - - TAILQ_FOREACH(ring, &obj->ring_list, node) - if (strcmp(ring->name, name) == 0) - return ring; - - return NULL; -} - /* * obj */ @@ -352,7 +290,6 @@ obj_init(void) return NULL; TAILQ_INIT(&obj->link_list); - TAILQ_INIT(&obj->ring_list); return obj; } diff --git a/examples/pipeline/obj.h b/examples/pipeline/obj.h index 4ea610ceed..dbbc6d39a0 100644 --- a/examples/pipeline/obj.h +++ b/examples/pipeline/obj.h @@ -73,25 +73,4 @@ link_find(struct obj *obj, const char *name); struct link * link_next(struct obj *obj, struct link *link); -/* - * ring - */ -struct ring_params { - uint32_t size; - uint32_t numa_node; -}; - -struct ring { - TAILQ_ENTRY(ring) node; - char name[NAME_SIZE]; -}; - -struct ring * -ring_create(struct obj *obj, - const char *name, - struct ring_params *params); - -struct ring * -ring_find(struct obj *obj, const char *name); - #endif /* _INCLUDE_OBJ_H_ */ -- 2.34.1