summaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/device
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/dpdk/device')
-rw-r--r--src/plugins/dpdk/device/common.c9
-rw-r--r--src/plugins/dpdk/device/flow.c17
-rwxr-xr-xsrc/plugins/dpdk/device/init.c3
3 files changed, 25 insertions, 4 deletions
diff --git a/src/plugins/dpdk/device/common.c b/src/plugins/dpdk/device/common.c
index 1b043496256..e42395f2133 100644
--- a/src/plugins/dpdk/device/common.c
+++ b/src/plugins/dpdk/device/common.c
@@ -59,6 +59,15 @@ dpdk_device_setup (dpdk_device_t * xd)
dpdk_device_stop (xd);
}
+ /* Enable flow director when flows exist */
+ if (xd->pmd == VNET_DPDK_PMD_I40E)
+ {
+ if ((xd->flags & DPDK_DEVICE_FLAG_RX_FLOW_OFFLOAD) != 0)
+ xd->port_conf.fdir_conf.mode = RTE_FDIR_MODE_PERFECT;
+ else
+ xd->port_conf.fdir_conf.mode = RTE_FDIR_MODE_NONE;
+ }
+
rv = rte_eth_dev_configure (xd->device_index, xd->rx_q_used,
xd->tx_q_used, &xd->port_conf);
diff --git a/src/plugins/dpdk/device/flow.c b/src/plugins/dpdk/device/flow.c
index af0c4b6e6bf..5080a9c83bc 100644
--- a/src/plugins/dpdk/device/flow.c
+++ b/src/plugins/dpdk/device/flow.c
@@ -178,7 +178,8 @@ dpdk_flow_ops_fn (vnet_main_t * vnm, vnet_flow_dev_op_t op, u32 dev_instance,
memset (fe, 0, sizeof (*fe));
pool_put (xd->flow_entries, fe);
- return 0;
+
+ goto disable_rx_offload;
}
if (op != VNET_FLOW_DEV_OP_ADD_FLOW)
@@ -208,6 +209,12 @@ dpdk_flow_ops_fn (vnet_main_t * vnm, vnet_flow_dev_op_t op, u32 dev_instance,
else
fe->mark = 0;
+ if ((xd->flags & DPDK_DEVICE_FLAG_RX_FLOW_OFFLOAD) == 0)
+ {
+ xd->flags |= DPDK_DEVICE_FLAG_RX_FLOW_OFFLOAD;
+ dpdk_device_setup (xd);
+ }
+
switch (flow->type)
{
case VNET_FLOW_TYPE_IP4_N_TUPLE:
@@ -242,6 +249,14 @@ done:
pool_put (xd->flow_lookup_entries, fle);
}
}
+disable_rx_offload:
+ if ((xd->flags & DPDK_DEVICE_FLAG_RX_FLOW_OFFLOAD) != 0
+ && pool_elts (xd->flow_entries) == 0)
+ {
+ xd->flags &= ~DPDK_DEVICE_FLAG_RX_FLOW_OFFLOAD;
+ dpdk_device_setup (xd);
+ }
+
return rv;
}
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index 70accccf7dd..23d4d46f24e 100755
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -386,9 +386,6 @@ dpdk_lib_init (dpdk_main_t * dm)
case VNET_DPDK_PMD_IXGBE:
case VNET_DPDK_PMD_I40E:
xd->port_type = port_type_from_speed_capa (&dev_info);
-#if 0
- xd->port_conf.fdir_conf.mode = RTE_FDIR_MODE_PERFECT;
-#endif
xd->supported_flow_actions = VNET_FLOW_ACTION_MARK |
VNET_FLOW_ACTION_REDIRECT_TO_NODE |
VNET_FLOW_ACTION_BUFFER_ADVANCE |