DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/3] add i40e RSS support in VF
@ 2014-07-18  2:45 Helin Zhang
  2014-07-18  2:45 ` [dpdk-dev] [PATCH 1/3] i40evf: add " Helin Zhang
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Helin Zhang @ 2014-07-18  2:45 UTC (permalink / raw)
  To: dev

As RSS in i40e VF is supported by hardware, these patches enable
it in i40e PMD, and also enable its testing in testpmd.

Helin Zhang (3):
  i40evf: add RSS support in VF
  app/testpmd: enable RSS support for i40e
  ethdev: improvements for some macro definition in head file

 app/test-pmd/testpmd.c               |  13 ++-
 lib/librte_ether/rte_ethdev.h        |  47 ++++----
 lib/librte_pmd_i40e/i40e_ethdev.c    |   4 +-
 lib/librte_pmd_i40e/i40e_ethdev.h    |  40 ++++++-
 lib/librte_pmd_i40e/i40e_ethdev_vf.c | 208 +++++++++++++++++++++++++++++++++++
 5 files changed, 284 insertions(+), 28 deletions(-)

-- 
1.8.1.4

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

* [dpdk-dev] [PATCH 1/3] i40evf: add RSS support in VF
  2014-07-18  2:45 [dpdk-dev] [PATCH 0/3] add i40e RSS support in VF Helin Zhang
@ 2014-07-18  2:45 ` Helin Zhang
  2014-07-18  2:45 ` [dpdk-dev] [PATCH 2/3] app/testpmd: enable RSS support for i40e Helin Zhang
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Helin Zhang @ 2014-07-18  2:45 UTC (permalink / raw)
  To: dev

Add VF RSS support in Poll Mode Driver, as it is supported by hardware.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Jijiang Liu <jijiang.liu@intel.com>
---
 lib/librte_pmd_i40e/i40e_ethdev.c    |   4 +-
 lib/librte_pmd_i40e/i40e_ethdev.h    |  40 ++++++-
 lib/librte_pmd_i40e/i40e_ethdev_vf.c | 208 +++++++++++++++++++++++++++++++++++
 3 files changed, 249 insertions(+), 3 deletions(-)

diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c
index 9ed31b5..85e8b18 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -3747,7 +3747,7 @@ DONE:
 }
 
 /* Configure hash enable flags for RSS */
-static uint64_t
+uint64_t
 i40e_config_hena(uint64_t flags)
 {
 	uint64_t hena = 0;
@@ -3782,7 +3782,7 @@ i40e_config_hena(uint64_t flags)
 }
 
 /* Parse the hash enable flags */
-static uint64_t
+uint64_t
 i40e_parse_hena(uint64_t flags)
 {
 	uint64_t rss_hf = 0;
diff --git a/lib/librte_pmd_i40e/i40e_ethdev.h b/lib/librte_pmd_i40e/i40e_ethdev.h
index 64deef2..1d42cd2 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.h
+++ b/lib/librte_pmd_i40e/i40e_ethdev.h
@@ -68,6 +68,36 @@
 		       I40E_FLAG_HEADER_SPLIT_ENABLED | \
 		       I40E_FLAG_FDIR)
 
+#define I40E_RSS_OFFLOAD_ALL ( \
+	ETH_RSS_NONF_IPV4_UDP | \
+	ETH_RSS_NONF_IPV4_TCP | \
+	ETH_RSS_NONF_IPV4_SCTP | \
+	ETH_RSS_NONF_IPV4_OTHER | \
+	ETH_RSS_FRAG_IPV4 | \
+	ETH_RSS_NONF_IPV6_UDP | \
+	ETH_RSS_NONF_IPV6_TCP | \
+	ETH_RSS_NONF_IPV6_SCTP | \
+	ETH_RSS_NONF_IPV6_OTHER | \
+	ETH_RSS_FRAG_IPV6 | \
+	ETH_RSS_L2_PAYLOAD)
+
+/* All bits of RSS hash enable */
+#define I40E_RSS_HENA_ALL ( \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_UDP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_SCTP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_OTHER) | \
+	(1ULL << I40E_FILTER_PCTYPE_FRAG_IPV4) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_UDP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_SCTP) | \
+	(1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER) | \
+	(1ULL << I40E_FILTER_PCTYPE_FRAG_IPV6) | \
+	(1ULL << I40E_FILTER_PCTYPE_FCOE_OX) | \
+	(1ULL << I40E_FILTER_PCTYPE_FCOE_RX) | \
+	(1ULL << I40E_FILTER_PCTYPE_FCOE_OTHER) | \
+	(1ULL << I40E_FILTER_PCTYPE_L2_PAYLOAD))
+
 struct i40e_adapter;
 
 TAILQ_HEAD(i40e_mac_filter_list, i40e_mac_filter);
@@ -253,6 +283,8 @@ struct i40e_vf_tx_queues {
  * Structure to store private data specific for VF instance.
  */
 struct i40e_vf {
+	struct i40e_adapter *adapter; /* The adapter this VF associate to */
+	struct rte_eth_dev_data *dev_data; /* Pointer to the device data */
 	uint16_t num_queue_pairs;
 	uint16_t max_pkt_len; /* Maximum packet length */
 	bool promisc_unicast_enabled;
@@ -310,8 +342,10 @@ int i40e_dev_link_update(struct rte_eth_dev *dev,
 void i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi);
 void i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi);
 int i40e_vsi_vlan_pvid_set(struct i40e_vsi *vsi,
-				struct i40e_vsi_vlan_pvid_info *info);
+			   struct i40e_vsi_vlan_pvid_info *info);
 int i40e_vsi_config_vlan_stripping(struct i40e_vsi *vsi, bool on);
+uint64_t i40e_config_hena(uint64_t flags);
+uint64_t i40e_parse_hena(uint64_t flags);
 
 /* I40E_DEV_PRIVATE_TO */
 #define I40E_DEV_PRIVATE_TO_PF(adapter) \
@@ -361,6 +395,10 @@ i40e_get_vsi_from_adapter(struct i40e_adapter *adapter)
 #define I40E_PF_TO_ADAPTER(pf) \
 	((struct i40e_adapter *)pf->adapter)
 
+/* I40E_VF_TO */
+#define I40E_VF_TO_HW(vf) \
+	(&(((struct i40e_vf *)vf)->adapter->hw))
+
 static inline void
 i40e_init_adminq_parameter(struct i40e_hw *hw)
 {
diff --git a/lib/librte_pmd_i40e/i40e_ethdev_vf.c b/lib/librte_pmd_i40e/i40e_ethdev_vf.c
index 2726bfb..bef34cb 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev_vf.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev_vf.c
@@ -125,6 +125,19 @@ static void i40evf_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int i40evf_get_link_status(struct rte_eth_dev *dev,
 				  struct rte_eth_link *link);
 static int i40evf_init_vlan(struct rte_eth_dev *dev);
+static int i40evf_config_rss(struct i40e_vf *vf);
+static int i40evf_dev_rss_reta_update(struct rte_eth_dev *dev,
+				      struct rte_eth_rss_reta *reta_conf);
+static int i40evf_dev_rss_reta_query(struct rte_eth_dev *dev,
+				     struct rte_eth_rss_reta *reta_conf);
+static int i40evf_dev_rss_hash_update(struct rte_eth_dev *dev,
+				      struct rte_eth_rss_conf *rss_conf);
+static int i40evf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
+					struct rte_eth_rss_conf *rss_conf);
+
+/* Default hash key buffer for RSS */
+static uint32_t rss_key_default[I40E_VFQF_HKEY_MAX_INDEX + 1];
+
 static struct eth_dev_ops i40evf_eth_dev_ops = {
 	.dev_configure        = i40evf_dev_configure,
 	.dev_start            = i40evf_dev_start,
@@ -144,6 +157,10 @@ static struct eth_dev_ops i40evf_eth_dev_ops = {
 	.rx_queue_release     = i40e_dev_rx_queue_release,
 	.tx_queue_setup       = i40e_dev_tx_queue_setup,
 	.tx_queue_release     = i40e_dev_tx_queue_release,
+	.reta_update          = i40evf_dev_rss_reta_update,
+	.reta_query           = i40evf_dev_rss_reta_query,
+	.rss_hash_update      = i40evf_dev_rss_hash_update,
+	.rss_hash_conf_get    = i40evf_dev_rss_hash_conf_get,
 };
 
 static int
@@ -941,6 +958,8 @@ i40evf_init_vf(struct rte_eth_dev *dev)
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 
+	vf->adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+	vf->dev_data = dev->data;
 	err = i40evf_set_mac_type(hw);
 	if (err) {
 		PMD_INIT_LOG(ERR, "set_mac_type failed: %d\n", err);
@@ -1194,11 +1213,13 @@ i40evf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 static int
 i40evf_rx_init(struct rte_eth_dev *dev)
 {
+	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	uint16_t i, j;
 	struct i40e_rx_queue **rxq =
 		(struct i40e_rx_queue **)dev->data->rx_queues;
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
+	i40evf_config_rss(vf);
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {
 		if (i40e_alloc_rx_queue_mbufs(rxq[i]) != 0) {
 			PMD_DRV_LOG(ERR, "alloc rx queues mbufs failed\n");
@@ -1445,3 +1466,190 @@ i40evf_dev_close(struct rte_eth_dev *dev)
 	i40evf_reset_vf(hw);
 	i40e_shutdown_adminq(hw);
 }
+
+static int
+i40evf_hw_rss_hash_set(struct i40e_hw *hw, struct rte_eth_rss_conf *rss_conf)
+{
+	uint32_t *hash_key;
+	uint8_t hash_key_len;
+	uint64_t rss_hf, hena;
+
+	hash_key = (uint32_t *)(rss_conf->rss_key);
+	hash_key_len = rss_conf->rss_key_len;
+	if (hash_key != NULL && hash_key_len >=
+		(I40E_VFQF_HKEY_MAX_INDEX + 1) * sizeof(uint32_t)) {
+		uint16_t i;
+
+		for (i = 0; i <= I40E_VFQF_HKEY_MAX_INDEX; i++)
+			I40E_WRITE_REG(hw, I40E_VFQF_HKEY(i), hash_key[i]);
+	}
+
+	rss_hf = rss_conf->rss_hf;
+	hena = (uint64_t)I40E_READ_REG(hw, I40E_VFQF_HENA(0));
+	hena |= ((uint64_t)I40E_READ_REG(hw, I40E_VFQF_HENA(1))) << 32;
+	hena &= ~I40E_RSS_HENA_ALL;
+	hena |= i40e_config_hena(rss_hf);
+	I40E_WRITE_REG(hw, I40E_VFQF_HENA(0), (uint32_t)hena);
+	I40E_WRITE_REG(hw, I40E_VFQF_HENA(1), (uint32_t)(hena >> 32));
+	I40EVF_WRITE_FLUSH(hw);
+
+	return 0;
+}
+
+static void
+i40evf_disable_rss(struct i40e_vf *vf)
+{
+	struct i40e_hw *hw = I40E_VF_TO_HW(vf);
+	uint64_t hena;
+
+	hena = (uint64_t)I40E_READ_REG(hw, I40E_VFQF_HENA(0));
+	hena |= ((uint64_t)I40E_READ_REG(hw, I40E_VFQF_HENA(1))) << 32;
+	hena &= ~I40E_RSS_HENA_ALL;
+	I40E_WRITE_REG(hw, I40E_VFQF_HENA(0), (uint32_t)hena);
+	I40E_WRITE_REG(hw, I40E_VFQF_HENA(1), (uint32_t)(hena >> 32));
+	I40EVF_WRITE_FLUSH(hw);
+}
+
+static int
+i40evf_config_rss(struct i40e_vf *vf)
+{
+	struct i40e_hw *hw = I40E_VF_TO_HW(vf);
+	struct rte_eth_rss_conf rss_conf;
+	uint32_t i, j, lut = 0, nb_q = (I40E_VFQF_HLUT_MAX_INDEX + 1) * 4;
+
+	if (vf->dev_data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) {
+		i40evf_disable_rss(vf);
+		PMD_DRV_LOG(DEBUG, "RSS not configured\n");
+		return 0;
+	}
+
+	/* Fill out the look up table */
+	for (i = 0, j = 0; i < nb_q; i++, j++) {
+		if (j >= vf->num_queue_pairs)
+			j = 0;
+		lut = (lut << 8) | j;
+		if ((i & 3) == 3)
+			I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
+	}
+
+	rss_conf = vf->dev_data->dev_conf.rx_adv_conf.rss_conf;
+	if ((rss_conf.rss_hf & I40E_RSS_OFFLOAD_ALL) == 0) {
+		i40evf_disable_rss(vf);
+		PMD_DRV_LOG(DEBUG, "No hash flag is set\n");
+		return 0;
+	}
+
+	if (rss_conf.rss_key == NULL || rss_conf.rss_key_len < nb_q) {
+		/* Calculate the default hash key */
+		for (i = 0; i <= I40E_VFQF_HKEY_MAX_INDEX; i++)
+			rss_key_default[i] = (uint32_t)rte_rand();
+		rss_conf.rss_key = (uint8_t *)rss_key_default;
+		rss_conf.rss_key_len = nb_q;
+	}
+
+	return i40evf_hw_rss_hash_set(hw, &rss_conf);
+}
+
+static int
+i40evf_dev_rss_reta_update(struct rte_eth_dev *dev,
+			   struct rte_eth_rss_reta *reta_conf)
+{
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	uint8_t i, j, mask, max = ETH_RSS_RETA_NUM_ENTRIES / 2;
+	uint32_t lut, l;
+
+	for (i = 0; i < ETH_RSS_RETA_NUM_ENTRIES; i += 4) {
+		if (i < max)
+			mask = (uint8_t)((reta_conf->mask_lo >> i) & 0xF);
+		else
+			mask = (uint8_t)((reta_conf->mask_hi >>
+						(i - max)) & 0xF);
+		if (!mask)
+			continue;
+		if (mask == 0xf)
+			l = 0;
+		else
+			l = I40E_READ_REG(hw, I40E_VFQF_HLUT(i >> 2));
+
+		for (j = 0, lut = 0; j < 4; j++) {
+			if (mask & (0x1 << j))
+				lut |= reta_conf->reta[i + j] << (8 * j);
+			else
+				lut |= l & (0xff << (8 * j));
+		}
+		I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
+	}
+
+	return 0;
+}
+
+static int
+i40evf_dev_rss_reta_query(struct rte_eth_dev *dev,
+			  struct rte_eth_rss_reta *reta_conf)
+{
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	uint8_t i, j, mask, max = ETH_RSS_RETA_NUM_ENTRIES / 2;
+	uint32_t lut;
+
+	for (i = 0; i < ETH_RSS_RETA_NUM_ENTRIES; i += 4) {
+		if (i < max)
+			mask = (uint8_t)((reta_conf->mask_lo >> i) & 0xF);
+		else
+			mask = (uint8_t)((reta_conf->mask_hi >>
+						(i - max)) & 0xF);
+		if (!mask)
+			continue;
+		lut = I40E_READ_REG(hw, I40E_VFQF_HLUT(i >> 2));
+		for (j = 0; j < 4; j++) {
+			if (mask & (0x1 << j))
+				reta_conf->reta[i + j] =
+					(uint8_t)((lut >> (8 * j)) & 0xFF);
+		}
+	}
+
+	return 0;
+}
+
+static int
+i40evf_dev_rss_hash_update(struct rte_eth_dev *dev,
+			   struct rte_eth_rss_conf *rss_conf)
+{
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	uint64_t rss_hf = rss_conf->rss_hf & I40E_RSS_OFFLOAD_ALL;
+	uint64_t hena;
+
+	hena = (uint64_t)I40E_READ_REG(hw, I40E_VFQF_HENA(0));
+	hena |= ((uint64_t)I40E_READ_REG(hw, I40E_VFQF_HENA(1))) << 32;
+	if (!(hena & I40E_RSS_HENA_ALL)) { /* RSS disabled */
+		if (rss_hf != 0) /* Enable RSS */
+			return -EINVAL;
+		return 0;
+	}
+
+	/* RSS enabled */
+	if (rss_hf == 0) /* Disable RSS */
+		return -EINVAL;
+
+	return i40evf_hw_rss_hash_set(hw, rss_conf);
+}
+
+static int
+i40evf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
+			     struct rte_eth_rss_conf *rss_conf)
+{
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	uint32_t *hash_key = (uint32_t *)(rss_conf->rss_key);
+	uint64_t hena;
+	uint16_t i;
+
+	if (hash_key) {
+		for (i = 0; i <= I40E_VFQF_HKEY_MAX_INDEX; i++)
+			hash_key[i] = I40E_READ_REG(hw, I40E_VFQF_HKEY(i));
+		rss_conf->rss_key_len = i * sizeof(uint32_t);
+	}
+	hena = (uint64_t)I40E_READ_REG(hw, I40E_VFQF_HENA(0));
+	hena |= ((uint64_t)I40E_READ_REG(hw, I40E_VFQF_HENA(1))) << 32;
+	rss_conf->rss_hf = i40e_parse_hena(hena);
+
+	return 0;
+}
-- 
1.8.1.4

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

* [dpdk-dev] [PATCH 2/3] app/testpmd: enable RSS support for i40e
  2014-07-18  2:45 [dpdk-dev] [PATCH 0/3] add i40e RSS support in VF Helin Zhang
  2014-07-18  2:45 ` [dpdk-dev] [PATCH 1/3] i40evf: add " Helin Zhang
