From patchwork Fri Nov 11 12:36:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ravali.burra@wipro.com X-Patchwork-Id: 693650 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 3tFfYK5pGCz9t10 for ; Fri, 11 Nov 2016 23:36:36 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id DBDF9B7E; Fri, 11 Nov 2016 12:36:32 +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 9AA9695D for ; Fri, 11 Nov 2016 12:36:31 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sg2apc01on0064.outbound.protection.outlook.com [104.47.125.64]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 047B4D4 for ; Fri, 11 Nov 2016 12:36:29 +0000 (UTC) Received: from HK2PR0301MB1954.apcprd03.prod.outlook.com (10.167.70.20) by HK2PR0301MB1955.apcprd03.prod.outlook.com (10.167.70.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.721.10; Fri, 11 Nov 2016 12:36:26 +0000 Received: from HK2PR0301MB1954.apcprd03.prod.outlook.com ([10.167.70.20]) by HK2PR0301MB1954.apcprd03.prod.outlook.com ([10.167.70.20]) with mapi id 15.01.0721.010; Fri, 11 Nov 2016 12:36:26 +0000 From: To: Thread-Topic: [ovs-dev] [PATCH 1/1] : Add Clear statistics support at interface level Thread-Index: AdI8GDa7oPnkOf29QE6wXByRGvjp+w== Date: Fri, 11 Nov 2016 12:36:26 +0000 Message-ID: Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=ravali.burra@wipro.com; x-originating-ip: [203.91.215.162] x-microsoft-exchange-diagnostics: 1; HK2PR0301MB1955; 7:tnsthgXa/IQu4AUh839Hd/S62MEmH/+ge9K3D2MBLcvaBf833JDYHtgX32DVLvPtoMHfKmlL56SeKA1qeAoJcwEJ05nhFxQDRgrzTSVkzaksljax2OQCJGmepHVUgkT+79DZ8fYd17T3gP5zkQX9Nj1SivTl4k7gCvF8b0ZlxM+FQPymacA1CxJjATv546y1nrvaqIGNg+nhc/Mox2ifOw8RyjyhW+K/Qq00kXNvObrFLoLVPa+pn1F4oh75XEvju3JUQ3cMRvVSQE6M9S/FA8TgizmeDG4bfbSa1slmK5NUZV/wdJ/onraMfHw/Ec0fnyPxVdAZqlGxfk2J0wkqd4zcxNB7aa7QDzOrVyTaUz8= x-ms-office365-filtering-correlation-id: dbc73e3c-194b-487c-1e42-08d40a2f5a95 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:HK2PR0301MB1955; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(267259832677123)(62627912741753)(21748063052155); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(61425038)(6040176)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026)(61426038)(61427038); SRVR:HK2PR0301MB1955; BCL:0; PCL:0; RULEID:; SRVR:HK2PR0301MB1955; x-forefront-prvs: 012349AD1C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(7916002)(189002)(199003)(53754006)(15974865002)(6916009)(189998001)(586003)(122556002)(9686002)(2900100001)(3280700002)(8676002)(81166006)(9326002)(81156014)(7736002)(50986999)(68736007)(54356999)(7696004)(74316002)(107886002)(7846002)(5660300001)(87936001)(101416001)(8936002)(1730700003)(3660700001)(3846002)(6116002)(97736004)(790700001)(5630700001)(102836003)(86362001)(2906002)(2351001)(110136003)(92566002)(450100001)(77096005)(33656002)(105586002)(106356001)(66066001)(76576001)(5890100001)(2501003)(5640700001); DIR:OUT; SFP:1101; SCL:1; SRVR:HK2PR0301MB1955; H:HK2PR0301MB1954.apcprd03.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: wipro.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wipro.com X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Nov 2016 12:36:26.4534 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 258ac4e4-146a-411e-9dc8-79a9e12fd6da X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR0301MB1955 X-MS-Exchange-CrossPremises-AuthAs: Internal X-MS-Exchange-CrossPremises-AuthMechanism: 04 X-MS-Exchange-CrossPremises-AuthSource: HK2PR0301MB1954.apcprd03.prod.outlook.com X-MS-Exchange-CrossPremises-SCL: 1 X-MS-Exchange-CrossPremises-messagesource: StoreDriver X-MS-Exchange-CrossPremises-BCC: X-MS-Exchange-CrossPremises-originalclientipaddress: 203.91.215.162 X-MS-Exchange-CrossPremises-avstamp-service: 1.0 X-MS-Exchange-CrossPremises-disclaimer-hash: ef6ed6a830673538406bd527e716551fd2daba1e446b50e7f1f30c79ce70f874 X-MS-Exchange-CrossPremises-antispam-scancontext: DIR:Originating; SFV:NSPM; SKIP:0; X-MS-Exchange-CrossPremises-processed-by-journaling: Journal Agent X-OrganizationHeadersPreserved: HK2PR0301MB1955.apcprd03.prod.outlook.com X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org X-Content-Filtered-By: Mailman/MimeDel 2.1.12 Subject: [ovs-dev] [PATCH 1/1] : Add Clear statistics support at interface level 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: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Hi All, Below are the configuration and patch details which provides the support for clearing statistics at Interface level. Description & Configuration: OVS by default has the support for the command ovs-vsctl clear interface statistics But in OVS the command functionality is implemented in such a way that we are just clearing the key and values and Number of statistics fields respective to the statistics column of Interface table at the db level, which was not clearing the statistics at Hardware level so we have extended the support to clear the statistics at Hardware level. Please find the below patch for implementation of clear statistics at Interface level. The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 7c1523e..71e2c7e 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -1866,6 +1866,15 @@ netdev_dpdk_convert_xstats(struct netdev_stats *stats, } } +int +get_stats_resets(const struct netdev *netdev) +{ + struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); + memset(&dev->stats, 0, sizeof(dev->stats)); + rte_eth_stats_reset(dev->port_id); + return 0; +} + static int netdev_dpdk_get_stats(const struct netdev *netdev, struct netdev_stats *stats) { diff --git a/lib/netdev.h b/lib/netdev.h index bad28c4..72a25a6 100644 --- a/lib/netdev.h +++ b/lib/netdev.h @@ -221,6 +221,7 @@ struct netdev *netdev_find_dev_by_in4(const struct in_addr *); /* Statistics. */ int netdev_get_stats(const struct netdev *, struct netdev_stats *); +int get_stats_resets(const struct netdev *); /* Quality of service. */ struct netdev_qos_capabilities { diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index ff5d86f..535c37c 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -657,6 +657,10 @@ bridge_reconfigure(const struct ovsrec_open_vswitch *ovs_cfg) &iface->cfg->lldp); ofproto_port_set_config(br->ofproto, iface->ofp_port, &iface->cfg->other_config); + if(iface->cfg->n_statistics == 0){ + get_stats_resets(iface->netdev); + } + } } bridge_configure_mirrors(br);