net/tap: defer qdisc initialisation for rte_flow
PATCH 1/1 net/tap: defer qdisc initialisation for rte_flow
qdisc setup is required when using a remote_iface or when creating rte_flow rules.
Otherwise, many applications don't care about it.
Let's postpone the qdisc init to when it is really needed, that will avoid spewing ERR logs for nothing.
--- drivers/net/tap/rte_eth_tap.c | 32 +++++--------------------------- drivers/net/tap/rte_eth_tap.h | 1 + drivers/net/tap/tap_flow.c | 26 ++++++++++++++++++++++++++ drivers/net/tap/tap_flow.h | 2 ++ 4 files changed, 34 insertions(+), 27 deletions(-)
drivers/net/tap/rte_eth_tap.c +5 -27
@@ -2122,26 +2122,14 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, pmd->persist = persist;#ifdef HAVE_TCA_FLOWER -/* -* Set up everything related to rte_flow: -* - mandatory QDISCs -* - rte_flow actual/implicit lists -* - implicit rules -*/ -if (qdisc_create_multiq (pmd->nlsk_fd, pmd->if_index) <0 ) { -TAP_LOG (ERR ,"%s: failed to create multiq qdisc." , - pmd->name); - goto disable_rte_flow; - } -if (qdisc_create_ingress (pmd->nlsk_fd, pmd->if_index) <0 ) { -TAP_LOG (ERR ,"%s: failed to create ingress qdisc." , - pmd->name); - goto disable_rte_flow; - } -LIST_INIT (&pmd->flows);if (strlen (remote_iface)) { +if (tap_flow_init (pmd) <0 ) { +TAP_LOG (ERR ,"Remote feature requires flow support." ); + goto error_exit; + } + pmd->remote_if_index =if_nametoindex (remote_iface);if (!pmd->remote_if_index) { TAP_LOG(ERR, "%s: failed to get %s if_index.",
@@ -2196,16 +2184,6 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name,rte_eth_dev_probing_finish (dev);return 0 ; -disable_rte_flow: -TAP_LOG (ERR ," Disabling rte flow support: %s(%d)" , -strerror (errno), errno); -if (strlen (remote_iface)) { -TAP_LOG (ERR ,"Remote feature requires flow support." ); - goto error_exit; - } -rte_eth_dev_probing_finish (dev); -return 0 ; -#ifdef HAVE_TCA_FLOWER error_remote: TAP_LOG(ERR, " Can't set up remote feature: %s(%d)",
drivers/net/tap/rte_eth_tap.h +1 -0
@@ -79,6 +79,7 @@ struct pmd_internals {int nlsk_fd;/* Netlink socket fd */ #ifdef HAVE_TCA_FLOWER +int flow_init;/* 1 if qdiscs were created */ int flow_isolate;/* 1 if flow isolation is enabled */ struct tap_rss *rss;/* BPF program */
drivers/net/tap/tap_flow.c +26 -0
@@ -1235,6 +1235,12 @@ tap_flow_create(struct rte_eth_dev *dev,struct tap_nlmsg *msg =NULL ;int err; +if (pmd->flow_init ==0 &&tap_flow_init (pmd) <0 ) { +rte_flow_error_set (error,ENOTSUP ,RTE_FLOW_ERROR_TYPE_HANDLE , +NULL , +"can't create rule, qdisc not initialized" ); + goto fail; + }if (!pmd->if_index) { rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
@@ -1875,6 +1881,26 @@ static int rss_add_actions(struct rte_flow *flow, struct pmd_internals *pmd, }#endif +int +tap_flow_init (struct pmd_internals *pmd) +{ +if (qdisc_create_multiq (pmd->nlsk_fd, pmd->if_index) <0 ) { +TAP_LOG (ERR ,"%s: failed to create multiq qdisc." , + pmd->name); +return -1 ; + } + +if (qdisc_create_ingress (pmd->nlsk_fd, pmd->if_index) <0 ) { +TAP_LOG (ERR ,"%s: failed to create ingress qdisc." , + pmd->name); +return -1 ; + } + + pmd->flow_init =1 ; + +return 0 ; +} +/** * Get rte_flow operations. *
drivers/net/tap/tap_flow.h +2 -0
@@ -45,6 +45,8 @@ enum implicit_rule_index { TAP_REMOTE_MAX_IDX, }; +int tap_flow_init (struct pmd_internals *pmd); +int tap_dev_flow_ops_get (struct rte_eth_dev *dev,const struct rte_flow_ops **ops);int tap_flow_flush (struct rte_eth_dev *dev,struct rte_flow_error *error);
Signature · 1 line
2.53.0
Quoted 9 lines · On Tue, 24 Feb 2026 16:27:44 +0100 David Marchand <[email protected]>…
qdisc setup is required when using a
remote_ifaceor when creatingrte_flowrules.
Otherwise, many applications don't care about it.Let's postpone the qdisc init to when it is really needed, that will avoid spewing ERR logs for nothing.
Signed-off-by David Marchand <[email protected]>---
Agreed. Should probably mark this with Fixes.
The only AI review feedback was that flow_init should be bool not int; but the existing code uses int for flags so OK.
Quoted 9 lines · On Tue, 24 Feb 2026 16:27:44 +0100 David Marchand <[email protected]>…
qdisc setup is required when using a
remote_ifaceor when creatingrte_flowrules.
Otherwise, many applications don't care about it.Let's postpone the qdisc init to when it is really needed, that will avoid spewing ERR logs for nothing.
Signed-off-by David Marchand <[email protected]>---
Helpful change. Applied to next-net