summaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/device
diff options
context:
space:
mode:
authorChenmin Sun <chenmin.sun@intel.com>2020-04-30 20:00:09 +0800
committerDamjan Marion <dmarion@me.com>2020-05-05 09:49:26 +0000
commit350737cd4510aa3869f4ba9efe558f2fcda674cc (patch)
tree03dbf1feeb8781e3e2afaeece0dd47774c2f65e2 /src/plugins/dpdk/device
parent84f91fa9c54f82c54b58ea3bf6e9ba22ff735d3a (diff)
flow: explicitly convert RSS function types in dpdk_plugin
explicitly convert RSS function types from vnet_rss_function_t to rte_eth_hash_function to avoid these two types go out of sync in the future... Type: fix Signed-off-by: Chenmin Sun <chenmin.sun@intel.com> Change-Id: Ic09f6bb7f2cfbcf7cc4d380e51554b7f2b7a3b90
Diffstat (limited to 'src/plugins/dpdk/device')
-rw-r--r--src/plugins/dpdk/device/flow.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/plugins/dpdk/device/flow.c b/src/plugins/dpdk/device/flow.c
index 9d0887c1304..59dd14df97f 100644
--- a/src/plugins/dpdk/device/flow.c
+++ b/src/plugins/dpdk/device/flow.c
@@ -79,6 +79,33 @@ dpdk_flow_convert_rss_types (u64 type, u64 * dpdk_rss_type)
return;
}
+static inline enum rte_eth_hash_function
+dpdk_flow_convert_rss_func (vnet_rss_function_t func)
+{
+ enum rte_eth_hash_function rss_func;
+
+ switch (func)
+ {
+ case VNET_RSS_FUNC_DEFAULT:
+ rss_func = RTE_ETH_HASH_FUNCTION_DEFAULT;
+ break;
+ case VNET_RSS_FUNC_TOEPLITZ:
+ rss_func = RTE_ETH_HASH_FUNCTION_TOEPLITZ;
+ break;
+ case VNET_RSS_FUNC_SIMPLE_XOR:
+ rss_func = RTE_ETH_HASH_FUNCTION_SIMPLE_XOR;
+ break;
+ case VNET_RSS_FUNC_SYMMETRIC_TOEPLITZ:
+ rss_func = RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ;
+ break;
+ default:
+ rss_func = RTE_ETH_HASH_FUNCTION_MAX;
+ break;
+ }
+
+ return rss_func;
+}
+
static int
dpdk_flow_add (dpdk_device_t * xd, vnet_flow_t * f, dpdk_flow_entry_t * fe)
{
@@ -571,6 +598,7 @@ pattern_end:
if (f->actions & VNET_FLOW_ACTION_RSS)
{
u64 rss_type = 0;
+
vec_add2 (actions, action, 1);
action->type = RTE_FLOW_ACTION_TYPE_RSS;
action->conf = &rss;
@@ -579,7 +607,12 @@ pattern_end:
dpdk_flow_convert_rss_types (f->rss_types, &rss_type);
rss.types = rss_type;
- rss.func = (enum rte_eth_hash_function) f->rss_fun;
+ if ((rss.func = dpdk_flow_convert_rss_func (f->rss_fun)) ==
+ RTE_ETH_HASH_FUNCTION_MAX)
+ {
+ rv = VNET_FLOW_ERROR_NOT_SUPPORTED;
+ goto done;
+ }
if (fate == true)
{