DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2 0/4] updates for hns3 PMD driver
@ 2020-07-11 10:18 Wei Hu (Xavier)
  2020-07-11 10:18 ` [dpdk-dev] [PATCH v2 1/4] net/hns3: support copper media type Wei Hu (Xavier)
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Wei Hu (Xavier) @ 2020-07-11 10:18 UTC (permalink / raw)
  To: dev; +Cc: xavier.huwei

This series are updates for hns3 PMD driver.

Lijun Ou (1):
  net/hns3: fix RSS configuration when empty RSS type

Min Hu (Connor) (1):
  net/hns3: support keeping CRC

Wei Hu (Xavier) (2):
  net/hns3: support copper media type
  net/hns3: support 200G speed rate

 drivers/net/hns3/hns3_cmd.h       |  1 +
 drivers/net/hns3/hns3_ethdev.c    | 28 ++++++++++++++++++---
 drivers/net/hns3/hns3_ethdev.h    |  8 ++++++
 drivers/net/hns3/hns3_ethdev_vf.c |  2 +-
 drivers/net/hns3/hns3_flow.c      |  7 +++---
 drivers/net/hns3/hns3_rxtx.c      | 53 +++++++++++++++++++++++++++++++++++++--
 drivers/net/hns3/hns3_rxtx.h      |  3 +++
 7 files changed, 92 insertions(+), 10 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v2 1/4] net/hns3: support copper media type
  2020-07-11 10:18 [dpdk-dev] [PATCH v2 0/4] updates for hns3 PMD driver Wei Hu (Xavier)
@ 2020-07-11 10:18 ` Wei Hu (Xavier)
  2020-07-14  6:16   ` [dpdk-dev] [PATCH v3 0/4] updates for hns3 PMD driver Wei Hu (Xavier)
  2020-07-11 10:18 ` [dpdk-dev] [PATCH v2 2/4] net/hns3: support 200G speed rate Wei Hu (Xavier)
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Wei Hu (Xavier) @ 2020-07-11 10:18 UTC (permalink / raw)
  To: dev; +Cc: xavier.huwei

The hns3 network engine is built-in multiple SoCs, such as kunpeng 920,
kunpeng 930, etc. The PCI revision id is 0x21 in kunpeng 920, and the PCI
revision id is 0x30 in kunpeng 930.

Copper media type is supported for hns3 PF device in kunpeng 930 and later
SoCs. The configuration operation for PHY is implemented by firmware.

Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c | 6 +++++-
 drivers/net/hns3/hns3_ethdev.h | 7 +++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 9575a05..f218fb8 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2823,6 +2823,9 @@ hns3_get_capability(struct hns3_hw *hw)
 	}
 	hw->revision = revision;
 
+	if (revision >= PCI_REVISION_ID_HIP09_A)
+		hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_COPPER_B, 1);
+
 	return 0;
 }
 
@@ -2840,7 +2843,8 @@ hns3_get_board_configuration(struct hns3_hw *hw)
 		return ret;
 	}
 
-	if (cfg.media_type == HNS3_MEDIA_TYPE_COPPER) {
+	if (cfg.media_type == HNS3_MEDIA_TYPE_COPPER &&
+	    !hns3_dev_copper_supported(hw)) {
 		PMD_INIT_LOG(ERR, "media type is copper, not supported.");
 		return -EOPNOTSUPP;
 	}
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index 3c991f4..31d34b0 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -30,6 +30,9 @@
 #define HNS3_PCI_REVISION_ID			0x08
 #define HNS3_PCI_REVISION_ID_LEN		1
 
+#define PCI_REVISION_ID_HIP08_B			0x21
+#define PCI_REVISION_ID_HIP09_A			0x30
+
 #define HNS3_PF_FUNC_ID			0
 #define HNS3_1ST_VF_FUNC_ID		1
 
@@ -530,10 +533,14 @@ struct hns3_adapter {
 };
 
 #define HNS3_DEV_SUPPORT_DCB_B			0x0
+#define HNS3_DEV_SUPPORT_COPPER_B		0x1
 
 #define hns3_dev_dcb_supported(hw) \
 	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_DCB_B)
 
+#define hns3_dev_copper_supported(hw) \
+	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_COPPER_B)
+
 #define HNS3_DEV_PRIVATE_TO_HW(adapter) \
 	(&((struct hns3_adapter *)adapter)->hw)
 #define HNS3_DEV_PRIVATE_TO_ADAPTER(adapter) \
-- 
2.7.4


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v2 2/4] net/hns3: support 200G speed rate
  2020-07-11 10:18 [dpdk-dev] [PATCH v2 0/4] updates for hns3 PMD driver Wei Hu (Xavier)
  2020-07-11 10:18 ` [dpdk-dev] [PATCH v2 1/4] net/hns3: support copper media type Wei Hu (Xavier)
@ 2020-07-11 10:18 ` Wei Hu (Xavier)
  2020-07-11 10:18 ` [dpdk-dev] [PATCH v2 3/4] net/hns3: support keeping CRC Wei Hu (Xavier)
  2020-07-11 10:18 ` [dpdk-dev] [PATCH v2 4/4] net/hns3: fix RSS configuration when empty RSS type Wei Hu (Xavier)
  3 siblings, 0 replies; 11+ messages in thread
From: Wei Hu (Xavier) @ 2020-07-11 10:18 UTC (permalink / raw)
  To: dev; +Cc: xavier.huwei

