Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/73993/?format=api
http://patches.dpdk.org/api/patches/73993/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1594707369-36270-4-git-send-email-xavier.huwei@huawei.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": "<1594707369-36270-4-git-send-email-xavier.huwei@huawei.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1594707369-36270-4-git-send-email-xavier.huwei@huawei.com", "date": "2020-07-14T06:16:08", "name": "[v3,3/4] net/hns3: support keeping CRC", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "80b972d34342ab65f5234886bc01c0c13b1ec0d6", "submitter": { "id": 1405, "url": "http://patches.dpdk.org/api/people/1405/?format=api", "name": "Wei Hu (Xavier)", "email": "xavier.huwei@huawei.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/1594707369-36270-4-git-send-email-xavier.huwei@huawei.com/mbox/", "series": [ { "id": 11011, "url": "http://patches.dpdk.org/api/series/11011/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=11011", "date": "2020-07-14T06:16:07", "name": "updates for hns3 PMD driver", "version": 3, "mbox": "http://patches.dpdk.org/series/11011/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/73993/comments/", "check": "warning", "checks": "http://patches.dpdk.org/api/patches/73993/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 6EAB7A0540;\n\tTue, 14 Jul 2020 08:18:44 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id AEB091D5B6;\n\tTue, 14 Jul 2020 08:18:18 +0200 (CEST)", "from huawei.com (szxga07-in.huawei.com [45.249.212.35])\n by dpdk.org (Postfix) with ESMTP id 3CA071D57C\n for <dev@dpdk.org>; Tue, 14 Jul 2020 08:18:11 +0200 (CEST)", "from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60])\n by Forcepoint Email with ESMTP id 6889D7F9912140C80C85\n for <dev@dpdk.org>; Tue, 14 Jul 2020 14:18:07 +0800 (CST)", "from localhost.localdomain (10.69.192.56) by\n DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id\n 14.3.487.0; Tue, 14 Jul 2020 14:17:57 +0800" ], "From": "\"Wei Hu (Xavier)\" <xavier.huwei@huawei.com>", "To": "<dev@dpdk.org>", "CC": "<xavier.huwei@huawei.com>", "Date": "Tue, 14 Jul 2020 14:16:08 +0800", "Message-ID": "<1594707369-36270-4-git-send-email-xavier.huwei@huawei.com>", "X-Mailer": "git-send-email 2.7.4", "In-Reply-To": "<1594707369-36270-1-git-send-email-xavier.huwei@huawei.com>", "References": "<1594462703-21448-2-git-send-email-xavier.huwei@huawei.com>\n <1594707369-36270-1-git-send-email-xavier.huwei@huawei.com>", "MIME-Version": "1.0", "Content-Type": "text/plain", "X-Originating-IP": "[10.69.192.56]", "X-CFilter-Loop": "Reflected", "Subject": "[dpdk-dev] [PATCH v3 3/4] net/hns3: support keeping CRC", "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: \"Min Hu (Connor)\" <humin29@huawei.com>\n\nCRC is the end of frame, which occupies 4 bytes. Keeping CRC is a feature\nof MAC, which will not strip CRC field when receiving frames. The featrue\ncan be enabled using DEV_RX_OFFLOAD_KEEP_CRC offload by upper level\napplication. And the feature is only supported for hns3 PF PMD driver,\nnot supported for hns3 VF PMD driver\n\nSigned-off-by: Min Hu (Connor) <humin29@huawei.com>\nSigned-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>\n---\nv2 -> v3:\n\tBecause \"rxm->next = NULL;\" had been moved before, del the\n redundant statement.\nv1 -> v2:\n\tfix typo, replacing 'recalulate' with 'recalculate'\n---\n drivers/net/hns3/hns3_ethdev.c | 10 +++++++-\n drivers/net/hns3/hns3_ethdev_vf.c | 1 -\n drivers/net/hns3/hns3_rxtx.c | 54 ++++++++++++++++++++++++++++++++++++---\n drivers/net/hns3/hns3_rxtx.h | 3 +++\n 4 files changed, 63 insertions(+), 5 deletions(-)", "diff": "diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c\nindex 4712cc2..81e7730 100644\n--- a/drivers/net/hns3/hns3_ethdev.c\n+++ b/drivers/net/hns3/hns3_ethdev.c\n@@ -4184,7 +4184,15 @@ hns3_cfg_mac_mode(struct hns3_hw *hw, bool enable)\n \thns3_set_bit(loop_en, HNS3_MAC_LINE_LP_B, 0);\n \thns3_set_bit(loop_en, HNS3_MAC_FCS_TX_B, val);\n \thns3_set_bit(loop_en, HNS3_MAC_RX_FCS_B, val);\n-\thns3_set_bit(loop_en, HNS3_MAC_RX_FCS_STRIP_B, val);\n+\n+\t/*\n+\t * If DEV_RX_OFFLOAD_KEEP_CRC offload is set, MAC will not strip CRC\n+\t * when receiving frames. Otherwise, CRC will be stripped.\n+\t */\n+\tif (hw->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC)\n+\t\thns3_set_bit(loop_en, HNS3_MAC_RX_FCS_STRIP_B, 0);\n+\telse\n+\t\thns3_set_bit(loop_en, HNS3_MAC_RX_FCS_STRIP_B, val);\n \thns3_set_bit(loop_en, HNS3_MAC_TX_OVERSIZE_TRUNCATE_B, val);\n \thns3_set_bit(loop_en, HNS3_MAC_RX_OVERSIZE_TRUNCATE_B, val);\n \thns3_set_bit(loop_en, HNS3_MAC_TX_UNDER_MIN_ERR_B, val);\ndiff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c\nindex b881bbe..1d2941f 100644\n--- a/drivers/net/hns3/hns3_ethdev_vf.c\n+++ b/drivers/net/hns3/hns3_ethdev_vf.c\n@@ -913,7 +913,6 @@ hns3vf_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info)\n \t\t\t\t DEV_RX_OFFLOAD_SCTP_CKSUM |\n \t\t\t\t DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |\n \t\t\t\t DEV_RX_OFFLOAD_OUTER_UDP_CKSUM |\n-\t\t\t\t DEV_RX_OFFLOAD_KEEP_CRC |\n \t\t\t\t DEV_RX_OFFLOAD_SCATTER |\n \t\t\t\t DEV_RX_OFFLOAD_VLAN_STRIP |\n \t\t\t\t DEV_RX_OFFLOAD_VLAN_FILTER |\ndiff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c\nindex b0253d5..c0f7981 100644\n--- a/drivers/net/hns3/hns3_rxtx.c\n+++ b/drivers/net/hns3/hns3_rxtx.c\n@@ -1312,6 +1312,12 @@ hns3_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc,\n \trxq->ol3_csum_erros = 0;\n \trxq->ol4_csum_erros = 0;\n \n+\t/* CRC len set here is used for amending packet length */\n+\tif (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC)\n+\t\trxq->crc_len = RTE_ETHER_CRC_LEN;\n+\telse\n+\t\trxq->crc_len = 0;\n+\n \trte_spinlock_lock(&hw->lock);\n \tdev->data->rx_queues[idx] = rxq;\n \trte_spinlock_unlock(&hw->lock);\n@@ -1578,6 +1584,23 @@ hns3_rxd_to_vlan_tci(struct hns3_rx_queue *rxq, struct rte_mbuf *mb,\n \t}\n }\n \n+static inline void\n+recalculate_data_len(struct rte_mbuf *first_seg, struct rte_mbuf *last_seg,\n+\t\t struct rte_mbuf *rxm, struct hns3_rx_queue *rxq,\n+\t\t uint16_t data_len)\n+{\n+\tuint8_t crc_len = rxq->crc_len;\n+\n+\tif (data_len <= crc_len) {\n+\t\trte_pktmbuf_free_seg(rxm);\n+\t\tfirst_seg->nb_segs--;\n+\t\tlast_seg->data_len = (uint16_t)(last_seg->data_len -\n+\t\t\t(crc_len - data_len));\n+\t\tlast_seg->next = NULL;\n+\t} else\n+\t\trxm->data_len = (uint16_t)(data_len - crc_len);\n+}\n+\n uint16_t\n hns3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)\n {\n@@ -1708,7 +1731,11 @@ hns3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)\n \t\trxdp->rx.bd_base_info = 0;\n \t\trxdp->addr = dma_addr;\n \n-\t\t/* Load remained descriptor data and extract necessary fields */\n+\t\t/*\n+\t\t * Load remained descriptor data and extract necessary fields.\n+\t\t * Data size from buffer description may contains CRC len,\n+\t\t * packet len should subtract it.\n+\t\t */\n \t\tdata_len = (uint16_t)(rte_le_to_cpu_16(rxd.rx.size));\n \t\tl234_info = rte_le_to_cpu_32(rxd.rx.l234_info);\n \t\tol_info = rte_le_to_cpu_32(rxd.rx.ol_info);\n@@ -1729,9 +1756,31 @@ hns3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)\n \t\t\tcontinue;\n \t\t}\n \n-\t\t/* The last buffer of the received packet */\n+\t\t/*\n+\t\t * The last buffer of the received packet. packet len from\n+\t\t * buffer description may contains CRC len, packet len should\n+\t\t * subtract it, same as data len.\n+\t\t */\n \t\tpkt_len = (uint16_t)(rte_le_to_cpu_16(rxd.rx.pkt_len));\n \t\tfirst_seg->pkt_len = pkt_len;\n+\n+\t\t/*\n+\t\t * This is the last buffer of the received packet. If the CRC\n+\t\t * is not stripped by the hardware:\n+\t\t * - Subtract the CRC length from the total packet length.\n+\t\t * - If the last buffer only contains the whole CRC or a part\n+\t\t * of it, free the mbuf associated to the last buffer. If part\n+\t\t * of the CRC is also contained in the previous mbuf, subtract\n+\t\t * the length of that CRC part from the data length of the\n+\t\t * previous mbuf.\n+\t\t */\n+\t\trxm->next = NULL;\n+\t\tif (unlikely(rxq->crc_len > 0)) {\n+\t\t\tfirst_seg->pkt_len -= rxq->crc_len;\n+\t\t\trecalculate_data_len(first_seg, last_seg, rxm, rxq,\n+\t\t\t\tdata_len);\n+\t\t}\n+\n \t\tfirst_seg->port = rxq->port_id;\n \t\tfirst_seg->hash.rss = rte_le_to_cpu_32(rxd.rx.rss_hash);\n \t\tfirst_seg->ol_flags = PKT_RX_RSS_HASH;\n@@ -1740,7 +1789,6 @@ hns3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)\n \t\t\t\trte_le_to_cpu_32(rxd.rx.fd_id);\n \t\t\tfirst_seg->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID;\n \t\t}\n-\t\trxm->next = NULL;\n \n \t\tgro_size = hns3_get_field(bd_base_info, HNS3_RXD_GRO_SIZE_M,\n \t\t\t\t\t HNS3_RXD_GRO_SIZE_S);\ndiff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h\nindex ccd508b..0d20a27 100644\n--- a/drivers/net/hns3/hns3_rxtx.h\n+++ b/drivers/net/hns3/hns3_rxtx.h\n@@ -256,6 +256,9 @@ struct hns3_rx_queue {\n \t */\n \tuint16_t pvid_state;\n \n+\t/* 4 if DEV_RX_OFFLOAD_KEEP_CRC offload set, 0 otherwise */\n+\tuint8_t crc_len;\n+\n \tbool rx_deferred_start; /* don't start this queue in dev start */\n \tbool configured; /* indicate if rx queue has been configured */\n \n", "prefixes": [ "v3", "3/4" ] }{ "id": 73993, "url": "