@ 2014-07-18  2:45 ` Helin Zhang
  2014-08-27 15:36   ` Thomas Monjalon
  2014-07-18  2:45 ` [dpdk-dev] [PATCH 3/3] ethdev: improvements for some macro definition in head file Helin Zhang
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Helin Zhang @ 2014-07-18  2:45 UTC (permalink / raw)
  To: dev

i40e can support RSS no matter if SR-IOV is enabled or not, while
ixgbe/igb can not support RSS if it is SR-IOV. Code changes are
needed to support i40e RSS if SR-IOV is enabled.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Jijiang Liu <jijiang.liu@intel.com>
Acked-by: Cunming Liang <cunming.liang@intel.com>
---
 app/test-pmd/testpmd.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index e8a4b45..2a2ec76 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1684,8 +1684,17 @@ init_port_config(void)
 			port->dev_conf.rx_adv_conf.rss_conf.rss_hf = 0;
 		}
 
-		/* In SR-IOV mode, RSS mode is not available */
-		if (port->dcb_flag == 0 && port->dev_info.max_vfs == 0) {
+		/**
+		 * For i40e, RSS is always available.
+		 * For non-i40e, RSS is available in non-SRIOV mode,
+		 * according to datasheet.
+		 */
+		if (port->dcb_flag == 0 &&
+			((port->dev_info.max_vfs == 0) ||
+			(!strcmp(port->dev_info.driver_name,
+					"rte_i40e_pmd")) ||
+			(!strcmp(port->dev_info.driver_name,
+					"rte_i40evf_pmd")))) {
 			if( port->dev_conf.rx_adv_conf.rss_conf.rss_hf != 0)
 				port->dev_conf.rxmode.mq_mode = ETH_MQ_RX_RSS;
 			else
-- 
1.8.1.4

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

* [dpdk-dev] [PATCH 3/3] ethdev: improvements for some macro definition in head file
  2014-07-18  2:45 [dpdk-dev] [PATCH 0/3] add i40e RSS support in VF Helin Zhang
  2014-07-18  2:45 ` [dpdk-dev] [PATCH 1/3] i40evf: add " Helin Zhang
  2014-07-18  2:45 ` [dpdk-dev] [PATCH 2/3] app/testpmd: enable RSS support for i40e Helin Zhang
@ 2014-07-18  2:45 ` Helin Zhang
  2014-08-27 15:42   ` Thomas Monjalon
  2014-07-31  1:55 ` [dpdk-dev] [PATCH 0/3] add i40e RSS support in VF Zhan, Zhaochen
  2014-08-20  7:07 ` Zhang, Helin
  4 siblings, 1 reply; 8+ messages in thread
From: Helin Zhang @ 2014-07-18  2:45 UTC (permalink / raw)
  To: dev

improvements for some macro definition about RSS packet
classification types in rte_ethdev.h.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Jijiang Liu <jijiang.liu@intel.com>
---
 lib/librte_ether/rte_ethdev.h | 47 ++++++++++++++++++++++---------------------
 1 file changed, 24 insertions(+), 23 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 50df654..3a0b33b 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -362,30 +362,31 @@ struct rte_eth_rss_conf {
 #define ETH_RSS_L2_PAYLOAD_SHIFT              63
 
 /* for 1G & 10G */
-#define ETH_RSS_IPV4                    ((uint16_t)1 << ETH_RSS_IPV4_SHIFT)
-#define ETH_RSS_IPV4_TCP                ((uint16_t)1 << ETH_RSS_IPV4_TCP_SHIFT)
-#define ETH_RSS_IPV6                    ((uint16_t)1 << ETH_RSS_IPV6_SHIFT)
-#define ETH_RSS_IPV6_EX                 ((uint16_t)1 << ETH_RSS_IPV6_EX_SHIFT)
-#define ETH_RSS_IPV6_TCP                ((uint16_t)1 << ETH_RSS_IPV6_TCP_SHIFT)
-#define ETH_RSS_IPV6_TCP_EX             ((uint16_t)1 << ETH_RSS_IPV6_TCP_EX_SHIFT)
-#define ETH_RSS_IPV4_UDP                ((uint16_t)1 << ETH_RSS_IPV4_UDP_SHIFT)
-#define ETH_RSS_IPV6_UDP                ((uint16_t)1 << ETH_RSS_IPV6_UDP_SHIFT)
-#define ETH_RSS_IPV6_UDP_EX             ((uint16_t)1 << ETH_RSS_IPV6_UDP_EX_SHIFT)
+#define ETH_RSS_IPV4                    (1 << ETH_RSS_IPV4_SHIFT)
+#define ETH_RSS_IPV4_TCP                (1 << ETH_RSS_IPV4_TCP_SHIFT)
+#define ETH_RSS_IPV6                    (1 << ETH_RSS_IPV6_SHIFT)
+#define ETH_RSS_IPV6_EX                 (1 << ETH_RSS_IPV6_EX_SHIFT)
+#define ETH_RSS_IPV6_TCP                (1 << ETH_RSS_IPV6_TCP_SHIFT)
+#define ETH_RSS_IPV6_TCP_EX             (1 << ETH_RSS_IPV6_TCP_EX_SHIFT)
+#define ETH_RSS_IPV4_UDP                (1 << ETH_RSS_IPV4_UDP_SHIFT)
+#define ETH_RSS_IPV6_UDP                (1 << ETH_RSS_IPV6_UDP_SHIFT)
+#define ETH_RSS_IPV6_UDP_EX             (1 << ETH_RSS_IPV6_UDP_EX_SHIFT)
 /* for 40G only */
-#define ETH_RSS_NONF_IPV4_UDP           ((uint64_t)1 << ETH_RSS_NONF_IPV4_UDP_SHIFT)
-#define ETH_RSS_NONF_IPV4_TCP           ((uint64_t)1 << ETH_RSS_NONF_IPV4_TCP_SHIFT)
-#define ETH_RSS_NONF_IPV4_SCTP          ((uint64_t)1 << ETH_RSS_NONF_IPV4_SCTP_SHIFT)
-#define ETH_RSS_NONF_IPV4_OTHER         ((uint64_t)1 << ETH_RSS_NONF_IPV4_OTHER_SHIFT)
-#define ETH_RSS_FRAG_IPV4               ((uint64_t)1 << ETH_RSS_FRAG_IPV4_SHIFT)
-#define ETH_RSS_NONF_IPV6_UDP           ((uint64_t)1 << ETH_RSS_NONF_IPV6_UDP_SHIFT)
-#define ETH_RSS_NONF_IPV6_TCP           ((uint64_t)1 << ETH_RSS_NONF_IPV6_TCP_SHIFT)
-#define ETH_RSS_NONF_IPV6_SCTP          ((uint64_t)1 << ETH_RSS_NONF_IPV6_SCTP_SHIFT)
-#define ETH_RSS_NONF_IPV6_OTHER         ((uint64_t)1 << ETH_RSS_NONF_IPV6_OTHER_SHIFT)
-#define ETH_RSS_FRAG_IPV6               ((uint64_t)1 << ETH_RSS_FRAG_IPV6_SHIFT)
-#define ETH_RSS_FCOE_OX                 ((uint64_t)1 << ETH_RSS_FCOE_OX_SHIFT) /* not used */
-#define ETH_RSS_FCOE_RX                 ((uint64_t)1 << ETH_RSS_FCOE_RX_SHIFT) /* not used */
-#define ETH_RSS_FCOE_OTHER              ((uint64_t)1 << ETH_RSS_FCOE_OTHER_SHIFT) /* not used */
-#define ETH_RSS_L2_PAYLOAD              ((uint64_t)1 << ETH_RSS_L2_PAYLOAD_SHIFT)
+#define ETH_RSS_NONF_IPV4_UDP           (1ULL << ETH_RSS_NONF_IPV4_UDP_SHIFT)
+#define ETH_RSS_NONF_IPV4_TCP           (1ULL << ETH_RSS_NONF_IPV4_TCP_SHIFT)
+#define ETH_RSS_NONF_IPV4_SCTP          (1ULL << ETH_RSS_NONF_IPV4_SCTP_SHIFT)
+#define ETH_RSS_NONF_IPV4_OTHER         (1ULL << ETH_RSS_NONF_IPV4_OTHER_SHIFT)
+#define ETH_RSS_FRAG_IPV4               (1ULL << ETH_RSS_FRAG_IPV4_SHIFT)
+#define ETH_RSS_NONF_IPV6_UDP           (1ULL << ETH_RSS_NONF_IPV6_UDP_SHIFT)
+#define ETH_RSS_NONF_IPV6_TCP           (1ULL << ETH_RSS_NONF_IPV6_TCP_SHIFT)
+#define ETH_RSS_NONF_IPV6_SCTP          (1ULL << ETH_RSS_NONF_IPV6_SCTP_SHIFT)
+#define ETH_RSS_NONF_IPV6_OTHER         (1ULL << ETH_RSS_NONF_IPV6_OTHER_SHIFT)
+#define ETH_RSS_FRAG_IPV6               (1ULL << ETH_RSS_FRAG_IPV6_SHIFT)
+/* FCOE relevant should not be used */
+#define ETH_RSS_FCOE_OX                 (1ULL << ETH_RSS_FCOE_OX_SHIFT)
+#define ETH_RSS_FCOE_RX                 (1ULL << ETH_RSS_FCOE_RX_SHIFT)
+#define ETH_RSS_FCOE_OTHER              (1ULL << ETH_RSS_FCOE_OTHER_SHIFT)
+#define ETH_RSS_L2_PAYLOAD              (1ULL << ETH_RSS_L2_PAYLOAD_SHIFT)
 
 #define ETH_RSS_IP ( \
 		ETH_RSS_IPV4 | \
-- 
1.8.1.4

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

* Re: [dpdk-dev] [PATCH 0/3] add i40e RSS support in VF
  2014-07-18  2:45 [dpdk-dev] [PATCH 0/3] add i40e RSS support in VF Helin Zhang
                   ` (2 preceding siblings ...)
  2014-07-18  2:45 ` [dpdk-dev] [PATCH 3/3] ethdev: improvements for some macro definition in head file Helin Zhang
@ 2014-07-31  1:55 ` Zhan, Zhaochen
  2014-08-20  7:07 ` Zhang, Helin
  4 siblings, 0 replies; 8+ messages in thread
From: Zhan, Zhaochen @ 2014-07-31  1:55 UTC (permalink / raw)
  To: Zhang, Helin, dev


> As RSS in i40e VF is supported by hardware, these patches enable
> it in i40e PMD, and also enable its testing in testpmd.
> 
> Helin Zhang (3):
>   i40evf: add RSS support in VF
>   app/testpmd: enable RSS support for i40e
>   ethdev: improvements for some macro definition in head file

Tested-by: Zhaochen Zhan <zhaochen.zhan@intel.com>

I have tested this patch on KVM virtual machine with Fortville NIC.
Testpmd support RSS works well with rx_queue=4/16, the max_queue can be
configured by CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_VF in the config file.

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

* Re: [dpdk-dev] [PATCH 0/3] add i40e RSS support in VF
  2014-07-18  2:45 [dpdk-dev] [PATCH 0/3] add i40e RSS support in VF Helin Zhang
                   ` (3 preceding siblings ...)
  2014-07-31  1:55 ` [dpdk-dev] [PATCH 0/3] add i40e RSS support in VF Zhan, Zhaochen
@ 2014-08-20  7:07 ` Zhang, Helin
  4 siblings, 0 replies; 8+ messages in thread
