get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 105047,
    "url": "http://patchwork.dpdk.org/api/patches/105047/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20211209091342.27017-8-ndabilpuram@marvell.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<20211209091342.27017-8-ndabilpuram@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20211209091342.27017-8-ndabilpuram@marvell.com",
    "date": "2021-12-09T09:13:42",
    "name": "[8/8] net/cnxk: synchronize inline session create and destroy",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "11a97b4777690e7ce75e83cb3548d3b478e47968",
    "submitter": {
        "id": 1202,
        "url": "http://patchwork.dpdk.org/api/people/1202/?format=api",
        "name": "Nithin Dabilpuram",
        "email": "ndabilpuram@marvell.com"
    },
    "delegate": {
        "id": 310,
        "url": "http://patchwork.dpdk.org/api/users/310/?format=api",
        "username": "jerin",
        "first_name": "Jerin",
        "last_name": "Jacob",
        "email": "jerinj@marvell.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20211209091342.27017-8-ndabilpuram@marvell.com/mbox/",
    "series": [
        {
            "id": 20897,
            "url": "http://patchwork.dpdk.org/api/series/20897/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=20897",
            "date": "2021-12-09T09:13:35",
            "name": "[1/8] common/cnxk: fix shift offset for tl3 length disable",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/20897/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/105047/comments/",
    "check": "warning",
    "checks": "http://patchwork.dpdk.org/api/patches/105047/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 C1E52A00C2;\n\tThu,  9 Dec 2021 10:14:40 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 6E28042713;\n\tThu,  9 Dec 2021 10:14:13 +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 DA90842711\n for <dev@dpdk.org>; Thu,  9 Dec 2021 10:14:12 +0100 (CET)",
            "from pps.filterd (m0045851.ppops.net [127.0.0.1])\n by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id\n 1B97bXNu009808\n for <dev@dpdk.org>; Thu, 9 Dec 2021 01:14:12 -0800",
            "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3cudjt0aqw-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Thu, 09 Dec 2021 01:14:12 -0800",
            "from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18;\n Thu, 9 Dec 2021 01:14:10 -0800",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend\n Transport; Thu, 9 Dec 2021 01:14:09 -0800",
            "from hyd1588t430.marvell.com (unknown [10.29.52.204])\n by maili.marvell.com (Postfix) with ESMTP id 3338A3F7054;\n Thu,  9 Dec 2021 01:14:07 -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=g/GIGWZspl2c0NU24EU4Wkw3gAYxKRxyyO8gvdc1OvA=;\n b=CvTnRyggiqZzLoKAv5I6RT03l4ZdyNi4dZ1aFIuVJrU8cr9lp3dyiIiLQ8miioyIAcPc\n dGymFWkFnDcLkKUPiUZ1GZfCG/WiIaJh02SmNdjZZEymy8SAyugxz4lGd2VIqfRjAyEC\n zeXi4L3HoJIXhG3s6/aF1BaFWKFIemuIoLG3++BvsHWmBy4JLJ6pUvhW38IRbdzR6xpe\n BJR6343KCGUwDkPT0vdC3fos34mjH9zDggOD4bShK0KF72x14cEo3UG+nmk2ZquGwbdC\n 23JzB3NpGugnF5bNtWwThU+sV0VorxWt/eG6IKh5knK90dH9hHEuSW9XjQhaEEA97J6s YA==",
        "From": "Nithin Dabilpuram <ndabilpuram@marvell.com>",
        "To": "<jerinj@marvell.com>, Nithin Dabilpuram <ndabilpuram@marvell.com>, \"Kiran\n Kumar K\" <kirankumark@marvell.com>, Sunil Kumar Kori <skori@marvell.com>,\n Satha Rao <skoteshwar@marvell.com>",
        "CC": "<dev@dpdk.org>",
        "Subject": "[PATCH 8/8] net/cnxk: synchronize inline session create and destroy",
        "Date": "Thu, 9 Dec 2021 14:43:42 +0530",
        "Message-ID": "<20211209091342.27017-8-ndabilpuram@marvell.com>",
        "X-Mailer": "git-send-email 2.8.4",
        "In-Reply-To": "<20211209091342.27017-1-ndabilpuram@marvell.com>",
        "References": "<20211209091342.27017-1-ndabilpuram@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Proofpoint-ORIG-GUID": "UVJu3rK9tG7FIOrXG3f-ixiSgRZmrkuC",
        "X-Proofpoint-GUID": "UVJu3rK9tG7FIOrXG3f-ixiSgRZmrkuC",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513\n definitions=2021-12-09_04,2021-12-08_01,2021-12-02_01",
        "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"
    },
    "content": "Synchronize inline session create and destroy using spinlock.\nAlso move security related error prints outside the spinlock.\n\nSigned-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>\n---\n drivers/net/cnxk/cn10k_ethdev_sec.c | 35 ++++++++++++++++++++++++++++-------\n drivers/net/cnxk/cn9k_ethdev_sec.c  | 34 +++++++++++++++++++++++++++-------\n drivers/net/cnxk/cnxk_ethdev.c      |  7 +++++--\n drivers/net/cnxk/cnxk_ethdev.h      |  6 ++++++\n 4 files changed, 66 insertions(+), 16 deletions(-)",
    "diff": "diff --git a/drivers/net/cnxk/cn10k_ethdev_sec.c b/drivers/net/cnxk/cn10k_ethdev_sec.c\nindex 235c168..12cec0a 100644\n--- a/drivers/net/cnxk/cn10k_ethdev_sec.c\n+++ b/drivers/net/cnxk/cn10k_ethdev_sec.c\n@@ -238,6 +238,8 @@ cn10k_eth_sec_session_create(void *device,\n \tstruct rte_crypto_sym_xform *crypto;\n \tstruct cnxk_eth_sec_sess *eth_sec;\n \tbool inbound, inl_dev;\n+\trte_spinlock_t *lock;\n+\tchar tbuf[128] = {0};\n \tint rc = 0;\n \n \tif (conf->action_type != RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL)\n@@ -272,6 +274,9 @@ cn10k_eth_sec_session_create(void *device,\n \tmemset(eth_sec, 0, sizeof(struct cnxk_eth_sec_sess));\n \tsess_priv.u64 = 0;\n \n+\tlock = inbound ? &dev->inb.lock : &dev->outb.lock;\n+\trte_spinlock_lock(lock);\n+\n \t/* Acquire lock on inline dev for inbound */\n \tif (inbound && inl_dev)\n \t\troc_nix_inl_dev_lock();\n@@ -287,12 +292,14 @@ cn10k_eth_sec_session_create(void *device,\n \t\t/* Get Inbound SA from NIX_RX_IPSEC_SA_BASE */\n \t\tsa = roc_nix_inl_inb_sa_get(&dev->nix, inl_dev, ipsec->spi);\n \t\tif (!sa && dev->inb.inl_dev) {\n-\t\t\tplt_err(\"Failed to create ingress sa, inline dev \"\n-\t\t\t\t\"not found or spi not in range\");\n+\t\t\tsnprintf(tbuf, sizeof(tbuf),\n+\t\t\t\t \"Failed to create ingress sa, inline dev \"\n+\t\t\t\t \"not found or spi not in range\");\n \t\t\trc = -ENOTSUP;\n \t\t\tgoto mempool_put;\n \t\t} else if (!sa) {\n-\t\t\tplt_err(\"Failed to create ingress sa\");\n+\t\t\tsnprintf(tbuf, sizeof(tbuf),\n+\t\t\t\t \"Failed to create ingress sa\");\n \t\t\trc = -EFAULT;\n \t\t\tgoto mempool_put;\n \t\t}\n@@ -301,8 +308,9 @@ cn10k_eth_sec_session_create(void *device,\n \n \t\t/* Check if SA is already in use */\n \t\tif (inb_sa->w2.s.valid) {\n-\t\t\tplt_err(\"Inbound SA with SPI %u already in use\",\n-\t\t\t\tipsec->spi);\n+\t\t\tsnprintf(tbuf, sizeof(tbuf),\n+\t\t\t\t \"Inbound SA with SPI %u already in use\",\n+\t\t\t\t ipsec->spi);\n \t\t\trc = -EBUSY;\n \t\t\tgoto mempool_put;\n \t\t}\n@@ -313,7 +321,8 @@ cn10k_eth_sec_session_create(void *device,\n \t\t/* Fill inbound sa params */\n \t\trc = cnxk_ot_ipsec_inb_sa_fill(inb_sa_dptr, ipsec, crypto);\n \t\tif (rc) {\n-\t\t\tplt_err(\"Failed to init inbound sa, rc=%d\", rc);\n+\t\t\tsnprintf(tbuf, sizeof(tbuf),\n+\t\t\t\t \"Failed to init inbound sa, rc=%d\", rc);\n \t\t\tgoto mempool_put;\n \t\t}\n \n@@ -371,7 +380,8 @@ cn10k_eth_sec_session_create(void *device,\n \t\t/* Fill outbound sa params */\n \t\trc = cnxk_ot_ipsec_outb_sa_fill(outb_sa_dptr, ipsec, crypto);\n \t\tif (rc) {\n-\t\t\tplt_err(\"Failed to init outbound sa, rc=%d\", rc);\n+\t\t\tsnprintf(tbuf, sizeof(tbuf),\n+\t\t\t\t \"Failed to init outbound sa, rc=%d\", rc);\n \t\t\trc |= cnxk_eth_outb_sa_idx_put(dev, sa_idx);\n \t\t\tgoto mempool_put;\n \t\t}\n@@ -409,6 +419,7 @@ cn10k_eth_sec_session_create(void *device,\n \t}\n \tif (inbound && inl_dev)\n \t\troc_nix_inl_dev_unlock();\n+\trte_spinlock_unlock(lock);\n \n \tplt_nix_dbg(\"Created %s session with spi=%u, sa_idx=%u inl_dev=%u\",\n \t\t    inbound ? \"inbound\" : \"outbound\", eth_sec->spi,\n@@ -422,7 +433,11 @@ cn10k_eth_sec_session_create(void *device,\n mempool_put:\n \tif (inbound && inl_dev)\n \t\troc_nix_inl_dev_unlock();\n+\trte_spinlock_unlock(lock);\n+\n \trte_mempool_put(mempool, eth_sec);\n+\tif (rc)\n+\t\tplt_err(\"%s\", tbuf);\n \treturn rc;\n }\n \n@@ -433,12 +448,16 @@ cn10k_eth_sec_session_destroy(void *device, struct rte_security_session *sess)\n \tstruct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);\n \tstruct cnxk_eth_sec_sess *eth_sec;\n \tstruct rte_mempool *mp;\n+\trte_spinlock_t *lock;\n \tvoid *sa_dptr;\n \n \teth_sec = cnxk_eth_sec_sess_get_by_sess(dev, sess);\n \tif (!eth_sec)\n \t\treturn -ENOENT;\n \n+\tlock = eth_sec->inb ? &dev->inb.lock : &dev->outb.lock;\n+\trte_spinlock_lock(lock);\n+\n \tif (eth_sec->inl_dev)\n \t\troc_nix_inl_dev_lock();\n \n@@ -468,6 +487,8 @@ cn10k_eth_sec_session_destroy(void *device, struct rte_security_session *sess)\n \tif (eth_sec->inl_dev)\n \t\troc_nix_inl_dev_unlock();\n \n+\trte_spinlock_unlock(lock);\n+\n \tplt_nix_dbg(\"Destroyed %s session with spi=%u, sa_idx=%u, inl_dev=%u\",\n \t\t    eth_sec->inb ? \"inbound\" : \"outbound\", eth_sec->spi,\n \t\t    eth_sec->sa_idx, eth_sec->inl_dev);\ndiff --git a/drivers/net/cnxk/cn9k_ethdev_sec.c b/drivers/net/cnxk/cn9k_ethdev_sec.c\nindex b070ad5..efdce22 100644\n--- a/drivers/net/cnxk/cn9k_ethdev_sec.c\n+++ b/drivers/net/cnxk/cn9k_ethdev_sec.c\n@@ -146,6 +146,8 @@ cn9k_eth_sec_session_create(void *device,\n \tstruct cn9k_sec_sess_priv sess_priv;\n \tstruct rte_crypto_sym_xform *crypto;\n \tstruct cnxk_eth_sec_sess *eth_sec;\n+\trte_spinlock_t *lock;\n+\tchar tbuf[128] = {0};\n \tbool inbound;\n \tint rc = 0;\n \n@@ -174,6 +176,9 @@ cn9k_eth_sec_session_create(void *device,\n \t\treturn -ENOMEM;\n \t}\n \n+\tlock = inbound ? &dev->inb.lock : &dev->outb.lock;\n+\trte_spinlock_lock(lock);\n+\n \tmemset(eth_sec, 0, sizeof(struct cnxk_eth_sec_sess));\n \tsess_priv.u64 = 0;\n \n@@ -187,18 +192,20 @@ cn9k_eth_sec_session_create(void *device,\n \t\t/* Get Inbound SA from NIX_RX_IPSEC_SA_BASE. Assume no inline\n \t\t * device always for CN9K.\n \t\t */\n-\t\tinb_sa = (struct roc_onf_ipsec_inb_sa *)\n-\t\t\troc_nix_inl_inb_sa_get(&dev->nix, false, ipsec->spi);\n+\t\tinb_sa = (struct roc_onf_ipsec_inb_sa *)roc_nix_inl_inb_sa_get(\n+\t\t\t&dev->nix, false, ipsec->spi);\n \t\tif (!inb_sa) {\n-\t\t\tplt_err(\"Failed to create ingress sa\");\n+\t\t\tsnprintf(tbuf, sizeof(tbuf),\n+\t\t\t\t \"Failed to create ingress sa\");\n \t\t\trc = -EFAULT;\n \t\t\tgoto mempool_put;\n \t\t}\n \n \t\t/* Check if SA is already in use */\n \t\tif (inb_sa->ctl.valid) {\n-\t\t\tplt_err(\"Inbound SA with SPI %u already in use\",\n-\t\t\t\tipsec->spi);\n+\t\t\tsnprintf(tbuf, sizeof(tbuf),\n+\t\t\t\t \"Inbound SA with SPI %u already in use\",\n+\t\t\t\t ipsec->spi);\n \t\t\trc = -EBUSY;\n \t\t\tgoto mempool_put;\n \t\t}\n@@ -208,7 +215,8 @@ cn9k_eth_sec_session_create(void *device,\n \t\t/* Fill inbound sa params */\n \t\trc = cnxk_onf_ipsec_inb_sa_fill(inb_sa, ipsec, crypto);\n \t\tif (rc) {\n-\t\t\tplt_err(\"Failed to init inbound sa, rc=%d\", rc);\n+\t\t\tsnprintf(tbuf, sizeof(tbuf),\n+\t\t\t\t \"Failed to init inbound sa, rc=%d\", rc);\n \t\t\tgoto mempool_put;\n \t\t}\n \n@@ -263,7 +271,8 @@ cn9k_eth_sec_session_create(void *device,\n \t\t/* Fill outbound sa params */\n \t\trc = cnxk_onf_ipsec_outb_sa_fill(outb_sa, ipsec, crypto);\n \t\tif (rc) {\n-\t\t\tplt_err(\"Failed to init outbound sa, rc=%d\", rc);\n+\t\t\tsnprintf(tbuf, sizeof(tbuf),\n+\t\t\t\t \"Failed to init outbound sa, rc=%d\", rc);\n \t\t\trc |= cnxk_eth_outb_sa_idx_put(dev, sa_idx);\n \t\t\tgoto mempool_put;\n \t\t}\n@@ -300,6 +309,8 @@ cn9k_eth_sec_session_create(void *device,\n \t/* Sync SA content */\n \tplt_atomic_thread_fence(__ATOMIC_ACQ_REL);\n \n+\trte_spinlock_unlock(lock);\n+\n \tplt_nix_dbg(\"Created %s session with spi=%u, sa_idx=%u\",\n \t\t    inbound ? \"inbound\" : \"outbound\", eth_sec->spi,\n \t\t    eth_sec->sa_idx);\n@@ -310,7 +321,10 @@ cn9k_eth_sec_session_create(void *device,\n \n \treturn 0;\n mempool_put:\n+\trte_spinlock_unlock(lock);\n \trte_mempool_put(mempool, eth_sec);\n+\tif (rc)\n+\t\tplt_err(\"%s\", tbuf);\n \treturn rc;\n }\n \n@@ -323,11 +337,15 @@ cn9k_eth_sec_session_destroy(void *device, struct rte_security_session *sess)\n \tstruct roc_onf_ipsec_inb_sa *inb_sa;\n \tstruct cnxk_eth_sec_sess *eth_sec;\n \tstruct rte_mempool *mp;\n+\trte_spinlock_t *lock;\n \n \teth_sec = cnxk_eth_sec_sess_get_by_sess(dev, sess);\n \tif (!eth_sec)\n \t\treturn -ENOENT;\n \n+\tlock = eth_sec->inb ? &dev->inb.lock : &dev->outb.lock;\n+\trte_spinlock_lock(lock);\n+\n \tif (eth_sec->inb) {\n \t\tinb_sa = eth_sec->sa;\n \t\t/* Disable SA */\n@@ -349,6 +367,8 @@ cn9k_eth_sec_session_destroy(void *device, struct rte_security_session *sess)\n \t/* Sync SA content */\n \tplt_atomic_thread_fence(__ATOMIC_ACQ_REL);\n \n+\trte_spinlock_unlock(lock);\n+\n \tplt_nix_dbg(\"Destroyed %s session with spi=%u, sa_idx=%u\",\n \t\t    eth_sec->inb ? \"inbound\" : \"outbound\", eth_sec->spi,\n \t\t    eth_sec->sa_idx);\ndiff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c\nindex 74f6255..c2e7f2f 100644\n--- a/drivers/net/cnxk/cnxk_ethdev.c\n+++ b/drivers/net/cnxk/cnxk_ethdev.c\n@@ -1605,8 +1605,6 @@ cnxk_eth_dev_init(struct rte_eth_dev *eth_dev)\n \tsec_ctx->flags =\n \t\t(RTE_SEC_CTX_F_FAST_SET_MDATA | RTE_SEC_CTX_F_FAST_GET_UDATA);\n \teth_dev->security_ctx = sec_ctx;\n-\tTAILQ_INIT(&dev->inb.list);\n-\tTAILQ_INIT(&dev->outb.list);\n \n \t/* For secondary processes, the primary has done all the work */\n \tif (rte_eal_process_type() != RTE_PROC_PRIMARY)\n@@ -1642,6 +1640,11 @@ cnxk_eth_dev_init(struct rte_eth_dev *eth_dev)\n \tdev->configured = 0;\n \tdev->ptype_disable = 0;\n \n+\tTAILQ_INIT(&dev->inb.list);\n+\tTAILQ_INIT(&dev->outb.list);\n+\trte_spinlock_init(&dev->inb.lock);\n+\trte_spinlock_init(&dev->outb.lock);\n+\n \t/* For vfs, returned max_entries will be 0. but to keep default mac\n \t * address, one entry must be allocated. so setting up to 1.\n \t */\ndiff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h\nindex 5bfda3d..db1fb4b 100644\n--- a/drivers/net/cnxk/cnxk_ethdev.h\n+++ b/drivers/net/cnxk/cnxk_ethdev.h\n@@ -271,6 +271,9 @@ struct cnxk_eth_dev_sec_inb {\n \n \t/* DPTR for WRITE_SA microcode op */\n \tvoid *sa_dptr;\n+\n+\t/* Lock to synchronize sa setup/release */\n+\trte_spinlock_t lock;\n };\n \n /* Outbound security data */\n@@ -304,6 +307,9 @@ struct cnxk_eth_dev_sec_outb {\n \n \t/* DPTR for WRITE_SA microcode op */\n \tvoid *sa_dptr;\n+\n+\t/* Lock to synchronize sa setup/release */\n+\trte_spinlock_t lock;\n };\n \n struct cnxk_eth_dev {\n",
    "prefixes": [
        "8/8"
    ]
}