* [dpdk-dev] [PATCH v1] net/tap: add RSS hash update callback
@ 2018-05-10 16:23 Ophir Munk
2018-05-10 16:28 ` Stephen Hemminger
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Ophir Munk @ 2018-05-10 16:23 UTC (permalink / raw)
To: dev, Pascal Mazon; +Cc: Thomas Monjalon, Olga Shern, Ophir Munk, Shahaf Shuler
Add an RSS hash update callback to eth_dev_ops.
Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
---
drivers/net/tap/rte_eth_tap.c | 39 ++++++++++++++++++++++++++++++++++++---
| 3 +++
2 files changed, 39 insertions(+), 3 deletions(-)
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 09cd70c..b08c27f 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -835,11 +835,10 @@ tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->tx_queue_offload_capa;
dev_info->hash_key_size = TAP_RSS_HASH_KEY_SIZE;
/*
- * limitation: TAP suppors all of the following hash
+ * limitation: TAP suppors all of IP, UDP and TCP hash
* functions together and not in partial combinations
*/
- dev_info->flow_type_rss_offloads =
- ETH_RSS_IP | ETH_RSS_UDP | ETH_RSS_TCP;
+ dev_info->flow_type_rss_offloads = ~TAP_RSS_HF_MASK;
}
static int
@@ -1434,6 +1433,39 @@ tap_flow_ctrl_set(struct rte_eth_dev *dev __rte_unused,
return 0;
}
+/**
+ * DPDK callback to update the RSS hash configuration.
+ *
+ * @param dev
+ * Pointer to Ethernet device structure.
+ * @param[in] rss_conf
+ * RSS configuration data.
+ *
+ * @return
+ * 0 on success, a negative errno value otherwise and rte_errno is set.
+ */
+static int
+tap_rss_hash_update(struct rte_eth_dev *dev,
+ struct rte_eth_rss_conf *rss_conf)
+{
+ if (rss_conf->rss_hf & TAP_RSS_HF_MASK) {
+ rte_errno = EINVAL;
+ return -rte_errno;
+ }
+ if (rss_conf->rss_key && rss_conf->rss_key_len) {
+ /*
+ * Currently TAP RSS key is hard coded
+ * and cannot be updated
+ */
+ TAP_LOG(ERR,
+ "port %u RSS key cannot be updated",
+ dev->data->port_id);
+ rte_errno = EINVAL;
+ return -rte_errno;
+ }
+ return 0;
+}
+
static const struct eth_dev_ops ops = {
.dev_start = tap_dev_start,
.dev_stop = tap_dev_stop,
@@ -1459,6 +1491,7 @@ static const struct eth_dev_ops ops = {
.stats_get = tap_stats_get,
.stats_reset = tap_stats_reset,
.dev_supported_ptypes_get = tap_dev_supported_ptypes_get,
+ .rss_hash_update = tap_rss_hash_update,
.filter_ctrl = tap_dev_filter_ctrl,
};
--git a/drivers/net/tap/tap_rss.h b/drivers/net/tap/tap_rss.h
index bd6b97b..17606b2 100644
--- a/drivers/net/tap/tap_rss.h
+++ b/drivers/net/tap/tap_rss.h
@@ -12,6 +12,9 @@
/* Fixed RSS hash key size in bytes. */
#define TAP_RSS_HASH_KEY_SIZE 40
+/* Supported RSS */
+#define TAP_RSS_HF_MASK (~(ETH_RSS_IP | ETH_RSS_UDP | ETH_RSS_TCP))
+
/* hashed fields for RSS */
enum hash_field {
HASH_FIELD_IPV4_L3, /* IPv4 src/dst addr */
--
2.7.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH v1] net/tap: add RSS hash update callback
2018-05-10 16:23 [dpdk-dev] [PATCH v1] net/tap: add RSS hash update callback Ophir Munk
@ 2018-05-10 16:28 ` Stephen Hemminger
2018-05-10 17:25 ` Ophir Munk
2018-05-10 17:30 ` [dpdk-dev] [PATCH v2] " Ophir Munk
2 siblings, 0 replies; 6+ messages in thread
From: Stephen Hemminger @ 2018-05-10 16:28 UTC (permalink / raw)
To: Ophir Munk; +Cc: dev, Pascal Mazon, Thomas Monjalon, Olga Shern, Shahaf Shuler
On Thu, 10 May 2018 16:23:38 +0000
Ophir Munk <ophirmu@mellanox.com> wrote:
> - * limitation: TAP suppors all of the following hash
> + * limitation: TAP suppors all of IP, UDP and TCP hash
> * functions together and not in partial combinations
s/suppors/supports/
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH v1] net/tap: add RSS hash update callback
2018-05-10 16:23 [dpdk-dev] [PATCH v1] net/tap: add RSS hash update callback Ophir Munk
2018-05-10 16:28 ` Stephen Hemminger
@ 2018-05-10 17:25 ` Ophir Munk
2018-05-10 17:30 ` [dpdk-dev] [PATCH v2] " Ophir Munk
2 siblings, 0 replies; 6+ messages in thread
From: Ophir Munk @ 2018-05-10 17:25 UTC (permalink / raw)
To: dev, Pascal Mazon; +Cc: Thomas Monjalon, Olga Shern, Ophir Munk, Shahaf Shuler
Add RSS hash update callback to eth_dev_ops.
Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
---
v1:
Initial release
v2:
typo fix
drivers/net/tap/rte_eth_tap.c | 39 ++++++++++++++++++++++++++++++++++++---
| 3 +++
2 files changed, 39 insertions(+), 3 deletions(-)
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 09cd70c..8556c6c 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -835,11 +835,10 @@ tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->tx_queue_offload_capa;
dev_info->hash_key_size = TAP_RSS_HASH_KEY_SIZE;
/*
- * limitation: TAP suppors all of the following hash
+ * limitation: TAP supports all of IP, UDP and TCP hash
* functions together and not in partial combinations
*/
- dev_info->flow_type_rss_offloads =
- ETH_RSS_IP | ETH_RSS_UDP | ETH_RSS_TCP;
+ dev_info->flow_type_rss_offloads = ~TAP_RSS_HF_MASK;
}
static int
@@ -1434,6 +1433,39 @@ tap_flow_ctrl_set(struct rte_eth_dev *dev __rte_unused,
return 0;
}
+/**
+ * DPDK callback to update the RSS hash configuration.
+ *
+ * @param dev
+ * Pointer to Ethernet device structure.
+ * @param[in] rss_conf
+ * RSS configuration data.
+ *
+ * @return
+ * 0 on success, a negative errno value otherwise and rte_errno is set.
+ */
+static int
+tap_rss_hash_update(struct rte_eth_dev *dev,
+ struct rte_eth_rss_conf *rss_conf)
+{
+ if (rss_conf->rss_hf & TAP_RSS_HF_MASK) {
+ rte_errno = EINVAL;
+ return -rte_errno;
+ }
+ if (rss_conf->rss_key && rss_conf->rss_key_len) {
+ /*
+ * Currently TAP RSS key is hard coded
+ * and cannot be updated
+ */
+ TAP_LOG(ERR,
+ "port %u RSS key cannot be updated",
+ dev->data->port_id);
+ rte_errno = EINVAL;
+ return -rte_errno;
+ }
+ return 0;
+}
+
static const struct eth_dev_ops ops = {
.dev_start = tap_dev_start,
.dev_stop = tap_dev_stop,
@@ -1459,6 +1491,7 @@ static const struct eth_dev_ops ops = {
.stats_get = tap_stats_get,
.stats_reset = tap_stats_reset,
.dev_supported_ptypes_get = tap_dev_supported_ptypes_get,
+ .rss_hash_update = tap_rss_hash_update,
.filter_ctrl = tap_dev_filter_ctrl,
};
--git a/drivers/net/tap/tap_rss.h b/drivers/net/tap/tap_rss.h
index bd6b97b..17606b2 100644
--- a/drivers/net/tap/tap_rss.h
+++ b/drivers/net/tap/tap_rss.h
@@ -12,6 +12,9 @@
/* Fixed RSS hash key size in bytes. */
#define TAP_RSS_HASH_KEY_SIZE 40
+/* Supported RSS */
+#define TAP_RSS_HF_MASK (~(ETH_RSS_IP | ETH_RSS_UDP | ETH_RSS_TCP))
+
/* hashed fields for RSS */
enum hash_field {
HASH_FIELD_IPV4_L3, /* IPv4 src/dst addr */
--
2.7.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH v2] net/tap: add RSS hash update callback
2018-05-10 16:23 [dpdk-dev] [PATCH v1] net/tap: add RSS hash update callback Ophir Munk
2018-05-10 16:28 ` Stephen Hemminger
2018-05-10 17:25 ` Ophir Munk
@ 2018-05-10 17:30 ` Ophir Munk
2018-05-15 12:21 ` Wiles, Keith
2 siblings, 1 reply; 6+ messages in thread
From: Ophir Munk @ 2018-05-10 17:30 UTC (permalink / raw)
To: dev, Pascal Mazon; +Cc: Thomas Monjalon, Olga Shern, Ophir Munk, Shahaf Shuler
Add RSS hash update callback to eth_dev_ops.
Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
---
v1:
Initial release
v2:
typo fix
drivers/net/tap/rte_eth_tap.c | 39 ++++++++++++++++++++++++++++++++++++---
| 3 +++
2 files changed, 39 insertions(+), 3 deletions(-)
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 09cd70c..8556c6c 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -835,11 +835,10 @@ tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->tx_queue_offload_capa;
dev_info->hash_key_size = TAP_RSS_HASH_KEY_SIZE;
/*
- * limitation: TAP suppors all of the following hash
+ * limitation: TAP supports all of IP, UDP and TCP hash
* functions together and not in partial combinations
*/
- dev_info->flow_type_rss_offloads =
- ETH_RSS_IP | ETH_RSS_UDP | ETH_RSS_TCP;
+ dev_info->flow_type_rss_offloads = ~TAP_RSS_HF_MASK;
}
static int
@@ -1434,6 +1433,39 @@ tap_flow_ctrl_set(struct rte_eth_dev *dev __rte_unused,
return 0;
}
+/**
+ * DPDK callback to update the RSS hash configuration.
+ *
+ * @param dev
+ * Pointer to Ethernet device structure.
+ * @param[in] rss_conf
+ * RSS configuration data.
+ *
+ * @return
+ * 0 on success, a negative errno value otherwise and rte_errno is set.
+ */
+static int
+tap_rss_hash_update(struct rte_eth_dev *dev,
+ struct rte_eth_rss_conf *rss_conf)
+{
+ if (rss_conf->rss_hf & TAP_RSS_HF_MASK) {
+ rte_errno = EINVAL;
+ return -rte_errno;
+ }
+ if (rss_conf->rss_key && rss_conf->rss_key_len) {
+ /*
+ * Currently TAP RSS key is hard coded
+ * and cannot be updated
+ */
+ TAP_LOG(ERR,
+ "port %u RSS key cannot be updated",
+ dev->data->port_id);
+ rte_errno = EINVAL;
+ return -rte_errno;
+ }
+ return 0;
+}
+
static const struct eth_dev_ops ops = {
.dev_start = tap_dev_start,
.dev_stop = tap_dev_stop,
@@ -1459,6 +1491,7 @@ static const struct eth_dev_ops ops = {
.stats_get = tap_stats_get,
.stats_reset = tap_stats_reset,
.dev_supported_ptypes_get = tap_dev_supported_ptypes_get,
+ .rss_hash_update = tap_rss_hash_update,
.filter_ctrl = tap_dev_filter_ctrl,
};
--git a/drivers/net/tap/tap_rss.h b/drivers/net/tap/tap_rss.h
index bd6b97b..17606b2 100644
--- a/drivers/net/tap/tap_rss.h
+++ b/drivers/net/tap/tap_rss.h
@@ -12,6 +12,9 @@
/* Fixed RSS hash key size in bytes. */
#define TAP_RSS_HASH_KEY_SIZE 40
+/* Supported RSS */
+#define TAP_RSS_HF_MASK (~(ETH_RSS_IP | ETH_RSS_UDP | ETH_RSS_TCP))
+
/* hashed fields for RSS */
enum hash_field {
HASH_FIELD_IPV4_L3, /* IPv4 src/dst addr */
--
2.7.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/tap: add RSS hash update callback
2018-05-10 17:30 ` [dpdk-dev] [PATCH v2] " Ophir Munk
@ 2018-05-15 12:21 ` Wiles, Keith
2018-05-17 17:11 ` Ferruh Yigit
0 siblings, 1 reply; 6+ messages in thread
From: Wiles, Keith @ 2018-05-15 12:21 UTC (permalink / raw)
To: Ophir Munk; +Cc: dev, Pascal Mazon, Thomas Monjalon, Olga Shern, Shahaf Shuler
> On May 10, 2018, at 12:30 PM, Ophir Munk <ophirmu@mellanox.com> wrote:
>
> Add RSS hash update callback to eth_dev_ops.
>
> Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
> ---
> v1:
> Initial release
> v2:
> typo fix
>
Acked by: Keith Wiles<keith.wiles@intel.com>
Regards,
Keith
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/tap: add RSS hash update callback
2018-05-15 12:21 ` Wiles, Keith
@ 2018-05-17 17:11 ` Ferruh Yigit
0 siblings, 0 replies; 6+ messages in thread
From: Ferruh Yigit @ 2018-05-17 17:11 UTC (permalink / raw)
To: Wiles, Keith, Ophir Munk
Cc: dev, Pascal Mazon, Thomas Monjalon, Olga Shern, Shahaf Shuler
On 5/15/2018 1:21 PM, Wiles, Keith wrote:
>
>
>> On May 10, 2018, at 12:30 PM, Ophir Munk <ophirmu@mellanox.com> wrote:
>>
>> Add RSS hash update callback to eth_dev_ops.
>>
>> Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
>> ---
>> v1:
>> Initial release
>> v2:
>> typo fix
>>
>
> Acked by: Keith Wiles<keith.wiles@intel.com>
Applied to dpdk-next-net/master, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-05-17 17:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-10 16:23 [dpdk-dev] [PATCH v1] net/tap: add RSS hash update callback Ophir Munk
2018-05-10 16:28 ` Stephen Hemminger
2018-05-10 17:25 ` Ophir Munk
2018-05-10 17:30 ` [dpdk-dev] [PATCH v2] " Ophir Munk
2018-05-15 12:21 ` Wiles, Keith
2018-05-17 17:11 ` Ferruh Yigit
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).