The 200G device has a new device id 0xA228, so adds this device id
to pci table for pci driver can probe it. Similar to the network port
with other speed, the hns3 PMD driver gets 200G speed information
from firmware, and passes them to DPDK framework.

Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/net/hns3/hns3_cmd.h       |  1 +
 drivers/net/hns3/hns3_ethdev.c    | 12 +++++++++++-
 drivers/net/hns3/hns3_ethdev.h    |  1 +
 drivers/net/hns3/hns3_ethdev_vf.c |  1 +
 4 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h
index b203e66..d70f42e 100644
--- a/drivers/net/hns3/hns3_cmd.h
+++ b/drivers/net/hns3/hns3_cmd.h
@@ -622,6 +622,7 @@ struct hns3_config_mac_mode_cmd {
 #define HNS3_CFG_SPEED_40G		3
 #define HNS3_CFG_SPEED_50G		4
 #define HNS3_CFG_SPEED_100G		5
+#define HNS3_CFG_SPEED_200G		8
 
 #define HNS3_CFG_SPEED_S		0
 #define HNS3_CFG_SPEED_M		GENMASK(5, 0)
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index f218fb8..4712cc2 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2560,6 +2560,7 @@ hns3_dev_link_update(struct rte_eth_dev *eth_dev,
 	case ETH_SPEED_NUM_40G:
 	case ETH_SPEED_NUM_50G:
 	case ETH_SPEED_NUM_100G:
+	case ETH_SPEED_NUM_200G:
 		new_link.link_speed = mac->link_speed;
 		break;
 	default:
@@ -2789,6 +2790,9 @@ hns3_parse_speed(int speed_cmd, uint32_t *speed)
 	case HNS3_CFG_SPEED_100G:
 		*speed = ETH_SPEED_NUM_100G;
 		break;
+	case HNS3_CFG_SPEED_200G:
+		*speed = ETH_SPEED_NUM_200G;
+		break;
 	default:
 		return -EINVAL;
 	}
@@ -2811,7 +2815,8 @@ hns3_get_capability(struct hns3_hw *hw)
 
 	if (device_id == HNS3_DEV_ID_25GE_RDMA ||
 	    device_id == HNS3_DEV_ID_50GE_RDMA ||
-	    device_id == HNS3_DEV_ID_100G_RDMA_MACSEC)
+	    device_id == HNS3_DEV_ID_100G_RDMA_MACSEC ||
+	    device_id == HNS3_DEV_ID_200G_RDMA)
 		hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_DCB_B, 1);
 
 	/* Get PCI revision id */
@@ -3027,6 +3032,10 @@ hns3_cfg_mac_speed_dup_hw(struct hns3_hw *hw, uint32_t speed, uint8_t duplex)
 		hns3_set_field(req->speed_dup, HNS3_CFG_SPEED_M,
 			       HNS3_CFG_SPEED_S, HNS3_CFG_SPEED_100G);
 		break;
+	case ETH_SPEED_NUM_200G:
+		hns3_set_field(req->speed_dup, HNS3_CFG_SPEED_M,
+			       HNS3_CFG_SPEED_S, HNS3_CFG_SPEED_200G);
+		break;
 	default:
 		PMD_INIT_LOG(ERR, "invalid speed (%u)", speed);
 		return -EINVAL;
@@ -5589,6 +5598,7 @@ static const struct rte_pci_id pci_id_hns3_map[] = {
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_HUAWEI, HNS3_DEV_ID_25GE_RDMA) },
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_HUAWEI, HNS3_DEV_ID_50GE_RDMA) },
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_HUAWEI, HNS3_DEV_ID_100G_RDMA_MACSEC) },
+	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_HUAWEI, HNS3_DEV_ID_200G_RDMA) },
 	{ .vendor_id = 0, /* sentinel */ },
 };
 
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index 31d34b0..0e665e5 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -23,6 +23,7 @@
 #define HNS3_DEV_ID_25GE_RDMA			0xA222
 #define HNS3_DEV_ID_50GE_RDMA			0xA224
 #define HNS3_DEV_ID_100G_RDMA_MACSEC		0xA226
+#define HNS3_DEV_ID_200G_RDMA			0xA228
 #define HNS3_DEV_ID_100G_VF			0xA22E
 #define HNS3_DEV_ID_100G_RDMA_PFC_VF		0xA22F
 
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 54e5dac..b881bbe 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -1893,6 +1893,7 @@ hns3vf_dev_link_update(struct rte_eth_dev *eth_dev,
 	case ETH_SPEED_NUM_40G:
 	case ETH_SPEED_NUM_50G:
 	case ETH_SPEED_NUM_100G:
+	case ETH_SPEED_NUM_200G:
 		new_link.link_speed = mac->link_speed;
 		break;
 	default:
-- 
2.7.4


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v2 3/4] net/hns3: support keeping CRC
  2020-07-11 10:18 [dpdk-dev] [PATCH v2 0/4] updates for hns3 PMD driver Wei Hu (Xavier)
  2020-07-11 10:18 ` [dpdk-dev] [PATCH v2 1/4] net/hns3: support copper media type Wei Hu (Xavier)
  2020-07-11 10:18 ` [dpdk-dev] [PATCH v2 2/4] net/hns3: support 200G speed rate Wei Hu (Xavier)
@ 2020-07-11 10:18 ` Wei Hu (Xavier)
  2020-07-11 10:18 ` [dpdk-dev] [PATCH v2 4/4] net/hns3: fix RSS configuration when empty RSS type Wei Hu (Xavier)
  3 siblings, 0 replies; 11+ messages in thread
From: Wei Hu (Xavier) @ 2020-07-11 10:18 UTC (permalink / raw)
  To: dev; +Cc: xavier.huwei

