Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/88542/?format=api
http://patches.dpdk.org/api/patches/88542/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210305133918.8005-16-ndabilpuram@marvell.com/", "project": { "id": 1, "url": "http://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": "<20210305133918.8005-16-ndabilpuram@marvell.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20210305133918.8005-16-ndabilpuram@marvell.com", "date": "2021-03-05T13:38:41", "name": "[15/52] common/cnxk: add npa batch alloc/free support", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "67bb0c7a220b2846c501a9d7d04ce5e333941d1c", "submitter": { "id": 1202, "url": "http://patches.dpdk.org/api/people/1202/?format=api", "name": "Nithin Dabilpuram", "email": "ndabilpuram@marvell.com" }, "delegate": { "id": 310, "url": "http://patches.dpdk.org/api/users/310/?format=api", "username": "jerin", "first_name": "Jerin", "last_name": "Jacob", "email": "jerinj@marvell.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20210305133918.8005-16-ndabilpuram@marvell.com/mbox/", "series": [ { "id": 15508, "url": "http://patches.dpdk.org/api/series/15508/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=15508", "date": "2021-03-05T13:38:26", "name": "Add Marvell CNXK common driver", "version": 1, "mbox": "http://patches.dpdk.org/series/15508/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/88542/comments/", "check": "warning", "checks": "http://patches.dpdk.org/api/patches/88542/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 813E5A0547;\n\tFri, 5 Mar 2021 14:42:24 +0100 (CET)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 684C822A393;\n\tFri, 5 Mar 2021 14:40:18 +0100 (CET)", "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n [67.231.156.173])\n by mails.dpdk.org (Postfix) with ESMTP id E12D322A360\n for <dev@dpdk.org>; Fri, 5 Mar 2021 14:40:16 +0100 (CET)", "from pps.filterd (m0045851.ppops.net [127.0.0.1])\n by mx0b-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id\n 125Ddk1H008288 for <dev@dpdk.org>; Fri, 5 Mar 2021 05:40:16 -0800", "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0b-0016f401.pphosted.com with ESMTP id 370p7p0dcc-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Fri, 05 Mar 2021 05:40:16 -0800", "from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.2;\n Fri, 5 Mar 2021 05:40:14 -0800", "from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend\n Transport; Fri, 5 Mar 2021 05:40:14 -0800", "from hyd1588t430.marvell.com (unknown [10.29.52.204])\n by maili.marvell.com (Postfix) with ESMTP id BC5DD3F7041;\n Fri, 5 Mar 2021 05:40:11 -0800 (PST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n h=from : to : cc :\n subject : date : message-id : in-reply-to : references : mime-version :\n content-type; s=pfpt0220; bh=8V0ZQ0ARTH5Y7lMHryvxtMn6vDhT2bOss3iptO2rmWU=;\n b=Ukb8ZfJiKXcjRrWJKgHiO38HCK5FI/Yrx102R/nXspwNTFF8dlSBnqpJ6wF9cDRSuL/V\n jY2hbX2RAO3NxOjmGXFTOQ2frPyq5nUVdbRwEgXEqaMBBBNi/9R5f2wxkqTxn8Ny6t/y\n Q9q9qfxveR8n6XWWaPzKe7ofj3LEH2wnXrlYSjXUb7ZXVk/S3RdraWAXFCVop+/+y0UT\n fCVSKt0tYucGnnJbuYjIHoBXPRMWmTEt6ACp+pTYPHLFdYhJ1GKUCmd8EbK1iUav8h+r\n TM6rB3sInLUsbpXtbMjDZ76JzOSv01SnSkLKUJ4oZPpHn0x6vScvz9n0p0Ria2f9mPSO RA==", "From": "Nithin Dabilpuram <ndabilpuram@marvell.com>", "To": "<dev@dpdk.org>", "CC": "<jerinj@marvell.com>, <skori@marvell.com>, <skoteshwar@marvell.com>,\n <pbhagavatula@marvell.com>, <kirankumark@marvell.com>,\n <psatheesh@marvell.com>, <asekhar@marvell.com>", "Date": "Fri, 5 Mar 2021 19:08:41 +0530", "Message-ID": "<20210305133918.8005-16-ndabilpuram@marvell.com>", "X-Mailer": "git-send-email 2.8.4", "In-Reply-To": "<20210305133918.8005-1-ndabilpuram@marvell.com>", "References": "<20210305133918.8005-1-ndabilpuram@marvell.com>", "MIME-Version": "1.0", "Content-Type": "text/plain", "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761\n definitions=2021-03-05_08:2021-03-03,\n 2021-03-05 signatures=0", "Subject": "[dpdk-dev] [PATCH 15/52] common/cnxk: add npa batch alloc/free\n support", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "From: Ashwin Sekhar T K <asekhar@marvell.com>\n\nAdd APIs to do allocations/frees in batch from\nNPA pool.\n\nSigned-off-by: Ashwin Sekhar T K <asekhar@marvell.com>\n---\n drivers/common/cnxk/roc_npa.h | 217 ++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 217 insertions(+)", "diff": "diff --git a/drivers/common/cnxk/roc_npa.h b/drivers/common/cnxk/roc_npa.h\nindex a7815e5..ab0b135 100644\n--- a/drivers/common/cnxk/roc_npa.h\n+++ b/drivers/common/cnxk/roc_npa.h\n@@ -8,6 +8,9 @@\n #define ROC_AURA_ID_MASK (BIT_ULL(16) - 1)\n #define ROC_AURA_OP_LIMIT_MASK (BIT_ULL(36) - 1)\n \n+#define ROC_CN10K_NPA_BATCH_ALLOC_MAX_PTRS 512\n+#define ROC_CN10K_NPA_BATCH_FREE_MAX_PTRS 15\n+\n /* 16 CASP instructions can be outstanding in CN9k, but we use only 15\n * outstanding CASPs as we run out of registers.\n */\n@@ -180,6 +183,114 @@ roc_npa_pool_op_performance_counter(uint64_t aura_handle, const int drop)\n \t\treturn reg & 0xFFFFFFFFFFFF;\n }\n \n+static inline int\n+roc_npa_aura_batch_alloc_issue(uint64_t aura_handle, uint64_t *buf,\n+\t\t\t unsigned int num, const int dis_wait,\n+\t\t\t const int drop)\n+{\n+\tunsigned int i;\n+\tint64_t *addr;\n+\tuint64_t res;\n+\tunion {\n+\t\tuint64_t u;\n+\t\tstruct npa_batch_alloc_compare_s compare_s;\n+\t} cmp;\n+\n+\tif (num > ROC_CN10K_NPA_BATCH_ALLOC_MAX_PTRS)\n+\t\treturn -1;\n+\n+\t/* Zero first word of every cache line */\n+\tfor (i = 0; i < num; i += (ROC_ALIGN / sizeof(uint64_t)))\n+\t\tbuf[i] = 0;\n+\n+\taddr = (int64_t *)(roc_npa_aura_handle_to_base(aura_handle) +\n+\t\t\t NPA_LF_AURA_BATCH_ALLOC);\n+\tcmp.u = 0;\n+\tcmp.compare_s.aura = roc_npa_aura_handle_to_aura(aura_handle);\n+\tcmp.compare_s.drop = drop;\n+\tcmp.compare_s.stype = ALLOC_STYPE_STSTP;\n+\tcmp.compare_s.dis_wait = dis_wait;\n+\tcmp.compare_s.count = num;\n+\n+\tres = roc_atomic64_cas(cmp.u, (uint64_t)buf, addr);\n+\tif (res != ALLOC_RESULT_ACCEPTED && res != ALLOC_RESULT_NOCORE)\n+\t\treturn -1;\n+\n+\treturn 0;\n+}\n+\n+static inline unsigned int\n+roc_npa_aura_batch_alloc_count(uint64_t *aligned_buf, unsigned int num)\n+{\n+\tunsigned int count, i;\n+\n+\tif (num > ROC_CN10K_NPA_BATCH_ALLOC_MAX_PTRS)\n+\t\treturn 0;\n+\n+\tcount = 0;\n+\t/* Check each ROC cache line one by one */\n+\tfor (i = 0; i < num; i += (ROC_ALIGN >> 3)) {\n+\t\tstruct npa_batch_alloc_status_s *status;\n+\t\tint ccode;\n+\n+\t\tstatus = (struct npa_batch_alloc_status_s *)&aligned_buf[i];\n+\n+\t\t/* Status is updated in first 7 bits of each 128 byte cache\n+\t\t * line. Wait until the status gets updated.\n+\t\t */\n+\t\tdo {\n+\t\t\tccode = (volatile int)status->ccode;\n+\t\t} while (ccode == ALLOC_CCODE_INVAL);\n+\n+\t\tcount += status->count;\n+\t}\n+\n+\treturn count;\n+}\n+\n+static inline unsigned int\n+roc_npa_aura_batch_alloc_extract(uint64_t *buf, uint64_t *aligned_buf,\n+\t\t\t\t unsigned int num)\n+{\n+\tunsigned int count, i;\n+\n+\tif (num > ROC_CN10K_NPA_BATCH_ALLOC_MAX_PTRS)\n+\t\treturn 0;\n+\n+\tcount = 0;\n+\t/* Check each ROC cache line one by one */\n+\tfor (i = 0; i < num; i += (ROC_ALIGN >> 3)) {\n+\t\tstruct npa_batch_alloc_status_s *status;\n+\t\tint line_count, ccode;\n+\n+\t\tstatus = (struct npa_batch_alloc_status_s *)&aligned_buf[i];\n+\n+\t\t/* Status is updated in first 7 bits of each 128 byte cache\n+\t\t * line. Wait until the status gets updated.\n+\t\t */\n+\t\tdo {\n+\t\t\tccode = (volatile int)status->ccode;\n+\t\t} while (ccode == ALLOC_CCODE_INVAL);\n+\n+\t\tline_count = status->count;\n+\n+\t\t/* Clear the status from the cache line */\n+\t\tstatus->ccode = 0;\n+\t\tstatus->count = 0;\n+\n+\t\t/* 'Compress' the allocated buffers as there can\n+\t\t * be 'holes' at the end of the 128 byte cache\n+\t\t * lines.\n+\t\t */\n+\t\tmemmove(&buf[count], &aligned_buf[i],\n+\t\t\tline_count * sizeof(uint64_t));\n+\n+\t\tcount += line_count;\n+\t}\n+\n+\treturn count;\n+}\n+\n static inline void\n roc_npa_aura_op_bulk_free(uint64_t aura_handle, uint64_t const *buf,\n \t\t\t unsigned int num, const int fabs)\n@@ -194,6 +305,112 @@ roc_npa_aura_op_bulk_free(uint64_t aura_handle, uint64_t const *buf,\n }\n \n static inline unsigned int\n+roc_npa_aura_op_batch_alloc(uint64_t aura_handle, uint64_t *buf,\n+\t\t\t uint64_t *aligned_buf, unsigned int num,\n+\t\t\t const int dis_wait, const int drop,\n+\t\t\t const int partial)\n+{\n+\tunsigned int count, chunk, num_alloc;\n+\n+\t/* The buffer should be 128 byte cache line aligned */\n+\tif (((uint64_t)aligned_buf & (ROC_ALIGN - 1)) != 0)\n+\t\treturn 0;\n+\n+\tcount = 0;\n+\twhile (num) {\n+\t\tchunk = (num > ROC_CN10K_NPA_BATCH_ALLOC_MAX_PTRS) ?\n+\t\t\t\t ROC_CN10K_NPA_BATCH_ALLOC_MAX_PTRS :\n+\t\t\t\t num;\n+\n+\t\tif (roc_npa_aura_batch_alloc_issue(aura_handle, aligned_buf,\n+\t\t\t\t\t\t chunk, dis_wait, drop))\n+\t\t\tbreak;\n+\n+\t\tnum_alloc = roc_npa_aura_batch_alloc_extract(buf, aligned_buf,\n+\t\t\t\t\t\t\t chunk);\n+\n+\t\tcount += num_alloc;\n+\t\tbuf += num_alloc;\n+\t\tnum -= num_alloc;\n+\n+\t\tif (num_alloc != chunk)\n+\t\t\tbreak;\n+\t}\n+\n+\t/* If the requested number of pointers was not allocated and if partial\n+\t * alloc is not desired, then free allocated pointers.\n+\t */\n+\tif (unlikely(num != 0 && !partial)) {\n+\t\troc_npa_aura_op_bulk_free(aura_handle, buf - count, count, 1);\n+\t\tcount = 0;\n+\t}\n+\n+\treturn count;\n+}\n+\n+static inline void\n+roc_npa_aura_batch_free(uint64_t aura_handle, uint64_t const *buf,\n+\t\t\tunsigned int num, const int fabs, uint64_t lmt_addr,\n+\t\t\tuint64_t lmt_id)\n+{\n+\tuint64_t addr, tar_addr, free0;\n+\tvolatile uint64_t *lmt_data;\n+\tunsigned int i;\n+\n+\tif (num > ROC_CN10K_NPA_BATCH_FREE_MAX_PTRS)\n+\t\treturn;\n+\n+\tlmt_data = (uint64_t *)lmt_addr;\n+\n+\taddr = roc_npa_aura_handle_to_base(aura_handle) +\n+\t NPA_LF_AURA_BATCH_FREE0;\n+\n+\t/*\n+\t * NPA_LF_AURA_BATCH_FREE0\n+\t *\n+\t * 63 63 62 33 32 32 31 20 19 0\n+\t * -----------------------------------------\n+\t * | FABS | Rsvd | COUNT_EOT | Rsvd | AURA |\n+\t * -----------------------------------------\n+\t */\n+\tfree0 = roc_npa_aura_handle_to_aura(aura_handle);\n+\tif (fabs)\n+\t\tfree0 |= (0x1UL << 63);\n+\tif (num & 0x1)\n+\t\tfree0 |= (0x1UL << 32);\n+\n+\t/* tar_addr[4:6] is LMTST size-1 in units of 128b */\n+\ttar_addr = addr | ((num >> 1) << 4);\n+\n+\tlmt_data[0] = free0;\n+\tfor (i = 0; i < num; i++)\n+\t\tlmt_data[i + 1] = buf[i];\n+\n+\troc_lmt_submit_steorl(lmt_id, tar_addr);\n+\tplt_io_wmb();\n+}\n+\n+static inline void\n+roc_npa_aura_op_batch_free(uint64_t aura_handle, uint64_t const *buf,\n+\t\t\t unsigned int num, const int fabs, uint64_t lmt_addr,\n+\t\t\t uint64_t lmt_id)\n+{\n+\tunsigned int chunk;\n+\n+\twhile (num) {\n+\t\tchunk = (num >= ROC_CN10K_NPA_BATCH_FREE_MAX_PTRS) ?\n+\t\t\t\t ROC_CN10K_NPA_BATCH_FREE_MAX_PTRS :\n+\t\t\t\t num;\n+\n+\t\troc_npa_aura_batch_free(aura_handle, buf, chunk, fabs, lmt_addr,\n+\t\t\t\t\tlmt_id);\n+\n+\t\tbuf += chunk;\n+\t\tnum -= chunk;\n+\t}\n+}\n+\n+static inline unsigned int\n roc_npa_aura_bulk_alloc(uint64_t aura_handle, uint64_t *buf, unsigned int num,\n \t\t\tconst int drop)\n {\n", "prefixes": [ "15/52" ] }{ "id": 88542, "url": "