Skip to contentSkip to conversation

dhcp provisioning support in cxgb3i

RFC-PATCH Rakesh Ranjan 4 participants 7 messages Oct 29, 2009 – Nov 4, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Hi Mike,

Herein attached patches for having dhcp provisioning support in cxgb3i. I have added one new iscsi netlink message ISCSI_UEVENT_REQ_IPCONF. Please have a look and share suggestions.

Regards
Rakesh Ranjan

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi-/[email protected]
To unsubscribe from this group, send email to open-iscsi+unsubscribe-/[email protected] For more options, visit this group at http://groups.google.com/group/open-iscsi
-~----------~----~----~----~------~----~------~--~---

Quoted 1 line

From 4b522723ab93b54504eeb738cc02f354635cec53 Mon Sep 17 00:00:00 2001

From: Rakesh Ranjan <[email protected]>
Date: Thu, 29 Oct 2009 17:41:42 +0530
Subject: [PATCH] added one new netlink message ISCSI_UEVENT_REQ_IPCONF in libiscsi to support dhcp functionality in cxgb3i

---
 drivers/scsi/scsi_transport_iscsi.c |   25 +++++++++++++++++++++++++
 include/scsi/iscsi_if.h             |    4 ++++
 include/scsi/scsi_transport_iscsi.h |    1 +
 3 files changed, 30 insertions(+), 0 deletions(-)
drivers/scsi/scsi_transport_iscsi.c +25 -0
index ad897df..4897a3f 100644
@@ -1508,6 +1508,28 @@ iscsi_set_path(struct iscsi_transport *transport, struct iscsi_uevent *ev)
 }
 
 static int
+iscsi_req_ipconf(struct iscsi_transport *transport, struct iscsi_uevent *ev)
+{
+	struct Scsi_Host *shost;
+	int err;
+
+	if (!transport->req_ipconf)
+		return -ENOSYS;
+
+	shost = scsi_host_lookup(ev->u.req_ipconf.host_no);
+	if (!shost) {
+		printk(KERN_ERR "ipconf req could not find host no %u\n",
+				ev->u.req_ipconf.host_no);
+		return -ENODEV;
+	}
+
+	err = transport->req_ipconf(shost);
+
+	scsi_host_put(shost);
+	return err;
+}
+
+static int
 iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group)
 {
 	int err = 0;
@@ -1627,6 +1649,9 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group)
 	case ISCSI_UEVENT_PATH_UPDATE:
 		err = iscsi_set_path(transport, ev);
 		break;
+	case ISCSI_UEVENT_REQ_IPCONF:
+		err = iscsi_req_ipconf(transport, ev);
+		break;
 	default:
 		err = -ENOSYS;
 		break;
