All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Christie <michaelc@cs.wisc.edu>
To: Candid Shot <candid_shot_1@yahoo.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: scsi (sg) device status vs FC connectivity
Date: Wed, 22 Feb 2012 03:02:33 -0600	[thread overview]
Message-ID: <4F44AF29.6020608@cs.wisc.edu> (raw)
In-Reply-To: <1329860107.22873.YahooMailNeo@web46407.mail.sp1.yahoo.com>

On 02/21/2012 03:35 PM, Candid Shot wrote:
> (I hope this list is the right place to ask SG Driver related question ..)
> 
> Background: A FC cable-pull is simulated by disabling the FC switch (Brocade) port.
> 
> 
> While /sys/class/fc_host/hostx/port_state might confirm the FC connectivity is missing,
> 
> /proc/scsi/sg/devices will show the scsi device to be 'online'.
> 
> My goal is to be able to return an error to the application, should a cable-pull happen.
> 
> Is there a way to be able to tweak this behavior where the scsi driver is able to look at port events,
> and possibly return errors during read/write operations? 


You can listen on the fc scsi netlink socket for fc_host_event_code. You
get values like:


        { FCH_EVT_LIP,                  "lip" },
        { FCH_EVT_LINKUP,               "link_up" },
        { FCH_EVT_LINKDOWN,             "link_down" },
        { FCH_EVT_LIPRESET,             "lip_reset" },
        { FCH_EVT_RSCN,                 "rscn" },
        { FCH_EVT_ADAPTER_CHANGE,       "adapter_chg" },
        { FCH_EVT_PORT_UNKNOWN,         "port_unknown" },
        { FCH_EVT_PORT_ONLINE,          "port_online" },
        { FCH_EVT_PORT_OFFLINE,         "port_offline" },
        { FCH_EVT_PORT_FABRIC,          "port_fabric" },
        { FCH_EVT_LINK_UNKNOWN,         "link_unknown" },
        { FCH_EVT_VENDOR_UNIQUE,        "vendor_unique" },

      parent reply	other threads:[~2012-02-22  9:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-21 21:35 scsi (sg) device status vs FC connectivity Candid Shot
2012-02-21 22:36 ` Douglas Gilbert
2012-02-22  3:21 ` James Bottomley
2012-02-22  9:02 ` Mike Christie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F44AF29.6020608@cs.wisc.edu \
    --to=michaelc@cs.wisc.edu \
    --cc=candid_shot_1@yahoo.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.