From patchwork Mon Apr 9 02:54:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Darrell Ball X-Patchwork-Id: 896095 X-Patchwork-Delegate: jpettit@nicira.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.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.b="raHkeelS"; dkim-atps=neutral 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 40KFNf3Kj1z9s27 for ; Mon, 9 Apr 2018 12:58:10 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 55607DBB; Mon, 9 Apr 2018 02:54:34 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 9A713D91 for ; Mon, 9 Apr 2018 02:54:29 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f194.google.com (mail-pf0-f194.google.com [209.85.192.194]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id C2EC5477 for ; Mon, 9 Apr 2018 02:54:28 +0000 (UTC) Received: by mail-pf0-f194.google.com with SMTP id g14so4972106pfh.3 for ; Sun, 08 Apr 2018 19:54:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=mNaKZlQBUmsYzyjzxnTftVBmy+zMcOVvnlNcjFVvdYI=; b=raHkeelSmItMV5JVJRhdDvtEKRrS9knVHxxBxCtRBfQo7XlE5tWCkXe1VOVqgihqRs IKu24+O6LNUFpxdvErn7VqNEwE6Zg89jqDt7T1CCm3CIgtjl3zJb+vxAJu6olQngcAOK dGBdQqCHK3NsX6xqQhhBuQT6VpqxEa6a1VYruMyZqPGXtrB8ArtS/F0aeiz8rWc/hmGh EFNcxcH63ejY98JiyZji/OaOby/GarHEywfI2FDP9LKpc2Cg+O6YCSl8QmebAtPC6hRQ 1aNd6/LW0LjrQKpcEkwl6ZwnmWWmS+gW/3nAhM6X1X2am5q5q2ZAAa8urrRkALpr/AsO O1aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=mNaKZlQBUmsYzyjzxnTftVBmy+zMcOVvnlNcjFVvdYI=; b=kBoUQxVglQmVQk+YCM1/iygX3AHPE+cWHzcZKjLHsCifo7OVvgvkJFlwXrtATCCinB Dsbs8PQMOry+H226PHeChVG6hWKLYUP5J6/eKJ3arfb3L+x8jCg7WhqF+GbRezmm0lki Pa/P+OPst645wESml+WJysfasOffz+HzgYHi9wD9YXsus9BdLAJW3FD5Mwf7ijfFZjPY itG2RdGkjVnlA6DllPzrJTLsG+GtZi0AxP94OenXFXN0yULyOg7BU0cJdZ1tYD8DwkX+ hYgM/xK8OYDz1TyCearo93u29iDnO1YoNOELWyP8CLlnNF/yLaBEqsd9CNa8AUuSwZ9J cj5w== X-Gm-Message-State: AElRT7F7YEXmLykRhAFTRsNjyLLkz125OXfGjt6Mdt3OQrh0OJCLYvab wnG6ouFbTNdLmLPwB5wXfrqnCA== X-Google-Smtp-Source: AIpwx4/erUTj5X/sZ1Mac7egjb39CnnYxQ/4sIzpvogpg44zdCo2WbDZuslpv2mro9ey3jI5uzztWg== X-Received: by 10.99.120.74 with SMTP id t71mr24319530pgc.310.1523242468350; Sun, 08 Apr 2018 19:54:28 -0700 (PDT) Received: from ubuntu.localdomain (96-82-111-186-static.hfc.comcastbusiness.net. [96.82.111.186]) by smtp.gmail.com with ESMTPSA id 85sm30039675pfz.155.2018.04.08.19.54.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 08 Apr 2018 19:54:27 -0700 (PDT) From: Darrell Ball To: dlu998@gmail.com, dev@openvswitch.org, jpettit@ovn.org Date: Sun, 8 Apr 2018 19:54:02 -0700 Message-Id: <1523242444-76467-9-git-send-email-dlu998@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1523242444-76467-1-git-send-email-dlu998@gmail.com> References: <1523242444-76467-1-git-send-email-dlu998@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [patch v6 08/10] ipf: Add command to get fragmentation handling status. 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 A new command "ovs-appctl dpctl/ipf-get-status" is added for userspace datapath conntrack fragmentation support. The command shows the configuration status as well as fragment counters. Signed-off-by: Darrell Ball --- NEWS | 2 ++ lib/ct-dpif.c | 21 +++++++++++++++ lib/ct-dpif.h | 6 +++++ lib/dpctl.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++- lib/dpctl.man | 5 ++++ lib/dpif-netdev.c | 33 +++++++++++++++++++++++ lib/dpif-netlink.c | 1 + lib/dpif-provider.h | 7 +++++ lib/ipf.c | 26 +++++++++++++++++++ lib/ipf.h | 3 +++ 10 files changed, 178 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 4ee43cf..d617335 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,8 @@ Post-v2.9.0 datapath conntrack fragmentation support. * New "ovs-appctl dpctl/ipf-set-maxfrags" command for userspace datapath conntrack fragmentation support. + * New "ovs-appctl dpctl/ipf-get-status" command for userspace datapath + conntrack fragmentation support. - ovs-vsctl: New commands "add-bond-iface" and "del-bond-iface". - OpenFlow: * OFPT_ROLE_STATUS is now available in OpenFlow 1.3. diff --git a/lib/ct-dpif.c b/lib/ct-dpif.c index 81f9d92..60c8986 100644 --- a/lib/ct-dpif.c +++ b/lib/ct-dpif.c @@ -188,6 +188,27 @@ ct_dpif_ipf_set_nfrag_max(struct dpif *dpif, uint32_t max_frags) : EOPNOTSUPP); } +int ct_dpif_ipf_get_status(struct dpif *dpif, bool *ipf_v4_enabled, + unsigned int *min_v4_frag_size, unsigned int *nfrag_max, + unsigned int *nfrag, unsigned int *n4frag_accepted, + unsigned int *n4frag_completed_sent, + unsigned int *n4frag_expired_sent, unsigned int *n4frag_too_small, + unsigned int *n4frag_overlap, bool *ipf_v6_enabled, + unsigned int *min_v6_frag_size, unsigned int *n6frag_accepted, + unsigned int *n6frag_completed_sent, + unsigned int *n6frag_expired_sent, unsigned int *n6frag_too_small, + unsigned int *n6frag_overlap) +{ + return (dpif->dpif_class->ipf_get_status + ? dpif->dpif_class->ipf_get_status(dpif, ipf_v4_enabled, + min_v4_frag_size, nfrag_max, nfrag, n4frag_accepted, + n4frag_completed_sent, n4frag_expired_sent, n4frag_too_small, + n4frag_overlap, ipf_v6_enabled, min_v6_frag_size, n6frag_accepted, + n6frag_completed_sent, n6frag_expired_sent, n6frag_too_small, + n6frag_overlap) + : EOPNOTSUPP); +} + void ct_dpif_entry_uninit(struct ct_dpif_entry *entry) { diff --git a/lib/ct-dpif.h b/lib/ct-dpif.h index 4ce4dd4..8a24128 100644 --- a/lib/ct-dpif.h +++ b/lib/ct-dpif.h @@ -203,6 +203,12 @@ int ct_dpif_get_nconns(struct dpif *dpif, uint32_t *nconns); int ct_dpif_ipf_change_enabled(struct dpif *, bool, bool); int ct_dpif_ipf_set_min_frag(struct dpif *, bool, uint32_t); int ct_dpif_ipf_set_nfrag_max(struct dpif *, uint32_t); +int ct_dpif_ipf_get_status(struct dpif *dpif, bool *, unsigned int *, + unsigned int *, unsigned int *, unsigned int *, + unsigned int *, unsigned int *, unsigned int *, + unsigned int *, bool *, unsigned int *, + unsigned int *, unsigned int *, unsigned int *, + unsigned int *, unsigned int *); 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/dpctl.c b/lib/dpctl.c index f25c6fc..84064cd 100644 --- a/lib/dpctl.c +++ b/lib/dpctl.c @@ -35,7 +35,6 @@ #include "dpif.h" #include "openvswitch/dynamic-string.h" #include "flow.h" -#include "ipf.h" #include "openvswitch/match.h" #include "netdev.h" #include "netdev-dpdk.h" @@ -1853,6 +1852,78 @@ dpctl_ct_ipf_set_nfrag_max(int argc, const char *argv[], return error; } +static int +dpctl_ct_ipf_get_status(int argc, const char *argv[], + struct dpctl_params *dpctl_p) +{ + struct dpif *dpif; + int error = dpctl_ct_open_dp(argc, argv, dpctl_p, &dpif, 2); + if (!error) { + bool ipf_v4_enabled; + unsigned int min_v4_frag_size; + unsigned int nfrag_max; + unsigned int nfrag; + unsigned int n4frag_accepted; + unsigned int n4frag_completed_sent; + unsigned int n4frag_expired_sent; + unsigned int n4frag_too_small; + unsigned int n4frag_overlap; + unsigned int min_v6_frag_size; + bool ipf_v6_enabled; + unsigned int n6frag_accepted; + unsigned int n6frag_completed_sent; + unsigned int n6frag_expired_sent; + unsigned int n6frag_too_small; + unsigned int n6frag_overlap; + error = ct_dpif_ipf_get_status(dpif, &ipf_v4_enabled, + &min_v4_frag_size, &nfrag_max, &nfrag, &n4frag_accepted, + &n4frag_completed_sent, &n4frag_expired_sent, &n4frag_too_small, + &n4frag_overlap, &ipf_v6_enabled, &min_v6_frag_size, + &n6frag_accepted, &n6frag_completed_sent, &n6frag_expired_sent, + &n6frag_too_small, &n6frag_overlap); + + if (!error) { + dpctl_print(dpctl_p, "\tFragmentation Module Status\n"); + dpctl_print(dpctl_p, "\t---------------------------\n"); + dpctl_print(dpctl_p, "\tv4 enabled: %u\n", ipf_v4_enabled); + dpctl_print(dpctl_p, "\tv6 enabled: %u\n", ipf_v6_enabled); + dpctl_print(dpctl_p, "\tmax num frags (v4/v6): %u\n", nfrag_max); + dpctl_print(dpctl_p, "\tnum frag: %u\n", nfrag); + dpctl_print(dpctl_p, "\tmin v4 frag size: %u\n", + min_v4_frag_size); + dpctl_print(dpctl_p, "\tv4 frags accepted: %u\n", + n4frag_accepted); + dpctl_print(dpctl_p, "\tv4 frags completed: %u\n", + n4frag_completed_sent); + dpctl_print(dpctl_p, "\tv4 frags expired: %u\n", + n4frag_expired_sent); + dpctl_print(dpctl_p, "\tv4 frags too small: %u\n", + n4frag_too_small); + dpctl_print(dpctl_p, "\tv4 frags overlapped: %u\n", + n4frag_overlap); + dpctl_print(dpctl_p, "\tmin v6 frag size: %u\n", + min_v6_frag_size); + dpctl_print(dpctl_p, "\tv6 frags accepted: %u\n", + n6frag_accepted); + dpctl_print(dpctl_p, "\tv6 frags completed: %u\n", + n6frag_completed_sent); + dpctl_print(dpctl_p, "\tv6 frags expired: %u\n", + n6frag_expired_sent); + dpctl_print(dpctl_p, "\tv6 frags too small: %u\n", + n6frag_too_small); + dpctl_print(dpctl_p, "\tv6 frags overlapped: %u\n", + n6frag_overlap); + } else { + dpctl_error(dpctl_p, error, + "ipf status could not be retrieved"); + } + + dpif_close(dpif); + } + + return error; +} + /* Undocumented commands for unit testing. */ static int @@ -2158,6 +2229,8 @@ static const struct dpctl_command all_commands[] = { dpctl_ct_ipf_set_min_frag, DP_RW }, { "ipf-set-maxfrags", "[dp] maxfrags", 1, 2, dpctl_ct_ipf_set_nfrag_max, DP_RW }, + { "ipf-get-status", "[dp]", 0, 1, dpctl_ct_ipf_get_status, + DP_RO }, { "help", "", 0, INT_MAX, dpctl_help, DP_RO }, { "list-commands", "", 0, INT_MAX, dpctl_list_commands, DP_RO }, diff --git a/lib/dpctl.man b/lib/dpctl.man index 43cff05..2e8c287 100644 --- a/lib/dpctl.man +++ b/lib/dpctl.man @@ -294,3 +294,8 @@ connection tracker. The default value is 1000 and the clamped maximum is 5000. Note that packet buffers can be held by the fragmentation module while fragments are incomplete, but will timeout after 15 seconds. Memory pool sizing should be set accordingly when fragmentation is enabled. +. +.TP +\*(DX\fBipf\-get\-status\fR [\fIdp\fR] +Gets the configuration settings and fragment counters associated with the +fragmentation handling of the userspace datapath connection tracker. diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 542478d..35094f0 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -5892,6 +5892,38 @@ dpif_netdev_ipf_set_nfrag_max(struct dpif *dpif OVS_UNUSED, return ipf_set_nfrag_max(max_frags); } +static int +dpif_netdev_ipf_get_status(struct dpif *dpif OVS_UNUSED, + bool *ipf_v4_enabled, unsigned int *min_v4_frag_size, + unsigned int *nfrag_max, unsigned int *nfrag, + unsigned int *n4frag_accepted, unsigned int *n4frag_completed_sent, + unsigned int *n4frag_expired_sent, unsigned int *n4frag_too_small, + unsigned int *n4frag_overlap, bool *ipf_v6_enabled, + unsigned int *min_v6_frag_size, unsigned int *n6frag_accepted, + unsigned int *n6frag_completed_sent, unsigned int *n6frag_expired_sent, + unsigned int *n6frag_too_small, unsigned int *n6frag_overlap) +{ + struct ipf_status ipf_status; + ipf_get_status(&ipf_status); + *ipf_v4_enabled = ipf_status.ifp_v4_enabled; + *min_v4_frag_size = ipf_status.min_v4_frag_size; + *nfrag_max = ipf_status.nfrag_max; + *nfrag = ipf_status.nfrag; + *n4frag_accepted = ipf_status.n4frag_accepted; + *n4frag_completed_sent = ipf_status.n4frag_completed_sent; + *n4frag_expired_sent = ipf_status.n4frag_expired_sent; + *n4frag_too_small = ipf_status.n4frag_too_small; + *n4frag_overlap = ipf_status.n4frag_overlap; + *ipf_v6_enabled = ipf_status.ifp_v6_enabled; + *min_v6_frag_size = ipf_status.min_v6_frag_size; + *n6frag_accepted = ipf_status.n6frag_accepted; + *n6frag_completed_sent = ipf_status.n6frag_completed_sent; + *n6frag_expired_sent = ipf_status.n6frag_expired_sent; + *n6frag_too_small = ipf_status.n6frag_too_small; + *n6frag_overlap = ipf_status.n6frag_overlap; + return 0; +} + const struct dpif_class dpif_netdev_class = { "netdev", dpif_netdev_init, @@ -5943,6 +5975,7 @@ const struct dpif_class dpif_netdev_class = { dpif_netdev_ipf_change_enabled, dpif_netdev_ipf_set_min_frag, dpif_netdev_ipf_set_nfrag_max, + dpif_netdev_ipf_get_status, dpif_netdev_meter_get_features, dpif_netdev_meter_set, dpif_netdev_meter_get, diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c index e8575d9..73bf31a 100644 --- a/lib/dpif-netlink.c +++ b/lib/dpif-netlink.c @@ -2997,6 +2997,7 @@ const struct dpif_class dpif_netlink_class = { NULL, /* ipf_change_enabled */ NULL, /* ipf_set_min_frag */ NULL, /* ipf_set_nfrag_max */ + NULL, /* ipf_get_status */ dpif_netlink_meter_get_features, dpif_netlink_meter_set, dpif_netlink_meter_get, diff --git a/lib/dpif-provider.h b/lib/dpif-provider.h index 7679169..82fbbfc 100644 --- a/lib/dpif-provider.h +++ b/lib/dpif-provider.h @@ -450,6 +450,13 @@ struct dpif_class { int (*ipf_set_min_frag)(struct dpif *, bool, uint32_t); /* Set maximum number of fragments tracked. */ int (*ipf_set_nfrag_max)(struct dpif *, uint32_t); + /* Get fragmentation configuration status and counters. */ + int (*ipf_get_status)(struct dpif *, bool *, unsigned int *, + unsigned int *, unsigned int *, unsigned int *, + unsigned int *, unsigned int *, unsigned int *, + unsigned int *, bool *, unsigned int *, unsigned int *, + unsigned int *, unsigned int *, unsigned int *, + unsigned int *); /* Meters */ /* Queries 'dpif' for supported meter features. diff --git a/lib/ipf.c b/lib/ipf.c index 78221f4..a62f4ea 100644 --- a/lib/ipf.c +++ b/lib/ipf.c @@ -1284,3 +1284,29 @@ ipf_set_nfrag_max(uint32_t value) atomic_store_relaxed(&nfrag_max, value); return 0; } + +int +ipf_get_status(struct ipf_status *ipf_status) +{ + atomic_read_relaxed(&ifp_v4_enabled, &ipf_status->ifp_v4_enabled); + atomic_read_relaxed(&min_v4_frag_size, &ipf_status->min_v4_frag_size); + atomic_read_relaxed(&nfrag_max, &ipf_status->nfrag_max); + ipf_status->nfrag = atomic_count_get(&nfrag); + ipf_status->n4frag_accepted = atomic_count_get(&n4frag_accepted); + ipf_status->n4frag_completed_sent = + atomic_count_get(&n4frag_completed_sent); + ipf_status->n4frag_expired_sent = + atomic_count_get(&n4frag_expired_sent); + ipf_status->n4frag_too_small = atomic_count_get(&n4frag_too_small); + ipf_status->n4frag_overlap = atomic_count_get(&n4frag_overlap); + atomic_read_relaxed(&ifp_v6_enabled, &ipf_status->ifp_v6_enabled); + atomic_read_relaxed(&min_v6_frag_size, &ipf_status->min_v6_frag_size); + ipf_status->n6frag_accepted = atomic_count_get(&n6frag_accepted); + ipf_status->n6frag_completed_sent = + atomic_count_get(&n6frag_completed_sent); + ipf_status->n6frag_expired_sent = + atomic_count_get(&n6frag_expired_sent); + ipf_status->n6frag_too_small = atomic_count_get(&n6frag_too_small); + ipf_status->n6frag_overlap = atomic_count_get(&n6frag_overlap); + return 0; +} diff --git a/lib/ipf.h b/lib/ipf.h index fb24078..a9fee06 100644 --- a/lib/ipf.h +++ b/lib/ipf.h @@ -69,4 +69,7 @@ ipf_set_min_frag(bool v6, uint32_t value); int ipf_set_nfrag_max(uint32_t value); +int +ipf_get_status(struct ipf_status *ipf_status); + #endif /* ipf.h */