From: "Min Hu (Connor)" <humin29@huawei.com>

CRC is the end of frame, which occupies 4 bytes. Keeping CRC is a feature
of MAC, which will not strip CRC field when receiving frames. The featrue
can be enabled using DEV_RX_OFFLOAD_KEEP_CRC offload by upper level
application. And the feature is only supported for hns3 PF PMD driver.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
v1 -> v2:
	fix typo, replacing 'recalulate' with 'recalculate'
---
 drivers/net/hns3/hns3_ethdev.c    | 10 +++++++-
 drivers/net/hns3/hns3_ethdev_vf.c |  1 -
 drivers/net/hns3/hns3_rxtx.c      | 53 +++++++++++++++++++++++++++++++++++++--
 drivers/net/hns3/hns3_rxtx.h      |  3 +++
 4 files changed, 63 insertions(+), 4 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 4712cc2..81e7730 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -4184,7 +4184,15 @@ hns3_cfg_mac_mode(struct hns3_hw *hw, bool enable)
 	hns3_set_bit(loop_en, HNS3_MAC_LINE_LP_B, 0);
 	hns3_set_bit(loop_en, HNS3_MAC_FCS_TX_B, val);
 	hns3_set_bit(loop_en, HNS3_MAC_RX_FCS_B, val);
-	hns3_set_bit(loop_en, HNS3_MAC_RX_FCS_STRIP_B, val);
+
+	/*
+	 * If DEV_RX_OFFLOAD_KEEP_CRC offload is set, MAC will not strip CRC
+	 * when receiving frames. Otherwise, CRC will be stripped.
+	 */
+	if (hw->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC)
+		hns3_set_bit(loop_en, HNS3_MAC_RX_FCS_STRIP_B, 0);
+	else
+		hns3_set_bit(loop_en, HNS3_MAC_RX_FCS_STRIP_B, val);
 	hns3_set_bit(loop_en, HNS3_MAC_TX_OVERSIZE_TRUNCATE_B, val);
 	hns3_set_bit(loop_en, HNS3_MAC_RX_OVERSIZE_TRUNCATE_B, val);
 	hns3_set_bit(loop_en, HNS3_MAC_TX_UNDER_MIN_ERR_B, val);
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index b881bbe..1d2941f 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -913,7 +913,6 @@ hns3vf_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info)
 				 DEV_RX_OFFLOAD_SCTP_CKSUM |
 				 DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |
 				 DEV_RX_OFFLOAD_OUTER_UDP_CKSUM |
-				 DEV_RX_OFFLOAD_KEEP_CRC |
 				 DEV_RX_OFFLOAD_SCATTER |
 				 DEV_RX_OFFLOAD_VLAN_STRIP |
 				 DEV_RX_OFFLOAD_VLAN_FILTER |
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index b0253d5..a1e9b1a 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -1312,6 +1312,12 @@ hns3_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc,
 	rxq->ol3_csum_erros = 0;
 	rxq->ol4_csum_erros = 0;
 
+	/* CRC len set here is used for amending packet length */
+	if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC)
+		rxq->crc_len = RTE_ETHER_CRC_LEN;
+	else
+		rxq->crc_len = 0;
+
 	rte_spinlock_lock(&hw->lock);
 	dev->data->rx_queues[idx] = rxq;
 	rte_spinlock_unlock(&hw->lock);
@@ -1578,6 +1584,23 @@ hns3_rxd_to_vlan_tci(struct hns3_rx_queue *rxq, struct rte_mbuf *mb,
 	}
 }
 
+static inline void
+recalculate_data_len(struct rte_mbuf *first_seg, struct rte_mbuf *last_seg,
+		    struct rte_mbuf *rxm, struct hns3_rx_queue *rxq,
+		    uint16_t data_len)
+{
+	uint8_t crc_len = rxq->crc_len;
+
+	if (data_len <= crc_len) {
+		rte_pktmbuf_free_seg(rxm);
+		first_seg->nb_segs--;
+		last_seg->data_len = (uint16_t)(last_seg->data_len -
+			(crc_len - data_len));
+		last_seg->next = NULL;
+	} else
+		rxm->data_len = (uint16_t)(data_len - crc_len);
+}
+
 uint16_t
 hns3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 {
@@ -1708,7 +1731,11 @@ hns3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 		rxdp->rx.bd_base_info = 0;
 		rxdp->addr = dma_addr;
 
-		/* Load remained descriptor data and extract necessary fields */
+		/*
+		 * Load remained descriptor data and extract necessary fields.
+		 * Data size from buffer description may contains CRC len,
+		 * packet len should subtract it.
+		 */
 		data_len = (uint16_t)(rte_le_to_cpu_16(rxd.rx.size));
 		l234_info = rte_le_to_cpu_32(rxd.rx.l234_info);
 		ol_info = rte_le_to_cpu_32(rxd.rx.ol_info);
@@ -1729,9 +1756,31 @@ hns3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 			continue;
 		}
 
-		/* The last buffer of the received packet */
+		/*
+		 * The last buffer of the received packet. packet len from
+		 * buffer description may contains CRC len, packet len should
+		 * subtract it, same as data len.
+		 */
 		pkt_len = (uint16_t)(rte_le_to_cpu_16(rxd.rx.pkt_len));
 		first_seg->pkt_len = pkt_len;
