get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 114886,
    "url": "https://patches.dpdk.org/api/patches/114886/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20220812095445.1253138-4-cristian.dumitrescu@intel.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": "<20220812095445.1253138-4-cristian.dumitrescu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220812095445.1253138-4-cristian.dumitrescu@intel.com",
    "date": "2022-08-12T09:54:44",
    "name": "[3/4] pipeline: support large default action arguments",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "8197745b25edd877defd119e7265a1d134b52199",
    "submitter": {
        "id": 19,
        "url": "https://patches.dpdk.org/api/people/19/?format=api",
        "name": "Cristian Dumitrescu",
        "email": "cristian.dumitrescu@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20220812095445.1253138-4-cristian.dumitrescu@intel.com/mbox/",
    "series": [
        {
            "id": 24289,
            "url": "https://patches.dpdk.org/api/series/24289/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=24289",
            "date": "2022-08-12T09:54:41",
            "name": "pipeline: support large structure fields",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/24289/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/114886/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/114886/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 3817FA0543;\n\tFri, 12 Aug 2022 11:55:06 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 1CE4B42C15;\n\tFri, 12 Aug 2022 11:54:53 +0200 (CEST)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n by mails.dpdk.org (Postfix) with ESMTP id DABC7410E7\n for <dev@dpdk.org>; Fri, 12 Aug 2022 11:54:50 +0200 (CEST)",
            "from orsmga008.jf.intel.com ([10.7.209.65])\n by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 12 Aug 2022 02:54:50 -0700",
            "from silpixa00400573.ir.intel.com (HELO\n silpixa00400573.ger.corp.intel.com.) ([10.237.223.157])\n by orsmga008.jf.intel.com with ESMTP; 12 Aug 2022 02:54:49 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1660298091; x=1691834091;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=cE8rODZCkPv1vlpC/wQGWIJa6ugz/lPWmiZo79mP12c=;\n b=eUubNfNsIbeXmUIQvFFTj0B/DM3lAsLPwdb+r/Ajeux5ucxn3NNeFNFj\n u6adJYjtIk3K9ssO10Blmr22Xqu0YsZOfScXet6OUI8oTCE5+rszaADBj\n 9RQKybIGMw2csxRxZBj4DZicHjvQs+dHkgkYX9fPYQJrLNB3EulBkpkQr\n SGNPj24agfem525hlv0eSfu0C66QnEA8il1188pRXgAbzXTv0lxi3SKUq\n 2u3TZhoKi8OYjyb8YJRtP/mft5e7D2bGc0jYmgwYS5S6E7KsH/dbgEc1v\n 2rQX/UlnmwtCI4QqFyCCKACYZTEiGd4w6kVELUhguuju951Y29ClCEYMx A==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6400,9594,10436\"; a=\"289135020\"",
            "E=Sophos;i=\"5.93,231,1654585200\"; d=\"scan'208\";a=\"289135020\"",
            "E=Sophos;i=\"5.93,231,1654585200\"; d=\"scan'208\";a=\"634589094\""
        ],
        "X-ExtLoop1": "1",
        "From": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Harshad Suresh Narayane <harshad.suresh.narayane@intel.com>",
        "Subject": "[PATCH 3/4] pipeline: support large default action arguments",
        "Date": "Fri, 12 Aug 2022 09:54:44 +0000",
        "Message-Id": "<20220812095445.1253138-4-cristian.dumitrescu@intel.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20220812095445.1253138-1-cristian.dumitrescu@intel.com>",
        "References": "<20220812095445.1253138-1-cristian.dumitrescu@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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": "Support structure fields bigger than 64 bits as default action\narguments.\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\nSigned-off-by: Harshad Suresh Narayane <harshad.suresh.narayane@intel.com>\n---\n lib/pipeline/rte_swx_pipeline.c | 89 +++++++++++++++++++++++++++++----\n 1 file changed, 78 insertions(+), 11 deletions(-)",
    "diff": "diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c\nindex 15c840b352..48b9df0fef 100644\n--- a/lib/pipeline/rte_swx_pipeline.c\n+++ b/lib/pipeline/rte_swx_pipeline.c\n@@ -7576,6 +7576,65 @@ action_arg_src_mov_count(struct action *a,\n \treturn n_users;\n }\n \n+static int\n+char_to_hex(char c, uint8_t *val)\n+{\n+\tif (c >= '0' && c <= '9') {\n+\t\t*val = c - '0';\n+\t\treturn 0;\n+\t}\n+\n+\tif (c >= 'A' && c <= 'F') {\n+\t\t*val = c - 'A' + 10;\n+\t\treturn 0;\n+\t}\n+\n+\tif (c >= 'a' && c <= 'f') {\n+\t\t*val = c - 'a' + 10;\n+\t\treturn 0;\n+\t}\n+\n+\treturn -EINVAL;\n+}\n+\n+static int\n+hex_string_parse(char *src, uint8_t *dst, uint32_t n_dst_bytes)\n+{\n+\tuint32_t i;\n+\n+\t/* Check input arguments. */\n+\tif (!src || !src[0] || !dst || !n_dst_bytes)\n+\t\treturn -EINVAL;\n+\n+\t/* Skip any leading \"0x\" or \"0X\" in the src string. */\n+\tif ((src[0] == '0') && (src[1] == 'x' || src[1] == 'X'))\n+\t\tsrc += 2;\n+\n+\t/* Convert each group of two hex characters in the src string to one byte in dst array. */\n+\tfor (i = 0; i < n_dst_bytes; i++) {\n+\t\tuint8_t a, b;\n+\t\tint status;\n+\n+\t\tstatus = char_to_hex(*src, &a);\n+\t\tif (status)\n+\t\t\treturn status;\n+\t\tsrc++;\n+\n+\t\tstatus = char_to_hex(*src, &b);\n+\t\tif (status)\n+\t\t\treturn status;\n+\t\tsrc++;\n+\n+\t\tdst[i] = a * 16 + b;\n+\t}\n+\n+\t/* Check for the end of the src string. */\n+\tif (*src)\n+\t\treturn -EINVAL;\n+\n+\treturn 0;\n+}\n+\n #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN\n #define field_ntoh(val, n_bits) (ntoh64((val) << (64 - n_bits)))\n #define field_hton(val, n_bits) (hton64((val) << (64 - n_bits)))\n@@ -7634,25 +7693,33 @@ action_args_parse(struct action *a, const char *args, uint8_t *data)\n \t\tstruct field *f = &a->st->fields[i];\n \t\tchar *arg_name = tokens[i * 2];\n \t\tchar *arg_val = tokens[i * 2 + 1];\n-\t\tuint64_t val;\n \n \t\tif (strcmp(arg_name, f->name)) {\n \t\t\tstatus = -EINVAL;\n \t\t\tgoto error;\n \t\t}\n \n-\t\tval = strtoull(arg_val, &arg_val, 0);\n-\t\tif (arg_val[0]) {\n-\t\t\tstatus = -EINVAL;\n-\t\t\tgoto error;\n-\t\t}\n+\t\tif (f->n_bits <= 64) {\n+\t\t\tuint64_t val;\n \n-\t\t/* Endianness conversion. */\n-\t\tif (a->args_endianness[i])\n-\t\t\tval = field_hton(val, f->n_bits);\n+\t\t\tval = strtoull(arg_val, &arg_val, 0);\n+\t\t\tif (arg_val[0]) {\n+\t\t\t\tstatus = -EINVAL;\n+\t\t\t\tgoto error;\n+\t\t\t}\n+\n+\t\t\t/* Endianness conversion. */\n+\t\t\tif (a->args_endianness[i])\n+\t\t\t\tval = field_hton(val, f->n_bits);\n+\n+\t\t\t/* Copy to entry. */\n+\t\t\tmemcpy(&data[offset], (uint8_t *)&val, f->n_bits / 8);\n+\t\t} else {\n+\t\t\tstatus = hex_string_parse(arg_val, &data[offset], f->n_bits / 8);\n+\t\t\tif (status)\n+\t\t\t\tgoto error;\n+\t\t}\n \n-\t\t/* Copy to entry. */\n-\t\tmemcpy(&data[offset], (uint8_t *)&val, f->n_bits / 8);\n \t\toffset += f->n_bits / 8;\n \t}\n \n",
    "prefixes": [
        "3/4"
    ]
}