Commit 08821023 authored by Benjamin Block's avatar Benjamin Block Committed by Martin K. Petersen

scsi: zfcp: add diagnostics buffer for exchange config data

In the same vein as the previous patch, add diagnostic data capture for the
Exchange Config Data command.

Link: https://lore.kernel.org/r/7d8ac0a6cad403fa8f8b888693476a84e80a277b.1572018131.git.bblock@linux.ibm.comReviewed-by: default avatarSteffen Maier <maier@linux.ibm.com>
Signed-off-by: default avatarBenjamin Block <bblock@linux.ibm.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 7e418833
...@@ -34,6 +34,9 @@ ...@@ -34,6 +34,9 @@
*/ */
int zfcp_diag_adapter_setup(struct zfcp_adapter *const adapter) int zfcp_diag_adapter_setup(struct zfcp_adapter *const adapter)
{ {
/* set the timestamp so that the first test on age will always fail */
const unsigned long initial_timestamp =
jiffies - msecs_to_jiffies(ZFCP_DIAG_MAX_AGE);
struct zfcp_diag_adapter *diag; struct zfcp_diag_adapter *diag;
struct zfcp_diag_header *hdr; struct zfcp_diag_header *hdr;
...@@ -47,8 +50,15 @@ int zfcp_diag_adapter_setup(struct zfcp_adapter *const adapter) ...@@ -47,8 +50,15 @@ int zfcp_diag_adapter_setup(struct zfcp_adapter *const adapter)
spin_lock_init(&hdr->access_lock); spin_lock_init(&hdr->access_lock);
hdr->buffer = &diag->port_data.data; hdr->buffer = &diag->port_data.data;
hdr->buffer_size = sizeof(diag->port_data.data); hdr->buffer_size = sizeof(diag->port_data.data);
/* set the timestamp so that the first test on age will always fail */ hdr->timestamp = initial_timestamp;
hdr->timestamp = jiffies - msecs_to_jiffies(ZFCP_DIAG_MAX_AGE);
/* setup header for config_data */
hdr = &diag->config_data.header;
spin_lock_init(&hdr->access_lock);
hdr->buffer = &diag->config_data.data;
hdr->buffer_size = sizeof(diag->config_data.data);
hdr->timestamp = initial_timestamp;
adapter->diagnostics = diag; adapter->diagnostics = diag;
return 0; return 0;
......
...@@ -43,12 +43,19 @@ struct zfcp_diag_header { ...@@ -43,12 +43,19 @@ struct zfcp_diag_header {
* @port_data: data retrieved using exchange port data. * @port_data: data retrieved using exchange port data.
* @port_data.header: header with metadata for the cache in @port_data.data. * @port_data.header: header with metadata for the cache in @port_data.data.
* @port_data.data: cached QTCB Bottom of command exchange port data. * @port_data.data: cached QTCB Bottom of command exchange port data.
* @config_data: data retrieved using exchange config data.
* @config_data.header: header with metadata for the cache in @config_data.data.
* @config_data.data: cached QTCB Bottom of command exchange config data.
*/ */
struct zfcp_diag_adapter { struct zfcp_diag_adapter {
struct { struct {
struct zfcp_diag_header header; struct zfcp_diag_header header;
struct fsf_qtcb_bottom_port data; struct fsf_qtcb_bottom_port data;
} port_data; } port_data;
struct {
struct zfcp_diag_header header;
struct fsf_qtcb_bottom_config data;
} config_data;
}; };
int zfcp_diag_adapter_setup(struct zfcp_adapter *const adapter); int zfcp_diag_adapter_setup(struct zfcp_adapter *const adapter);
......
...@@ -556,6 +556,8 @@ static int zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *req) ...@@ -556,6 +556,8 @@ static int zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *req)
static void zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *req) static void zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *req)
{ {
struct zfcp_adapter *adapter = req->adapter; struct zfcp_adapter *adapter = req->adapter;
struct zfcp_diag_header *const diag_hdr =
&adapter->diagnostics->config_data.header;
struct fsf_qtcb *qtcb = req->qtcb; struct fsf_qtcb *qtcb = req->qtcb;
struct fsf_qtcb_bottom_config *bottom = &qtcb->bottom.config; struct fsf_qtcb_bottom_config *bottom = &qtcb->bottom.config;
struct Scsi_Host *shost = adapter->scsi_host; struct Scsi_Host *shost = adapter->scsi_host;
...@@ -572,6 +574,12 @@ static void zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *req) ...@@ -572,6 +574,12 @@ static void zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *req)
switch (qtcb->header.fsf_status) { switch (qtcb->header.fsf_status) {
case FSF_GOOD: case FSF_GOOD:
/*
* usually we wait with an update till the cache is too old,
* but because we have the data available, update it anyway
*/
zfcp_diag_update_xdata(diag_hdr, bottom, false);
if (zfcp_fsf_exchange_config_evaluate(req)) if (zfcp_fsf_exchange_config_evaluate(req))
return; return;
...@@ -587,6 +595,7 @@ static void zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *req) ...@@ -587,6 +595,7 @@ static void zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *req)
&adapter->status); &adapter->status);
break; break;
case FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE: case FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE:
zfcp_diag_update_xdata(diag_hdr, bottom, true);
req->status |= ZFCP_STATUS_FSFREQ_XDATAINCOMPLETE; req->status |= ZFCP_STATUS_FSFREQ_XDATAINCOMPLETE;
fc_host_node_name(shost) = 0; fc_host_node_name(shost) = 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