diff options
| author | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-03-22 17:14:09 -0400 |
|---|---|---|
| committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-07-25 03:48:08 -0400 |
| commit | 8304bbceee505742925b487fd8ea56e1f8b4b805 (patch) | |
| tree | 4776c640eb8aab7e8a957f9890a7e49a48855d2d /include | |
| parent | 55bdabdf41b6ee99e22e9d78a895b001fb1d852e (diff) | |
iscsi: Add Serial Number Arithmetic LT and GT into iscsi_proto.h
This patch moves the iscsi_sna_lt() and iscsi_sna_lte(), along with
iscsi_sna_gt() and iscsi_sna_gte() from iscsi_target_mod into
static inlines inside of include/scsi/iscsi_proto.h
This patch also includes the ISCSI_HDR_LEN and ISCSI_CRC_LEN
definitions.
(Added JesperJ simpliciation for iscsi_sna_* usage)
Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/scsi/iscsi_proto.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/include/scsi/iscsi_proto.h b/include/scsi/iscsi_proto.h index f5f83534fc13..988ba06b3ad6 100644 --- a/include/scsi/iscsi_proto.h +++ b/include/scsi/iscsi_proto.h | |||
| @@ -29,10 +29,40 @@ | |||
| 29 | /* default iSCSI listen port for incoming connections */ | 29 | /* default iSCSI listen port for incoming connections */ |
| 30 | #define ISCSI_LISTEN_PORT 3260 | 30 | #define ISCSI_LISTEN_PORT 3260 |
| 31 | 31 | ||
| 32 | /* iSCSI header length */ | ||
| 33 | #define ISCSI_HDR_LEN 48 | ||
| 34 | |||
| 35 | /* iSCSI CRC32C length */ | ||
| 36 | #define ISCSI_CRC_LEN 4 | ||
| 37 | |||
| 32 | /* Padding word length */ | 38 | /* Padding word length */ |
| 33 | #define ISCSI_PAD_LEN 4 | 39 | #define ISCSI_PAD_LEN 4 |
| 34 | 40 | ||
| 35 | /* | 41 | /* |
| 42 | * Serial Number Arithmetic, 32 bits, RFC1982 | ||
| 43 | */ | ||
| 44 | |||
| 45 | static inline int iscsi_sna_lt(u32 n1, u32 n2) | ||
| 46 | { | ||
| 47 | return (s32)(n1 - n2) < 0; | ||
| 48 | } | ||
| 49 | |||
| 50 | static inline int iscsi_sna_lte(u32 n1, u32 n2) | ||
| 51 | { | ||
| 52 | return (s32)(n1 - n2) <= 0; | ||
| 53 | } | ||
| 54 | |||
| 55 | static inline int iscsi_sna_gt(u32 n1, u32 n2) | ||
| 56 | { | ||
| 57 | return (s32)(n1 - n2) > 0; | ||
| 58 | } | ||
| 59 | |||
| 60 | static inline int iscsi_sna_gte(u32 n1, u32 n2) | ||
| 61 | { | ||
| 62 | return (s32)(n1 - n2) >= 0; | ||
| 63 | } | ||
| 64 | |||
| 65 | /* | ||
| 36 | * useful common(control and data pathes) macro | 66 | * useful common(control and data pathes) macro |
| 37 | */ | 67 | */ |
| 38 | #define ntoh24(p) (((p)[0] << 16) | ((p)[1] << 8) | ((p)[2])) | 68 | #define ntoh24(p) (((p)[0] << 16) | ((p)[1] << 8) | ((p)[2])) |
