diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-27 13:21:40 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-27 13:21:40 -0700 |
commit | 91d41fdf31f74e6e2e5f3cb018eca4200e36e202 (patch) | |
tree | 81ef11f06bd8047031a2d93706dc263fa1bacd56 /include | |
parent | c1095c6da518b0b64e724f629051fa67655cd8d9 (diff) | |
parent | 277c5f27a2c86a9a733c0ec0f6a9b1032dfa3e15 (diff) |
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
target: Convert to DIV_ROUND_UP_SECTOR_T usage for sectors / dev_max_sectors
kernel.h: Add DIV_ROUND_UP_ULL and DIV_ROUND_UP_SECTOR_T macro usage
iscsi-target: Add iSCSI fabric support for target v4.1
iscsi: Add Serial Number Arithmetic LT and GT into iscsi_proto.h
iscsi: Use struct scsi_lun in iscsi structs instead of u8[8]
iscsi: Resolve iscsi_proto.h naming conflicts with drivers/target/iscsi
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/kernel.h | 8 | ||||
-rw-r--r-- | include/scsi/iscsi_proto.h | 60 |
2 files changed, 60 insertions, 8 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 9a43ad792cfc..46ac9a50528d 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -56,6 +56,14 @@ #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) +#define DIV_ROUND_UP_ULL(ll,d) \ + ({ unsigned long long _tmp = (ll)+(d)-1; do_div(_tmp, d); _tmp; }) + +#if BITS_PER_LONG == 32 +# define DIV_ROUND_UP_SECTOR_T(ll,d) DIV_ROUND_UP_ULL(ll, d) +#else +# define DIV_ROUND_UP_SECTOR_T(ll,d) DIV_ROUND_UP(ll,d) +#endif /* The `const' in roundup() prevents gcc-3.3 from calling __divdi3 */ #define roundup(x, y) ( \ diff --git a/include/scsi/iscsi_proto.h b/include/scsi/iscsi_proto.h index ea68b3c56dbf..988ba06b3ad6 100644 --- a/include/scsi/iscsi_proto.h +++ b/include/scsi/iscsi_proto.h @@ -29,10 +29,40 @@ /* default iSCSI listen port for incoming connections */ #define ISCSI_LISTEN_PORT 3260 +/* iSCSI header length */ +#define ISCSI_HDR_LEN 48 + +/* iSCSI CRC32C length */ +#define ISCSI_CRC_LEN 4 + /* Padding word length */ #define ISCSI_PAD_LEN 4 /* + * Serial Number Arithmetic, 32 bits, RFC1982 + */ + +static inline int iscsi_sna_lt(u32 n1, u32 n2) +{ + return (s32)(n1 - n2) < 0; +} + +static inline int iscsi_sna_lte(u32 n1, u32 n2) +{ + return (s32)(n1 - n2) <= 0; +} + +static inline int iscsi_sna_gt(u32 n1, u32 n2) +{ + return (s32)(n1 - n2) > 0; +} + +static inline int iscsi_sna_gte(u32 n1, u32 n2) +{ + return (s32)(n1 - n2) >= 0; +} + +/* * useful common(control and data pathes) macro */ #define ntoh24(p) (((p)[0] << 16) | ((p)[1] << 8) | ((p)[2])) @@ -116,7 +146,7 @@ struct iscsi_ahs_hdr { #define ISCSI_CDB_SIZE 16 /* iSCSI PDU Header */ -struct iscsi_cmd { +struct iscsi_scsi_req { uint8_t opcode; uint8_t flags; __be16 rsvd2; @@ -161,7 +191,7 @@ struct iscsi_ecdb_ahdr { }; /* SCSI Response Header */ -struct iscsi_cmd_rsp { +struct iscsi_scsi_rsp { uint8_t opcode; uint8_t flags; uint8_t response; @@ -406,7 +436,7 @@ struct iscsi_text_rsp { }; /* Login Header */ -struct iscsi_login { +struct iscsi_login_req { uint8_t opcode; uint8_t flags; uint8_t max_version; /* Max. version supported */ @@ -427,7 +457,13 @@ struct iscsi_login { #define ISCSI_FLAG_LOGIN_TRANSIT 0x80 #define ISCSI_FLAG_LOGIN_CONTINUE 0x40 #define ISCSI_FLAG_LOGIN_CURRENT_STAGE_MASK 0x0C /* 2 bits */ +#define ISCSI_FLAG_LOGIN_CURRENT_STAGE1 0x04 +#define ISCSI_FLAG_LOGIN_CURRENT_STAGE2 0x08 +#define ISCSI_FLAG_LOGIN_CURRENT_STAGE3 0x0C #define ISCSI_FLAG_LOGIN_NEXT_STAGE_MASK 0x03 /* 2 bits */ +#define ISCSI_FLAG_LOGIN_NEXT_STAGE1 0x01 +#define ISCSI_FLAG_LOGIN_NEXT_STAGE2 0x02 +#define ISCSI_FLAG_LOGIN_NEXT_STAGE3 0x03 #define ISCSI_LOGIN_CURRENT_STAGE(flags) \ ((flags & ISCSI_FLAG_LOGIN_CURRENT_STAGE_MASK) >> 2) @@ -550,17 +586,25 @@ struct iscsi_logout_rsp { struct iscsi_snack { uint8_t opcode; uint8_t flags; - uint8_t rsvd2[14]; + uint8_t rsvd2[2]; + uint8_t hlength; + uint8_t dlength[3]; + uint8_t lun[8]; itt_t itt; + __be32 ttt; + uint8_t rsvd3[4]; + __be32 exp_statsn; + uint8_t rsvd4[8]; __be32 begrun; __be32 runlength; - __be32 exp_statsn; - __be32 rsvd3; - __be32 exp_datasn; - uint8_t rsvd6[8]; }; /* SNACK PDU flags */ +#define ISCSI_FLAG_SNACK_TYPE_DATA 0 +#define ISCSI_FLAG_SNACK_TYPE_R2T 0 +#define ISCSI_FLAG_SNACK_TYPE_STATUS 1 +#define ISCSI_FLAG_SNACK_TYPE_DATA_ACK 2 +#define ISCSI_FLAG_SNACK_TYPE_RDATA 3 #define ISCSI_FLAG_SNACK_TYPE_MASK 0x0F /* 4 bits */ /* Reject Message Header */ |