Re: [ANNOUNCE 2/6] Open-iSCSI High-Performance Initiator for Linux

From: Matt Mackall
Date: Wed Mar 09 2005 - 01:37:17 EST


On Sun, Mar 06, 2005 at 11:12:06PM -0800, Alex Aizman wrote:

> +#define iscsi_ptr(_handle) ((void*)(unsigned long)_handle)
> +#define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr)

This is a bit wonky. Why is there a distinction?


> +#ifndef ISCSI_PROTO_H
> +#define ISCSI_PROTO_H
> +
> +#define ISCSI_VERSION_STR "0.1.0"
> +#define ISCSI_DATE_STR "17-Jan-2005"
> +#define ISCSI_DRAFT20_VERSION 0x00
> +
> +/* default iSCSI listen port for incoming connections */
> +#define ISCSI_LISTEN_PORT 3260
> +
> +/* Padding word length */
> +#define PAD_WORD_LEN 4

Namespace.

> +
> +/*
> + * useful common(control and data pathes) macro
> + */
> +#define ntoh24(p) (((p)[0] << 16) | ((p)[1] << 8) | ((p)[2]))
> +#define hton24(p, v) { \
> + p[0] = (((v) >> 16) & 0xFF); \
> + p[1] = (((v) >> 8) & 0xFF); \
> + p[2] = ((v) & 0xFF); \
> +}
> +#define zero_data(p) {p[0]=0;p[1]=0;p[2]=0;}

These are specific to dlength, yes? Can we instead roll dlength and
hlength together, and do this with masking?

#define iscsi_hlen(hdr) (ntohl(hdr->hdlen)>>24)
#define iscsi_dlen(hdr) (ntohl(hdr->hdlen) & 0xffffff)
#define iscsi_set_hlen(hdr, len) (hdr->hdlen=htonl(iscsi_dlen(hdr)|(len<<24)))
#define iscsi_set_hlen(hdr, len) (hdr->hdlen=htonl(len|(iscsi_hlen(hdr)<<24)))

The last two obviously have multiple evaluation, but you get the idea.

> +/* SNACK Header */

Mmm, snacks.

> +/* Reason for Reject */
> +#define CMD_BEFORE_LOGIN 1
> +#define DATA_DIGEST_ERROR 2
> +#define DATA_SNACK_REJECT 3
> +#define ISCSI_PROTOCOL_ERROR 4
> +#define CMD_NOT_SUPPORTED 5
> +#define IMM_CMD_REJECT 6
> +#define TASK_IN_PROGRESS 7
> +#define INVALID_SNACK 8
> +#define BOOKMARK_REJECTED 9
> +#define BOOKMARK_NO_RESOURCES 10
> +#define NEGOTIATION_RESET 11
> +
> +/* Max. number of Key=Value pairs in a text message */
> +#define MAX_KEY_VALUE_PAIRS 8192
> +
> +/* maximum length for text keys/values */
> +#define KEY_MAXLEN 64
> +#define VALUE_MAXLEN 255
> +#define TARGET_NAME_MAXLEN VALUE_MAXLEN
> +
> +#define DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH 8192

Namespace.

--
Mathematics is the supreme nostalgia of our time.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/