From patchwork Tue Jun 30 15:30:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Tu X-Patchwork-Id: 1319976 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.133; helo=hemlock.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=RWfVdHRD; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49x7cQ0Gfwz9sQx for ; Wed, 1 Jul 2020 01:31:16 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 82F7287E30; Tue, 30 Jun 2020 15:31:14 +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 ygR8NJ5C8puX; Tue, 30 Jun 2020 15:31:13 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id B3B4587E07; Tue, 30 Jun 2020 15:31:13 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 90047C0865; Tue, 30 Jun 2020 15:31:13 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 223EDC016E for ; Tue, 30 Jun 2020 15:31:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id EE1D220486 for ; Tue, 30 Jun 2020 15:31:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iR71SpL08QXf for ; Tue, 30 Jun 2020 15:31:11 +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 silver.osuosl.org (Postfix) with ESMTPS id 2E4FC20446 for ; Tue, 30 Jun 2020 15:31:11 +0000 (UTC) Received: by mail-pj1-f66.google.com with SMTP id i4so9631550pjd.0 for ; Tue, 30 Jun 2020 08:31:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=8gdmfc7lXP0bH0VkYGYj5UIIeqeZ4077OAQkzb+MBsU=; b=RWfVdHRD1HqTYi2cBCHlgbDHIevqNp5TQXnIBR9bMAOn5zwmm1eQh8yHAIJPIICMyf 110XwNHkxqSZo9k/tjN46awHcP4lU2LbGHhWJooERpzaXD5H8MPgrFl+adMmEP0hPSQB 8K436qPDJnC7v06OuKnozylL6rB+sBpVF3qtNK7ItqTxyllC4GhQshWh3J3LqMRtqgoB U7P6s9m/2T52YySRVEVg8P0Qb6qeXFRI/+BgXXPJ1A0e5U5b8jrgpuOHBzGd9VWVaqR1 q1SYGPR2kaCCByTTvezEmGa3WC6Gmwxg/exeku/NCpnK3S/Dv0hw6eHXt4J+lc+Dzrnm id7w== 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=8gdmfc7lXP0bH0VkYGYj5UIIeqeZ4077OAQkzb+MBsU=; b=Rbz2BPZKQ9/5gV/jmhonff7u4CUui86Q+FdIXWOlivT4QkoNIZkr7oe9dXMLKnMXav doGwKLYMIZGorTarMjQWgyukQDHjl2Q0DGqIPKzFIQUflM/mhYNYRsrf1dfT6QkkHNFD W2qsbKvXXakhK3d1kprKMN7NSz/CZM1lJGGDTDvi32pQ0fvcZPX16zuavdPpNjVnb6YY qcIVEQHQVSdYoEA13bZ/I9Msd49w9KQ5I/qa4inqOFCv1IxHUUjvgxZ1ksgTonHtHQJN u1PgMKGYNJ+MNFpsTc499HKhaPobyE6b+tT7WsqJf24QzJ2REhYokCFnU1Hms1McnqZV bqRg== X-Gm-Message-State: AOAM5339HSB1GTbODBnS3cPuPD0by5aXUKXk1YlXHYhiS5RaWVgof2p5 1fM2+Fs2jlwxXhcOvT30SOsrJTEmgLg= X-Google-Smtp-Source: ABdhPJw3GX/srX3kBJzj5CgBOdyklYDiOi2DPSnY8LUsofJJ6j9ogp6csFwB1i/cAUJ0/GbB542gNg== X-Received: by 2002:a17:902:c391:: with SMTP id g17mr18400111plg.330.1593531070055; Tue, 30 Jun 2020 08:31:10 -0700 (PDT) Received: from sc9-mailhost2.vmware.com (c-76-21-95-192.hsd1.ca.comcast.net. [76.21.95.192]) by smtp.gmail.com with ESMTPSA id 144sm3106413pfb.31.2020.06.30.08.31.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jun 2020 08:31:09 -0700 (PDT) From: William Tu To: dev@openvswitch.org Date: Tue, 30 Jun 2020 08:30:45 -0700 Message-Id: <1593531045-112153-1-git-send-email-u9012063@gmail.com> X-Mailer: git-send-email 2.7.4 Cc: simon.horman@netronome.com, vladbu@mellanox.com Subject: [ovs-dev] [PATCH] netdev-offload-tc: Add drop action support. 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" Currently drop action is not offloaded when using userspace datapath with tc offload. The patch programs tc gact (generic action) chain ID 0 to drop the packet by setting it to TC_ACT_SHOT. Example: $ ovs-appctl dpctl/add-flow netdev@ovs-netdev \ 'recirc_id(0),in_port(2),eth(),eth_type(0x0806),\ arp(op=2,tha=00:50:56:e1:4b:ab,tip=10.255.1.116)' drop $ tc filter show dev ovs-p0 ingress filter protocol arp pref 2 flower chain 0 filter protocol arp pref 2 flower chain 0 handle 0x1 eth_type arp arp_tip 10.255.1.116 arp_op reply arp_tha 00:50:56:e1:4b:ab skip_hw not_in_hw action order 1: gact action drop ... Signed-off-by: William Tu --- lib/netdev-offload-tc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c index 258d31f54b08..8c6bcc0aa2c7 100644 --- a/lib/netdev-offload-tc.c +++ b/lib/netdev-offload-tc.c @@ -1788,6 +1788,12 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match, action->chain = nl_attr_get_u32(nla); flower.action_count++; recirc_act = true; +#ifndef __KERNEL__ + } else if (nl_attr_type(nla) == OVS_ACTION_ATTR_DROP) { + action->type = TC_ACT_GOTO; + action->chain = 0; /* 0 is reserved and not used by recirc. */ + flower.action_count++; +#endif } else { VLOG_DBG_RL(&rl, "unsupported put action type: %d", nl_attr_type(nla));