From patchwork Fri Nov 6 03:12:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniele Di Proietto X-Patchwork-Id: 540793 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (unknown [IPv6:2600:3c00::f03c:91ff:fe6e:bdf7]) by ozlabs.org (Postfix) with ESMTP id 9486A1402D7 for ; Fri, 6 Nov 2015 14:13:13 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 8DD3122C397; Thu, 5 Nov 2015 19:12:50 -0800 (PST) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id AECC322C389 for ; Thu, 5 Nov 2015 19:12:48 -0800 (PST) Received: from bar3.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id 3F48F162E7F for ; Thu, 5 Nov 2015 20:12:48 -0700 (MST) X-ASG-Debug-ID: 1446779567-03dd7b577318a70001-byXFYA Received: from mx3-pf3.cudamail.com ([192.168.14.3]) by bar3.cudamail.com with ESMTP id qXxP2HnhUCvu5w8g (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 05 Nov 2015 20:12:47 -0700 (MST) X-Barracuda-Envelope-From: diproiettod@vmware.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.3 Received: from unknown (HELO smtp-outbound-1.vmware.com) (208.91.2.12) by mx3-pf3.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 6 Nov 2015 03:24:23 -0000 Received-SPF: error (mx3-pf3.cudamail.com: error in processing during lookup of vmware.com: DNS problem) X-Barracuda-Apparent-Source-IP: 208.91.2.12 X-Barracuda-RBL-IP: 208.91.2.12 Received: from sc9-mailhost3.vmware.com (sc9-mailhost3.vmware.com [10.113.161.73]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id C4ABB2830A for ; Thu, 5 Nov 2015 19:12:46 -0800 (PST) Received: from diproiettod-dev.localdomain (unknown [10.33.74.202]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id C636C40253; Thu, 5 Nov 2015 19:12:46 -0800 (PST) X-CudaMail-Envelope-Sender: diproiettod@vmware.com From: Daniele Di Proietto To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V3-1104071689 X-CudaMail-DTE: 110515 X-CudaMail-Originating-IP: 208.91.2.12 Date: Thu, 5 Nov 2015 19:12:35 -0800 X-ASG-Orig-Subj: [##CM-V3-1104071689##][PATCH v2 04/11] ct-dpif: Add ct_dpif_flush(). Message-Id: <1446779562-3837-5-git-send-email-diproiettod@vmware.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1446779562-3837-1-git-send-email-diproiettod@vmware.com> References: <1446779562-3837-1-git-send-email-diproiettod@vmware.com> X-Barracuda-Connect: UNKNOWN[192.168.14.3] X-Barracuda-Start-Time: 1446779567 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-ASG-Whitelist: EmailCat (corporate) Subject: [ovs-dev] [PATCH v2 04/11] ct-dpif: Add ct_dpif_flush(). X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" This function will flush the connection tracking tables of a specific datapath. It simply calls a function pointer in the dpif_class. No dpif currently implements the required interface. The next commits will provide an implementation in dpif-netlink. Signed-off-by: Daniele Di Proietto --- lib/ct-dpif.c | 11 +++++++++++ lib/ct-dpif.h | 1 + lib/dpif-netdev.c | 1 + lib/dpif-netlink.c | 1 + lib/dpif-provider.h | 4 ++++ 5 files changed, 18 insertions(+) diff --git a/lib/ct-dpif.c b/lib/ct-dpif.c index 84e6488..9a23a5c 100644 --- a/lib/ct-dpif.c +++ b/lib/ct-dpif.c @@ -107,6 +107,17 @@ ct_dpif_dump_done(struct ct_dpif_dump_state *dump) : EOPNOTSUPP); } +/* Flush the entries in the connection tracker used by 'dpif'. + * + * If 'zone' is not NULL, flush only the entries in '*zone'. */ +int +ct_dpif_flush(struct dpif *dpif, const uint16_t *zone) +{ + return (dpif->dpif_class->ct_flush + ? dpif->dpif_class->ct_flush(dpif, zone) + : EOPNOTSUPP); +} + /* Free memory held by 'entry'. */ void ct_dpif_entry_uninit(struct ct_dpif_entry *entry) diff --git a/lib/ct-dpif.h b/lib/ct-dpif.h index 03f1c20..454be41 100644 --- a/lib/ct-dpif.h +++ b/lib/ct-dpif.h @@ -175,6 +175,7 @@ int ct_dpif_dump_start(struct dpif *, struct ct_dpif_dump_state **, const uint16_t *zone); int ct_dpif_dump_next(struct ct_dpif_dump_state *, struct ct_dpif_entry *); int ct_dpif_dump_done(struct ct_dpif_dump_state *); +int ct_dpif_flush(struct dpif *, const uint16_t *zone); void ct_dpif_entry_uninit(struct ct_dpif_entry *); void ct_dpif_format_entry(const struct ct_dpif_entry *, struct ds *, bool verbose, bool print_stats); diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 0f76249..3440755 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -3690,6 +3690,7 @@ const struct dpif_class dpif_netdev_class = { NULL, /* ct_dump_start */ NULL, /* ct_dump_next */ NULL, /* ct_dump_done */ + NULL, /* ct_flush */ }; static void diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c index bf81e61..fa995c1 100644 --- a/lib/dpif-netlink.c +++ b/lib/dpif-netlink.c @@ -2322,6 +2322,7 @@ const struct dpif_class dpif_netlink_class = { NULL, /* ct_dump_start */ NULL, /* ct_dump_next */ NULL, /* ct_dump_done */ + NULL, /* ct_flush */ }; static int diff --git a/lib/dpif-provider.h b/lib/dpif-provider.h index f00e635..a9844be 100644 --- a/lib/dpif-provider.h +++ b/lib/dpif-provider.h @@ -415,6 +415,10 @@ struct dpif_class { int (*ct_dump_next)(struct dpif *, struct ct_dpif_dump_state *, struct ct_dpif_entry *entry); int (*ct_dump_done)(struct dpif *, struct ct_dpif_dump_state *state); + + /* Flushes the connection tracking tables. If 'zone' is not NULL, + * only deletes connections in '*zone'. */ + int (*ct_flush)(struct dpif *, const uint16_t *zone); }; extern const struct dpif_class dpif_netlink_class;