include/scsi/iscsi_if.h +4 -0
index d67dda2..939b1d6 100644
@@ -59,6 +59,7 @@ enum iscsi_uevent_e {
 	ISCSI_UEVENT_TRANSPORT_EP_CONNECT_THROUGH_HOST	= UEVENT_BASE + 19,
 
 	ISCSI_UEVENT_PATH_UPDATE	= UEVENT_BASE + 20,
+	ISCSI_UEVENT_REQ_IPCONF		= UEVENT_BASE + 21,
 
 	/* up events */
 	ISCSI_KEVENT_RECV_PDU		= KEVENT_BASE + 1,
@@ -172,6 +173,9 @@ struct iscsi_uevent {
 		struct msg_set_path {
 			uint32_t	host_no;
 		} set_path;
+		struct msg_req_ipconf {
+			uint32_t	host_no;
+		} req_ipconf;
 	} u;
 	union {
 		/* messages k -> u */
include/scsi/scsi_transport_iscsi.h +1 -0
index 349c7f3..3e5fd96 100644
@@ -134,6 +134,7 @@ struct iscsi_transport {
 	int (*tgt_dscvr) (struct Scsi_Host *shost, enum iscsi_tgt_dscvr type,
 			  uint32_t enable, struct sockaddr *dst_addr);
 	int (*set_path) (struct Scsi_Host *shost, struct iscsi_path *params);
+	int (*req_ipconf) (struct Scsi_Host *shost);
 };
 
 /*
Signature · 1 line
1.6.0.6
Quoted 1 line

From c64cae0fc1c281159141d9e624331f00e434f056 Mon Sep 17 00:00:00 2001

From: Rakesh Ranjan <[email protected]>
Date: Thu, 29 Oct 2009 17:43:51 +0530
Subject: [PATCH] Implemented dhcp client support in cxgb3i

---
 drivers/scsi/cxgb3i/Kbuild            |    2 +-
 drivers/scsi/cxgb3i/cxgb3i.h          |    4 +
 drivers/scsi/cxgb3i/cxgb3i_ipconfig.c |  519 +++++++++++++++++++++++++++++++++
 drivers/scsi/cxgb3i/cxgb3i_iscsi.c    |   23 ++-
 drivers/scsi/cxgb3i/cxgb3i_offload.c  |    3 +-
 5 files changed, 548 insertions(+), 3 deletions(-)
 create mode 100644 drivers/scsi/cxgb3i/cxgb3i_ipconfig.c
drivers/scsi/cxgb3i/Kbuild +1 -1
index 70d060b..b0f1a3d 100644
@@ -1,4 +1,4 @@
 EXTRA_CFLAGS += -I$(srctree)/drivers/net/cxgb3
 
-cxgb3i-y := cxgb3i_init.o cxgb3i_iscsi.o cxgb3i_pdu.o cxgb3i_offload.o cxgb3i_ddp.o
+cxgb3i-y := cxgb3i_init.o cxgb3i_iscsi.o cxgb3i_pdu.o cxgb3i_offload.o cxgb3i_ddp.o cxgb3i_ipconfig.o
 obj-$(CONFIG_SCSI_CXGB3_ISCSI) += cxgb3i.o
drivers/scsi/cxgb3i/cxgb3i.h +4 -0
index e3133b5..37b9a0d 100644
@@ -158,4 +158,8 @@ int cxgb3i_conn_xmit_pdu(struct iscsi_task *);
 void cxgb3i_release_itt(struct iscsi_task *task, itt_t hdr_itt);
 int cxgb3i_reserve_itt(struct iscsi_task *task, itt_t *hdr_itt);
 
+int cxgb3i_ipconfig_init(struct cxgb3i_hba *hba);
+void cxgb3i_ipconfig_exit(struct cxgb3i_hba *hba);
+int cxgb3i_do_ipconf(struct cxgb3i_hba *hba);
+
 #endif
drivers/scsi/cxgb3i/cxgb3i_ipconfig.c new file +519 -0

519 lines not on this page · raw message

drivers/scsi/cxgb3i/cxgb3i_iscsi.c +22 -1
index 2631bdd..2bb5e63 100644
@@ -240,6 +240,13 @@ struct cxgb3i_hba *cxgb3i_hba_host_add(struct cxgb3i_adapter *snic,
 		goto pci_dev_put;
 	}
 
+	err = cxgb3i_ipconfig_init(hba);
+	if (err) {
+		cxgb3i_log_info("snic 0x%p, ndev 0x%p, host_add failed.\n",
+				snic, ndev);
+		goto pci_dev_put;
+	}
+
 	cxgb3i_api_debug("shost 0x%p, hba 0x%p, no %u.\n",
 			 shost, hba, shost->host_no);
 
@@ -259,6 +266,7 @@ void cxgb3i_hba_host_remove(struct cxgb3i_hba *hba)
 {
 	cxgb3i_api_debug("shost 0x%p, hba 0x%p, no %u.\n",
 			 hba->shost, hba, hba->shost->host_no);
+	cxgb3i_ipconfig_exit(hba);
 	iscsi_host_remove(hba->shost);
 	pci_dev_put(hba->snic->pdev);
 	iscsi_host_free(hba->shost);
@@ -737,13 +745,14 @@ static int cxgb3i_host_get_param(struct Scsi_Host *shost,
 				 enum iscsi_host_param param, char *buf)
 {
 	struct cxgb3i_hba *hba = iscsi_host_priv(shost);
+	struct port_info *pi = netdev_priv(hba->ndev);
 	int len = 0;
 
 	cxgb3i_api_debug("hba %s, param %d.\n", hba->ndev->name, param);
 
 	switch (param) {
 	case ISCSI_HOST_PARAM_HWADDRESS:
-		len = sysfs_format_mac(buf, hba->ndev->dev_addr, 6);
+		len = sysfs_format_mac(buf, pi->iscsic.mac_addr, ETH_ALEN);
 		break;
 	case ISCSI_HOST_PARAM_NETDEV_NAME:
 		len = sprintf(buf, "%s\n", hba->ndev->name);
@@ -762,6 +771,17 @@ static int cxgb3i_host_get_param(struct Scsi_Host *shost,
 	return len;
 }
 
+static int cxgb3i_req_ipconf(struct Scsi_Host *shost)
+{
+	int rc;
+
+	struct cxgb3i_hba *hba = iscsi_host_priv(shost);
+
+	rc = cxgb3i_do_ipconf(hba);
+
+	return rc;
+}
+
 /**
  * cxgb3i_conn_get_stats - returns iSCSI stats
  * @cls_conn:	pointer to iscsi cls conn
@@ -976,6 +996,7 @@ static struct iscsi_transport cxgb3i_iscsi_transport = {
 	.ep_disconnect		= cxgb3i_ep_disconnect,
 	/* Error recovery timeout call */
 	.session_recovery_timedout = iscsi_session_recovery_timedout,
+	.req_ipconf		= cxgb3i_req_ipconf,
 };
 
 int cxgb3i_iscsi_init(void)
drivers/scsi/cxgb3i/cxgb3i_offload.c +2 -1
index c1d5be4..8fdafeb 100644
@@ -269,7 +269,8 @@ static void make_act_open_req(struct s3_conn *c3cn, struct sk_buff *skb,
 	req->local_ip = c3cn->saddr.sin_addr.s_addr;
 	req->peer_ip = c3cn->daddr.sin_addr.s_addr;
 	req->opt0h = htonl(calc_opt0h(c3cn) | V_L2T_IDX(e->idx) |
-			   V_TX_CHANNEL(e->smt_idx));
+			   V_TX_CHANNEL(e->smt_idx) |
+			   V_SRC_MAC_SEL(SAN_MAC_IDX));
 	req->opt0l = htonl(calc_opt0l(c3cn));
 	req->params = 0;
 }
