10 Dec, 2009

2 commits

  • So libosd has decided to sacrifice some code simplicity for the sake of
    a clean API. One of these things is the possibility for users to call
    osd_end_request, in any condition at any state. This opens up some
    problems with calling blk_put_request when out-side of the completion
    callback but calling __blk_put_request when detecting a from-completion
    state.

    The current hack was working just fine until exofs decided to operate on
    all devices in parallel and wait for the sum of the requests, before
    deallocating all osd-requests at once. There are two new possible cases
    1. All request in a group are deallocated as part of the last request's
    async-done, request_queue is locked.
    2. All request in a group where executed asynchronously, but
    de-allocation was delayed to after the async-done, in the context of
    another thread. Async execution but request_queue is not locked.

    The solution I chose was to separate the deallocation of the osd_request
    which has the information users need, from the deallocation of the
    internal(2) requests which impose the locking problem. The internal
    block-requests are freed unconditionally inside the async-done-callback,
    when we know the queue is always locked. If at osd_end_request time we
    still have a bock-request, then we know it did not come from within an
    async-done-callback and we can call the regular blk_put_request.

    The internal requests were used for carrying error information after
    execution. This information is now copied to osd_request members for
    later analysis by user code.

    The external API and behaviour was unchanged, except now it really
    supports what was previously advertised.

    Reported-by: Vineet Agarwal
    Signed-off-by: Boaz Harrosh
    Cc: Stable Tree
    Signed-off-by: James Bottomley

    Boaz Harrosh
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (222 commits)
    [SCSI] zfcp: Remove flag ZFCP_STATUS_FSFREQ_TMFUNCNOTSUPP
    [SCSI] zfcp: Activate fc4s attributes for zfcp in FC transport class
    [SCSI] zfcp: Block scsi_eh thread for rport state BLOCKED
    [SCSI] zfcp: Update FSF error reporting
    [SCSI] zfcp: Improve ELS ADISC handling
    [SCSI] zfcp: Simplify handling of ct and els requests
    [SCSI] zfcp: Remove ZFCP_DID_MASK
    [SCSI] zfcp: Move WKA port to zfcp FC code
    [SCSI] zfcp: Use common code definitions for FC CT structs
    [SCSI] zfcp: Use common code definitions for FC ELS structs
    [SCSI] zfcp: Update FCP protocol related code
    [SCSI] zfcp: Dont fail SCSI commands when transitioning to blocked fc_rport
    [SCSI] zfcp: Assign scheduled work to driver queue
    [SCSI] zfcp: Remove STATUS_COMMON_REMOVE flag as it is not required anymore
    [SCSI] zfcp: Implement module unloading
    [SCSI] zfcp: Merge trace code for fsf requests in one function
    [SCSI] zfcp: Access ports and units with container_of in sysfs code
    [SCSI] zfcp: Remove suspend callback
    [SCSI] zfcp: Remove global config_mutex
    [SCSI] zfcp: Replace local reference counting with common kref
    ...

    Linus Torvalds
     

05 Dec, 2009

