Blame IbAccess/Common/Inc/stl_pkt.h

Packit 857059
/* BEGIN_ICS_COPYRIGHT5 ****************************************
Packit 857059
Packit 857059
Copyright (c) 2015-2017, Intel Corporation
Packit 857059
Packit 857059
Redistribution and use in source and binary forms, with or without
Packit 857059
modification, are permitted provided that the following conditions are met:
Packit 857059
Packit 857059
    * Redistributions of source code must retain the above copyright notice,
Packit 857059
      this list of conditions and the following disclaimer.
Packit 857059
    * Redistributions in binary form must reproduce the above copyright
Packit 857059
      notice, this list of conditions and the following disclaimer in the
Packit 857059
      documentation and/or other materials provided with the distribution.
Packit 857059
    * Neither the name of Intel Corporation nor the names of its contributors
Packit 857059
      may be used to endorse or promote products derived from this software
Packit 857059
      without specific prior written permission.
Packit 857059
Packit 857059
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Packit 857059
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Packit 857059
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Packit 857059
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
Packit 857059
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Packit 857059
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Packit 857059
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Packit 857059
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Packit 857059
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit 857059
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit 857059
Packit 857059
 * ** END_ICS_COPYRIGHT5   ****************************************/
Packit 857059
Packit 857059
/* [ICS VERSION STRING: unknown] */
Packit 857059
Packit 857059
#ifndef _IBA_STL_PKT_H_
Packit 857059
#define _IBA_STL_PKT_H_	(1)
Packit 857059
Packit 857059
#include "iba/ib_pkt.h"
Packit 857059
Packit 857059
#if defined (__cplusplus)
Packit 857059
extern "C" {
Packit 857059
#endif
Packit 857059
Packit 857059
#include "iba/public/ipackon.h"
Packit 857059
Packit 857059
/* L2 Codes */
Packit 857059
#define STL_L2_8B 0x0
Packit 857059
#define STL_L2_10B 0x1
Packit 857059
#define STL_L2_16B 0x2
Packit 857059
#define STL_L2_9B 0x3
Packit 857059
Packit 857059
/* 9B LNH (L4) */
Packit 857059
#define STL_9B_LNH_BTH 0x2
Packit 857059
#define STL_9B_LNH_GRH 0x3
Packit 857059
Packit 857059
/* L4 Types */
Packit 857059
#define STL_L4_TYPE_FM (0x08)
Packit 857059
#define STL_L4_TYPE_IB_LOCAL (0x09)
Packit 857059
#define STL_L4_TYPE_IB_GLOBAL (0x0A)
Packit 857059
#if defined(INCLUDE_STLEEP)
Packit 857059
#define STL_L4_TYPE_STLEEP (0x78)
Packit 857059
#define STL_L4_TYPE_STLEEP_EP (0x79)
Packit 857059
#endif
Packit 857059
Packit 857059
Packit 857059
Packit 857059
/*
Packit 857059
 * STL packet headers
Packit 857059
 */
Packit 857059
Packit 857059
/*  
Packit 857059
 * 8B Header Format 
Packit 857059
 */ 
Packit 857059
typedef struct _STL_8B_HDR {
Packit 857059
	STL_FIELDUNION4(u2, 32,
Packit 857059
		B:1,
Packit 857059
		L4:4,
Packit 857059
		Length:7,
Packit 857059
		SLID20:20);
Packit 857059
	STL_FIELDUNION6(u1, 32,
Packit 857059
		LT:1,
Packit 857059
		L2:2,
Packit 857059
		F:1,
Packit 857059
		RC:3,
Packit 857059
		SC:5,
Packit 857059
		DLID20:20);
Packit 857059
} STL_8B_HDR;
Packit 857059
static __inline void BSWAP_STL_8B_HDR( STL_8B_HDR *hdr) {
Packit 857059
#if CPU_BE
Packit 857059
	hdr->u1.AsReg32 = le32toh(hdr->u1.AsReg32);
Packit 857059
	hdr->u2.AsReg32 = le32toh(hdr->u2.AsReg32);
Packit 857059
#endif
Packit 857059
}
Packit 857059
Packit 857059
/*  
Packit 857059
 * 9B Header Format 
Packit 857059
 */ 
Packit 857059
typedef struct _STL_9B_HDR {
Packit 857059
	STL_FIELDUNION5(u1, 16,
Packit 857059
		LT:1,
Packit 857059
		L2:2,
Packit 857059
		Reserved_60_57:4,
Packit 857059
		ServiceChannel:5,
Packit 857059
		LinkVersion:4);
Packit 857059
	STL_FIELDUNION3(u2, 8,
Packit 857059
		ServiceLevel:4,
Packit 857059
		Reserved_43_42:2,
Packit 857059
		LNH:2);
Packit 857059
	STL_LID_16 DLID16;
Packit 857059
	STL_FIELDUNION2(u3, 16,
Packit 857059
		Reserved_23_20:4,
Packit 857059
		Length:12);
Packit 857059
	STL_LID_16 SLID16;
Packit 857059
} STL_9B_HDR;
Packit 857059
Packit 857059
static __inline void BSWAP_STL_9B_HDR( STL_9B_HDR *hdr) {
Packit 857059
#if CPU_LE
Packit 857059
	hdr->u1.AsReg16 = ntoh16(hdr->u1.AsReg16);
Packit 857059
	hdr->DLID16 = ntoh16(hdr->DLID16);
Packit 857059
	hdr->u3.AsReg16 = ntoh16(hdr->u3.AsReg16);
Packit 857059
	hdr->SLID16 = ntoh16(hdr->SLID16);
Packit 857059
#endif
Packit 857059
}
Packit 857059
Packit 857059
/*  
Packit 857059
 * 10B Header Format 
Packit 857059
 */ 
Packit 857059
typedef struct _STL_10B_HDR {
Packit 857059
	STL_FIELDUNION3(u2, 32,
Packit 857059
		B:1,
Packit 857059
		Length:11,
Packit 857059
		SLID20:20);
Packit 857059
	STL_FIELDUNION6(u1, 32,
Packit 857059
		LT:1,
Packit 857059
		L2:2,
Packit 857059
		F:1,
Packit 857059
		RC:3,
Packit 857059
		SC:5,
Packit 857059
		DLID20:20);
Packit 857059
	STL_FIELDUNION2(u3, 8,
Packit 857059
		Pkey:4,
Packit 857059
		L4:4);
Packit 857059
	uint8 Entropy;
Packit 857059
Packit 857059
} STL_10B_HDR;
Packit 857059
Packit 857059
static __inline void BSWAP_STL_10B_HDR( STL_10B_HDR *hdr) {
Packit 857059
#if CPU_BE
Packit 857059
	hdr->u1.AsReg32 = le32toh(hdr->u1.AsReg32);
Packit 857059
	hdr->u2.AsReg32 = le32toh(hdr->u2.AsReg32);
Packit 857059
#endif
Packit 857059
}
Packit 857059
Packit 857059
/*  
Packit 857059
 * 16B Header Format
Packit 857059
 */ 
Packit 857059
typedef struct _STL_16B_HDR {
Packit 857059
	STL_FIELDUNION3(u2, 32,
Packit 857059
		B:1,
Packit 857059
		Length:11,
Packit 857059
		SLID_19_0:20);
Packit 857059
	STL_FIELDUNION6(u1, 32,
Packit 857059
		LT:1,
Packit 857059
		L2:2,
Packit 857059
		F:1,
Packit 857059
		RC:3,
Packit 857059
		SC:5,
Packit 857059
		DLID_19_0:20);
Packit 857059
	uint8 L4;
Packit 857059
	STL_FIELDUNION2(u3, 8,
Packit 857059
		DLID_23_20:4,
Packit 857059
		SLID_23_20:4);
Packit 857059
	uint16 Pkey;
Packit 857059
	uint16 Entropy;
Packit 857059
	uint8 Age;
Packit 857059
	uint8 Reserved;
Packit 857059
} PACK_SUFFIX STL_16B_HDR;
Packit 857059
Packit 857059
static __inline void BSWAP_STL_16B_HDR( STL_16B_HDR *hdr) {
Packit 857059
#if CPU_BE
Packit 857059
	hdr->u1.AsReg32 = le32toh(hdr->u1.AsReg32);
Packit 857059
	hdr->u2.AsReg32 = le32toh(hdr->u2.AsReg32);
Packit 857059
	hdr->Entropy = le16toh(hdr->Entropy);
Packit 857059
	hdr->Pkey = le16toh(hdr->Pkey);
Packit 857059
#endif
Packit 857059
}
Packit 857059
Packit 857059
Packit 857059
/*
Packit 857059
 * Base Transport Header for STL 16B
Packit 857059
 */
Packit 857059
typedef struct _STL_16B_BTH {
Packit 857059
	uint8		OpCode;
Packit 857059
Packit 857059
	struct _STL_16B_BTH_V {IB_BITFIELD3(uint8,
Packit 857059
		SolicitedEvent:	1,
Packit 857059
		PadCount:		3,
Packit 857059
		HeaderVersion:	4)	/* Transport Header version */
Packit 857059
	} v;
Packit 857059
Packit 857059
	uint16 Reserved;
Packit 857059
Packit 857059
	STL_FIELDUNION3(Qp, 32,
Packit 857059
		Migrate:		1,
Packit 857059
		Reserved:		7,
Packit 857059
		DestQPNumber:	24);
Packit 857059
Packit 857059
	STL_FIELDUNION2(Psn, 32,
Packit 857059
		AckReq:			1,
Packit 857059
		PSN:			31);
Packit 857059
} PACK_SUFFIX STL_16B_BTH;
Packit 857059
static __inline void BSWAP_STL_16B_BTH(STL_16B_BTH *bth) {
Packit 857059
#if CPU_LE
Packit 857059
	bth->Qp.AsReg32 = ntoh32(bth->Qp.AsReg32);
Packit 857059
	bth->Psn.AsReg32 = ntoh32(bth->Psn.AsReg32);
Packit 857059
#endif
Packit 857059
}
Packit 857059
Packit 857059
Packit 857059
/*
Packit 857059
 * L4 FM Header
Packit 857059
 */
Packit 857059
typedef struct _STL_FMH {
Packit 857059
	STL_FIELDUNION2(DestQP, 32,
Packit 857059
		Reserved:     8,
Packit 857059
		DestQPNumber: 24);
Packit 857059
	STL_FIELDUNION2(SrcQP, 32,
Packit 857059
		Reserved:    8,
Packit 857059
		SrcQPNumber: 24);
Packit 857059
} PACK_SUFFIX STL_FMH;
Packit 857059
static __inline void BSWAP_STL_FMH(STL_FMH *fm_hdr) {
Packit 857059
#if CPU_LE
Packit 857059
	fm_hdr->DestQP.AsReg32 = ntoh32(fm_hdr->DestQP.AsReg32);
Packit 857059
	fm_hdr->SrcQP.AsReg32 = ntoh32(fm_hdr->SrcQP.AsReg32);
Packit 857059
#endif
Packit 857059
}
Packit 857059
Packit 857059
Packit 857059
#include "iba/public/ipackoff.h"
Packit 857059
Packit 857059
#if defined (__cplusplus)
Packit 857059
};
Packit 857059
#endif
Packit 857059
Packit 857059
#endif /* _IBA_STL_PKT_H_ */
Packit 857059