get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/53980/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 53980,
    "url": "http://patches.dpdk.org/api/patches/53980/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190601014905.45531-10-jerinj@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": "<20190601014905.45531-10-jerinj@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190601014905.45531-10-jerinj@marvell.com",
    "date": "2019-06-01T01:48:47",
    "name": "[v2,09/27] common/octeontx2: handle intra device operations",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "4d239eadc70b47531246c1b8bb31fadbb38dfc98",
    "submitter": {
        "id": 1188,
        "url": "http://patches.dpdk.org/api/people/1188/?format=api",
        "name": "Jerin Jacob Kollanukkaran",
        "email": "jerinj@marvell.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20190601014905.45531-10-jerinj@marvell.com/mbox/",
    "series": [
        {
            "id": 4844,
            "url": "http://patches.dpdk.org/api/series/4844/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4844",
            "date": "2019-06-01T01:48:38",
            "name": "OCTEON TX2 common and mempool driver",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/4844/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/53980/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/53980/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id F29541B9B0;\n\tSat,  1 Jun 2019 03:49:43 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n\t[67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 5C0701B9AD\n\tfor <dev@dpdk.org>; Sat,  1 Jun 2019 03:49:42 +0200 (CEST)",
            "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n\tby mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id\n\tx511k4DS000968 for <dev@dpdk.org>; Fri, 31 May 2019 18:49:41 -0700",
            "from sc-exch02.marvell.com ([199.233.58.182])\n\tby mx0a-0016f401.pphosted.com with ESMTP id 2sufgn82wf-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n\tfor <dev@dpdk.org>; Fri, 31 May 2019 18:49:41 -0700",
            "from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH02.marvell.com\n\t(10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3;\n\tFri, 31 May 2019 18:49:40 -0700",
            "from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com\n\t(10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend\n\tTransport; Fri, 31 May 2019 18:49:40 -0700",
            "from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14])\n\tby maili.marvell.com (Postfix) with ESMTP id 6AE7B3F703F;\n\tFri, 31 May 2019 18:49:39 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n\th=from : to : cc :\n\tsubject : date : message-id : in-reply-to : references : mime-version\n\t: content-transfer-encoding : content-type; s=pfpt0818;\n\tbh=S/5yO3BDpsSHCCE7RclQej0y4NdgK4Q10gdLVeUwK1s=;\n\tb=hETTy0N6WdcG8bvym9T7IbVZteXmNOY4qlmXdoSTUTztTwbGZBIDkhh+OTAc3hvUK0h0\n\t15H/YFyT1r92THrkpzmxFurCgNkRaoSAUvcYy6o1PuQ7I2vnWzsPV1Yg1/YArAp8Ra0j\n\ttjtUUQ7UsAbB1GjaMtXQh91ETjTK/UKQzlW9unqatAZQTTOHHPMIulIweAfMveRzGdt9\n\tUhp1I5rNdmo7MhdjbvOdprbKlB2GGMJH7DoFGup2Oq/nVwCX5Tbbt+i6x7v1YvXALYge\n\t1hiuXq4iy3GyE0TuB2Cyxh6D/Hx4l9lXyzuYbbQstVCMxa5VJSo3crXq/MS5/xi/qbfA\n\t1Q== ",
        "From": "<jerinj@marvell.com>",
        "To": "<dev@dpdk.org>, Jerin Jacob <jerinj@marvell.com>, Nithin Dabilpuram\n\t<ndabilpuram@marvell.com>, Vamsi Attunuru <vattunuru@marvell.com>",
        "CC": "Pavan Nikhilesh <pbhagavatula@marvell.com>",
        "Date": "Sat, 1 Jun 2019 07:18:47 +0530",
        "Message-ID": "<20190601014905.45531-10-jerinj@marvell.com>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190601014905.45531-1-jerinj@marvell.com>",
        "References": "<20190523081339.56348-1-jerinj@marvell.com>\n\t<20190601014905.45531-1-jerinj@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10434:, ,\n\tdefinitions=2019-06-01_02:, , signatures=0",
        "Subject": "[dpdk-dev] [PATCH v2 09/27] common/octeontx2: handle intra device\n\toperations",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Jerin Jacob <jerinj@marvell.com>\n\nThe mempool device(NPA) may be provisioned as a standalone device or\nit can be part of ethdev/eventdev device. In order to address\nmempool as standalone or integrated with ethdev/eventdev device,\nAn intra device structure being introduced.\n\nWhen the _first_ ethdev/eventdev PCIe device or standalone mempool(NPA)\ndevices get probed by the eal PCI subsystem,\nThe NPA object(struct otx2_npa_lf) stored in otx2_dev base class.\nOnce it is accomplished, the other consumer drivers like\nethdev driver or eventdev driver use otx2_npa_* API to operate on\nshared NPA object.\n\nThe similar concept followed for SSO object, Which needs to share between\nPCIe devices.\n\nSigned-off-by: Jerin Jacob <jerinj@marvell.com>\nSigned-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>\nSigned-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>\n---\n drivers/common/octeontx2/otx2_common.c        | 163 ++++++++++++++++++\n drivers/common/octeontx2/otx2_common.h        |  32 +++-\n drivers/common/octeontx2/otx2_dev.c           |   6 +\n drivers/common/octeontx2/otx2_dev.h           |   1 +\n .../rte_common_octeontx2_version.map          |   9 +\n 5 files changed, 210 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/drivers/common/octeontx2/otx2_common.c b/drivers/common/octeontx2/otx2_common.c\nindex a4b91b4f1..7e4536639 100644\n--- a/drivers/common/octeontx2/otx2_common.c\n+++ b/drivers/common/octeontx2/otx2_common.c\n@@ -2,9 +2,172 @@\n  * Copyright(C) 2019 Marvell International Ltd.\n  */\n \n+#include <rte_atomic.h>\n+#include <rte_malloc.h>\n #include <rte_log.h>\n \n #include \"otx2_common.h\"\n+#include \"otx2_dev.h\"\n+#include \"otx2_mbox.h\"\n+\n+/**\n+ * @internal\n+ * Set default NPA configuration.\n+ */\n+void\n+otx2_npa_set_defaults(struct otx2_idev_cfg *idev)\n+{\n+\tidev->npa_pf_func = 0;\n+\trte_atomic16_set(&idev->npa_refcnt, 0);\n+}\n+\n+/**\n+ * @internal\n+ * Get intra device config structure.\n+ */\n+struct otx2_idev_cfg *\n+otx2_intra_dev_get_cfg(void)\n+{\n+\tconst char name[] = \"octeontx2_intra_device_conf\";\n+\tconst struct rte_memzone *mz;\n+\tstruct otx2_idev_cfg *idev;\n+\n+\tmz = rte_memzone_lookup(name);\n+\tif (mz != NULL)\n+\t\treturn mz->addr;\n+\n+\t/* Request for the first time */\n+\tmz = rte_memzone_reserve_aligned(name, sizeof(struct otx2_idev_cfg),\n+\t\t\t\t\t SOCKET_ID_ANY, 0, OTX2_ALIGN);\n+\tif (mz != NULL) {\n+\t\tidev = mz->addr;\n+\t\tidev->sso_pf_func = 0;\n+\t\tidev->npa_lf = NULL;\n+\t\totx2_npa_set_defaults(idev);\n+\t\treturn idev;\n+\t}\n+\treturn NULL;\n+}\n+\n+/**\n+ * @internal\n+ * Get SSO PF_FUNC.\n+ */\n+uint16_t\n+otx2_sso_pf_func_get(void)\n+{\n+\tstruct otx2_idev_cfg *idev;\n+\tuint16_t sso_pf_func;\n+\n+\tsso_pf_func = 0;\n+\tidev = otx2_intra_dev_get_cfg();\n+\n+\tif (idev != NULL)\n+\t\tsso_pf_func = idev->sso_pf_func;\n+\n+\treturn sso_pf_func;\n+}\n+\n+/**\n+ * @internal\n+ * Set SSO PF_FUNC.\n+ */\n+void\n+otx2_sso_pf_func_set(uint16_t sso_pf_func)\n+{\n+\tstruct otx2_idev_cfg *idev;\n+\n+\tidev = otx2_intra_dev_get_cfg();\n+\n+\tif (idev != NULL) {\n+\t\tidev->sso_pf_func = sso_pf_func;\n+\t\trte_smp_wmb();\n+\t}\n+}\n+\n+/**\n+ * @internal\n+ * Get NPA PF_FUNC.\n+ */\n+uint16_t\n+otx2_npa_pf_func_get(void)\n+{\n+\tstruct otx2_idev_cfg *idev;\n+\tuint16_t npa_pf_func;\n+\n+\tnpa_pf_func = 0;\n+\tidev = otx2_intra_dev_get_cfg();\n+\n+\tif (idev != NULL)\n+\t\tnpa_pf_func = idev->npa_pf_func;\n+\n+\treturn npa_pf_func;\n+}\n+\n+/**\n+ * @internal\n+ * Get NPA lf object.\n+ */\n+struct otx2_npa_lf *\n+otx2_npa_lf_obj_get(void)\n+{\n+\tstruct otx2_idev_cfg *idev;\n+\n+\tidev = otx2_intra_dev_get_cfg();\n+\n+\tif (idev != NULL && rte_atomic16_read(&idev->npa_refcnt))\n+\t\treturn idev->npa_lf;\n+\n+\treturn NULL;\n+}\n+\n+/**\n+ * @internal\n+ * Is NPA lf active for the given device?.\n+ */\n+int\n+otx2_npa_lf_active(void *otx2_dev)\n+{\n+\tstruct otx2_dev *dev = otx2_dev;\n+\tstruct otx2_idev_cfg *idev;\n+\n+\t/* Check if npalf is actively used on this dev */\n+\tidev = otx2_intra_dev_get_cfg();\n+\tif (!idev || !idev->npa_lf || idev->npa_lf->mbox != dev->mbox)\n+\t\treturn 0;\n+\n+\treturn rte_atomic16_read(&idev->npa_refcnt);\n+}\n+\n+/*\n+ * @internal\n+ * Gets reference only to existing NPA LF object.\n+ */\n+int otx2_npa_lf_obj_ref(void)\n+{\n+\tstruct otx2_idev_cfg *idev;\n+\tuint16_t cnt;\n+\tint rc;\n+\n+\tidev = otx2_intra_dev_get_cfg();\n+\n+\t/* Check if ref not possible */\n+\tif (idev == NULL)\n+\t\treturn -EINVAL;\n+\n+\n+\t/* Get ref only if > 0 */\n+\tcnt = rte_atomic16_read(&idev->npa_refcnt);\n+\twhile (cnt != 0) {\n+\t\trc = rte_atomic16_cmpset(&idev->npa_refcnt_u16, cnt, cnt + 1);\n+\t\tif (rc)\n+\t\t\tbreak;\n+\n+\t\tcnt = rte_atomic16_read(&idev->npa_refcnt);\n+\t}\n+\n+\treturn cnt ? 0 : -EINVAL;\n+}\n \n /**\n  * @internal\ndiff --git a/drivers/common/octeontx2/otx2_common.h b/drivers/common/octeontx2/otx2_common.h\nindex b9e7a7f8d..cbc5c65a7 100644\n--- a/drivers/common/octeontx2/otx2_common.h\n+++ b/drivers/common/octeontx2/otx2_common.h\n@@ -5,9 +5,12 @@\n #ifndef _OTX2_COMMON_H_\n #define _OTX2_COMMON_H_\n \n+#include <rte_atomic.h>\n #include <rte_common.h>\n-#include <rte_io.h>\n+#include <rte_cycles.h>\n #include <rte_memory.h>\n+#include <rte_memzone.h>\n+#include <rte_io.h>\n \n #include \"hw/otx2_rvu.h\"\n #include \"hw/otx2_nix.h\"\n@@ -33,6 +36,33 @@\n #define __hot   __attribute__((hot))\n #endif\n \n+/* Intra device related functions */\n+struct otx2_npa_lf {\n+\tstruct otx2_mbox *mbox;\n+\tstruct rte_pci_device *pci_dev;\n+\tstruct rte_intr_handle *intr_handle;\n+};\n+\n+struct otx2_idev_cfg {\n+\tuint16_t sso_pf_func;\n+\tuint16_t npa_pf_func;\n+\tstruct otx2_npa_lf *npa_lf;\n+\tRTE_STD_C11\n+\tunion {\n+\t\trte_atomic16_t npa_refcnt;\n+\t\tuint16_t npa_refcnt_u16;\n+\t};\n+};\n+\n+struct otx2_idev_cfg *otx2_intra_dev_get_cfg(void);\n+void otx2_sso_pf_func_set(uint16_t sso_pf_func);\n+uint16_t otx2_sso_pf_func_get(void);\n+uint16_t otx2_npa_pf_func_get(void);\n+struct otx2_npa_lf *otx2_npa_lf_obj_get(void);\n+void otx2_npa_set_defaults(struct otx2_idev_cfg *idev);\n+int otx2_npa_lf_active(void *dev);\n+int otx2_npa_lf_obj_ref(void);\n+\n /* Log */\n extern int otx2_logtype_base;\n extern int otx2_logtype_mbox;\ndiff --git a/drivers/common/octeontx2/otx2_dev.c b/drivers/common/octeontx2/otx2_dev.c\nindex ccdb2df78..59bd988d1 100644\n--- a/drivers/common/octeontx2/otx2_dev.c\n+++ b/drivers/common/octeontx2/otx2_dev.c\n@@ -177,8 +177,14 @@ void\n otx2_dev_fini(struct rte_pci_device *pci_dev, void *otx2_dev)\n {\n \tstruct otx2_dev *dev = otx2_dev;\n+\tstruct otx2_idev_cfg *idev;\n \tstruct otx2_mbox *mbox;\n \n+\t/* Clear references to this pci dev */\n+\tidev = otx2_intra_dev_get_cfg();\n+\tif (idev->npa_lf && idev->npa_lf->pci_dev == pci_dev)\n+\t\tidev->npa_lf = NULL;\n+\n \t/* Release PF - VF */\n \tmbox = &dev->mbox_vfpf;\n \tif (mbox->hwbase && mbox->dev)\ndiff --git a/drivers/common/octeontx2/otx2_dev.h b/drivers/common/octeontx2/otx2_dev.h\nindex a89570b62..70104dfa2 100644\n--- a/drivers/common/octeontx2/otx2_dev.h\n+++ b/drivers/common/octeontx2/otx2_dev.h\n@@ -40,6 +40,7 @@ struct otx2_dev;\n \totx2_intr_t intr;\t\t\t\t\\\n \tint timer_set;\t/* ~0 : no alarm handling */\t\\\n \tuint64_t hwcap;\t\t\t\t\t\\\n+\tstruct otx2_npa_lf npalf;\t\t\t\\\n \tstruct otx2_mbox *mbox;\t\t\t\t\\\n \tuint16_t maxvf;\t\t\t\t\t\\\n \tconst struct otx2_dev_ops *ops\ndiff --git a/drivers/common/octeontx2/rte_common_octeontx2_version.map b/drivers/common/octeontx2/rte_common_octeontx2_version.map\nindex 2f8a607ee..602eb3651 100644\n--- a/drivers/common/octeontx2/rte_common_octeontx2_version.map\n+++ b/drivers/common/octeontx2/rte_common_octeontx2_version.map\n@@ -21,6 +21,15 @@ DPDK_19.05 {\n \totx2_mbox_msg_send;\n \totx2_mbox_wait_for_rsp;\n \n+\totx2_intra_dev_get_cfg;\n+\totx2_npa_lf_active;\n+\totx2_npa_lf_obj_get;\n+\totx2_npa_lf_obj_ref;\n+\totx2_npa_pf_func_get;\n+\totx2_npa_set_defaults;\n+\totx2_sso_pf_func_get;\n+\totx2_sso_pf_func_set;\n+\n \totx2_disable_irqs;\n \totx2_unregister_irq;\n \totx2_register_irq;\n",
    "prefixes": [
        "v2",
        "09/27"
    ]
}