1. 12 Feb, 2011 3 commits
    • Joe Eykholt's avatar
      [SCSI] libfc: add method for setting handler for incoming exchange · 1a5c2d7e
      Joe Eykholt authored
      Add a method for setting handler for incoming exchange.
      For multi-sequence exchanges, this allows the target driver
      to add a response handler for handling subsequent sequences,
      and exchange manager resets.
      
      The new function is called fc_seq_set_resp().
      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@suse.de>
      1a5c2d7e
    • Joe Eykholt's avatar
      [SCSI] libfc: add hook for FC-4 provider registration · 96ad8464
      Joe Eykholt authored
      Allow FC-4 provider modules to hook into libfc, mostly for targets.
      This should allow any FC-4 module to handle PRLI requests and maintain
      process-association states.
      
      Each provider registers its ops with libfc and then will be called for
      any incoming PRLI for that FC-4 type on any instance.   The provider
      can decide whether to handle that particular instance using any method
      it likes, such as ACLs or other configuration information.
      
      A count is kept of the number of successful PRLIs from the remote port.
      Providers are called back with an implicit PRLO when the remote port
      is about to be deleted or has been reset.
      
      fc_lport_recv_req() now sends incoming FC-4 requests to FC-4 providers,
      and there is a built-in provider always registered for handling
      incoming ELS requests.
      
      The call to provider recv() routines uses rcu_read_lock()
      so that providers aren't removed during the call.  That lock is very
      cheap and shouldn't affect any performance on ELS requests.
      Providers can rely on the RCU lock to protect a session lookup as well.
      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@suse.de>
      96ad8464
    • Hannes Reinecke's avatar
      [SCSI] Add detailed SCSI I/O errors · 63583cca
      Hannes Reinecke authored
      Instead of just passing 'EIO' for any I/O error we should be
      notifying the upper layers with more details about the cause
      of this error.
      
      Update the possible I/O errors to:
      
      - ENOLINK: Link failure between host and target
      - EIO: Retryable I/O error
      - EREMOTEIO: Non-retryable I/O error
      - EBADE: I/O error restricted to the I_T_L nexus
      
      'Retryable' in this context means that an I/O error _might_ be
      restricted to the I_T_L nexus (vulgo: path), so retrying on another
      nexus / path might succeed.
      
      'Non-retryable' in general refers to a target failure, so this
      error will always be generated regardless of the I_T_L nexus
      it was send on.
      
      I/O errors restricted to the I_T_L nexus might be retried
      on another nexus / path, but they should _not_ be queued
      if no paths are available.
      Signed-off-by: default avatarHannes Reinecke <hare@suse.de>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
      63583cca
  2. 24 Jan, 2011 1 commit
  3. 31 Dec, 2010 2 commits
  4. 21 Dec, 2010 6 commits
  5. 16 Dec, 2010 1 commit
    • Tejun Heo's avatar
      sr: implement sr_check_events() · 93aae17a
      Tejun Heo authored
      Replace sr_media_change() with sr_check_events().  It normally only
      uses GET_EVENT_STATUS_NOTIFICATION to check both media change and
      eject request.  If @clearing includes DISK_EVENT_MEDIA_CHANGE, it
      issues TUR and compares whether media presence has changed.  The SCSI
      specific media change uevent is kept for compatibility.
      
      sr_media_change() was doing both media change check and revalidation.
      The revalidation part is split into sr_block_revalidate_disk().
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: default avatarJens Axboe <jaxboe@fusionio.com>
      93aae17a
  6. 16 Nov, 2010 1 commit
    • Jeff Garzik's avatar
      SCSI host lock push-down · f281233d
      Jeff Garzik authored
      Move the mid-layer's ->queuecommand() invocation from being locked
      with the host lock to being unlocked to facilitate speeding up the
      critical path for drivers who don't need this lock taken anyway.
      
      The patch below presents a simple SCSI host lock push-down as an
      equivalent transformation.  No locking or other behavior should change
      with this patch.  All existing bugs and locking orders are preserved.
      
      Additionally, add one parameter to queuecommand,
      	struct Scsi_Host *
      and remove one parameter from queuecommand,
      	void (*done)(struct scsi_cmnd *)
      
      Scsi_Host* is a convenient pointer that most host drivers need anyway,
      and 'done' is redundant to struct scsi_cmnd->scsi_done.
      
      Minimal code disturbance was attempted with this change.  Most drivers
      needed only two one-line modifications for their host lock push-down.
      Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
      Acked-by: default avatarJames Bottomley <James.Bottomley@suse.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f281233d
  7. 01 Nov, 2010 1 commit
  8. 26 Oct, 2010 2 commits
    • Boaz Harrosh's avatar
      [SCSI] libosd: write/read_sg_kern API · 6dd1d8a7
      Boaz Harrosh authored
      This is a trivial addition to the SG API that can receive kernel
      pointers. It is only used by the out-of-tree test module. So
      it's immediate need is questionable. For maintenance ease it might
      just get in, as it's very small.
      
      John.
      do you need this in the Kernel, or is it only for osd_ktest.ko?
      Signed-off-by: default avatarJohn A. Chandy <john.chandy@uconn.edu>
      Signed-off-by: default avatarBoaz Harrosh <bharrosh@panasas.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
      6dd1d8a7
    • Boaz Harrosh's avatar
      [SCSI] libosd: Support for scatter gather write/read commands · e96e72c4
      Boaz Harrosh authored
      This patch adds the Scatter-Gather (sg) API to libosd.
      Scatter-gather enables a write/read of multiple none-contiguous
      areas of an object, in a single call. The extents may overlap
      and/or be in any order.
      
      The Scatter-Gather list is sent to the target in what is called
      a "cdb continuation segment". This is yet another possible segment
      in the osd-out-buffer. It is unlike all other segments in that it
      sits before the actual "data" segment (which until now was always
      first), and that it is signed by itself and not part of the data
      buffer. This is because the cdb-continuation-segment is considered
      a spill-over of the CDB data, and is therefor signed under
      OSD_SEC_CAPKEY and higher.
      
      TODO: A new osd_finalize_request_ex version should be supplied so
      the @caps received on the network also contains a size parameter
      and can be spilled over into the "cdb continuation segment".
      
      Thanks to John Chandy <john.chandy@uconn.edu> for the original
      code, and investigations. And the implementation of SG support
      in the osd-target.
      Original-coded-by: default avatarJohn Chandy <john.chandy@uconn.edu>
      Signed-off-by: default avatarBoaz Harrosh <bharrosh@panasas.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
      e96e72c4
  9. 25 Oct, 2010 1 commit
    • Bhanu Prakash Gollapudi's avatar
      [SCSI] libfc: Do not let disc work cancel itself · c531b9b4
      Bhanu Prakash Gollapudi authored
      When number of NPIV ports created are greater than the xids
      allocated per pool -- for eg., creating 255 NPIV ports on a
      system with nr_cpu_ids of 32, with each pool containing 128
      xids -- and then generating a link event - for eg.,
      shutdown/no shutdown -- on the switch port causes the hang
      with the following stack trace.
      
      Call Trace:
      schedule_timeout+0x19d/0x230
      wait_for_common+0xc0/0x170
      __cancel_work_timer+0xcf/0x1b0
      fc_disc_stop+0x16/0x30 [libfc]
      fc_lport_reset_locked+0x47/0x90 [libfc]
      fc_lport_enter_reset+0x67/0xe0 [libfc]
      fc_lport_disc_callback+0xbc/0xe0 [libfc]
      fc_disc_done+0xa8/0xf0 [libfc]
      fc_disc_timeout+0x29/0x40 [libfc]
      run_workqueue+0xb8/0x140
      worker_thread+0x96/0x110
      kthread+0x96/0xa0
      child_rip+0xa/0x20
      
      Fix is to not cancel the disc_work if discovery is already
      stopped, thus allowing lport state machine to restart and try
      discovery again.
      Signed-off-by: default avatarBhanu Prakash Gollapudi <bprakash@broadcom.com>
      Acked-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@suse.de>
      c531b9b4
  10. 22 Oct, 2010 4 commits
    • David Dillow's avatar
      IB/srp: Implement SRP_CRED_REQ and SRP_AER_REQ · bb12588a
      David Dillow authored
      This patch adds support for SRP_CRED_REQ to avoid a lockup by targets
      that use that mechanism to return credits to the initiator. This
      prevents a lockup observed in the field where we would never add the
      credits from the SRP_CRED_REQ to our current count, and would therefore
      never send another command to the target.
      
      Minimal support for SRP_AER_REQ is also added, as these messages can
      also be used to convey additional credits to the initiator.
      
      Based upon extensive debugging and code by Bart Van Assche and a bug
      report by Chris Worley.
      Signed-off-by: default avatarDavid Dillow <dillowda@ornl.gov>
      Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
      bb12588a
    • Michal Nazarewicz's avatar
      USB: gadget: storage: reuse definitions from scsi.h header file · 0a6a717c
      Michal Nazarewicz authored
      This commit changes storage_common.h, file_storage.c and
      f_mass_storage.c to use definitions of SCSI commands from
      scsi/scsi.h file instead of redefining the commands in
      storage_common.c.
      
      scsi/scsi.h header file was missing READ_FORMAT_CAPACITIES and
      READ_HEADER so this commit also add those to the header.
      Signed-off-by: default avatarMichal Nazarewicz <mina86@mina86.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: James Bottomley <James.Bottomley@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      0a6a717c
    • Hans de Goede's avatar
      scsi/sd: add a no_read_capacity_16 scsi_device flag · 5ce524bd
      Hans de Goede authored
      I seem to have a knack for digging up buggy usb devices which don't work
      with Linux, and I'm crazy enough to try to make them work.  So this time a
      friend of mine asked me to get an mp4 player (an mp3 player which can play
      videos on a small screen) to work with Linux.
      
      It is based on the well known rockbox chipset for which we already have an
      unusual devs entries to work around some of its bugs.  But this model
      comes with an additional twist.
      
      This model chokes on read_capacity_16 calls.  Now normally we don't make
      those calls, but this model comes with an sdcard slot and when there is no
      card in there (and shipped from the factory there is none), it reports a
      size of 0.  However this time the programmers actually got the
      read_capacity_10 response right!  So they substract one from the size as
      stored internally in the mp3 player before reporting it back, resulting in
      an answer of ...  0xffffffff sectors, causing sd.c to try a
      read_capacity_16, on which the device crashes.
      
      This patch adds a flag to scsi_device to indicate that a a device cannot
      handle read_capacity_16, and when this flag is set if a device reports an
      lba of 0xffffffff as answer to a read_capacity_10, assumes it tries to
      report a size of 0.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      5ce524bd
    • Hans de Goede's avatar
      scsi/sr: add no_read_disc_info scsi_device flag · 8e04d805
      Hans de Goede authored
      Some USB devices emulate a usb-mass-storage attached (scsi) cdrom device,
      usually this fake cdrom contains the windows software for the device.
      While working on supporting Appotech ax3003 based photoframes, which do
      this I discovered that they will go of into lala land when ever they see a
      READ_DISC_INFO scsi command.
      
      Thus this patch adds a scsi_device flag (which can then be set by the
      usb-storage driver through an unsual-devs entry), to indicate this, and
      makes the sr driver honor this flag.
      
      I know this sucks, but as discussed on linux-scsi list there is no other
      way to make this device work properly.
      
      Looking at usb traces made under windows, windows never sends a
      READ_DISC_INFO during normal interactions with a usb cdrom device.  So as
      this cdrom emulation thingie becomes more common we might see more of this
      problem.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      8e04d805
  11. 08 Oct, 2010 1 commit
  12. 07 Oct, 2010 1 commit
  13. 10 Sep, 2010 2 commits
    • Martin K. Petersen's avatar
      block/scsi: Provide a limit on the number of integrity segments · 13f05c8d
      Martin K. Petersen authored
      Some controllers have a hardware limit on the number of protection
      information scatter-gather list segments they can handle.
      
      Introduce a max_integrity_segments limit in the block layer and provide
      a new scsi_host_template setting that allows HBA drivers to provide a
      value suitable for the hardware.
      
      Add support for honoring the integrity segment limit when merging both
      bios and requests.
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarJens Axboe <axboe@carl.home.kernel.dk>
      13f05c8d
    • Tejun Heo's avatar
      block: remove spurious uses of REQ_HARDBARRIER · 9cbbdca4
      Tejun Heo authored
      REQ_HARDBARRIER is deprecated.  Remove spurious uses in the following
      users.  Please note that other than osdblk, all other uses were
      already spurious before deprecation.
      
      * osdblk: osdblk_rq_fn() won't receive any request with
        REQ_HARDBARRIER set.  Remove the test for it.
      
      * pktcdvd: use of REQ_HARDBARRIER in pkt_generic_packet() doesn't mean
        anything.  Removed.
      
      * aic7xxx_old: Setting MSG_ORDERED_Q_TAG on REQ_HARDBARRIER is
        spurious.  Removed.
      
      * sas_scsi_host: Setting TASK_ATTR_ORDERED on REQ_HARDBARRIER is
        spurious.  Removed.
      
      * scsi_tcq: The ordered tag path wasn't being used anyway.  Removed.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarBoaz Harrosh <bharrosh@panasas.com>
      Cc: James Bottomley <James.Bottomley@suse.de>
      Cc: Peter Osterlund <petero2@telia.com>
      Signed-off-by: default avatarJens Axboe <jaxboe@fusionio.com>
      9cbbdca4
  14. 05 Sep, 2010 1 commit
  15. 11 Aug, 2010 1 commit
  16. 28 Jul, 2010 12 commits
    • Alan Stern's avatar
      [SCSI] implement runtime Power Management · bc4f2401
      Alan Stern authored
      This patch (as1398b) adds runtime PM support to the SCSI layer.  Only
      the machanism is provided; use of it is up to the various high-level
      drivers, and the patch doesn't change any of them.  Except for sg --
      the patch expicitly prevents a device from being runtime-suspended
      while its sg device file is open.
      
      The implementation is simplistic.  In general, hosts and targets are
      automatically suspended when all their children are asleep, but for
      them the runtime-suspend code doesn't actually do anything.  (A host's
      runtime PM status is propagated up the device tree, though, so a
      runtime-PM-aware lower-level driver could power down the host adapter
      hardware at the appropriate times.)  There are comments indicating
      where a transport class might be notified or some other hooks added.
      
      LUNs are runtime-suspended by calling the drivers' existing suspend
      handlers (and likewise for runtime-resume).  Somewhat arbitrarily, the
      implementation delays for 100 ms before suspending an eligible LUN.
      This is because there typically are occasions during bootup when the
      same device file is opened and closed several times in quick
      succession.
      
      The way this all works is that the SCSI core increments a device's
      PM-usage count when it is registered.  If a high-level driver does
      nothing then the device will not be eligible for runtime-suspend
      because of the elevated usage count.  If a high-level driver wants to
      use runtime PM then it can call scsi_autopm_put_device() in its probe
      routine to decrement the usage count and scsi_autopm_get_device() in
      its remove routine to restore the original count.
      
      Hosts, targets, and LUNs are not suspended while they are being probed
      or removed, or while the error handler is running.  In fact, a fairly
      large part of the patch consists of code to make sure that things
      aren't suspended at such times.
      
      [jejb: fix up compile issues in PM config variations]
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
      bc4f2401
    • James Bottomley's avatar
      [SCSI] Unify SAM_ and SAM_STAT_ macros · df64d3ca
      James Bottomley authored
      We have two separate definitions for identical constants with nearly the
      same name.  One comes from the generic headers in scsi.h; the other is
      an enum in libsas.h ... it's causing confusion about which one is
      correct (fortunately they both are).
      
      Fix this by eliminating the libsas.h duplicate
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
      df64d3ca
    • Mike Christie's avatar
      [SCSI] iscsi_transport: wait on session in error handler path · c01be6dc
      Mike Christie authored
      wait for session to come online in eh_device_reset_handler
      and eh_target_reset_handler
      Signed-off-by: default avatarMike Christie <michaelc@cs.wisc.edu>
      Signed-off-by: default avatarVikas Chaudhary <vikas.chaudhary@qlogic.com>
      Signed-off-by: default avatarRavi Anand <ravi.anand@qlogic.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
      c01be6dc
    • Joe Eykholt's avatar
      [SCSI] libfc: don't require a local exchange for incoming requests · 92261156
      Joe Eykholt authored
      Incoming requests shouldn't require a local exchange if we're
      just going to reply with one or two frames and don't expect
      anything further.  Don't allocate exchanges for such requests
      until requested by the upper-layer protocol.
      
      The sequence is always NULL for new requests, so remove
      that as an argument to request handlers.
      
      Also change the first argument to lport->tt.seq_els_rsp_send
      from the sequence pointer to the received frame pointer, to
      supply the exchange IDs and destination ID info.
      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@suse.de>
      92261156
    • Joe Eykholt's avatar
      [SCSI] libfc: add interface to allocate a sequence for incoming requests · 239e8104
      Joe Eykholt authored
      For incoming ELS and FCP requests, we often don't require an
      exchange and sequence, however, sometimes we do.  For those cases,
      (primarily FCP requests for targets) add a function to set up
      the exchange and sequence.
      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@suse.de>
      239e8104
    • Joe Eykholt's avatar
      [SCSI] libfc: add fc_fill_reply_hdr() and fc_fill_hdr() · 24f089e2
      Joe Eykholt authored
      Add functions to fill in an FC header given a request header.
      These reduces code lines in fc_lport and fc_rport and works
      without an exchange/sequence assigned.
      
      fc_fill_reply_hdr() fills a header for a final reply frame.
      
      fc_fill_hdr() which is similar but allows specifying the
      f_ctl parameter.
      
      Add defines for F_CTL values FC_FCTL_REQ and FC_FCTL_RESP.
      These can be used for most request and response sequences.
      
      v2 of patch adds a line to copy the frame encapsulation
      info from the received frame.
      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@suse.de>
      24f089e2
    • Joe Eykholt's avatar
      [SCSI] libfc: add fc_frame_sid() and fc_frame_did() functions · 251748a9
      Joe Eykholt authored
      To pave the way for eliminating exchanges from incoming requests,
      add simple inline fc_frame_sid() and fc_frame_did() functions
      which get the FC_IDs from the frame header.  This can be almost
      as efficient as getting them from the sequence/exchange.
      
      Move ntohll, htonll, ntoh24 and hton24 to <scsi/fc_frame.h>
      since we need them there and that's included by <scsi/libfc.h>
      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@suse.de>
      251748a9
    • Joe Eykholt's avatar
      [SCSI] libfc: eliminate rport LOGO state · 079ecd8c
      Joe Eykholt authored
      The LOGO state hasn't been used in a while, except in a brief
      transition to DELETE state while holding the rport mutex.
      All port LOGO responses have been ignored as well as any timeout
      if we don't get a response.
      
      So this patch just removes LOGO state and simplifies the response handler.
      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@suse.de>
      079ecd8c
    • Joe Eykholt's avatar
      [SCSI] libfcoe: fcoe: fnic: add FIP VN2VN point-to-multipoint support · e10f8c66
      Joe Eykholt authored
      The FC-BB-6 committee is proposing a new FIP usage model called
      VN_port to VN_port mode.  It allows VN_ports to discover each other
      over a loss-free L2 Ethernet without any FCF or Fibre-channel fabric
      services.  This is point-to-multipoint.  There is also a variant
      of this called point-to-point which provides for making sure there
      is just one pair of ports operating over the Ethernet fabric.
      
      We add these new states:  VNMP_START, _PROBE1, _PROBE2, _CLAIM, and _UP.
      These usually go quickly in that sequence.  After waiting a random
      amount of time up to 100 ms in START, we select a pseudo-random
      proposed locally-unique port ID and send out probes in states PROBE1
      and PROBE2, 100 ms apart.  If no probe responses are heard, we
      proceed to CLAIM state 400 ms later and send a claim notification.
      We wait another 400 ms to receive claim responses, which give us
      a list of the other nodes on the network, including their FC-4
      capabilities.  After another 400 ms we go to VNMP_UP state and
      should start interoperating with any of the nodes for whic we
      receivec claim responses.  More details are in the spec.j
      
      Add the new mode as FIP_MODE_VN2VN.  The driver must specify
      explicitly that it wants to operate in this mode.  There is
      no automatic detection between point-to-multipoint and fabric
      mode, and the local port initialization is affected, so it isn't
      anticipated that there will ever be any such automatic switchover.
      
      It may eventually be possible to have both fabric and VN2VN
      modes on the same L2 network, which may be done by two separate
      local VN_ports (lports).
      
      When in VN2VN mode, FIP replaces libfc's fabric-oriented discovery
      module with its own simple code that adds remote ports as they
      are discovered from incoming claim notifications and responses.
      These hooks are placed by fcoe_disc_init().
      
      A linear list of discovered vn_ports is maintained under the
      fcoe_ctlr struct.  It is expected to be short for now, and
      accessed infrequently.  It is kept under RCU for lock-ordering
      reasons.  The lport and/or rport mutexes may be held when we
      need to lookup a fcoe_vnport during an ELS send.
      
      Change fcoe_ctlr_encaps() to lookup the destination vn_port in
      the list of peers for the destination MAC address of the
      FIP-encapsulated frame.
      
      Add a new function fcoe_disc_init() to initialize just the
      discovery portion of libfcoe for VN2VN mode.
      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@suse.de>
      e10f8c66
    • Joe Eykholt's avatar
      [SCSI] libfcoe: add protocol description of FIP VN2VN mode · edcbb439
      Joe Eykholt authored
      The FC-BB-6 committee is proposing a new FIP usage model called
      VN_port to VN_port mode.  It allows VN_ports to discover each other
      over a loss-free L2 Ethernet without any FCF or Fibre-channel fabric
      services.  This is point-to-multipoint.  There is also a variant
      of this called point-to-point which provides for making sure there
      is just one pair of ports operating over the Ethernet fabric.
      
      This patch defines the new message type and subtypes as well as
      one new descriptor type used by VN2VN mode.
      
      These are all still at the proposed stage and subject to change.
      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@suse.de>
      edcbb439
    • Joe Eykholt's avatar
      [SCSI] libfc: track FIP exchanges · f60e12e9
      Joe Eykholt authored
      When an exchange is received with a FIP encapsulation, we need
      to know that the response must be sent via FIP and what the original
      ELS opcode was.  This becomes important for VN2VN mode, where we may
      receive FLOGI or LOGO from several peer VN_ports, and the LS_ACC or
      LS_RJT must be sent FIP-encapsulated with the correct sub-type.
      
      Add a field to the struct fc_frame, fr_encaps, to indicate the
      encapsulation values.  That term is chosen to be neutral and
      LLD-agnostic in case non-FCoE/FIP LLDs might find it useful.
      
      The frame fr_encaps is transferred from the ingress frame to the
      exchange by fc_exch_recv_req(), and back to the outgoing frame
      by fc_seq_send().
      
      This is taking the last byte in the skb->cb array.  If needed,
      we could combine the info in sof, eof, flags, and encaps
      together into one field, but it'd be better to do that if
      and when its needed.
      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@suse.de>
      f60e12e9
    • Joe Eykholt's avatar
      [SCSI] libfc: add FLOGI state to rport for VN2VN · a7b12a27
      Joe Eykholt authored
      The FIP proposal for VN_port to VN_port point-to-multipoint
      operation requires a FLOGI be sent to each remote port.
      The FLOGI is sent with the assigned S_ID and D_IDs of the
      local and remote ports.  This and the response get
      FIP-encapsulated for Ethernet.
      
      Add FLOGI state to the remote port state machine.
      This will be skipped if not in point-to-multipoint mode.
      
      To reduce a little duplication between PLOGI and FLOGI
      response handling, added fc_rport_login_complete(), which
      handles the parameters for the rdata struct.
      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@suse.de>
      a7b12a27