[dpdk-stable] patch 'net/hinic: fix LRO' has been queued to stable release 19.11.3

luca.boccassi at gmail.com luca.boccassi at gmail.com
Tue May 19 15:02:24 CEST 2020


Hi,

FYI, your patch has been queued to stable release 19.11.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 05/21/20. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Thanks.

Luca Boccassi

---
>From 4710da6ef5e7c38428f6d80bc81537136fd935db Mon Sep 17 00:00:00 2001
From: Xiaoyun Wang <cloud.wangxiaoyun at huawei.com>
Date: Tue, 17 Mar 2020 23:01:11 +0800
Subject: [PATCH] net/hinic: fix LRO

[ upstream commit 9d02f40d650305935f8c407795fec02d8e9f01ec ]

PMD driver should change the max_lro_pkt_size parameter into lro_wqe_num
that used for hardware, and when packets are coalesced by hardware,
PKT_RX_LRO flag should be set in the RX mbuf.

Fixes: 9d4878ef0897 ("net/hinic: support LRO offload")

Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun at huawei.com>
---
 drivers/net/hinic/hinic_pmd_ethdev.c | 17 ++---------
 drivers/net/hinic/hinic_pmd_rx.c     | 42 +++++++++++++++++++++++++++-
 2 files changed, 43 insertions(+), 16 deletions(-)

diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index 8493f6e42c..b81ecd0b8f 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -736,6 +736,7 @@ hinic_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info)
 	info->max_mac_addrs  = HINIC_MAX_UC_MAC_ADDRS;
 	info->min_mtu = HINIC_MIN_MTU_SIZE;
 	info->max_mtu = HINIC_MAX_MTU_SIZE;
+	info->max_lro_pkt_size = HINIC_MAX_LRO_SIZE;
 
 	hinic_get_speed_capa(dev, &info->speed_capa);
 	info->rx_queue_offload_capa = 0;
@@ -811,12 +812,10 @@ static int hinic_config_rx_mode(struct hinic_nic_dev *nic_dev, u32 rx_mode_ctrl)
 	return 0;
 }
 
-
 static int hinic_rxtx_configure(struct rte_eth_dev *dev)
 {
-	int err;
 	struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
-	bool lro_en;
+	int err;
 
 	/* rx configure, if rss enable, need to init default configuration */
 	err = hinic_rx_configure(dev);
@@ -833,18 +832,6 @@ static int hinic_rxtx_configure(struct rte_eth_dev *dev)
 		goto set_rx_mode_fail;
 	}
 
-	/* config lro */
-	lro_en = dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_TCP_LRO ?
-			true : false;
-
-	err = hinic_set_rx_lro(nic_dev->hwdev, lro_en, lro_en,
-				HINIC_LRO_WQE_NUM_DEFAULT);
-	if (err) {
-		PMD_DRV_LOG(ERR, "%s lro failed, err: %d",
-			lro_en ? "Enable" : "Disable", err);
-		goto set_rx_mode_fail;
-	}
-
 	return HINIC_OK;
 
 set_rx_mode_fail:
diff --git a/drivers/net/hinic/hinic_pmd_rx.c b/drivers/net/hinic/hinic_pmd_rx.c
index f1b873afb7..224337ddd9 100644
--- a/drivers/net/hinic/hinic_pmd_rx.c
+++ b/drivers/net/hinic/hinic_pmd_rx.c
@@ -656,6 +656,10 @@ int hinic_rx_configure(struct rte_eth_dev *dev)
 	struct rte_eth_rss_conf rss_conf =
 		dev->data->dev_conf.rx_adv_conf.rss_conf;
 	int err;
