1. 07 3月, 2009 3 次提交
    • S
      [SCSI] libfc: exch mgr is freed while lport still retrying sequences · f7db2c15
      Steve Ma 提交于
      When a sequence cannot be delivered to the target, the local
      port will schedule retries, While this process is in progress,
      if we destroy the FCoE interface, the fcoe_sw_destroy routine is
      entered, and the fc_exch_mgr_free(lp->emp) is called.  Thus
      if fc_exch_alloc() is called when retrying the sequence,
      the mempool_alloc() will fail to allocate the exchange because
      the mempool of the exchange manager has already been released.
      This patch is to cancel any pending retry work of the local
      port before we start to destroy the interface.
      
      Also, when resetting the local port, we should also stop the
      scheduled pending retries.
      Signed-off-by: NSteve Ma <steve.ma@intel.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      f7db2c15
    • V
      [SCSI] libfc, fcoe: fixed locking issues with lport->lp_mutex around lport->link_status · bc0e17f6
      Vasu Dev 提交于
      The fcoe_xmit could call fc_pause in case the pending skb queue len is larger
      than FCOE_MAX_QUEUE_DEPTH, the fc_pause was trying to grab lport->lp_muex to
      change lport->link_status and that had these issues :-
      
      1. The fcoe_xmit was getting called with bh disabled, thus causing
      "BUG: scheduling while atomic" when grabbing lport->lp_muex with bh disabled.
      
      2. fc_linkup and fc_linkdown function calls lport_enter function with
      lport->lp_mutex held and these enter function in turn calls fcoe_xmit to send
      lport related FC frame, e.g. fc_linkup => fc_lport_enter_flogi to send flogi
      req. In this case grabbing the same lport->lp_mutex again in fc_puase from
      fcoe_xmit would cause deadlock.
      
      The lport->lp_mutex was used for setting FC_PAUSE in fcoe_xmit path but
      FC_PAUSE bit was not used anywhere beside just setting and clear this
      bit in lport->link_status, instead used a separate field qfull in fc_lport
      to eliminate need for lport->lp_mutex to track pending queue full condition
      and in turn avoid above described two locking issues.
      
      Also added check for lp->qfull in fc_fcp_lport_queue_ready to trigger
      SCSI_MLQUEUE_HOST_BUSY when lp->qfull is set to prevent more scsi-ml cmds
      while lp->qfull is set.
      
      This patch eliminated FC_LINK_UP and FC_PAUSE and instead used dedicated
      fields in fc_lport for this, this simplified all related conditional
      code.
      
      Also removed fc_pause and fc_unpause functions and instead used newly added
      lport->qfull directly in fcoe.
      Signed-off-by: NVasu Dev <vasu.dev@intel.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      bc0e17f6
    • A
      [SCSI] libfc: Pass lport in exch_mgr_reset · 1f6ff364
      Abhijeet Joglekar 提交于
      fc_exch_mgr structure is private to fc_exch.c. To export exch_mgr_reset to
      transport, transport needs access to the exch manager. Change
      exch_mgr_reset to use lport param which is the shared structure between
      libFC and transport.
      
      Alternatively, fc_exch_mgr definition can be moved to libfc.h so that lport
      can be accessed from mp*.
      Signed-off-by: NAbhijeet Joglekar <abjoglek@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      1f6ff364
  2. 30 12月, 2008 1 次提交
    • R
      [SCSI] libfc: A modular Fibre Channel library · 42e9a92f
      Robert Love 提交于
      libFC is composed of 4 blocks supported by an exchange manager
      and a framing library. The upper 4 layers are fc_lport, fc_disc,
      fc_rport and fc_fcp. A LLD that uses libfc could choose to
      either use libfc's block, or using the transport template
      defined in libfc.h, override one or more blocks with its own
      implementation.
      
      The EM (Exchange Manager) manages exhcanges/sequences for all
      commands- ELS, CT and FCP.
      
      The framing library frames ELS and CT commands.
      
      The fc_lport block manages the library's representation of the
      host's FC enabled ports.
      
      The fc_disc block manages discovery of targets as well as
      handling changes that occur in the FC fabric (via. RSCN events).
      
      The fc_rport block manages the library's representation of other
      entities in the FC fabric. Currently the library uses this block
      for targets, its peer when in point-to-point mode and the
      directory server, but can be extended for other entities if
      needed.
      
      The fc_fcp block interacts with the scsi-ml and handles all
      I/O.
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      [jejb: added include of delay.h to fix ppc64 compile prob spotted by sfr]
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      42e9a92f