From: Zhang, Helin @ 2014-08-20  7:07 UTC (permalink / raw)
  To: dev



> -----Original Message-----
> From: Zhang, Helin
> Sent: Friday, July 18, 2014 10:45 AM
> To: dev@dpdk.org
> Cc: Zhang, Helin
> Subject: [PATCH 0/3] add i40e RSS support in VF
> 
> As RSS in i40e VF is supported by hardware, these patches enable it in i40e
> PMD, and also enable its testing in testpmd.
> 
> Helin Zhang (3):
>   i40evf: add RSS support in VF
>   app/testpmd: enable RSS support for i40e
>   ethdev: improvements for some macro definition in head file
> 
>  app/test-pmd/testpmd.c               |  13 ++-
>  lib/librte_ether/rte_ethdev.h        |  47 ++++----
>  lib/librte_pmd_i40e/i40e_ethdev.c    |   4 +-
>  lib/librte_pmd_i40e/i40e_ethdev.h    |  40 ++++++-
>  lib/librte_pmd_i40e/i40e_ethdev_vf.c | 208
> +++++++++++++++++++++++++++++++++++
>  5 files changed, 284 insertions(+), 28 deletions(-)
> 
> --
> 1.8.1.4


Hi guys

Any comments for these patches?
Any next steps planned for merging these patches?

