mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-24 21:54:34 -04:00
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
This commit is contained in:
commit
91d41fdf31
49 changed files with 22173 additions and 40 deletions
|
|
@ -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) ( \
|
||||
|
|
|
|||
|
|
@ -29,9 +29,39 @@
|
|||
/* 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
|
||||
*/
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Reference in a new issue