Commit 32ef9388 authored by Vineeth Vijayan's avatar Vineeth Vijayan Committed by Jens Axboe

s390/cio: Add support for FCES status notification

Fibre Channel Endpoint-Security event is received as an sei:nt0 type
in the CIO layer. This information needs to be shared with the
CCW device drivers using the path_events callback.
Co-developed-by: default avatarSebastian Ott <sebott@linux.ibm.com>
Signed-off-by: default avatarVineeth Vijayan <vneethv@linux.ibm.com>
Signed-off-by: default avatarSebastian Ott <sebott@linux.ibm.com>
Signed-off-by: default avatarStefan Haberland <sth@linux.ibm.com>
Reviewed-by: default avatarPeter Oberparleiter <oberpar@linux.ibm.com>
Acked-by: default avatarVasily Gorbik <gor@linux.ibm.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 4cd6094d
...@@ -104,6 +104,8 @@ struct ccw_device { ...@@ -104,6 +104,8 @@ struct ccw_device {
was successfully verified. */ was successfully verified. */
#define PE_PATHGROUP_ESTABLISHED 0x4 /* A pathgroup was reset and had #define PE_PATHGROUP_ESTABLISHED 0x4 /* A pathgroup was reset and had
to be established again. */ to be established again. */
#define PE_PATH_FCES_EVENT 0x8 /* The FCES Status of a path has
* changed. */
/* /*
* Possible CIO actions triggered by the unit check handler. * Possible CIO actions triggered by the unit check handler.
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#define CHP_OFFLINE 1 #define CHP_OFFLINE 1
#define CHP_VARY_ON 2 #define CHP_VARY_ON 2
#define CHP_VARY_OFF 3 #define CHP_VARY_OFF 3
#define CHP_FCES_EVENT 4
struct chp_link { struct chp_link {
struct chp_id chpid; struct chp_id chpid;
......
...@@ -37,6 +37,9 @@ static void *sei_page; ...@@ -37,6 +37,9 @@ static void *sei_page;
static void *chsc_page; static void *chsc_page;
static DEFINE_SPINLOCK(chsc_page_lock); static DEFINE_SPINLOCK(chsc_page_lock);
#define SEI_VF_FLA 0xc0 /* VF flag for Full Link Address */
#define SEI_RS_CHPID 0x4 /* 4 in RS field indicates CHPID */
/** /**
* chsc_error_from_response() - convert a chsc response to an error * chsc_error_from_response() - convert a chsc response to an error
* @response: chsc response code * @response: chsc response code
...@@ -287,6 +290,15 @@ static void s390_process_res_acc(struct chp_link *link) ...@@ -287,6 +290,15 @@ static void s390_process_res_acc(struct chp_link *link)
css_schedule_reprobe(); css_schedule_reprobe();
} }
static int process_fces_event(struct subchannel *sch, void *data)
{
spin_lock_irq(sch->lock);
if (sch->driver && sch->driver->chp_event)
sch->driver->chp_event(sch, data, CHP_FCES_EVENT);
spin_unlock_irq(sch->lock);
return 0;
}
struct chsc_sei_nt0_area { struct chsc_sei_nt0_area {
u8 flags; u8 flags;
u8 vf; /* validity flags */ u8 vf; /* validity flags */
...@@ -364,6 +376,16 @@ static char *store_ebcdic(char *dest, const char *src, unsigned long len, ...@@ -364,6 +376,16 @@ static char *store_ebcdic(char *dest, const char *src, unsigned long len,
return dest + len; return dest + len;
} }
static void chsc_link_from_sei(struct chp_link *link,
struct chsc_sei_nt0_area *sei_area)
{
if ((sei_area->vf & SEI_VF_FLA) != 0) {
link->fla = sei_area->fla;
link->fla_mask = ((sei_area->vf & SEI_VF_FLA) == SEI_VF_FLA) ?
0xffff : 0xff00;
}
}
/* Format node ID and parameters for output in LIR log message. */ /* Format node ID and parameters for output in LIR log message. */
static void format_node_data(char *params, char *id, struct node_descriptor *nd) static void format_node_data(char *params, char *id, struct node_descriptor *nd)
{ {
...@@ -453,15 +475,7 @@ static void chsc_process_sei_res_acc(struct chsc_sei_nt0_area *sei_area) ...@@ -453,15 +475,7 @@ static void chsc_process_sei_res_acc(struct chsc_sei_nt0_area *sei_area)
} }
memset(&link, 0, sizeof(struct chp_link)); memset(&link, 0, sizeof(struct chp_link));
link.chpid = chpid; link.chpid = chpid;
if ((sei_area->vf & 0xc0) != 0) { chsc_link_from_sei(&link, sei_area);
link.fla = sei_area->fla;
if ((sei_area->vf & 0xc0) == 0xc0)
/* full link address */
link.fla_mask = 0xffff;
else
/* link address */
link.fla_mask = 0xff00;
}
s390_process_res_acc(&link); s390_process_res_acc(&link);
} }
...@@ -570,6 +584,33 @@ static void chsc_process_sei_ap_cfg_chg(struct chsc_sei_nt0_area *sei_area) ...@@ -570,6 +584,33 @@ static void chsc_process_sei_ap_cfg_chg(struct chsc_sei_nt0_area *sei_area)
ap_bus_cfg_chg(); ap_bus_cfg_chg();
} }
static void chsc_process_sei_fces_event(struct chsc_sei_nt0_area *sei_area)
{
struct chp_link link;
struct chp_id chpid;
struct channel_path *chp;
CIO_CRW_EVENT(4,
"chsc: FCES status notification (rs=%02x, rs_id=%04x, FCES-status=%x)\n",
sei_area->rs, sei_area->rsid, sei_area->ccdf[0]);
if (sei_area->rs != SEI_RS_CHPID)
return;
chp_id_init(&chpid);
chpid.id = sei_area->rsid;
/* Ignore the event on unknown/invalid chp */
chp = chpid_to_chp(chpid);
if (!chp)
return;
memset(&link, 0, sizeof(struct chp_link));
link.chpid = chpid;
chsc_link_from_sei(&link, sei_area);
for_each_subchannel_staged(process_fces_event, NULL, &link);
}
static void chsc_process_sei_nt2(struct chsc_sei_nt2_area *sei_area) static void chsc_process_sei_nt2(struct chsc_sei_nt2_area *sei_area)
{ {
switch (sei_area->cc) { switch (sei_area->cc) {
...@@ -611,6 +652,9 @@ static void chsc_process_sei_nt0(struct chsc_sei_nt0_area *sei_area) ...@@ -611,6 +652,9 @@ static void chsc_process_sei_nt0(struct chsc_sei_nt0_area *sei_area)
case 14: /* scm available notification */ case 14: /* scm available notification */
chsc_process_sei_scm_avail(sei_area); chsc_process_sei_scm_avail(sei_area);
break; break;
case 15: /* FCES event notification */
chsc_process_sei_fces_event(sei_area);
break;
default: /* other stuff */ default: /* other stuff */
CIO_CRW_EVENT(2, "chsc: sei nt0 unhandled cc=%d\n", CIO_CRW_EVENT(2, "chsc: sei nt0 unhandled cc=%d\n",
sei_area->cc); sei_area->cc);
......
...@@ -1170,7 +1170,8 @@ static int io_subchannel_chp_event(struct subchannel *sch, ...@@ -1170,7 +1170,8 @@ static int io_subchannel_chp_event(struct subchannel *sch,
struct chp_link *link, int event) struct chp_link *link, int event)
{ {
struct ccw_device *cdev = sch_get_cdev(sch); struct ccw_device *cdev = sch_get_cdev(sch);
int mask; int mask, chpid, valid_bit;
int path_event[8];
mask = chp_ssd_get_mask(&sch->ssd_info, link); mask = chp_ssd_get_mask(&sch->ssd_info, link);
if (!mask) if (!mask)
...@@ -1205,6 +1206,18 @@ static int io_subchannel_chp_event(struct subchannel *sch, ...@@ -1205,6 +1206,18 @@ static int io_subchannel_chp_event(struct subchannel *sch,
cdev->private->path_new_mask |= mask; cdev->private->path_new_mask |= mask;
io_subchannel_verify(sch); io_subchannel_verify(sch);
break; break;
case CHP_FCES_EVENT:
/* Forward Endpoint Security event */
for (chpid = 0, valid_bit = 0x80; chpid < 8; chpid++,
valid_bit >>= 1) {
if (mask & valid_bit)
path_event[chpid] = PE_PATH_FCES_EVENT;
else
path_event[chpid] = PE_NONE;
}
if (cdev)
cdev->drv->path_event(cdev, path_event);
break;
} }
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment