Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/7789/?format=api
https://patches.dpdk.org/api/patches/7789/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1445372497-817-1-git-send-email-yrobot@amazon.com/", "project": { "id": 1, "url": "https://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<1445372497-817-1-git-send-email-yrobot@amazon.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1445372497-817-1-git-send-email-yrobot@amazon.com", "date": "2015-10-20T20:21:37", "name": "[dpdk-dev] lib: rte_*_create gives NULL/EEXIST on duped name", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": true, "hash": "2562ffa0e124712ca4f6c6dbde008e655cb7f48e", "submitter": { "id": 328, "url": "https://patches.dpdk.org/api/people/328/?format=api", "name": "Yoni Fogel", "email": "yrobot@amazon.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1445372497-817-1-git-send-email-yrobot@amazon.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/7789/comments/", "check": "pending", "checks": "https://patches.dpdk.org/api/patches/7789/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 1FE4A8E94;\n\tTue, 20 Oct 2015 22:45:09 +0200 (CEST)", "from smtp-fw-9101.amazon.com (smtp-fw-9101.amazon.com\n\t[207.171.184.25]) by dpdk.org (Postfix) with ESMTP id 89D778E93\n\tfor <dev@dpdk.org>; Tue, 20 Oct 2015 22:45:07 +0200 (CEST)", "from sea3-co-svc-lb3-vlan2.amazon.com (HELO\n\temail-inbound-relay-60009.pdx1.amazon.com) ([172.18.12.82])\n\tby smtp-border-fw-out-9101.sea19.amazon.com with\n\tESMTP/TLS/DHE-RSA-AES256-SHA; 20 Oct 2015 20:21:52 +0000", "from ex10-hub-7002.ant.amazon.com\n\t(pdx1-ws-svc-lb16-vlan2.amazon.com [10.239.138.210])\n\tby email-inbound-relay-60009.pdx1.amazon.com (8.14.7/8.14.7) with\n\tESMTP id t9KKLoVD010333\n\t(version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL)\n\tfor <dev@dpdk.org>; Tue, 20 Oct 2015 20:21:52 GMT", "from EX13D11UWB003.ant.amazon.com (10.43.161.206) by\n\tex10-hub-7002.ant.amazon.com (10.43.110.153) with Microsoft SMTP\n\tServer (TLS) id 14.3.181.6; Tue, 20 Oct 2015 13:21:42 -0700", "from uf8bc12800b5c53f661e4.amazon.com (10.43.162.161) by\n\tEX13D11UWB003.ant.amazon.com (10.43.161.206) with Microsoft SMTP\n\tServer (TLS) id 15.0.1076.9; Tue, 20 Oct 2015 20:21:40 +0000" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209;\n\tt=1445373907; x=1476909907;\n\th=from:to:subject:date:message-id:mime-version;\n\tbh=rmVXYhTtT7OfzJR34Qivs5WyBSd/Jp2bA7syyA+pnIA=;\n\tb=gP6LdaECU1aCkqbKtfcFxfhnr1x/q772Sz34lCk8j6DDQtimZZDhzSHh\n\tAi9xRX2m4d2YJ+trA/Wh+ioGB9p4K4TjmBNJ+tmOCu8LKy5WBqL1KULo4\n\taullXwMGr6rtx5Uw+CeegVtHJ965WDxf9XxESKGg+7cf5uTd4mqdJgCWP 4=;", "X-IronPort-AV": "E=Sophos;i=\"5.17,708,1437436800\"; d=\"scan'208\";a=\"344372769\"", "From": "Yoni Fogel <yrobot@amazon.com>", "To": "<dev@dpdk.org>", "Date": "Tue, 20 Oct 2015 13:21:37 -0700", "Message-ID": "<1445372497-817-1-git-send-email-yrobot@amazon.com>", "X-Mailer": "git-send-email 2.6.2", "MIME-Version": "1.0", "Content-Type": "text/plain", "X-Originating-IP": "[10.43.162.161]", "X-ClientProxiedBy": "EX13D10UWB001.ant.amazon.com (10.43.161.111) To\n\tEX13D11UWB003.ant.amazon.com (10.43.161.206)", "Precedence": "Bulk", "Subject": "[dpdk-dev] [PATCH] lib: rte_*_create gives NULL/EEXIST on duped name", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "List-Id": "patches and discussions about DPDK <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Also fixed a bug in many of them where if the rte_malloc of\nthe TAILQ fails, then we return a pointer to some arbitrary\nexisting struct.\n\nSigned-off-by: Yoni Fogel <yrobot@amazon.com>\n---\n lib/librte_acl/rte_acl.c | 53 +++++++++++++++++++++------------------\n lib/librte_hash/rte_cuckoo_hash.c | 6 +++--\n lib/librte_hash/rte_fbk_hash.c | 5 +++-\n lib/librte_lpm/rte_lpm.c | 5 +++-\n lib/librte_lpm/rte_lpm6.c | 5 +++-\n 5 files changed, 44 insertions(+), 30 deletions(-)", "diff": "diff --git a/lib/librte_acl/rte_acl.c b/lib/librte_acl/rte_acl.c\nindex d60219f..f591556 100644\n--- a/lib/librte_acl/rte_acl.c\n+++ b/lib/librte_acl/rte_acl.c\n@@ -213,37 +213,40 @@ rte_acl_create(const struct rte_acl_param *param)\n \t\t\tbreak;\n \t}\n \n+\tctx = NULL;\n+\tif (te != NULL) {\n+\t\trte_errno = EEXIST;\n+\t\tgoto exit;\n+\t}\n+\n \t/* if ACL with such name doesn't exist, then create a new one. */\n-\tif (te == NULL) {\n-\t\tctx = NULL;\n-\t\tte = rte_zmalloc(\"ACL_TAILQ_ENTRY\", sizeof(*te), 0);\n+\tte = rte_zmalloc(\"ACL_TAILQ_ENTRY\", sizeof(*te), 0);\n \n-\t\tif (te == NULL) {\n-\t\t\tRTE_LOG(ERR, ACL, \"Cannot allocate tailq entry!\\n\");\n-\t\t\tgoto exit;\n-\t\t}\n+\tif (te == NULL) {\n+\t\tRTE_LOG(ERR, ACL, \"Cannot allocate tailq entry!\\n\");\n+\t\tgoto exit;\n+\t}\n \n-\t\tctx = rte_zmalloc_socket(name, sz, RTE_CACHE_LINE_SIZE, param->socket_id);\n+\tctx = rte_zmalloc_socket(name, sz, RTE_CACHE_LINE_SIZE, param->socket_id);\n \n-\t\tif (ctx == NULL) {\n-\t\t\tRTE_LOG(ERR, ACL,\n-\t\t\t\t\"allocation of %zu bytes on socket %d for %s failed\\n\",\n-\t\t\t\tsz, param->socket_id, name);\n-\t\t\trte_free(te);\n-\t\t\tgoto exit;\n-\t\t}\n-\t\t/* init new allocated context. */\n-\t\tctx->rules = ctx + 1;\n-\t\tctx->max_rules = param->max_rule_num;\n-\t\tctx->rule_sz = param->rule_size;\n-\t\tctx->socket_id = param->socket_id;\n-\t\tctx->alg = rte_acl_default_classify;\n-\t\tsnprintf(ctx->name, sizeof(ctx->name), \"%s\", param->name);\n+\tif (ctx == NULL) {\n+\t\tRTE_LOG(ERR, ACL,\n+\t\t\t\"allocation of %zu bytes on socket %d for %s failed\\n\",\n+\t\t\tsz, param->socket_id, name);\n+\t\trte_free(te);\n+\t\tgoto exit;\n+\t}\n+\t/* init new allocated context. */\n+\tctx->rules = ctx + 1;\n+\tctx->max_rules = param->max_rule_num;\n+\tctx->rule_sz = param->rule_size;\n+\tctx->socket_id = param->socket_id;\n+\tctx->alg = rte_acl_default_classify;\n+\tsnprintf(ctx->name, sizeof(ctx->name), \"%s\", param->name);\n \n-\t\tte->data = (void *) ctx;\n+\tte->data = (void *) ctx;\n \n-\t\tTAILQ_INSERT_TAIL(acl_list, te, next);\n-\t}\n+\tTAILQ_INSERT_TAIL(acl_list, te, next);\n \n exit:\n \trte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK);\ndiff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c\nindex 7019763..fe5a79e 100644\n--- a/lib/librte_hash/rte_cuckoo_hash.c\n+++ b/lib/librte_hash/rte_cuckoo_hash.c\n@@ -206,8 +206,10 @@ rte_hash_create(const struct rte_hash_parameters *params)\n \n \t/* Guarantee there's no existing */\n \th = rte_hash_find_existing(params->name);\n-\tif (h != NULL)\n-\t\treturn h;\n+\tif (h != NULL) {\n+\t\trte_errno = EEXIST;\n+\t\treturn NULL;\n+\t}\n \n \tte = rte_zmalloc(\"HASH_TAILQ_ENTRY\", sizeof(*te), 0);\n \tif (te == NULL) {\ndiff --git a/lib/librte_hash/rte_fbk_hash.c b/lib/librte_hash/rte_fbk_hash.c\nindex 8752a47..55c9f35 100644\n--- a/lib/librte_hash/rte_fbk_hash.c\n+++ b/lib/librte_hash/rte_fbk_hash.c\n@@ -140,8 +140,11 @@ rte_fbk_hash_create(const struct rte_fbk_hash_params *params)\n \t\tif (strncmp(params->name, ht->name, RTE_FBK_HASH_NAMESIZE) == 0)\n \t\t\tbreak;\n \t}\n-\tif (te != NULL)\n+\tht = NULL;\n+\tif (te != NULL) {\n+\t\trte_errno = EEXIST;\n \t\tgoto exit;\n+\t}\n \n \tte = rte_zmalloc(\"FBK_HASH_TAILQ_ENTRY\", sizeof(*te), 0);\n \tif (te == NULL) {\ndiff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c\nindex 163ba3c..ea3cd44 100644\n--- a/lib/librte_lpm/rte_lpm.c\n+++ b/lib/librte_lpm/rte_lpm.c\n@@ -181,8 +181,11 @@ rte_lpm_create(const char *name, int socket_id, int max_rules,\n \t\tif (strncmp(name, lpm->name, RTE_LPM_NAMESIZE) == 0)\n \t\t\tbreak;\n \t}\n-\tif (te != NULL)\n+\tlpm = NULL;\n+\tif (te != NULL) {\n+\t\trte_errno = EEXIST;\n \t\tgoto exit;\n+\t}\n \n \t/* allocate tailq entry */\n \tte = rte_zmalloc(\"LPM_TAILQ_ENTRY\", sizeof(*te), 0);\ndiff --git a/lib/librte_lpm/rte_lpm6.c b/lib/librte_lpm/rte_lpm6.c\nindex 6c2b293..ff0bd76 100644\n--- a/lib/librte_lpm/rte_lpm6.c\n+++ b/lib/librte_lpm/rte_lpm6.c\n@@ -182,8 +182,11 @@ rte_lpm6_create(const char *name, int socket_id,\n \t\tif (strncmp(name, lpm->name, RTE_LPM6_NAMESIZE) == 0)\n \t\t\tbreak;\n \t}\n-\tif (te != NULL)\n+\tlpm = NULL;\n+\tif (te != NULL) {\n+\t\trte_errno = EEXIST;\n \t\tgoto exit;\n+\t}\n \n \t/* allocate tailq entry */\n \tte = rte_zmalloc(\"LPM6_TAILQ_ENTRY\", sizeof(*te), 0);\n", "prefixes": [ "dpdk-dev" ] }{ "id": 7789, "url": "