From patchwork Wed Jan 15 16:19:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emma Finn X-Patchwork-Id: 1223700 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=intel.com 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 47yXc16RMCz9sS3 for ; Thu, 16 Jan 2020 03:20:17 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 845E987939; Wed, 15 Jan 2020 16:20:15 +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 mbM7WFQR7sHA; Wed, 15 Jan 2020 16:20:11 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 1BD4C85707; Wed, 15 Jan 2020 16:20:11 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 01757C1D82; Wed, 15 Jan 2020 16:20:11 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0F291C077D for ; Wed, 15 Jan 2020 16:20:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 0C08384BC2 for ; Wed, 15 Jan 2020 16:20:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RFTwVT+IhrfU for ; Wed, 15 Jan 2020 16:20:03 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by whitealder.osuosl.org (Postfix) with ESMTPS id 8BF73863BE for ; Wed, 15 Jan 2020 16:20:03 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Jan 2020 08:20:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,323,1574150400"; d="scan'208";a="397936022" Received: from silpixa00397517.ir.intel.com ([10.237.222.176]) by orsmga005.jf.intel.com with ESMTP; 15 Jan 2020 08:20:01 -0800 From: Emma Finn To: dev@openvswitch.org Date: Wed, 15 Jan 2020 16:19:53 +0000 Message-Id: <1579105193-31418-1-git-send-email-emma.finn@intel.com> X-Mailer: git-send-email 2.7.4 Cc: ian.stokes@intel.org, Emma Finn , i.maximets@ovn.org Subject: [ovs-dev] [v3] dpif-netdev: Modified ovs-appctl dpctl/dump-flows command 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" Modified ovs-appctl dpctl/dump-flows command to output the miniflow bits for a given flow when -m option is passed. $ ovs-appctl dpctl/dump-flows -m Signed-off-by: Emma Finn --- RFC -> v1 * Changed revision from RFC to v1 * Reformatted based on comments * Fixed same classifier being dumped multiple times flagged by Ilya * Fixed print of subtables flagged by William * Updated print count of bits as well as bits themselves --- v1 -> v2 * Reformatted based on comments * Refactored code to make output part of ovs-appctl dpctl/dump-flows -m command. --- v2 -> v3 * Added attribute dp_extra_info to dpif_flow_attrs struct to store miniflow bits as a string --- NEWS | 2 ++ lib/dpctl.c | 4 ++++ lib/dpif-netdev.c | 8 ++++++++ lib/dpif.h | 1 + 4 files changed, 15 insertions(+) diff --git a/NEWS b/NEWS index 965faca..1c9d2db 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,8 @@ Post-v2.12.0 * Add option to enable, disable and query TCP sequence checking in conntrack. * Add support for conntrack zone limits. + * Command "ovs-appctl dpctl/dump-flows" refactored to show subtable + miniflow bits for userspace datapath. - AF_XDP: * New option 'use-need-wakeup' for netdev-afxdp to control enabling of corresponding 'need_wakeup' flag in AF_XDP rings. Enabled by default diff --git a/lib/dpctl.c b/lib/dpctl.c index a1ea25b..bd33ac4 100644 --- a/lib/dpctl.c +++ b/lib/dpctl.c @@ -825,6 +825,10 @@ format_dpif_flow(struct ds *ds, const struct dpif_flow *f, struct hmap *ports, } ds_put_cstr(ds, ", actions:"); format_odp_actions(ds, f->actions, f->actions_len, ports); + if (dpctl_p->verbosity && f->attrs.dp_extra_info) { + ds_put_format(ds, ", dp-extra-info:miniflow_bits%s", + f->attrs.dp_extra_info); + } } struct dump_types { diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 079bd1b..51def10 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -3101,6 +3101,14 @@ dp_netdev_flow_to_dpif_flow(const struct dp_netdev_flow *netdev_flow, flow->attrs.offloaded = false; flow->attrs.dp_layer = "ovs"; + + struct ds extra_info = DS_EMPTY_INITIALIZER; + + ds_put_format(&extra_info, "(0x%X,0x%X)", + count_1bits(netdev_flow->cr.mask->mf.map.bits[0]), + count_1bits(netdev_flow->cr.mask->mf.map.bits[1])); + flow->attrs.dp_extra_info = ds_steal_cstr(&extra_info); + ds_destroy(&extra_info); } static int diff --git a/lib/dpif.h b/lib/dpif.h index c21e897..064f884 100644 --- a/lib/dpif.h +++ b/lib/dpif.h @@ -513,6 +513,7 @@ struct dpif_flow_detailed_stats { struct dpif_flow_attrs { bool offloaded; /* True if flow is offloaded to HW. */ const char *dp_layer; /* DP layer the flow is handled in. */ + char *dp_extra_info; }; struct dpif_flow_dump_types {