+
+		/*
+		 * This is the last buffer of the received packet. If the CRC
+		 * is not stripped by the hardware:
+		 *  - Subtract the CRC length from the total packet length.
+		 *  - If the last buffer only contains the whole CRC or a part
+		 *  of it, free the mbuf associated to the last buffer. If part
+		 *  of the CRC is also contained in the previous mbuf, subtract
+		 *  the length of that CRC part from the data length of the
+		 *  previous mbuf.
+		 */
+		rxm->next = NULL;
+		if (unlikely(rxq->crc_len > 0)) {
+			first_seg->pkt_len -= rxq->crc_len;
+			recalculate_data_len(first_seg, last_seg, rxm, rxq,
+				data_len);
+		}
+
 		first_seg->port = rxq->port_id;
 		first_seg->hash.rss = rte_le_to_cpu_32(rxd.rx.rss_hash);
 		first_seg->ol_flags = PKT_RX_RSS_HASH;
diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h
index ccd508b..0d20a27 100644
--- a/drivers/net/hns3/hns3_rxtx.h
+++ b/drivers/net/hns3/hns3_rxtx.h
@@ -256,6 +256,9 @@ struct hns3_rx_queue {
 	 */
 	uint16_t pvid_state;
 
+	/* 4 if DEV_RX_OFFLOAD_KEEP_CRC offload set, 0 otherwise */
+	uint8_t crc_len;
+
 	bool rx_deferred_start; /* don't start this queue in dev start */
 	bool configured;        /* indicate if rx queue has been configured */
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v2 4/4] net/hns3: fix RSS configuration when empty RSS type
  2020-07-11 10:18 [dpdk-dev] [PATCH v2 0/4] updates for hns3 PMD driver Wei Hu (Xavier)
                   ` (2 preceding siblings ...)
  2020-07-11 10:18 ` [dpdk-dev] [PATCH v2 3/4] net/hns3: support keeping CRC Wei Hu (Xavier)
@ 2020-07-11 10:18 ` Wei Hu (Xavier)
  3 siblings, 0 replies; 11+ messages in thread
From: Wei Hu (Xavier) @ 2020-07-11 10:18 UTC (permalink / raw)
  To: dev; +Cc: xavier.huwei

From: Lijun Ou <oulijun@huawei.com>

According to the definition of RSS types of action attributes from
testpmd, the driver will not disable RSS but instead requests the
unspecified "best-effort" settings when upper application call
rte_flow_create API function to create flow using empty RSS types.

As a result, here use the default RSS types when RSS types is empty.

Fixes: c37ca66f2b27 ("net/hns3: support RSS")
Cc: stable@dpdk.org

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/net/hns3/hns3_flow.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c
index 1e58ad7..7ec46ae 100644
--- a/drivers/net/hns3/hns3_flow.c
+++ b/drivers/net/hns3/hns3_flow.c
@@ -1486,7 +1486,9 @@ hns3_config_rss_filter(struct rte_eth_dev *dev,
 	}
 
 	/* Filter the unsupported flow types */
-	flow_types = rss_flow_conf.types & HNS3_ETH_RSS_SUPPORT;
+	flow_types = conf->conf.types ?
+		     rss_flow_conf.types & HNS3_ETH_RSS_SUPPORT :
+		     hw->rss_info.conf.types;
 	if (flow_types != rss_flow_conf.types)
 		hns3_warn(hw, "modified RSS types based on hardware support, "
 			      "requested:%" PRIx64 " configured:%" PRIx64,
@@ -1494,9 +1496,6 @@ hns3_config_rss_filter(struct rte_eth_dev *dev,
 	/* Update the useful flow types */
 	rss_flow_conf.types = flow_types;
 
-	if ((rss_flow_conf.types & ETH_RSS_PROTO_MASK) == 0)
-		return hns3_disable_rss(hw);
-
 	rss_info = &hw->rss_info;
 	if (!add) {
 		if (hns3_action_rss_same(&rss_info->conf, &rss_flow_conf)) {
-- 
2.7.4


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v3 0/4] updates for hns3 PMD driver
  2020-07-11 10:18 ` [dpdk-dev] [PATCH v2 1/4] net/hns3: support copper media type Wei Hu (Xavier)
@ 2020-07-14  6:16   ` Wei Hu (Xavier)
  2020-07-14  6:16     ` [dpdk-dev] [PATCH v3 1/4] net/hns3: support copper media type Wei Hu (Xavier)
                       ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Wei Hu (Xavier) @ 2020-07-14  6:16 UTC (permalink / raw)
  To: dev; +Cc: xavier.huwei

This series are updates for hns3 PMD driver.

Lijun Ou (1):
  net/hns3: fix RSS configuration when empty RSS type

Min Hu (Connor) (1):
  net/hns3: support keeping CRC

