Show a patch.

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

{
    "id": 182,
    "url": "https://patches.dpdk.org/api/patches/182/?format=api",
    "web_url": "https://patches.dpdk.org/patch/182/",
    "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"
    },
    "msgid": "<1408456313-28812-5-git-send-email-declan.doherty@intel.com>",
    "date": "2014-08-19T13:51:51",
    "name": "[dpdk-dev,4/6] bond: free mbufs if transmission fails in bonding tx_burst functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "87139856827fec4ded5055309ea8d075df885e96",
    "submitter": {
        "id": 11,
        "url": "https://patches.dpdk.org/api/people/11/?format=api",
        "name": "Doherty, Declan",
        "email": "declan.doherty@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/patch/182/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/182/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/182/checks/",
    "tags": {},
    "headers": {
        "X-Mailman-Version": "2.1.15",
        "X-ExtLoop1": "1",
        "Received": [
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id 7F8495963\n\tfor <dev@dpdk.org>; Tue, 19 Aug 2014 15:48:38 +0200 (CEST)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby orsmga102.jf.intel.com with ESMTP; 19 Aug 2014 06:46:11 -0700",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga002.jf.intel.com with ESMTP; 19 Aug 2014 06:52:04 -0700",
            "from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com\n\t[10.237.217.46])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\ts7JDq3RO002079; Tue, 19 Aug 2014 14:52:03 +0100",
            "from sivswdev02.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev02.ir.intel.com with ESMTP id s7JDq3I4002922;\n\tTue, 19 Aug 2014 14:52:03 +0100",
            "(from dwdohert@localhost)\n\tby sivswdev02.ir.intel.com with  id s7JDq3GT002918;\n\tTue, 19 Aug 2014 14:52:03 +0100"
        ],
        "References": "<1408456313-28812-1-git-send-email-declan.doherty@intel.com>",
        "X-BeenThere": "dev@dpdk.org",
        "Message-Id": "<1408456313-28812-5-git-send-email-declan.doherty@intel.com>",
        "X-IronPort-AV": "E=Sophos;i=\"5.01,894,1400050800\"; d=\"scan'208\";a=\"590206519\"",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Precedence": "list",
        "From": "Declan Doherty <declan.doherty@intel.com>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "X-List-Received-Date": "Tue, 19 Aug 2014 13:48:40 -0000",
        "Return-Path": "<dwdohert@ecsmtp.ir.intel.com>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "In-Reply-To": "<1408456313-28812-1-git-send-email-declan.doherty@intel.com>",
        "To": "dev@dpdk.org",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Date": "Tue, 19 Aug 2014 14:51:51 +0100",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Subject": "[dpdk-dev] [PATCH 4/6] bond: free mbufs if transmission fails in\n\tbonding tx_burst functions"
    },
    "content": "Fixing a number of corner cases that if transmission failed on slave devices then this\ncould lead to leaked mbufs \n\n\nSigned-off-by: Declan Doherty <declan.doherty@intel.com>\n---\n app/test/test_link_bonding.c           |    4 +-\n lib/librte_pmd_bond/rte_eth_bond_pmd.c |   46 +++++++++++++++++++++++++-------\n 2 files changed, 38 insertions(+), 12 deletions(-)",
    "diff": "diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c\nindex 02823b6..3c265ee 100644\n--- a/app/test/test_link_bonding.c\n+++ b/app/test/test_link_bonding.c\n@@ -3415,7 +3415,7 @@ test_broadcast_tx_burst(void)\n \t/* Send burst on bonded port */\n \tnb_tx = rte_eth_tx_burst(test_params->bonded_port_id, 0, pkts_burst,\n \t\t\tburst_size);\n-\tif (nb_tx != burst_size * test_params->bonded_slave_count) {\n+\tif (nb_tx != burst_size) {\n \t\tprintf(\"Bonded Port (%d) rx burst failed, packets transmitted value (%u) not as expected (%d)\\n\",\n \t\t\t\ttest_params->bonded_port_id,\n \t\t\t\tnb_tx, burst_size);\n@@ -3770,7 +3770,7 @@ test_broadcast_verify_slave_link_status_change_behaviour(void)\n \t}\n \n \tif (rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt_burst[0][0],\n-\t\t\tburst_size) != (burst_size * slave_count)) {\n+\t\t\tburst_size) != burst_size) {\n \t\tprintf(\"rte_eth_tx_burst failed\\n\");\n \t\treturn -1;\n \t}\ndiff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c b/lib/librte_pmd_bond/rte_eth_bond_pmd.c\nindex 70123fc..ae9726e 100644\n--- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c\n+++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c\n@@ -101,7 +101,7 @@ bond_ethdev_tx_burst_round_robin(void *queue, struct rte_mbuf **bufs,\n \tuint8_t num_of_slaves;\n \tuint8_t slaves[RTE_MAX_ETHPORTS];\n \n-\tuint16_t num_tx_total = 0;\n+\tuint16_t num_tx_total = 0, num_tx_slave;\n \n \tstatic int slave_idx = 0;\n \tint i, cs_idx = 0;\n@@ -130,9 +130,17 @@ bond_ethdev_tx_burst_round_robin(void *queue, struct rte_mbuf **bufs,\n \n \t/* Send packet burst on each slave device */\n \tfor (i = 0; i < num_of_slaves; i++)\n-\t\tif (slave_nb_pkts[i] > 0)\n-\t\t\tnum_tx_total += rte_eth_tx_burst(slaves[i],\n+\t\tif (slave_nb_pkts[i] > 0) {\n+\t\t\tnum_tx_slave = rte_eth_tx_burst(slaves[i],\n \t\t\t\t\tbd_tx_q->queue_id, slave_bufs[i], slave_nb_pkts[i]);\n+\t\t\tnum_tx_total += num_tx_slave;\n+\n+\t\t\t/* if tx burst fails, free unsent mbufs */\n+\t\t\twhile (unlikely(num_tx_slave < slave_nb_pkts[i])) {\n+\t\t\t\trte_pktmbuf_free(slave_bufs[i][num_tx_slave]);\n+\t\t\t\tnum_tx_slave++;\n+\t\t\t}\n+\t\t}\n \n \treturn num_tx_total;\n }\n@@ -283,7 +291,7 @@ bond_ethdev_tx_burst_balance(void *queue, struct rte_mbuf **bufs,\n \tuint8_t num_of_slaves;\n \tuint8_t slaves[RTE_MAX_ETHPORTS];\n \n-\tuint16_t num_tx_total = 0;\n+\tuint16_t num_tx_total = 0, num_tx_slave = 0;\n \n \tint i, op_slave_id;\n \n@@ -315,11 +323,19 @@ bond_ethdev_tx_burst_balance(void *queue, struct rte_mbuf **bufs,\n \t/* Send packet burst on each slave device */\n \tfor (i = 0; i < num_of_slaves; i++) {\n \t\tif (slave_nb_pkts[i] > 0) {\n-\t\t\tnum_tx_total += rte_eth_tx_burst(slaves[i], bd_tx_q->queue_id,\n+\t\t\tnum_tx_slave = rte_eth_tx_burst(slaves[i], bd_tx_q->queue_id,\n \t\t\t\t\tslave_bufs[i], slave_nb_pkts[i]);\n+\t\t\tnum_tx_total += num_tx_slave;\n+\n+\t\t\t/* if tx burst fails, free unsent mbufs */\n+\t\t\twhile (unlikely(num_tx_slave < slave_nb_pkts[i])) {\n+\t\t\t\trte_pktmbuf_free(slave_bufs[i][num_tx_slave]);\n+\t\t\t\tnum_tx_slave++;\n+\t\t\t}\n \t\t}\n \t}\n \n+\n \treturn num_tx_total;\n }\n \n@@ -333,7 +349,7 @@ bond_ethdev_tx_burst_broadcast(void *queue, struct rte_mbuf **bufs,\n \tuint8_t num_of_slaves;\n \tuint8_t slaves[RTE_MAX_ETHPORTS];\n \n-\tuint16_t num_tx_total = 0;\n+\tuint16_t num_tx_slave = 0, max_tx_pkts = 0;\n \n \tint i;\n \n@@ -354,11 +370,21 @@ bond_ethdev_tx_burst_broadcast(void *queue, struct rte_mbuf **bufs,\n \t\trte_mbuf_refcnt_update(bufs[i], num_of_slaves - 1);\n \n \t/* Transmit burst on each active slave */\n-\tfor (i = 0; i < num_of_slaves; i++)\n-\t\tnum_tx_total += rte_eth_tx_burst(slaves[i], bd_tx_q->queue_id,\n-\t\t\t\tbufs, nb_pkts);\n+\tfor (i = 0; i < num_of_slaves; i++) {\n+\t\tnum_tx_slave = rte_eth_tx_burst(slaves[i], bd_tx_q->queue_id,\n+\t\t\t\t\tbufs, nb_pkts);\n \n-\treturn num_tx_total;\n+\t\tif (max_tx_pkts < num_tx_slave)\n+\t\t\tmax_tx_pkts = num_tx_slave;\n+\n+\t\t/* if tx burst fails, free unsent mbufs */\n+\t\twhile (unlikely(num_tx_slave < nb_pkts)) {\n+\t\t\trte_pktmbuf_free(bufs[num_tx_slave]);\n+\t\t\tnum_tx_slave++;\n+\t\t}\n+\t}\n+\n+\treturn max_tx_pkts;\n }\n \n void\n",
    "prefixes": [
        "dpdk-dev",
        "4/6"
    ]
}