iprdd-devel Mailing List for IPR Linux device driver
Brought to you by:
brking
You can subscribe to this list here.
2014 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2015 |
Jan
|
Feb
(18) |
Mar
(55) |
Apr
(31) |
May
(14) |
Jun
(38) |
Jul
(27) |
Aug
(11) |
Sep
(11) |
Oct
(46) |
Nov
(55) |
Dec
(22) |
2016 |
Jan
(33) |
Feb
(21) |
Mar
(32) |
Apr
(19) |
May
|
Jun
(10) |
Jul
(21) |
Aug
(4) |
Sep
(29) |
Oct
(26) |
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(8) |
Apr
(2) |
May
(1) |
Jun
(7) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(5) |
Dec
|
2018 |
Jan
|
Feb
|
Mar
(3) |
Apr
(3) |
May
(4) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
(4) |
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2021 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Brian K. <br...@li...> - 2022-04-15 21:03:30
|
Applied. Thanks, Brian -- Brian King Power Linux I/O IBM Linux Technology Center |
From: <wen...@li...> - 2021-11-18 16:03:25
|
From: Wen Xiong <wen...@li...> The patch fixes several wrong values in Fuel Gauge: - byte written - life remaining - pfa trip Signed-off-by: Wen Xiong <wen...@li...> --- iprconfig.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/iprconfig.c b/iprconfig.c index f74a70c..0453648 100644 --- a/iprconfig.c +++ b/iprconfig.c @@ -19152,7 +19152,7 @@ static char *print_ssd_report(struct ipr_dev *dev, char *body) struct ipr_sas_log_write_err_cnt_attr *bytes_counter; char buffer[BUFSIZ]; - int rc, len, nentries = 0; + int rc, len; u64 aux; u64 total_gb_writ = 0; u32 uptime = 0; @@ -19201,7 +19201,7 @@ static char *print_ssd_report(struct ipr_dev *dev, char *body) if (rc) return NULL; - smart_attr = ipr_sas_log_get_param(&page34_log, 0xE7, NULL); + smart_attr = ipr_sas_log_get_param(&page34_log, 0xB1, NULL); if (smart_attr && smart_attr->norm_worst_val > 0) life_remain = smart_attr->norm_worst_val; @@ -19215,17 +19215,14 @@ static char *print_ssd_report(struct ipr_dev *dev, char *body) bytes_counter = ipr_sas_log_get_param(&page02_log, 0x05, NULL); if (bytes_counter) - total_gb_writ = be64toh(*(u64 *) &bytes_counter->counter) >> 14; + total_gb_writ = be64toh(*((u64 *) &bytes_counter->counter))/1024/1024/1024; rc = ipr_log_sense(dev, 0x2F, &page2F_log, sizeof(page2F_log)); if (rc) return NULL; - - inf_except_attr = ipr_sas_log_get_param(&page2F_log, 0x0, &nentries); + inf_except_attr = ipr_sas_log_get_param(&page2F_log, 0x0, NULL); if (inf_except_attr) pfa_trip = inf_except_attr->inf_except_add_sense_code; - if (nentries > 1) - pfa_trip = 1; body = add_line_to_body(body, "", NULL); /* FRU Number */ @@ -19254,7 +19251,7 @@ static char *print_ssd_report(struct ipr_dev *dev, char *body) body = add_line_to_body(body, _("Firmware Version"), buffer); /* Bytes written */ - snprintf(buffer, BUFSIZ, "%ld GB", total_gb_writ); + snprintf(buffer, BUFSIZ, "%llu GB", total_gb_writ); body = add_line_to_body(body, _("Total Bytes Written"), buffer); /* Max bytes. */ -- 2.27.0 |
From: Brian K. <br...@li...> - 2020-05-01 18:21:07
|
Applied, Thanks! Brian -- Brian King Power Linux I/O IBM Linux Technology Center |
From: <wen...@li...> - 2020-04-17 16:34:37
|
From: Wen Xiong <wen...@li...> Without freeing the raid_cmd_head list before creating the raid menu, GUI menu of creating/deleting an array got mess up. Signed-off-by: Wen Xiong <wen...@li...> --- iprconfig.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/iprconfig.c b/iprconfig.c index 5f31beb..f74a70c 100644 --- a/iprconfig.c +++ b/iprconfig.c @@ -2980,6 +2980,8 @@ int hot_spare_screen(i_container *i_con) **/ int raid_screen(i_container *i_con) { + free_raid_cmds(); + return display_features_menu(i_con, &n_raid_screen); } -- 1.6.0.2 |
From: Brian K. <br...@li...> - 2019-09-16 14:17:44
|
On 9/13/19 9:17 PM, Brahadambal Srinivasan wrote: > New drives that default to reporting descriptor format sense data, > do not have support for this in iprutils and it makes it impossible > to use the drives. This patch adds code to convert the sense data > to the format that user expects. Applied. Thanks! Brian -- Brian King Power Linux I/O IBM Linux Technology Center |
From: Brahadambal S. <la...@li...> - 2019-09-14 02:53:56
|
New drives that default to reporting descriptor format sense data, do not have support for this in iprutils and it makes it impossible to use the drives. This patch adds code to convert the sense data to the format that user expects. Signed-off-by: Brahadambal Srinivasan <la...@li...> Reviewed-by: Rick Lindsley <ric...@li...> Reported-by: Timothy O'Callaghan <tj...@us...> --- iprlib.c | 29 +++++++++++++++++++++++++++-- iprlib.h | 11 +++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/iprlib.c b/iprlib.c index 516f069..e3b49b8 100644 --- a/iprlib.c +++ b/iprlib.c @@ -5291,6 +5291,8 @@ static int _sg_ioctl(int fd, u8 cdb[IPR_CCB_CDB_LEN], int buff_len, segment_size; void *dxferp; u8 *buf; + struct sense_data_t sd; + struct df_sense_data_t *dfsdp = NULL; /* check if scatter gather should be used */ if (xfer_len > IPR_MAX_XFER) { @@ -5320,7 +5322,7 @@ static int _sg_ioctl(int fd, u8 cdb[IPR_CCB_CDB_LEN], for (i = 0; i < (retries + 1); i++) { memset(&io_hdr_t, 0, sizeof(io_hdr_t)); - memset(sense_data, 0, sizeof(struct sense_data_t)); + memset(&sd, 0, sizeof(struct sense_data_t)); io_hdr_t.interface_id = 'S'; io_hdr_t.cmd_len = cdb_size[(cdb[0] >> 5) & 0x7]; @@ -5328,7 +5330,7 @@ static int _sg_ioctl(int fd, u8 cdb[IPR_CCB_CDB_LEN], io_hdr_t.flags = 0; io_hdr_t.pack_id = 0; io_hdr_t.usr_ptr = 0; - io_hdr_t.sbp = (unsigned char *)sense_data; + io_hdr_t.sbp = (unsigned char *)&sd; io_hdr_t.mx_sb_len = sizeof(struct sense_data_t); io_hdr_t.timeout = timeout_in_sec * 1000; io_hdr_t.cmdp = cdb; @@ -5352,6 +5354,29 @@ static int _sg_ioctl(int fd, u8 cdb[IPR_CCB_CDB_LEN], break; } + memset(sense_data, 0, sizeof(struct sense_data_t)); + + if (((sd.error_code & 0x7F) == 0x72) || ((sd.error_code & 0x7F) == 0x73)) { + dfsdp = (struct df_sense_data_t *)&sd; + /* change error_codes 0x72 to 0x70 and 0x73 to 0x71 */ + sense_data->error_code = dfsdp->error_code & 0xFD; + + /* Do not change the order of the next two assignments + * In the same u8, the 4th bit of fixed format corresponds + * to SDAT_OVLF and the last 4 bits to sense_key. + */ + sense_data->sense_key = dfsdp->sense_key & 0x0F; + if (dfsdp->rfield & 0x80) + sense_data->sense_key |= 0x10; + + /* copy the other values */ + sense_data->add_sense_code = dfsdp->add_sense_code; + sense_data->add_sense_code_qual = dfsdp->add_sense_code_qual; + sense_data->add_sense_len = 0; + } else if(sd.error_code & 0x7F) { + memcpy(sense_data, &sd, sizeof(struct sense_data_t)); + } + out: if (iovec_count) { for (i = 0, buf = (u8 *)data; i < iovec_count; i++) { diff --git a/iprlib.h b/iprlib.h index aa07989..ebd1c81 100644 --- a/iprlib.h +++ b/iprlib.h @@ -1727,6 +1727,17 @@ struct sense_data_t { u8 add_sense_bytes[0]; }; +/* Structure for Descriptive Format Sense Data */ +struct df_sense_data_t { + u8 error_code; + u8 sense_key; + u8 add_sense_code; + u8 add_sense_code_qual; + u8 rfield; + u8 rsrvd[2]; + u8 add_sense_len; +}; + struct ipr_ioa_mode_page { struct ipr_mode_page_hdr hdr; u8 reserved; -- 2.19.1 |
From: Brian K. <br...@li...> - 2019-09-13 21:04:42
|
Thanks Latha! Looks good. A few minor comments below. On 9/13/19 9:48 AM, Brahadambal Srinivasan wrote: > New drives that default to reporting descriptor format sense data, > do not have support for this in iprutils and it makes it impossible > to use the drives. This patch adds code to convert the sense data > to the format that user expects. > > Signed-off-by: Brahadambal Srinivasan <la...@li...> > Signed-off-by: Brian King <br...@li...> My signed off should be removed from the patch submission and I will add it when committing the patch. > Reviewed-by: Rick Lindsley <ric...@li...> > Reported-by: Timothy O'Callaghan <tj...@us...> > > --- > iprlib.c | 31 +++++++++++++++++++++++++++++-- > iprlib.h | 11 +++++++++++ > 2 files changed, 40 insertions(+), 2 deletions(-) > > diff --git a/iprlib.c b/iprlib.c > index 516f069..032fe1a 100644 > --- a/iprlib.c > +++ b/iprlib.c > @@ -16,6 +16,8 @@ > #ifndef iprlib_h > #include "iprlib.h" > #endif > +#include <stdio.h> > +#include <stdlib.h> Why are these needed? Can they be removed? > @@ -5352,6 +5356,29 @@ static int _sg_ioctl(int fd, u8 cdb[IPR_CCB_CDB_LEN], > break; > } > > + memset(sense_data, 0, sizeof(struct sense_data_t)); > + > + if (((sd.error_code & 0x7F) == 0x72) || ((sd.error_code & 0x7F) == 0x73)) { > + dfsdp = (struct df_sense_data_t *)&sd; > + /* change error_codes 0x72 to 0x70 and 0x73 to 0x71 */ > + sense_data->error_code = dfsdp->error_code & 0xFD; > + > + /* Do not change the order of the next two assignments > + * In the same u8, bit 4 of the fixed format corresponds > + * to SDAT_OVLF and the last 4 bits to sense_key. > + */ > + sense_data->sense_key = dfsdp->sense_key & 0x0F; > + if (dfsdp->rfield & 0x80) > + sense_data->sense_key |= 0x10; > + > + /* copy the other values */ > + sense_data->add_sense_code = dfsdp->add_sense_code; > + sense_data->add_sense_code_qual = dfsdp->add_sense_code_qual; > + sense_data->add_sense_len = dfsdp->add_sense_len; I would suggest leaving the add_sense_len to zero here. There is no additional sense data you are copying over and the format would be different anyway, so you can't easily do that. > + } else if (((sd.error_code & 0x7F) == 0x70) || ((sd.error_code & 0x7F) == 0x71)) { > + memcpy((void *)sense_data, (void *)&sd, sizeof(struct sense_data_t)); Some trailing whitespace on the memcpy line. Also, you can probably remove the void * casts here. Were you getting compile warnings without them? Also, you can probably just simplify the check here to be something like: else if (sd.error_code & 0x7F) That way any vendor specific sense data doesn't get lost. > + } > + > out: > if (iovec_count) { > for (i = 0, buf = (u8 *)data; i < iovec_count; i++) { -- Brian King Power Linux I/O IBM Linux Technology Center |
From: Brahadambal S. <la...@li...> - 2019-09-13 15:27:56
|
New drives that default to reporting descriptor format sense data, do not have support for this in iprutils and it makes it impossible to use the drives. This patch adds code to convert the sense data to the format that user expects. Signed-off-by: Brahadambal Srinivasan <la...@li...> Signed-off-by: Brian King <br...@li...> Reviewed-by: Rick Lindsley <ric...@li...> Reported-by: Timothy O'Callaghan <tj...@us...> --- iprlib.c | 31 +++++++++++++++++++++++++++++-- iprlib.h | 11 +++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/iprlib.c b/iprlib.c index 516f069..032fe1a 100644 --- a/iprlib.c +++ b/iprlib.c @@ -16,6 +16,8 @@ #ifndef iprlib_h #include "iprlib.h" #endif +#include <stdio.h> +#include <stdlib.h> static void default_exit_func() { @@ -5291,6 +5293,8 @@ static int _sg_ioctl(int fd, u8 cdb[IPR_CCB_CDB_LEN], int buff_len, segment_size; void *dxferp; u8 *buf; + struct sense_data_t sd; + struct df_sense_data_t *dfsdp = NULL; /* check if scatter gather should be used */ if (xfer_len > IPR_MAX_XFER) { @@ -5320,7 +5324,7 @@ static int _sg_ioctl(int fd, u8 cdb[IPR_CCB_CDB_LEN], for (i = 0; i < (retries + 1); i++) { memset(&io_hdr_t, 0, sizeof(io_hdr_t)); - memset(sense_data, 0, sizeof(struct sense_data_t)); + memset(&sd, 0, sizeof(struct sense_data_t)); io_hdr_t.interface_id = 'S'; io_hdr_t.cmd_len = cdb_size[(cdb[0] >> 5) & 0x7]; @@ -5328,7 +5332,7 @@ static int _sg_ioctl(int fd, u8 cdb[IPR_CCB_CDB_LEN], io_hdr_t.flags = 0; io_hdr_t.pack_id = 0; io_hdr_t.usr_ptr = 0; - io_hdr_t.sbp = (unsigned char *)sense_data; + io_hdr_t.sbp = (unsigned char *)&sd; io_hdr_t.mx_sb_len = sizeof(struct sense_data_t); io_hdr_t.timeout = timeout_in_sec * 1000; io_hdr_t.cmdp = cdb; @@ -5352,6 +5356,29 @@ static int _sg_ioctl(int fd, u8 cdb[IPR_CCB_CDB_LEN], break; } + memset(sense_data, 0, sizeof(struct sense_data_t)); + + if (((sd.error_code & 0x7F) == 0x72) || ((sd.error_code & 0x7F) == 0x73)) { + dfsdp = (struct df_sense_data_t *)&sd; + /* change error_codes 0x72 to 0x70 and 0x73 to 0x71 */ + sense_data->error_code = dfsdp->error_code & 0xFD; + + /* Do not change the order of the next two assignments + * In the same u8, bit 4 of the fixed format corresponds + * to SDAT_OVLF and the last 4 bits to sense_key. + */ + sense_data->sense_key = dfsdp->sense_key & 0x0F; + if (dfsdp->rfield & 0x80) + sense_data->sense_key |= 0x10; + + /* copy the other values */ + sense_data->add_sense_code = dfsdp->add_sense_code; + sense_data->add_sense_code_qual = dfsdp->add_sense_code_qual; + sense_data->add_sense_len = dfsdp->add_sense_len; + } else if (((sd.error_code & 0x7F) == 0x70) || ((sd.error_code & 0x7F) == 0x71)) { + memcpy((void *)sense_data, (void *)&sd, sizeof(struct sense_data_t)); + } + out: if (iovec_count) { for (i = 0, buf = (u8 *)data; i < iovec_count; i++) { diff --git a/iprlib.h b/iprlib.h index aa07989..ebd1c81 100644 --- a/iprlib.h +++ b/iprlib.h @@ -1727,6 +1727,17 @@ struct sense_data_t { u8 add_sense_bytes[0]; }; +/* Structure for Descriptive Format Sense Data */ +struct df_sense_data_t { + u8 error_code; + u8 sense_key; + u8 add_sense_code; + u8 add_sense_code_qual; + u8 rfield; + u8 rsrvd[2]; + u8 add_sense_len; +}; + struct ipr_ioa_mode_page { struct ipr_mode_page_hdr hdr; u8 reserved; -- 1.8.3.1 |
From: Brian K. <br...@li...> - 2019-05-22 17:33:26
|
When formatting a disk from JBOD to RAID, we unbind the disk from the sd driver, including the remote path, in the case of dual adapters, and flush unused multipaths. However, due to a bug, this code wasn't actually working once the SCSI host, bus, or target exceeded a single character. Signed-off-by: Brian King <br...@li...> --- iprlib.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/iprlib.c b/iprlib.c index 4d3ab5f..516f069 100644 --- a/iprlib.c +++ b/iprlib.c @@ -10345,7 +10345,8 @@ int ipr_jbod_sysfs_bind(struct ipr_dev *dev, u8 op) char *sysfs_device_name; sysfs_device_name = dev->scsi_dev_data->sysfs_device_name; - size = strnlen(sysfs_device_name, sizeof(sysfs_device_name)); + size = strnlen(sysfs_device_name, + sizeof(dev->scsi_dev_data->sysfs_device_name)); if (op == IPR_JBOD_SYSFS_BIND) { fd = open("/sys/bus/scsi/drivers/sd/bind", O_WRONLY); @@ -10367,7 +10368,8 @@ int ipr_jbod_sysfs_bind(struct ipr_dev *dev, u8 op) mp_dev = find_multipath_jbod(dev); if (mp_dev) { sysfs_device_name = mp_dev->scsi_dev_data->sysfs_device_name; - size = strnlen(sysfs_device_name, sizeof(sysfs_device_name)); + size = strnlen(sysfs_device_name, + sizeof(mp_dev->scsi_dev_data->sysfs_device_name)); rc = write(fd, sysfs_device_name, size); if (rc < 0) { close(fd); -- 1.8.3.1 |
From: Brian K. <br...@li...> - 2019-05-22 16:51:29
|
These two patches fix up some hang conditions that have been seen when formatting drives for RAID function. Brian King (2): iprutils: Fix driver unbind on format iprutils: Fix format for RAID hang iprconfig.c | 2 +- iprlib.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) -- 1.8.3.1 |
From: Brian K. <br...@li...> - 2019-05-22 16:37:07
|
After completing all device formats when formatting disks for RAID, we wait until the drives get converted from JBOD resources to RAID device resources. We wait for 30 seconds for this to complete. However, due to a bug, we ended up waiting here forever. This ensures we timeout after 30 seconds. Signed-off-by: Brian King <br...@li...> --- iprconfig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iprconfig.c b/iprconfig.c index 6a5fd21..5f31beb 100644 --- a/iprconfig.c +++ b/iprconfig.c @@ -232,7 +232,7 @@ static int wait_for_formatted_af_dasd(int timeout_in_secs) int num_devs, j, af_found, jbod2af_formats, num_secs; u64 device_id; - for (num_secs = 0; num_secs < timeout_in_secs; timeout_in_secs++) { + for (num_secs = 0; num_secs < timeout_in_secs; num_secs++) { af_found = 0; jbod2af_formats = 0; scsi_devs = NULL; -- 1.8.3.1 |
From: Brian K. <br...@li...> - 2018-06-05 20:13:25
|
On 05/25/2018 09:00 AM, wen...@li... wrote: > From: Wen Xiong <wen...@li...> > > This patch adds formatting error overlay 0x41 to improve debug > capabilities. > > Signed-off-by: Wen Xiong <wen...@li...> > --- Acked-by: Brian King <br...@li...> -- Brian King Power Linux I/O IBM Linux Technology Center |
From: <wen...@li...> - 2018-05-25 15:05:25
|
From: Wen Xiong <wen...@li...> This patch adds formatting error overlay 0x41 to improve debug capabilities. Signed-off-by: Wen Xiong <wen...@li...> --- drivers/scsi/ipr.c | 25 +++++++++++++++++++++++++ drivers/scsi/ipr.h | 7 +++++++ 2 files changed, 32 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 6615ad8..d51eb71 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c @@ -2413,6 +2413,28 @@ static void ipr_log_sis64_fabric_error(struct ipr_ioa_cfg *ioa_cfg, } /** + * ipr_log_sis64_service_required_error - Log a sis64 service required error. + * @ioa_cfg: ioa config struct + * @hostrcb: hostrcb struct + * + * Return value: + * none + **/ +static void ipr_log_sis64_service_required_error(struct ipr_ioa_cfg *ioa_cfg, + struct ipr_hostrcb *hostrcb) +{ + struct ipr_hostrcb_type_41_error *error; + + error = &hostrcb->hcam.u.error64.u.type_41_error; + + error->failure_reason[sizeof(error->failure_reason) - 1] = '\0'; + ipr_err("Primary Failure Reason: %s\n", error->failure_reason); + ipr_log_hex_data(ioa_cfg, error->data, + be32_to_cpu(hostrcb->hcam.length) - + (offsetof(struct ipr_hostrcb_error, u) + + offsetof(struct ipr_hostrcb_type_41_error, data))); +} +/** * ipr_log_generic_error - Log an adapter error. * @ioa_cfg: ioa config struct * @hostrcb: hostrcb struct @@ -2587,6 +2609,9 @@ static void ipr_handle_log_data(struct ipr_ioa_cfg *ioa_cfg, case IPR_HOST_RCB_OVERLAY_ID_30: ipr_log_sis64_fabric_error(ioa_cfg, hostrcb); break; + case IPR_HOST_RCB_OVERLAY_ID_41: + ipr_log_sis64_service_required_error(ioa_cfg, hostrcb); + break; case IPR_HOST_RCB_OVERLAY_ID_1: case IPR_HOST_RCB_OVERLAY_ID_DEFAULT: default: diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h index 9357073..68afbbd 100644 --- a/drivers/scsi/ipr.h +++ b/drivers/scsi/ipr.h @@ -1135,6 +1135,11 @@ struct ipr_hostrcb_type_30_error { struct ipr_hostrcb64_fabric_desc desc[1]; }__attribute__((packed, aligned (4))); +struct ipr_hostrcb_type_41_error { + u8 failure_reason[64]; + __be32 data[200]; +}__attribute__((packed, aligned (4))); + struct ipr_hostrcb_error { __be32 fd_ioasc; struct ipr_res_addr fd_res_addr; @@ -1173,6 +1178,7 @@ struct ipr_hostrcb64_error { struct ipr_hostrcb_type_23_error type_23_error; struct ipr_hostrcb_type_24_error type_24_error; struct ipr_hostrcb_type_30_error type_30_error; + struct ipr_hostrcb_type_41_error type_41_error; } u; }__attribute__((packed, aligned (8))); @@ -1218,6 +1224,7 @@ struct ipr_hcam { #define IPR_HOST_RCB_OVERLAY_ID_24 0x24 #define IPR_HOST_RCB_OVERLAY_ID_26 0x26 #define IPR_HOST_RCB_OVERLAY_ID_30 0x30 +#define IPR_HOST_RCB_OVERLAY_ID_41 0x41 #define IPR_HOST_RCB_OVERLAY_ID_DEFAULT 0xFF u8 reserved1[3]; -- 1.6.0.2 |
From: <wen...@li...> - 2018-05-09 19:33:49
|
From: Wen Xiong <wen...@li...> This patch adds new adapter error log for P9 system with the new AZ SAS cable. Signed-off-by: Wen Xiong <wen...@li...> Acked-by: Brian King <br...@li...> --- drivers/scsi/ipr.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index dda1a64..6615ad8 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c @@ -435,6 +435,8 @@ struct ipr_error_table_t ipr_error_table[] = { "4080: IOA exceeded maximum operating temperature"}, {0x060B8000, 0, IPR_DEFAULT_LOG_LEVEL, "4085: Service required"}, + {0x060B8100, 0, IPR_DEFAULT_LOG_LEVEL, + "4086: SAS Adapter Hardware Configuration Error"}, {0x06288000, 0, IPR_DEFAULT_LOG_LEVEL, "3140: Device bus not ready to ready transition"}, {0x06290000, 0, IPR_DEFAULT_LOG_LEVEL, -- 1.6.0.2 |
From: Brian K. <br...@li...> - 2018-05-08 20:12:20
|
While attempting to further optimize show-details performance, it was observed that get_drive_phy_loc was iterating over all ioa's, even though a specific ioa is passed into the function. On large configurations, this resulted in show-details taking longer than 5 seconds. If we remove this redundant code, show-details will now complete in less than 1 second in a similar configuration. Signed-off-by: Brian King <br...@li...> --- iprconfig.c | 94 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 46 insertions(+), 48 deletions(-) diff --git a/iprconfig.c b/iprconfig.c index 9f4f61f..6a5fd21 100644 --- a/iprconfig.c +++ b/iprconfig.c @@ -17780,66 +17780,64 @@ static int get_drive_phy_loc(struct ipr_ioa *ioa) char phy_loc[PHYSICAL_LOCATION_LENGTH + 1]; int times, index; - for_each_ioa(ioa) { - is_spi = ioa_is_spi(ioa); + is_spi = ioa_is_spi(ioa); - for_each_hotplug_dev(ioa, dev) { - if (ioa->sis64) - get_res_path(dev); - else - get_res_addrs(dev); - } + for_each_hotplug_dev(ioa, dev) { + if (ioa->sis64) + get_res_path(dev); + else + get_res_addrs(dev); + } - for_each_ses(ioa, ses) { - times = 5; - if (strlen(ses->physical_location) == 0) - get_ses_phy_loc(ses); - while (times--) { - if (!ipr_receive_diagnostics(ses, 2, &ses_data, sizeof(ses_data))) - break; - } - if (times < 0 ) continue; + for_each_ses(ioa, ses) { + times = 5; + if (strlen(ses->physical_location) == 0) + get_ses_phy_loc(ses); + while (times--) { + if (!ipr_receive_diagnostics(ses, 2, &ses_data, sizeof(ses_data))) + break; + } + if (times < 0 ) continue; - if (ipr_receive_diagnostics(ses, 1, &ses_cfg, sizeof(ses_cfg))) - continue; + if (ipr_receive_diagnostics(ses, 1, &ses_cfg, sizeof(ses_cfg))) + continue; - if (ipr_receive_diagnostics(ses, 7, &drive_data, sizeof(drive_data))) - continue; + if (ipr_receive_diagnostics(ses, 7, &drive_data, sizeof(drive_data))) + continue; - overall = ipr_get_overall_elem(&ses_data, &ses_cfg); - ses_bus = ses->scsi_dev_data->channel; - scsi_id_found = 0; + overall = ipr_get_overall_elem(&ses_data, &ses_cfg); + ses_bus = ses->scsi_dev_data->channel; + scsi_id_found = 0; - if (!is_spi && (overall->device_environment == 0)) - is_vses = 1; - else - is_vses = 0; + if (!is_spi && (overall->device_environment == 0)) + is_vses = 1; + else + is_vses = 0; - scsi_dbg(ses, "%s\n", is_vses ? "Found VSES" : "Found real SES"); + scsi_dbg(ses, "%s\n", is_vses ? "Found VSES" : "Found real SES"); - for_each_elem_status(elem_status, &ses_data, &ses_cfg) { - index = index_in_page2(&ses_data, elem_status->slot_id); - if (index != -1) - get_drive_phy_loc_with_ses_phy_loc(ses, &drive_data, index, phy_loc, 0); - - if (elem_status->status == IPR_DRIVE_ELEM_STATUS_UNSUPP) - continue; - if (elem_status->status == IPR_DRIVE_ELEM_STATUS_NO_ACCESS) - continue; - if (is_spi && (scsi_id_found & (1 << elem_status->slot_id))) - continue; - scsi_id_found |= (1 << elem_status->slot_id); + for_each_elem_status(elem_status, &ses_data, &ses_cfg) { + index = index_in_page2(&ses_data, elem_status->slot_id); + if (index != -1) + get_drive_phy_loc_with_ses_phy_loc(ses, &drive_data, index, phy_loc, 0); - if (ioa->sis64) - dev = get_dev_for_slot_64bit(ses, elem_status->slot_id, phy_loc); - else - dev = get_dev_for_slot(ses, elem_status->slot_id, is_vses, phy_loc); - if (!dev) - continue; + if (elem_status->status == IPR_DRIVE_ELEM_STATUS_UNSUPP) + continue; + if (elem_status->status == IPR_DRIVE_ELEM_STATUS_NO_ACCESS) + continue; + if (is_spi && (scsi_id_found & (1 << elem_status->slot_id))) + continue; + scsi_id_found |= (1 << elem_status->slot_id); - } + if (ioa->sis64) + dev = get_dev_for_slot_64bit(ses, elem_status->slot_id, phy_loc); + else + dev = get_dev_for_slot(ses, elem_status->slot_id, is_vses, phy_loc); + if (!dev) + continue; } + } return 0; } -- 1.8.3.1 |
From: Brian K. <br...@li...> - 2018-05-08 16:38:26
|
On 04/25/2018 05:40 PM, wen...@li... wrote: > From: Wen Xiong <wen...@li...> > > This patch adds new adapter error log for P9 system with the new > AZ SAS cable. > --- > drivers/scsi/ipr.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c > index dda1a64..6615ad8 100644 > --- a/drivers/scsi/ipr.c > +++ b/drivers/scsi/ipr.c > @@ -435,6 +435,8 @@ struct ipr_error_table_t ipr_error_table[] = { > "4080: IOA exceeded maximum operating temperature"}, > {0x060B8000, 0, IPR_DEFAULT_LOG_LEVEL, > "4085: Service required"}, > + {0x060B8100, 0, IPR_DEFAULT_LOG_LEVEL, > + "4086: SAS Adapter Hardware Configuration Error"}, > {0x06288000, 0, IPR_DEFAULT_LOG_LEVEL, > "3140: Device bus not ready to ready transition"}, > {0x06290000, 0, IPR_DEFAULT_LOG_LEVEL, > Acked-by: Brian King <br...@li...> Please go ahead and send to linux-scsi Thanks, Brian -- Brian King Power Linux I/O IBM Linux Technology Center |
From: <wen...@li...> - 2018-04-25 23:44:12
|
From: Wen Xiong <wen...@li...> This patch adds new adapter error log for P9 system with the new AZ SAS cable. --- drivers/scsi/ipr.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index dda1a64..6615ad8 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c @@ -435,6 +435,8 @@ struct ipr_error_table_t ipr_error_table[] = { "4080: IOA exceeded maximum operating temperature"}, {0x060B8000, 0, IPR_DEFAULT_LOG_LEVEL, "4085: Service required"}, + {0x060B8100, 0, IPR_DEFAULT_LOG_LEVEL, + "4086: SAS Adapter Hardware Configuration Error"}, {0x06288000, 0, IPR_DEFAULT_LOG_LEVEL, "3140: Device bus not ready to ready transition"}, {0x06290000, 0, IPR_DEFAULT_LOG_LEVEL, -- 1.6.0.2 |
From: Brian K. <br...@li...> - 2018-04-25 22:45:31
|
Applied. Thanks, Brian -- Brian King Power Linux I/O IBM Linux Technology Center |
From: <wen...@li...> - 2018-04-13 16:39:25
|
From: Wen Xiong <wen...@li...> When creating the arrays with RI and non-RI ssd disks, this patch improves the error message in GUI and command line. Signed-off-by: Wen Xiong <wen...@li...> --- iprconfig.c | 27 ++++++++++++++++++++++++++- iprconfig.h | 2 ++ 2 files changed, 28 insertions(+), 1 deletions(-) diff --git a/iprconfig.c b/iprconfig.c index 5da12cc..7f37387 100644 --- a/iprconfig.c +++ b/iprconfig.c @@ -4102,6 +4102,7 @@ int confirm_raid_start(i_container *i_con) int header_lines; int toggle = 0; struct screen_output *s_out; + int is_ri_count = 0, non_ri_count = 0; rc = RC_SUCCESS; @@ -4113,12 +4114,24 @@ int confirm_raid_start(i_container *i_con) print_dev(k, cur_raid_cmd->dev, buffer, "1", k); for_each_af_dasd(ioa, dev) { - if (dev->dev_rcd->issue_cmd) + if (dev->dev_rcd->issue_cmd) { print_dev(k, dev, buffer, "1", k); + if (dev->block_dev_class & IPR_SSD) { + if (dev->read_intensive & IPR_RI) + is_ri_count++; + else + non_ri_count++; + } + } } } } + if (is_ri_count > 0 && non_ri_count > 0) { + rc = RC_95_Mixed_RISSD_SSDs; + return rc; + } + toggle_field = 0; do { @@ -14115,6 +14128,7 @@ static int raid_create(char **args, int num_args) { int i, num_devs = 0, ssd_num_devs = 0, rc, prot_level; int non_4k_count = 0, is_4k_count = 0; + int non_ri_count = 0, is_ri_count = 0; int next_raid_level, next_stripe_size, next_qdepth, next_label; char *raid_level = IPR_DEFAULT_RAID_LVL; char label[8]; @@ -14210,6 +14224,12 @@ static int raid_create(char **args, int num_args) is_4k_count++; else non_4k_count++; + + if (dev->block_dev_class & IPR_SSD) + if (dev->read_intensive & IPR_RI) + is_ri_count++; + else + non_ri_count++; } if (is_4k_count > 0 && non_4k_count > 0) { @@ -14217,6 +14237,11 @@ static int raid_create(char **args, int num_args) return -EINVAL; } + if (is_ri_count > 0 && non_ri_count > 0) { + syslog(LOG_ERR, _("SSD disks and RI SSD disks can not be mixed in an array.\n")); + return -EINVAL; + } + if (!ioa) { syslog(LOG_ERR, _("No valid devices specified.\n")); return -EINVAL; diff --git a/iprconfig.h b/iprconfig.h index a6f6e75..ff6dd02 100644 --- a/iprconfig.h +++ b/iprconfig.h @@ -1717,6 +1717,7 @@ const char *screen_status[] = { /* 92 */ __("Create disk array failed - can not build with read intensive disks only."), /* 93 */ __("All devices up to date"), /* 94 */ __("Temporary log file creation failed: %s"), + /* 95 */ __("Create disk array failed - can not mix SSDs and RI SSDs."), /* NOTE: 127 maximum limit */ }; @@ -1818,6 +1819,7 @@ enum { RC_92_UNSUPT_REQ_BLK_DEV_CLASS, RC_93_All_Up_To_Date, RC_94_Tmp_Log_Fail, + RC_95_Mixed_RISSD_SSDs, /* NOTE: 127 maximum limit */ }; -- 1.6.0.2 |
From: Wen X. <wen...@us...> - 2018-03-15 19:00:20
|
Probably need to check for P8 and P9. Thanks, Wendy From: Brian King <br...@li...> To: wen...@li..., ipr...@li... Cc: Wen Xiong/Austin/IBM@IBMUS Date: 03/15/2018 01:44 PM Subject: Re: [Iprdd-devel] [PATCH] iprutils: Remove the Analyze Log in main menu On 03/14/2018 03:28 PM, wen...@li... wrote: > From: Wen Xiong <wen...@li...> > > iprconfig Analyze log is broken in most distros are moving towards > using journalctl for viewing the system logs. This patch removes > the Analze log in iprconfig. This looks good. Thanks for doing this. Prior to getting this into a release we'll need to update the reference guide to remove reference to this option. Can you look into that? Thanks, Brian -- Brian King Power Linux I/O IBM Linux Technology Center |
From: Brian K. <br...@li...> - 2018-03-15 18:44:32
|
On 03/14/2018 03:28 PM, wen...@li... wrote: > From: Wen Xiong <wen...@li...> > > iprconfig Analyze log is broken in most distros are moving towards > using journalctl for viewing the system logs. This patch removes > the Analze log in iprconfig. This looks good. Thanks for doing this. Prior to getting this into a release we'll need to update the reference guide to remove reference to this option. Can you look into that? Thanks, Brian -- Brian King Power Linux I/O IBM Linux Technology Center |
From: <wen...@li...> - 2018-03-14 21:30:43
|
From: Wen Xiong <wen...@li...> iprconfig Analyze log is broken in most distros are moving towards using journalctl for viewing the system logs. This patch removes the Analze log in iprconfig. Signed-off-by: Wen Xiong <wen...@li...> --- iprconfig.c | 761 ----------------------------------------------------------- iprconfig.h | 112 --------- 2 files changed, 0 insertions(+), 873 deletions(-) diff --git a/iprconfig.c b/iprconfig.c index 5da12cc..1108248 100644 --- a/iprconfig.c +++ b/iprconfig.c @@ -12108,767 +12108,6 @@ int ucode_screen(i_container *i_con) return display_features_menu(i_con, &n_ucode_screen); } -/** -* log_menu - -* @i_con: i_container struct -* -* Returns: -* 0 if success / non-zero on failure FIXME -**/ -int log_menu(i_container *i_con) -{ - char cmnd[MAX_CMD_LENGTH]; - int rc, loop; - struct stat file_stat; - struct screen_output *s_out; - int offset = 0; - - sprintf(cmnd,"%s/boot.msg",log_root_dir); - rc = stat(cmnd, &file_stat); - - if (rc) - /* file does not exist - do not display option */ - offset--; - - for (loop = 0; loop < (n_log_menu.num_opts + offset); loop++) { - n_log_menu.body = ipr_list_opts(n_log_menu.body, - n_log_menu.options[loop].key, - n_log_menu.options[loop].list_str); - } - n_log_menu.body = ipr_end_list(n_log_menu.body); - - s_out = screen_driver(&n_log_menu, 0, NULL); - free(n_log_menu.body); - n_log_menu.body = NULL; - rc = s_out->rc; - i_con = s_out->i_con; - i_con = free_i_con(i_con); - free(s_out); - return rc; -} - -static int invoke_pager(char *filename) -{ - int pid, status; - char *argv[] = { - DEFAULT_EDITOR, "-c", - filename, NULL - }; - - pid = fork(); - if (pid) { - waitpid(pid, &status, 0); - } else { - /* disable insecure pager features */ - putenv("LESSSECURE=1"); - execvp(argv[0], argv); - _exit(errno); - } - return WEXITSTATUS(status); -} - -#define EDITOR_MAX_ARGS 32 -static int invoke_editor(char* filename) -{ - int i; - int rc, pid, status; - - /* if editor not set, use secure pager */ - if (strcmp(editor, DEFAULT_EDITOR) == 0) { - rc = invoke_pager(filename); - return rc; - } - - pid = fork(); - if (pid == 0) { - char *tok; - char *argv[EDITOR_MAX_ARGS]; - char cmnd[MAX_CMD_LENGTH]; - - /* copy editor name to argv[0] */ - strncpy(cmnd, editor, sizeof(cmnd) - 1); - tok = strtok(cmnd, " "); - argv[0] = malloc(strlen(tok)); - strcpy(argv[0], tok); - - /* handle editor arguments, if any */ - for (i = 1; i < EDITOR_MAX_ARGS - 2; ++i) { - tok = strtok(NULL, " "); - if (tok == NULL) - break; - argv[i] = malloc(strlen(tok)); - strcpy(argv[i], tok); - } - argv[i] = filename; - argv[i+1] = NULL; - - execvp(argv[0], argv); - _exit(errno); - } else { - waitpid(pid, &status, 0); - } - - return WEXITSTATUS(status); -} - -/** - * ibm_storage_log_tail - - * @i_con: i_container struct - * - * Returns: - * 0 on success / non-zero on failure - **/ -int ibm_storage_log_tail(i_container *i_con) -{ - int rc, len; - int log_fd; - char line[MAX_CMD_LENGTH]; - char logfile[MAX_CMD_LENGTH]; - char *tmp_log; - FILE *logsource_fp; - - /* aux variables for erasing unnecessary log info */ - const char *local_s = "localhost kernel: ipr"; - const char *kernel_s = "kernel: ipr"; - char prefix[256]; - char host[256]; - char *dot; - - tmp_log = strdup(_PATH_TMP"iprerror-XXXXXX"); - log_fd = mkstemp(tmp_log); - if (log_fd < 0) { - s_status.str = strerror(errno); - syslog(LOG_ERR, "Could not create tmp log file: %m\n"); - free(tmp_log); - return RC_94_Tmp_Log_Fail; - } - - def_prog_mode(); - endwin(); - - snprintf(logfile, sizeof(logfile), "%s/messages", log_root_dir); - logsource_fp = fopen(logfile, "r"); - if (!logsource_fp) { - syslog(LOG_ERR, "Could not open %s: %m\n", logfile); - free(tmp_log); - close(log_fd); - return RC_75_Failed_Read_Err_Log; - } - - while (fgets(line, sizeof(line), logsource_fp)) { - /* ignore lines that dont contain 'ipr' */ - if (strstr(line, "ipr") == NULL) - continue; - - /* build prefix using current hostname */ - gethostname(host, sizeof(host)); - dot = strchr(host, '.'); - if (dot) - *dot = '\0'; - snprintf(prefix, sizeof(prefix), "%s kernel: ipr", host); - - /* erase prefix, local_s and kernel_s from line: - * dot+strlen points to beginning of prefix - * strlen(dot) - strlen(prefix) + 1 == size of the rest of line - * - * code below moves 'rest of line' on top of prefix et al. */ - if (dot = strstr(line, prefix)) { - memmove(dot, dot + strlen(prefix), - strlen(dot) - strlen(prefix) + 1); - } else if (dot = strstr(line, local_s)) { - memmove(dot, dot+strlen(local_s), - strlen(dot) - strlen(local_s) + 1); - } else if (dot = strstr(line, kernel_s)) { - memmove(dot, dot+strlen(kernel_s), - strlen(dot) - strlen(kernel_s) + 1); - } - - write(log_fd, line, strlen(line)); - } - - fclose(logsource_fp); - close(log_fd); - rc = invoke_editor(tmp_log); - free(tmp_log); - - if ((rc != 0) && (rc != 127)) { - /* "Editor returned %d. Try setting the default editor" */ - s_status.num = rc; - return RC_65_Set_Default_Editor; - } else { - /* return with success */ - return RC_0_Success; - } -} - -/** - * select_log_file - - * @dir_entry: dirent struct - * - * Returns: - * 1 if "messages" if found in the dir_entry->d_name / 0 otherwise - **/ -static int select_log_file(const struct dirent *dir_entry) -{ - if (dir_entry) { - if (strstr(dir_entry->d_name, "messages") == dir_entry->d_name) - return 1; - } - return 0; -} - -/** - * compare_log_file - - * @log_file1: - * @log_file2: - * - * Returns: - * 0 if success / non-zero on failure FIXME - **/ -static int compare_log_file(const struct dirent **first_dir, const struct dirent **second_dir) -{ - char name1[MAX_CMD_LENGTH], name2[MAX_CMD_LENGTH]; - struct stat stat1, stat2; - - if (strcmp((*first_dir)->d_name, "messages") == 0) - return 1; - if (strcmp((*second_dir)->d_name, "messages") == 0) - return -1; - - sprintf(name1, "%s/%s", log_root_dir, (*first_dir)->d_name); - sprintf(name2, "%s/%s", log_root_dir, (*second_dir)->d_name); - - if (stat(name1, &stat1)) - return 1; - if (stat(name2, &stat2)) - return -1; - - if (stat1.st_mtime < stat2.st_mtime) - return -1; - if (stat1.st_mtime > stat2.st_mtime) - return 1; - return 0; -} - -/** - * ibm_storage_log - - * @i_con: i_container struct - * - * Returns: - * 0 on success / non-zero on failure FIXME - **/ -int ibm_storage_log(i_container *i_con) -{ - char line[MAX_CMD_LENGTH]; - char logfile[MAX_CMD_LENGTH]; - int i; - struct dirent **log_files; - struct dirent **dirent; - int num_dir_entries; - int rc, len; - int log_fd; - char *tmp_log; - gzFile logsource_fp; - - /* aux variables for erasing unnecessary log info */ - const char *local_s = "localhost kernel: ipr"; - const char *kernel_s = "kernel: ipr"; - char prefix[256]; - char host[256]; - char *dot; - - tmp_log = strdup(_PATH_TMP"iprerror-XXXXXX"); - log_fd = mkstemp(tmp_log); - if (log_fd < 0) { - s_status.str = strerror(errno); - syslog(LOG_ERR, "Could not create tmp log file: %m\n"); - free(tmp_log); - return RC_94_Tmp_Log_Fail; - } - - def_prog_mode(); - endwin(); - - num_dir_entries = scandir(log_root_dir, &log_files, select_log_file, compare_log_file); - if (num_dir_entries < 0) { - s_status.num = 75; - return RC_75_Failed_Read_Err_Log; - } - - if (num_dir_entries) - dirent = log_files; - - for (i = 0; i < num_dir_entries; ++i) { - snprintf(logfile, sizeof(logfile), "%s/%s", log_root_dir, - (*dirent)->d_name); - logsource_fp = gzopen(logfile, "r"); - if (logsource_fp == NULL) { - syslog(LOG_ERR, "Could not open %s: %m\n", line); - close(log_fd); - continue; /* proceed to next log file */ - } - - while (gzgets(logsource_fp, line, sizeof(line))) { - /* ignore lines that dont contain 'ipr' */ - if (strstr(line, "ipr") == NULL) - continue; - - gethostname(host, sizeof(host)); - dot = strchr(host, '.'); - if (dot) - *dot = '\0'; - snprintf(prefix, sizeof(prefix), "%s kernel: ipr", - host); - - /* erase prefix, local_s and kernel_s from line: - * dot+strlen points to beginning of prefix - * strlen(dot) - strlen(prefix) + 1 == - * size of the rest of line - * - * code below moves 'rest of line' on top of prefix */ - if (dot = strstr(line, prefix)) { - memmove(dot, dot + strlen(prefix), - strlen(dot) - strlen(prefix) + 1); - } else if (dot = strstr(line, local_s)) { - memmove(dot, dot + strlen(local_s), - strlen(dot) - strlen(local_s) + 1); - } else if (dot = strstr(line, kernel_s)) { - memmove(dot, dot + strlen(kernel_s), - strlen(dot) - strlen(kernel_s) + 1); - } - - write(log_fd, line, strlen(line)); - } - gzclose(logsource_fp); - dirent++; - } - - close(log_fd); - rc = invoke_editor(tmp_log); - free(tmp_log); - - if (num_dir_entries) { - while (num_dir_entries--) - free(log_files[num_dir_entries]); - free(log_files); - } - - if ((rc != 0) && (rc != 127)) { - /* "Editor returned %d. Try setting the default editor" */ - s_status.num = rc; - return RC_65_Set_Default_Editor; - } else { - /* return with success */ - return RC_0_Success; - } -} - -/** - * kernel_log - - * @i_con: i_container struct - * - * Returns: - * 0 if success / non-zero on failure FIXME - **/ -int kernel_log(i_container *i_con) -{ - char line[MAX_CMD_LENGTH]; - char logfile[MAX_CMD_LENGTH]; - int rc, i; - struct dirent **log_files; - struct dirent **dirent; - int num_dir_entries; - int len; - int log_fd; - char *tmp_log; - gzFile logsource_fp; - - tmp_log = strdup(_PATH_TMP"iprerror-XXXXXX"); - log_fd = mkstemp(tmp_log); - if (log_fd < 0) { - s_status.str = strerror(errno); - syslog(LOG_ERR, "Could not create tmp log file: %m\n"); - free(tmp_log); - return RC_94_Tmp_Log_Fail; - } - - def_prog_mode(); - endwin(); - - num_dir_entries = scandir(log_root_dir, &log_files, select_log_file, compare_log_file); - if (num_dir_entries < 0) { - s_status.num = 75; - return RC_75_Failed_Read_Err_Log; - } - - if (num_dir_entries) - dirent = log_files; - - for (i = 0; i < num_dir_entries; ++i) { - snprintf(logfile, sizeof(logfile), "%s/%s", log_root_dir, - (*dirent)->d_name); - logsource_fp = gzopen(logfile, "r"); - if (logsource_fp == NULL) { - syslog(LOG_ERR, "Could not open %s: %m\n", line); - close(log_fd); - continue; /* proceed to next log file */ - } - - while (gzgets(logsource_fp, line, sizeof(line))) - write(log_fd, line, strlen(line)); - gzclose(logsource_fp); - dirent++; - } - - close(log_fd); - rc = invoke_editor(tmp_log); - free(tmp_log); - - if (num_dir_entries > 0) { - while (num_dir_entries--) - free(log_files[num_dir_entries]); - free(log_files); - } - - if ((rc != 0) && (rc != 127)) { - /* "Editor returned %d. Try setting the default editor" */ - s_status.num = rc; - return RC_65_Set_Default_Editor; - } - else { - /* return with success */ - return RC_0_Success; - } -} - -/** - * iprconfig_log - - * @i_con: i_container struct - * - * Returns: - * 0 if success / non-zero on failure FIXME - **/ -int iprconfig_log(i_container *i_con) -{ - char line[MAX_CMD_LENGTH]; - char logfile[MAX_CMD_LENGTH]; - int rc, i; - struct dirent **log_files; - struct dirent **dirent; - int num_dir_entries; - int len; - int log_fd; - char *tmp_log; - gzFile logsource_fp; - - tmp_log = strdup(_PATH_TMP"iprerror-XXXXXX"); - log_fd = mkstemp(tmp_log); - if (log_fd < 0) { - s_status.str = strerror(errno); - syslog(LOG_ERR, "Could not create tmp log file: %m\n"); - free(tmp_log); - return RC_94_Tmp_Log_Fail; - } - - def_prog_mode(); - endwin(); - - num_dir_entries = scandir(log_root_dir, &log_files, select_log_file, compare_log_file); - if (num_dir_entries < 0) { - s_status.num = 75; - return RC_75_Failed_Read_Err_Log; - } - - if (num_dir_entries) - dirent = log_files; - - for (i = 0; i < num_dir_entries; ++i) { - snprintf(logfile, sizeof(logfile), "%s/%s", log_root_dir, - (*dirent)->d_name); - logsource_fp = gzopen(logfile, "r"); - if (logsource_fp == NULL) { - syslog(LOG_ERR, "Could not open %s: %m\n", line); - close(log_fd); - continue; /* proceed to next log file */ - } - - while (gzgets(logsource_fp, line, sizeof(line))) { - /* ignore lines that dont contain 'iprconfig' */ - if (strstr(line, "iprconfig") == NULL) - continue; - write(log_fd, line, strlen(line)); - } - gzclose(logsource_fp); - dirent++; - } - - close(log_fd); - rc = invoke_editor(tmp_log); - free(tmp_log); - - if (num_dir_entries) { - while (num_dir_entries--) - free(log_files[num_dir_entries]); - free(log_files); - } - - if ((rc != 0) && (rc != 127)) { - /* "Editor returned %d. Try setting the default editor" */ - s_status.num = rc; - return RC_65_Set_Default_Editor; - } else { - /* return with success */ - return RC_0_Success; - } -} - -/** - * kernel_root - - * @i_con: i_container struct - * - * Returns: - * 0 if success / non-zero on failure FIXME - **/ -int kernel_root(i_container *i_con) -{ - int rc; - struct screen_output *s_out; - char *body = NULL; - - i_con = free_i_con(i_con); - - /* i_con to return field data */ - i_con = add_i_con(i_con,"",NULL); - - body = body_init(n_kernel_root.header, NULL); - body = add_line_to_body(body,_("Current root directory"), log_root_dir); - body = add_line_to_body(body,_("New root directory"), "%39"); - - n_kernel_root.body = body; - s_out = screen_driver(&n_kernel_root, 0, i_con); - - free(n_kernel_root.body); - n_kernel_root.body = NULL; - rc = s_out->rc; - free(s_out); - - return rc; -} - -/** - * confirm_kernel_root - - * @i_con: i_container struct - * - * Returns: - * 0 if success / non-zero on failure FIXME - **/ -int confirm_kernel_root(i_container *i_con) -{ - int rc; - DIR *dir; - char *input; - struct screen_output *s_out; - char *body = NULL; - - input = strip_trailing_whitespace(i_con->field_data); - if (strlen(input) == 0) - return (EXIT_FLAG | 61); - - dir = opendir(input); - - if (dir == NULL) - /* "Invalid directory" */ - return 59; - else { - closedir(dir); - if (strcmp(log_root_dir, input) == 0) - /*"Root directory unchanged"*/ - return (EXIT_FLAG | 61); - } - - body = body_init(n_confirm_kernel_root.header, NULL); - body = add_line_to_body(body,_("New root directory"), input); - - n_confirm_kernel_root.body = body; - s_out = screen_driver(&n_confirm_kernel_root, 0, i_con); - - free(n_confirm_kernel_root.body); - n_confirm_kernel_root.body = NULL; - - rc = s_out->rc; - if (rc == 0) { - /*"Root directory changed to %s"*/ - strcpy(log_root_dir, i_con->field_data); - s_status.str = log_root_dir; - rc = (EXIT_FLAG | 60); - } - - else - /*"Root directory unchanged"*/ - rc = (EXIT_FLAG | 61); - - free(s_out); - return rc; -} - -/** - * set_default_editor - - * @i_con: i_container struct - * - * Returns: - * 0 if success / non-zero on failure FIXME - **/ -int set_default_editor(i_container *i_con) -{ - int rc = 0; - struct screen_output *s_out; - char *body = NULL; - - i_con = free_i_con(i_con); - i_con = add_i_con(i_con,"",NULL); - - body = body_init(n_set_default_editor.header, NULL); - body = add_line_to_body(body, _("Current editor"), editor); - body = add_line_to_body(body, _("New editor"), "%39"); - - n_set_default_editor.body = body; - s_out = screen_driver(&n_set_default_editor, 0, i_con); - - free(n_set_default_editor.body); - n_set_default_editor.body = NULL; - rc = s_out->rc; - free(s_out); - - return rc; -} - -/** - * confirm_set_default_editor - - * @i_con: i_container struct - * - * Returns: - * EXIT_FLAG | 62 if editor changed / EXIT_FLAG | 63 if editor unchanged - **/ -int confirm_set_default_editor(i_container *i_con) -{ - int rc; - char *input; - struct screen_output *s_out; - char *body = NULL; - - input = strip_trailing_whitespace(i_con->field_data); - if (strlen(input) == 0) - /*"Editor unchanged"*/ - return (EXIT_FLAG | 63); - - if (strcmp(editor, input) == 0) - /*"Editor unchanged"*/ - return (EXIT_FLAG | 63); - - body = body_init(n_confirm_set_default_editor.header, NULL); - body = add_line_to_body(body,_("New editor"), input); - - n_confirm_set_default_editor.body = body; - s_out = screen_driver(&n_confirm_set_default_editor, 0, i_con); - - free(n_confirm_set_default_editor.body); - n_confirm_set_default_editor.body = NULL; - - rc = s_out->rc; - if (rc == 0) { - /*"Editor changed to %s"*/ - strcpy(editor, i_con->field_data); - s_status.str = editor; - rc = (EXIT_FLAG | 62); - } else - /*"Editor unchanged"*/ - rc = (EXIT_FLAG | 63); - - free(s_out); - return rc; -} - -/** - * restore_log_defaults - - * @i_con: i_container struct - * - * Returns: - * 64 - **/ -int restore_log_defaults(i_container *i_con) -{ - strcpy(log_root_dir, DEFAULT_LOG_DIR); - strcpy(editor, DEFAULT_EDITOR); - return 64; /*"Default log values restored"*/ -} - -/** - * ibm_boot_log - - * @i_con: i_container struct - * - * Returns: - * 0 if success / non-zero on failure FIXME - **/ -int ibm_boot_log(i_container *i_con) -{ - char line[MAX_CMD_LENGTH]; - char logfile[MAX_CMD_LENGTH]; - int rc; - int len; - struct stat file_stat; - int log_fd; - char *tmp_log; - FILE *logsource_fp; - - sprintf(line,"%s/boot.msg",log_root_dir); - rc = stat(line, &file_stat); - if (rc) - return 2; /* "Invalid option specified" */ - - tmp_log = strdup(_PATH_TMP"iprerror-XXXXXX"); - log_fd = mkstemp(tmp_log); - if (log_fd < 0) { - s_status.str = strerror(errno); - syslog(LOG_ERR, "Could not create temp log file: %m\n"); - free(tmp_log); - return RC_94_Tmp_Log_Fail; - } - - def_prog_mode(); - endwin(); - - snprintf(logfile, sizeof(logfile), "%s/boot.msg", log_root_dir); - logsource_fp = fopen(logfile, "r"); - if (!logsource_fp) { - syslog(LOG_ERR, "Could not open %s: %m\n", line); - free(tmp_log); - close(log_fd); - return RC_75_Failed_Read_Err_Log; - } - - while (fgets(line, sizeof(line), logsource_fp)) { - /* ignore lines that dont contain 'ipr' */ - if (strstr(line, "ipr") == NULL) - continue; - - write(log_fd, line, strlen(line)); - } - - fclose(logsource_fp); - close(log_fd); - rc = invoke_editor(tmp_log); - free(tmp_log); - - if ((rc != 0) && (rc != 127)) { - /* "Editor returned %d. Try setting the default editor" */ - s_status.num = rc; - return RC_65_Set_Default_Editor; - } else { - /* return with no status */ - return RC_0_Success; - } -} - int get_ses_ioport_status(struct ipr_dev *ses) { struct ipr_query_io_port io_status; diff --git a/iprconfig.h b/iprconfig.h index a6f6e75..d8b76fe 100644 --- a/iprconfig.h +++ b/iprconfig.h @@ -138,21 +138,6 @@ int ucode_screen(i_container *i_con); int download_ucode(i_container *); int download_all_ucode(i_container *); int choose_ucode(i_container *); -int log_menu(i_container *); -int ibm_storage_log_tail(i_container *); -int ibm_storage_log(i_container *); -int kernel_log(i_container *); -int iprconfig_log(i_container *); -int kernel_root(i_container *); -int confirm_kernel_root(i_container *); -int confirm_kernel_root_change(i_container *); -int confirm_kernel_root_change2(i_container *); -int set_default_editor(i_container *); -int confirm_set_default_editor(i_container *); -int confirm_set_default_editor_change(i_container *); -int confirm_set_default_editor_change2(i_container *); -int restore_log_defaults(i_container *); -int ibm_boot_log(i_container *); int exit_confirmed(i_container *); int statistics_menu(i_container *); @@ -197,7 +182,6 @@ struct screen_opts main_menu_opt[] = { {config_menu, "4", __("Work with configuration options")}, {ucode_screen, "5", __("Work with microcode updates")}, {statistics_menu, "6", __("Devices Statistics")}, - {log_menu, "7", __("Analyze log")} }; s_node n_main_menu = { @@ -1512,102 +1496,6 @@ s_node n_download_ucode_in_progress = { "" } }; -struct screen_opts log_menu_opt[] = { - {ibm_storage_log_tail, "1", __("View most recent ipr error messages")}, - {ibm_storage_log, "2", __("View ipr error messages")}, - {kernel_log, "3", __("View all kernel error messages")}, - {iprconfig_log, "4", __("View iprconfig error messages")}, - {kernel_root, "5", __("Set root kernel message log directory")}, - {set_default_editor, "6", __("Set default editor")}, - {restore_log_defaults, "7", __("Restore defaults")}, - {ibm_boot_log, "8", __("View ipr boot time messages")} -}; - -s_node n_log_menu = { - .rc_flags = (EXIT_FLAG | CANCEL_FLAG | REFRESH_FLAG), - .f_flags = (EXIT_FLAG | CANCEL_FLAG), - .num_opts = NUM_OPTS(log_menu_opt), - .options = &log_menu_opt[0], - .title = __("Kernel Messages Log"), - .header = { - __("ATTENTION: Devices listed below are currently known to be zeroed. " - "By exiting now, this information will be lost, resulting in potentially " - "longer array creation times.\n\n"), - __(" q=Cancel to return to iprconfig.\n"), - __(" e=Exit iprconfig\n") - } -}; - -s_node n_exit_menu = { - .rc_flags = (EXIT_FLAG | CANCEL_FLAG), - .f_flags = (EXIT_FLAG | CANCEL_FLAG), - .num_opts = NUM_OPTS(log_menu_opt), - .options = &null_opt[0], - .title = __("Confirm Exit") -}; - -struct screen_opts kernel_root_opt[] = { - {confirm_kernel_root, "\n"} -}; - -s_node n_kernel_root = { - .f_flags = (ENTER_FLAG), - .num_opts = NUM_OPTS(kernel_root_opt), - .options = &kernel_root_opt[0], - .title = __("Kernel Messages Log Root Directory"), - .header = { - __("Enter new directory and press Enter\n\n"), - "" } -}; - -struct screen_opts confirm_kernel_root_opt[] = { - {NULL, "c"}, -}; - -s_node n_confirm_kernel_root = { - .f_flags = (CONFIRM_FLAG | CANCEL_FLAG), - .num_opts = NUM_OPTS(confirm_kernel_root_opt), - .options = &confirm_kernel_root_opt[0], - .title = __("Confirm Root Directory Change"), - .header = { - __("Press 'c' to confirm your new " - "kernel root directory choice.\n\n"), - __("To return to the log menu without " - "changing the root directory, choose 'q'.\n\n"), - "" } -}; - -struct screen_opts set_default_editor_opt[] = { - {confirm_set_default_editor, "\n"} -}; - -s_node n_set_default_editor = { - .f_flags = (ENTER_FLAG), - .num_opts = NUM_OPTS(set_default_editor_opt), - .options = &set_default_editor_opt[0], - .title = __("Kernel Messages Editor"), - .header = { - __("Enter new editor command and press Enter\n\n"), - "" } -}; - -struct screen_opts confirm_set_default_editor_opt[] = { - {NULL, "c"} -}; - -s_node n_confirm_set_default_editor = { - .f_flags = (CONFIRM_FLAG | CANCEL_FLAG), - .num_opts = NUM_OPTS(confirm_set_default_editor_opt), - .options = &confirm_set_default_editor_opt[0], - .title = __("Confirm Editor Change"), - .header = { - __("Press 'c' to confirm your editor choice\n\n"), - __("To return to the log menu without " - "changing the editor, choose 'q'.\n\n"), - "" } -}; - - struct screen_opts ucode_screen_opt[] = { {download_ucode, "1", __("Download microcode")}, {download_all_ucode, "2", __("Download latest microcode to all devices")}, -- 1.6.0.2 |
From: Brian K. <br...@li...> - 2017-11-16 21:13:59
|
On 11/16/2017 03:12 PM, Brian King wrote: > This fixes a regression that was introduced which broke the > iprconfig option to download microcode to all devices. Wendy, Can you try this as an alternate fix? It prevents us from having to duplicate some code. Thanks, Brian > > Fixes: bcfcda764d10 ("iprutils: Fix iprconfig dump option to log full IOA details") > Signed-off-by: Brian King <br...@li...> > --- > iprconfig.c | 4 ++-- > iprlib.h | 4 ++++ > 2 files changed, 6 insertions(+), 2 deletions(-) > > diff --git a/iprconfig.c b/iprconfig.c > index 11233cf..5da12cc 100644 > --- a/iprconfig.c > +++ b/iprconfig.c > @@ -11842,7 +11842,7 @@ int download_all_ucode(i_container *i_con) > if (!ioa->ioa.scsi_dev_data || ioa->ioa_dead) > continue; > > - for_each_dev (ioa, dev) { > + for_ioa_and_each_dev (ioa, dev) { > if (ipr_is_volume_set(dev)) > continue; > > @@ -15754,7 +15754,7 @@ static int update_all_ucodes(char **args, int num_args) > for_each_ioa(ioa) { > if (!ioa->ioa.scsi_dev_data) > continue; > - for_each_dev(ioa, dev) { > + for_ioa_and_each_dev(ioa, dev) { > if (ipr_is_volume_set(dev)) > continue; > > diff --git a/iprlib.h b/iprlib.h > index 4fe9823..f715522 100644 > --- a/iprlib.h > +++ b/iprlib.h > @@ -1594,6 +1594,10 @@ struct ipr_ioa { > > #define for_each_dev(i, d) for (d = (i)->dev; (d - (i)->dev) < (i)->num_devices; d++) > > +#define for_ioa_and_each_dev(i, d) for (d = &((i)->ioa); \ > + (d == &((i)->ioa)) || ((d - (i)->dev) < (i)->num_devices); \ > + d = (d == &((i)->ioa)) ? (i)->dev : d + 1) > + > #define for_each_hotplug_dev(i, d) \ > for_each_dev(i, d) \ > if (ipr_is_af_dasd_device(d) || ipr_is_gscsi(d)) > -- Brian King Power Linux I/O IBM Linux Technology Center |
From: Brian K. <br...@li...> - 2017-11-16 21:12:55
|
Fixes the sorting of microcode images from the filesystem on little endian systems so that when using the ncurses interface to download microcode, the latest version shows up as the top option. Signed-off-by: Brian King <br...@li...> --- iprlib.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/iprlib.c b/iprlib.c index 97653e4..bc4afe3 100644 --- a/iprlib.c +++ b/iprlib.c @@ -8369,8 +8369,11 @@ static int fw_compare(const void *parm1, struct ipr_fw_images *first = (struct ipr_fw_images *)parm1; struct ipr_fw_images *second = (struct ipr_fw_images *)parm2; - return memcmp(&second->version, &first->version, - sizeof(second->version)); + if (first->version < second->version) + return 1; + if (second->version > first->version) + return -1; + return 0; } /** -- 1.8.3.1 |
From: Brian K. <br...@li...> - 2017-11-16 21:12:52
|
This fixes a regression that was introduced which broke the iprconfig option to download microcode to all devices. Fixes: bcfcda764d10 ("iprutils: Fix iprconfig dump option to log full IOA details") Signed-off-by: Brian King <br...@li...> --- iprconfig.c | 4 ++-- iprlib.h | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/iprconfig.c b/iprconfig.c index 11233cf..5da12cc 100644 --- a/iprconfig.c +++ b/iprconfig.c @@ -11842,7 +11842,7 @@ int download_all_ucode(i_container *i_con) if (!ioa->ioa.scsi_dev_data || ioa->ioa_dead) continue; - for_each_dev (ioa, dev) { + for_ioa_and_each_dev (ioa, dev) { if (ipr_is_volume_set(dev)) continue; @@ -15754,7 +15754,7 @@ static int update_all_ucodes(char **args, int num_args) for_each_ioa(ioa) { if (!ioa->ioa.scsi_dev_data) continue; - for_each_dev(ioa, dev) { + for_ioa_and_each_dev(ioa, dev) { if (ipr_is_volume_set(dev)) continue; diff --git a/iprlib.h b/iprlib.h index 4fe9823..f715522 100644 --- a/iprlib.h +++ b/iprlib.h @@ -1594,6 +1594,10 @@ struct ipr_ioa { #define for_each_dev(i, d) for (d = (i)->dev; (d - (i)->dev) < (i)->num_devices; d++) +#define for_ioa_and_each_dev(i, d) for (d = &((i)->ioa); \ + (d == &((i)->ioa)) || ((d - (i)->dev) < (i)->num_devices); \ + d = (d == &((i)->ioa)) ? (i)->dev : d + 1) + #define for_each_hotplug_dev(i, d) \ for_each_dev(i, d) \ if (ipr_is_af_dasd_device(d) || ipr_is_gscsi(d)) -- 1.8.3.1 |