Wei Hu (Xavier) (2):
  net/hns3: support copper media type
  net/hns3: support 200G speed rate

 drivers/net/hns3/hns3_cmd.h       |  1 +
 drivers/net/hns3/hns3_ethdev.c    | 28 +++++++++++++++++---
 drivers/net/hns3/hns3_ethdev.h    |  8 ++++++
 drivers/net/hns3/hns3_ethdev_vf.c |  2 +-
 drivers/net/hns3/hns3_flow.c      |  7 +++--
 drivers/net/hns3/hns3_rxtx.c      | 54 ++++++++++++++++++++++++++++++++++++---
 drivers/net/hns3/hns3_rxtx.h      |  3 +++
 7 files changed, 92 insertions(+), 11 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v3 1/4] net/hns3: support copper media type
  2020-07-14  6:16   ` [dpdk-dev] [PATCH v3 0/4] updates for hns3 PMD driver Wei Hu (Xavier)
@ 2020-07-14  6:16     ` Wei Hu (Xavier)
  2020-07-14  6:16     ` [dpdk-dev] [PATCH v3 2/4] net/hns3: support 200G speed rate Wei Hu (Xavier)
                       ` (3 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Wei Hu (Xavier) @ 2020-07-14  6:16 UTC (permalink / raw)
  To: dev; +Cc: xavier.huwei

The hns3 network engine is built-in multiple SoCs, such as kunpeng 920,
kunpeng 930, etc. The PCI revision id is 0x21 in kunpeng 920, and the PCI
revision id is 0x30 in kunpeng 930.

Copper media type is supported for hns3 PF device in kunpeng 930 and later
SoCs. The configuration operation for PHY is implemented by firmware.

Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c | 6 +++++-
 drivers/net/hns3/hns3_ethdev.h | 7 +++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 9575a05..f218fb8 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2823,6 +2823,9 @@ hns3_get_capability(struct hns3_hw *hw)
 	}
 	hw->revision = revision;
 
+	if (revision >= PCI_REVISION_ID_HIP09_A)
+		hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_COPPER_B, 1);
+
 	return 0;
 }
 
@@ -2840,7 +2843,8 @@ hns3_get_board_configuration(struct hns3_hw *hw)
 		return ret;
 	}
 
-	if (cfg.media_type == HNS3_MEDIA_TYPE_COPPER) {
+	if (cfg.media_type == HNS3_MEDIA_TYPE_COPPER &&
+	    !hns3_dev_copper_supported(hw)) {
 		PMD_INIT_LOG(ERR, "media type is copper, not supported.");
 		return -EOPNOTSUPP;
 	}
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index 3c991f4..31d34b0 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -30,6 +30,9 @@
 #define HNS3_PCI_REVISION_ID			0x08
 #define HNS3_PCI_REVISION_ID_LEN		1
 
+#define PCI_REVISION_ID_HIP08_B			0x21
+#define PCI_REVISION_ID_HIP09_A			0x30
+
 #define HNS3_PF_FUNC_ID			0
 #define HNS3_1ST_VF_FUNC_ID		1
 
@@ -530,10 +533,14 @@ struct hns3_adapter {
 };
 
 #define HNS3_DEV_SUPPORT_DCB_B			0x0
+#define HNS3_DEV_SUPPORT_COPPER_B		0x1
 
 #define hns3_dev_dcb_supported(hw) \
 	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_DCB_B)
 
+#define hns3_dev_copper_supported(hw) \
+	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_COPPER_B)
+
 #define HNS3_DEV_PRIVATE_TO_HW(adapter) \
 	(&((struct hns3_adapter *)adapter)->hw)
 #define HNS3_DEV_PRIVATE_TO_ADAPTER(adapter) \
-- 
2.7.4


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v3 2/4] net/hns3: support 200G speed rate
  2020-07-14  6:16   ` [dpdk-dev] [PATCH v3 0/4] updates for hns3 PMD driver Wei Hu (Xavier)
  2020-07-14  6:16     ` [dpdk-dev] [PATCH v3 1/4] net/hns3: support copper media type Wei Hu (Xavier)
@ 2020-07-14  6:16     ` Wei Hu (Xavier)
  2020-07-14  6:16     ` [dpdk-dev] [PATCH v3 3/4] net/hns3: support keeping CRC Wei Hu (Xavier)
                       ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Wei Hu (Xavier) @ 2020-07-14  6:16 UTC (permalink / raw)
  To: dev; +Cc: xavier.huwei

The 200G device has a new device id 0xA228, so adds this device id
to pci table for pci driver can probe it. Similar to the network port
with other speed, the hns3 PMD driver gets 200G speed information
from firmware, and passes them to DPDK framework.

Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/net/hns3/hns3_cmd.h       |  1 +
 drivers/net/hns3/hns3_ethdev.c    | 12 +++++++++++-
 drivers/net/hns3/hns3_ethdev.h    |  1 +
 drivers/net/hns3/hns3_ethdev_vf.c |  1 +
 4 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h
index b203e66..d70f42e 100644
--- a/drivers/net/hns3/hns3_cmd.h
+++ b/drivers/net/hns3/hns3_cmd.h
@@ -622,6 +622,7 @@ struct hns3_config_mac_mode_cmd {
 #define HNS3_CFG_SPEED_40G		3
 #define HNS3_CFG_SPEED_50G		4
 #define HNS3_CFG_SPEED_100G		5
+#define HNS3_CFG_SPEED_200G		8
 
 #define HNS3_CFG_SPEED_S		0
 #define HNS3_CFG_SPEED_M		GENMASK(5, 0)
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index f218fb8..4712cc2 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2560,6 +2560,7 @@ hns3_dev_link_update(struct rte_eth_dev *eth_dev,
 	case ETH_SPEED_NUM_40G:
 	case ETH_SPEED_NUM_50G:
 	case ETH_SPEED_NUM_100G:
+	case ETH_SPEED_NUM_200G:
 		new_link.link_speed = mac->link_speed;
 		break;
 	default:
@@ -2789,6 +2790,9 @@ hns3_parse_speed(int speed_cmd, uint32_t *speed)
 	case HNS3_CFG_SPEED_100G:
 		*speed = ETH_SPEED_NUM_100G;
 		break;
+	case HNS3_CFG_SPEED_200G:
+		*speed = ETH_SPEED_NUM_200G;
+		break;
 	default:
 		return -EINVAL;
 	}
@@ -2811,7 +2815,8 @@ hns3_get_capability(struct hns3_hw *hw)
 
 	if (device_id == HNS3_DEV_ID_25GE_RDMA ||
 	    device_id == HNS3_DEV_ID_50GE_RDMA ||
-	    device_id == HNS3_DEV_ID_100G_RDMA_MACSEC)
+	    device_id == HNS3_DEV_ID_100G_RDMA_MACSEC ||
+	    device_id == HNS3_DEV_ID_200G_RDMA)
 		hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_DCB_B, 1);
 
 	/* Get PCI revision id */
