Skip to contentSkip to conversation

be2iscsi: Add support for iscsi boot

PATCH In review Jayamohan Kallickal 2 participants 3 messages Jul 12, 2010 – Jul 13, 2010

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

PATCH 17/20 be2iscsi: Add support for iscsi boot

This patch contains changes for adding support for iscsi_boot.
Have modified to make read of mac address from chip as a function.

Since this is a rarely used call, I would like to make the call
to the chip

---
 drivers/scsi/be2iscsi/be_cmds.h  |  147 +++++++++++++++--
 drivers/scsi/be2iscsi/be_iscsi.c |   71 +++++----
 drivers/scsi/be2iscsi/be_iscsi.h |    2 +
 drivers/scsi/be2iscsi/be_main.c  |  334 +++++++++++++++++++++++++++++++++++++-
 drivers/scsi/be2iscsi/be_main.h  |    2 +
 drivers/scsi/be2iscsi/be_mgmt.c  |   71 ++++++++
 6 files changed, 580 insertions(+), 47 deletions(-)
drivers/scsi/be2iscsi/be_cmds.h +130 -17
index 40641d0..5218de4 100644
@@ -162,6 +162,13 @@ struct be_mcc_mailbox {
 #define OPCODE_COMMON_ISCSI_CFG_POST_SGL_PAGES		2
 #define OPCODE_COMMON_ISCSI_CFG_REMOVE_SGL_PAGES        3
 #define OPCODE_COMMON_ISCSI_NTWK_GET_NIC_CONFIG		7
+#define OPCODE_COMMON_ISCSI_NTWK_SET_VLAN		14
+#define OPCODE_COMMON_ISCSI_NTWK_CONFIGURE_STATELESS_IP_ADDR	17
+#define OPCODE_COMMON_ISCSI_NTWK_MODIFY_IP_ADDR		21
+#define OPCODE_COMMON_ISCSI_NTWK_GET_DEFAULT_GATEWAY	22
+#define OPCODE_COMMON_ISCSI_NTWK_MODIFY_DEFAULT_GATEWAY 23
+#define OPCODE_COMMON_ISCSI_NTWK_GET_ALL_IF_ID		24
+#define OPCODE_COMMON_ISCSI_NTWK_GET_IF_INFO		25
 #define OPCODE_COMMON_ISCSI_SET_FRAGNUM_BITS_FOR_SGL_CRA 61
 #define OPCODE_COMMON_ISCSI_DEFQ_CREATE                 64
 #define OPCODE_COMMON_ISCSI_DEFQ_DESTROY		65
@@ -237,11 +244,109 @@ struct be_cmd_resp_eq_create {
 	u16 rsvd0;		/* sword */
 } __packed;
 
+struct mgmt_chap_format {
+	u32 flags;
+	u8  intr_chap_name[256];
+	u8  intr_secret[16];
+	u8  target_chap_name[256];
+	u8  target_secret[16];
+	u16 intr_chap_name_length;
+	u16 intr_secret_length;
+	u16 target_chap_name_length;
+	u16 target_secret_length;
+} __packed;
+
+struct mgmt_auth_method_format {
+	u8	auth_method_type;
+	u8	padding[3];
+	struct	mgmt_chap_format chap;
+} __packed;
+
+struct mgmt_conn_login_options {
+	u8 flags;
+	u8 header_digest;
+	u8 data_digest;
+	u8 rsvd0;
+	u32 max_recv_datasegment_len_ini;
+	u32 max_recv_datasegment_len_tgt;
+	u32 tcp_mss;
+	u32 tcp_window_size;
+	struct	mgmt_auth_method_format auth_data;
+} __packed;
+
+struct ip_address_format {
+	u16 size_of_structure;
+	u8 reserved;
+	u8 ip_type;
+	u8 ip_address[16];
+	u32 rsvd0;
+} __packed;
+
+struct	mgmt_conn_info {
+	u32	connection_handle;
+	u32	connection_status;
+	u16	src_port;
+	u16	dest_port;
+	u16	dest_port_redirected;
+	u16	cid;
+	u32	estimated_throughput;
+	struct	ip_address_format	src_ipaddr;
+	struct	ip_address_format	dest_ipaddr;
+	struct	ip_address_format	dest_ipaddr_redirected;
+	struct	mgmt_conn_login_options	negotiated_login_options;
+} __packed;
+
+struct mgmt_session_login_options {
+	u8	flags;
+	u8	error_recovery_level;
+	u16	rsvd0;
+	u32	first_burst_length;
+	u32	max_burst_length;
+	u16	max_connections;
+	u16	max_outstanding_r2t;
+	u16	default_time2wait;
+	u16	default_time2retain;
+} __packed;
+
+struct mgmt_session_info {
+	u32	session_handle;
+	u32	status;
+	u8	isid[6];
+	u16	tsih;
+	u32	session_flags;
+	u16	conn_count;
+	u16	pad;
+	u8	target_name[224];
+	u8	initiator_iscsiname[224];
+	struct	mgmt_session_login_options negotiated_login_options;
+	struct	mgmt_conn_info	conn_list[1];
+} __packed;
+
+struct  be_cmd_req_get_session {
+	struct be_cmd_req_hdr hdr;
+	u32 session_handle;
+} __packed;
+
+struct  be_cmd_resp_get_session {
+	struct be_cmd_resp_hdr hdr;
+	struct mgmt_session_info session_info;
+} __packed;
+
 struct mac_addr {
 	u16 size_of_struct;
 	u8 addr[ETH_ALEN];
 } __packed;
 
+struct be_cmd_req_get_boot_target {
+	struct be_cmd_req_hdr hdr;
+} __packed;
+
+struct be_cmd_resp_get_boot_target {
+	struct be_cmd_resp_hdr hdr;
+	u32  boot_session_count;
+	int  boot_session_handle;
+};
+
 struct be_cmd_req_mac_query {
 	struct be_cmd_req_hdr hdr;
 	u8 type;
@@ -426,6 +531,11 @@ int be_poll_mcc(struct be_ctrl_info *ctrl);
 int mgmt_check_supported_fw(struct be_ctrl_info *ctrl,
 				      struct beiscsi_hba *phba);
 unsigned int be_cmd_get_mac_addr(struct beiscsi_hba *phba);
+unsigned int beiscsi_get_boot_target(struct beiscsi_hba *phba);
+unsigned int beiscsi_get_session_info(struct beiscsi_hba *phba,
+				  u32 boot_session_handle,
+				  struct be_dma_mem *nonemb_cmd);
+
 void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag);
 /*ISCSI Functuions */
 int be_cmd_fw_initialize(struct be_ctrl_info *ctrl);
@@ -601,14 +711,6 @@ struct be_eq_delay_params_in {
 	struct eq_delay delay[8];
 } __packed;
 
-struct ip_address_format {
-	u16 size_of_structure;
-	u8 reserved;
-	u8 ip_type;
-	u8 ip_address[16];
-	u32 rsvd0;
-} __packed;
-
 struct tcp_connect_and_offload_in {
 	struct be_cmd_req_hdr hdr;
 	struct ip_address_format ip_address;
@@ -688,18 +790,29 @@ struct be_fw_cfg {
 	u32 function_caps;
 } __packed;
 
-#define CMD_ISCSI_COMMAND_INVALIDATE  1
-#define ISCSI_OPCODE_SCSI_DATA_OUT      5
+struct be_all_if_id {
+	struct be_cmd_req_hdr hdr;
+	u32 if_count;
+	u32 if_hndl_list[1];
+} __packed;
+
+#define ISCSI_OPCODE_SCSI_DATA_OUT		5
+#define OPCODE_COMMON_MODIFY_EQ_DELAY		41
+#define OPCODE_COMMON_ISCSI_CLEANUP		59
+#define	OPCODE_COMMON_TCP_UPLOAD		56
 #define OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD 70
-#define OPCODE_ISCSI_INI_DRIVER_OFFLOAD_SESSION 41
-#define OPCODE_COMMON_MODIFY_EQ_DELAY	41
-#define OPCODE_COMMON_ISCSI_CLEANUP	59
-#define	OPCODE_COMMON_TCP_UPLOAD	56
 #define OPCODE_COMMON_ISCSI_ERROR_RECOVERY_INVALIDATE_COMMANDS 1
-/* --- CMD_ISCSI_INVALIDATE_CONNECTION_TYPE --- */
-#define CMD_ISCSI_CONNECTION_INVALIDATE 0x8001
-#define CMD_ISCSI_CONNECTION_ISSUE_TCP_RST 0x8002
+#define OPCODE_ISCSI_INI_CFG_GET_HBA_NAME	6
+#define OPCODE_ISCSI_INI_CFG_SET_HBA_NAME	7
+#define OPCODE_ISCSI_INI_SESSION_GET_A_SESSION  14
+#define OPCODE_ISCSI_INI_DRIVER_OFFLOAD_SESSION 41
 #define OPCODE_ISCSI_INI_DRIVER_INVALIDATE_CONNECTION 42
+#define OPCODE_ISCSI_INI_BOOT_GET_BOOT_TARGET	52
+
+/* --- CMD_ISCSI_INVALIDATE_CONNECTION_TYPE --- */
+#define CMD_ISCSI_COMMAND_INVALIDATE		1
+#define CMD_ISCSI_CONNECTION_INVALIDATE		0x8001
+#define CMD_ISCSI_CONNECTION_ISSUE_TCP_RST	0x8002
 
 #define INI_WR_CMD			1	/* Initiator write command */
 #define INI_TMF_CMD			2	/* Initiator TMF command */
drivers/scsi/be2iscsi/be_iscsi.c +42 -29

88 lines not on this page · raw message

drivers/scsi/be2iscsi/be_iscsi.h +2 -0
index 1f512c2..5a7f9b7 100644
@@ -54,6 +54,8 @@ int beiscsi_conn_get_param(struct iscsi_cls_conn *cls_conn,
 int beiscsi_get_host_param(struct Scsi_Host *shost,
 			   enum iscsi_host_param param, char *buf);
 
+int beiscsi_get_macaddr(char *buf, struct beiscsi_hba *phba);
+
 int beiscsi_set_param(struct iscsi_cls_conn *cls_conn,
 		      enum iscsi_param param, char *buf, int buflen);
 
drivers/scsi/be2iscsi/be_main.c +333 -1

379 lines not on this page · raw message

drivers/scsi/be2iscsi/be_main.h +2 -0
index 08996d0..978a57d 100644
@@ -311,6 +311,7 @@ struct beiscsi_hba {
 	struct list_head hba_queue;
 	unsigned short *cid_array;
 	struct iscsi_endpoint **ep_array;
+	struct iscsi_boot_kset *boot_kset;
 	struct Scsi_Host *shost;
 	struct {
 		/**
@@ -341,6 +342,7 @@ struct beiscsi_hba {
 	struct work_struct work_cqs;	/* The work being queued */
 	struct be_ctrl_info ctrl;
 	unsigned int generation;
+	struct mgmt_session_info boot_sess;
 	struct invalidate_command_table inv_tbl[128];
 
 };
drivers/scsi/be2iscsi/be_mgmt.c +71 -0

77 lines not on this page · raw message

Signature · 1 line
1.6.5.2
#1 lore raw
Quoted 5 lines · Jayamohan Kallickal

This patch contains changes for adding support for iscsi_boot.
Have modified to make read of mac address from chip as a function.

Since this is a rarely used call, I would like to make the call
to the chip

It actually gets called every logout and every login from the get host param path. If you do not have this info it is not going to work.

drivers/scsi/be2iscsi/be_main.c unlock: · line 221

Quoted 8 lines
drivers/scsi/be2iscsi/be_main.c +7 -0
+static ssize_t beiscsi_show_boot_tgt_info(void *data, int type, char *buf)
+{
+	struct beiscsi_hba *phba = data;
+	char *str = buf;
+	int rc;
+
+	printk(KERN_ERR " In beiscsi_show_boot_tgt_info type=%d\n", type);

I think you wanted this to be a beiscsi debug statement or at least KERN_INFO or KERN_DEBUG.

drivers/scsi/be2iscsi/be_main.c unlock: · line 300

Quoted 8 lines
drivers/scsi/be2iscsi/be_main.c +8 -0
+
+static ssize_t beiscsi_show_boot_ini_info(void *data, int type, char *buf)
+{
+	struct beiscsi_hba *phba = data;
+	char *str = buf;
+	int rc;
+
+	printk(KERN_ERR " In beiscsi_show_boot_ini_info type=%d\n", type);

Same as above.

drivers/scsi/be2iscsi/be_main.c unlock: · line 318

Quoted 7 lines
drivers/scsi/be2iscsi/be_main.c +7 -0
+static ssize_t beiscsi_show_boot_eth_info(void *data, int type, char *buf)
+{
+	struct beiscsi_hba *phba = data;
+	char *str = buf;
+	int rc;
+
+	printk(KERN_ERR " In beiscsi_show_boot_eth_info type = %d\n", type);

Same.

Quoted 6 lines
drivers/scsi/be2iscsi/be_main.c +6 -0
+
+static int beiscsi_setup_boot_info(struct beiscsi_hba *phba)
+{
+	struct iscsi_boot_kobj *boot_kobj;
+	char *set_name;
+

drivers/scsi/be2iscsi/be_main.c unlock: · line 411

Quoted 10 lines
drivers/scsi/be2iscsi/be_main.c +10 -0
+	set_name = kasprintf(GFP_KERNEL, "iscsi_boot%u", phba->shost->host_no);
+	if (!set_name)
+		return -ENOMEM;
+
+	phba->boot_kset = iscsi_boot_create_kset(set_name);
+	if (!phba->boot_kset) {
+		kfree(set_name);
+		return -ENOMEM;
+	}
+

You should use iscsi_boot_create_host_kset.

#2 lore raw

_____
From: Mike Christie [mailto:[email protected]]
To: Jayamohan Kalickal [mailto:[email protected]]
Cc: [email protected], [email protected], [email protected]
Sent: Tue, 13 Jul 2010 01:01:35 -0700
Subject: Re: [PATCH 17/20] be2iscsi: Add support for iscsi boot

Quoted 5 lines · Jayamohan Kallickal

This patch contains changes for adding support for iscsi_boot.
Have modified to make read of mac address from chip as a function.

Since this is a rarely used call, I would like to make the call
to the chip

It actually gets called every logout and every login from the get host param path. If you do not have this info it is not going to work.

OK. You want me to cache it? Fine, will do it.

Reg all the comments reg print stetments below, will move it to be2iscsi debugs.

drivers/scsi/be2iscsi/be_main.c unlock: · line 221

Quoted 8 lines
drivers/scsi/be2iscsi/be_main.c +7 -0
+static ssize_t beiscsi_show_boot_tgt_info(void *data, int type, char *buf)
+{
+	struct beiscsi_hba *phba = data;
+	char *str = buf;
+	int rc;
+
+	printk(KERN_ERR " In beiscsi_show_boot_tgt_info type=%d\n", type);

I think you wanted this to be a beiscsi debug statement or at least KERN_INFO or KERN_DEBUG.

drivers/scsi/be2iscsi/be_main.c unlock: · line 300

Quoted 8 lines
drivers/scsi/be2iscsi/be_main.c +8 -0
+
+static ssize_t beiscsi_show_boot_ini_info(void *data, int type, char *buf)
+{
+	struct beiscsi_hba *phba = data;
+	char *str = buf;
+	int rc;
+
+	printk(KERN_ERR " In beiscsi_show_boot_ini_info type=%d\n", type);

Same as above.

drivers/scsi/be2iscsi/be_main.c unlock: · line 318

Quoted 7 lines
drivers/scsi/be2iscsi/be_main.c +7 -0
+static ssize_t beiscsi_show_boot_eth_info(void *data, int type, char *buf)
+{
+	struct beiscsi_hba *phba = data;
+	char *str = buf;
+	int rc;
+
+	printk(KERN_ERR " In beiscsi_show_boot_eth_info type = %d\n", type);

Same.

Quoted 6 lines
drivers/scsi/be2iscsi/be_main.c +6 -0
+
+static int beiscsi_setup_boot_info(struct beiscsi_hba *phba)
+{
+	struct iscsi_boot_kobj *boot_kobj;
+	char *set_name;
+

drivers/scsi/be2iscsi/be_main.c unlock: · line 411

Quoted 10 lines
drivers/scsi/be2iscsi/be_main.c +10 -0
+	set_name = kasprintf(GFP_KERNEL, "iscsi_boot%u", phba->shost->host_no);
+	if (!set_name)
+		return -ENOMEM;
+
+	phba->boot_kset = iscsi_boot_create_kset(set_name);
+	if (!phba->boot_kset) {
+		kfree(set_name);
+		return -ENOMEM;
+	}
+

You should use iscsi_boot_create_host_kset.

___________________________________________________________________________________
This message, together with any attachment(s), contains confidential and proprietary information of ServerEngines Corporation and is intended only for the designated recipient(s) named above. Any unauthorized review, printing, retention, copying, disclosure or distribution is strictly prohibited. If you are not the intended recipient of this message, please immediately advise the sender by reply email message and delete all copies of this message and any attachment(s). Thank you.