Regards,
Helin

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

* Re: [dpdk-dev] [PATCH 2/3] app/testpmd: enable RSS support for i40e
  2014-07-18  2:45 ` [dpdk-dev] [PATCH 2/3] app/testpmd: enable RSS support for i40e Helin Zhang
@ 2014-08-27 15:36   ` Thomas Monjalon
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Monjalon @ 2014-08-27 15:36 UTC (permalink / raw)
  To: Helin Zhang; +Cc: dev

2014-07-18 10:45, Helin Zhang:
> i40e can support RSS no matter if SR-IOV is enabled or not, while
> ixgbe/igb can not support RSS if it is SR-IOV. Code changes are
> needed to support i40e RSS if SR-IOV is enabled.
[...]
> -		/* In SR-IOV mode, RSS mode is not available */
> -		if (port->dcb_flag == 0 && port->dev_info.max_vfs == 0) {
> +		/**
> +		 * For i40e, RSS is always available.
> +		 * For non-i40e, RSS is available in non-SRIOV mode,
> +		 * according to datasheet.
> +		 */
> +		if (port->dcb_flag == 0 &&
> +			((port->dev_info.max_vfs == 0) ||
> +			(!strcmp(port->dev_info.driver_name,
> +					"rte_i40e_pmd")) ||
> +			(!strcmp(port->dev_info.driver_name,
> +					"rte_i40evf_pmd")))) {

This kind of knowledge should be coded in the drivers.
Application writer doesn't have to read the datasheet to use the drivers.
I think returning an error in the driver could be enough to handle it at
application level.

Thanks
-- 
Thomas

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

* Re: [dpdk-dev] [PATCH 3/3] ethdev: improvements for some macro definition in head file
  2014-07-18  2:45 ` [dpdk-dev] [PATCH 3/3] ethdev: improvements for some macro definition in head file Helin Zhang
@ 2014-08-27 15:42   ` Thomas Monjalon
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Monjalon @ 2014-08-27 15:42 UTC (permalink / raw)
  To: Helin Zhang; +Cc: dev

2014-07-18 10:45, Helin Zhang:
> improvements for some macro definition about RSS packet
> classification types in rte_ethdev.h.
[...]
> -#define ETH_RSS_IPV4                    ((uint16_t)1 << ETH_RSS_IPV4_SHIFT)
[...]
> +#define ETH_RSS_IPV4                    (1 << ETH_RSS_IPV4_SHIFT)

Please explain your change in the commit log.
In general, the log should answer to these questions:
	what was the problem?
	when the problem was introduced?
	why it's better now?

Thanks
-- 
Thomas

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

end of thread, other threads:[~2014-08-27 15:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-18  2:45 [dpdk-dev] [PATCH 0/3] add i40e RSS support in VF Helin Zhang
2014-07-18  2:45 ` [dpdk-dev] [PATCH 1/3] i40evf: add " Helin Zhang
2014-07-18  2:45 ` [dpdk-dev] [PATCH 2/3] app/testpmd: enable RSS support for i40e Helin Zhang
2014-08-27 15:36   ` Thomas Monjalon
2014-07-18  2:45 ` [dpdk-dev] [PATCH 3/3] ethdev: improvements for some macro definition in head file Helin Zhang
2014-08-27 15:42   ` Thomas Monjalon
2014-07-31  1:55 ` [dpdk-dev] [PATCH 0/3] add i40e RSS support in VF Zhan, Zhaochen
2014-08-20  7:07 ` Zhang, Helin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).