get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 97739,
    "url": "https://patches.dpdk.org/api/patches/97739/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210902021505.17607-14-ndabilpuram@marvell.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": "<20210902021505.17607-14-ndabilpuram@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210902021505.17607-14-ndabilpuram@marvell.com",
    "date": "2021-09-02T02:14:51",
    "name": "[13/27] common/cnxk: add anti-replay check implementation for cn9k",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "e9df830383f5e6db0d9f4525eea21e27e16e5841",
    "submitter": {
        "id": 1202,
        "url": "https://patches.dpdk.org/api/people/1202/?format=api",
        "name": "Nithin Dabilpuram",
        "email": "ndabilpuram@marvell.com"
    },
    "delegate": {
        "id": 310,
        "url": "https://patches.dpdk.org/api/users/310/?format=api",
        "username": "jerin",
        "first_name": "Jerin",
        "last_name": "Jacob",
        "email": "jerinj@marvell.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20210902021505.17607-14-ndabilpuram@marvell.com/mbox/",
    "series": [
        {
            "id": 18612,
            "url": "https://patches.dpdk.org/api/series/18612/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=18612",
            "date": "2021-09-02T02:14:38",
            "name": "net/cnxk: support for inline ipsec",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/18612/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/97739/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/97739/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 E7050A0C4C;\n\tThu,  2 Sep 2021 04:18:13 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 699974116B;\n\tThu,  2 Sep 2021 04:17:26 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n [67.231.156.173])\n by mails.dpdk.org (Postfix) with ESMTP id 5175441159\n for <dev@dpdk.org>; Thu,  2 Sep 2021 04:17:24 +0200 (CEST)",
            "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 SMTP id 181HQ3fJ011587\n for <dev@dpdk.org>; Wed, 1 Sep 2021 19:17:23 -0700",
            "from dc5-exch01.marvell.com ([199.233.59.181])\n by mx0b-0016f401.pphosted.com with ESMTP id 3atdwq9hsw-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Wed, 01 Sep 2021 19:17:23 -0700",
            "from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.18;\n Wed, 1 Sep 2021 19:17:21 -0700",
            "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.18 via Frontend\n Transport; Wed, 1 Sep 2021 19:17:21 -0700",
            "from hyd1588t430.marvell.com (unknown [10.29.52.204])\n by maili.marvell.com (Postfix) with ESMTP id 3E2363F7040;\n Wed,  1 Sep 2021 19:17:19 -0700 (PDT)"
        ],
        "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=RmfNko7/8XvQzbAZi7sEgjTJSHE/vfW8o7k2YT8GwIM=;\n b=MOaTuOPh+dlr/pHeNDobF3OuUNcKXZ2RJRscydqQLd7T6hRBVE881uGCzRGLufOyZtrF\n fI7YKFy129FT3J/xOLa0O8RQ7H+OgshH8g5hpu+ILq7E5Erz7Jq5vQs4p4P0KDOfzqJ/\n qT1894yDr1hM/7U7tADLKHErD/tVOHR37TtjplH5dWYpVQ7W/79/tFxHhlCphwbB3MGD\n ue55CtPoVjPqQBwFfLpyzOEhKmctAC6nI4MIUcUfaWXglHiblVjVGtAGB1fW4ad6yoPe\n ZIKNaCxva1BT0YcsYZo/Bfo+4tpmqWSpkeF5mBYA4ZRAkOIPFU3xCFzzvHwLO8MFRO7B rA==",
        "From": "Nithin Dabilpuram <ndabilpuram@marvell.com>",
        "To": "Nithin Dabilpuram <ndabilpuram@marvell.com>, Kiran Kumar K\n <kirankumark@marvell.com>, Sunil Kumar Kori <skori@marvell.com>, Satha Rao\n <skoteshwar@marvell.com>",
        "CC": "<jerinj@marvell.com>, <schalla@marvell.com>, <dev@dpdk.org>",
        "Date": "Thu, 2 Sep 2021 07:44:51 +0530",
        "Message-ID": "<20210902021505.17607-14-ndabilpuram@marvell.com>",
        "X-Mailer": "git-send-email 2.8.4",
        "In-Reply-To": "<20210902021505.17607-1-ndabilpuram@marvell.com>",
        "References": "<20210902021505.17607-1-ndabilpuram@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Proofpoint-ORIG-GUID": "qpGE7m6mKETJWiFUqXtzWdp7JXvIFPWo",
        "X-Proofpoint-GUID": "qpGE7m6mKETJWiFUqXtzWdp7JXvIFPWo",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475\n definitions=2021-09-01_05,2021-09-01_01,2020-04-07_01",
        "Subject": "[dpdk-dev] [PATCH 13/27] common/cnxk: add anti-replay check\n implementation for cn9k",
        "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: Srujana Challa <schalla@marvell.com>\n\nAdds anti replay helper for cn9k platform.\n\nSigned-off-by: Srujana Challa <schalla@marvell.com>\n---\n drivers/common/cnxk/cnxk_security_ar.h | 184 +++++++++++++++++++++++++++++++++\n 1 file changed, 184 insertions(+)\n create mode 100644 drivers/common/cnxk/cnxk_security_ar.h",
    "diff": "diff --git a/drivers/common/cnxk/cnxk_security_ar.h b/drivers/common/cnxk/cnxk_security_ar.h\nnew file mode 100644\nindex 0000000..6bc517c\n--- /dev/null\n+++ b/drivers/common/cnxk/cnxk_security_ar.h\n@@ -0,0 +1,184 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(C) 2021 Marvell.\n+ */\n+\n+#ifndef __CNXK_SECURITY_AR_H__\n+#define __CNXK_SECURITY_AR_H__\n+\n+#include <rte_mbuf.h>\n+\n+#include \"cnxk_security.h\"\n+\n+#define CNXK_ON_AR_WIN_SIZE_MAX 1024\n+\n+/* u64 array size to fit anti replay window bits */\n+#define AR_WIN_ARR_SZ                                                          \\\n+\t(PLT_ALIGN_CEIL(CNXK_ON_AR_WIN_SIZE_MAX, BITS_PER_LONG_LONG) /        \\\n+\t BITS_PER_LONG_LONG)\n+\n+#define WORD_SHIFT 6\n+#define WORD_SIZE  (1 << WORD_SHIFT)\n+#define WORD_MASK  (WORD_SIZE - 1)\n+\n+#define IPSEC_ANTI_REPLAY_FAILED (-1)\n+\n+struct cnxk_on_ipsec_ar {\n+\trte_spinlock_t lock;\n+\tuint32_t winb;\n+\tuint32_t wint;\n+\tuint64_t base;\t\t\t/**< base of the anti-replay window */\n+\tuint64_t window[AR_WIN_ARR_SZ]; /**< anti-replay window */\n+};\n+\n+static inline int\n+cnxk_on_anti_replay_check(uint64_t seq, struct cnxk_on_ipsec_ar *ar,\n+\t\t\t  uint32_t winsz)\n+{\n+\tuint64_t ex_winsz = winsz + WORD_SIZE;\n+\tuint64_t *window = &ar->window[0];\n+\tuint64_t seqword, shiftwords;\n+\tuint64_t base = ar->base;\n+\tuint32_t winb = ar->winb;\n+\tuint32_t wint = ar->wint;\n+\tuint64_t winwords;\n+\tuint64_t bit_pos;\n+\tuint64_t shift;\n+\tuint64_t *wptr;\n+\tuint64_t tmp;\n+\n+\twinwords = ex_winsz >> WORD_SHIFT;\n+\tif (winsz > 64)\n+\t\tgoto slow_shift;\n+\t/* Check if the seq is the biggest one yet */\n+\tif (likely(seq > base)) {\n+\t\tshift = seq - base;\n+\t\tif (shift < winsz) { /* In window */\n+\t\t\t/*\n+\t\t\t * If more than 64-bit anti-replay window,\n+\t\t\t * use slow shift routine\n+\t\t\t */\n+\t\t\twptr = window + (shift >> WORD_SHIFT);\n+\t\t\t*wptr <<= shift;\n+\t\t\t*wptr |= 1ull;\n+\t\t} else {\n+\t\t\t/* No special handling of window size > 64 */\n+\t\t\twptr = window + ((winsz - 1) >> WORD_SHIFT);\n+\t\t\t/*\n+\t\t\t * Zero out the whole window (especially for\n+\t\t\t * bigger than 64b window) till the last 64b word\n+\t\t\t * as the incoming sequence number minus\n+\t\t\t * base sequence is more than the window size.\n+\t\t\t */\n+\t\t\twhile (window != wptr)\n+\t\t\t\t*window++ = 0ull;\n+\t\t\t/*\n+\t\t\t * Set the last bit (of the window) to 1\n+\t\t\t * as that corresponds to the base sequence number.\n+\t\t\t * Now any incoming sequence number which is\n+\t\t\t * (base - window size - 1) will pass anti-replay check\n+\t\t\t */\n+\t\t\t*wptr = 1ull;\n+\t\t}\n+\t\t/*\n+\t\t * Set the base to incoming sequence number as\n+\t\t * that is the biggest sequence number seen yet\n+\t\t */\n+\t\tar->base = seq;\n+\t\treturn 0;\n+\t}\n+\n+\tbit_pos = base - seq;\n+\n+\t/* If seq falls behind the window, return failure */\n+\tif (bit_pos >= winsz)\n+\t\treturn IPSEC_ANTI_REPLAY_FAILED;\n+\n+\t/* seq is within anti-replay window */\n+\twptr = window + ((winsz - bit_pos - 1) >> WORD_SHIFT);\n+\tbit_pos &= WORD_MASK;\n+\n+\t/* Check if this is a replayed packet */\n+\tif (*wptr & ((1ull) << bit_pos))\n+\t\treturn IPSEC_ANTI_REPLAY_FAILED;\n+\n+\t/* mark as seen */\n+\t*wptr |= ((1ull) << bit_pos);\n+\treturn 0;\n+\n+slow_shift:\n+\tif (likely(seq > base)) {\n+\t\tuint32_t i;\n+\n+\t\tshift = seq - base;\n+\t\tif (unlikely(shift >= winsz)) {\n+\t\t\t/*\n+\t\t\t * shift is bigger than the window,\n+\t\t\t * so just zero out everything\n+\t\t\t */\n+\t\t\tfor (i = 0; i < winwords; i++)\n+\t\t\t\twindow[i] = 0;\n+winupdate:\n+\t\t\t/* Find out the word */\n+\t\t\tseqword = ((seq - 1) % ex_winsz) >> WORD_SHIFT;\n+\n+\t\t\t/* Find out the bit in the word */\n+\t\t\tbit_pos = (seq - 1) & WORD_MASK;\n+\n+\t\t\t/*\n+\t\t\t * Set the bit corresponding to sequence number\n+\t\t\t * in window to mark it as received\n+\t\t\t */\n+\t\t\twindow[seqword] |= (1ull << (63 - bit_pos));\n+\n+\t\t\t/* wint and winb range from 1 to ex_winsz */\n+\t\t\tar->wint = ((wint + shift - 1) % ex_winsz) + 1;\n+\t\t\tar->winb = ((winb + shift - 1) % ex_winsz) + 1;\n+\n+\t\t\tar->base = seq;\n+\t\t\treturn 0;\n+\t\t}\n+\n+\t\t/*\n+\t\t * New sequence number is bigger than the base but\n+\t\t * it's not bigger than base + window size\n+\t\t */\n+\n+\t\tshiftwords = ((wint + shift - 1) >> WORD_SHIFT) -\n+\t\t\t     ((wint - 1) >> WORD_SHIFT);\n+\t\tif (unlikely(shiftwords)) {\n+\t\t\ttmp = (wint + WORD_SIZE - 1) / WORD_SIZE;\n+\t\t\tfor (i = 0; i < shiftwords; i++) {\n+\t\t\t\ttmp %= winwords;\n+\t\t\t\twindow[tmp++] = 0;\n+\t\t\t}\n+\t\t}\n+\n+\t\tgoto winupdate;\n+\t}\n+\n+\t/* Sequence number is before the window */\n+\tif (unlikely((seq + winsz) <= base))\n+\t\treturn IPSEC_ANTI_REPLAY_FAILED;\n+\n+\t/* Sequence number is within the window */\n+\n+\t/* Find out the word */\n+\tseqword = ((seq - 1) % ex_winsz) >> WORD_SHIFT;\n+\n+\t/* Find out the bit in the word */\n+\tbit_pos = (seq - 1) & WORD_MASK;\n+\n+\t/* Check if this is a replayed packet */\n+\tif (window[seqword] & (1ull << (63 - bit_pos)))\n+\t\treturn IPSEC_ANTI_REPLAY_FAILED;\n+\n+\t/*\n+\t * Set the bit corresponding to sequence number\n+\t * in window to mark it as received\n+\t */\n+\twindow[seqword] |= (1ull << (63 - bit_pos));\n+\n+\treturn 0;\n+}\n+\n+#endif /* __CNXK_SECURITY_AR_H__ */\n",
    "prefixes": [
        "13/27"
    ]
}