From: Hannes Reinecke <hare@suse.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
James Bottomley <james.bottomley@hansenpartnership.com>,
linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.de>,
Hannes Reinecke <hare@suse.com>
Subject: [PATCH 1/3] ses: make initial allocation size configurable
Date: Thu, 21 Dec 2017 12:22:32 +0100 [thread overview]
Message-ID: <1513855354-86603-2-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1513855354-86603-1-git-send-email-hare@suse.de>
Some storage arrays have an incorrect SES implementation which will
always return the allocation length of the CDB instead of the true
length of the requested page.
With this patch one can modify the initial allocation size to
get the full output of those arrays.
Signed-off-by: Hannes Reinecke <hare@suse.com>
---
drivers/scsi/ses.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c
index 11826c5..e8ffee1 100644
--- a/drivers/scsi/ses.c
+++ b/drivers/scsi/ses.c
@@ -51,6 +51,13 @@ struct ses_component {
u64 addr;
};
+#define INIT_ALLOC_SIZE 32
+
+static unsigned long ses_alloc_size = INIT_ALLOC_SIZE;
+
+module_param_named(alloc_size, ses_alloc_size, ulong, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(alloc_size, "initial allocation length");
+
static bool ses_page2_supported(struct enclosure_device *edev)
{
struct ses_device *ses_dev = edev->scratch;
@@ -508,8 +515,6 @@ static int ses_enclosure_find_by_addr(struct enclosure_device *edev,
return 0;
}
-#define INIT_ALLOC_SIZE 32
-
static void ses_enclosure_data_process(struct enclosure_device *edev,
struct scsi_device *sdev,
int create)
@@ -519,7 +524,7 @@ static void ses_enclosure_data_process(struct enclosure_device *edev,
int i, j, page7_len, len, components;
struct ses_device *ses_dev = edev->scratch;
int types = ses_dev->page1_num_types;
- unsigned char *hdr_buf = kzalloc(INIT_ALLOC_SIZE, GFP_KERNEL);
+ unsigned char *hdr_buf = kzalloc(ses_alloc_size, GFP_KERNEL);
if (!hdr_buf)
goto simple_populate;
@@ -528,7 +533,7 @@ static void ses_enclosure_data_process(struct enclosure_device *edev,
if (ses_dev->page10)
ses_recv_diag(sdev, 10, ses_dev->page10, ses_dev->page10_len);
/* Page 7 for the descriptors is optional */
- result = ses_recv_diag(sdev, 7, hdr_buf, INIT_ALLOC_SIZE);
+ result = ses_recv_diag(sdev, 7, hdr_buf, ses_alloc_size);
if (result)
goto simple_populate;
@@ -663,12 +668,12 @@ static int ses_intf_add(struct device *cdev,
sdev_printk(KERN_NOTICE, sdev, "Embedded Enclosure Device\n");
ses_dev = kzalloc(sizeof(*ses_dev), GFP_KERNEL);
- hdr_buf = kzalloc(INIT_ALLOC_SIZE, GFP_KERNEL);
+ hdr_buf = kzalloc(ses_alloc_size, GFP_KERNEL);
if (!hdr_buf || !ses_dev)
goto err_init_free;
page = 1;
- result = ses_recv_diag(sdev, page, hdr_buf, INIT_ALLOC_SIZE);
+ result = ses_recv_diag(sdev, page, hdr_buf, ses_alloc_size);
if (result)
goto recv_failed;
@@ -708,7 +713,7 @@ static int ses_intf_add(struct device *cdev,
buf = NULL;
page = 2;
- result = ses_recv_diag(sdev, page, hdr_buf, INIT_ALLOC_SIZE);
+ result = ses_recv_diag(sdev, page, hdr_buf, ses_alloc_size);
if (result)
goto page2_not_supported;
@@ -728,7 +733,7 @@ static int ses_intf_add(struct device *cdev,
/* The additional information page --- allows us
* to match up the devices */
page = 10;
- result = ses_recv_diag(sdev, page, hdr_buf, INIT_ALLOC_SIZE);
+ result = ses_recv_diag(sdev, page, hdr_buf, ses_alloc_size);
if (!result) {
len = (hdr_buf[2] << 8) + hdr_buf[3] + 4;
--
1.8.5.6
next prev parent reply other threads:[~2017-12-21 11:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-21 11:22 [PATCH 0/3] Another round of SES fixes Hannes Reinecke
2017-12-21 11:22 ` Hannes Reinecke [this message]
2017-12-22 17:14 ` [PATCH 1/3] ses: make initial allocation size configurable James Bottomley
2017-12-23 14:29 ` Hannes Reinecke
2017-12-21 11:22 ` [PATCH 2/3] ses: skip error messages for invalid LUNs Hannes Reinecke
2017-12-22 17:39 ` James Bottomley
2017-12-23 14:37 ` Hannes Reinecke
2017-12-21 11:22 ` [PATCH 3/3] ses: Retry Power-on-reset check condition Hannes Reinecke
2017-12-21 15:29 ` James Bottomley
2017-12-21 15:39 ` Hannes Reinecke
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=1513855354-86603-2-git-send-email-hare@suse.de \
--to=hare@suse.de \
--cc=hare@suse.com \
--cc=hch@lst.de \
--cc=james.bottomley@hansenpartnership.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox