Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: fnic: print port speed only at driver init or speed change

Port speed printing was added by commit d948e6383ec3 ("scsi: fnic: Add port
speed stat to fnic debug stats"). As currently configured, this will cause
the port speed to be printed to syslog every 2 seconds. To prevent log
spamming, only print the vnic port speed at driver initialization and if
the speed changes. Also clean up a small typo in fnic_trace.c.

Fixes: d948e6383ec3 ("scsi: fnic: Add port speed stat to fnic debug stats")
Signed-off-by: John Pittman <jpittman@redhat.com>
Reviewed-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

John Pittman and committed by
Martin K. Petersen
90302e95 84769706

+11 -5
+10 -4
drivers/scsi/fnic/fnic_fcs.c
··· 52 52 unsigned long flags; 53 53 int old_link_status; 54 54 u32 old_link_down_cnt; 55 + u64 old_port_speed, new_port_speed; 55 56 56 57 spin_lock_irqsave(&fnic->fnic_lock, flags); 57 58 ··· 63 62 64 63 old_link_down_cnt = fnic->link_down_cnt; 65 64 old_link_status = fnic->link_status; 65 + old_port_speed = atomic64_read( 66 + &fnic->fnic_stats.misc_stats.current_port_speed); 67 + 66 68 fnic->link_status = vnic_dev_link_status(fnic->vdev); 67 69 fnic->link_down_cnt = vnic_dev_link_down_cnt(fnic->vdev); 68 70 71 + new_port_speed = vnic_dev_port_speed(fnic->vdev); 69 72 atomic64_set(&fnic->fnic_stats.misc_stats.current_port_speed, 70 - vnic_dev_port_speed(fnic->vdev)); 71 - shost_printk(KERN_INFO, fnic->lport->host, "Current vnic speed set to : %llu\n", 72 - (u64)atomic64_read( 73 - &fnic->fnic_stats.misc_stats.current_port_speed)); 73 + new_port_speed); 74 + if (old_port_speed != new_port_speed) 75 + shost_printk(KERN_INFO, fnic->lport->host, 76 + "Current vnic speed set to : %llu\n", 77 + new_port_speed); 74 78 75 79 switch (vnic_dev_port_speed(fnic->vdev)) { 76 80 case DCEM_PORTSPEED_10G:
+1 -1
drivers/scsi/fnic/fnic_trace.c
··· 453 453 (u64)atomic64_read(&stats->misc_stats.frame_errors)); 454 454 455 455 len += snprintf(debug->debug_buffer + len, buf_size - len, 456 - "Firmware reported port seed: %llu\n", 456 + "Firmware reported port speed: %llu\n", 457 457 (u64)atomic64_read( 458 458 &stats->misc_stats.current_port_speed)); 459 459