@@ -3027,6 +3032,10 @@ hns3_cfg_mac_speed_dup_hw(struct hns3_hw *hw, uint32_t speed, uint8_t duplex)
 		hns3_set_field(req->speed_dup, HNS3_CFG_SPEED_M,
 			       HNS3_CFG_SPEED_S, HNS3_CFG_SPEED_100G);
 		break;
+	case ETH_SPEED_NUM_200G:
+		hns3_set_field(req->speed_dup, HNS3_CFG_SPEED_M,
+			       HNS3_CFG_SPEED_S, HNS3_CFG_SPEED_200G);
+		break;
 	default:
 		PMD_INIT_LOG(ERR, "invalid speed (%u)", speed);
 		return -EINVAL;
@@ -5589,6 +5598,7 @@ static const struct rte_pci_id pci_id_hns3_map[] = {
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_HUAWEI, HNS3_DEV_ID_25GE_RDMA) },
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_HUAWEI, HNS3_DEV_ID_50GE_RDMA) },
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_HUAWEI, HNS3_DEV_ID_100G_RDMA_MACSEC) },
+	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_HUAWEI, HNS3_DEV_ID_200G_RDMA) },
 	{ .vendor_id = 0, /* sentinel */ },
 };
 
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index 31d34b0..0e665e5 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -23,6 +23,7 @@
 #define HNS3_DEV_ID_25GE_RDMA			0xA222
 #define HNS3_DEV_ID_50GE_RDMA			0xA224
 #define HNS3_DEV_ID_100G_RDMA_MACSEC		0xA226
+#define HNS3_DEV_ID_200G_RDMA			0xA228
 #define HNS3_DEV_ID_100G_VF			0xA22E
 #define HNS3_DEV_ID_100G_RDMA_PFC_VF		0xA22F
 
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 54e5dac..b881bbe 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -1893,6 +1893,7 @@ hns3vf_dev_link_update(struct rte_eth_dev *eth_dev,
 	case ETH_SPEED_NUM_40G:
 	case ETH_SPEED_NUM_50G:
 	case ETH_SPEED_NUM_100G:
+	case ETH_SPEED_NUM_200G:
 		new_link.link_speed = mac->link_speed;
 		break;
 	default:
-- 
2.7.4


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v3 3/4] net/hns3: support keeping CRC
  2020-07-14  6:16   ` [dpdk-dev] [PATCH v3 0/4] updates for hns3 PMD driver Wei Hu (Xavier)
  2020-07-14  6:16     ` [dpdk-dev] [PATCH v3 1/4] net/hns3: support copper media type Wei Hu (Xavier)
  2020-07-14  6:16     ` [dpdk-dev] [PATCH v3 2/4] net/hns3: support 200G speed rate Wei Hu (Xavier)
@ 2020-07-14  6:16     ` Wei Hu (Xavier)
  2020-07-14  6:16     ` [dpdk-dev] [PATCH v3 4/4] net/hns3: fix RSS configuration when empty RSS type Wei Hu (Xavier)
  2020-07-14 11:07     ` [dpdk-dev] [PATCH v3 0/4] updates for hns3 PMD driver Ferruh Yigit
  4 siblings, 0 replies; 11+ messages in thread
From: Wei Hu (Xavier) @ 2020-07-14  6:16 UTC (permalink / raw)
  To: dev; +Cc: xavier.huwei

From: "Min Hu (Connor)" <humin29@huawei.com>

CRC is the end of frame, which occupies 4 bytes. Keeping CRC is a feature
of MAC, which will not strip CRC field when receiving frames. The featrue
can be enabled using DEV_RX_OFFLOAD_KEEP_CRC offload by upper level
application. And the feature is only supported for hns3 PF PMD driver,
not supported for hns3 VF PMD driver

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
v2 -> v3:
	Because "rxm->next = NULL;" had been moved before, del the
        redundant statement.
v1 -> v2:
	fix typo, replacing 'recalulate' with 'recalculate'
---
 drivers/net/hns3/hns3_ethdev.c    | 10 +++++++-
 drivers/net/hns3/hns3_ethdev_vf.c |  1 -
 drivers/net/hns3/hns3_rxtx.c      | 54 ++++++++++++++++++++++++++++++++++++---
 drivers/net/hns3/hns3_rxtx.h      |  3 +++
 4 files changed, 63 insertions(+), 5 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 4712cc2..81e7730 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -4184,7 +4184,15 @@ hns3_cfg_mac_mode(struct hns3_hw *hw, bool enable)
 	hns3_set_bit(loop_en, HNS3_MAC_LINE_LP_B, 0);
 	hns3_set_bit(loop_en, HNS3_MAC_FCS_TX_B, val);
 	hns3_set_bit(loop_en, HNS3_MAC_RX_FCS_B, val);
