diff mbox

[3/4] iscsi class, libiscsi: Add net config.

Message ID 1241208039-6813-4-git-send-email-mchan@broadcom.com
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

Michael Chan May 1, 2009, 8 p.m. UTC
Add ISCSI_NETLINK messages to get/set vendor specific information.
This is to support bnx2i that handles net config of private iSCSI
IP address in userspace.

Signed-off-by: Anil Veerabhadrappa <anilgv@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Acked-by: David S. Miller <davem@davemloft.net>
---
 drivers/scsi/scsi_transport_iscsi.c |   59 ++++++++++++++++++++++++++++++++++-
 include/scsi/iscsi_if.h             |   14 ++++++++
 include/scsi/scsi_transport_iscsi.h |    6 +++
 3 files changed, 78 insertions(+), 1 deletions(-)

Comments

Mike Christie May 6, 2009, 4:40 p.m. UTC | #1
Michael Chan wrote:
> Add ISCSI_NETLINK messages to get/set vendor specific information.
> This is to support bnx2i that handles net config of private iSCSI
> IP address in userspace.
> 
> Signed-off-by: Anil Veerabhadrappa <anilgv@broadcom.com>
> Signed-off-by: Michael Chan <mchan@broadcom.com>
> Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
> Acked-by: David S. Miller <davem@davemloft.net>
> ---
>  drivers/scsi/scsi_transport_iscsi.c |   59 ++++++++++++++++++++++++++++++++++-
>  include/scsi/iscsi_if.h             |   14 ++++++++
>  include/scsi/scsi_transport_iscsi.h |    6 +++
>  3 files changed, 78 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
> index 0947954..ef3af96 100644
> --- a/drivers/scsi/scsi_transport_iscsi.c
> +++ b/drivers/scsi/scsi_transport_iscsi.c
> @@ -995,6 +995,37 @@ int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr,
>  }
>  EXPORT_SYMBOL_GPL(iscsi_recv_pdu);
>  
> +extern int iscsi_vendor_priv_mesg(struct Scsi_Host *shost,

Just a cut and paste error probably. You have an extern in there.

> +				  struct iscsi_transport *transport,
> +				  uint16_t priv_op,
> +				  char *data, uint16_t data_size)
> +{

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michael Chan May 6, 2009, 4:42 p.m. UTC | #2
On Wed, 2009-05-06 at 09:40 -0700, Mike Christie wrote:
> Michael Chan wrote:
> > Add ISCSI_NETLINK messages to get/set vendor specific information.
> > This is to support bnx2i that handles net config of private iSCSI
> > IP address in userspace.
> > 
> > Signed-off-by: Anil Veerabhadrappa <anilgv@broadcom.com>
> > Signed-off-by: Michael Chan <mchan@broadcom.com>
> > Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
> > Acked-by: David S. Miller <davem@davemloft.net>
> > ---
> >  drivers/scsi/scsi_transport_iscsi.c |   59 ++++++++++++++++++++++++++++++++++-
> >  include/scsi/iscsi_if.h             |   14 ++++++++
> >  include/scsi/scsi_transport_iscsi.h |    6 +++
> >  3 files changed, 78 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
> > index 0947954..ef3af96 100644
> > --- a/drivers/scsi/scsi_transport_iscsi.c
> > +++ b/drivers/scsi/scsi_transport_iscsi.c
> > @@ -995,6 +995,37 @@ int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr,
> >  }
> >  EXPORT_SYMBOL_GPL(iscsi_recv_pdu);
> >  
> > +extern int iscsi_vendor_priv_mesg(struct Scsi_Host *shost,
> 
> Just a cut and paste error probably. You have an extern in there.

Thanks for noticing.  Will fix this up in the next version of the patch.

> 
> > +				  struct iscsi_transport *transport,
> > +				  uint16_t priv_op,
> > +				  char *data, uint16_t data_size)
> > +{
> 
> 


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
James Bottomley June 8, 2009, 5:56 p.m. UTC | #3
On Fri, 2009-05-01 at 13:00 -0700, Michael Chan wrote:
> Add ISCSI_NETLINK messages to get/set vendor specific information.
> This is to support bnx2i that handles net config of private iSCSI
> IP address in userspace.
> 
> Signed-off-by: Anil Veerabhadrappa <anilgv@broadcom.com>
> Signed-off-by: Michael Chan <mchan@broadcom.com>
> Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
> Acked-by: David S. Miller <davem@davemloft.net>

This patch is rejecting pretty badly against both SCSI and net ... is
there an update (I saw you updated the other three patches in this
series on the 23rd, but not this one)?

James

---

patching file drivers/scsi/scsi_transport_iscsi.c
Hunk #1 succeeded at 1015 with fuzz 2 (offset 20 lines).
Hunk #2 FAILED at 1416.
Hunk #3 FAILED at 1456.
Hunk #4 succeeded at 1611 with fuzz 2 (offset 80 lines).
2 out of 4 hunks FAILED -- saving rejects to file
drivers/scsi/scsi_transport_iscsi.c.rej
patching file include/scsi/iscsi_if.h
Hunk #1 succeeded at 60 with fuzz 2 (offset 8 lines).
Hunk #2 FAILED at 69.
Hunk #3 FAILED at 165.
Hunk #4 FAILED at 204.
3 out of 4 hunks FAILED -- saving rejects to file
include/scsi/iscsi_if.h.rej
patching file include/scsi/scsi_transport_iscsi.h
Hunk #1 FAILED at 132.
Hunk #2 succeeded at 151 with fuzz 2 (offset 2 lines).
1 out of 2 hunks FAILED -- saving rejects to file
include/scsi/scsi_transport_iscsi.h.rej


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michael Chan June 8, 2009, 5:59 p.m. UTC | #4
On Mon, 2009-06-08 at 10:56 -0700, James Bottomley wrote:
> On Fri, 2009-05-01 at 13:00 -0700, Michael Chan wrote:
> > Add ISCSI_NETLINK messages to get/set vendor specific information.
> > This is to support bnx2i that handles net config of private iSCSI
> > IP address in userspace.
> > 
> > Signed-off-by: Anil Veerabhadrappa <anilgv@broadcom.com>
> > Signed-off-by: Michael Chan <mchan@broadcom.com>
> > Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
> > Acked-by: David S. Miller <davem@davemloft.net>
> 
> This patch is rejecting pretty badly against both SCSI and net ... is
> there an update (I saw you updated the other three patches in this
> series on the 23rd, but not this one)?
> 

I believe this is an earlier version of the patch.  On the 23rd, I sent
a completely new version after feedback from Mike and Chelsio to
standardize the message format.  It was also re-ordered as patch 1/4.

We have some cleanups we want to make on the bnx2i patch (4/4).  I can
re-spin everything and send out the whole set of patches later today.

Thanks.

> James
> 
> ---
> 
> patching file drivers/scsi/scsi_transport_iscsi.c
> Hunk #1 succeeded at 1015 with fuzz 2 (offset 20 lines).
> Hunk #2 FAILED at 1416.
> Hunk #3 FAILED at 1456.
> Hunk #4 succeeded at 1611 with fuzz 2 (offset 80 lines).
> 2 out of 4 hunks FAILED -- saving rejects to file
> drivers/scsi/scsi_transport_iscsi.c.rej
> patching file include/scsi/iscsi_if.h
> Hunk #1 succeeded at 60 with fuzz 2 (offset 8 lines).
> Hunk #2 FAILED at 69.
> Hunk #3 FAILED at 165.
> Hunk #4 FAILED at 204.
> 3 out of 4 hunks FAILED -- saving rejects to file
> include/scsi/iscsi_if.h.rej
> patching file include/scsi/scsi_transport_iscsi.h
> Hunk #1 FAILED at 132.
> Hunk #2 succeeded at 151 with fuzz 2 (offset 2 lines).
> 1 out of 2 hunks FAILED -- saving rejects to file
> include/scsi/scsi_transport_iscsi.h.rej
> 
> 
> 


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mike Christie June 8, 2009, 6:07 p.m. UTC | #5
James Bottomley wrote:
> On Fri, 2009-05-01 at 13:00 -0700, Michael Chan wrote:
>> Add ISCSI_NETLINK messages to get/set vendor specific information.
>> This is to support bnx2i that handles net config of private iSCSI
>> IP address in userspace.
>>
>> Signed-off-by: Anil Veerabhadrappa <anilgv@broadcom.com>
>> Signed-off-by: Michael Chan <mchan@broadcom.com>
>> Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
>> Acked-by: David S. Miller <davem@davemloft.net>
> 
> This patch is rejecting pretty badly against both SCSI and net ... is
> there an update (I saw you updated the other three patches in this
> series on the 23rd, but not this one)?
> 

The patch in this mail was dropped in their newest patchset from the 23rd.

Instead of the patch in this mail we now added the patch "[PATCH 1/4] 
iscsi class: Add new NETLINK_ISCSI messages for cnic/bnx2i driver." 
(link http://marc.info/?l=linux-scsi&m=124311620603619&w=2)  that was 
posted with the updated bnx2i/cnic patches on the 23rd.

James, one note. I was reviewing the bnx2i patch again and found some 
bugs in the locking. Are you going to merge the patches that were sent 
on the 23rd and then do you want us to just send fixes against that? Or 
do you want a new fixed up patchset?


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
James Bottomley June 8, 2009, 6:13 p.m. UTC | #6
On Mon, 2009-06-08 at 10:59 -0700, Michael Chan wrote:
> On Mon, 2009-06-08 at 10:56 -0700, James Bottomley wrote:
> > On Fri, 2009-05-01 at 13:00 -0700, Michael Chan wrote:
> > > Add ISCSI_NETLINK messages to get/set vendor specific information.
> > > This is to support bnx2i that handles net config of private iSCSI
> > > IP address in userspace.
> > > 
> > > Signed-off-by: Anil Veerabhadrappa <anilgv@broadcom.com>
> > > Signed-off-by: Michael Chan <mchan@broadcom.com>
> > > Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
> > > Acked-by: David S. Miller <davem@davemloft.net>
> > 
> > This patch is rejecting pretty badly against both SCSI and net ... is
> > there an update (I saw you updated the other three patches in this
> > series on the 23rd, but not this one)?
> > 
> 
> I believe this is an earlier version of the patch.  On the 23rd, I sent
> a completely new version after feedback from Mike and Chelsio to
> standardize the message format.  It was also re-ordered as patch 1/4.
> 
> We have some cleanups we want to make on the bnx2i patch (4/4).  I can
> re-spin everything and send out the whole set of patches later today.

That's probably the best solution ... I found it ... I'd just got the
old patch labelled in my workflow somehow.

Thanks,

James


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michael Chan June 8, 2009, 8:06 p.m. UTC | #7
On Mon, 2009-06-08 at 13:07 -0700, Hans de Goede wrote:
> <snip>
> 
> Sorry for jumping in the middle of a thread, I missed the
> libiscsi in the subject. Can someone please resent me the
> libiscsi part of this patchset so that I can review it ?
> 
> (I'm the libiscsi author)
> 

I'll be sending a new patchset later today and I'll CC you.  In the
final version, we are not modifying libiscsi, only scsi_transport_iscsi.

Thanks.


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hans de Goede June 8, 2009, 8:07 p.m. UTC | #8
<snip>

Sorry for jumping in the middle of a thread, I missed the
libiscsi in the subject. Can someone please resent me the
libiscsi part of this patchset so that I can review it ?

(I'm the libiscsi author)

Thanks & Regards,

Hans
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mike Christie June 8, 2009, 8:24 p.m. UTC | #9
Hans de Goede wrote:
> <snip>
> 
> Sorry for jumping in the middle of a thread, I missed the
> libiscsi in the subject. Can someone please resent me the
> libiscsi part of this patchset so that I can review it ?
> 
> (I'm the libiscsi author)
> 

There is actually a kernel module called libiscsi. That is what this 
patch/thread/mail is for. It is not the userpsace libiscsi lib that you did.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hans de Goede June 8, 2009, 8:27 p.m. UTC | #10
On 06/08/2009 10:24 PM, Mike Christie wrote:
> Hans de Goede wrote:
>> <snip>
>>
>> Sorry for jumping in the middle of a thread, I missed the
>> libiscsi in the subject. Can someone please resent me the
>> libiscsi part of this patchset so that I can review it ?
>>
>> (I'm the libiscsi author)
>>
>
> There is actually a kernel module called libiscsi. That is what this
> patch/thread/mail is for. It is not the userpsace libiscsi lib that you
> did.

Ah, my bad.

Regards,

Hans
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 0947954..ef3af96 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -995,6 +995,37 @@  int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr,
 }
 EXPORT_SYMBOL_GPL(iscsi_recv_pdu);
 
+extern int iscsi_vendor_priv_mesg(struct Scsi_Host *shost,
+				  struct iscsi_transport *transport,
+				  uint16_t priv_op,
+				  char *data, uint16_t data_size)
+{
+	struct nlmsghdr	*nlh;
+	struct sk_buff *skb;
+	struct iscsi_uevent *ev;
+	int len = NLMSG_SPACE(sizeof(*ev) + data_size);
+
+	skb = alloc_skb(len, GFP_ATOMIC);
+	if (!skb) {
+		printk(KERN_ERR "can not deliver vendor private message:OOM\n");
+		return -ENOMEM;
+	}
+
+	nlh = __nlmsg_put(skb, 0, 0, 0, (len - sizeof(*nlh)), 0);
+	ev = NLMSG_DATA(nlh);
+	memset(ev, 0, sizeof(*ev));
+	ev->type = ISCSI_KEVENT_PRIVATE_MESG;
+	ev->transport_handle = iscsi_handle(transport);
+	ev->r.vendor_priv.host_no = shost->host_no;
+	ev->r.vendor_priv.priv_op = priv_op;
+	ev->r.vendor_priv.mesg_size = data_size;
+
+	memcpy((char*)ev + sizeof(*ev), data, data_size);
+
+	return iscsi_broadcast_skb(skb, GFP_KERNEL);
+}
+EXPORT_SYMBOL_GPL(iscsi_vendor_priv_mesg);
+
 void iscsi_conn_error_event(struct iscsi_cls_conn *conn, enum iscsi_err error)
 {
 	struct nlmsghdr	*nlh;
@@ -1365,6 +1396,28 @@  iscsi_set_host_param(struct iscsi_transport *transport,
 }
 
 static int
+iscsi_vendor_priv_msg(struct iscsi_transport *transport,
+		      struct iscsi_uevent *ev)
+{
+	struct Scsi_Host *shost;
+	int err;
+
+	shost = scsi_host_lookup(ev->u.vendor_priv.host_no);
+	if (!shost) {
+		printk(KERN_ERR "target discovery could not find host no %u\n",
+		       ev->u.tgt_dscvr.host_no);
+		return -ENODEV;
+	}
+
+	err = transport->nl_priv_recv(shost, ev->u.vendor_priv.priv_op,
+				      ev->u.vendor_priv.status,
+				      (char *)((char*)ev + sizeof(*ev)),
+				      ev->u.vendor_priv.mesg_size);
+	scsi_host_put(shost);
+	return err;
+}
+
+static int
 iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
 {
 	int err = 0;
@@ -1383,7 +1436,8 @@  iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
 	if (!try_module_get(transport->owner))
 		return -EINVAL;
 
-	priv->daemon_pid = NETLINK_CREDS(skb)->pid;
+	if (nlh->nlmsg_type != ISCSI_UEVENT_PRIVATE_MESG)
+		priv->daemon_pid = NETLINK_CREDS(skb)->pid;
 
 	switch (nlh->nlmsg_type) {
 	case ISCSI_UEVENT_CREATE_SESSION:
@@ -1477,6 +1531,9 @@  iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
 	case ISCSI_UEVENT_SET_HOST_PARAM:
 		err = iscsi_set_host_param(transport, ev);
 		break;
+	case ISCSI_UEVENT_PRIVATE_MESG:
+		err = iscsi_vendor_priv_msg(transport, ev);
+		break;
 	default:
 		err = -ENOSYS;
 		break;
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index d0ed522..9e67946 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -52,6 +52,8 @@  enum iscsi_uevent_e {
 	ISCSI_UEVENT_UNBIND_SESSION	= UEVENT_BASE + 17,
 	ISCSI_UEVENT_CREATE_BOUND_SESSION	= UEVENT_BASE + 18,
 
+	ISCSI_UEVENT_PRIVATE_MESG	= UEVENT_BASE + 20,
+
 	/* up events */
 	ISCSI_KEVENT_RECV_PDU		= KEVENT_BASE + 1,
 	ISCSI_KEVENT_CONN_ERROR		= KEVENT_BASE + 2,
@@ -59,6 +61,7 @@  enum iscsi_uevent_e {
 	ISCSI_KEVENT_DESTROY_SESSION	= KEVENT_BASE + 4,
 	ISCSI_KEVENT_UNBIND_SESSION	= KEVENT_BASE + 5,
 	ISCSI_KEVENT_CREATE_SESSION	= KEVENT_BASE + 6,
+	ISCSI_KEVENT_PRIVATE_MESG	= KEVENT_BASE + 7,
 };
 
 enum iscsi_tgt_dscvr {
@@ -154,6 +157,12 @@  struct iscsi_uevent {
 			uint32_t	param; /* enum iscsi_host_param */
 			uint32_t	len;
 		} set_host_param;
+		struct msg_vendor_priv {
+			uint32_t	host_no;
+			uint16_t	priv_op;
+			uint16_t	mesg_size;
+			uint32_t	status;
+		} vendor_priv;
 	} u;
 	union {
 		/* messages k -> u */
@@ -187,6 +196,11 @@  struct iscsi_uevent {
 		struct msg_transport_connect_ret {
 			uint64_t	handle;
 		} ep_connect_ret;
+		struct msg_vendor_priv_ret {
+			uint32_t	host_no;
+			uint16_t	priv_op;
+			uint16_t	mesg_size;
+		} vendor_priv;
 	} r;
 } __attribute__ ((aligned (sizeof(uint64_t))));
 
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 457588e..14dab4e 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -132,6 +132,8 @@  struct iscsi_transport {
 	void (*ep_disconnect) (struct iscsi_endpoint *ep);
 	int (*tgt_dscvr) (struct Scsi_Host *shost, enum iscsi_tgt_dscvr type,
 			  uint32_t enable, struct sockaddr *dst_addr);
+	int (*nl_priv_recv) (struct Scsi_Host *shost, uint16_t priv_op,
+			     int status, char *data, int data_size);
 };
 
 /*
@@ -147,6 +149,10 @@  extern void iscsi_conn_error_event(struct iscsi_cls_conn *conn,
 				   enum iscsi_err error);
 extern int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr,
 			  char *data, uint32_t data_size);
+extern int iscsi_vendor_priv_mesg(struct Scsi_Host *shost,
+				  struct iscsi_transport *transport,
+				  uint16_t priv_op,
+				  char *data, uint16_t data_size);
 
 struct iscsi_cls_conn {
 	struct list_head conn_list;	/* item in connlist */