From: Tonghao Zhang <[email protected]> netdev_assign_flow_api will try to init the netdev, if success, the netdev will use the offload api. If we init the type of netdev is dpdk, using the tc offload api (netdev_tc_init_flow_api, which may be called firstly.), the err log always is showing up. This patch adds a additional check, and can void the err log.
"failed adding ingress qdisc required for offloading: No such device" Signed-off-by: Tonghao Zhang <[email protected]> --- lib/netdev-linux.c | 21 +++++++++++++++++++++ lib/netdev-linux.h | 1 + lib/netdev-offload-tc.c | 4 ++++ 3 files changed, 26 insertions(+) diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index f8e59ba..bd83e64 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -3317,6 +3317,27 @@ const struct netdev_class netdev_afxdp_class = { #endif +static bool +is_linux_class(const struct netdev_class *class) +{ + if (class->destruct == netdev_linux_destruct) { + return true; + } +#ifdef HAVE_AF_XDP + if (class->destruct == netdev_afxdp_destruct) { + return true; + } +#endif + + return false; +} + +bool +netdev_linux_flow_api_supported(const struct netdev *netdev) +{ + return is_linux_class(netdev->netdev_class); +} + #define CODEL_N_QUEUES 0x0000 /* In sufficiently new kernel headers these are defined as enums in diff --git a/lib/netdev-linux.h b/lib/netdev-linux.h index e1e30f8..43cc725 100644 --- a/lib/netdev-linux.h +++ b/lib/netdev-linux.h @@ -28,5 +28,6 @@ struct netdev; int netdev_linux_ethtool_set_flag(struct netdev *netdev, uint32_t flag, const char *flag_name, bool enable); int linux_get_ifindex(const char *netdev_name); +bool netdev_linux_flow_api_supported(const struct netdev *netdev); #endif /* netdev-linux.h */ diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c index 1adbb32..80bbf2d 100644 --- a/lib/netdev-offload-tc.c +++ b/lib/netdev-offload-tc.c @@ -1643,6 +1643,10 @@ netdev_tc_init_flow_api(struct netdev *netdev) int ifindex; int error; + if (!netdev_linux_flow_api_supported(netdev)) { + return EOPNOTSUPP; + } + ifindex = netdev_get_ifindex(netdev); if (ifindex < 0) { VLOG_INFO("init: failed to get ifindex for %s: %s", -- 1.8.3.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
