get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 86742,
    "url": "https://patches.dpdk.org/api/patches/86742/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210118070428.36998-2-stevex.yang@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": "<20210118070428.36998-2-stevex.yang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210118070428.36998-2-stevex.yang@intel.com",
    "date": "2021-01-18T07:04:07",
    "name": "[v4,01/22] ethdev: fix MTU size exceeds max rx packet length",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "7baf65955890ee0d5ac7c4e7084d331c7869a383",
    "submitter": {
        "id": 1883,
        "url": "https://patches.dpdk.org/api/people/1883/?format=api",
        "name": "Steve Yang",
        "email": "stevex.yang@intel.com"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20210118070428.36998-2-stevex.yang@intel.com/mbox/",
    "series": [
        {
            "id": 14800,
            "url": "https://patches.dpdk.org/api/series/14800/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=14800",
            "date": "2021-01-18T07:04:06",
            "name": "fix rx packets dropped issue",
            "version": 4,
            "mbox": "https://patches.dpdk.org/series/14800/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/86742/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/86742/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 2EF65A0A03;\n\tMon, 18 Jan 2021 08:08:11 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 1B6A5140D1D;\n\tMon, 18 Jan 2021 08:08:11 +0100 (CET)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by mails.dpdk.org (Postfix) with ESMTP id 2E937140D0D\n for <dev@dpdk.org>; Mon, 18 Jan 2021 08:08:09 +0100 (CET)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 17 Jan 2021 23:08:08 -0800",
            "from intel-npg-odc-srv01.cd.intel.com ([10.240.178.136])\n by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 17 Jan 2021 23:08:06 -0800"
        ],
        "IronPort-SDR": [
            "\n mX61PBq5HDqTELhedrLk6C2eyPX+8Zyn8NNjbvAy+JV8LpAomWXjagWBqELEw8MIU/6KPeMEYz\n cXd0D1L3l4gA==",
            "\n B+JKqpv3Q9rwL7f0sR9iaM+QULv6KLAl2T42NMdJHvyWEEYue/wvoP+sNFFM0k9UiHX+pHFWYL\n /2hUV2lILzeg=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9867\"; a=\"197460148\"",
            "E=Sophos;i=\"5.79,355,1602572400\"; d=\"scan'208\";a=\"197460148\"",
            "E=Sophos;i=\"5.79,355,1602572400\"; d=\"scan'208\";a=\"355086718\""
        ],
        "From": "Steve Yang <stevex.yang@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Steve Yang <stevex.yang@intel.com>, Thomas Monjalon <thomas@monjalon.net>,\n Ferruh Yigit <ferruh.yigit@intel.com>,\n Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>",
        "Date": "Mon, 18 Jan 2021 07:04:07 +0000",
        "Message-Id": "<20210118070428.36998-2-stevex.yang@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20210118070428.36998-1-stevex.yang@intel.com>",
        "References": "<20210114094537.13661-1-stevex.yang@intel.com>\n <20210118070428.36998-1-stevex.yang@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v4 01/22] ethdev: fix MTU size exceeds max rx\n packet length",
        "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": "Ethdev is using default Ethernet overhead to decide if provided\n'max_rx_pkt_len' value is bigger than max (non jumbo) MTU value,\nand limits it to MAX if it is.\n\nSince the application/driver used Ethernet overhead is different than\nthe ethdev one, check result is wrong.\n\nIf the driver is using Ethernet overhead bigger than the default one,\nthe provided 'max_rx_pkt_len' is trimmed down, and in the driver when\ncorrect Ethernet overhead is used to convert back, the resulting MTU is\nless than the intended one, causing some packets to be dropped.\n\nLike,\napp     -> max_rx_pkt_len = 1500/*mtu*/ + 22/*overhead*/ = 1522\nethdev  -> 1522 > 1518/*MAX*/; max_rx_pkt_len = 1518\ndriver  -> MTU = 1518 - 22 = 1496\nPackets with size 1497-1500 are dropped although intention is to be able\nto send/receive them.\n\nThe fix is to make ethdev use the correct Ethernet overhead for port,\ninstead of default one.\n\nFixes: 59d0ecdbf0e1 (\"ethdev: MTU accessors\")\n\nCc: Thomas Monjalon <thomas@monjalon.net>\nCc: Ferruh Yigit <ferruh.yigit@intel.com>\nCc: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>\n\nSigned-off-by: Steve Yang <stevex.yang@intel.com>\n---\n lib/librte_ethdev/rte_ethdev.c | 25 ++++++++++++++++++++++---\n 1 file changed, 22 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c\nindex 17ddacc78d..71e1e9a6db 100644\n--- a/lib/librte_ethdev/rte_ethdev.c\n+++ b/lib/librte_ethdev/rte_ethdev.c\n@@ -1292,8 +1292,10 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,\n \tstruct rte_eth_dev *dev;\n \tstruct rte_eth_dev_info dev_info;\n \tstruct rte_eth_conf orig_conf;\n+\tuint16_t overhead_len;\n \tint diag;\n \tint ret;\n+\tuint16_t old_mtu;\n \n \tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n \n@@ -1319,10 +1321,20 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,\n \t\tmemcpy(&dev->data->dev_conf, dev_conf,\n \t\t       sizeof(dev->data->dev_conf));\n \n+\t/* Backup mtu for rollback */\n+\told_mtu = dev->data->mtu;\n+\n \tret = rte_eth_dev_info_get(port_id, &dev_info);\n \tif (ret != 0)\n \t\tgoto rollback;\n \n+\t/* Get the real Ethernet overhead length */\n+\tif (dev_info.max_mtu != UINT16_MAX &&\n+\t    dev_info.max_rx_pktlen > dev_info.max_mtu)\n+\t\toverhead_len = dev_info.max_rx_pktlen - dev_info.max_mtu;\n+\telse\n+\t\toverhead_len = RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;\n+\n \t/* If number of queues specified by application for both Rx and Tx is\n \t * zero, use driver preferred values. This cannot be done individually\n \t * as it is valid for either Tx or Rx (but not both) to be zero.\n@@ -1409,12 +1421,17 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,\n \t\t\tret = -EINVAL;\n \t\t\tgoto rollback;\n \t\t}\n+\n+\t\t/* Scale the MTU size to adapt max_rx_pkt_len */\n+\t\tdev->data->mtu = dev->data->dev_conf.rxmode.max_rx_pkt_len -\n+\t\t\t\toverhead_len;\n \t} else {\n-\t\tif (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN ||\n-\t\t\tdev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN)\n+\t\tuint16_t pktlen = dev_conf->rxmode.max_rx_pkt_len;\n+\t\tif (pktlen < RTE_ETHER_MIN_MTU + overhead_len ||\n+\t\t    pktlen > RTE_ETHER_MTU + overhead_len)\n \t\t\t/* Use default value */\n \t\t\tdev->data->dev_conf.rxmode.max_rx_pkt_len =\n-\t\t\t\t\t\t\tRTE_ETHER_MAX_LEN;\n+\t\t\t\t\t\tRTE_ETHER_MTU + overhead_len;\n \t}\n \n \t/*\n@@ -1549,6 +1566,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,\n \teth_dev_tx_queue_config(dev, 0);\n rollback:\n \tmemcpy(&dev->data->dev_conf, &orig_conf, sizeof(dev->data->dev_conf));\n+\tif (old_mtu != dev->data->mtu)\n+\t\tdev->data->mtu = old_mtu;\n \n \trte_ethdev_trace_configure(port_id, nb_rx_q, nb_tx_q, dev_conf, ret);\n \treturn ret;\n",
    "prefixes": [
        "v4",
        "01/22"
    ]
}