diff options
author | Adheer Chandravanshi <adheer.chandravanshi@qlogic.com> | 2013-03-22 07:41:29 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-04-11 18:19:35 -0400 |
commit | c6a4bb2ef596d0bfe0d885ef6807b263ac83e47a (patch) | |
tree | 317560eb93ab800b72a8a33762a1228b3dc40e94 /include/scsi | |
parent | 9060f6bfc389edb195548d7357e588430c32ab77 (diff) |
[SCSI] scsi_transport_iscsi: Add flash node mgmt support
This patch allows iscsiadm to manage iSCSI target information stored on
adapter flash on per host basis.
The sysfs entries will look as cited below:
/sys/bus/iscsi_flashnode/devices/flashnode_sess-<host_no>:<flashnode_id>/<session attrs>
/sys/bus/iscsi_flashnode/devices/flashnode_conn-<host_no>:<flashnode_id>:<conn_id>/<conn attrs>
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Manish Rangankar <manish.rangankar@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'include/scsi')
-rw-r--r-- | include/scsi/iscsi_if.h | 113 | ||||
-rw-r--r-- | include/scsi/scsi_transport_iscsi.h | 151 |
2 files changed, 264 insertions, 0 deletions
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h index 917741bb8e11..f1b01839490c 100644 --- a/include/scsi/iscsi_if.h +++ b/include/scsi/iscsi_if.h | |||
@@ -63,6 +63,12 @@ enum iscsi_uevent_e { | |||
63 | ISCSI_UEVENT_PING = UEVENT_BASE + 22, | 63 | ISCSI_UEVENT_PING = UEVENT_BASE + 22, |
64 | ISCSI_UEVENT_GET_CHAP = UEVENT_BASE + 23, | 64 | ISCSI_UEVENT_GET_CHAP = UEVENT_BASE + 23, |
65 | ISCSI_UEVENT_DELETE_CHAP = UEVENT_BASE + 24, | 65 | ISCSI_UEVENT_DELETE_CHAP = UEVENT_BASE + 24, |
66 | ISCSI_UEVENT_SET_FLASHNODE_PARAMS = UEVENT_BASE + 25, | ||
67 | ISCSI_UEVENT_NEW_FLASHNODE = UEVENT_BASE + 26, | ||
68 | ISCSI_UEVENT_DEL_FLASHNODE = UEVENT_BASE + 27, | ||
69 | ISCSI_UEVENT_LOGIN_FLASHNODE = UEVENT_BASE + 28, | ||
70 | ISCSI_UEVENT_LOGOUT_FLASHNODE = UEVENT_BASE + 29, | ||
71 | ISCSI_UEVENT_LOGOUT_FLASHNODE_SID = UEVENT_BASE + 30, | ||
66 | 72 | ||
67 | /* up events */ | 73 | /* up events */ |
68 | ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1, | 74 | ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1, |
@@ -210,6 +216,31 @@ struct iscsi_uevent { | |||
210 | uint32_t host_no; | 216 | uint32_t host_no; |
211 | uint16_t chap_tbl_idx; | 217 | uint16_t chap_tbl_idx; |
212 | } delete_chap; | 218 | } delete_chap; |
219 | struct msg_set_flashnode_param { | ||
220 | uint32_t host_no; | ||
221 | uint32_t flashnode_idx; | ||
222 | uint32_t count; | ||
223 | } set_flashnode; | ||
224 | struct msg_new_flashnode { | ||
225 | uint32_t host_no; | ||
226 | uint32_t len; | ||
227 | } new_flashnode; | ||
228 | struct msg_del_flashnode { | ||
229 | uint32_t host_no; | ||
230 | uint32_t flashnode_idx; | ||
231 | } del_flashnode; | ||
232 | struct msg_login_flashnode { | ||
233 | uint32_t host_no; | ||
234 | uint32_t flashnode_idx; | ||
235 | } login_flashnode; | ||
236 | struct msg_logout_flashnode { | ||
237 | uint32_t host_no; | ||
238 | uint32_t flashnode_idx; | ||
239 | } logout_flashnode; | ||
240 | struct msg_logout_flashnode_sid { | ||
241 | uint32_t host_no; | ||
242 | uint32_t sid; | ||
243 | } logout_flashnode_sid; | ||
213 | } u; | 244 | } u; |
214 | union { | 245 | union { |
215 | /* messages k -> u */ | 246 | /* messages k -> u */ |
@@ -267,6 +298,9 @@ struct iscsi_uevent { | |||
267 | with each ping request */ | 298 | with each ping request */ |
268 | uint32_t data_size; | 299 | uint32_t data_size; |
269 | } ping_comp; | 300 | } ping_comp; |
301 | struct msg_new_flashnode_ret { | ||
302 | uint32_t flashnode_idx; | ||
303 | } new_flashnode_ret; | ||
270 | } r; | 304 | } r; |
271 | } __attribute__ ((aligned (sizeof(uint64_t)))); | 305 | } __attribute__ ((aligned (sizeof(uint64_t)))); |
272 | 306 | ||
@@ -274,6 +308,7 @@ enum iscsi_param_type { | |||
274 | ISCSI_PARAM, /* iscsi_param (session, conn, target, LU) */ | 308 | ISCSI_PARAM, /* iscsi_param (session, conn, target, LU) */ |
275 | ISCSI_HOST_PARAM, /* iscsi_host_param */ | 309 | ISCSI_HOST_PARAM, /* iscsi_host_param */ |
276 | ISCSI_NET_PARAM, /* iscsi_net_param */ | 310 | ISCSI_NET_PARAM, /* iscsi_net_param */ |
311 | ISCSI_FLASHNODE_PARAM, /* iscsi_flashnode_param */ | ||
277 | }; | 312 | }; |
278 | 313 | ||
279 | struct iscsi_iface_param_info { | 314 | struct iscsi_iface_param_info { |
@@ -469,6 +504,84 @@ enum iscsi_host_param { | |||
469 | ISCSI_HOST_PARAM_MAX, | 504 | ISCSI_HOST_PARAM_MAX, |
470 | }; | 505 | }; |
471 | 506 | ||
507 | /* iSCSI Flash Target params */ | ||
508 | enum iscsi_flashnode_param { | ||
509 | ISCSI_FLASHNODE_IS_FW_ASSIGNED_IPV6, | ||
510 | ISCSI_FLASHNODE_PORTAL_TYPE, | ||
511 | ISCSI_FLASHNODE_AUTO_SND_TGT_DISABLE, | ||
512 | ISCSI_FLASHNODE_DISCOVERY_SESS, | ||
513 | ISCSI_FLASHNODE_ENTRY_EN, | ||
514 | ISCSI_FLASHNODE_HDR_DGST_EN, | ||
515 | ISCSI_FLASHNODE_DATA_DGST_EN, | ||
516 | ISCSI_FLASHNODE_IMM_DATA_EN, | ||
517 | ISCSI_FLASHNODE_INITIAL_R2T_EN, | ||
518 | ISCSI_FLASHNODE_DATASEQ_INORDER, | ||
519 | ISCSI_FLASHNODE_PDU_INORDER, | ||
520 | ISCSI_FLASHNODE_CHAP_AUTH_EN, | ||
521 | ISCSI_FLASHNODE_SNACK_REQ_EN, | ||
522 | ISCSI_FLASHNODE_DISCOVERY_LOGOUT_EN, | ||
523 | ISCSI_FLASHNODE_BIDI_CHAP_EN, | ||
524 | /* make authentication for discovery sessions optional */ | ||
525 | ISCSI_FLASHNODE_DISCOVERY_AUTH_OPTIONAL, | ||
526 | ISCSI_FLASHNODE_ERL, | ||
527 | ISCSI_FLASHNODE_TCP_TIMESTAMP_STAT, | ||
528 | ISCSI_FLASHNODE_TCP_NAGLE_DISABLE, | ||
529 | ISCSI_FLASHNODE_TCP_WSF_DISABLE, | ||
530 | ISCSI_FLASHNODE_TCP_TIMER_SCALE, | ||
531 | ISCSI_FLASHNODE_TCP_TIMESTAMP_EN, | ||
532 | ISCSI_FLASHNODE_IP_FRAG_DISABLE, | ||
533 | ISCSI_FLASHNODE_MAX_RECV_DLENGTH, | ||
534 | ISCSI_FLASHNODE_MAX_XMIT_DLENGTH, | ||
535 | ISCSI_FLASHNODE_FIRST_BURST, | ||
536 | ISCSI_FLASHNODE_DEF_TIME2WAIT, | ||
537 | ISCSI_FLASHNODE_DEF_TIME2RETAIN, | ||
538 | ISCSI_FLASHNODE_MAX_R2T, | ||
539 | ISCSI_FLASHNODE_KEEPALIVE_TMO, | ||
540 | ISCSI_FLASHNODE_ISID, | ||
541 | ISCSI_FLASHNODE_TSID, | ||
542 | ISCSI_FLASHNODE_PORT, | ||
543 | ISCSI_FLASHNODE_MAX_BURST, | ||
544 | ISCSI_FLASHNODE_DEF_TASKMGMT_TMO, | ||
545 | ISCSI_FLASHNODE_IPADDR, | ||
546 | ISCSI_FLASHNODE_ALIAS, | ||
547 | ISCSI_FLASHNODE_REDIRECT_IPADDR, | ||
548 | ISCSI_FLASHNODE_MAX_SEGMENT_SIZE, | ||
549 | ISCSI_FLASHNODE_LOCAL_PORT, | ||
550 | ISCSI_FLASHNODE_IPV4_TOS, | ||
551 | ISCSI_FLASHNODE_IPV6_TC, | ||
552 | ISCSI_FLASHNODE_IPV6_FLOW_LABEL, | ||
553 | ISCSI_FLASHNODE_NAME, | ||
554 | ISCSI_FLASHNODE_TPGT, | ||
555 | ISCSI_FLASHNODE_LINK_LOCAL_IPV6, | ||
556 | ISCSI_FLASHNODE_DISCOVERY_PARENT_IDX, | ||
557 | ISCSI_FLASHNODE_DISCOVERY_PARENT_TYPE, | ||
558 | ISCSI_FLASHNODE_TCP_XMIT_WSF, | ||
559 | ISCSI_FLASHNODE_TCP_RECV_WSF, | ||
560 | ISCSI_FLASHNODE_CHAP_IN_IDX, | ||
561 | ISCSI_FLASHNODE_CHAP_OUT_IDX, | ||
562 | ISCSI_FLASHNODE_USERNAME, | ||
563 | ISCSI_FLASHNODE_USERNAME_IN, | ||
564 | ISCSI_FLASHNODE_PASSWORD, | ||
565 | ISCSI_FLASHNODE_PASSWORD_IN, | ||
566 | ISCSI_FLASHNODE_STATSN, | ||
567 | ISCSI_FLASHNODE_EXP_STATSN, | ||
568 | ISCSI_FLASHNODE_IS_BOOT_TGT, | ||
569 | |||
570 | ISCSI_FLASHNODE_MAX, | ||
571 | }; | ||
572 | |||
573 | struct iscsi_flashnode_param_info { | ||
574 | uint32_t len; /* Actual length of the param */ | ||
575 | uint16_t param; /* iscsi param value */ | ||
576 | uint8_t value[0]; /* length sized value follows */ | ||
577 | } __packed; | ||
578 | |||
579 | enum iscsi_discovery_parent_type { | ||
580 | ISCSI_DISC_PARENT_UNKNOWN = 0x1, | ||
581 | ISCSI_DISC_PARENT_SENDTGT = 0x2, | ||
582 | ISCSI_DISC_PARENT_ISNS = 0x3, | ||
583 | }; | ||
584 | |||
472 | /* iSCSI port Speed */ | 585 | /* iSCSI port Speed */ |
473 | enum iscsi_port_speed { | 586 | enum iscsi_port_speed { |
474 | ISCSI_PORT_SPEED_UNKNOWN = 0x1, | 587 | ISCSI_PORT_SPEED_UNKNOWN = 0x1, |
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h index 53f0b361d668..4a58cca2ecc1 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h | |||
@@ -39,6 +39,8 @@ struct iscsi_task; | |||
39 | struct sockaddr; | 39 | struct sockaddr; |
40 | struct iscsi_iface; | 40 | struct iscsi_iface; |
41 | struct bsg_job; | 41 | struct bsg_job; |
42 | struct iscsi_bus_flash_session; | ||
43 | struct iscsi_bus_flash_conn; | ||
42 | 44 | ||
43 | /** | 45 | /** |
44 | * struct iscsi_transport - iSCSI Transport template | 46 | * struct iscsi_transport - iSCSI Transport template |
@@ -150,6 +152,19 @@ struct iscsi_transport { | |||
150 | 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, |
151 | uint32_t *num_entries, char *buf); | 153 | uint32_t *num_entries, char *buf); |
152 | 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 (*get_flashnode_param) (struct iscsi_bus_flash_session *fnode_sess, | ||
156 | int param, char *buf); | ||
157 | int (*set_flashnode_param) (struct iscsi_bus_flash_session *fnode_sess, | ||
158 | struct iscsi_bus_flash_conn *fnode_conn, | ||
159 | void *data, int len); | ||
160 | int (*new_flashnode) (struct Scsi_Host *shost, const char *buf, | ||
161 | int len); | ||
162 | int (*del_flashnode) (struct iscsi_bus_flash_session *fnode_sess); | ||
163 | int (*login_flashnode) (struct iscsi_bus_flash_session *fnode_sess, | ||
164 | struct iscsi_bus_flash_conn *fnode_conn); | ||
165 | int (*logout_flashnode) (struct iscsi_bus_flash_session *fnode_sess, | ||
166 | struct iscsi_bus_flash_conn *fnode_conn); | ||
167 | int (*logout_flashnode_sid) (struct iscsi_cls_session *cls_sess); | ||
153 | }; | 168 | }; |
154 | 169 | ||
155 | /* | 170 | /* |
@@ -286,6 +301,112 @@ struct iscsi_iface { | |||
286 | #define iscsi_iface_to_shost(_iface) \ | 301 | #define iscsi_iface_to_shost(_iface) \ |
287 | dev_to_shost(_iface->dev.parent) | 302 | dev_to_shost(_iface->dev.parent) |
288 | 303 | ||
304 | |||
305 | struct iscsi_bus_flash_conn { | ||
306 | struct list_head conn_list; /* item in connlist */ | ||
307 | void *dd_data; /* LLD private data */ | ||
308 | struct iscsi_transport *transport; | ||
309 | struct device dev; /* sysfs transport/container device */ | ||
310 | /* iscsi connection parameters */ | ||
311 | uint32_t exp_statsn; | ||
312 | uint32_t statsn; | ||
313 | unsigned max_recv_dlength; /* initiator_max_recv_dsl*/ | ||
314 | unsigned max_xmit_dlength; /* target_max_recv_dsl */ | ||
315 | unsigned max_segment_size; | ||
316 | unsigned tcp_xmit_wsf; | ||
317 | unsigned tcp_recv_wsf; | ||
318 | int hdrdgst_en; | ||
319 | int datadgst_en; | ||
320 | int port; | ||
321 | char *ipaddress; | ||
322 | char *link_local_ipv6_addr; | ||
323 | char *redirect_ipaddr; | ||
324 | uint16_t keepalive_timeout; | ||
325 | uint16_t local_port; | ||
326 | uint8_t snack_req_en; | ||
327 | /* tcp timestamp negotiation status */ | ||
328 | uint8_t tcp_timestamp_stat; | ||
329 | uint8_t tcp_nagle_disable; | ||
330 | /* tcp window scale factor */ | ||
331 | uint8_t tcp_wsf_disable; | ||
332 | uint8_t tcp_timer_scale; | ||
333 | uint8_t tcp_timestamp_en; | ||
334 | uint8_t ipv4_tos; | ||
335 | uint8_t ipv6_traffic_class; | ||
336 | uint8_t ipv6_flow_label; | ||
337 | uint8_t fragment_disable; | ||
338 | /* Link local IPv6 address is assigned by firmware or driver */ | ||
339 | uint8_t is_fw_assigned_ipv6; | ||
340 | }; | ||
341 | |||
342 | #define iscsi_dev_to_flash_conn(_dev) \ | ||
343 | container_of(_dev, struct iscsi_bus_flash_conn, dev) | ||
344 | |||
345 | #define iscsi_flash_conn_to_flash_session(_conn) \ | ||
346 | iscsi_dev_to_flash_session(_conn->dev.parent) | ||
347 | |||
348 | #define ISID_SIZE 6 | ||
349 | |||
350 | struct iscsi_bus_flash_session { | ||
351 | struct list_head sess_list; /* item in session_list */ | ||
352 | struct iscsi_transport *transport; | ||
353 | unsigned int target_id; | ||
354 | int flash_state; /* persistent or non-persistent */ | ||
355 | void *dd_data; /* LLD private data */ | ||
356 | struct device dev; /* sysfs transport/container device */ | ||
357 | /* iscsi session parameters */ | ||
358 | unsigned first_burst; | ||
359 | unsigned max_burst; | ||
360 | unsigned short max_r2t; | ||
361 | int default_taskmgmt_timeout; | ||
362 | int initial_r2t_en; | ||
363 | int imm_data_en; | ||
364 | int time2wait; | ||
365 | int time2retain; | ||
366 | int pdu_inorder_en; | ||
367 | int dataseq_inorder_en; | ||
368 | int erl; | ||
369 | int tpgt; | ||
370 | char *username; | ||
371 | char *username_in; | ||
372 | char *password; | ||
373 | char *password_in; | ||
374 | char *targetname; | ||
375 | char *targetalias; | ||
376 | char *portal_type; | ||
377 | uint16_t tsid; | ||
378 | uint16_t chap_in_idx; | ||
379 | uint16_t chap_out_idx; | ||
380 | /* index of iSCSI discovery session if the entry is | ||
381 | * discovered by iSCSI discovery session | ||
382 | */ | ||
383 | uint16_t discovery_parent_idx; | ||
384 | /* indicates if discovery was done through iSNS discovery service | ||
385 | * or through sendTarget */ | ||
386 | uint16_t discovery_parent_type; | ||
387 | /* Firmware auto sendtarget discovery disable */ | ||
388 | uint8_t auto_snd_tgt_disable; | ||
389 | uint8_t discovery_sess; | ||
390 | /* indicates if this flashnode entry is enabled or disabled */ | ||
391 | uint8_t entry_state; | ||
392 | uint8_t chap_auth_en; | ||
393 | /* enables firmware to auto logout the discovery session on discovery | ||
394 | * completion | ||
395 | */ | ||
396 | uint8_t discovery_logout_en; | ||
397 | uint8_t bidi_chap_en; | ||
398 | /* makes authentication for discovery session optional */ | ||
399 | uint8_t discovery_auth_optional; | ||
400 | uint8_t isid[ISID_SIZE]; | ||
401 | uint8_t is_boot_target; | ||
402 | }; | ||
403 | |||
404 | #define iscsi_dev_to_flash_session(_dev) \ | ||
405 | container_of(_dev, struct iscsi_bus_flash_session, dev) | ||
406 | |||
407 | #define iscsi_flash_session_to_shost(_session) \ | ||
408 | dev_to_shost(_session->dev.parent) | ||
409 | |||
289 | /* | 410 | /* |
290 | * session and connection functions that can be used by HW iSCSI LLDs | 411 | * session and connection functions that can be used by HW iSCSI LLDs |
291 | */ | 412 | */ |
@@ -330,4 +451,34 @@ extern char *iscsi_get_port_speed_name(struct Scsi_Host *shost); | |||
330 | extern char *iscsi_get_port_state_name(struct Scsi_Host *shost); | 451 | extern char *iscsi_get_port_state_name(struct Scsi_Host *shost); |
331 | extern int iscsi_is_session_dev(const struct device *dev); | 452 | extern int iscsi_is_session_dev(const struct device *dev); |
332 | 453 | ||
454 | extern char *iscsi_get_discovery_parent_name(int parent_type); | ||
455 | extern struct device * | ||
456 | iscsi_find_flashnode(struct Scsi_Host *shost, void *data, | ||
457 | int (*fn)(struct device *dev, void *data)); | ||
458 | |||
459 | extern struct iscsi_bus_flash_session * | ||
460 | iscsi_create_flashnode_sess(struct Scsi_Host *shost, int index, | ||
461 | struct iscsi_transport *transport, int dd_size); | ||
462 | |||
463 | extern struct iscsi_bus_flash_conn * | ||
464 | iscsi_create_flashnode_conn(struct Scsi_Host *shost, | ||
465 | struct iscsi_bus_flash_session *fnode_sess, | ||
466 | struct iscsi_transport *transport, int dd_size); | ||
467 | |||
468 | extern void | ||
469 | iscsi_destroy_flashnode_sess(struct iscsi_bus_flash_session *fnode_sess); | ||
470 | |||
471 | extern void iscsi_destroy_all_flashnode(struct Scsi_Host *shost); | ||
472 | extern int iscsi_flashnode_bus_match(struct device *dev, | ||
473 | struct device_driver *drv); | ||
474 | extern int iscsi_is_flashnode_conn_dev(struct device *dev, void *data); | ||
475 | |||
476 | extern struct device * | ||
477 | iscsi_find_flashnode_sess(struct Scsi_Host *shost, void *data, | ||
478 | int (*fn)(struct device *dev, void *data)); | ||
479 | |||
480 | extern struct device * | ||
481 | iscsi_find_flashnode_conn(struct iscsi_bus_flash_session *fnode_sess, | ||
482 | void *data, | ||
483 | int (*fn)(struct device *dev, void *data)); | ||
333 | #endif | 484 | #endif |