get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 78313,
    "url": "http://patches.dpdk.org/api/patches/78313/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200922085401.12272-6-huwei013@chinasoftinc.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<20200922085401.12272-6-huwei013@chinasoftinc.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200922085401.12272-6-huwei013@chinasoftinc.com",
    "date": "2020-09-22T08:53:49",
    "name": "[05/17] net/hns3: add TSO pseudo header calculation compatibility",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "2c27478e3d173291ec2564f9fb466bc76fb6e7c0",
    "submitter": {
        "id": 1537,
        "url": "http://patches.dpdk.org/api/people/1537/?format=api",
        "name": "Wei Hu (Xavier)",
        "email": "huwei013@chinasoftinc.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200922085401.12272-6-huwei013@chinasoftinc.com/mbox/",
    "series": [
        {
            "id": 12401,
            "url": "http://patches.dpdk.org/api/series/12401/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=12401",
            "date": "2020-09-22T08:53:46",
            "name": "updates for hns3 PMD driver",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/12401/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/78313/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/78313/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 8C04DA04E1;\n\tTue, 22 Sep 2020 11:02:39 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 9B7161DC1F;\n\tTue, 22 Sep 2020 10:55:12 +0200 (CEST)",
            "from incedge.chinasoftinc.com (unknown [114.113.233.8])\n by dpdk.org (Postfix) with ESMTP id D24331DAF8\n for <dev@dpdk.org>; Tue, 22 Sep 2020 10:54:56 +0200 (CEST)",
            "from mail.chinasoftinc.com ([10.168.0.51]) by\n incedge.chinasoftinc.com with ESMTP id uvs1pGGqwSo8Rezb (version=TLSv1\n cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO);\n Tue, 22 Sep 2020 16:54:55 +0800 (CST)",
            "from localhost.localdomain (120.133.139.157) by INCCAS001.ito.icss\n (10.168.0.60) with Microsoft SMTP Server id 14.3.487.0; Tue, 22 Sep 2020\n 16:54:53 +0800"
        ],
        "X-ASG-Debug-ID": "1600764894-149d111bae19b030002-TfluYd",
        "X-Barracuda-Envelope-From": "huwei013@chinasoftinc.com",
        "X-Barracuda-RBL-Trusted-Forwarder": [
            "10.168.0.51",
            "10.168.0.60"
        ],
        "X-ASG-Whitelist": "Client",
        "From": "\"Wei Hu (Xavier)\" <huwei013@chinasoftinc.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<xavier.huwei@huawei.com>",
        "Date": "Tue, 22 Sep 2020 16:53:49 +0800",
        "X-ASG-Orig-Subj": "[PATCH 05/17] net/hns3: add TSO pseudo header calculation\n compatibility",
        "Message-ID": "<20200922085401.12272-6-huwei013@chinasoftinc.com>",
        "X-Mailer": "git-send-email 2.9.5",
        "In-Reply-To": "<20200922085401.12272-1-huwei013@chinasoftinc.com>",
        "References": "<20200922085401.12272-1-huwei013@chinasoftinc.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[120.133.139.157]",
        "X-Barracuda-Connect": "UNKNOWN[10.168.0.51]",
        "X-Barracuda-Start-Time": "1600764895",
        "X-Barracuda-Encrypted": "ECDHE-RSA-AES256-SHA",
        "X-Barracuda-URL": "https://incspam.chinasofti.com:443/cgi-mod/mark.cgi",
        "X-Virus-Scanned": "by bsmtpd at chinasoftinc.com",
        "X-Barracuda-Scan-Msg-Size": "7812",
        "Subject": "[dpdk-dev] [PATCH 05/17] net/hns3: add TSO pseudo header\n\tcalculation compatibility",
        "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 <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": "From: \"Wei Hu (Xavier)\" <xavier.huwei@huawei.com>\n\nIn kunpeng 920, when process pkts which need TSO, the network driver\nneed to erase the L4 len value of the TCP TSO pseudo header and\nrecalculate the pseudo header checksum. kunpeng930 support not need\nto erase the L4 len value of the TCP TSO pseudo header.\n\nSigned-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>\nSigned-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>\nSigned-off-by: Chengchang Tang <tangchengchang@huawei.com>\n---\n drivers/net/hns3/hns3_ethdev.c    |  2 +\n drivers/net/hns3/hns3_ethdev.h    | 21 +++++++++-\n drivers/net/hns3/hns3_ethdev_vf.c |  2 +\n drivers/net/hns3/hns3_rxtx.c      | 82 ++++++++++++++++++++++++---------------\n drivers/net/hns3/hns3_rxtx.h      | 17 ++++++++\n 5 files changed, 92 insertions(+), 32 deletions(-)",
    "diff": "diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c\nindex ed4273b..9c9f264 100644\n--- a/drivers/net/hns3/hns3_ethdev.c\n+++ b/drivers/net/hns3/hns3_ethdev.c\n@@ -2916,6 +2916,7 @@ hns3_get_capability(struct hns3_hw *hw)\n \t\thw->intr.mapping_mode = HNS3_INTR_MAPPING_VEC_RSV_ONE;\n \t\thw->intr.coalesce_mode = HNS3_INTR_COALESCE_NON_QL;\n \t\thw->intr.gl_unit = HNS3_INTR_COALESCE_GL_UINT_2US;\n+\t\thw->tso_mode = HNS3_TSO_SW_CAL_PSEUDO_H_CSUM;\n \t\thw->vlan_mode = HNS3_SW_SHIFT_AND_DISCARD_MODE;\n \t\thw->min_tx_pkt_len = HNS3_HIP08_MIN_TX_PKT_LEN;\n \t\treturn 0;\n@@ -2932,6 +2933,7 @@ hns3_get_capability(struct hns3_hw *hw)\n \thw->intr.mapping_mode = HNS3_INTR_MAPPING_VEC_ALL;\n \thw->intr.coalesce_mode = HNS3_INTR_COALESCE_QL;\n \thw->intr.gl_unit = HNS3_INTR_COALESCE_GL_UINT_1US;\n+\thw->tso_mode = HNS3_TSO_HW_CAL_PSEUDO_H_CSUM;\n \thw->vlan_mode = HNS3_HW_SHIFT_AND_DISCARD_MODE;\n \thw->min_tx_pkt_len = HNS3_HIP09_MIN_TX_PKT_LEN;\n \ndiff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h\nindex a70223f..f170df9 100644\n--- a/drivers/net/hns3/hns3_ethdev.h\n+++ b/drivers/net/hns3/hns3_ethdev.h\n@@ -416,6 +416,9 @@ struct hns3_queue_intr {\n \tuint8_t gl_unit;\n };\n \n+#define HNS3_TSO_SW_CAL_PSEUDO_H_CSUM\t\t0\n+#define HNS3_TSO_HW_CAL_PSEUDO_H_CSUM\t\t1\n+\n struct hns3_hw {\n \tstruct rte_eth_dev_data *data;\n \tvoid *io_base;\n@@ -476,7 +479,23 @@ struct hns3_hw {\n \tuint32_t min_tx_pkt_len;\n \n \tstruct hns3_queue_intr intr;\n-\n+\t/*\n+\t * tso mode.\n+\t * value range:\n+\t *      HNS3_TSO_SW_CAL_PSEUDO_H_CSUM/HNS3_TSO_HW_CAL_PSEUDO_H_CSUM\n+\t *\n+\t *  - HNS3_TSO_SW_CAL_PSEUDO_H_CSUM\n+\t *     In this mode, because of the hardware constraint, network driver\n+\t *     software need erase the L4 len value of the TCP pseudo header\n+\t *     and recalculate the TCP pseudo header checksum of packets that\n+\t *     need TSO.\n+\t *\n+\t *  - HNS3_TSO_HW_CAL_PSEUDO_H_CSUM\n+\t *     In this mode, hardware support recalculate the TCP pseudo header\n+\t *     checksum of packets that need TSO, so network driver software\n+\t *     not need to recalculate it.\n+\t */\n+\tuint8_t tso_mode;\n \t/*\n \t * vlan mode.\n \t * value range:\ndiff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c\nindex c39edf5..565cf60 100644\n--- a/drivers/net/hns3/hns3_ethdev_vf.c\n+++ b/drivers/net/hns3/hns3_ethdev_vf.c\n@@ -1165,6 +1165,7 @@ hns3vf_get_capability(struct hns3_hw *hw)\n \t\thw->intr.mapping_mode = HNS3_INTR_MAPPING_VEC_RSV_ONE;\n \t\thw->intr.coalesce_mode = HNS3_INTR_COALESCE_NON_QL;\n \t\thw->intr.gl_unit = HNS3_INTR_COALESCE_GL_UINT_2US;\n+\t\thw->tso_mode = HNS3_TSO_SW_CAL_PSEUDO_H_CSUM;\n \t\thw->min_tx_pkt_len = HNS3_HIP08_MIN_TX_PKT_LEN;\n \t\treturn 0;\n \t}\n@@ -1180,6 +1181,7 @@ hns3vf_get_capability(struct hns3_hw *hw)\n \thw->intr.mapping_mode = HNS3_INTR_MAPPING_VEC_ALL;\n \thw->intr.coalesce_mode = HNS3_INTR_COALESCE_QL;\n \thw->intr.gl_unit = HNS3_INTR_COALESCE_GL_UINT_1US;\n+\thw->tso_mode = HNS3_TSO_HW_CAL_PSEUDO_H_CSUM;\n \thw->min_tx_pkt_len = HNS3_HIP09_MIN_TX_PKT_LEN;\n \n \treturn 0;\ndiff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c\nindex 7c7b9de..930aa28 100644\n--- a/drivers/net/hns3/hns3_rxtx.c\n+++ b/drivers/net/hns3/hns3_rxtx.c\n@@ -2188,6 +2188,7 @@ hns3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc,\n \ttxq->io_tail_reg = (volatile void *)((char *)txq->io_base +\n \t\t\t\t\t     HNS3_RING_TX_TAIL_REG);\n \ttxq->min_tx_pkt_len = hw->min_tx_pkt_len;\n+\ttxq->tso_mode = hw->tso_mode;\n \ttxq->over_length_pkt_cnt = 0;\n \ttxq->exceed_limit_bd_pkt_cnt = 0;\n \ttxq->exceed_limit_bd_reassem_fail = 0;\n@@ -2858,47 +2859,66 @@ hns3_vld_vlan_chk(struct hns3_tx_queue *txq, struct rte_mbuf *m)\n }\n #endif\n \n-uint16_t\n-hns3_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,\n-\t       uint16_t nb_pkts)\n+static int\n+hns3_prep_pkt_proc(struct hns3_tx_queue *tx_queue, struct rte_mbuf *m)\n {\n-\tstruct hns3_tx_queue *txq;\n-\tstruct rte_mbuf *m;\n-\tuint16_t i;\n \tint ret;\n \n-\ttxq = (struct hns3_tx_queue *)tx_queue;\n-\n-\tfor (i = 0; i < nb_pkts; i++) {\n-\t\tm = tx_pkts[i];\n+#ifdef RTE_LIBRTE_ETHDEV_DEBUG\n+\tret = rte_validate_tx_offload(m);\n+\tif (ret != 0) {\n+\t\trte_errno = -ret;\n+\t\treturn ret;\n+\t}\n \n-\t\tif (hns3_pkt_is_tso(m) &&\n-\t\t    (hns3_pkt_need_linearized(m, m->nb_segs,\n-\t\t\t\t\t      txq->max_non_tso_bd_num) ||\n-\t\t     hns3_check_tso_pkt_valid(m))) {\n+\tret = hns3_vld_vlan_chk(tx_queue, m);\n+\tif (ret != 0) {\n+\t\trte_errno = EINVAL;\n+\t\treturn ret;\n+\t}\n+#endif\n+\tif (hns3_pkt_is_tso(m)) {\n+\t\tif (hns3_pkt_need_linearized(m, m->nb_segs,\n+\t\t\t\t\t     tx_queue->max_non_tso_bd_num) ||\n+\t\t    hns3_check_tso_pkt_valid(m)) {\n \t\t\trte_errno = EINVAL;\n-\t\t\treturn i;\n+\t\t\treturn -EINVAL;\n \t\t}\n \n-#ifdef RTE_LIBRTE_ETHDEV_DEBUG\n-\t\tret = rte_validate_tx_offload(m);\n-\t\tif (ret != 0) {\n-\t\t\trte_errno = -ret;\n-\t\t\treturn i;\n+\t\tif (tx_queue->tso_mode != HNS3_TSO_SW_CAL_PSEUDO_H_CSUM) {\n+\t\t\t/*\n+\t\t\t * (tso mode != HNS3_TSO_SW_CAL_PSEUDO_H_CSUM) means\n+\t\t\t * hardware support recalculate the TCP pseudo header\n+\t\t\t * checksum of packets that need TSO, so network driver\n+\t\t\t * software not need to recalculate it.\n+\t\t\t */\n+\t\t\thns3_outer_header_cksum_prepare(m);\n+\t\t\treturn 0;\n \t\t}\n+\t}\n \n-\t\tif (hns3_vld_vlan_chk(txq, m)) {\n-\t\t\trte_errno = EINVAL;\n-\t\t\treturn i;\n-\t\t}\n-#endif\n-\t\tret = rte_net_intel_cksum_prepare(m);\n-\t\tif (ret != 0) {\n-\t\t\trte_errno = -ret;\n-\t\t\treturn i;\n-\t\t}\n+\tret = rte_net_intel_cksum_prepare(m);\n+\tif (ret != 0) {\n+\t\trte_errno = -ret;\n+\t\treturn ret;\n+\t}\n+\n+\thns3_outer_header_cksum_prepare(m);\n+\n+\treturn 0;\n+}\n \n-\t\thns3_outer_header_cksum_prepare(m);\n+uint16_t\n+hns3_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,\n+\t       uint16_t nb_pkts)\n+{\n+\tstruct rte_mbuf *m;\n+\tuint16_t i;\n+\n+\tfor (i = 0; i < nb_pkts; i++) {\n+\t\tm = tx_pkts[i];\n+\t\tif (hns3_prep_pkt_proc(tx_queue, m))\n+\t\t\treturn i;\n \t}\n \n \treturn i;\ndiff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h\nindex 5ffe30e..d7d70f6 100644\n--- a/drivers/net/hns3/hns3_rxtx.h\n+++ b/drivers/net/hns3/hns3_rxtx.h\n@@ -367,6 +367,23 @@ struct hns3_tx_queue {\n \tstruct rte_mbuf **free;\n \n \t/*\n+\t * tso mode.\n+\t * value range:\n+\t *      HNS3_TSO_SW_CAL_PSEUDO_H_CSUM/HNS3_TSO_HW_CAL_PSEUDO_H_CSUM\n+\t *\n+\t *  - HNS3_TSO_SW_CAL_PSEUDO_H_CSUM\n+\t *     In this mode, because of the hardware constraint, network driver\n+\t *     software need erase the L4 len value of the TCP pseudo header\n+\t *     and recalculate the TCP pseudo header checksum of packets that\n+\t *     need TSO.\n+\t *\n+\t *  - HNS3_TSO_HW_CAL_PSEUDO_H_CSUM\n+\t *     In this mode, hardware support recalculate the TCP pseudo header\n+\t *     checksum of packets that need TSO, so network driver software\n+\t *     not need to recalculate it.\n+\t */\n+\tuint8_t tso_mode;\n+\t/*\n \t * The minimum length of the packet supported by hardware in the Tx\n \t * direction.\n \t */\n",
    "prefixes": [
        "05/17"
    ]
}