diff options
author | Adheer Chandravanshi <adheer.chandravanshi@qlogic.com> | 2013-09-17 07:54:48 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-10-25 04:58:01 -0400 |
commit | 3af142fea7da55718b733b25be9d54ddb87acfcc (patch) | |
tree | 978da743cf3fde4b405fdd802c762691290cae20 | |
parent | b1d0b63f99300c0bd8b3fa9c8058fcd9529e294f (diff) |
[SCSI] scsi_transport_iscsi: Add support to set CHAP entries
For offload iSCSI like qla4xxx, CHAP entries are stored in adapter's
flash.
This patch adds support to add/update CHAP entries in adapter's flash
using iscsi tools, like Open-iSCSI.
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r-- | drivers/scsi/scsi_transport_iscsi.c | 26 | ||||
-rw-r--r-- | include/scsi/iscsi_if.h | 17 | ||||
-rw-r--r-- | include/scsi/scsi_transport_iscsi.h | 1 |
3 files changed, 44 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index e4a989fa477d..63a6ca49d4e5 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c | |||
@@ -2744,6 +2744,28 @@ exit_get_chap: | |||
2744 | return err; | 2744 | return err; |
2745 | } | 2745 | } |
2746 | 2746 | ||
2747 | static int iscsi_set_chap(struct iscsi_transport *transport, | ||
2748 | struct iscsi_uevent *ev, uint32_t len) | ||
2749 | { | ||
2750 | char *data = (char *)ev + sizeof(*ev); | ||
2751 | struct Scsi_Host *shost; | ||
2752 | int err = 0; | ||
2753 | |||
2754 | if (!transport->set_chap) | ||
2755 | return -ENOSYS; | ||
2756 | |||
2757 | shost = scsi_host_lookup(ev->u.set_path.host_no); | ||
2758 | if (!shost) { | ||
2759 | pr_err("%s could not find host no %u\n", | ||
2760 | __func__, ev->u.set_path.host_no); | ||
2761 | return -ENODEV; | ||
2762 | } | ||
2763 | |||
2764 | err = transport->set_chap(shost, data, len); | ||
2765 | scsi_host_put(shost); | ||
2766 | return err; | ||
2767 | } | ||
2768 | |||
2747 | static int iscsi_delete_chap(struct iscsi_transport *transport, | 2769 | static int iscsi_delete_chap(struct iscsi_transport *transport, |
2748 | struct iscsi_uevent *ev) | 2770 | struct iscsi_uevent *ev) |
2749 | { | 2771 | { |
@@ -3234,6 +3256,10 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) | |||
3234 | case ISCSI_UEVENT_LOGOUT_FLASHNODE_SID: | 3256 | case ISCSI_UEVENT_LOGOUT_FLASHNODE_SID: |
3235 | err = iscsi_logout_flashnode_sid(transport, ev); | 3257 | err = iscsi_logout_flashnode_sid(transport, ev); |
3236 | break; | 3258 | break; |
3259 | case ISCSI_UEVENT_SET_CHAP: | ||
3260 | err = iscsi_set_chap(transport, ev, | ||
3261 | nlmsg_attrlen(nlh, sizeof(*ev))); | ||
3262 | break; | ||
3237 | default: | 3263 | default: |
3238 | err = -ENOSYS; | 3264 | err = -ENOSYS; |
3239 | break; | 3265 | break; |
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h index 13d81c5c4ebf..5d6ed6cf12cc 100644 --- a/include/scsi/iscsi_if.h +++ b/include/scsi/iscsi_if.h | |||
@@ -69,6 +69,7 @@ enum iscsi_uevent_e { | |||
69 | ISCSI_UEVENT_LOGIN_FLASHNODE = UEVENT_BASE + 28, | 69 | ISCSI_UEVENT_LOGIN_FLASHNODE = UEVENT_BASE + 28, |
70 | ISCSI_UEVENT_LOGOUT_FLASHNODE = UEVENT_BASE + 29, | 70 | ISCSI_UEVENT_LOGOUT_FLASHNODE = UEVENT_BASE + 29, |
71 | ISCSI_UEVENT_LOGOUT_FLASHNODE_SID = UEVENT_BASE + 30, | 71 | ISCSI_UEVENT_LOGOUT_FLASHNODE_SID = UEVENT_BASE + 30, |
72 | ISCSI_UEVENT_SET_CHAP = UEVENT_BASE + 31, | ||
72 | 73 | ||
73 | /* up events */ | 74 | /* up events */ |
74 | ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1, | 75 | ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1, |
@@ -309,8 +310,16 @@ enum iscsi_param_type { | |||
309 | ISCSI_HOST_PARAM, /* iscsi_host_param */ | 310 | ISCSI_HOST_PARAM, /* iscsi_host_param */ |
310 | ISCSI_NET_PARAM, /* iscsi_net_param */ | 311 | ISCSI_NET_PARAM, /* iscsi_net_param */ |
311 | ISCSI_FLASHNODE_PARAM, /* iscsi_flashnode_param */ | 312 | ISCSI_FLASHNODE_PARAM, /* iscsi_flashnode_param */ |
313 | ISCSI_CHAP_PARAM, /* iscsi_chap_param */ | ||
312 | }; | 314 | }; |
313 | 315 | ||
316 | /* structure for minimalist usecase */ | ||
317 | struct iscsi_param_info { | ||
318 | uint32_t len; /* Actual length of the param value */ | ||
319 | uint16_t param; /* iscsi param */ | ||
320 | uint8_t value[0]; /* length sized value follows */ | ||
321 | } __packed; | ||
322 | |||
314 | struct iscsi_iface_param_info { | 323 | struct iscsi_iface_param_info { |
315 | uint32_t iface_num; /* iface number, 0 - n */ | 324 | uint32_t iface_num; /* iface number, 0 - n */ |
316 | uint32_t len; /* Actual length of the param */ | 325 | uint32_t len; /* Actual length of the param */ |
@@ -739,6 +748,14 @@ enum chap_type_e { | |||
739 | CHAP_TYPE_IN, | 748 | CHAP_TYPE_IN, |
740 | }; | 749 | }; |
741 | 750 | ||
751 | enum iscsi_chap_param { | ||
752 | ISCSI_CHAP_PARAM_INDEX, | ||
753 | ISCSI_CHAP_PARAM_CHAP_TYPE, | ||
754 | ISCSI_CHAP_PARAM_USERNAME, | ||
755 | ISCSI_CHAP_PARAM_PASSWORD, | ||
756 | ISCSI_CHAP_PARAM_PASSWORD_LEN | ||
757 | }; | ||
758 | |||
742 | #define ISCSI_CHAP_AUTH_NAME_MAX_LEN 256 | 759 | #define ISCSI_CHAP_AUTH_NAME_MAX_LEN 256 |
743 | #define ISCSI_CHAP_AUTH_SECRET_MAX_LEN 256 | 760 | #define ISCSI_CHAP_AUTH_SECRET_MAX_LEN 256 |
744 | struct iscsi_chap_rec { | 761 | struct iscsi_chap_rec { |
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h index d0f1602985e7..fe7c8f3e93f8 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h | |||
@@ -152,6 +152,7 @@ struct iscsi_transport { | |||
152 | int (*get_chap) (struct Scsi_Host *shost, uint16_t chap_tbl_idx, | 152 | int (*get_chap) (struct Scsi_Host *shost, uint16_t chap_tbl_idx, |
153 | uint32_t *num_entries, char *buf); | 153 | uint32_t *num_entries, char *buf); |
154 | int (*delete_chap) (struct Scsi_Host *shost, uint16_t chap_tbl_idx); | 154 | int (*delete_chap) (struct Scsi_Host *shost, uint16_t chap_tbl_idx); |
155 | int (*set_chap) (struct Scsi_Host *shost, void *data, int len); | ||
155 | int (*get_flashnode_param) (struct iscsi_bus_flash_session *fnode_sess, | 156 | int (*get_flashnode_param) (struct iscsi_bus_flash_session *fnode_sess, |
156 | int param, char *buf); | 157 | int param, char *buf); |
157 | int (*set_flashnode_param) (struct iscsi_bus_flash_session *fnode_sess, | 158 | int (*set_flashnode_param) (struct iscsi_bus_flash_session *fnode_sess, |