Show a patch.

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

{
    "id": 44098,
    "url": "http://patches.dpdk.org/api/patches/44098/",
    "web_url": "http://patches.dpdk.org/patch/44098/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<1535718368-15803-2-git-send-email-amo@semihalf.com>",
    "date": "2018-08-31T12:25:57",
    "name": "[v2,1/8] net/bonding: fix buf corruption in packets",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": true,
    "hash": "aa54c9e44e6a7e49730d4333425916bbdb9eb265",
    "submitter": {
        "id": 1112,
        "url": "http://patches.dpdk.org/api/people/1112/",
        "name": "Andrzej Ostruszka",
        "email": "amo@semihalf.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@intel.com"
    },
    "mbox": "http://patches.dpdk.org/patch/44098/mbox/",
    "series": [
        {
            "id": 1131,
            "url": "http://patches.dpdk.org/api/series/1131/",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1131",
            "date": "2018-08-31T12:25:56",
            "name": "Add Marvell NETA PMD",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/1131/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/44098/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/44098/checks/",
    "tags": {},
    "headers": {
        "X-Mailman-Version": "2.1.15",
        "In-Reply-To": "<1535718368-15803-1-git-send-email-amo@semihalf.com>",
        "Errors-To": "dev-bounces@dpdk.org",
        "X-Mailer": "git-send-email 2.7.4",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 86E0E4F9C;\n\tFri, 31 Aug 2018 14:26:14 +0200 (CEST)",
            "from mail-lf1-f68.google.com (mail-lf1-f68.google.com\n\t[209.85.167.68]) by dpdk.org (Postfix) with ESMTP id 0B4B84CB5\n\tfor <dev@dpdk.org>; Fri, 31 Aug 2018 14:26:12 +0200 (CEST)",
            "by mail-lf1-f68.google.com with SMTP id v77-v6so219604lfa.6\n\tfor <dev@dpdk.org>; Fri, 31 Aug 2018 05:26:12 -0700 (PDT)",
            "from amok.semihalf.local (31-172-191-173.noc.fibertech.net.pl.\n\t[31.172.191.173]) by smtp.googlemail.com with ESMTPSA id\n\tt4-v6sm1825422lfd.13.2018.08.31.05.26.10\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tFri, 31 Aug 2018 05:26:10 -0700 (PDT)"
        ],
        "References": "<1535469030-18647-1-git-send-email-amo@semihalf.com>\n\t<1535718368-15803-1-git-send-email-amo@semihalf.com>",
        "X-Google-Smtp-Source": "ANB0VdZFsAKjt9ILPBwpn0eXYlVZ+QgmX95iuDO1EOP/3SZTD6bGq6iolHqGFy67/Fb01BFTHKQ2/w==",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=semihalf-com.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=adsAaIh09rnKQyCcEk7Ku64QY1pTOPAH2rD/OyEFEuc=;\n\tb=DUeC/DPzQjm/QjOMupmDXh0HeLlwSOJL5c/gO69vcFalh4ugat/RlpgVwYdGVu4eTv\n\tgn/AbKINM7GWnGaTfwOAnolkjlDTypziU0pJ4Dxsgnz0my44Bf+s8iuzeukctIL6hsGZ\n\t0fv/n8TO6FHGxCT7uuTAbbFpb4UO4qjQsfdDNaniDxpQxnlN83YY9Yf3P67PWGIITJkD\n\troG8WS9s9PaDYfCVYOBudLR1VFO3RR8KkYWn0DqTNHMeeQS+EjVLkU8O17fljHmC6ULF\n\t1LKaQDyuyYSWSpR6u+d7fhD3vXFfbqc+5HUXNqVClflk6X9OnJoQnedhwTTaiJdCRVIE\n\tR8IA==",
        "X-BeenThere": "dev@dpdk.org",
        "X-Received": "by 2002:a19:c4c9:: with SMTP id\n\tu192-v6mr9812690lff.87.1535718371472; \n\tFri, 31 Aug 2018 05:26:11 -0700 (PDT)",
        "Message-Id": "<1535718368-15803-2-git-send-email-amo@semihalf.com>",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=adsAaIh09rnKQyCcEk7Ku64QY1pTOPAH2rD/OyEFEuc=;\n\tb=j9s8rykXb/fZSH2W+cqmAwX7mHyiXp0dvHWNYVniNi34SV0987ik7THTUTnvPyzQJA\n\tXR1T5mFoQZUxl0WicnXC2V0XNMYncpfsfQ1yh6eb0snVgF+cawgdZs3Hz8vxUKZdkLpw\n\tgTgx4Ks3UdQTt1NL7wCLNY7ZYW/ASXQUvWkeKLA7SaZIhZq5R+0OFAtBzQkQWLS86Wdj\n\tYMyLgQg5HOk3HpVIJ17YJVpZoXMemuiqW3/GY2iMKB2tWKYk/vAuvqrSU+//AL7XjGII\n\tcB8Q/o5qLsXMPsuFWyCUbObAfVyyrrfyMrJHxA36/lDWPlYaT3EkeiMCzxdiXgX/yMGh\n\tGDmg==",
        "Delivered-To": "patchwork@dpdk.org",
        "Precedence": "list",
        "From": "Andrzej Ostruszka <amo@semihalf.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Sender": "\"dev\" <dev-bounces@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>",
        "To": "dev@dpdk.org",
        "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>",
        "Date": "Fri, 31 Aug 2018 14:25:57 +0200",
        "X-Gm-Message-State": "APzg51CzUEzuuyTZJ6DtAt9tkJtg7YZloGswUt0pIW786HmbO28pW7/C\n\tOSn4sQ+ISKoNCRag7PcdZ+2HasxyjCI=",
        "Cc": "mw@semihalf.com, zr@semihalf.com, tdu@semihalf.com, nsamsono@marvell.com,\n\tJia Yu <jyu@vmware.com>, stable@dpdk.org",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Subject": "[dpdk-dev] [PATCH v2 1/8] net/bonding: fix buf corruption in packets"
    },
    "content": "From: Jia Yu <jyu@vmware.com>\n\nWhen bond slave devices cannot transmit all packets in bufs array,\ntx_burst callback shall merge the un-transmitted packets back to\nbufs array. Recent merge logic introduced a bug which causes\ninvalid mbuf addresses being written to bufs array.\nWhen caller frees the un-transmitted packets, due to invalid addresses,\napplication will crash.\n\nThe fix is avoid shifting mbufs, and directly write un-transmitted\npackets back to bufs array.\n\nFixes: 09150784a776 (\"net/bonding: burst mode hash calculation\")\nCc: stable@dpdk.org\n\nSigned-off-by: Jia Yu <jyu@vmware.com>\nAcked-by: Chas Williams <chas3@att.com>\n---\n drivers/net/bonding/rte_eth_bond_pmd.c | 116 +++++++--------------------------\n 1 file changed, 23 insertions(+), 93 deletions(-)",
    "diff": "diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c\nindex 4417422..b84f322 100644\n--- a/drivers/net/bonding/rte_eth_bond_pmd.c\n+++ b/drivers/net/bonding/rte_eth_bond_pmd.c\n@@ -301,10 +301,10 @@ bond_ethdev_tx_burst_8023ad_fast_queue(void *queue, struct rte_mbuf **bufs,\n \t/* Mapping array generated by hash function to map mbufs to slaves */\n \tuint16_t bufs_slave_port_idxs[RTE_MAX_ETHPORTS] = { 0 };\n \n-\tuint16_t slave_tx_count, slave_tx_fail_count[RTE_MAX_ETHPORTS] = { 0 };\n+\tuint16_t slave_tx_count;\n \tuint16_t total_tx_count = 0, total_tx_fail_count = 0;\n \n-\tuint16_t i, j;\n+\tuint16_t i;\n \n \tif (unlikely(nb_bufs == 0))\n \t\treturn 0;\n@@ -359,34 +359,12 @@ bond_ethdev_tx_burst_8023ad_fast_queue(void *queue, struct rte_mbuf **bufs,\n \n \t\t/* If tx burst fails move packets to end of bufs */\n \t\tif (unlikely(slave_tx_count < slave_nb_bufs[i])) {\n-\t\t\tslave_tx_fail_count[i] = slave_nb_bufs[i] -\n+\t\t\tint slave_tx_fail_count = slave_nb_bufs[i] -\n \t\t\t\t\tslave_tx_count;\n-\t\t\ttotal_tx_fail_count += slave_tx_fail_count[i];\n-\n-\t\t\t/*\n-\t\t\t * Shift bufs to beginning of array to allow reordering\n-\t\t\t * later\n-\t\t\t */\n-\t\t\tfor (j = 0; j < slave_tx_fail_count[i]; j++) {\n-\t\t\t\tslave_bufs[i][j] =\n-\t\t\t\t\tslave_bufs[i][(slave_tx_count - 1) + j];\n-\t\t\t}\n-\t\t}\n-\t}\n-\n-\t/*\n-\t * If there are tx burst failures we move packets to end of bufs to\n-\t * preserve expected PMD behaviour of all failed transmitted being\n-\t * at the end of the input mbuf array\n-\t */\n-\tif (unlikely(total_tx_fail_count > 0)) {\n-\t\tint bufs_idx = nb_bufs - total_tx_fail_count - 1;\n-\n-\t\tfor (i = 0; i < slave_count; i++) {\n-\t\t\tif (slave_tx_fail_count[i] > 0) {\n-\t\t\t\tfor (j = 0; j < slave_tx_fail_count[i]; j++)\n-\t\t\t\t\tbufs[bufs_idx++] = slave_bufs[i][j];\n-\t\t\t}\n+\t\t\ttotal_tx_fail_count += slave_tx_fail_count;\n+\t\t\tmemcpy(&bufs[nb_bufs - total_tx_fail_count],\n+\t\t\t       &slave_bufs[i][slave_tx_count],\n+\t\t\t       slave_tx_fail_count * sizeof(bufs[0]));\n \t\t}\n \t}\n \n@@ -716,8 +694,8 @@ bond_ethdev_tx_burst_round_robin(void *queue, struct rte_mbuf **bufs,\n \t\t\t\ttx_fail_total += tx_fail_slave;\n \n \t\t\t\tmemcpy(&bufs[nb_pkts - tx_fail_total],\n-\t\t\t\t\t\t&slave_bufs[i][num_tx_slave],\n-\t\t\t\t\t\ttx_fail_slave * sizeof(bufs[0]));\n+\t\t\t\t       &slave_bufs[i][num_tx_slave],\n+\t\t\t\t       tx_fail_slave * sizeof(bufs[0]));\n \t\t\t}\n \t\t\tnum_tx_total += num_tx_slave;\n \t\t}\n@@ -1222,10 +1200,10 @@ bond_ethdev_tx_burst_balance(void *queue, struct rte_mbuf **bufs,\n \t/* Mapping array generated by hash function to map mbufs to slaves */\n \tuint16_t bufs_slave_port_idxs[nb_bufs];\n \n-\tuint16_t slave_tx_count, slave_tx_fail_count[RTE_MAX_ETHPORTS] = { 0 };\n+\tuint16_t slave_tx_count;\n \tuint16_t total_tx_count = 0, total_tx_fail_count = 0;\n \n-\tuint16_t i, j;\n+\tuint16_t i;\n \n \tif (unlikely(nb_bufs == 0))\n \t\treturn 0;\n@@ -1266,34 +1244,12 @@ bond_ethdev_tx_burst_balance(void *queue, struct rte_mbuf **bufs,\n \n \t\t/* If tx burst fails move packets to end of bufs */\n \t\tif (unlikely(slave_tx_count < slave_nb_bufs[i])) {\n-\t\t\tslave_tx_fail_count[i] = slave_nb_bufs[i] -\n+\t\t\tint slave_tx_fail_count = slave_nb_bufs[i] -\n \t\t\t\t\tslave_tx_count;\n-\t\t\ttotal_tx_fail_count += slave_tx_fail_count[i];\n-\n-\t\t\t/*\n-\t\t\t * Shift bufs to beginning of array to allow reordering\n-\t\t\t * later\n-\t\t\t */\n-\t\t\tfor (j = 0; j < slave_tx_fail_count[i]; j++) {\n-\t\t\t\tslave_bufs[i][j] =\n-\t\t\t\t\tslave_bufs[i][(slave_tx_count - 1) + j];\n-\t\t\t}\n-\t\t}\n-\t}\n-\n-\t/*\n-\t * If there are tx burst failures we move packets to end of bufs to\n-\t * preserve expected PMD behaviour of all failed transmitted being\n-\t * at the end of the input mbuf array\n-\t */\n-\tif (unlikely(total_tx_fail_count > 0)) {\n-\t\tint bufs_idx = nb_bufs - total_tx_fail_count - 1;\n-\n-\t\tfor (i = 0; i < slave_count; i++) {\n-\t\t\tif (slave_tx_fail_count[i] > 0) {\n-\t\t\t\tfor (j = 0; j < slave_tx_fail_count[i]; j++)\n-\t\t\t\t\tbufs[bufs_idx++] = slave_bufs[i][j];\n-\t\t\t}\n+\t\t\ttotal_tx_fail_count += slave_tx_fail_count;\n+\t\t\tmemcpy(&bufs[nb_bufs - total_tx_fail_count],\n+\t\t\t       &slave_bufs[i][slave_tx_count],\n+\t\t\t       slave_tx_fail_count * sizeof(bufs[0]));\n \t\t}\n \t}\n \n@@ -1320,10 +1276,10 @@ bond_ethdev_tx_burst_8023ad(void *queue, struct rte_mbuf **bufs,\n \t/* Mapping array generated by hash function to map mbufs to slaves */\n \tuint16_t bufs_slave_port_idxs[RTE_MAX_ETHPORTS] = { 0 };\n \n-\tuint16_t slave_tx_count, slave_tx_fail_count[RTE_MAX_ETHPORTS] = { 0 };\n+\tuint16_t slave_tx_count;\n \tuint16_t total_tx_count = 0, total_tx_fail_count = 0;\n \n-\tuint16_t i, j;\n+\tuint16_t i;\n \n \tif (unlikely(nb_bufs == 0))\n \t\treturn 0;\n@@ -1381,39 +1337,13 @@ bond_ethdev_tx_burst_8023ad(void *queue, struct rte_mbuf **bufs,\n \n \t\t\t/* If tx burst fails move packets to end of bufs */\n \t\t\tif (unlikely(slave_tx_count < slave_nb_bufs[i])) {\n-\t\t\t\tslave_tx_fail_count[i] = slave_nb_bufs[i] -\n+\t\t\t\tint slave_tx_fail_count = slave_nb_bufs[i] -\n \t\t\t\t\t\tslave_tx_count;\n-\t\t\t\ttotal_tx_fail_count += slave_tx_fail_count[i];\n-\n-\t\t\t\t/*\n-\t\t\t\t * Shift bufs to beginning of array to allow\n-\t\t\t\t * reordering later\n-\t\t\t\t */\n-\t\t\t\tfor (j = 0; j < slave_tx_fail_count[i]; j++)\n-\t\t\t\t\tslave_bufs[i][j] =\n-\t\t\t\t\t\tslave_bufs[i]\n-\t\t\t\t\t\t\t[(slave_tx_count - 1)\n-\t\t\t\t\t\t\t+ j];\n-\t\t\t}\n-\t\t}\n+\t\t\t\ttotal_tx_fail_count += slave_tx_fail_count;\n \n-\t\t/*\n-\t\t * If there are tx burst failures we move packets to end of\n-\t\t * bufs to preserve expected PMD behaviour of all failed\n-\t\t * transmitted being at the end of the input mbuf array\n-\t\t */\n-\t\tif (unlikely(total_tx_fail_count > 0)) {\n-\t\t\tint bufs_idx = nb_bufs - total_tx_fail_count - 1;\n-\n-\t\t\tfor (i = 0; i < slave_count; i++) {\n-\t\t\t\tif (slave_tx_fail_count[i] > 0) {\n-\t\t\t\t\tfor (j = 0;\n-\t\t\t\t\t\tj < slave_tx_fail_count[i];\n-\t\t\t\t\t\tj++) {\n-\t\t\t\t\t\tbufs[bufs_idx++] =\n-\t\t\t\t\t\t\tslave_bufs[i][j];\n-\t\t\t\t\t}\n-\t\t\t\t}\n+\t\t\t\tmemcpy(&bufs[nb_bufs - total_tx_fail_count],\n+\t\t\t\t       &slave_bufs[i][slave_tx_count],\n+\t\t\t\t       slave_tx_fail_count * sizeof(bufs[0]));\n \t\t\t}\n \t\t}\n \t}\n",
    "prefixes": [
        "v2",
        "1/8"
    ]
}