get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 85243,
    "url": "https://patches.dpdk.org/api/patches/85243/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1608125790-26496-1-git-send-email-luyicai@huawei.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": "<1608125790-26496-1-git-send-email-luyicai@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1608125790-26496-1-git-send-email-luyicai@huawei.com",
    "date": "2020-12-16T13:36:30",
    "name": "[v6] ip_frag: remove padding length of fragment",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "98efcfe3923300a8ed71cc77d324b081535f0b38",
    "submitter": {
        "id": 1719,
        "url": "https://patches.dpdk.org/api/people/1719/?format=api",
        "name": "Yicai Lu",
        "email": "luyicai@huawei.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/1608125790-26496-1-git-send-email-luyicai@huawei.com/mbox/",
    "series": [
        {
            "id": 14331,
            "url": "https://patches.dpdk.org/api/series/14331/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=14331",
            "date": "2020-12-16T13:36:30",
            "name": "[v6] ip_frag: remove padding length of fragment",
            "version": 6,
            "mbox": "https://patches.dpdk.org/series/14331/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/85243/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/85243/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id E3CB4A09EF;\n\tWed, 16 Dec 2020 14:37:14 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id BA4FCC9AA;\n\tWed, 16 Dec 2020 14:37:12 +0100 (CET)",
            "from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190])\n by dpdk.org (Postfix) with ESMTP id AB801C996;\n Wed, 16 Dec 2020 14:37:08 +0100 (CET)",
            "from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58])\n by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Cwx3p0HF2z15WJr;\n Wed, 16 Dec 2020 21:36:22 +0800 (CST)",
            "from localhost (10.174.243.72) by DGGEMS413-HUB.china.huawei.com\n (10.3.19.213) with Microsoft SMTP Server id 14.3.498.0; Wed, 16 Dec 2020\n 21:36:54 +0800"
        ],
        "From": "Yicai Lu <luyicai@huawei.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<konstantin.ananyev@intel.com>, <zhoujingbin@huawei.com>,\n <chenchanghu@huawei.com>, <jerry.lilijun@huawei.com>,\n <haifeng.lin@huawei.com>, <guohongzhi1@huawei.com>, <wangyunjian@huawei.com>,\n Yicai Lu <luyicai@huawei.com>, <stable@dpdk.org>",
        "Date": "Wed, 16 Dec 2020 21:36:30 +0800",
        "Message-ID": "<1608125790-26496-1-git-send-email-luyicai@huawei.com>",
        "X-Mailer": "git-send-email 1.9.5.msysgit.1",
        "In-Reply-To": "<1605706193-17192-1-git-send-email-luyicai@huawei.com>",
        "References": "<1605706193-17192-1-git-send-email-luyicai@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.174.243.72]",
        "X-CFilter-Loop": "Reflected",
        "Subject": "[dpdk-dev]  [PATCH v6] ip_frag: remove padding length of fragment",
        "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 <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": "In some situations, we would get several ip fragments, which total\ndata length is less than min_ip_len(64) and padding with zeros.\nWe simulated intermediate fragments by modifying the MTU.\nTo illustrate the problem, we simplify the packet format and\nignore the impact of the packet header.In namespace2,\na packet whose data length is 1520 is sent.\nWhen the packet passes tap2, the packet is divided into two\nfragments: fragment A and B, similar to (1520 = 1510 + 10).\nWhen the packet passes tap3, the larger fragment packet A is\ndivided into two fragments A1 and A2, similar to (1510 = 1500 + 10).\nFinally, the bond interface receives three fragments:\nA1, A2, and B (1520 = 1500 + 10 + 10).\nOne fragmented packet A2 is smaller than the minimum Ethernet\nframe length, so it needs to be padded.\n\n|---------------------------------------------------|\n|                      HOST                         |\n| |--------------|   |----------------------------| |\n| |      ns2     |   |      |--------------|      | |\n| |  |--------|  |   |  |--------|    |--------|  | |\n| |  |  tap1  |  |   |  |  tap2  | ns1|  tap3  |  | |\n| |  |mtu=1510|  |   |  |mtu=1510|    |mtu=1500|  | |\n| |--|1.1.1.1 |--|   |--|1.1.1.2 |----|2.1.1.1 |--| |\n|    |--------|         |--------|    |--------|    |\n|         |                 |              |        |\n|         |-----------------|              |        |\n|                                          |        |\n|                                      |--------|   |\n|                                      |  bond  |   |\n|--------------------------------------|mtu=1500|---|\n                                       |--------|\n\nWhen processing the preceding packets above,\nDPDK would aggregate fragmented packets A2 and B.\nAnd error packets are generated, which padding(zero)\nis displayed in the middle of the packet.\n\nA2 + B:\n0000   fa 16 3e 9f fb 82 fa 47 b2 57 dc 20 08 00 45 00\n0010   00 33 b4 66 00 ba 3f 01 c1 a5 01 01 01 01 02 01\n0020   01 02 c0 c1 c2 c3 c4 c5 c6 c7 00 00 00 00 00 00\n0030   00 00 00 00 00 00 00 00 00 00 00 00 c8 c9 ca cb\n0040   cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db\n0050   dc dd de df e0 e1 e2 e3 e4 e5 e6\n\nSo, we would calculate the length of padding, and remove\nthe padding in pkt_len and data_len before aggregation.\nAnd also we have the fix for both ipv4 and ipv6.\n\nFixes: 7f0983ee331c (\"ip_frag: check fragment length of incoming packet\")\nCc: stable@dpdk.org\n\nSigned-off-by: Yicai Lu <luyicai@huawei.com>\n---\nv5 -> v6: Have the fix for ipv6.\n---\n lib/librte_ip_frag/rte_ipv4_reassembly.c | 11 ++++++++---\n lib/librte_ip_frag/rte_ipv6_reassembly.c |  9 +++++++--\n 2 files changed, 15 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/lib/librte_ip_frag/rte_ipv4_reassembly.c b/lib/librte_ip_frag/rte_ipv4_reassembly.c\nindex 1dda8ac..69666c8 100644\n--- a/lib/librte_ip_frag/rte_ipv4_reassembly.c\n+++ b/lib/librte_ip_frag/rte_ipv4_reassembly.c\n@@ -104,6 +104,7 @@ struct rte_mbuf *\n \tconst unaligned_uint64_t *psd;\n \tuint16_t flag_offset, ip_ofs, ip_flag;\n \tint32_t ip_len;\n+\tint32_t trim;\n \n \tflag_offset = rte_be_to_cpu_16(ip_hdr->fragment_offset);\n \tip_ofs = (uint16_t)(flag_offset & RTE_IPV4_HDR_OFFSET_MASK);\n@@ -117,14 +118,15 @@ struct rte_mbuf *\n \n \tip_ofs *= RTE_IPV4_HDR_OFFSET_UNITS;\n \tip_len = rte_be_to_cpu_16(ip_hdr->total_length) - mb->l3_len;\n+\ttrim = mb->pkt_len - (ip_len + mb->l3_len + mb->l2_len);\n \n \tIP_FRAG_LOG(DEBUG, \"%s:%d:\\n\"\n-\t\t\"mbuf: %p, tms: %\" PRIu64\n-\t\t\", key: <%\" PRIx64 \", %#x>, ofs: %u, len: %d, flags: %#x\\n\"\n+\t\t\"mbuf: %p, tms: %\" PRIu64 \", key: <%\" PRIx64 \", %#x>\"\n+\t\t\"ofs: %u, len: %d, padding: %d, flags: %#x\\n\"\n \t\t\"tbl: %p, max_cycles: %\" PRIu64 \", entry_mask: %#x, \"\n \t\t\"max_entries: %u, use_entries: %u\\n\\n\",\n \t\t__func__, __LINE__,\n-\t\tmb, tms, key.src_dst[0], key.id, ip_ofs, ip_len, ip_flag,\n+\t\tmb, tms, key.src_dst[0], key.id, ip_ofs, ip_len, trim, ip_flag,\n \t\ttbl, tbl->max_cycles, tbl->entry_mask, tbl->max_entries,\n \t\ttbl->use_entries);\n \n@@ -134,6 +136,9 @@ struct rte_mbuf *\n \t\treturn NULL;\n \t}\n \n+\tif (unlikely(trim > 0))\n+\t\trte_pktmbuf_trim(mb, trim);\n+\n \t/* try to find/add entry into the fragment's table. */\n \tif ((fp = ip_frag_find(tbl, dr, &key, tms)) == NULL) {\n \t\tIP_FRAG_MBUF2DR(dr, mb);\ndiff --git a/lib/librte_ip_frag/rte_ipv6_reassembly.c b/lib/librte_ip_frag/rte_ipv6_reassembly.c\nindex ad01055..4037da0 100644\n--- a/lib/librte_ip_frag/rte_ipv6_reassembly.c\n+++ b/lib/librte_ip_frag/rte_ipv6_reassembly.c\n@@ -142,6 +142,7 @@ struct rte_mbuf *\n \tstruct ip_frag_key key;\n \tuint16_t ip_ofs;\n \tint32_t ip_len;\n+\tint32_t trim;\n \n \trte_memcpy(&key.src_dst[0], ip_hdr->src_addr, 16);\n \trte_memcpy(&key.src_dst[2], ip_hdr->dst_addr, 16);\n@@ -158,16 +159,17 @@ struct rte_mbuf *\n \t * this is what we remove from the payload len.\n \t */\n \tip_len = rte_be_to_cpu_16(ip_hdr->payload_len) - sizeof(*frag_hdr);\n+\ttrim = mb->pkt_len - (ip_len + mb->l3_len + mb->l2_len);\n \n \tIP_FRAG_LOG(DEBUG, \"%s:%d:\\n\"\n \t\t\"mbuf: %p, tms: %\" PRIu64\n \t\t\", key: <\" IPv6_KEY_BYTES_FMT \", %#x>, \"\n-\t\t\"ofs: %u, len: %d, flags: %#x\\n\"\n+\t\t\"ofs: %u, len: %d, padding: %d, flags: %#x\\n\"\n \t\t\"tbl: %p, max_cycles: %\" PRIu64 \", entry_mask: %#x, \"\n \t\t\"max_entries: %u, use_entries: %u\\n\\n\",\n \t\t__func__, __LINE__,\n \t\tmb, tms, IPv6_KEY_BYTES(key.src_dst), key.id, ip_ofs, ip_len,\n-\t\tRTE_IPV6_GET_MF(frag_hdr->frag_data),\n+\t\ttrim, RTE_IPV6_GET_MF(frag_hdr->frag_data),\n \t\ttbl, tbl->max_cycles, tbl->entry_mask, tbl->max_entries,\n \t\ttbl->use_entries);\n \n@@ -177,6 +179,9 @@ struct rte_mbuf *\n \t\treturn NULL;\n \t}\n \n+\tif (unlikely(trim > 0))\n+\t\trte_pktmbuf_trim(mb, trim);\n+\n \t/* try to find/add entry into the fragment's table. */\n \tfp = ip_frag_find(tbl, dr, &key, tms);\n \tif (fp == NULL) {\n",
    "prefixes": [
        "v6"
    ]
}