- * the types. MXLND_MASK_ICON_REQ and MXLND_MASK_ICON_ACK are used for
- * mx_iconnect(). We reserve the remaining combinations for future use. The
- * next 8 bits (52-59) are reserved for returning a status code for failed
- * GET_DATA (payload) messages. The last 52 bits are used for cookies. That
- * should allow unique cookies for 4 KB messages at 10 Gbps line rate without
- * rollover for about 8 years. That should be enough. */
-
-/* constants */
-#define MXLND_MASK_ICON_REQ (0xBLL << 60) /* it is a mx_iconnect() completion */
-#define MXLND_MASK_CONN_REQ (0xCLL << 60) /* CONN_REQ msg */
-#define MXLND_MASK_ICON_ACK (0x9LL << 60) /* it is a mx_iconnect() completion */
-#define MXLND_MASK_CONN_ACK (0xALL << 60) /* CONN_ACK msg*/
-#define MXLND_MASK_EAGER (0xELL << 60) /* EAGER msg */
-#define MXLND_MASK_NOOP (0x1LL << 60) /* NOOP msg */
-#define MXLND_MASK_PUT_REQ (0x2LL << 60) /* PUT_REQ msg */
-#define MXLND_MASK_PUT_ACK (0x3LL << 60) /* PUT_ACK msg */
-#define MXLND_MASK_PUT_DATA (0x4LL << 60) /* PUT_DATA msg */
-#define MXLND_MASK_GET_REQ (0x5LL << 60) /* GET_REQ msg */
-#define MXLND_MASK_GET_DATA (0x6LL << 60) /* GET_DATA msg */
-//#define MXLND_MASK_NAK (0x7LL << 60) /* NAK msg */
-
-#define MXLND_MAX_COOKIE ((1LL << 52) - 1) /* when to roll-over the cookie value */
-#define MXLND_NCOMPLETIONS (MXLND_N_SCHED + 2) /* max threads for completion array */
+ * the types. We reserve the remaining combinations for future use. The next 8
+ * bits (52-59) are reserved for returning a status code for failed GET_DATA
+ * (payload) messages. The last 52 bits are used for cookies. That should allow
+ * unique cookies for 4 KB messages at 10 Gbps line rate without rollover for
+ * about 8 years. That should be enough. */
+
+#define MXLND_MSG_OFFSET 60 /* msg type offset */
+#define MXLND_MSG_BITS (64 - MXLND_MSG_OFFSET)
+#define MXLND_MSG_MASK (((1ULL<<MXLND_MSG_BITS) - 1) << MXLND_MSG_OFFSET)
+#define MXLND_MSG_TYPE(x) (((x) & MXLND_MSG_MASK) >> MXLND_MSG_OFFSET)
+
+#define MXLND_ERROR_OFFSET 52 /* error value offset */
+#define MXLND_ERROR_BITS (MXLND_MSG_OFFSET - MXLND_ERROR_OFFSET)
+#define MXLND_ERROR_MASK (((1ULL<<MXLND_ERROR_BITS) - 1) << MXLND_ERROR_OFFSET)
+#define MXLND_ERROR_VAL(x) (((x) & MXLND_ERROR_MASK) >> MXLND_ERROR_OFFSET)
+
+/* message types */
+#define MXLND_MSG_ICON_REQ 0xb /* mx_iconnect() before CONN_REQ */
+#define MXLND_MSG_CONN_REQ 0xc /* connection request */
+#define MXLND_MSG_ICON_ACK 0x9 /* mx_iconnect() before CONN_ACK */
+#define MXLND_MSG_CONN_ACK 0xa /* connection request response */
+#define MXLND_MSG_BYE 0xd /* disconnect msg */
+#define MXLND_MSG_EAGER 0xe /* eager message */
+#define MXLND_MSG_NOOP 0x1 /* no msg, return credits */
+#define MXLND_MSG_PUT_REQ 0x2 /* put request src->sink */
+#define MXLND_MSG_PUT_ACK 0x3 /* put ack src<-sink */
+#define MXLND_MSG_PUT_DATA 0x4 /* put payload src->sink */
+#define MXLND_MSG_GET_REQ 0x5 /* get request sink->src */
+#define MXLND_MSG_GET_DATA 0x6 /* get payload sink<-src */
+
+/* when to roll-over the cookie value */
+#define MXLND_MAX_COOKIE ((1ULL << MXLND_ERROR_OFFSET) - 1)