-	hns3_set_bit(loop_en, HNS3_MAC_RX_FCS_STRIP_B, val);
+
+	/*
+	 * If DEV_RX_OFFLOAD_KEEP_CRC offload is set, MAC will not strip CRC
+	 * when receiving frames. Otherwise, CRC will be stripped.
+	 */
+	if (hw->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC)
+		hns3_set_bit(loop_en, HNS3_MAC_RX_FCS_STRIP_B, 0);
+	else
+		hns3_set_bit(loop_en, HNS3_MAC_RX_FCS_STRIP_B, val);
 	hns3_set_bit(loop_en, HNS3_MAC_TX_OVERSIZE_TRUNCATE_B, val);
 	hns3_set_bit(loop_en, HNS3_MAC_RX_OVERSIZE_TRUNCATE_B, val);
 	hns3_set_bit(loop_en, HNS3_MAC_TX_UNDER_MIN_ERR_B, val);
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index b881bbe..1d2941f 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -913,7 +913,6 @@ hns3vf_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info)
 				 DEV_RX_OFFLOAD_SCTP_CKSUM |
 				 DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |
 				 DEV_RX_OFFLOAD_OUTER_UDP_CKSUM |
-				 DEV_RX_OFFLOAD_KEEP_CRC |
 				 DEV_RX_OFFLOAD_SCATTER |
 				 DEV_RX_OFFLOAD_VLAN_STRIP |
 				 DEV_RX_OFFLOAD_VLAN_FILTER |
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index b0253d5..c0f7981 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -1312,6 +1312,12 @@ hns3_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc,
 	rxq->ol3_csum_erros = 0;
 	rxq->ol4_csum_erros = 0;
 
+	/* CRC len set here is used for amending packet length */
+	if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC)
+		rxq->crc_len = RTE_ETHER_CRC_LEN;
+	else
+		rxq->crc_len = 0;
+
 	rte_spinlock_lock(&hw->lock);
 	dev->data->rx_queues[idx] = rxq;
 	rte_spinlock_unlock(&hw->lock);
@@ -1578,6 +1584,23 @@ hns3_rxd_to_vlan_tci(struct hns3_rx_queue *rxq, struct rte_mbuf *mb,
 	}
 }
 
+static inline void
+recalculate_data_len(struct rte_mbuf *first_seg, struct rte_mbuf *last_seg,
+		    struct rte_mbuf *rxm, struct hns3_rx_queue *rxq,
+		    uint16_t data_len)
+{
+	uint8_t crc_len = rxq->crc_len;
+
+	if (data_len <= crc_len) {
+		rte_pktmbuf_free_seg(rxm);
+		first_seg->nb_segs--;
+		last_seg->data_len = (uint16_t)(last_seg->data_len -
+			(crc_len - data_len));
+		last_seg->next = NULL;
+	} else
+		rxm->data_len = (uint16_t)(data_len - crc_len);
+}
+
 uint16_t
 hns3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 {
@@ -1708,7 +1731,11 @@ hns3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 		rxdp->rx.bd_base_info = 0;
 		rxdp->addr = dma_addr;
 
-		/* Load remained descriptor data and extract necessary fields */
+		/*
+		 * Load remained descriptor data and extract necessary fields.
+		 * Data size from buffer description may contains CRC len,
+		 * packet len should subtract it.
+		 */
 		data_len = (uint16_t)(rte_le_to_cpu_16(rxd.rx.size));
 		l234_info = rte_le_to_cpu_32(rxd.rx.l234_info);
 		ol_info = rte_le_to_cpu_32(rxd.rx.ol_info);
@@ -1729,9 +1756,31 @@ hns3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 			continue;
 		}
 
-		/* The last buffer of the received packet */
+		/*
+		 * The last buffer of the received packet. packet len from
+		 * buffer description may contains CRC len, packet len should
+		 * subtract it, same as data len.
+		 */
 		pkt_len = (uint16_t)(rte_le_to_cpu_16(rxd.rx.pkt_len));
 		first_seg->pkt_len = pkt_len;
+
+		/*
+		 * This is the last buffer of the received packet. If the CRC
+		 * is not stripped by the hardware:
+		 *  - Subtract the CRC length from the total packet length.
+		 *  - If the last buffer only contains the whole CRC or a part
+		 *  of it, free the mbuf associated to the last buffer. If part
+		 *  of the CRC is also contained in the previous mbuf, subtract
+		 *  the length of that CRC part from the data length of the
+		 *  previous mbuf.
+		 */
+		rxm->next = NULL;
+		if (unlikely(rxq->crc_len > 0)) {
+			first_seg->pkt_len -= rxq->crc_len;
+			recalculate_data_len(first_seg, last_seg, rxm, rxq,
+				data_len);
+		}
+
 		first_seg->port = rxq->port_id;
 		first_seg->hash.rss = rte_le_to_cpu_32(rxd.rx.rss_hash);
 		first_seg->ol_flags = PKT_RX_RSS_HASH;
@@ -1740,7 +1789,6 @@ hns3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 				rte_le_to_cpu_32(rxd.rx.fd_id);
 			first_seg->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID;
 		}
-		rxm->next = NULL;
 
 		gro_size = hns3_get_field(bd_base_info, HNS3_RXD_GRO_SIZE_M,
 					  HNS3_RXD_GRO_SIZE_S);
diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h
index ccd508b..0d20a27 100644
--- a/drivers/net/hns3/hns3_rxtx.h
+++ b/drivers/net/hns3/hns3_rxtx.h
@@ -256,6 +256,9 @@ struct hns3_rx_queue {
 	 */
 	uint16_t pvid_state;
 
+	/* 4 if DEV_RX_OFFLOAD_KEEP_CRC offload set, 0 otherwise */
+	uint8_t crc_len;
+
 	bool rx_deferred_start; /* don't start this queue in dev start */
 	bool configured;        /* indicate if rx queue has been configured */
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v3 4/4] net/hns3: fix RSS configuration when empty RSS type
  2020-07-14  6:16   ` [dpdk-dev] [PATCH v3 0/4] updates for hns3 PMD driver Wei Hu (Xavier)
                       ` (2 preceding siblings ...)
  2020-07-14  6:16     ` [dpdk-dev] [PATCH v3 3/4] net/hns3: support keeping CRC Wei Hu (Xavier)
@ 2020-07-14  6:16     ` Wei Hu (Xavier)
  2020-07-14 11:07     ` [dpdk-dev] [PATCH v3 0/4] updates for hns3 PMD driver Ferruh Yigit
  4 siblings, 0 replies; 11+ messages in thread
From: Wei Hu (Xavier) @ 2020-07-14  6:16 UTC (permalink / raw)
  To: dev; +Cc: xavier.huwei

From: Lijun Ou <oulijun@huawei.com>

According to the definition of RSS types of action attributes from
testpmd, the driver will not disable RSS but instead requests the
unspecified "best-effort" settings when upper application call
rte_flow_create API function to create flow using empty RSS types.

As a result, here use the default RSS types when RSS types is empty.

Fixes: c37ca66f2b27 ("net/hns3: support RSS")
Cc: stable@dpdk.org

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/net/hns3/hns3_flow.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c
index 1e58ad7..7ec46ae 100644
--- a/drivers/net/hns3/hns3_flow.c
+++ b/drivers/net/hns3/hns3_flow.c
@@ -1486,7 +1486,9 @@ hns3_config_rss_filter(struct rte_eth_dev *dev,
 	}
 
 	/* Filter the unsupported flow types */
-	flow_types = rss_flow_conf.types & HNS3_ETH_RSS_SUPPORT;
+	flow_types = conf->conf.types ?
+		     rss_flow_conf.types & HNS3_ETH_RSS_SUPPORT :
+		     hw->rss_info.conf.types;
 	if (flow_types != rss_flow_conf.types)
 		hns3_warn(hw, "modified RSS types based on hardware support, "
 			      "requested:%" PRIx64 " configured:%" PRIx64,
@@ -1494,9 +1496,6 @@ hns3_config_rss_filter(struct rte_eth_dev *dev,
 	/* Update the useful flow types */
 	rss_flow_conf.types = flow_types;
 
-	if ((rss_flow_conf.types & ETH_RSS_PROTO_MASK) == 0)
-		return hns3_disable_rss(hw);
-
 	rss_info = &hw->rss_info;
 	if (!add) {
 		if (hns3_action_rss_same(&rss_info->conf, &rss_flow_conf)) {
-- 
2.7.4


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH v3 0/4] updates for hns3 PMD driver
  2020-07-14  6:16   ` [dpdk-dev] [PATCH v3 0/4] updates for hns3 PMD driver Wei Hu (Xavier)
                       ` (3 preceding siblings ...)
  2020-07-14  6:16     ` [dpdk-dev] [PATCH v3 4/4] net/hns3: fix RSS configuration when empty RSS type Wei Hu (Xavier)
@ 2020-07-14 11:07     ` Ferruh Yigit
  4 siblings, 0 replies; 11+ messages in thread
From: Ferruh Yigit @ 2020-07-14 11:07 UTC (permalink / raw)
  To: Wei Hu (Xavier), dev

On 7/14/2020 7:16 AM, Wei Hu (Xavier) wrote:
> This series are updates for hns3 PMD driver.
> 
> Lijun Ou (1):
>   net/hns3: fix RSS configuration when empty RSS type
> 
> Min Hu (Connor) (1):
>   net/hns3: support keeping CRC
> 
> Wei Hu (Xavier) (2):
>   net/hns3: support copper media type
>   net/hns3: support 200G speed rate
> 

Series applied to dpdk-next-net/master, thanks.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-07-14 11:07 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-11 10:18 [dpdk-dev] [PATCH v2 0/4] updates for hns3 PMD driver Wei Hu (Xavier)
2020-07-11 10:18 ` [dpdk-dev] [PATCH v2 1/4] net/hns3: support copper media type Wei Hu (Xavier)
2020-07-14  6:16   ` [dpdk-dev] [PATCH v3 0/4] updates for hns3 PMD driver Wei Hu (Xavier)
2020-07-14  6:16     ` [dpdk-dev] [PATCH v3 1/4] net/hns3: support copper media type Wei Hu (Xavier)
2020-07-14  6:16     ` [dpdk-dev] [PATCH v3 2/4] net/hns3: support 200G speed rate Wei Hu (Xavier)
2020-07-14  6:16     ` [dpdk-dev] [PATCH v3 3/4] net/hns3: support keeping CRC Wei Hu (Xavier)
2020-07-14  6:16     ` [dpdk-dev] [PATCH v3 4/4] net/hns3: fix RSS configuration when empty RSS type Wei Hu (Xavier)
2020-07-14 11:07     ` [dpdk-dev] [PATCH v3 0/4] updates for hns3 PMD driver Ferruh Yigit
2020-07-11 10:18 ` [dpdk-dev] [PATCH v2 2/4] net/hns3: support 200G speed rate Wei Hu (Xavier)
2020-07-11 10:18 ` [dpdk-dev] [PATCH v2 3/4] net/hns3: support keeping CRC Wei Hu (Xavier)
2020-07-11 10:18 ` [dpdk-dev] [PATCH v2 4/4] net/hns3: fix RSS configuration when empty RSS type Wei Hu (Xavier)

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git