get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 41306,
    "url": "https://patches.dpdk.org/api/patches/41306/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20180620014412.134350-1-yanglong.wu@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": "<20180620014412.134350-1-yanglong.wu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180620014412.134350-1-yanglong.wu@intel.com",
    "date": "2018-06-20T01:44:12",
    "name": "net/i40e: illegal pactket checking",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "7f8a8ff386048aff0420046d7bf125d8e0ff287a",
    "submitter": {
        "id": 879,
        "url": "https://patches.dpdk.org/api/people/879/?format=api",
        "name": "Yanglong Wu",
        "email": "yanglong.wu@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20180620014412.134350-1-yanglong.wu@intel.com/mbox/",
    "series": [
        {
            "id": 174,
            "url": "https://patches.dpdk.org/api/series/174/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=174",
            "date": "2018-06-20T01:44:12",
            "name": "net/i40e: illegal pactket checking",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/174/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/41306/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/41306/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 E978A1B489;\n\tWed, 20 Jun 2018 03:52:22 +0200 (CEST)",
            "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n\tby dpdk.org (Postfix) with ESMTP id 247061B488\n\tfor <dev@dpdk.org>; Wed, 20 Jun 2018 03:52:20 +0200 (CEST)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t19 Jun 2018 18:52:19 -0700",
            "from wuyanglong.sh.intel.com ([10.67.111.147])\n\tby orsmga002.jf.intel.com with ESMTP; 19 Jun 2018 18:52:18 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,245,1526367600\"; d=\"scan'208\";a=\"68396159\"",
        "From": "Yanglong Wu <yanglong.wu@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "qi.z.zhang@intel.com, konstantin.ananyev@intel.com,\n\tYanglong Wu <yanglong.wu@intel.com>",
        "Date": "Wed, 20 Jun 2018 09:44:12 +0800",
        "Message-Id": "<20180620014412.134350-1-yanglong.wu@intel.com>",
        "X-Mailer": "git-send-email 2.11.0",
        "In-Reply-To": "<20180608035412.91329-1-yanglong.wu@intel.com>",
        "References": "<20180608035412.91329-1-yanglong.wu@intel.com>",
        "Subject": "[dpdk-dev] [PATCH] net/i40e: illegal pactket checking",
        "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": "Some illegal packets will lead to TX/RX hang and\ncan't recover automatically. This patch check those\nillegal packets and protect TX/RX from hanging.\n\nSigned-off-by: Yanglong Wu <yanglong.wu@intel.com>\n---\nv2:\nfix coding style issue and spelling error\n---\nv3:\nrework as comments\n---\n drivers/net/i40e/i40e_rxtx.c | 15 +++++++++++----\n drivers/net/i40e/i40e_rxtx.h |  2 ++\n 2 files changed, 13 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c\nindex 6032d5541..e7916f99c 100644\n--- a/drivers/net/i40e/i40e_rxtx.c\n+++ b/drivers/net/i40e/i40e_rxtx.c\n@@ -1439,13 +1439,13 @@ i40e_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,\n \n \t\t/* Check for m->nb_segs to not exceed the limits. */\n \t\tif (!(ol_flags & PKT_TX_TCP_SEG)) {\n-\t\t\tif (m->nb_segs > I40E_TX_MAX_SEG ||\n-\t\t\t    m->nb_segs > I40E_TX_MAX_MTU_SEG) {\n+\t\t\tif (m->nb_segs > I40E_TX_MAX_MTU_SEG) {\n \t\t\t\trte_errno = -EINVAL;\n \t\t\t\treturn i;\n \t\t\t}\n-\t\t} else if ((m->tso_segsz < I40E_MIN_TSO_MSS) ||\n-\t\t\t\t(m->tso_segsz > I40E_MAX_TSO_MSS)) {\n+\t\t} else if (m->nb_segs > I40E_TX_MAX_SEG ||\n+\t\t\t   m->tso_segsz < I40E_MIN_TSO_MSS ||\n+\t\t\t   m->tso_segsz > I40E_MAX_TSO_MSS) {\n \t\t\t/* MSS outside the range (256B - 9674B) are considered\n \t\t\t * malicious\n \t\t\t */\n@@ -1458,6 +1458,13 @@ i40e_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,\n \t\t\treturn i;\n \t\t}\n \n+\t\t/* check the size of packet */\n+\t\tif (m->pkt_len > I40E_FRAME_SIZE_MAX ||\n+\t\t    m->pkt_len < I40E_TX_MIN_PKT_LEN) {\n+\t\t\trte_errno = -EINVAL;\n+\t\t\treturn i;\n+\t\t}\n+\n #ifdef RTE_LIBRTE_ETHDEV_DEBUG\n \t\tret = rte_validate_tx_offload(m);\n \t\tif (ret != 0) {\ndiff --git a/drivers/net/i40e/i40e_rxtx.h b/drivers/net/i40e/i40e_rxtx.h\nindex ea73a8a1b..3fc619af9 100644\n--- a/drivers/net/i40e/i40e_rxtx.h\n+++ b/drivers/net/i40e/i40e_rxtx.h\n@@ -30,6 +30,8 @@\n #define I40E_TX_MAX_SEG     UINT8_MAX\n #define I40E_TX_MAX_MTU_SEG 8\n \n+#define I40E_TX_MIN_PKT_LEN 17\n+\n #undef container_of\n #define container_of(ptr, type, member) ({ \\\n \t\ttypeof(((type *)0)->member)(*__mptr) = (ptr); \\\n",
    "prefixes": []
}