Browse Source

iSCSI updated to use data-xfer interface on the socket side (TCP).

SCSI interface not yet implemented.
tags/v0.9.3
Michael Brown 17 years ago
parent
commit
9b28b25332
2 changed files with 395 additions and 361 deletions
  1. 16
    31
      src/include/gpxe/iscsi.h
  2. 379
    330
      src/net/tcp/iscsi.c

+ 16
- 31
src/include/gpxe/iscsi.h View File

8
  */
8
  */
9
 
9
 
10
 #include <stdint.h>
10
 #include <stdint.h>
11
-#include <gpxe/stream.h>
12
-#include <gpxe/async.h>
13
 #include <gpxe/scsi.h>
11
 #include <gpxe/scsi.h>
14
 #include <gpxe/chap.h>
12
 #include <gpxe/chap.h>
13
+#include <gpxe/refcnt.h>
14
+#include <gpxe/xfer.h>
15
+#include <gpxe/process.h>
15
 
16
 
16
 /** Default iSCSI port */
17
 /** Default iSCSI port */
17
 #define ISCSI_PORT 3260
18
 #define ISCSI_PORT 3260
486
 
487
 
487
 /** An iSCSI session */
488
 /** An iSCSI session */
488
 struct iscsi_session {
489
 struct iscsi_session {
490
+	/** Reference counter */
491
+	struct refcnt refcnt;
492
+
493
+	/** Transport-layer socket */
494
+	struct xfer_interface socket;
495
+
489
 	/** Initiator IQN */
496
 	/** Initiator IQN */
490
-	const char *initiator_iqn;
497
+	char *initiator_iqn;
491
 	/** Target address */
498
 	/** Target address */
492
-	struct sockaddr target;
499
+	char *target_address;
493
 	/** Target IQN */
500
 	/** Target IQN */
494
-	const char *target_iqn;
501
+	char *target_iqn;
495
 	/** Logical Unit Number (LUN) */
502
 	/** Logical Unit Number (LUN) */
496
 	uint64_t lun;
503
 	uint64_t lun;
497
 	/** Username */
504
 	/** Username */
498
-	const char *username;
505
+	char *username;
499
 	/** Password */
506
 	/** Password */
500
-	const char *password;
507
+	char *password;
501
 
508
 
502
-	/** Stream application for this session */
503
-	struct stream_application stream;
504
 	/** Session status
509
 	/** Session status
505
 	 *
510
 	 *
506
 	 * This is the bitwise-OR of zero or more ISCSI_STATUS_XXX
511
 	 * This is the bitwise-OR of zero or more ISCSI_STATUS_XXX
569
 	union iscsi_bhs tx_bhs;
574
 	union iscsi_bhs tx_bhs;
570
 	/** State of the TX engine */
575
 	/** State of the TX engine */
571
 	enum iscsi_tx_state tx_state;
576
 	enum iscsi_tx_state tx_state;
572
-	/** Byte offset within the current TX state */
573
-	size_t tx_offset;
574
-	/** Length of the current TX state */
575
-	size_t tx_len;
577
+	/** TX process */
578
+	struct process process;
576
 
579
 
577
 	/** Basic header segment for current RX PDU */
580
 	/** Basic header segment for current RX PDU */
578
 	union iscsi_bhs rx_bhs;
581
 	union iscsi_bhs rx_bhs;
590
 	 * Set to NULL when command is complete.
593
 	 * Set to NULL when command is complete.
591
 	 */
594
 	 */
592
 	struct scsi_command *command;
595
 	struct scsi_command *command;
593
-	/** Asynchronous operation for the current iSCSI operation */
594
-	struct async async;
595
 	/** Instant return code
596
 	/** Instant return code
596
 	 *
597
 	 *
597
 	 * Set to a non-zero value if all requests should return
598
 	 * Set to a non-zero value if all requests should return
637
 /** Maximum number of retries at connecting */
638
 /** Maximum number of retries at connecting */
638
 #define ISCSI_MAX_RETRIES 2
639
 #define ISCSI_MAX_RETRIES 2
639
 
640
 
640
-extern int iscsi_issue ( struct iscsi_session *iscsi,
641
-			 struct scsi_command *command,
642
-			 struct async *parent );
643
-extern void iscsi_shutdown ( struct iscsi_session *iscsi );
644
-
645
-/** An iSCSI device */
646
-struct iscsi_device {
647
-	/** SCSI device interface */
648
-	struct scsi_device scsi;
649
-	/** iSCSI protocol instance */
650
-	struct iscsi_session iscsi;
651
-};
652
-
653
-extern int init_iscsidev ( struct iscsi_device *iscsidev );
654
-extern void fini_iscsidev ( struct iscsi_device *iscsidev );
655
-
656
 #endif /* _GPXE_ISCSI_H */
641
 #endif /* _GPXE_ISCSI_H */

+ 379
- 330
src/net/tcp/iscsi.c
File diff suppressed because it is too large
View File


Loading…
Cancel
Save