@@ -4023,7 +4023,7 @@ lpfc_mbx_cmpl_reg_vpi(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
40234023 spin_unlock_irq (shost -> host_lock );
40244024 vport -> num_disc_nodes = 0 ;
40254025 /* go thru NPR list and issue ELS PLOGIs */
4026- if (vport -> fc_npr_cnt )
4026+ if (atomic_read ( & vport -> fc_npr_cnt ) )
40274027 lpfc_els_disc_plogi (vport );
40284028
40294029 if (!vport -> num_disc_nodes ) {
@@ -4600,40 +4600,35 @@ lpfc_unregister_remote_port(struct lpfc_nodelist *ndlp)
46004600static void
46014601lpfc_nlp_counters (struct lpfc_vport * vport , int state , int count )
46024602{
4603- struct Scsi_Host * shost = lpfc_shost_from_vport (vport );
4604- unsigned long iflags ;
4605-
4606- spin_lock_irqsave (shost -> host_lock , iflags );
46074603 switch (state ) {
46084604 case NLP_STE_UNUSED_NODE :
4609- vport -> fc_unused_cnt += count ;
4605+ atomic_add ( count , & vport -> fc_unused_cnt ) ;
46104606 break ;
46114607 case NLP_STE_PLOGI_ISSUE :
4612- vport -> fc_plogi_cnt += count ;
4608+ atomic_add ( count , & vport -> fc_plogi_cnt ) ;
46134609 break ;
46144610 case NLP_STE_ADISC_ISSUE :
4615- vport -> fc_adisc_cnt += count ;
4611+ atomic_add ( count , & vport -> fc_adisc_cnt ) ;
46164612 break ;
46174613 case NLP_STE_REG_LOGIN_ISSUE :
4618- vport -> fc_reglogin_cnt += count ;
4614+ atomic_add ( count , & vport -> fc_reglogin_cnt ) ;
46194615 break ;
46204616 case NLP_STE_PRLI_ISSUE :
4621- vport -> fc_prli_cnt += count ;
4617+ atomic_add ( count , & vport -> fc_prli_cnt ) ;
46224618 break ;
46234619 case NLP_STE_UNMAPPED_NODE :
4624- vport -> fc_unmap_cnt += count ;
4620+ atomic_add ( count , & vport -> fc_unmap_cnt ) ;
46254621 break ;
46264622 case NLP_STE_MAPPED_NODE :
4627- vport -> fc_map_cnt += count ;
4623+ atomic_add ( count , & vport -> fc_map_cnt ) ;
46284624 break ;
46294625 case NLP_STE_NPR_NODE :
4630- if (vport -> fc_npr_cnt == 0 && count == -1 )
4631- vport -> fc_npr_cnt = 0 ;
4626+ if (! atomic_read ( & vport -> fc_npr_cnt ) && count == -1 )
4627+ atomic_set ( & vport -> fc_npr_cnt , 0 ) ;
46324628 else
4633- vport -> fc_npr_cnt += count ;
4629+ atomic_add ( count , & vport -> fc_npr_cnt ) ;
46344630 break ;
46354631 }
4636- spin_unlock_irqrestore (shost -> host_lock , iflags );
46374632}
46384633
46394634/* Register a node with backend if not already done */
@@ -5034,8 +5029,9 @@ lpfc_set_disctmo(struct lpfc_vport *vport)
50345029 "0247 Start Discovery Timer state x%x "
50355030 "Data: x%x x%lx x%x x%x\n" ,
50365031 vport -> port_state , tmo ,
5037- (unsigned long )& vport -> fc_disctmo , vport -> fc_plogi_cnt ,
5038- vport -> fc_adisc_cnt );
5032+ (unsigned long )& vport -> fc_disctmo ,
5033+ atomic_read (& vport -> fc_plogi_cnt ),
5034+ atomic_read (& vport -> fc_adisc_cnt ));
50395035
50405036 return ;
50415037}
@@ -5070,7 +5066,8 @@ lpfc_can_disctmo(struct lpfc_vport *vport)
50705066 "0248 Cancel Discovery Timer state x%x "
50715067 "Data: x%x x%x x%x\n" ,
50725068 vport -> port_state , vport -> fc_flag ,
5073- vport -> fc_plogi_cnt , vport -> fc_adisc_cnt );
5069+ atomic_read (& vport -> fc_plogi_cnt ),
5070+ atomic_read (& vport -> fc_adisc_cnt ));
50745071 return 0 ;
50755072}
50765073
@@ -5951,8 +5948,10 @@ lpfc_disc_start(struct lpfc_vport *vport)
59515948 lpfc_printf_vlog (vport , KERN_INFO , LOG_DISCOVERY ,
59525949 "0202 Start Discovery port state x%x "
59535950 "flg x%x Data: x%x x%x x%x\n" ,
5954- vport -> port_state , vport -> fc_flag , vport -> fc_plogi_cnt ,
5955- vport -> fc_adisc_cnt , vport -> fc_npr_cnt );
5951+ vport -> port_state , vport -> fc_flag ,
5952+ atomic_read (& vport -> fc_plogi_cnt ),
5953+ atomic_read (& vport -> fc_adisc_cnt ),
5954+ atomic_read (& vport -> fc_npr_cnt ));
59565955
59575956 /* First do ADISCs - if any */
59585957 num_sent = lpfc_els_disc_adisc (vport );
@@ -5981,7 +5980,7 @@ lpfc_disc_start(struct lpfc_vport *vport)
59815980 if (!(vport -> fc_flag & FC_ABORT_DISCOVERY )) {
59825981 vport -> num_disc_nodes = 0 ;
59835982 /* go thru NPR nodes and issue ELS PLOGIs */
5984- if (vport -> fc_npr_cnt )
5983+ if (atomic_read ( & vport -> fc_npr_cnt ) )
59855984 lpfc_els_disc_plogi (vport );
59865985
59875986 if (!vport -> num_disc_nodes ) {
@@ -6077,7 +6076,8 @@ lpfc_disc_flush_list(struct lpfc_vport *vport)
60776076 struct lpfc_nodelist * ndlp , * next_ndlp ;
60786077 struct lpfc_hba * phba = vport -> phba ;
60796078
6080- if (vport -> fc_plogi_cnt || vport -> fc_adisc_cnt ) {
6079+ if (atomic_read (& vport -> fc_plogi_cnt ) ||
6080+ atomic_read (& vport -> fc_adisc_cnt )) {
60816081 list_for_each_entry_safe (ndlp , next_ndlp , & vport -> fc_nodes ,
60826082 nlp_listp ) {
60836083 if (ndlp -> nlp_state == NLP_STE_PLOGI_ISSUE ||
0 commit comments