From patchwork Sun Jan 19 11:40:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tonghao Zhang X-Patchwork-Id: 1225422 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=d9tN7UT3; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 480tD10smkz9sPK for ; Sun, 19 Jan 2020 22:41:04 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 2AF6F8565B; Sun, 19 Jan 2020 11:41:03 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LyFefISQ2rGB; Sun, 19 Jan 2020 11:41:02 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5A35684E42; Sun, 19 Jan 2020 11:41:02 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3980AC0177; Sun, 19 Jan 2020 11:41:02 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id B8DD6C0174 for ; Sun, 19 Jan 2020 11:41:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id B44F284E42 for ; Sun, 19 Jan 2020 11:41:00 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bWClKxYF9By2 for ; Sun, 19 Jan 2020 11:40:55 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by fraxinus.osuosl.org (Postfix) with ESMTPS id C9F4984E34 for ; Sun, 19 Jan 2020 11:40:55 +0000 (UTC) Received: by mail-pj1-f66.google.com with SMTP id m13so5672910pjb.2 for ; Sun, 19 Jan 2020 03:40:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=2YY+uKKXjrvjsjBsjjb+ypmhU4W2ODX+RgV6Gbo/IDQ=; b=d9tN7UT3EI/drU4/A810ZX+IjYaTNwhG+CUPemdrfJ9aovQOBlIqxtFI6aPRN4RKwy fM9O38oqHrlyO8G1lyqTFNDW5Q3oRjsC/oWXkkhFoYUs4ok+skf/5e6o0dLFDLEY2ScH gpEgjR0xJ/hHo4SxfOyo/DiuZ3UZjMQlvYWKxSwyBD30G/hyt3HFOvQ21nzjVKdtznW9 bHlTj3FjZUbWqBQn8kNhX3EMSwgmZzHvXMlrzyufEdChh0fkQXmG98IOkeqG/WPFn0B/ VUQPWWyQg33KZPEOda7r/cp9q2dgmQTNBLKydYnvtlAprT9pdCfY2nx1E/gN9KepLtrO dyuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=2YY+uKKXjrvjsjBsjjb+ypmhU4W2ODX+RgV6Gbo/IDQ=; b=i6u0Kd9xXsdfwaBCvdcp4HYykxuMwfXZohPZlvuZQY8cIskGb0ZOh00VtQ6HLRLGG1 POreC9/kkVxETsIuun+WFw6Q1nNm6dzGuiDYJM43dAkJYhBsS6gs7sXLkyZOoY99yTh7 dIXBthFFRbqTaarGtD1rm5rd5zg1tcQbRXRU530PNFaIE9+ModJpIS84WwN2fV4L1RGv iVMfxwmynUc6wBfOT9jvH/GVrQdZcJKrYMD/4ZX53bv1aFfUpTYigjjTzxssjOHjcjhA ijwzeIb22rO5qGx4fnKbaN2GEoMKU3h/TYlA/K0b5k3LCSYq930PdCh98xobtxYwNhgM nKKQ== X-Gm-Message-State: APjAAAVDfFPHZ9bTTS4KNpgddo7mD5MRudnhUe87tPTg9St1fod6m5FH ohcl786CsDViB8hDo2Ed770usPLt X-Google-Smtp-Source: APXvYqyTeYncHaEKG3CoUZ1/7uA9Zc4SdW9YP/M9UFzlaq7hMyYJrVcRykBRgqSk5+Xwk+R/5Q1AEg== X-Received: by 2002:a17:90a:b904:: with SMTP id p4mr17850357pjr.62.1579434055411; Sun, 19 Jan 2020 03:40:55 -0800 (PST) Received: from local.opencloud.tech.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id 17sm36269064pfv.142.2020.01.19.03.40.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Jan 2020 03:40:54 -0800 (PST) From: xiangxia.m.yue@gmail.com To: paulb@mellanox.com, blp@ovn.org, i.maximets@ovn.org Date: Sun, 19 Jan 2020 19:40:43 +0800 Message-Id: <1579434043-28916-1-git-send-email-xiangxia.m.yue@gmail.com> X-Mailer: git-send-email 1.8.3.1 Cc: dev@openvswitch.org Subject: [ovs-dev] [PATCH RESEND ovs-dev] netdev-offload-tc: Add checking when assigning flow api X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Tonghao Zhang 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 --- 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",