From patchwork Sun Dec 9 16:38:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Satish Kharat X-Patchwork-Id: 10720139 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3188E91E for ; Sun, 9 Dec 2018 16:53:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1277C2A0B7 for ; Sun, 9 Dec 2018 16:53:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 00C902A0C3; Sun, 9 Dec 2018 16:53:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E4952A0B7 for ; Sun, 9 Dec 2018 16:53:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726097AbeLIQx4 (ORCPT ); Sun, 9 Dec 2018 11:53:56 -0500 Received: from rcdn-iport-4.cisco.com ([173.37.86.75]:53286 "EHLO rcdn-iport-4.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726078AbeLIQx4 (ORCPT ); Sun, 9 Dec 2018 11:53:56 -0500 X-Greylist: delayed 562 seconds by postgrey-1.27 at vger.kernel.org; Sun, 09 Dec 2018 11:53:56 EST DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2079; q=dns/txt; s=iport; t=1544374436; x=1545584036; h=from:to:cc:subject:date:message-id; bh=O07K6AgTDvev0JMM8E1MbVvQJx80RQc86000tAYz6Wg=; b=ERYvwSLSjbuEnVkhpw816nCt6430hOxk+P+m6CYjtNiym1oob/2S6KXF 6hPpPh5wEXBLBgQuZLRxKj1J/3sqU/OeyW0ROnnUbgfP88C/P+W7gFH1j pt0tWFC5kR+otGamEAVlkbD9Ihujb4ad6LYJESQVPo5aUFWrIEbL+tPj+ M=; X-IronPort-AV: E=Sophos;i="5.56,335,1539648000"; d="scan'208";a="493341393" Received: from alln-core-11.cisco.com ([173.36.13.133]) by rcdn-iport-4.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Dec 2018 16:44:33 +0000 Received: from satish-ini-cisco-com.cisco.com (satish-ini.cisco.com [10.193.101.67]) by alln-core-11.cisco.com (8.15.2/8.15.2) with ESMTP id wB9GiXt8022582; Sun, 9 Dec 2018 16:44:33 GMT From: Satish Kharat To: linux-scsi@vger.kernel.org Cc: Satish Kharat Subject: [PATCH] scsi:fnic: Add fnic port speed stat to finc debug stats Date: Sun, 9 Dec 2018 08:38:35 -0800 Message-Id: <20181209163844.48020-1-satishkh@cisco.com> X-Mailer: git-send-email 2.17.2 X-Outbound-SMTP-Client: 10.193.101.67, satish-ini.cisco.com X-Outbound-Node: alln-core-11.cisco.com Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds the current fnic port speed stat to fnic debug stats. Signed-off-by: Satish Kharat --- drivers/scsi/fnic/fnic_fcs.c | 6 ++++++ drivers/scsi/fnic/fnic_stats.h | 1 + drivers/scsi/fnic/fnic_trace.c | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/drivers/scsi/fnic/fnic_fcs.c b/drivers/scsi/fnic/fnic_fcs.c index 844ef688fa91..dac7e3175563 100644 --- a/drivers/scsi/fnic/fnic_fcs.c +++ b/drivers/scsi/fnic/fnic_fcs.c @@ -65,6 +65,12 @@ void fnic_handle_link(struct work_struct *work) fnic->link_status = vnic_dev_link_status(fnic->vdev); fnic->link_down_cnt = vnic_dev_link_down_cnt(fnic->vdev); + atomic64_set(&fnic->fnic_stats.misc_stats.current_port_speed, + vnic_dev_port_speed(fnic->vdev)); + shost_printk(KERN_INFO, fnic->lport->host, "Current vnic speed set to : %llu\n", + (u64)atomic64_read( + &fnic->fnic_stats.misc_stats.current_port_speed)); + switch (vnic_dev_port_speed(fnic->vdev)) { case DCEM_PORTSPEED_10G: fc_host_speed(fnic->lport->host) = FC_PORTSPEED_10GBIT; diff --git a/drivers/scsi/fnic/fnic_stats.h b/drivers/scsi/fnic/fnic_stats.h index 9daa6ada6fa0..299e925921b1 100644 --- a/drivers/scsi/fnic/fnic_stats.h +++ b/drivers/scsi/fnic/fnic_stats.h @@ -113,6 +113,7 @@ struct misc_stats { atomic64_t queue_fulls; atomic64_t rport_not_ready; atomic64_t frame_errors; + atomic64_t current_port_speed; }; struct fnic_stats { diff --git a/drivers/scsi/fnic/fnic_trace.c b/drivers/scsi/fnic/fnic_trace.c index 8271785bdb93..8c78269814ae 100644 --- a/drivers/scsi/fnic/fnic_trace.c +++ b/drivers/scsi/fnic/fnic_trace.c @@ -446,6 +446,11 @@ int fnic_get_stats_data(struct stats_debug_info *debug, (u64)atomic64_read(&stats->misc_stats.rport_not_ready), (u64)atomic64_read(&stats->misc_stats.frame_errors)); + len += snprintf(debug->debug_buffer + len, buf_size - len, + "Firmware reported port seed: %llu\n", + (u64)atomic64_read( + &stats->misc_stats.current_port_speed)); + return len; }