get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 59683,
    "url": "https://patches.dpdk.org/api/patches/59683/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1569338383-11118-1-git-send-email-hkalra@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": "<1569338383-11118-1-git-send-email-hkalra@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1569338383-11118-1-git-send-email-hkalra@marvell.com",
    "date": "2019-09-24T15:20:24",
    "name": "test/bpf: add new test cases",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "e15cbd9a6db90080b0c51b8dbd83ee57380c7f21",
    "submitter": {
        "id": 1182,
        "url": "https://patches.dpdk.org/api/people/1182/?format=api",
        "name": "Harman Kalra",
        "email": "hkalra@marvell.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1569338383-11118-1-git-send-email-hkalra@marvell.com/mbox/",
    "series": [
        {
            "id": 6505,
            "url": "https://patches.dpdk.org/api/series/6505/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=6505",
            "date": "2019-09-24T15:20:24",
            "name": "test/bpf: add new test cases",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/6505/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/59683/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/59683/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 CE7852BEA;\n\tTue, 24 Sep 2019 17:21:23 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n\t[67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 884412BCE\n\tfor <dev@dpdk.org>; Tue, 24 Sep 2019 17:21:22 +0200 (CEST)",
            "from pps.filterd (m0045851.ppops.net [127.0.0.1])\n\tby mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id\n\tx8OFKlpT022665; Tue, 24 Sep 2019 08:21:21 -0700",
            "from sc-exch02.marvell.com ([199.233.58.182])\n\tby mx0b-0016f401.pphosted.com with ESMTP id 2v7nq1804k-5\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); \n\tTue, 24 Sep 2019 08:21:21 -0700",
            "from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH02.marvell.com\n\t(10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3;\n\tTue, 24 Sep 2019 08:20:26 -0700",
            "from NAM05-BY2-obe.outbound.protection.outlook.com (104.47.50.55)\n\tby SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server\n\t(TLS) id\n\t15.0.1367.3 via Frontend Transport; Tue, 24 Sep 2019 08:20:26 -0700",
            "from MN2PR18MB2848.namprd18.prod.outlook.com (20.179.21.149) by\n\tMN2PR18MB2591.namprd18.prod.outlook.com (20.179.82.13) with Microsoft\n\tSMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n\t15.20.2284.23; Tue, 24 Sep 2019 15:20:25 +0000",
            "from MN2PR18MB2848.namprd18.prod.outlook.com\n\t([fe80::196f:da3c:751b:8ffa]) by\n\tMN2PR18MB2848.namprd18.prod.outlook.com\n\t([fe80::196f:da3c:751b:8ffa%7]) with mapi id 15.20.2284.023;\n\tTue, 24 Sep 2019 15:20:24 +0000"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n\th=from : to : cc :\n\tsubject : date : message-id : content-type :\n\tcontent-transfer-encoding : mime-version; s=pfpt0818;\n\tbh=kbXmjtba48b2cSWRyYbobpzNLCAsOAl98kvcug87UDg=; \n\tb=Tpc5QK8lu1f8rl1qn3ejzeie/KEkTvf+r6G83PImierARNUZL6VEtLg/GnprZM2o3W2W\n\t2SU/+4XbaULAqc0drz7SV+ypZvVlPQesPmInSgIdzbn2gfcPB8y+01uQBVL2T9nbDVsq\n\tt9BVRQETHgVU/OFmEvy415MdIui77OD5d3pm+DhLCn6BRoBcMyvLFASqrI6XpF26kKE2\n\tknytCYvz6h/EMbqF917fhgZegpfbs9lIKoJ1mRAGGBaxxE9EMZT7Hi+bPoWKlAF++gdM\n\tMRzBfL6kAjAHHfZRJGHmTZZoMQzQQD3V5alujh/Hn6WY4R+vRqO4PSXzpPEwL/edbMN8\n\t8w== ",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n\tbh=kbXmjtba48b2cSWRyYbobpzNLCAsOAl98kvcug87UDg=;\n\tb=aaexGY6Ss0jEBOcrNaFUAtCTD2LJyz6WBh8dmuiZn9LUMnfQxEDFWPtD4S1kxKcaw0DVjvDTBdpK9UxUcDr7ffEtPxQGqnMlf97uKP+K+Qdw06eYkzYWoK7fvAgd30DOHj1FsQflEXHAGx13MZYEaCsw9gK7kScP7XRMMqz6go8="
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;\n\tb=HK78AH2op2DijjddxUxxBvx/tNPH7wEfEFnpb7VFbDkn8HcBUgETtVf/kpBBiNQE+ByNma6AWWLNYKbFv/RO6uM2W6mhhA8MhsJTSEg3dcKQk5rJ20uuHM0tzqMva5S3pKAif1Z95Cnu+jMct/Oh5feoKlfmH7v51MjFEhZQO/gOWffHs3XZArSK4ytpQA59ayNPcDYDNgX09FL3lf528kp6G/oOFTs9HRpK45YfSeS83QrLwKEN7V50knUgagTdDm/q4OzyymSPn9kx2AGy3NVt3iHMtl8R1ta4S/+ZhLd2slb3DpTLUOXyf52mIKlbbPYKQMrF6lkBZuHuCOgyWA==",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n\ts=arcselector9901;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n\tbh=kbXmjtba48b2cSWRyYbobpzNLCAsOAl98kvcug87UDg=;\n\tb=fefa8xEmQ/k3R/nZ+zOaelIlcufCHCRtp/t/iCMnO5uPzALv5G5CsXWj3pIYyHAH1DXLJCQSUTtGItwP0B5460cAzvdmiJSwb60ndUOxzifjgAMj5z3LALJHHxAoABcYANRnXvV2x32Q0dlGMEl+NHjdGeul35ZlDcxL5saLUqPRcpZH+/QMQYyK5wj8K2FqPjsFcT4N/Hpr2dsaqEm46qJclolJAT46u5wMFlTscp6y4CtH1GnFAg+Rx9fGp2BDrZ7rR3Tx8XZS2RZD5rPxbMwddA8Qs2lo3KAFG3rvWFLJmjHghBqV8dJ/phIEOdudzwLm9c0SMvIMDJiEd+pjGQ==",
        "ARC-Authentication-Results": "i=1; mx.microsoft.com 1; spf=pass\n\tsmtp.mailfrom=marvell.com;\n\tdmarc=pass action=none header.from=marvell.com; \n\tdkim=pass header.d=marvell.com; arc=none",
        "From": "Harman Kalra <hkalra@marvell.com>",
        "To": "Konstantin Ananyev <konstantin.ananyev@intel.com>",
        "CC": "\"dev@dpdk.org\" <dev@dpdk.org>, Harman Kalra <hkalra@marvell.com>",
        "Thread-Topic": "[PATCH] test/bpf: add new test cases",
        "Thread-Index": "AQHVcuuWfPAukSSWCkez/k1/g6T2dA==",
        "Date": "Tue, 24 Sep 2019 15:20:24 +0000",
        "Message-ID": "<1569338383-11118-1-git-send-email-hkalra@marvell.com>",
        "Accept-Language": "en-GB, en-US",
        "Content-Language": "en-US",
        "X-MS-Has-Attach": "",
        "X-MS-TNEF-Correlator": "",
        "x-clientproxiedby": "BMXPR01CA0015.INDPRD01.PROD.OUTLOOK.COM\n\t(2603:1096:b00:d::25) To MN2PR18MB2848.namprd18.prod.outlook.com\n\t(2603:10b6:208:3e::21)",
        "x-ms-exchange-messagesentrepresentingtype": "1",
        "x-mailer": "git-send-email 2.7.4",
        "x-originating-ip": "[115.113.156.2]",
        "x-ms-publictraffictype": "Email",
        "x-ms-office365-filtering-correlation-id": "49eba447-751c-4faa-f77b-08d74102b8f6",
        "x-microsoft-antispam": "BCL:0; PCL:0;\n\tRULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600167)(711020)(4605104)(1401327)(2017052603328)(7193020);\n\tSRVR:MN2PR18MB2591; ",
        "x-ms-traffictypediagnostic": "MN2PR18MB2591:",
        "x-ms-exchange-transport-forked": "True",
        "x-microsoft-antispam-prvs": "<MN2PR18MB25915E46420466CAF2575EFDC5840@MN2PR18MB2591.namprd18.prod.outlook.com>",
        "x-ms-oob-tlc-oobclassifiers": "OLM:1169;",
        "x-forefront-prvs": "0170DAF08C",
        "x-forefront-antispam-report": "SFV:NSPM;\n\tSFS:(10009020)(4636009)(376002)(366004)(39860400002)(136003)(346002)(396003)(189003)(199004)(81156014)(8676002)(81166006)(305945005)(7736002)(66946007)(50226002)(3846002)(6116002)(5660300002)(316002)(66066001)(64756008)(66556008)(66476007)(54906003)(478600001)(66446008)(2906002)(30864003)(14454004)(6486002)(25786009)(486006)(14444005)(256004)(52116002)(86362001)(99286004)(36756003)(6512007)(476003)(186003)(4326008)(2616005)(6436002)(55236004)(19627235002)(107886003)(71190400001)(6916009)(386003)(26005)(6506007)(71200400001)(102836004)(8936002);\n\tDIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2591;\n\tH:MN2PR18MB2848.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en;\n\tPTR:InfoNoRecords; MX:1; A:1; ",
        "received-spf": "None (protection.outlook.com: marvell.com does not designate\n\tpermitted sender hosts)",
        "x-ms-exchange-senderadcheck": "1",
        "x-microsoft-antispam-message-info": "GwUvvBpnVo81/AZXgkkEW2vfxzl83jT7yqw4GyxjxZhxB+/2cyHUfbNtFGNzD2lNx4AmYkzQHbq/DerF0ttVaJ0DSN1UiI8EhyfdPe9eWuUjeOR2/KrmVrdMivFVPmzArQXEHL7ULD/LCSltGoA0zaAV4u6F8FzEnhh75hO7DEPgj24jiUKaEet0NQXBLRqxjFpEZRSUGjcje93Gt5lHgdGTI1VOd0bftqofZkmszs9wEooo8VtzNcubSih+B4hNkNfq5poFnpRYX3xytK3HlYDKFSP4Q9k+XS5anabQDIdHvCE1fmUbt9XNgYE6JacEyj3YnR9RaADYgRlVx8FboZqydDdJ7rjR90yx0PYJaDLjRoFE/rtOkrTHmZ9NnN5OojSWbzhpAbh3AFaYiS5gvFd1nt9N+3jcb6LaYau4Krk=",
        "Content-Type": "text/plain; charset=\"iso-8859-1\"",
        "Content-Transfer-Encoding": "quoted-printable",
        "MIME-Version": "1.0",
        "X-MS-Exchange-CrossTenant-Network-Message-Id": "49eba447-751c-4faa-f77b-08d74102b8f6",
        "X-MS-Exchange-CrossTenant-originalarrivaltime": "24 Sep 2019 15:20:24.7346\n\t(UTC)",
        "X-MS-Exchange-CrossTenant-fromentityheader": "Hosted",
        "X-MS-Exchange-CrossTenant-id": "70e1fb47-1155-421d-87fc-2e58f638b6e0",
        "X-MS-Exchange-CrossTenant-mailboxtype": "HOSTED",
        "X-MS-Exchange-CrossTenant-userprincipalname": "syku7ZOb/f6NKEcNyjbSixbsNd2PCvNuP601r4TY6poZF2ElCWIkrRPjsoecmuBV/q0KQIYZ7wokyq3G5rHJdg==",
        "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "MN2PR18MB2591",
        "X-OriginatorOrg": "marvell.com",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10434:6.0.95,1.0.8\n\tdefinitions=2019-09-24_06:2019-09-23,2019-09-24 signatures=0",
        "Subject": "[dpdk-dev] [PATCH] test/bpf: add new test cases",
        "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": "This patch implements following new test cases:\n- test_call4: test case to verify if stack corruption occurs\nacross with multiple function calls.\n- test_jump2: test case with a default packet in memory, parse\nthe packet and check if dest ip is part of a subnet.\n- test_call5: test case with string data in the stack and\ncalling string comaprision.\n\nSigned-off-by: Harman Kalra <hkalra@marvell.com>\n---\n app/test/test_bpf.c | 644 ++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 644 insertions(+)",
    "diff": "diff --git a/app/test/test_bpf.c b/app/test/test_bpf.c\nindex e8841800a..c6b9819fc 100644\n--- a/app/test/test_bpf.c\n+++ b/app/test/test_bpf.c\n@@ -14,6 +14,8 @@\n #include <rte_byteorder.h>\n #include <rte_errno.h>\n #include <rte_bpf.h>\n+#include <rte_ether.h>\n+#include <rte_ip.h>\n \n #include \"test.h\"\n \n@@ -35,6 +37,12 @@ struct dummy_vect8 {\n \tstruct dummy_offset out[8];\n };\n \n+struct dummy_net {\n+\tstruct rte_ether_hdr eth_hdr;\n+\tstruct rte_vlan_hdr vlan_hdr;\n+\tstruct rte_ipv4_hdr ip_hdr;\n+};\n+\n #define\tTEST_FILL_1\t0xDEADBEEF\n \n #define\tTEST_MUL_1\t21\n@@ -54,6 +62,20 @@ struct dummy_vect8 {\n #define TEST_IMM_4\t((uint64_t)UINT32_MAX)\n #define TEST_IMM_5\t((uint64_t)UINT32_MAX + 1)\n \n+#define TEST_MEMFROB\t0x2a2a2a2a\n+\n+#define STRING_GEEK\t0x6B656567\n+#define STRING_WEEK\t0x6B656577\n+\n+#define TEST_NETMASK 0xffffff00\n+#define TEST_SUBNET  0xaca80200\n+\n+uint8_t src_mac[] = { 0x00, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF };\n+uint8_t dst_mac[] = { 0x00, 0xAA, 0xFF, 0xAA, 0xFF, 0xAA };\n+\n+uint32_t ip_src_addr = (172U << 24) | (168U << 16) | (2 << 8) | 1;\n+uint32_t ip_dst_addr = (172U << 24) | (168U << 16) | (2 << 8) | 2;\n+\n struct bpf_test {\n \tconst char *name;\n \tsize_t arg_sz;\n@@ -866,6 +888,181 @@ test_jump1_check(uint64_t rc, const void *arg)\n \treturn cmp_res(__func__, rv, rc, &rv, &rc, sizeof(rv));\n }\n \n+/* Jump test case - check ip4_dest in particular subnet */\n+static const struct ebpf_insn test_jump2_prog[] = {\n+\n+\t[0] = {\n+\t\t.code = (EBPF_ALU64 | EBPF_MOV | BPF_K),\n+\t\t.dst_reg = EBPF_REG_2,\n+\t\t.imm = 0xe,\n+\t},\n+\t[1] = {\n+\t\t.code = (BPF_LDX | BPF_MEM | BPF_H),\n+\t\t.dst_reg = EBPF_REG_3,\n+\t\t.src_reg = EBPF_REG_1,\n+\t\t.off = 12,\n+\t},\n+\t[2] = {\n+\t\t.code = (BPF_JMP | EBPF_JNE | BPF_K),\n+\t\t.dst_reg = EBPF_REG_3,\n+\t\t.off = 2,\n+\t\t.imm = 0x81,\n+\t},\n+\t[3] = {\n+\t\t.code = (EBPF_ALU64 | EBPF_MOV | BPF_K),\n+\t\t.dst_reg = EBPF_REG_2,\n+\t\t.imm = 0x12,\n+\t},\n+\t[4] = {\n+\t\t.code = (BPF_LDX | BPF_MEM | BPF_H),\n+\t\t.dst_reg = EBPF_REG_3,\n+\t\t.src_reg = EBPF_REG_1,\n+\t\t.off = 16,\n+\t},\n+\t[5] = {\n+\t\t.code = (EBPF_ALU64 | BPF_AND | BPF_K),\n+\t\t.dst_reg = EBPF_REG_3,\n+\t\t.imm = 0xffff,\n+\t},\n+\t[6] = {\n+\t\t.code = (BPF_JMP | EBPF_JNE | BPF_K),\n+\t\t.dst_reg = EBPF_REG_3,\n+\t\t.off = 9,\n+\t\t.imm = 0x8,\n+\t},\n+\t[7] = {\n+\t\t.code = (EBPF_ALU64 | BPF_ADD | BPF_X),\n+\t\t.dst_reg = EBPF_REG_1,\n+\t\t.src_reg = EBPF_REG_2,\n+\t},\n+\t[8] = {\n+\t\t.code = (EBPF_ALU64 | EBPF_MOV | BPF_K),\n+\t\t.dst_reg = EBPF_REG_0,\n+\t\t.imm = 0,\n+\t},\n+\t[9] = {\n+\t\t.code = (BPF_LDX | BPF_MEM | BPF_W),\n+\t\t.dst_reg = EBPF_REG_1,\n+\t\t.src_reg = EBPF_REG_1,\n+\t\t.off = 16,\n+\t},\n+\t[10] = {\n+\t\t.code = (BPF_ALU | EBPF_MOV | BPF_K),\n+\t\t.dst_reg = EBPF_REG_3,\n+\t\t.imm = TEST_NETMASK,\n+\t},\n+\t[11] = {\n+\t\t.code = (BPF_ALU | EBPF_END | EBPF_TO_BE),\n+\t\t.dst_reg = EBPF_REG_3,\n+\t\t.imm = sizeof(uint32_t) * CHAR_BIT,\n+\t},\n+\t[12] = {\n+\t\t.code = (BPF_ALU | BPF_AND | BPF_X),\n+\t\t.dst_reg = EBPF_REG_1,\n+\t\t.src_reg = EBPF_REG_3,\n+\t},\n+\t[13] = {\n+\t\t.code = (BPF_ALU | EBPF_MOV | BPF_K),\n+\t\t.dst_reg = EBPF_REG_3,\n+\t\t.imm = TEST_SUBNET,\n+\t},\n+\t[14] = {\n+\t\t.code = (BPF_ALU | EBPF_END | EBPF_TO_BE),\n+\t\t.dst_reg = EBPF_REG_3,\n+\t\t.imm = sizeof(uint32_t) * CHAR_BIT,\n+\t},\n+\t[15] = {\n+\t\t.code = (BPF_JMP | BPF_JEQ | BPF_X),\n+\t\t.dst_reg = EBPF_REG_1,\n+\t\t.src_reg = EBPF_REG_3,\n+\t\t.off = 1,\n+\t},\n+\t[16] = {\n+\t\t.code = (EBPF_ALU64 | EBPF_MOV | BPF_K),\n+\t\t.dst_reg = EBPF_REG_0,\n+\t\t.imm = -1,\n+\t},\n+\t[17] = {\n+\t\t.code = (BPF_JMP | EBPF_EXIT),\n+\t},\n+};\n+\n+/* Preparing a vlan packet */\n+static void\n+test_jump2_prepare(void *arg)\n+{\n+\tstruct dummy_net *dn;\n+\n+\tdn = arg;\n+\tmemset(dn, 0, sizeof(*dn));\n+\n+\t/*\n+\t * Initialize ether header.\n+\t */\n+\trte_ether_addr_copy((struct rte_ether_addr *)dst_mac,\n+\t\t\t    &dn->eth_hdr.d_addr);\n+\trte_ether_addr_copy((struct rte_ether_addr *)src_mac,\n+\t\t\t    &dn->eth_hdr.s_addr);\n+\tdn->eth_hdr.ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN);\n+\n+\t/*\n+\t * Initialize vlan header.\n+\t */\n+\tdn->vlan_hdr.eth_proto =  rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);\n+\tdn->vlan_hdr.vlan_tci = 32;\n+\n+\t/*\n+\t * Initialize IP header.\n+\t */\n+\tdn->ip_hdr.version_ihl   = 0x45;    /*IP_VERSION | IP_HDRLEN*/\n+\tdn->ip_hdr.time_to_live   = 64;   /* IP_DEFTTL */\n+\tdn->ip_hdr.next_proto_id = IPPROTO_TCP;\n+\tdn->ip_hdr.packet_id = rte_cpu_to_be_16(0x463c);\n+\tdn->ip_hdr.total_length   = rte_cpu_to_be_16(60);\n+\tdn->ip_hdr.src_addr = rte_cpu_to_be_32(ip_src_addr);\n+\tdn->ip_hdr.dst_addr = rte_cpu_to_be_32(ip_dst_addr);\n+}\n+\n+static int\n+test_jump2_check(uint64_t rc, const void *arg)\n+{\n+\tconst struct rte_ether_hdr *eth_hdr = arg;\n+\tconst struct rte_ipv4_hdr *ipv4_hdr;\n+\tconst void *next = eth_hdr;\n+\tuint16_t eth_type;\n+\tuint64_t v = -1;\n+\n+\tif (eth_hdr->ether_type == htons(0x8100)) {\n+\t\tconst struct rte_vlan_hdr *vlan_hdr =\n+\t\t\t(const void *)(eth_hdr + 1);\n+\t\teth_type = vlan_hdr->eth_proto;\n+\t\tnext = vlan_hdr + 1;\n+\t} else {\n+\t\teth_type = eth_hdr->ether_type;\n+\t\tnext = eth_hdr + 1;\n+\t}\n+\n+\tif (eth_type == htons(0x0800)) {\n+\t\tipv4_hdr = next;\n+\t\tif ((ipv4_hdr->dst_addr & rte_cpu_to_be_32(TEST_NETMASK)) ==\n+\t\t    rte_cpu_to_be_32(TEST_SUBNET)) {\n+\t\t\tv = 0;\n+\t\t}\n+\t}\n+\n+\tif (v != rc) {\n+\t\tprintf(\"%s@%d: invalid return value \"\n+\t\t       \"expected=0x%\" PRIx64 \", actual=0x%\" PRIx64 \"\\n\",\n+\t\t       __func__, __LINE__, v, rc);\n+\t\treturn -1;\n+\t}\n+\n+\tif (v)\n+\t\tprintf(\"Either IP not part of subnet or wrong ethertype\\n\");\n+\n+\treturn 0;\n+}\n+\n /* alu (add, sub, and, or, xor, neg)  test-cases */\n static const struct ebpf_insn test_alu1_prog[] = {\n \n@@ -1889,6 +2086,403 @@ static const struct rte_bpf_xsym test_call3_xsym[] = {\n \t},\n };\n \n+/* Test for stack corruption in multiple function calls */\n+static const struct ebpf_insn test_call4_prog[] = {\n+\t{\n+\t\t.code = (BPF_ST | BPF_MEM | BPF_B),\n+\t\t.dst_reg = EBPF_REG_10,\n+\t\t.off = -4,\n+\t\t.imm = 1,\n+\t},\n+\t{\n+\t\t.code = (BPF_ST | BPF_MEM | BPF_B),\n+\t\t.dst_reg = EBPF_REG_10,\n+\t\t.off = -3,\n+\t\t.imm = 2,\n+\t},\n+\t{\n+\t\t.code = (BPF_ST | BPF_MEM | BPF_B),\n+\t\t.dst_reg = EBPF_REG_10,\n+\t\t.off = -2,\n+\t\t.imm = 3,\n+\t},\n+\t{\n+\t\t.code = (BPF_ST | BPF_MEM | BPF_B),\n+\t\t.dst_reg = EBPF_REG_10,\n+\t\t.off = -1,\n+\t\t.imm = 4,\n+\t},\n+\t{\n+\t\t.code = (EBPF_ALU64 | EBPF_MOV | BPF_X),\n+\t\t.dst_reg = EBPF_REG_1,\n+\t\t.src_reg = EBPF_REG_10,\n+\t},\n+\t{\n+\t\t.code = (EBPF_ALU64 | EBPF_MOV | BPF_K),\n+\t\t.dst_reg = EBPF_REG_2,\n+\t\t.imm = 4,\n+\t},\n+\t{\n+\t\t.code = (EBPF_ALU64 | BPF_SUB | BPF_X),\n+\t\t.dst_reg = EBPF_REG_1,\n+\t\t.src_reg = EBPF_REG_2,\n+\t},\n+\t{\n+\t\t.code = (BPF_JMP | EBPF_CALL),\n+\t\t.imm = 0,\n+\t},\n+\t{\n+\t\t.code = (BPF_LDX | BPF_MEM | BPF_B),\n+\t\t.dst_reg = EBPF_REG_1,\n+\t\t.src_reg = EBPF_REG_10,\n+\t\t.off = -4,\n+\t},\n+\t{\n+\t\t.code = (BPF_LDX | BPF_MEM | BPF_B),\n+\t\t.dst_reg = EBPF_REG_2,\n+\t\t.src_reg = EBPF_REG_10,\n+\t\t.off = -3,\n+\t},\n+\t{\n+\t\t.code = (BPF_LDX | BPF_MEM | BPF_B),\n+\t\t.dst_reg = EBPF_REG_3,\n+\t\t.src_reg = EBPF_REG_10,\n+\t\t.off = -2,\n+\t},\n+\t{\n+\t\t.code = (BPF_LDX | BPF_MEM | BPF_B),\n+\t\t.dst_reg = EBPF_REG_4,\n+\t\t.src_reg = EBPF_REG_10,\n+\t\t.off = -1,\n+\t},\n+\t{\n+\t\t.code = (BPF_JMP | EBPF_CALL),\n+\t\t.imm = 1,\n+\t},\n+\t{\n+\t\t.code = (EBPF_ALU64 | BPF_XOR | BPF_K),\n+\t\t.dst_reg = EBPF_REG_0,\n+\t\t.imm = TEST_MEMFROB,\n+\t},\n+\t{\n+\t\t.code = (BPF_JMP | EBPF_EXIT),\n+\t},\n+};\n+\n+/* Gathering the bytes together */\n+static uint32_t\n+dummy_func4_1(uint8_t a, uint8_t b, uint8_t c, uint8_t d)\n+{\n+\treturn (a << 24) | (b << 16) | (c << 8) | (d << 0);\n+}\n+\n+/* Implementation of memfrob */\n+static uint32_t\n+dummy_func4_0(uint32_t *s, uint8_t n)\n+{\n+\tchar *p = (char *) s;\n+\twhile (n-- > 0)\n+\t\t*p++ ^= 42;\n+\treturn *s;\n+}\n+\n+\n+static int\n+test_call4_check(uint64_t rc, const void *arg)\n+{\n+\tuint8_t a[4] = {1, 2, 3, 4};\n+\tuint32_t s, v = 0;\n+\n+\tRTE_SET_USED(arg);\n+\n+\ts = dummy_func4_0((uint32_t *)a, 4);\n+\n+\ts = dummy_func4_1(a[0], a[1], a[2], a[3]);\n+\n+\tv = s ^ TEST_MEMFROB;\n+\n+\tif (v != rc) {\n+\t\tprintf(\"%s@%d: invalid return value \"\n+\t\t\t\"expected=0x%\" PRIx32 \", actual=0x%\" PRIx64 \"\\n\",\n+\t\t\t__func__, __LINE__, v, rc);\n+\t\treturn -1;\n+\t}\n+\treturn 0;\n+}\n+\n+static const struct rte_bpf_xsym test_call4_xsym[] = {\n+\t[0] = {\n+\t\t.name = RTE_STR(dummy_func4_0),\n+\t\t.type = RTE_BPF_XTYPE_FUNC,\n+\t\t.func = {\n+\t\t\t.val = (void *)dummy_func4_0,\n+\t\t\t.nb_args = 2,\n+\t\t\t.args = {\n+\t\t\t\t[0] = {\n+\t\t\t\t\t.type = RTE_BPF_ARG_PTR,\n+\t\t\t\t\t.size = 4 * sizeof(uint8_t),\n+\t\t\t\t},\n+\t\t\t\t[1] = {\n+\t\t\t\t\t.type = RTE_BPF_ARG_RAW,\n+\t\t\t\t\t.size = sizeof(uint8_t),\n+\t\t\t\t},\n+\t\t\t},\n+\t\t\t.ret = {\n+\t\t\t\t.type = RTE_BPF_ARG_RAW,\n+\t\t\t\t.size = sizeof(uint32_t),\n+\t\t\t},\n+\t\t},\n+\t},\n+\t[1] = {\n+\t\t.name = RTE_STR(dummy_func4_1),\n+\t\t.type = RTE_BPF_XTYPE_FUNC,\n+\t\t.func = {\n+\t\t\t.val = (void *)dummy_func4_1,\n+\t\t\t.nb_args = 4,\n+\t\t\t.args = {\n+\t\t\t\t[0] = {\n+\t\t\t\t\t.type = RTE_BPF_ARG_RAW,\n+\t\t\t\t\t.size = sizeof(uint8_t),\n+\t\t\t\t},\n+\t\t\t\t[1] = {\n+\t\t\t\t\t.type = RTE_BPF_ARG_RAW,\n+\t\t\t\t\t.size = sizeof(uint8_t),\n+\t\t\t\t},\n+\t\t\t\t[2] = {\n+\t\t\t\t\t.type = RTE_BPF_ARG_RAW,\n+\t\t\t\t\t.size = sizeof(uint8_t),\n+\t\t\t\t},\n+\t\t\t\t[3] = {\n+\t\t\t\t\t.type = RTE_BPF_ARG_RAW,\n+\t\t\t\t\t.size = sizeof(uint8_t),\n+\t\t\t\t},\n+\t\t\t},\n+\t\t\t.ret = {\n+\t\t\t\t.type = RTE_BPF_ARG_RAW,\n+\t\t\t\t.size = sizeof(uint32_t),\n+\t\t\t},\n+\t\t},\n+\t},\n+};\n+\n+/* string compare test case */\n+static const struct ebpf_insn test_call5_prog[] = {\n+\n+\t[0] = {\n+\t\t.code = (EBPF_ALU64 | EBPF_MOV | BPF_K),\n+\t\t.dst_reg = EBPF_REG_1,\n+\t\t.imm = STRING_GEEK,\n+\t},\n+\t[1] = {\n+\t\t.code = (BPF_STX | BPF_MEM | BPF_W),\n+\t\t.dst_reg = EBPF_REG_10,\n+\t\t.src_reg = EBPF_REG_1,\n+\t\t.off = -8,\n+\t},\n+\t[2] = {\n+\t\t.code = (EBPF_ALU64 | EBPF_MOV | BPF_K),\n+\t\t.dst_reg = EBPF_REG_6,\n+\t\t.imm = 0,\n+\t},\n+\t[3] = {\n+\t\t.code = (BPF_STX | BPF_MEM | BPF_B),\n+\t\t.dst_reg = EBPF_REG_10,\n+\t\t.src_reg = EBPF_REG_6,\n+\t\t.off = -4,\n+\t},\n+\t[4] = {\n+\t\t.code = (BPF_STX | BPF_MEM | BPF_W),\n+\t\t.dst_reg = EBPF_REG_10,\n+\t\t.src_reg = EBPF_REG_6,\n+\t\t.off = -12,\n+\t},\n+\t[5] = {\n+\t\t.code = (EBPF_ALU64 | EBPF_MOV | BPF_K),\n+\t\t.dst_reg = EBPF_REG_1,\n+\t\t.imm = STRING_WEEK,\n+\t},\n+\t[6] = {\n+\t\t.code = (BPF_STX | BPF_MEM | BPF_W),\n+\t\t.dst_reg = EBPF_REG_10,\n+\t\t.src_reg = EBPF_REG_1,\n+\t\t.off = -16,\n+\t},\n+\t[7] = {\n+\t\t.code = (EBPF_ALU64 | EBPF_MOV | BPF_X),\n+\t\t.dst_reg = EBPF_REG_1,\n+\t\t.src_reg = EBPF_REG_10,\n+\t},\n+\t[8] = {\n+\t\t.code = (EBPF_ALU64 | BPF_ADD | BPF_K),\n+\t\t.dst_reg = EBPF_REG_1,\n+\t\t.imm = -8,\n+\t},\n+\t[9] = {\n+\t\t.code = (EBPF_ALU64 | EBPF_MOV | BPF_X),\n+\t\t.dst_reg = EBPF_REG_2,\n+\t\t.src_reg = EBPF_REG_1,\n+\t},\n+\t[10] = {\n+\t\t.code = (BPF_JMP | EBPF_CALL),\n+\t\t.imm = 0,\n+\t},\n+\t[11] = {\n+\t\t.code = (EBPF_ALU64 | EBPF_MOV | BPF_X),\n+\t\t.dst_reg = EBPF_REG_1,\n+\t\t.src_reg = EBPF_REG_0,\n+\t},\n+\t[12] = {\n+\t\t.code = (BPF_ALU | EBPF_MOV | BPF_K),\n+\t\t.dst_reg = EBPF_REG_0,\n+\t\t.imm = -1,\n+\t},\n+\t[13] = {\n+\t\t.code = (EBPF_ALU64 | BPF_LSH | BPF_K),\n+\t\t.dst_reg = EBPF_REG_1,\n+\t\t.imm = 0x20,\n+\t},\n+\t[14] = {\n+\t\t.code = (EBPF_ALU64 | BPF_RSH | BPF_K),\n+\t\t.dst_reg = EBPF_REG_1,\n+\t\t.imm = 0x20,\n+\t},\n+\t[15] = {\n+\t\t.code = (BPF_JMP | EBPF_JNE | BPF_K),\n+\t\t.dst_reg = EBPF_REG_1,\n+\t\t.off = 11,\n+\t\t.imm = 0,\n+\t},\n+\t[16] = {\n+\t\t.code = (EBPF_ALU64 | EBPF_MOV | BPF_X),\n+\t\t.dst_reg = EBPF_REG_1,\n+\t\t.src_reg = EBPF_REG_10,\n+\t},\n+\t[17] = {\n+\t\t.code = (EBPF_ALU64 | BPF_ADD | BPF_K),\n+\t\t.dst_reg = EBPF_REG_1,\n+\t\t.imm = -8,\n+\t},\n+\t[18] = {\n+\t\t.code = (EBPF_ALU64 | EBPF_MOV | BPF_X),\n+\t\t.dst_reg = EBPF_REG_2,\n+\t\t.src_reg = EBPF_REG_10,\n+\t},\n+\t[19] = {\n+\t\t.code = (EBPF_ALU64 | BPF_ADD | BPF_K),\n+\t\t.dst_reg = EBPF_REG_2,\n+\t\t.imm = -16,\n+\t},\n+\t[20] = {\n+\t\t.code = (BPF_JMP | EBPF_CALL),\n+\t\t.imm = 0,\n+\t},\n+\t[21] = {\n+\t\t.code = (EBPF_ALU64 | EBPF_MOV | BPF_X),\n+\t\t.dst_reg = EBPF_REG_1,\n+\t\t.src_reg = EBPF_REG_0,\n+\t},\n+\t[22] = {\n+\t\t.code = (EBPF_ALU64 | BPF_LSH | BPF_K),\n+\t\t.dst_reg = EBPF_REG_1,\n+\t\t.imm = 0x20,\n+\t},\n+\t[23] = {\n+\t\t.code = (EBPF_ALU64 | BPF_RSH | BPF_K),\n+\t\t.dst_reg = EBPF_REG_1,\n+\t\t.imm = 0x20,\n+\t},\n+\t[24] = {\n+\t\t.code = (EBPF_ALU64 | EBPF_MOV | BPF_X),\n+\t\t.dst_reg = EBPF_REG_0,\n+\t\t.src_reg = EBPF_REG_1,\n+\t},\n+\t[25] = {\n+\t\t.code = (BPF_JMP | BPF_JEQ | BPF_X),\n+\t\t.dst_reg = EBPF_REG_1,\n+\t\t.src_reg = EBPF_REG_6,\n+\t\t.off = 1,\n+\t},\n+\t[26] = {\n+\t\t.code = (EBPF_ALU64 | EBPF_MOV | BPF_K),\n+\t\t.dst_reg = EBPF_REG_0,\n+\t\t.imm = 0,\n+\t},\n+\t[27] = {\n+\t\t.code = (BPF_JMP | EBPF_EXIT),\n+\t},\n+};\n+\n+/* String comparision impelementation, return 0 if equal else difference */\n+static uint32_t\n+dummy_func5(const char *s1, const char *s2)\n+{\n+\twhile (*s1 && (*s1 == *s2)) {\n+\t\ts1++;\n+\t\ts2++;\n+\t}\n+\treturn *(const unsigned char *)s1 - *(const unsigned char *)s2;\n+}\n+\n+static int\n+test_call5_check(uint64_t rc, const void *arg)\n+{\n+\tchar a[] = \"geek\";\n+\tchar b[] = \"week\";\n+\tuint32_t v;\n+\n+\tRTE_SET_USED(arg);\n+\n+\tv = dummy_func5(a, a);\n+\tif (v != 0) {\n+\t\tv = -1;\n+\t\tgoto fail;\n+\t}\n+\n+\tv = dummy_func5(a, b);\n+\tif (v == 0)\n+\t\tgoto fail;\n+\n+\tv = 0;\n+\n+fail:\n+\tif (v != rc) {\n+\t\tprintf(\"%s@%d: invalid return value \"\n+\t\t       \"expected=0x%\" PRIx32 \", actual=0x%\" PRIx64 \"\\n\",\n+\t\t       __func__, __LINE__, v, rc);\n+\t\treturn -1;\n+\t}\n+\n+\tif (v)\n+\t\tprintf(\"String comparision test failed\\n\");\n+\n+\treturn 0;\n+}\n+\n+static const struct rte_bpf_xsym test_call5_xsym[] = {\n+\t[0] = {\n+\t\t.name = RTE_STR(dummy_func5),\n+\t\t.type = RTE_BPF_XTYPE_FUNC,\n+\t\t.func = {\n+\t\t\t.val = (void *)dummy_func5,\n+\t\t\t.nb_args = 2,\n+\t\t\t.args = {\n+\t\t\t\t[0] = {\n+\t\t\t\t\t.type = RTE_BPF_ARG_PTR,\n+\t\t\t\t\t.size = sizeof(char),\n+\t\t\t\t},\n+\t\t\t\t[1] = {\n+\t\t\t\t\t.type = RTE_BPF_ARG_PTR,\n+\t\t\t\t\t.size = sizeof(char),\n+\t\t\t\t},\n+\t\t\t},\n+\t\t\t.ret = {\n+\t\t\t\t.type = RTE_BPF_ARG_RAW,\n+\t\t\t\t.size = sizeof(uint32_t),\n+\t\t\t},\n+\t\t},\n+\t},\n+};\n+\n static const struct bpf_test tests[] = {\n \t{\n \t\t.name = \"test_store1\",\n@@ -1988,6 +2582,20 @@ static const struct bpf_test tests[] = {\n \t\t.prepare = test_jump1_prepare,\n \t\t.check_result = test_jump1_check,\n \t},\n+\t{\n+\t\t.name = \"test_jump2\",\n+\t\t.arg_sz = sizeof(struct dummy_net),\n+\t\t.prm = {\n+\t\t\t.ins = test_jump2_prog,\n+\t\t\t.nb_ins = RTE_DIM(test_jump2_prog),\n+\t\t\t.prog_arg = {\n+\t\t\t\t.type = RTE_BPF_ARG_PTR,\n+\t\t\t\t.size = sizeof(struct dummy_net),\n+\t\t\t},\n+\t\t},\n+\t\t.prepare = test_jump2_prepare,\n+\t\t.check_result = test_jump2_check,\n+\t},\n \t{\n \t\t.name = \"test_alu1\",\n \t\t.arg_sz = sizeof(struct dummy_vect8),\n@@ -2098,6 +2706,42 @@ static const struct bpf_test tests[] = {\n \t\t/* for now don't support function calls on 32 bit platform */\n \t\t.allow_fail = (sizeof(uint64_t) != sizeof(uintptr_t)),\n \t},\n+\t{\n+\t\t.name = \"test_call4\",\n+\t\t.arg_sz = sizeof(struct dummy_offset),\n+\t\t.prm = {\n+\t\t\t.ins = test_call4_prog,\n+\t\t\t.nb_ins = RTE_DIM(test_call4_prog),\n+\t\t\t.prog_arg = {\n+\t\t\t\t.type = RTE_BPF_ARG_PTR,\n+\t\t\t\t.size = 2 * sizeof(struct dummy_offset),\n+\t\t\t},\n+\t\t\t.xsym = test_call4_xsym,\n+\t\t\t.nb_xsym = RTE_DIM(test_call4_xsym),\n+\t\t},\n+\t\t.prepare = test_store1_prepare,\n+\t\t.check_result = test_call4_check,\n+\t\t/* for now don't support function calls on 32 bit platform */\n+\t\t.allow_fail = (sizeof(uint64_t) != sizeof(uintptr_t)),\n+\t},\n+\t{\n+\t\t.name = \"test_call5\",\n+\t\t.arg_sz = sizeof(struct dummy_offset),\n+\t\t.prm = {\n+\t\t\t.ins = test_call5_prog,\n+\t\t\t.nb_ins = RTE_DIM(test_call5_prog),\n+\t\t\t.prog_arg = {\n+\t\t\t\t.type = RTE_BPF_ARG_PTR,\n+\t\t\t\t.size = sizeof(struct dummy_offset),\n+\t\t\t},\n+\t\t\t.xsym = test_call5_xsym,\n+\t\t\t.nb_xsym = RTE_DIM(test_call5_xsym),\n+\t\t},\n+\t\t.prepare = test_store1_prepare,\n+\t\t.check_result = test_call5_check,\n+\t\t/* for now don't support function calls on 32 bit platform */\n+\t\t.allow_fail = (sizeof(uint64_t) != sizeof(uintptr_t)),\n+\t},\n };\n \n static int\n",
    "prefixes": []
}