Skip to content

Commit

Permalink
scsi: zfcp: Process Version Change events
Browse files Browse the repository at this point in the history
Handle notifications for a concurrent change of the FCP Channel firmware.
Update the relevant user-visible fields to provide accurate data.

Link: https://lore.kernel.org/r/d2c7bc57c6cf1b65eabbf7a5d0e3927b9f65647f.1603908167.git.bblock@linux.ibm.com
Reviewed-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Julian Wiedmann authored and Martin K. Petersen committed Oct 30, 2020
1 parent efd3217 commit a6c37ab
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
16 changes: 16 additions & 0 deletions drivers/s390/scsi/zfcp_fsf.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,19 @@ static void zfcp_fsf_status_read_link_down(struct zfcp_fsf_req *req)
}
}

static void
zfcp_fsf_status_read_version_change(struct zfcp_adapter *adapter,
struct fsf_status_read_buffer *sr_buf)
{
if (sr_buf->status_subtype == FSF_STATUS_READ_SUB_LIC_CHANGE) {
u32 version = sr_buf->payload.version_change.current_version;

WRITE_ONCE(adapter->fsf_lic_version, version);
snprintf(fc_host_firmware_version(adapter->scsi_host),
FC_VERSION_STRING_SIZE, "%#08x", version);
}
}

static void zfcp_fsf_status_read_handler(struct zfcp_fsf_req *req)
{
struct zfcp_adapter *adapter = req->adapter;
Expand Down Expand Up @@ -300,6 +313,9 @@ static void zfcp_fsf_status_read_handler(struct zfcp_fsf_req *req)
case FSF_STATUS_READ_FEATURE_UPDATE_ALERT:
adapter->adapter_features = sr_buf->payload.word[0];
break;
case FSF_STATUS_READ_VERSION_CHANGE:
zfcp_fsf_status_read_version_change(adapter, sr_buf);
break;
}

mempool_free(virt_to_page(sr_buf), adapter->pool.sr_data);
Expand Down
10 changes: 10 additions & 0 deletions drivers/s390/scsi/zfcp_fsf.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
#define FSF_STATUS_READ_LINK_UP 0x00000006
#define FSF_STATUS_READ_NOTIFICATION_LOST 0x00000009
#define FSF_STATUS_READ_FEATURE_UPDATE_ALERT 0x0000000C
#define FSF_STATUS_READ_VERSION_CHANGE 0x0000000D

/* status subtypes for link down */
#define FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK 0x00000000
Expand All @@ -143,6 +144,9 @@
/* status subtypes for unsolicited status notification lost */
#define FSF_STATUS_READ_SUB_INCOMING_ELS 0x00000001

/* status subtypes for version change */
#define FSF_STATUS_READ_SUB_LIC_CHANGE 0x00000001

/* topologie that is detected by the adapter */
#define FSF_TOPO_P2P 0x00000001
#define FSF_TOPO_FABRIC 0x00000002
Expand Down Expand Up @@ -226,6 +230,11 @@ struct fsf_link_down_info {
u8 vendor_specific_code;
} __attribute__ ((packed));

struct fsf_version_change {
u32 current_version;
u32 previous_version;
} __packed;

struct fsf_status_read_buffer {
u32 status_type;
u32 status_subtype;
Expand All @@ -242,6 +251,7 @@ struct fsf_status_read_buffer {
u32 word[FSF_STATUS_READ_PAYLOAD_SIZE/sizeof(u32)];
struct fsf_link_down_info link_down_info;
struct fsf_bit_error_payload bit_error;
struct fsf_version_change version_change;
} payload;
} __attribute__ ((packed));

Expand Down

0 comments on commit a6c37ab

Please sign in to comment.