38 commits

  • While the target reset task management function has been deprecated in
    newer specs, it is still in use by SCSI FC drivers and there is no
    real replacement. Add the target reset flag to the FCP header file to
    allow usage of this definition in SCSI FC drivers.

    Reviewed-by: Swen Schillig
    Signed-off-by: Christof Schmitt
    Signed-off-by: James Bottomley

    Christof Schmitt
     
  • Add a member function pointer as get_lesb to libfc_function_template so LLD
    can fill the LESB based on its own statistics. For fcoe, it fills the LESB
    as a fcoe_fc_els_lesb struct according to FC-BB-5.

    Signed-off-by: Yi Zou
    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Yi Zou
     
  • Add struct fcoe_fc_els_lesb as described in FC-BB-5 LESB for FCoE. It has
    the same size as LESB defined in FC-FS-3 (struct fc_els_lesb) but members
    have different meanings according to FC-BB-5.

    Signed-off-by: Yi Zou
    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Yi Zou
     
  • When the D bit is set if the FKA_ADV_Period of the FIP Discovery
    Advertisement, the ENode should not transmit period ENode FIP Keep Alive and
    VN_Port FIP Keep Alive (FC-BB-5 Rev2, 7.8.3.13).

    Note that fcf->flags is taken directly from the fip_header, I am claiming one
    bit for the purpose of the FIP_FKA_Period D bit as FIP_FL_FK_ADV_B, and use
    FIP_HEADER_FLAGS as bitmask for bits used in fip_header.

    Signed-off-by: Yi Zou
    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Yi Zou
     
  • FC-BB-5 Rev2.0, Clause 7.10 extends the FC-LS-3 LESB for FC-BB_E. We are
    already tracking Link Failure Count so add the rest in this patch.

    For VLinkFailureCount and MissDiscAdvCount, they are part of the per-cpu
    fcoe_dev_stats. For SymbolErrorCount, ErroredBlockCount, and FCSErrorCount,
    they are defined in IEEE 802.3-2008 and are per LLD. They are expected to
    come from LLD.

    Signed-off-by: Yi Zou
    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Yi Zou
     
  • include/scsi/osd_protocol.h uses ALIGN() without an #include
    , leading to:
    | include/scsi/osd_protocol.h:362: error: implicit declaration of function 'ALIGN'

    Signed-off-by: Martin Michlmayr
    Signed-off-by: Boaz Harrosh
    Cc: Stable Tree
    Signed-off-by: James Bottomley

    Martin Michlmayr
     
  • Administer some love to the osd_req_decode_sense function

    * Fix a bad bug with osd_req_decode_sense(). If there was no scsi
    residual, .i.e the request never reached the target, then all the
    osd_sense_info members where garbage.

    * Add grossly missing in/out_resid to osd_sense_info and fill them in
    properly.

    * Define an osd_err_priority enum which divides the possible errors into
    7 categories in ascending severity. Each category is also assigned a
    Linux return code translation.

    Analyze the different osd/scsi/block returned errors and set the
    proper osd_err_priority and Linux return code accordingly.

    * extra check a few situations so not to get stuck with inconsistent
    error view. Example an empty residual with an error code, and other
    places ...

    Lots of libosd's osd_req_decode_sense clients had this logic in some
    form or another. Consolidate all these into one place that should
    actually know about osd returns. Thous translating it to a more
    abstract error.

    Signed-off-by: Boaz Harrosh
    Signed-off-by: James Bottomley

    Boaz Harrosh
     
  • Define an osd_dev_info structure that Uniquely identifies an OSD
    device lun on the network. The identification is built from unique
    target attributes and is the same for all network/SAN machines.

    osduld_info_lookup() - NEW
    New API that will lookup an osd_dev by its osd_dev_info.
    This is used by pNFS-objects for cross network global device
    identification. And by exofs multy-device support, the device
    info is specified in the on-disk exofs device table.

    osduld_device_info() - NEW
    Given an osd_dev handle returns its associated osd_dev_info.
    The ULD fetches this information at startup and hangs it on
    each OSD device. (This is a fast operation that can be called
    at any condition)

    osduld_device_same() - NEW
    With a given osd_dev at one hand and an osd_dev_info
    at another, we would like to know if they are the same
    device.
    Two osd_dev handles can be checked by:
    osduld_device_same(od1, osduld_device_info(od2));

    osd_auto_detect_ver() - REVISED
    Now returns an osd_dev_info structure. Is only called once
    by ULD as before. See added comments for how to use.

    Signed-off-by: Boaz Harrosh
    Signed-off-by: James Bottomley

    Boaz Harrosh
     
  • The true logic of this patch will be clear in the next patch where we
    use the class_find_device() API. When doing so the use of an internal
    kref leaves us a narrow window where a find is started while the actual
    object can go away. Using the device's kobj reference solves this
    problem because now the same kref is used for both operations. (Remove
    and find)

    Core changes
    * Embed a struct device in uld_ structure and use device_register
    instead of devie_create. Set __remove to be the device release
    function.
    * __uld_get/put is just get_/put_device. Now every thing is accounted
    for on the device object. Internal kref is removed.
    * At __remove() we can safely de-allocate the uld_ structure. (The
    function has moved to avoid forward declaration)

    Some cleanups
    * Use class register/unregister is cleaner for this driver now.
    * cdev ref-counting games are no longer necessary

    I have incremented the device version string in case of new bugs.

    Note: Previous bugfix of taking the reference around fput() still
    applies.

    Signed-off-by: Boaz Harrosh
    Signed-off-by: James Bottomley

    Boaz Harrosh
     
  • Add one more important cdb_field_offset that can be returned with
    scsi_invalid_field_in_cdb. It is the offset of the permissions_bit_mask
    field in the capabilities structure.

    Interestingly, the offset is the same for V1/V2

    Signed-off-by: Boaz Harrosh
    Signed-off-by: James Bottomley

    Boaz Harrosh
     
  • define a new osd_dev_is_ver1 that operates on devices
    and the old osd_req_is_ver1 uses that new API.

    Signed-off-by: Boaz Harrosh
    Signed-off-by: James Bottomley

    Boaz Harrosh
     
  • This implements warm target reset tmf support for
    the scsi-ml target reset callback. Previously we would
    just drop the session in that callback. This patch will
    now try a target reset and if that fails drop the session.

    Signed-off-by: Mike Christie
    Signed-off-by: James Bottomley

    Mike Christie
     
  • Patch and mail from both MikeC and HannesR:

    Before we're trying to send a PDU we have to check whether a TMF
    is active. If so and if the PDU will be affected by the TMF
    we should allow only Data-out PDUs to be sent.

    If fast_abort is set, no Data-out PDUs will be sent while
    a LUN reset is being processed for a affected LUN.

    fast_abort is now ingored during a ABORT TASK tmf. We will not
    send any Data-outs for a task if the task is being aborted.

    Signed-off-by: Mike Christie
    Signed-off-by: Hannes Reinecke
    Signed-off-by: James Bottomley

    Mike Christie
     
  • Some of our virtual SCSI hosts don't have a proper bus parent at the
    top, which can be a problem for doing DMA on them

    This patch makes the host device cache a pointer to the physical bus
    device and provides an extra API for setting it (the normal API picks
    it up from the parent). This patch also modifies the qla2xxx and lpfc
    vport logic to use the new DMA host setting API.

    Acked-By: James Smart
    Cc: Stable Tree
    Signed-off-by: James Bottomley

    James Bottomley
     
  • Customers and certification tests have pointed out that we don't
    show up on the switch management software as an initiator.

    On some MDS switches 'show fcns database' command shows libfc
    initiators as 'fcp' not 'fcp:init' like other initiators.

    On others switches, I think the switch gets the features by doing a PRLI,
    but it may be only certain models or under certain configurations.

    Fix this by registering our FC4 features with the RFF_ID CT request
    after local port login and after the RFT_ID.

    Signed-off-by: Joe Eykholt
    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Joe Eykholt
     
  • There was a locking problem where the fip->lock was held during
    the call to update_mac(). The rtnl_lock() must be taken before
    the fip->lock, not the other way around. This fixes that.

    Now that fcoe_ctlr_recv_flog() is called only from the response handler
    to a FLOGI request, some checking can be eliminated. Instead of calling
    update_mac(), just fill in the granted_mac address for the passed-in
    frame (skb).

    Eliminate the passed-in source MAC address since it is also in the skb.

    Also, in fcoe, call fcoe_set_src_mac() directly instead of going thru
    the fip function pointer. This will generate less code.
    Then, since fip isn't needed for LOGO response, use lport as the arg.

    Signed-off-by: Joe Eykholt
    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Joe Eykholt
     
  • This is to notify the LLD when an FC_ID is assigned to the local port.

    The fnic driver needs to push the assigned FC_ID to firmware.
    It currently does this by intercepting the FLOGI responses, and
    in order to make that code more common with FIP and NPIV, it
    makes more sense to wait until the local port has completely
    handled the FLOGI or FDISC response. Also, when we fix
    point-to-point FC_ID assignment, we'll need this callback as well.

    Add a call to the libfc template, which is called whenever
    the local port FC_ID is being assigned. It defaults to
    fc_lport_set_fid(), supplied by libfc.

    As additional benefit of this function, the LLD may determine
    the MAC address that caused the change by looking at the received frame.

    We also print the assigned port ID as long as it isn't 0.
    Setting port ID to 0 happens often in reset while retrying FLOGI,
    and would be uninteresting. This replaces the previous message
    which didn't identify the host adapter instance.

    patch v2 note: changed one word in a comment. "intercepted" -> "provided".

    Signed-off-by: Joe Eykholt
    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Joe Eykholt
     
  • The strncpy for RSPN_ID and RSNN_NN requests was padding
    past the allocated frame size.

    Get the string length before filling in the ct header.

    Signed-off-by: Joe Eykholt
    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Joe Eykholt
     
  • The code that filled in the name server RNN_ID (register node name)
    request had somehow gotten a line in it from the RFT_ID code
    which copies 32 bytes of data over the relatively short payload.
    This caused some corruption and hangs.

    Simply deleted the extraneous line.

    Signed-off-by: Joe Eykholt
    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Joe Eykholt
     
  • The fnic driver with FIP is reporting link up, even though it's down.

    When the interface is shut down by the switch, we receive a clear
    virtual link, and set the state reported to libfc as down, although
    we still report it up. Clearly wrong. That causes the subsequent
    link down event not to be reported, and /sys shows the host "Online".

    Currently, in FIP mode, if an FCF times out, then link to libfc
    is reported as down, to stop FLOGIs. That interferes with the LLD
    link down being reported.

    Users really need to know the physical link information, to diagnose
    cabling issues, so physical link status should be reported to libfc.

    If the selected FCF needs to be reported, that should be done
    separately, in a later patch.

    Signed-off-by: Joe Eykholt
    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Joe Eykholt
     
  • Allow FIP to be disabled by the driver for devices
    that want to use libfcoe in non-FIP mode.

    The driver merely sets the fcoe_ctlr mode to the state which
    should be entered when the link comes up. The default is auto.
    No change is needed for fcoe.c which uses auto mode.

    Signed-off-by: Joe Eykholt
    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Joe Eykholt
     
  • Cleans up frame allocation APIs to have just single fc_frame_alloc API.

    Removes _fc_frame_alloc, renames __fc_frame_alloc to _fc_frame_alloc.

    Modifies fc_fcp_send_data for removed _fc_frame_alloc, fc_fcp_send_data
    was the only user of removed _fc_frame_alloc.

    Also Adds check in fc_frame_alloc to do mod by 4 for only non-zero
    len value.

    This patch is prep work to fix can_queue reducing in next patch.
    Single fc_frame_alloc API helps in fixing can_queue reducing in
    next patch.

    Signed-off-by: Vasu Dev
    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Vasu Dev
     
  • Ensures that there are kernel-doc style comments for all
    routines and structures.

    There were also a few instances of fc_lport's named 'lp'
    which were switched to 'lport' as per the libfc/libfcoe/fcoe
    naming convention.

    Also, emacs 'indent-region' and 'tabify' were ran on libfcoe.c.

    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Robert Love
     
  • This patch makes a variety of cleanup changes to all libfc files.

    This patch adds kernel-doc headers to all functions lacking them
    and attempts to better format existing headers. It also add kernel-doc
    headers to structures.

    This patch ensures that the current naming conventions for local ports,
    remote ports and remote port private data is upheld in the following
    manner.

    struct instance (i.e. variable name)
    --------------------------------------------------
    fc_lport lport
    fc_rport rport
    fc_rport_libfc_priv rpriv
    fc_rport_priv rdata

    I also renamed dns_rp and ptp_rp to dns_rdata and ptp_rdata
    respectively.

    I used emacs 'indent-region' and 'tabify' on all libfc files
    to correct spacing alignments.

    I feel sorry for anyone attempting to review this patch.

    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Robert Love
     
  • This is the Open-FCoE implementation of the FC
    passthrough support via bsg interface.

    Passthrough support is added to both N_Ports and
    VN_Ports.

    Signed-off-by: Steve Ma
    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Steve Ma
     
  • Export fc_els.h, fc_fs.h, fc_gs.h and fc_ns.h so that they
    may be used by applications.

    This will be needed for FC Passthrough applications like fcping,
    but could be used by other applications.

    Fix to include to exported files provided by
    Chris Leech .

    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Robert Love
     
  • Register the fc_host symbolic name as the symbolic port name
    with the fabric name server.

    Signed-off-by: Chris Leech
    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Chris Leech
     
  • Register the fc_host symbolic name as the symbolic node name
    with the fabric name server.

    Signed-off-by: Chris Leech
    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Chris Leech
     
  • One could interpret FC-GS-5 to say that an explicit RNN_ID is required
    before RSNN_NN is allowed to succeed, which is why RNN_ID was not obsoleted
    along with RPN_ID acording to this document:
    ftp://ftp.t11.org/t11/member/fc/gs-5/05-546v2.pdf

    Signed-off-by: Chris Leech
    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Chris Leech
     
  • RPN_ID has been obsolete per FC-GS-5 for several years. The port name is
    registered implicitly as part of FLOGI, and it is undesirable for ports to
    change a registered port name using RPN_ID while logged into the fabric.

    Signed-off-by: Chris Leech
    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Chris Leech
     
  • The FIP code in libfcoe needed several changes to support NPIV

    1) dst_src_addr needs to be managed per-n_port-ID for FPMA fabrics with NPIV
    enabled. Managing the MAC address is now handled in fcoe, with some slight
    changes to update_mac() and a new get_src_addr() function pointer.

    2) The libfc elsct_send() hook is used to setup FCoE specific response
    handlers for FIP encapsulated ELS exchanges. This lets the FCoE specific
    handling know which VN_Port the exchange is for, and doesn't require
    tracking OX_IDs. It might be possible to roll back to the full FIP frame
    in these, but for now I've just stashed the contents of the MAC address
    descriptor in the skb context block for later use. Also, because
    fcoe_elsct_send() just passes control on to fc_elsct_send(), all transmits
    still come through the normal frame_send() path.

    3) The NPIV changes added a mutex hold in the keep alive sending, the lport
    mutex is protecting the vport list. We can't take a mutex from a timer,
    so move the FIP keep alive logic to the link work struct.

    Signed-off-by: Chris Leech
    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Chris Leech
     
  • Add FDISC ELS handling to libfc and libfcoe, treat it the same as FLOGI where
    appropriate.

    Add checking for NPIV support in the FLOGI LS_ACC service parameters.

    Signed-off-by: Chris Leech
    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Chris Leech
     
  • NPIV vports are managed in libfc by changing their virtual link state
    when the parent N_Ports internal state changes. The vport link is only
    online when the N_Port is in a ready state (logged into the fabric).

    vport_state is updated as needed in this patch as well, currently the states
    LINKDOWN, INITIALIZING, ACTIVE, DSIABLED, and NO_FABRIC_SUPP are used.

    This also changes the fc_host port_state handling to differentiate between
    LINKDOWN and OFFLINE.

    Signed-off-by: Chris Leech
    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Chris Leech
     
  • Adds a function to create a new VN_Port instances, which share the EM
    list with the N_Port, VN_Port lookup by fabric ID when responding to a new
    request (otherwise the exchange lookup from the N_Ports EM list is trusted to
    return an exchange with a cached lport value for the correct VN_Port),
    a pointer to a fc_vport structure for VN_Ports, and flags to indicate if an
    N_Port supports NPIV and if the switch/fabric allows it.

    Signed-off-by: Chris Leech
    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Chris Leech
     
  • I'd like to keep basic initialization together with allocation, which means
    this can't just be a tail-call to scsi_host_alloc.

    This is needed to create a generic libfc host allocation routine for NPIV
    VN_Ports, which will share the exchange ID space (through sharing exchange
    manager structures) with the parent lport. In order to clone the exchange
    manager list when the lport is allocated, the list head must be initialized
    earlier.

    Also, update fnic to use the libfc_host_alloc so that later changes do not break
    it. (contribution by Joe Eykholt)

    Signed-off-by: Chris Leech
    Signed-off-by: Joe Eykholt
    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Chris Leech
     
  • include/scsi/libfc.h is currently loaded with common code
    shared between libfc's sub-modules as well as shared between
    libfc and fcoe. Previous patches attempted to move out
    non-common code. This patch creates two files for common
    libfc routines that will not be shared with fcoe, fnic or
    any other LLDs.

    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Robert Love
     
  • This function is never used, let's remove it.

    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Robert Love
     
  • This patch moves all non-common routines and function prototypes
    out of libfc.h and into the appropriate .c files. It makes these
    routines 'static' when necessary and removes any unnecessary EXPORT_SYMBOL
    statements.

    A result of moving the fc_exch_seq_send, fc_seq_els_rsp_send, fc_exch_alloc
    and fc_seq_start_next prototypes out of libfc.h is that they were no longer
    being imported into fc_exch.c when libfc.h was included. This caused errors
    where routines in fc_exch.c were looking for undefined symbols. To fix this
    this patch reorganizes fc_seq_alloc, fc_seq_start_next and
    fc_seq_start_next_locked. This move also made it so that
    fc_seq_start_next_locked did not need to be prototyped at the top of
    fc_exch.c.

    Signed-off-by: Robert Love
    Signed-off-by: James Bottomley

    Robert Love