1. 11 9月, 2010 1 次提交
  2. 11 8月, 2010 1 次提交
  3. 28 7月, 2010 25 次提交
    • A
      [SCSI] implement runtime Power Management · bc4f2401
      Alan Stern 提交于
      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: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      bc4f2401
    • J
      [SCSI] Unify SAM_ and SAM_STAT_ macros · df64d3ca
      James Bottomley 提交于
      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: NJames Bottomley <James.Bottomley@suse.de>
      df64d3ca
    • M
      [SCSI] iscsi_transport: wait on session in error handler path · c01be6dc
      Mike Christie 提交于
      wait for session to come online in eh_device_reset_handler
      and eh_target_reset_handler
      Signed-off-by: NMike Christie <michaelc@cs.wisc.edu>
      Signed-off-by: NVikas Chaudhary <vikas.chaudhary@qlogic.com>
      Signed-off-by: NRavi Anand <ravi.anand@qlogic.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      c01be6dc
    • J
      [SCSI] libfc: don't require a local exchange for incoming requests · 92261156
      Joe Eykholt 提交于
      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: NJoe Eykholt <jeykholt@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      92261156
    • J
      [SCSI] libfc: add interface to allocate a sequence for incoming requests · 239e8104
      Joe Eykholt 提交于
      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: NJoe Eykholt <jeykholt@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      239e8104
    • J
      [SCSI] libfc: add fc_fill_reply_hdr() and fc_fill_hdr() · 24f089e2
      Joe Eykholt 提交于
      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: NJoe Eykholt <jeykholt@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      24f089e2
    • J
      [SCSI] libfc: add fc_frame_sid() and fc_frame_did() functions · 251748a9
      Joe Eykholt 提交于
      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: NJoe Eykholt <jeykholt@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      251748a9
    • J
      [SCSI] libfc: eliminate rport LOGO state · 079ecd8c
      Joe Eykholt 提交于
      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: NJoe Eykholt <jeykholt@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      079ecd8c
    • J
      [SCSI] libfcoe: fcoe: fnic: add FIP VN2VN point-to-multipoint support · e10f8c66
      Joe Eykholt 提交于
      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: NJoe Eykholt <jeykholt@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      e10f8c66
    • J
      [SCSI] libfcoe: add protocol description of FIP VN2VN mode · edcbb439
      Joe Eykholt 提交于
      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: NJoe Eykholt <jeykholt@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      edcbb439
    • J
      [SCSI] libfc: track FIP exchanges · f60e12e9
      Joe Eykholt 提交于
      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: NJoe Eykholt <jeykholt@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      f60e12e9
    • J
      [SCSI] libfc: add FLOGI state to rport for VN2VN · a7b12a27
      Joe Eykholt 提交于
      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: NJoe Eykholt <jeykholt@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      a7b12a27
    • J
      [SCSI] libfc: Add local port point-to-multipoint flag · 3726f358
      Joe Eykholt 提交于
      For VN_port to VN_port mode, the transport sets the port_id and
      there's no lport FLOGI.  This is similar to FC loop mode.
      
      Add a point_to_multipoint flag that indicates the local port is in
      point-to-multipoint mode.  This skips FLOGI and discovery.
      It also skips resetting the port_id on resets other than link down.
      
      Add function fc_lport_set_local_id() that sets the local port_id.
      This is called by libfcoe on behalf of the low-level driver
      to set the port_id when the link comes up.
      Signed-off-by: NJoe Eykholt <jeykholt@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      3726f358
    • J
      [SCSI] libfcoe: fcoe: fnic: change fcoe_ctlr_init interface to specify mode · 3d902ac0
      Joe Eykholt 提交于
      There are three modes that libfcoe currently supports, and a new one
      is coming.  Change the fcoe_ctlr_init() interface to add the mode
      desired.  This should not change any functionality.
      Signed-off-by: NJoe Eykholt <jeykholt@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      3d902ac0
    • J
      [SCSI] libfc: add discovery-private pointer for LLD · 0685230c
      Joe Eykholt 提交于
      For VN_port to VN_port mode, FIP will do discovery and needs a
      way to find its state from the local port or discovery structure.
      It seems that any other LLD that implements its own discovery
      would also need something like this.
      
      Replace disc->lport with disc->priv, and use container_of to
      find the lport.  We could use disc->priv for that, but
      container_of is smaller and faster.
      Signed-off-by: NJoe Eykholt <jeykholt@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      0685230c
    • J
      [SCSI] libfcoe: convert FIP to lock with mutex instead of spin lock · fdb068c6
      Joe Eykholt 提交于
      It turns out most of the FIP work is now done from worker threads
      or process context now, so there's no need to use a spin lock.
      
      Change to use mutex instead of spin lock and delayed_work instead
      of a timer.
      
      This will make it nicer for the VN_port to VN_port feature that
      will interact more with the libfc layers requiring that
      spinlocks not be held.
      Signed-off-by: NJoe Eykholt <jeykholt@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      fdb068c6
    • J
      [SCSI] libfc: provide space for LLD after remote port structure · f90377ab
      Joe Eykholt 提交于
      Add pre-zeroed space after the allocation for fc_rport_priv
      for use by the lower-level driver.
      
      This is primarily for VN2VN FIP mode, but could be used in
      other ways someday.
      
      The space required is specified in lport->rport_priv_size.
      Signed-off-by: NJoe Eykholt <jeykholt@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      f90377ab
    • J
      [SCSI] libfc: convert rport lookup to be RCU safe · 42e90414
      Joe Eykholt 提交于
      To allow LLD to do lookups on rports without grabbing a mutex,
      make them RCU-safe.  The caller of lport->tt.rport_lookup will
      have the choice of holding disc_mutex or the rcu_read_lock().
      Signed-off-by: NJoe Eykholt <jeykholt@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      42e90414
    • V
      [SCSI] fcoe: adds src and dest mac address checking for fcoe frames · 519e5135
      Vasu Dev 提交于
      This is  per FC-BB-5 Annex-D recommendation and per that
      if address checking fails then drop the frame.
      
      FIP code paths are already doing this so only needed for fcoe
      frames.
      
      The src address checking is limited to only fip mode since
      this might break non-fip mode used in p2p due to used OUI
      based addressing in some p2p code paths, going forward FIP
      will be the only mode, therefore limited this to only FIP
      mode so that it won't break non-fip p2p mode for now.
      
      -v2
      Removes FCOE packet type checking since fcoe_rcv is
      registered to receive only FCoE type packets from netdev
      and it is already checked by netdev.
      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@suse.de>
      519e5135
    • B
      [SCSI] fcoe: make it possible to verify fcoe with sparse · d058fd31
      Bart Van Assche 提交于
      Analyzing fcoe with sparse currently fails. This is because struct
      fcoe_rcv_info contains two enum members that have been declared with
      __attribute__((packed)). Apparently gcc honors this attribute while sparse
      ignores it. The result is that sizeof(struct fcoe_rcv_info)
      == sizeof(struct sk_buff::cb) == 48 on a 64-bit system according to gcc, but
      not according to sparse. The patch below modifies the definition of
      struct fcoe_rcv_info such that gcc and sparse interpret this structure
      definition in the same way. The current sparse output is as follows:
      
      $ cd linux-2.6.34
      $ make C=2 M=drivers/scsi/fcoe modules
       CHECK   drivers/scsi/fcoe/fcoe.c
      
      include/scsi/fc_frame.h:81:9: error: invalid bitfield width, -1.
       CC [M]  drivers/scsi/fcoe/fcoe.o
       CHECK   drivers/scsi/fcoe/libfcoe.c
      
      include/scsi/fc_frame.h:81:9: error: invalid bitfield width, -1.
      drivers/scsi/fcoe/libfcoe.c:56:37: error: invalid initializer
      Signed-off-by: NBart Van Assche <bart.vanassche@gmail.com>
      Cc: jeykholt@cisco.com
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      d058fd31
    • V
    • J
      [SCSI] libfc: fix indefinite rport restart · f034260d
      Joe Eykholt 提交于
      Remote ports were restarting indefinitely after getting
      rejects in PRLI.
      
      Fix by adding a counter of restarts and limiting that with
      the port login retry limit as well.
      Signed-off-by: NJoe Eykholt <jeykholt@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      f034260d
    • J
      [SCSI] libfc: Fix remote port restart problem · 4b2164d4
      Joe Eykholt 提交于
      This patch somewhat combines two fixes to remote port handing in libfc.
      
      The first problem was that rport work could be queued on a deleted
      and freed rport.  This is handled by not resetting rdata->event
      ton NONE if the rdata is about to be deleted.
      
      However, that fix led to the second problem, described by
      Bhanu Gollapudi, as follows:
      > Here is the sequence of events. T1 is first LOGO receive thread, T2 is
      > fc_rport_work() scheduled by T1 and T3 is second LOGO receive thread and
      > T4 is fc_rport_work scheduled by T3.
      >
      > 1. (T1)Received 1st LOGO in state Ready
      > 2. (T1)Delete port & enter to RESTART state.
      > 3. (T1)schdule event_work, since event is RPORT_EV_NONE.
      > 4. (T1)set event = RPORT_EV_LOGO
      > 5. (T1)Enter RESTART state as disc_id is set.
      > 6. (T2)remember to PLOGI, and set event = RPORT_EV_NONE
      > 6. (T3)Received 2nd LOGO
      > 7. (T3)Delete Port & enter to RESTART state.
      > 8. (T3)schedule event_work, since event is RPORT_EV_NONE.
      > 9. (T3)Enter RESTART state as disc_id is set.
      > 9. (T3)set event = RPORT_EV_LOGO
      > 10.(T2)work restart, enter PLOGI state and issues PLOGI
      > 11.(T4)Since state is not RESTART anymore, restart is not set, and the
      > event is not reset to RPORT_EV_NONE. (current event is RPORT_EV_LOGO).
      > 12. Now, PLOGI succeeds and fc_rport_enter_ready() will not schedule
      > event_work, and hence the rport will never be created, eventually losing
      > the target after dev_loss_tmo.
      
      So, the problem here is that we were tracking the desire for
      the rport be restarted by state RESTART, which was otherwise
      equivalent to DELETE.  A contributing factor is that we dropped
      the lock between steps 6 and 10 in thread T2, which allows the
      state to change, and we didn't completely re-evaluate then.
      
      This is hopefully corrected by the following minor redesign:
      
      Simplify the rport restart logic by making the decision to
      restart after deleting the transport rport.  That decision
      is based on a new STARTED flag that indicates fc_rport_login()
      has been called and fc_rport_logoff() has not been called
      since then.  This replaces the need for the RESTART state.
      
      Only restart if the rdata is still in DELETED state
      and only if it still has the STARTED flag set.
      
      Also now, since we clear the event code much later in the
      work thread, allow for the possibility that the rport may
      have become READY again via incoming PLOGI, and if so,
      queue another event to handle that.
      
      In the problem scenario, the second LOGO received will
      cause the LOGO event to occur again.
      Reported-by: NBhanu Gollapudi <bprakash@broadcom.com>
      Signed-off-by: NJoe Eykholt <jeykholt@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      4b2164d4
    • B
      [SCSI] libfc: Handle unsolicited PRLO request · f8fc6c2c
      Bhanu Prakash Gollapudi 提交于
      Resubmitting after incorporating Joe's review comment.
      
      Unsolicited PRLO request is now handled by sending LS_ACC,
      and then relogin to the remote port if an N-port login
      session exists for that remote port.
      
      Note that this patch should be applied on top of Joe Eykholt's
      "Fix remote port restart problem" patch.
      Signed-off-by: NBhanu Prakash Gollapudi <bprakash@broadcom.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      f8fc6c2c
    • J
      [SCSI] fcoe: clean up TBD comments in FCoE prototype header · 5d4a2e29
      Joe Eykholt 提交于
      Some old comments in fc_fcoe.h say TBD long after the
      standard has been passed by T11.  Clean them up.
      Signed-off-by: NJoe Eykholt <jeykholt@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      5d4a2e29
  4. 03 6月, 2010 1 次提交
  5. 17 5月, 2010 2 次提交
  6. 02 5月, 2010 1 次提交
  7. 01 5月, 2010 1 次提交
  8. 12 4月, 2010 2 次提交
  9. 11 4月, 2010 4 次提交
    • C
      [SCSI] Allow FC LLD to fast-fail scsi eh by introducing new eh return · 2f2eb587
      Christof Schmitt 提交于
      If the scsi eh is running and then a FC LLD calls
      fc_remote_port_delete, the SCSI commands sent from the eh will fail.
      To prevent this, a FC LLD can call fc_block_scsi_eh from the eh
      callback, blocking the eh thread until the dev_loss_tmo fires or the
      remote port is available again.
      
      If (e.g. for a multipathing setup) the dev_loss_tmo is set to a very
      large value, thus preventing the scsi device removal , the scsi eh can
      block for a long time. For multipathing, the fast_io_fail_tmo is then
      set to a low value to detect path problems sooner.
      
      This patch introduces a new return code FAST_IO_FAIL. The function
      fc_block_scsi_eh now returns FAST_IO_FAIL when the fast_io_fail_tmo
      fires. This indicates that the LLD terminated all pending I/O requests
      and there are no more pending SCSI commands for the scsi eh to wait
      for. This return code can be passed back to the scsi eh to stop the
      escalation and finish the recovery process for this device.
      Signed-off-by: NChristof Schmitt <christof.schmitt@de.ibm.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      2f2eb587
    • J
      [SCSI] libfc, libfcoe, fcoe: use smp_processor_id() only when preempt disabled · f018b73a
      Joe Eykholt 提交于
      When the kernel is configured for preemption, using smp_processor_id()
      when preemption is enabled causes a warning backtrace and is wrong
      since we could move off of that CPU as soon as we get the ID,
      and we would be referencing the wrong CPU, and possibly an invalid one
      if it could be hotswapped out.
      
      Remove the fc_lport_get_stats() function and explicitly use per_cpu_ptr()
      to get the statistics.  Where preemption has been disabled by holding
      a _bh lock continue to use smp_processor_id(), but otherwise use
      get_cpu()/put_cpu().
      
      In fcoe_recv_frame() also changed the cases where we return in the
      middle to do a goto to the code which bumps ErrorFrames and does
      a put_cpu().  Two of these cases didn't bump ErrorFrames before, but
      doing so is harmless because they "can't happen", due to prior length
      checks.
      
      Also rearranged code in fcoe_recv_frame() to have only one call to
      fc_exch_recv().  It's just as efficient and saves a call to put_cpu().
      
      In fc_fcp.c, adjusted a FIXME comment for code which doesn't need fixing.
      Signed-off-by: NJoe Eykholt <jeykholt@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      f018b73a
    • J
      [SCSI] libfcoe: eliminate unused link and last_link fields · 42913657
      Joe Eykholt 提交于
      The link and last_link fields in the fcoe_ctlr struct are no
      longer useful, since they are always set to the same value,
      and FIP always calls libfc to pass link information to the lport.
      
      Eliminate those fields and rename link_work to timer_work, since
      it no longer has any link change work to do.
      
      Thanks to Brian Uchino for discovering this issue.
      Signed-off-by: NJoe Eykholt <jeykholt@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      42913657
    • J
      [SCSI] libfc: add definition for task attribute mask · 4dc7ccf7
      Joe Eykholt 提交于
      The FCP command header definition should define a mask for
      the task attribute field.  This adds that #define.
      Signed-off-by: NJoe Eykholt <jeykholt@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      4dc7ccf7
  10. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  11. 13 3月, 2010 1 次提交