Signature · 1 line
1.6.0.6
#1 lore raw
Quoted 6 lines · Rakesh Ranjan

Hi Mike,

Herein attached patches for having dhcp provisioning support in cxgb3i.
I have added one new iscsi netlink message ISCSI_UEVENT_REQ_IPCONF. Please have a look and share suggestions.

[...]

Why does cxgb3i need its very own DHCP client? This seems like something that's generically useful to firmware-based iSCSI adapters.

(It would be better still if this could be left to user-space, but although a user-space program could send out requests on the net device using the iSCSI device's MAC address, I don't see how it would get replies.)

Ben.

Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
#2 lore raw
In reply to Rakesh Ranjan
Quoted 4 lines · Rakesh Ranjan

Hi Mike,

Herein attached patches for having dhcp provisioning support in cxgb3i. I have added one new iscsi netlink message ISCSI_UEVENT_REQ_IPCONF.

Is the idea to have iscsid/uip send down this msg?

Was it not possible to hook in more like how bnx2i does dhcp?

#3 lore raw
Quoted 8 lines · Mike Christie
Quoted 3 lines · Rakesh Ranjan

Hi Mike,

Herein attached patches for having dhcp provisioning support in cxgb3i. I have added one new iscsi netlink message ISCSI_UEVENT_REQ_IPCONF.

Is the idea to have iscsid/uip send down this msg?

Was it not possible to hook in more like how bnx2i does dhcp?

yep, idea is to have iscsid send down ISCSI_UEVENT_REQ_IPCONF msg. bnx2i approach in our case for at least T3 is not feasible.

Regards
Rakesh Ranjan

#4 lore raw
Quoted 4 lines · Rakesh Ranjan
Quoted 3 lines · Mike Christie
Quoted 2 lines · Rakesh Ranjan

Hi Mike,

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Herein attached patches for having dhcp provisioning support in cxgb3i. I have added one new iscsi netlink message ISCSI_UEVENT_REQ_IPCONF.

Is the idea to have iscsid/uip send down this msg?

Was it not possible to hook in more like how bnx2i does dhcp?

yep, idea is to have iscsid send down ISCSI_UEVENT_REQ_IPCONF msg. bnx2i approach in our case for at least T3 is not feasible.

I think adding DHCP in the kernel is getting a little crazy :) If we go down this path, I agree with the other person that stated it should at least be generic.

#5 lore raw
Quoted 13 lines · Mike Christie
Quoted 12 lines · Rakesh Ranjan
Quoted 10 lines · Mike Christie
Quoted 5 lines · Rakesh Ranjan

Hi Mike,

Herein attached patches for having dhcp provisioning support in cxgb3i. I have added one new iscsi netlink message ISCSI_UEVENT_REQ_IPCONF.

Is the idea to have iscsid/uip send down this msg?

Was it not possible to hook in more like how bnx2i does dhcp?

Quoted 7 lines
Quoted 3 lines

yep, idea is to have iscsid send down ISCSI_UEVENT_REQ_IPCONF msg. bnx2i approach in our case for at least T3 is not feasible.

I think adding DHCP in the kernel is getting a little crazy :) If we go down this path, I agree with the other person that stated it should at least be generic.

Hi Mike,

What do you mean be generic ? Do you want to have a generic interface for DHCP handler that could be part of libiscsi and could be used by other LLD's.

Regards
Rakesh Ranjan

#6 lore raw
Quoted 22 lines · On Wed, 04 Nov 2009 23:54:07 +0530 Rakesh Ranjan <[email protected]> wrote:
Quoted 13 lines · Mike Christie
Quoted 12 lines · Rakesh Ranjan
Quoted 10 lines · Mike Christie
Quoted 5 lines · Rakesh Ranjan

Hi Mike,

Herein attached patches for having dhcp provisioning support in cxgb3i. I have added one new iscsi netlink message ISCSI_UEVENT_REQ_IPCONF.

Is the idea to have iscsid/uip send down this msg?

Was it not possible to hook in more like how bnx2i does dhcp?

Quoted 7 lines
Quoted 3 lines

yep, idea is to have iscsid send down ISCSI_UEVENT_REQ_IPCONF msg. bnx2i approach in our case for at least T3 is not feasible.

I think adding DHCP in the kernel is getting a little crazy :) If we go down this path, I agree with the other person that stated it should at least be generic.

Quoted 5 lines

Hi Mike,

What do you mean be generic ? Do you want to have a generic interface for DHCP handler that could be part of libiscsi and could be used by other LLD's.

Is there anyway to make existing code (in net/ipv4/ipconfig.c) more generic and useful for both?