aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/libiscsi.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/scsi/libiscsi.h')
-rw-r--r--include/scsi/libiscsi.h33
1 files changed, 31 insertions, 2 deletions
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index e1fb3d0927b0..a9a9e869188d 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -78,6 +78,9 @@ enum {
78#define ISCSI_ADDRESS_BUF_LEN 64 78#define ISCSI_ADDRESS_BUF_LEN 64
79 79
80enum { 80enum {
81 /* this is the maximum possible storage for AHSs */
82 ISCSI_MAX_AHS_SIZE = sizeof(struct iscsi_ecdb_ahdr) +
83 sizeof(struct iscsi_rlength_ahdr),
81 ISCSI_DIGEST_SIZE = sizeof(__u32), 84 ISCSI_DIGEST_SIZE = sizeof(__u32),
82}; 85};
83 86
@@ -102,10 +105,13 @@ enum {
102 105
103struct iscsi_cmd_task { 106struct iscsi_cmd_task {
104 /* 107 /*
105 * Becuae LLDs allocate their hdr differently, this is a pointer to 108 * Because LLDs allocate their hdr differently, this is a pointer
106 * that storage. It must be setup at session creation time. 109 * and length to that storage. It must be setup at session
110 * creation time.
107 */ 111 */
108 struct iscsi_cmd *hdr; 112 struct iscsi_cmd *hdr;
113 unsigned short hdr_max;
114 unsigned short hdr_len; /* accumulated size of hdr used */
109 int itt; /* this ITT */ 115 int itt; /* this ITT */
110 116
111 uint32_t unsol_datasn; 117 uint32_t unsol_datasn;
@@ -124,6 +130,11 @@ struct iscsi_cmd_task {
124 void *dd_data; /* driver/transport data */ 130 void *dd_data; /* driver/transport data */
125}; 131};
126 132
133static inline void* iscsi_next_hdr(struct iscsi_cmd_task *ctask)
134{
135 return (void*)ctask->hdr + ctask->hdr_len;
136}
137
127struct iscsi_conn { 138struct iscsi_conn {
128 struct iscsi_cls_conn *cls_conn; /* ptr to class connection */ 139 struct iscsi_cls_conn *cls_conn; /* ptr to class connection */
129 void *dd_data; /* iscsi_transport data */ 140 void *dd_data; /* iscsi_transport data */
@@ -342,4 +353,22 @@ extern void iscsi_requeue_ctask(struct iscsi_cmd_task *ctask);
342extern void iscsi_pool_free(struct iscsi_queue *, void **); 353extern void iscsi_pool_free(struct iscsi_queue *, void **);
343extern int iscsi_pool_init(struct iscsi_queue *, int, void ***, int); 354extern int iscsi_pool_init(struct iscsi_queue *, int, void ***, int);
344 355
356/*
357 * inline functions to deal with padding.
358 */
359static inline unsigned int
360iscsi_padded(unsigned int len)
361{
362 return (len + ISCSI_PAD_LEN - 1) & ~(ISCSI_PAD_LEN - 1);
363}
364
365static inline unsigned int
366iscsi_padding(unsigned int len)
367{
368 len &= (ISCSI_PAD_LEN - 1);
369 if (len)
370 len = ISCSI_PAD_LEN - len;
371 return len;
372}
373
345#endif 374#endif