• Steffen Maier's avatar
    scsi: zfcp: reduce flood of fcrscn1 trace records on multi-element RSCN · c8206579
    Steffen Maier authored
    If an incoming ELS of type RSCN contains more than one element, zfcp
    suboptimally causes repeated erp trigger NOP trace records for each
    previously failed port. These could be ports that went away.  It loops over
    each RSCN element, and for each of those in an inner loop over all
    zfcp_ports.
    
    The trigger to recover failed ports should be just the reception of some
    RSCN, no matter how many elements it has. So we can loop over failed ports
    separately, and only then loop over each RSCN element to handle the
    non-failed ports.
    
    The call chain was:
    
      zfcp_fc_incoming_rscn
        for (i = 1; i < no_entries; i++)
          _zfcp_fc_incoming_rscn
            list_for_each_entry(port, &adapter->port_list, list)
              if (masked port->d_id match) zfcp_fc_test_link
              if (!port->d_id) zfcp_erp_port_reopen "fcrscn1"   <===
    
    In order the reduce the "flooding" of the REC trace area in such cases, we
    factor out handling the failed ports to be outside of the entries loop:
    
      zfcp_fc_incoming_rscn
        if (no_entries > 1)                                     <===
          list_for_each_entry(port, &adapter->port_list, list)  <===
            if (!port->d_id) zfcp_erp_port_reopen "fcrscn1"     <===
        for (i = 1; i < no_entries; i++)
          _zfcp_fc_incoming_rscn
            list_for_each_entry(port, &adapter->port_list, list)
              if (masked port->d_id match) zfcp_fc_test_link
    
    Abbreviated example trace records before this code change:
    
    Tag            : fcrscn1
    WWPN           : 0x500507630310d327
    ERP want       : 0x02
    ERP need       : 0x02
    
    Tag            : fcrscn1
    WWPN           : 0x500507630310d327
    ERP want       : 0x02
    ERP need       : 0x00                 NOP => superfluous trace record
    
    The last trace entry repeats if there are more than 2 RSCN elements.
    Signed-off-by: default avatarSteffen Maier <maier@linux.ibm.com>
    Reviewed-by: default avatarBenjamin Block <bblock@linux.ibm.com>
    Reviewed-by: default avatarJens Remus <jremus@linux.ibm.com>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    c8206579
zfcp_fc.c 30 KB