get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 91642,
    "url": "https://patches.dpdk.org/api/patches/91642/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1618571071-5927-2-git-send-email-tangchengchang@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": "<1618571071-5927-2-git-send-email-tangchengchang@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1618571071-5927-2-git-send-email-tangchengchang@huawei.com",
    "date": "2021-04-16T11:04:30",
    "name": "[RFC,1/2] net/bonding: add Tx prepare for bonding",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "be4b7f27ab247092a391f4485892dc3d0ace441f",
    "submitter": {
        "id": 1792,
        "url": "https://patches.dpdk.org/api/people/1792/?format=api",
        "name": "Chengchang Tang",
        "email": "tangchengchang@huawei.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/1618571071-5927-2-git-send-email-tangchengchang@huawei.com/mbox/",
    "series": [
        {
            "id": 16448,
            "url": "https://patches.dpdk.org/api/series/16448/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=16448",
            "date": "2021-04-16T11:04:29",
            "name": "add Tx prepare support for bonding device",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/16448/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/91642/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/91642/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 1FC0CA0C43;\n\tFri, 16 Apr 2021 13:04:37 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id C2F9C1415FB;\n\tFri, 16 Apr 2021 13:04:25 +0200 (CEST)",
            "from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35])\n by mails.dpdk.org (Postfix) with ESMTP id 1B0F8141163\n for <dev@dpdk.org>; Fri, 16 Apr 2021 13:04:21 +0200 (CEST)",
            "from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.60])\n by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4FMCvr1CWXzB1jR;\n Fri, 16 Apr 2021 19:02:00 +0800 (CST)",
            "from localhost.localdomain (10.69.192.56) by\n DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id\n 14.3.498.0; Fri, 16 Apr 2021 19:04:11 +0800"
        ],
        "From": "Chengchang Tang <tangchengchang@huawei.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<linuxarm@huawei.com>, <chas3@att.com>, <humin29@huawei.com>,\n <ferruh.yigit@intel.com>",
        "Date": "Fri, 16 Apr 2021 19:04:30 +0800",
        "Message-ID": "<1618571071-5927-2-git-send-email-tangchengchang@huawei.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1618571071-5927-1-git-send-email-tangchengchang@huawei.com>",
        "References": "<1618571071-5927-1-git-send-email-tangchengchang@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.69.192.56]",
        "X-CFilter-Loop": "Reflected",
        "Subject": "[dpdk-dev] [RFC 1/2] net/bonding: add Tx prepare for bonding",
        "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": "To use the HW offloads capability (e.g. checksum and TSO) in the Tx\ndirection, the upper-layer users need to call rte_eth_dev_prepare to do\nsome adjustment to the packets before sending them (e.g. processing\npseudo headers when Tx checksum offoad enabled). But, the tx_prepare\ncallback of the bond driver is not implemented. Therefore, related\noffloads can not be used unless the upper layer users process the packet\nproperly in their own application. But it is bad for the\ntransplantability.\n\nHowever, it is difficult to design the tx_prepare callback for bonding\ndriver. Because when a bonded device sends packets, the bonded device\nallocates the packets to different slave devices based on the real-time\nlink status and bonding mode. That is, it is very difficult for the\nbonding device to determine which slave device's prepare function should\nbe invoked. In addition, if the link status changes after the packets are\nprepared, the packets may fail to be sent because packets allocation may\nchange.\n\nSo, in this patch, the tx_prepare callback of bonding driver is not\nimplemented. Instead, the prepare function of the slave device is added to\nthe tx_burst callback. And a global variable is introduced to control\nwhether the bonded device need call the rte_eth_tx_prepare. If upper-layer\nusers need to use related offloads, they should enable the preparation\nfunction. In this way, the bonded device will call the rte_eth_tx_prepare\nfor the fast path packets in the tx_burst callback.\n\nNote:\nThe rte_eth_tx_prepare is not added to bond mode 3(Broadcast). This is\nbecause in broadcast mode, a packet needs to be sent by all slave ports.\nDifferent PMDs process the packets differently in tx_prepare. As a result,\nthe sent packet may be incorrect.\n\nSigned-off-by: Chengchang Tang <tangchengchang@huawei.com>\n---\n drivers/net/bonding/eth_bond_private.h |  1 +\n drivers/net/bonding/rte_eth_bond.h     | 29 +++++++++++++++++++++++++++++\n drivers/net/bonding/rte_eth_bond_api.c | 28 ++++++++++++++++++++++++++++\n drivers/net/bonding/rte_eth_bond_pmd.c | 33 +++++++++++++++++++++++++++++----\n drivers/net/bonding/version.map        |  5 +++++\n 5 files changed, 92 insertions(+), 4 deletions(-)\n\n--\n2.7.4",
    "diff": "diff --git a/drivers/net/bonding/eth_bond_private.h b/drivers/net/bonding/eth_bond_private.h\nindex 75fb8dc..72ec4a0 100644\n--- a/drivers/net/bonding/eth_bond_private.h\n+++ b/drivers/net/bonding/eth_bond_private.h\n@@ -126,6 +126,7 @@ struct bond_dev_private {\n \t/**< Flag for whether MAC address is user defined or not */\n\n \tuint8_t link_status_polling_enabled;\n+\tuint8_t tx_prepare_enabled;\n \tuint32_t link_status_polling_interval_ms;\n\n \tuint32_t link_down_delay_ms;\ndiff --git a/drivers/net/bonding/rte_eth_bond.h b/drivers/net/bonding/rte_eth_bond.h\nindex 874aa91..8ec09eb 100644\n--- a/drivers/net/bonding/rte_eth_bond.h\n+++ b/drivers/net/bonding/rte_eth_bond.h\n@@ -343,6 +343,35 @@ rte_eth_bond_link_up_prop_delay_set(uint16_t bonded_port_id,\n int\n rte_eth_bond_link_up_prop_delay_get(uint16_t bonded_port_id);\n\n+/**\n+ * Enable Tx prepare for bonded port\n+ *\n+ * To perform some HW offloads in the Tx direction, some PMDs need to call\n+ * rte_eth_tx_prepare to do some adjustment for packets. This function\n+ * enables packets preparation in the fast path for bonded device.\n+ *\n+ * @param bonded_port_id      Bonded device id\n+ *\n+ * @return\n+ *   0 on success, negative value otherwise.\n+ */\n+__rte_experimental\n+int\n+rte_eth_bond_tx_prepare_enable(uint16_t bonded_port_id);\n+\n+/**\n+ * Disable Tx prepare for bonded port\n+ *\n+ * This function disables Tx prepare for the fast path packets.\n+ *\n+ * @param bonded_port_id      Bonded device id\n+ *\n+ * @return\n+ *   0 on success, negative value otherwise.\n+ */\n+__rte_experimental\n+int\n+rte_eth_bond_tx_prepare_disable(uint16_t bonded_port_id);\n\n #ifdef __cplusplus\n }\ndiff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c\nindex 17e6ff8..b04806a 100644\n--- a/drivers/net/bonding/rte_eth_bond_api.c\n+++ b/drivers/net/bonding/rte_eth_bond_api.c\n@@ -1050,3 +1050,31 @@ rte_eth_bond_link_up_prop_delay_get(uint16_t bonded_port_id)\n\n \treturn internals->link_up_delay_ms;\n }\n+\n+int\n+rte_eth_bond_tx_prepare_enable(uint16_t bonded_port_id)\n+{\n+\tstruct bond_dev_private *internals;\n+\n+\tif (valid_bonded_port_id(bonded_port_id) != 0)\n+\t\treturn -1;\n+\n+\tinternals = rte_eth_devices[bonded_port_id].data->dev_private;\n+\tinternals->tx_prepare_enabled = 1;\n+\n+\treturn 0;\n+}\n+\n+int\n+rte_eth_bond_tx_prepare_disable(uint16_t bonded_port_id)\n+{\n+\tstruct bond_dev_private *internals;\n+\n+\tif (valid_bonded_port_id(bonded_port_id) != 0)\n+\t\treturn -1;\n+\n+\tinternals = rte_eth_devices[bonded_port_id].data->dev_private;\n+\tinternals->tx_prepare_enabled = 0;\n+\n+\treturn 0;\n+}\ndiff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c\nindex 2e9cea5..3b7870f 100644\n--- a/drivers/net/bonding/rte_eth_bond_pmd.c\n+++ b/drivers/net/bonding/rte_eth_bond_pmd.c\n@@ -606,8 +606,14 @@ bond_ethdev_tx_burst_round_robin(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\tint nb_prep_pkts = slave_nb_pkts[i];\n+\t\t\tif (internals->tx_prepare_enabled)\n+\t\t\t\tnb_prep_pkts = rte_eth_tx_prepare(slaves[i],\n+\t\t\t\t\t\tbd_tx_q->queue_id,\n+\t\t\t\t\t\tslave_bufs[i], nb_prep_pkts);\n+\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\t\t\tslave_bufs[i], nb_prep_pkts);\n\n \t\t\t/* if tx burst fails move packets to end of bufs */\n \t\t\tif (unlikely(num_tx_slave < slave_nb_pkts[i])) {\n@@ -632,6 +638,7 @@ bond_ethdev_tx_burst_active_backup(void *queue,\n {\n \tstruct bond_dev_private *internals;\n \tstruct bond_tx_queue *bd_tx_q;\n+\tint nb_prep_pkts = nb_pkts;\n\n \tbd_tx_q = (struct bond_tx_queue *)queue;\n \tinternals = bd_tx_q->dev_private;\n@@ -639,8 +646,13 @@ bond_ethdev_tx_burst_active_backup(void *queue,\n \tif (internals->active_slave_count < 1)\n \t\treturn 0;\n\n+\tif (internals->tx_prepare_enabled)\n+\t\tnb_prep_pkts =\n+\t\t\trte_eth_tx_prepare(internals->current_primary_port,\n+\t\t\t\tbd_tx_q->queue_id, bufs, nb_prep_pkts);\n+\n \treturn rte_eth_tx_burst(internals->current_primary_port, bd_tx_q->queue_id,\n-\t\t\tbufs, nb_pkts);\n+\t\t\tbufs, nb_prep_pkts);\n }\n\n static inline uint16_t\n@@ -939,6 +951,7 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)\n \t}\n\n \tfor (i = 0; i < num_of_slaves; i++) {\n+\t\tint nb_prep_pkts;\n \t\trte_eth_macaddr_get(slaves[i], &active_slave_addr);\n \t\tfor (j = num_tx_total; j < nb_pkts; j++) {\n \t\t\tif (j + 3 < nb_pkts)\n@@ -955,8 +968,14 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)\n #endif\n \t\t}\n\n+\t\tnb_prep_pkts = nb_pkts - num_tx_total;\n+\t\tif (internals->tx_prepare_enabled)\n+\t\t\tnb_prep_pkts = rte_eth_tx_prepare(slaves[i],\n+\t\t\t\t\tbd_tx_q->queue_id, bufs + num_tx_total,\n+\t\t\t\t\tnb_prep_pkts);\n+\n \t\tnum_tx_total += rte_eth_tx_burst(slaves[i], bd_tx_q->queue_id,\n-\t\t\t\tbufs + num_tx_total, nb_pkts - num_tx_total);\n+\t\t\t\tbufs + num_tx_total, nb_prep_pkts);\n\n \t\tif (num_tx_total == nb_pkts)\n \t\t\tbreak;\n@@ -1159,12 +1178,18 @@ tx_burst_balance(void *queue, struct rte_mbuf **bufs, uint16_t nb_bufs,\n\n \t/* Send packet burst on each slave device */\n \tfor (i = 0; i < slave_count; i++) {\n+\t\tint nb_prep_pkts;\n \t\tif (slave_nb_bufs[i] == 0)\n \t\t\tcontinue;\n+\t\tnb_prep_pkts = slave_nb_bufs[i];\n+\t\tif (internals->tx_prepare_enabled)\n+\t\t\tnb_prep_pkts = rte_eth_tx_prepare(slave_port_ids[i],\n+\t\t\t\t\tbd_tx_q->queue_id, slave_bufs[i],\n+\t\t\t\t\tnb_prep_pkts);\n\n \t\tslave_tx_count = rte_eth_tx_burst(slave_port_ids[i],\n \t\t\t\tbd_tx_q->queue_id, slave_bufs[i],\n-\t\t\t\tslave_nb_bufs[i]);\n+\t\t\t\tnb_prep_pkts);\n\n \t\ttotal_tx_count += slave_tx_count;\n\ndiff --git a/drivers/net/bonding/version.map b/drivers/net/bonding/version.map\nindex df81ee7..b642729 100644\n--- a/drivers/net/bonding/version.map\n+++ b/drivers/net/bonding/version.map\n@@ -31,3 +31,8 @@ DPDK_21 {\n\n \tlocal: *;\n };\n+\n+EXPERIMENTAL {\n+\trte_eth_bond_tx_prepare_disable;\n+\trte_eth_bond_tx_prepare_enable;\n+};\n",
    "prefixes": [
        "RFC",
        "1/2"
    ]
}