scsi: fnic: Add port speed stat to fnic debug stats
authorSatish Kharat <satishkh@cisco.com>
Tue, 15 Jan 2019 01:09:24 +0000 (17:09 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 23 Jan 2019 02:18:34 +0000 (21:18 -0500)
This patch adds the current fnic port speed stat to fnic debug stats.

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/fnic/fnic_fcs.c
drivers/scsi/fnic/fnic_stats.h
drivers/scsi/fnic/fnic_trace.c

index 9bc1ece372a74a7907ceb5302b9f400d645cb039..911a5adc289cf37de34fccaf63ab38b66d6b42a8 100644 (file)
@@ -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;
index 9daa6ada6fa064a7797fb3898efd76de7dede460..299e925921b1298f3d289686fcf6215f0a6495d1 100644 (file)
@@ -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 {
index bf0fd2aeb92e818e4afd512beb1638c4827f7bba..8c0d4ee824db143156570f60fe5a1a504a9eca15 100644 (file)
@@ -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;
 
 }