From patchwork Thu Nov 21 01:30:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Kolakaluri X-Patchwork-Id: 1198631 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.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=plume.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=plume-com.20150623.gappssmtp.com header.i=@plume-com.20150623.gappssmtp.com header.b="Mi72xUiA"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47JMwY1bY3z9sPT for ; Thu, 21 Nov 2019 12:51:08 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5945886EC4; Thu, 21 Nov 2019 01:51:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 23uIDJNHQub6; Thu, 21 Nov 2019 01:51:04 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 02EBB86BFF; Thu, 21 Nov 2019 01:51:04 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id DFC9BC1DD7; Thu, 21 Nov 2019 01:51:03 +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 D9432C18DA for ; Thu, 21 Nov 2019 01:51:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id C740120535 for ; Thu, 21 Nov 2019 01:51:02 +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 ckgzjupYjNAV for ; Thu, 21 Nov 2019 01:51:01 +0000 (UTC) X-Greylist: delayed 00:15:32 by SQLgrey-1.7.6 Received: from mail-yw1-f68.google.com (mail-yw1-f68.google.com [209.85.161.68]) by silver.osuosl.org (Postfix) with ESMTPS id A2C6D20532 for ; Thu, 21 Nov 2019 01:51:01 +0000 (UTC) Received: by mail-yw1-f68.google.com with SMTP id r131so766332ywh.2 for ; Wed, 20 Nov 2019 17:51:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plume-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=LSEaVhdR4Dy+vSTd6wPQUfE9js/4XKa/6De9oWayh64=; b=Mi72xUiAzdi6zKJ/a27PvyTWmeEWCeeUC4SyEH26acWxnfG3CZyyuHrSpsWDhf0Qd6 Dx8th5JG2bBk7lteE0Eum9Hkn7K1lNL2AJ1ToY/7p9FnYwA4XcGnfHU91R0FHMUnRTPB iW/PCewIB4IckVSSqlX1hg28l9B7zIVMsEewZkdXDFfSIeO891W4cJQEMlixUwGOdh/Y wEylnhB63VsIDoBHwiJJj5gzVQeTMfS7E0uxr2aHXwMJMG4vM287CLEjaGPB3K+cIDeX jAtirv6/aXfP0aoXtdYRcXK3jo200dUqZ4+KgsfibfsWlp+4dQLPVcrJ5ZRJRgu+51FD vQJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=LSEaVhdR4Dy+vSTd6wPQUfE9js/4XKa/6De9oWayh64=; b=s6RKTi9VFh1p58n/+Ftai8ZkG31n9jMu4i1PkD2/PoHpcjRfC0Pdmnk1dxPqaCJCsU a9wKnkXMxpe+qEW//t8ML1MCh4ZxFKVK/PT0NNY+J1cKIMxkYCKSgOo4r2xDERR8fipp DPSCMwpcAb/xepIq0dJNt0+xQM+SITT1Utfni+CifjVFU9m0Bt38G7ULTqEb0CjMS/6I p8I1iNzlZu6tdteyX35469uwgGEFmdUzLl/IGgAx+NLzZH18PjHxbZjJ/mbeAMgwQ/2t UF0vKXVHeLwSRQMWCMSVYXJxz/jMeG3fs0oK9xmofu5tddjZ8sbogaAqpqBBoSKe+iDw ktTw== X-Gm-Message-State: APjAAAWWvNoani4W4/G5MGyLd1zWIosvlXMGM9j3J42J64i9VFAWDavK DFF+hcNmVhTX25EHGKbMK2KEOYbz5xcdhMntTA474oEXxsji9w== X-Google-Smtp-Source: APXvYqzEs/JF946f49I0MiNQQE5XL2mdXc2+mUvLqHQbgPrfEEMozIFBt3v7HlTJkoZeSddIeA5TimYOw+h6qs7bfFQ= X-Received: by 2002:ab0:2a4f:: with SMTP id p15mr3746502uar.70.1574299816149; Wed, 20 Nov 2019 17:30:16 -0800 (PST) MIME-Version: 1.0 From: Krishna Kolakaluri Date: Wed, 20 Nov 2019 17:30:05 -0800 Message-ID: To: dev@openvswitch.org Subject: [ovs-dev] [PATCH] bridge: Move sec_in_state field from port status to port statistics. 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: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Signed-off-by: Krishna Kolakaluri --- ofproto/ofproto-dpif.c | 2 +- ofproto/ofproto.h | 2 +- vswitchd/bridge.c | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index c35ec3e61..f68ab661f 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -2829,7 +2829,6 @@ get_stp_port_status(struct ofport *ofport_, s->enabled = true; stp_port_get_status(sp, &s->port_id, &s->state, &s->role); - s->sec_in_state = (time_msec() - ofport->stp_state_entered) / 1000; return 0; } @@ -2849,6 +2848,7 @@ get_stp_port_stats(struct ofport *ofport_, s->enabled = true; stp_port_get_counts(sp, &s->tx_count, &s->rx_count, &s->error_count); + s->sec_in_state = (time_msec() - ofport->stp_state_entered) / 1000; return 0; } diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h index 033c4cf93..7e75b2e6c 100644 --- a/ofproto/ofproto.h +++ b/ofproto/ofproto.h @@ -166,7 +166,6 @@ struct ofproto_port_stp_status { bool enabled; /* If false, ignore other members. */ int port_id; enum stp_state state; - unsigned int sec_in_state; enum stp_role role; }; @@ -175,6 +174,7 @@ struct ofproto_port_stp_stats { int tx_count; /* Number of BPDUs transmitted. */ int rx_count; /* Number of valid BPDUs received. */ int error_count; /* Number of bad BPDUs received. */ + unsigned int sec_in_state; /* Number of secs in stp state. */ }; struct ofproto_port_queue { diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 9095ebf5d..26aa596e9 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -2758,7 +2758,6 @@ port_refresh_stp_status(struct port *port) smap_init(&smap); smap_add_format(&smap, "stp_port_id", "%d", status.port_id); smap_add(&smap, "stp_state", stp_state_name(status.state)); - smap_add_format(&smap, "stp_sec_in_state", "%u", status.sec_in_state); smap_add(&smap, "stp_role", stp_role_name(status.role)); ovsrec_port_set_status(port->cfg, &smap); smap_destroy(&smap); @@ -2770,8 +2769,8 @@ port_refresh_stp_stats(struct port *port) struct ofproto *ofproto = port->bridge->ofproto; struct iface *iface; struct ofproto_port_stp_stats stats; - const char *keys[3]; - int64_t int_values[3]; + const char *keys[4]; + int64_t int_values[4]; if (port_is_synthetic(port)) { return; @@ -2799,6 +2798,8 @@ port_refresh_stp_stats(struct port *port) int_values[1] = stats.rx_count; keys[2] = "stp_error_count"; int_values[2] = stats.error_count; + keys[3] = "stp_sec_in_state"; + int_values[3] = stats.sec_in_state; ovsrec_port_set_statistics(port->cfg, keys, int_values, ARRAY_SIZE(int_values));