#ifndef SPDK_ISCSI_CONN_H
#define SPDK_ISCSI_CONN_H
-#include <stdbool.h>
-#include <stdint.h>
+#include "spdk/stdinc.h"
#include "iscsi/iscsi.h"
#include "spdk/queue.h"
-#include "spdk/event.h"
+#include "spdk/cpuset.h"
+#include "spdk/scsi.h"
/*
* MAX_CONNECTION_PARAMS: The numbers of the params in conn_param_table
#define OBJECT_ISCSI_PDU 0x1
#define TRACE_GROUP_ISCSI 0x1
-#define TRACE_READ_FROM_SOCKET_DONE SPDK_TPOINT_ID(TRACE_GROUP_ISCSI, 0x0)
-#define TRACE_FLUSH_WRITEBUF_START SPDK_TPOINT_ID(TRACE_GROUP_ISCSI, 0x1)
-#define TRACE_FLUSH_WRITEBUF_DONE SPDK_TPOINT_ID(TRACE_GROUP_ISCSI, 0x2)
-#define TRACE_READ_PDU SPDK_TPOINT_ID(TRACE_GROUP_ISCSI, 0x3)
-#define TRACE_ISCSI_TASK_DONE SPDK_TPOINT_ID(TRACE_GROUP_ISCSI, 0x4)
-#define TRACE_ISCSI_TASK_QUEUE SPDK_TPOINT_ID(TRACE_GROUP_ISCSI, 0x5)
-#define TRACE_ISCSI_CONN_ACTIVE SPDK_TPOINT_ID(TRACE_GROUP_ISCSI, 0x6)
-#define TRACE_ISCSI_CONN_IDLE SPDK_TPOINT_ID(TRACE_GROUP_ISCSI, 0x7)
+#define TRACE_ISCSI_READ_FROM_SOCKET_DONE SPDK_TPOINT_ID(TRACE_GROUP_ISCSI, 0x0)
+#define TRACE_ISCSI_FLUSH_WRITEBUF_START SPDK_TPOINT_ID(TRACE_GROUP_ISCSI, 0x1)
+#define TRACE_ISCSI_FLUSH_WRITEBUF_DONE SPDK_TPOINT_ID(TRACE_GROUP_ISCSI, 0x2)
+#define TRACE_ISCSI_READ_PDU SPDK_TPOINT_ID(TRACE_GROUP_ISCSI, 0x3)
+#define TRACE_ISCSI_TASK_DONE SPDK_TPOINT_ID(TRACE_GROUP_ISCSI, 0x4)
+#define TRACE_ISCSI_TASK_QUEUE SPDK_TPOINT_ID(TRACE_GROUP_ISCSI, 0x5)
+#define TRACE_ISCSI_TASK_EXECUTED SPDK_TPOINT_ID(TRACE_GROUP_ISCSI, 0x6)
+#define TRACE_ISCSI_PDU_COMPLETED SPDK_TPOINT_ID(TRACE_GROUP_ISCSI, 0x7)
+
+struct spdk_poller;
struct spdk_iscsi_conn {
int id;
int is_valid;
- int is_idle;
/*
* All fields below this point are reinitialized each time the
* connection object is allocated. Make sure to update the
* SPDK_ISCSI_CONNECTION_MEMSET() macro if changing which fields
* are initialized when allocated.
*/
- struct spdk_iscsi_portal *portal;
+ struct spdk_iscsi_portal *portal;
+ int pg_tag;
+ char *portal_host;
+ char *portal_port;
+ struct spdk_cpuset *portal_cpumask;
uint32_t lcore;
- int sock;
- struct spdk_iscsi_sess *sess;
+ struct spdk_sock *sock;
+ struct spdk_iscsi_sess *sess;
enum iscsi_connection_state state;
int login_phase;
int authenticated;
int req_auth;
int req_mutual;
- uint64_t last_activity_tsc;
uint32_t pending_task_cnt;
uint32_t data_out_cnt;
uint32_t data_in_cnt;
uint32_t StatSN;
uint32_t exp_statsn;
- uint32_t ttt; /* target transfer tag*/
+ uint32_t ttt; /* target transfer tag */
char *partial_text_parameter;
STAILQ_ENTRY(spdk_iscsi_conn) link;
- struct spdk_poller *poller;
+ struct spdk_poller *flush_poller;
+ bool is_stopped; /* Set true when connection is stopped for migration */
TAILQ_HEAD(queued_r2t_tasks, spdk_iscsi_task) queued_r2t_tasks;
TAILQ_HEAD(active_r2t_tasks, spdk_iscsi_task) active_r2t_tasks;
TAILQ_HEAD(queued_datain_tasks, spdk_iscsi_task) queued_datain_tasks;
+
+ struct spdk_scsi_desc *open_lun_descs[SPDK_SCSI_DEV_MAX_LUN];
};
extern struct spdk_iscsi_conn *g_conns_array;
int spdk_initialize_iscsi_conns(void);
void spdk_shutdown_iscsi_conns(void);
-int spdk_iscsi_conn_construct(struct spdk_iscsi_portal *portal, int sock);
+int spdk_iscsi_conn_construct(struct spdk_iscsi_portal *portal, struct spdk_sock *sock);
void spdk_iscsi_conn_destruct(struct spdk_iscsi_conn *conn);
+void spdk_iscsi_conn_handle_nop(struct spdk_iscsi_conn *conn);
+void spdk_iscsi_conn_migration(struct spdk_iscsi_conn *conn);
void spdk_iscsi_conn_logout(struct spdk_iscsi_conn *conn);
int spdk_iscsi_drop_conns(struct spdk_iscsi_conn *conn,
const char *conn_match, int drop_all);
void spdk_iscsi_conn_set_min_per_core(int count);
-void spdk_iscsi_set_min_conn_idle_interval(int interval_in_us);
+int spdk_iscsi_conn_get_min_per_core(void);
int spdk_iscsi_conn_read_data(struct spdk_iscsi_conn *conn, int len,
void *buf);
+void spdk_iscsi_conn_write_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu);
void spdk_iscsi_conn_free_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu);