From patchwork Wed Feb 8 15:29:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roi Dayan X-Patchwork-Id: 725678 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vJQPR3fprz9s7c for ; Thu, 9 Feb 2017 02:39:39 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id C8864C35; Wed, 8 Feb 2017 15:31:02 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp2.linuxfoundation.org (smtp2.linux-foundation.org [172.17.192.36]) by mail.linuxfoundation.org (Postfix) with ESMTPS id A953BC25 for ; Wed, 8 Feb 2017 15:31:00 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by smtp2.linuxfoundation.org (Postfix) with ESMTP id B2A411DE5A for ; Wed, 8 Feb 2017 15:30:59 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from roid@mellanox.com) with ESMTPS (AES256-SHA encrypted); 8 Feb 2017 17:30:24 +0200 Received: from dev-r-vrt-189.mtr.labs.mlnx (dev-r-vrt-189.mtr.labs.mlnx [10.212.189.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v18FUA3h001047; Wed, 8 Feb 2017 17:30:23 +0200 From: Roi Dayan To: dev@openvswitch.org Date: Wed, 8 Feb 2017 17:29:29 +0200 Message-Id: <1486567778-63232-17-git-send-email-roid@mellanox.com> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1486567778-63232-1-git-send-email-roid@mellanox.com> References: <1486567778-63232-1-git-send-email-roid@mellanox.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp2.linux-foundation.org Cc: Shahar Klein , Mark Bloch , Hadar Hen Zion , Rony Efraim , Jiri Pirko , Marcelo Ricardo Leitner , Simon Horman , Or Gerlitz , Andy Gospodarek Subject: [ovs-dev] [PATCH ovs V3 16/25] netdev-tc-offloads: Implement netdev flow del using tc interface X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Paul Blakey Signed-off-by: Paul Blakey Reviewed-by: Roi Dayan --- lib/netdev-tc-offloads.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/lib/netdev-tc-offloads.c b/lib/netdev-tc-offloads.c index 035f361..d1c7805 100644 --- a/lib/netdev-tc-offloads.c +++ b/lib/netdev-tc-offloads.c @@ -725,7 +725,33 @@ netdev_tc_flow_del(struct netdev *netdev OVS_UNUSED, struct dpif_flow_stats *stats OVS_UNUSED, const ovs_u128 *ufid OVS_UNUSED) { - return EOPNOTSUPP; + struct netdev *dev; + int prio = 0; + int ifindex; + int error; + int handle = get_ufid_tc_mapping(ufid, &prio, &dev); + + if (!handle) { + return ENOENT; + } + + ifindex = netdev_get_ifindex(dev); + if (ifindex < 0) { + VLOG_ERR_RL(&rl_err, "failed to get ifindex for %s: %s", + netdev_get_name(dev), ovs_strerror(-ifindex)); + netdev_close(dev); + return -ifindex; + } + + error = tc_del_filter(ifindex, prio, handle); + del_ufid_tc_mapping(ufid); + + netdev_close(dev); + + if (stats) { + memset(stats, 0, sizeof(*stats)); + } + return error; } int