+	bool lro_en;
+	int max_lro_size;
+	int lro_wqe_num;
+	int buf_size;
 
 	if (nic_dev->flags & ETH_MQ_RX_RSS_FLAG) {
 		if (rss_conf.rss_hf == 0) {
@@ -681,15 +685,42 @@ int hinic_rx_configure(struct rte_eth_dev *dev)
 	if (err)
 		goto rx_csum_ofl_err;
 
+	/* config lro */
+	lro_en = dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_TCP_LRO ?
+			true : false;
+	max_lro_size = dev->data->dev_conf.rxmode.max_lro_pkt_size;
+	buf_size = nic_dev->hwdev->nic_io->rq_buf_size;
+	lro_wqe_num = max_lro_size / buf_size ? (max_lro_size / buf_size) : 1;
+
+	err = hinic_set_rx_lro(nic_dev->hwdev, lro_en, lro_en, lro_wqe_num);
+	if (err) {
+		PMD_DRV_LOG(ERR, "%s %s lro failed, err: %d, max_lro_size: %d",
+				dev->data->name, lro_en ? "Enable" : "Disable",
+				err, max_lro_size);
+		goto set_rx_lro_err;
+	}
+
 	return 0;
 
+set_rx_lro_err:
 rx_csum_ofl_err:
 rss_config_err:
+
 	hinic_destroy_num_qps(nic_dev);
 
 	return HINIC_ERROR;
 }
 
+static void hinic_rx_remove_lro(struct hinic_nic_dev *nic_dev)
+{
+	int err;
+
+	err = hinic_set_rx_lro(nic_dev->hwdev, false, false, 0);
+	if (err)
+		PMD_DRV_LOG(ERR, "%s disable LRO failed",
+			    nic_dev->proc_dev_name);
+}
+
 void hinic_rx_remove_configure(struct rte_eth_dev *dev)
 {
 	struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
@@ -698,6 +729,8 @@ void hinic_rx_remove_configure(struct rte_eth_dev *dev)
 		hinic_rss_deinit(nic_dev);
 		hinic_destroy_num_qps(nic_dev);
 	}
+
+	hinic_rx_remove_lro(nic_dev);
 }
 
 void hinic_free_all_rx_mbufs(struct hinic_rxq *rxq)
@@ -956,7 +989,7 @@ u16 hinic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, u16 nb_pkts)
 	volatile struct hinic_rq_cqe *rx_cqe;
 	u16 rx_buf_len, pkts = 0;
 	u16 sw_ci, ci_mask, wqebb_cnt = 0;
-	u32 pkt_len, status, vlan_len;
+	u32 pkt_len, status, vlan_len, lro_num;
 	u64 rx_bytes = 0;
 	struct hinic_rq_cqe cqe;
 	u32 offload_type, rss_hash;
@@ -1024,6 +1057,13 @@ u16 hinic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, u16 nb_pkts)
 		rxm->ol_flags |= hinic_rx_rss_hash(offload_type, rss_hash,
 						   &rxm->hash.rss);
 
+		/* lro offload */
+		lro_num = HINIC_GET_RX_NUM_LRO(cqe.status);
+		if (unlikely(lro_num != 0)) {
+			rxm->ol_flags |= PKT_RX_LRO;
+			rxm->tso_segsz = pkt_len / lro_num;
+		}
+
 		/* 6. clear done bit */
 		rx_cqe->status = 0;
 
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-05-19 14:04:44.960218254 +0100
+++ 0009-net-hinic-fix-LRO.patch	2020-05-19 14:04:44.064645617 +0100
@@ -1,14 +1,15 @@
-From 9d02f40d650305935f8c407795fec02d8e9f01ec Mon Sep 17 00:00:00 2001
+From 4710da6ef5e7c38428f6d80bc81537136fd935db Mon Sep 17 00:00:00 2001
 From: Xiaoyun Wang <cloud.wangxiaoyun at huawei.com>
 Date: Tue, 17 Mar 2020 23:01:11 +0800
 Subject: [PATCH] net/hinic: fix LRO
 
+[ upstream commit 9d02f40d650305935f8c407795fec02d8e9f01ec ]
+
 PMD driver should change the max_lro_pkt_size parameter into lro_wqe_num
 that used for hardware, and when packets are coalesced by hardware,
 PKT_RX_LRO flag should be set in the RX mbuf.
 
 Fixes: 9d4878ef0897 ("net/hinic: support LRO offload")
-Cc: stable at dpdk.org
 
 Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun at huawei.com>
 ---
@@ -62,7 +63,7 @@
  
  set_rx_mode_fail:
 diff --git a/drivers/net/hinic/hinic_pmd_rx.c b/drivers/net/hinic/hinic_pmd_rx.c
-index 3894ace4b8..4ca74f0fb2 100644
+index f1b873afb7..224337ddd9 100644
 --- a/drivers/net/hinic/hinic_pmd_rx.c
 +++ b/drivers/net/hinic/hinic_pmd_rx.c
 @@ -656,6 +656,10 @@ int hinic_rx_configure(struct rte_eth_dev *dev)


More information about the stable mailing list