From patchwork Thu Jan 16 09:38:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 1224104 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=none (p=none dis=none) header.from=netronome.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=netronome-com.20150623.gappssmtp.com header.i=@netronome-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=O5ZH+Vch; 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 47yzfs2l9Hz9sNx for ; Thu, 16 Jan 2020 20:39:16 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 7BF2885FD6; Thu, 16 Jan 2020 09:39:14 +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 80RGQibTZtkE; Thu, 16 Jan 2020 09:39:10 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id A446A84C93; Thu, 16 Jan 2020 09:39:10 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8279BC1D82; Thu, 16 Jan 2020 09:39:10 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id A50AAC077D for ; Thu, 16 Jan 2020 09:39:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 8B71C8798F for ; Thu, 16 Jan 2020 09:39:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id e-5uMM1Tbgr2 for ; Thu, 16 Jan 2020 09:39:03 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by hemlock.osuosl.org (Postfix) with ESMTPS id D9FCB870DF for ; Thu, 16 Jan 2020 09:39:02 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id y17so18414504wrh.5 for ; Thu, 16 Jan 2020 01:39:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=lQngREQNwW6CgqZDFXn5chg3YRUTHtkjFGTW+G3T/0c=; b=O5ZH+Vch2UNbeS3zIT0hv4CWu/vGLl++YagzG27RLLih/pFRa6H/mtE/6zl18tKm91 ZoNKo7t5REd8mP5Yt6Z1tW9CMrdsCREn6dGRevbVc6b5CznnI8xMySwCxv2vgiUFlz4h a5DRIvAjmQMlVHb02x/3t+mlL3NKzux003K/hbE9Ue5IYYXMa08YGCCa6IWKXG27rzuY A/XCumTnVz1kAA9rMkf+O3zd84nrCJNA89112q5aZUU1vxHMVjkD+XgGWqS5EHobolec rKKyCogmW0w0/4yh2m2jLTh1xo6W7QxWKYOEE+SL/wyMBE8VfR0Xmeeh4bLW3fQfZeRA dhBw== 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:mime-version :content-transfer-encoding; bh=lQngREQNwW6CgqZDFXn5chg3YRUTHtkjFGTW+G3T/0c=; b=q4QW4o6MwYdCpflaYNoUMGD5Wuz8DnapBkhHOt+mRunSLeMQWWKzRUXf5ZNM1/ZTbq NTAFrrivy1/whOLXCsy56uJ8Q/2iHHwW3Ffg4OFcDd4GOpTzmSyQr/1mGg1yKRku5ObQ fHoXvKpZ04WMq78/FL1swFjqOsk6hHhuksRI/USSKw/oO6AuLcdxucLAZm5Zj8FZojyc 5NjNeympgjVSUrMsoz3SJpymLpYPKgQODVlSG2ftGF4vR06KH8zgR8jo0MFZHEdKUxjr QrbsR2skpLkwyZT2hDaGY4TinWfErDqZ93KM8G4d62Hp6xSLI0GxL7YJDS1ZMUUHdaw1 A1HQ== X-Gm-Message-State: APjAAAVFU6EE8hEDag4inyz7PFvGgW3eBMuRSSHuUalVmyLjy+AklDcB me0j+Eeuk/31ePOgU+/xk60Hmm/81c+OUqMyXiP3NkMiY68BlneCKrTkvDV+pKImIY1xA7lyT+d 9Wo5/z9NP8hyWwvgSbIkrQCBzpr5CkaIbyJ4ZazR+NhFMsFEFLDfLdV68isvOTX9hCWiGJ2E= X-Google-Smtp-Source: APXvYqxnzJvQdUevhKjfEfnsBS74n1WS3xpniPJDtCkZQex0MQSSIZETSFxjVAWG8PlSK1uhuuQYiA== X-Received: by 2002:a5d:49c7:: with SMTP id t7mr2181115wrs.369.1579167540732; Thu, 16 Jan 2020 01:39:00 -0800 (PST) Received: from reginn.horms.nl ([2001:982:756:703:d63d:7eff:fe99:ac9d]) by smtp.gmail.com with ESMTPSA id p17sm28492821wrx.20.2020.01.16.01.38.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2020 01:38:59 -0800 (PST) From: Simon Horman To: dev@openvswitch.org Date: Thu, 16 Jan 2020 10:38:50 +0100 Message-Id: <20200116093850.32188-1-simon.horman@netronome.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Cc: oss-drivers@netronome.com Subject: [ovs-dev] [PATCH v2] tc: handle packet mark of zero 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: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: John Hurley Openstack may set an skb mark of 0 in tunnel rules. This is considered to be an unused/unset value. However, it prevents the rule from being offloaded. Check if the key value of the skb mark is 0 when it is in use (mask is set to all ones). If it is then ignore the field and continue with TC offload. Only the exact-match case is covered by this patch as it addresses the Openstack use-case and seems most robust against feature evolution: f.e. in future there may exist hardware offload scenarios where an operation, such as a BPF offload, sets the SKB mark before proceeding tho the in-HW OVS. datapath. Signed-off-by: John Hurley Co-Authored: Simon Horman Signed-off-by: Simon Horman Acked-by: Aaron Conole --- v0 [John Hurley] v1 [Simon Horman] * Check for exact rather than masked match on skb 0 v2 [Simon Horman] * Add co-authored tag Add explanation of check against exact-match to changelog --- lib/netdev-offload-tc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c index 4988dadc3f50..5781d163e276 100644 --- a/lib/netdev-offload-tc.c +++ b/lib/netdev-offload-tc.c @@ -1619,6 +1619,11 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match, mask->ct_label = OVS_U128_ZERO; } + /* ignore exact match on skb_mark of 0. */ + if (mask->pkt_mark == UINT32_MAX && !key->pkt_mark) { + mask->pkt_mark = 0; + } + err = test_key_and_mask(match); if (err) { return err;