linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bart.vanassche@sandisk.com>
To: Bryant G Ly <bryantly@linux.vnet.ibm.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>,
	<martin.petersen@oracle.com>, <tyreld@linux.vnet.ibm.com>,
	<akpm@linux-foundation.org>, <kvalo@codeaurora.org>,
	<davem@davemloft.net>, <gregkh@linuxfoundation.org>,
	<mchehab@osg.samsung.com>, <jslaby@suse.com>, <joe@perches.com>,
	<bp@suse.de>, <linux-kernel@vger.kernel.org>,
	<linux-scsi@vger.kernel.org>, <target-devel@vger.kernel.org>,
	bgly <bgly@us.ibm.com>
Subject: Re: [PATCH] ibmvscsis: Initial commit of IBM VSCSI Tgt Driver
Date: Fri, 10 Jun 2016 12:03:51 -0700	[thread overview]
Message-ID: <12c6229a-3188-b88c-523f-99219ed60c05@sandisk.com> (raw)
In-Reply-To: <20160524160047.Horde.M1bK0S-HUnY41nXa9ZoJ6w1@ltc.linux.ibm.com>

On 05/24/2016 01:00 PM, Bryant G Ly wrote:
> Quoting Bart Van Assche <bart.vanassche@sandisk.com>:
>> On 05/24/2016 06:52 AM, Bryant G. Ly wrote:
>>> +static uint64_t ibmvscsis_unpack_lun(const uint8_t *lun, int len)
>>> +{
>>> +    uint64_t res = NO_SUCH_LUN;
>>> +    int addressing_method;
>>> +
>>> +    if (unlikely(len < 2)) {
>>> +        pr_err("Illegal LUN length %d, expected 2 bytes or more\n",
>>> +            len);
>>> +        goto out;
>>> +    }
>>> +
>>> +    switch (len) {
>>> +    case 8:
>>> +        if ((*((__be64 *)lun) & cpu_to_be64(0x0000FFFFFFFFFFFFLL))
>>> != 0)
>>> +            goto out_err;
>>> +        break;
>>> +    case 4:
>>> +        if (*((__be16 *)&lun[2]) != 0)
>>> +            goto out_err;
>>> +        break;
>>> +    case 6:
>>> +        if (*((__be32 *)&lun[2]) != 0)
>>> +            goto out_err;
>>> +        break;
>>> +    case 2:
>>> +        break;
>>> +    default:
>>> +        goto out_err;
>>> +    }
>>> +
>>> +    addressing_method = (*lun) >> 6; /* highest two bits of byte 0 */
>>> +    switch (addressing_method) {
>>> +    case SCSI_LUN_ADDR_METHOD_PERIPHERAL:
>>> +    case SCSI_LUN_ADDR_METHOD_FLAT:
>>> +    case SCSI_LUN_ADDR_METHOD_LUN:
>>> +        res = *(lun + 1) | (((*lun) & 0x3f) << 8);
>>> +        break;
>>> +
>>> +    case SCSI_LUN_ADDR_METHOD_EXTENDED_LUN:
>>> +    default:
>>> +        pr_err("Unimplemented LUN addressing method %u\n",
>>> +            addressing_method);
>>> +        break;
>>> +    }
>>> +
>>> +out:
>>> +    return res;
>>> +out_err:
>>> +    pr_err("Support for multi-level LUNs has not yet been
>>> implemented\n");
>>> +    goto out;
>>> +}
>>
>> In the above function there is nothing that is specific to the VIO
>> mechanism. Please consider to merge this function with
>> scsilun_to_int(), e.g. by introducing a new function that accepts a
>> SCSI LUN and the addressing method as arguments and by making
>> scsilun_to_int() call that function with
>> SCSI_LUN_ADDR_METHOD_PERIPHERAL as one of its arguments.
>>
>
> We are going to keep this here atm, until we can make sure canonical can
> pick up
> these changes, since we have a deliverable for a 3rd party vendor who is
> going to
> fully utilize this driver. Once they can pick it up in 4.4 kernel I will
> make the
> change you recommended / move the scsi_lun_addr_method addressed below.
> I will also
> address the changes that ib_srpt needs to utilize this new function too.

A much better approach would be to move this function into the SCSI core 
and to add a copy of that function to the backported driver that will be 
provided to Canonical.

Thanks,

Bart.

  reply	other threads:[~2016-06-10 19:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-24 13:52 [PATCH] ibmvscsis: Initial commit of IBM VSCSI Tgt Driver Bryant G. Ly
2016-05-24 14:14 ` Joe Perches
2016-05-24 14:30 ` Greg KH
2016-05-24 16:25 ` Bart Van Assche
2016-05-24 16:34   ` Greg KH
2016-05-24 16:44     ` Bart Van Assche
2016-05-24 16:50       ` Greg KH
2016-05-24 20:00   ` Bryant G Ly
2016-06-10 19:03     ` Bart Van Assche [this message]
2016-06-14  6:23       ` Nicholas A. Bellinger
2016-06-14 14:55         ` Christoph Hellwig
2016-05-25 14:17 ` IBM VSCSI Target Driver Initial Patch Sets Bryant G. Ly
2016-05-25 14:17   ` [PATCH 2/3] ibmvscsis: Addressing Bart's comments Bryant G. Ly
2016-05-25 14:17   ` [PATCH 3/3] ibmvscsis: clean up functions Bryant G. Ly
2016-05-25 14:44     ` Joe Perches

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=12c6229a-3188-b88c-523f-99219ed60c05@sandisk.com \
    --to=bart.vanassche@sandisk.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=akpm@linux-foundation.org \
    --cc=bgly@us.ibm.com \
    --cc=bp@suse.de \
    --cc=bryantly@linux.vnet.ibm.com \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=jslaby@suse.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mchehab@osg.samsung.com \
    --cc=target-devel@vger.kernel.org \
    --cc=tyreld@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).