1. 04 Dec, 2009 17 commits
  2. 10 Sep, 2009 15 commits
  3. 05 Sep, 2009 2 commits
    • Vasu Dev's avatar
      [SCSI] fcoe, libfc: fully makes use of per cpu exch pool and then removes em_lock · b2f0091f
      Vasu Dev authored
      1. Updates fcoe_rcv() to queue incoming frames to the fcoe per
         cpu thread on which this frame's exch was originated and simply
         use current cpu for request exch not originated by initiator.
         It is redundant to add this code under CONFIG_SMP, so removes
         CONFIG_SMP uses around this code.
      
      2. Updates fc_exch_em_alloc, fc_exch_delete, fc_exch_find to use
         per cpu exch pools, here fc_exch_delete is rename of older
         fc_exch_mgr_delete_ep since ep/exch are now deleted in pools
         of EM and so brief new name is sufficient and better name.
      
         Updates these functions to map exch id to their index into exch
         pool using fc_cpu_mask, fc_cpu_order and EM min_xid.
         This mapping is as per detailed explanation about this in
         last patch and basically this is just as lower fc_cpu_mask
         bits of exch id as cpu number and upper bit sum of EM min_xid
         and exch index in pool.
      
         Uses pool next_index to keep track of exch allocation from
         pool along with pool_max_index as upper bound of exches array
         in pool.
      
      3. Adds exch pool ptr to fc_exch to free exch to its pool in
         fc_exch_delete.
      
      4. Updates fc_exch_mgr_reset to reset all exch pools of an EM,
         this required adding fc_exch_pool_reset func to reset exches
         in pool and then have fc_exch_mgr_reset call fc_exch_pool_reset
         for each pool within each EM for a lport.
      
      5. Removes no longer needed exches array, em_lock, next_xid, and
         total_exches from struct fc_exch_mgr, these are not needed after
         use of per cpu exch pool, also removes not used max_read,
         last_read from struct fc_exch_mgr.
      
      6. Updates locking notes for exch pool lock with fc_exch lock and
         uses pool lock in exch allocation, lookup and reset.
      Signed-off-by: default avatarVasu Dev <vasu.dev@intel.com>
      Signed-off-by: default avatarRobert Love <robert.w.love@intel.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
      b2f0091f
    • Vasu Dev's avatar
      [SCSI] fcoe, libfc: adds per cpu exch pool within exchange manager(EM) · e4bc50be
      Vasu Dev authored
      Adds per cpu exch pool for these reasons:-
      
       1. Currently an EM instance is shared across all cpus to manage
          all exches for all cpus. This required em_lock across all
          cpus for an exch alloc, free, lookup and reset each frame
          and that made em_lock expensive, so instead having per cpu
          exch pool with their own per cpu pool lock will likely reduce
          locking contention in fast path for an exch alloc, free and
          lookup.
      
       2. Per cpu exch pool will likely improve cache hit ratio since
          all frames of an exch will be processed on the same cpu on
          which exch originated.
      
      This patch is only prep work to help in keeping complexity of next
      patch low, so this patch only sets up per cpu exch pool and related
      helper funcs to be used by next patch. The next patch fully makes
      use of per cpu exch pool in all code paths ie. tx, rx and reset.
      
      Divides per EM exch id range equally across all cpus to setup per
      cpu exch pool. This division is such that lower bits of exch id
      carries cpu number info on which exch originated, later a simple
      bitwise AND operation on exch id of incoming frame with fc_cpu_mask
      retrieves cpu number info to direct all frames to same cpu on which
      exch originated. This required a global fc_cpu_mask and fc_cpu_order
      initialized to max possible cpus number nr_cpu_ids rounded up to 2's
      power, this will be used in mapping exch id and exch ptr array
      index in pool during exch allocation, find or reset code paths.
      
      Adds a check in fc_exch_mgr_alloc() to ensure specified min_xid
      lower bits are zero since these bits are used to carry cpu info.
      
      Adds and initializes struct fc_exch_pool with all required fields
      to manage exches in pool.
      
      Allocates per cpu struct fc_exch_pool with memory for exches array
      for range of exches per pool. The exches array memory is followed
      by struct fc_exch_pool.
      
      Adds fc_exch_ptr_get/set() helper functions to get/set exch ptr in
      pool exches array at specified array index.
      
      Increases default FCOE_MAX_XID to 0x0FFF from 0x07EF, so that more
      exches are available per cpu after above described exch id range
      division across all cpus to each pool.
      Signed-off-by: default avatarVasu Dev <vasu.dev@intel.com>
      Signed-off-by: default avatarRobert Love <robert.w.love@intel.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
      e4bc50be
  4. 22 Aug, 2009 6 commits
    • Vasu Dev's avatar
      [SCSI] fcoe, fnic, libfc: modifies current code paths to use EM anchor list · 52ff878c
      Vasu Dev authored
      Modifies current code to use EM anchor list in EM allocation, EM free,
      EM reset, exch allocation and exch lookup code paths.
      
       1. Modifies fc_exch_mgr_alloc to accept EM match function and then
          have allocated EM added to the lport using fc_exch_mgr_add API
          while also updating EM kref for newly added EM.
      
       2. Updates fc_exch_mgr_free API to accept only lport pointer instead
          EM and then have this API free all EMs of the lport from EM anchor
          list.
      
       3. Removes single lport pointer link from the EM, which was used in
          associating lport pointer in newly allocated exchange. Instead have
          lport pointer passed along new exchange allocation call path and
          then store passed lport pointer in newly allocated exchange, this
          will allow a single EM instance to be used across more than one
          lport and used in EM reset to reset only lport specific exchanges.
      
       4. Modifies fc_exch_mgr_reset to reset all EMs from the EM anchor list
          of the lport, adds additional exch lport pointer (ep->lp) check for
          shared EM case to reset exchange specific to a lport requested reset.
      
       5. Updates exch allocation API fc_exch_alloc to use EM anchor list and
          its anchor match func pointer. The fc_exch_alloc will walk the list
          of EMs until it finds a match, a match will be either null match
          func pointer or call to match function returning true value.
      
       6. Updates fc_exch_recv to accept incoming frame on local port using
          only lport pointer and frame pointer without specifying EM instance
          of incoming frame. Instead modified fc_exch_recv to locate EM for the
          incoming frame by matching xid of incoming frame against a EM xid range.
          This change was required to use EM list in libfc Rx path and after this
          change the lport fc_exch_mgr pointer emp is not needed anymore, so
          removed emp pointer.
      
       7. Updates fnic for removed lport emp pointer and above modified libfc APIs
          fc_exch_recv, fc_exch_mgr_alloc and fc_exch_mgr_free.
      
       8. Removes exch_get and exch_put from libfc_function_template as these
          are no longer needed with EM anchor list and its match function use.
          Also removes its default function fc_exch_get.
      
      A defect this patch introduced regarding the libfc initialization order in
      the fnic driver was fixed by Joe Eykholt <jeykholt@cisco.com>.
      Signed-off-by: default avatarVasu Dev <vasu.dev@intel.com>
      Signed-off-by: default avatarRobert Love <robert.w.love@intel.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
      52ff878c
    • Robert Love's avatar
      [SCSI] libfc: Remove the FC_EM_DBG macro · d459b7ea
      Robert Love authored
      Currently there is a 1:1 relationship between the lport
      and exchange manager. This macro takes an EM as an argument
      and determines the lport from it. However, later patches
      will use an EM list per lport, so we will no longer have
      this 1:1 relationship- this macro must change.
      
      The FC_EM_DBG macro is rarely used. There are four callers,
      two can use FC_LPORT_DBG instead and two can be removed
      since they're not necessary. This patch makes those changes
      and removes the macro.
      Signed-off-by: default avatarRobert Love <robert.w.love@intel.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
      d459b7ea
    • Vasu Dev's avatar
      [SCSI] fcoe, libfc: adds exchange manager(EM) anchor list per lport and related APIs · 96316099
      Vasu Dev authored
      Adds EM list using a anchor struct fc_exch_mgr_anchor, anchor is used
      to allow same EM instance sharing across more than one lport on a eth
      device, this implementation is per discussed design posted at
      http://www.open-fcoe.org/pipermail/devel/2009-June/002566.html.
      
      The shared EM is required for multiple lports on eth device when
      using multiple VLANs or NPIV.
      
      Adds fc_exch_mgr_add API to add a EM to the lport and fc_exch_mgr_del
      API to delete previously added EM.
      
      Also adds function fc_exch_mgr_destroy() to destroy allocated EM.
      The kref is added to the EM to keep track of EM usage count, the EM is
      destroyed when no longer in use upon kref reaching to zero.
      
      The caller can specify match function to fc_exch_mgr_add, this
      will be used in determining exchange allocation from its EM or not.
      
      Moved calling of fcoe_em_config below fcoe_libfc_config calling,
      so that list head lp->ema_list is initialized before configuring
      EM.
      Signed-off-by: default avatarVasu Dev <vasu.dev@intel.com>
      Signed-off-by: default avatarRobert Love <robert.w.love@intel.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
      96316099
    • Joe Eykholt's avatar
      [SCSI] libfc: rename rport state "NONE" to "DELETE". · 14194054
      Joe Eykholt authored
      State RPORT_ST_NONE was intented to be an invalid state (0), never used.
      This was a misguided attempt to be sure it was always initialized.
      Having an extra state meaning nothing requires switch statements to
      have a case covering that state.
      
      State NONE has been used instead to mean the remote port is being deleted.
      Changing the name to RPORT_ST_DELETE.
      Signed-off-by: default avatarJoe Eykholt <jeykholt@cisco.com>
      Signed-off-by: default avatarRobert Love <robert.w.love@intel.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
      14194054
    • Joe Eykholt's avatar
      [SCSI] libfc: rename lport NONE state to DISABLED · b1d9fd55
      Joe Eykholt authored
      The state NONE was meant to be invalid, but has been used as
      the initial state.  Rename it to be DISABLED, as more descriptive.
      Further patches will make it the like the RESET state, except
      it won't transition to FLOGI until fc_lport_fabric_login() is called.
      Signed-off-by: default avatarJoe Eykholt <jeykholt@cisco.com>
      Signed-off-by: default avatarRobert Love <robert.w.love@intel.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
      b1d9fd55
    • Joe Eykholt's avatar
      [SCSI] libfc: change debug messages to give host number. · 7f74549f
      Joe Eykholt authored
      libfc debug messages currently show 'lport: <fc-id>:'
      wher <fc-id> is the hex assigned port-id.  When the lport
      is logged off, that will be zero, so its hard to distinguish
      which instance is involved.  The FC-ID can change
      if the port is re-patched or changes VSANs.
      
      Two lports may even have the same FC-ID if connected to isolated SANs.
      
      Change the debug messages to print the SCSI host number "hostN:",
      which will not change for the life of the lport.
      Still show the FC_ID on lport messages.
      
      Also, add a macro to FC_RPORT_ID_DBG for rport debugging where there's
      no rdata structure involved.  It takes the lport and port_id as parameters.
      Use this in fc_rport_recv_plogi_req() and fc_rport_recv_logo_req().
      Signed-off-by: default avatarJoe Eykholt <jeykholt@cisco.com>
      Signed-off-by: default avatarRobert Love <robert.w.love@intel.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
      7f74549f