ipath_common.h
来自「linux 内核源代码」· C头文件 代码 · 共 785 行 · 第 1/2 页
H
785 行
* number of words in KD protocol header * This tells InfiniPath how many words to copy to rcvhdrq. If 0, * kernel uses a default. Once set, attempts to set any other value * are an error (EAGAIN) until driver is reloaded. */ __u32 spu_rcvhdrsize; /* * If two or more processes wish to share a port, each process * must set the spu_subport_cnt and spu_subport_id to the same * values. The only restriction on the spu_subport_id is that * it be unique for a given node. */ __u16 spu_subport_cnt; __u16 spu_subport_id; __u32 spu_unused; /* kept for compatible layout */ /* * address of struct base_info to write to */ __u64 spu_base_info;} __attribute__ ((aligned(8)));/* User commands. */#define IPATH_CMD_MIN 16#define __IPATH_CMD_USER_INIT 16 /* old set up userspace (for old user code) */#define IPATH_CMD_PORT_INFO 17 /* find out what resources we got */#define IPATH_CMD_RECV_CTRL 18 /* control receipt of packets */#define IPATH_CMD_TID_UPDATE 19 /* update expected TID entries */#define IPATH_CMD_TID_FREE 20 /* free expected TID entries */#define IPATH_CMD_SET_PART_KEY 21 /* add partition key */#define __IPATH_CMD_SLAVE_INFO 22 /* return info on slave processes (for old user code) */#define IPATH_CMD_ASSIGN_PORT 23 /* allocate HCA and port */#define IPATH_CMD_USER_INIT 24 /* set up userspace */#define IPATH_CMD_UNUSED_1 25#define IPATH_CMD_UNUSED_2 26#define IPATH_CMD_PIOAVAILUPD 27 /* force an update of PIOAvail reg */#define IPATH_CMD_POLL_TYPE 28 /* set the kind of polling we want */#define IPATH_CMD_MAX 28/* * Poll types */#define IPATH_POLL_TYPE_URGENT 0x01#define IPATH_POLL_TYPE_OVERFLOW 0x02struct ipath_port_info { __u32 num_active; /* number of active units */ __u32 unit; /* unit (chip) assigned to caller */ __u16 port; /* port on unit assigned to caller */ __u16 subport; /* subport on unit assigned to caller */ __u16 num_ports; /* number of ports available on unit */ __u16 num_subports; /* number of subports opened on port */};struct ipath_tid_info { __u32 tidcnt; /* make structure same size in 32 and 64 bit */ __u32 tid__unused; /* virtual address of first page in transfer */ __u64 tidvaddr; /* pointer (same size 32/64 bit) to __u16 tid array */ __u64 tidlist; /* * pointer (same size 32/64 bit) to bitmap of TIDs used * for this call; checked for being large enough at open */ __u64 tidmap;};struct ipath_cmd { __u32 type; /* command type */ union { struct ipath_tid_info tid_info; struct ipath_user_info user_info; /* address in userspace of struct ipath_port_info to write result to */ __u64 port_info; /* enable/disable receipt of packets */ __u32 recv_ctrl; /* partition key to set */ __u16 part_key; /* user address of __u32 bitmask of active slaves */ __u64 slave_mask_addr; /* type of polling we want */ __u16 poll_type; } cmd;};struct ipath_iovec { /* Pointer to data, but same size 32 and 64 bit */ __u64 iov_base; /* * Length of data; don't need 64 bits, but want * ipath_sendpkt to remain same size as before 32 bit changes, so... */ __u64 iov_len;};/* * Describes a single packet for send. Each packet can have one or more * buffers, but the total length (exclusive of IB headers) must be less * than the MTU, and if using the PIO method, entire packet length, * including IB headers, must be less than the ipath_piosize value (words). * Use of this necessitates including sys/uio.h */struct __ipath_sendpkt { __u32 sps_flags; /* flags for packet (TBD) */ __u32 sps_cnt; /* number of entries to use in sps_iov */ /* array of iov's describing packet. TEMPORARY */ struct ipath_iovec sps_iov[4];};/* * diagnostics can send a packet by "writing" one of the following * two structs to diag data special file * The first is the legacy version for backward compatibility */struct ipath_diag_pkt { __u32 unit; __u64 data; __u32 len;};/* The second diag_pkt struct is the expanded version that allows * more control over the packet, specifically, by allowing a custom * pbc (+ extra) qword, so that special modes and deliberate * changes to CRCs can be used. The elements were also re-ordered * for better alignment and to avoid padding issues. */struct ipath_diag_xpkt { __u64 data; __u64 pbc_wd; __u32 unit; __u32 len;};/* * Data layout in I2C flash (for GUID, etc.) * All fields are little-endian binary unless otherwise stated */#define IPATH_FLASH_VERSION 2struct ipath_flash { /* flash layout version (IPATH_FLASH_VERSION) */ __u8 if_fversion; /* checksum protecting if_length bytes */ __u8 if_csum; /* * valid length (in use, protected by if_csum), including * if_fversion and if_csum themselves) */ __u8 if_length; /* the GUID, in network order */ __u8 if_guid[8]; /* number of GUIDs to use, starting from if_guid */ __u8 if_numguid; /* the (last 10 characters of) board serial number, in ASCII */ char if_serial[12]; /* board mfg date (YYYYMMDD ASCII) */ char if_mfgdate[8]; /* last board rework/test date (YYYYMMDD ASCII) */ char if_testdate[8]; /* logging of error counts, TBD */ __u8 if_errcntp[4]; /* powered on hours, updated at driver unload */ __u8 if_powerhour[2]; /* ASCII free-form comment field */ char if_comment[32]; /* Backwards compatible prefix for longer QLogic Serial Numbers */ char if_sprefix[4]; /* 82 bytes used, min flash size is 128 bytes */ __u8 if_future[46];};/* * These are the counters implemented in the chip, and are listed in order. * The InterCaps naming is taken straight from the chip spec. */struct infinipath_counters { __u64 LBIntCnt; __u64 LBFlowStallCnt; __u64 Reserved1; __u64 TxUnsupVLErrCnt; __u64 TxDataPktCnt; __u64 TxFlowPktCnt; __u64 TxDwordCnt; __u64 TxLenErrCnt; __u64 TxMaxMinLenErrCnt; __u64 TxUnderrunCnt; __u64 TxFlowStallCnt; __u64 TxDroppedPktCnt; __u64 RxDroppedPktCnt; __u64 RxDataPktCnt; __u64 RxFlowPktCnt; __u64 RxDwordCnt; __u64 RxLenErrCnt; __u64 RxMaxMinLenErrCnt; __u64 RxICRCErrCnt; __u64 RxVCRCErrCnt; __u64 RxFlowCtrlErrCnt; __u64 RxBadFormatCnt; __u64 RxLinkProblemCnt; __u64 RxEBPCnt; __u64 RxLPCRCErrCnt; __u64 RxBufOvflCnt; __u64 RxTIDFullErrCnt; __u64 RxTIDValidErrCnt; __u64 RxPKeyMismatchCnt; __u64 RxP0HdrEgrOvflCnt; __u64 RxP1HdrEgrOvflCnt; __u64 RxP2HdrEgrOvflCnt; __u64 RxP3HdrEgrOvflCnt; __u64 RxP4HdrEgrOvflCnt; __u64 RxP5HdrEgrOvflCnt; __u64 RxP6HdrEgrOvflCnt; __u64 RxP7HdrEgrOvflCnt; __u64 RxP8HdrEgrOvflCnt; __u64 Reserved6; __u64 Reserved7; __u64 IBStatusChangeCnt; __u64 IBLinkErrRecoveryCnt; __u64 IBLinkDownedCnt; __u64 IBSymbolErrCnt;};/* * The next set of defines are for packet headers, and chip register * and memory bits that are visible to and/or used by user-mode software * The other bits that are used only by the driver or diags are in * ipath_registers.h *//* RcvHdrFlags bits */#define INFINIPATH_RHF_LENGTH_MASK 0x7FF#define INFINIPATH_RHF_LENGTH_SHIFT 0#define INFINIPATH_RHF_RCVTYPE_MASK 0x7#define INFINIPATH_RHF_RCVTYPE_SHIFT 11#define INFINIPATH_RHF_EGRINDEX_MASK 0x7FF#define INFINIPATH_RHF_EGRINDEX_SHIFT 16#define INFINIPATH_RHF_H_ICRCERR 0x80000000#define INFINIPATH_RHF_H_VCRCERR 0x40000000#define INFINIPATH_RHF_H_PARITYERR 0x20000000#define INFINIPATH_RHF_H_LENERR 0x10000000#define INFINIPATH_RHF_H_MTUERR 0x08000000#define INFINIPATH_RHF_H_IHDRERR 0x04000000#define INFINIPATH_RHF_H_TIDERR 0x02000000#define INFINIPATH_RHF_H_MKERR 0x01000000#define INFINIPATH_RHF_H_IBERR 0x00800000#define INFINIPATH_RHF_L_SWA 0x00008000#define INFINIPATH_RHF_L_SWB 0x00004000/* infinipath header fields */#define INFINIPATH_I_VERS_MASK 0xF#define INFINIPATH_I_VERS_SHIFT 28#define INFINIPATH_I_PORT_MASK 0xF#define INFINIPATH_I_PORT_SHIFT 24#define INFINIPATH_I_TID_MASK 0x7FF#define INFINIPATH_I_TID_SHIFT 13#define INFINIPATH_I_OFFSET_MASK 0x1FFF#define INFINIPATH_I_OFFSET_SHIFT 0/* K_PktFlags bits */#define INFINIPATH_KPF_INTR 0x1#define INFINIPATH_KPF_SUBPORT_MASK 0x3#define INFINIPATH_KPF_SUBPORT_SHIFT 1#define INFINIPATH_MAX_SUBPORT 4/* SendPIO per-buffer control */#define INFINIPATH_SP_TEST 0x40#define INFINIPATH_SP_TESTEBP 0x20/* SendPIOAvail bits */#define INFINIPATH_SENDPIOAVAIL_BUSY_SHIFT 1#define INFINIPATH_SENDPIOAVAIL_CHECK_SHIFT 0/* infinipath header format */struct ipath_header { /* * Version - 4 bits, Port - 4 bits, TID - 10 bits and Offset - * 14 bits before ECO change ~28 Dec 03. After that, Vers 4, * Port 4, TID 11, offset 13. */ __le32 ver_port_tid_offset; __le16 chksum; __le16 pkt_flags;};/* infinipath user message header format. * This structure contains the first 4 fields common to all protocols * that employ infinipath. */struct ipath_message_header { __be16 lrh[4]; __be32 bth[3]; /* fields below this point are in host byte order */ struct ipath_header iph; __u8 sub_opcode;};/* infinipath ethernet header format */struct ether_header { __be16 lrh[4]; __be32 bth[3]; struct ipath_header iph; __u8 sub_opcode; __u8 cmd; __be16 lid; __u16 mac[3]; __u8 frag_num; __u8 seq_num; __le32 len; /* MUST be of word size due to PIO write requirements */ __le32 csum; __le16 csum_offset; __le16 flags; __u16 first_2_bytes; __u8 unused[2]; /* currently unused */};/* IB - LRH header consts */#define IPATH_LRH_GRH 0x0003 /* 1. word of IB LRH - next header: GRH */#define IPATH_LRH_BTH 0x0002 /* 1. word of IB LRH - next header: BTH *//* misc. */#define SIZE_OF_CRC 1#define IPATH_DEFAULT_P_KEY 0xFFFF#define IPATH_PERMISSIVE_LID 0xFFFF#define IPATH_AETH_CREDIT_SHIFT 24#define IPATH_AETH_CREDIT_MASK 0x1F#define IPATH_AETH_CREDIT_INVAL 0x1F#define IPATH_PSN_MASK 0xFFFFFF#define IPATH_MSN_MASK 0xFFFFFF#define IPATH_QPN_MASK 0xFFFFFF#define IPATH_MULTICAST_LID_BASE 0xC000#define IPATH_MULTICAST_QPN 0xFFFFFF/* Receive Header Queue: receive type (from infinipath) */#define RCVHQ_RCV_TYPE_EXPECTED 0#define RCVHQ_RCV_TYPE_EAGER 1#define RCVHQ_RCV_TYPE_NON_KD 2#define RCVHQ_RCV_TYPE_ERROR 3/* sub OpCodes - ith4x */#define IPATH_ITH4X_OPCODE_ENCAP 0x81#define IPATH_ITH4X_OPCODE_LID_ARP 0x82#define IPATH_HEADER_QUEUE_WORDS 9/* functions for extracting fields from rcvhdrq entries for the driver. */static inline __u32 ipath_hdrget_err_flags(const __le32 * rbuf){ return __le32_to_cpu(rbuf[1]);}static inline __u32 ipath_hdrget_rcv_type(const __le32 * rbuf){ return (__le32_to_cpu(rbuf[0]) >> INFINIPATH_RHF_RCVTYPE_SHIFT) & INFINIPATH_RHF_RCVTYPE_MASK;}static inline __u32 ipath_hdrget_length_in_bytes(const __le32 * rbuf){ return ((__le32_to_cpu(rbuf[0]) >> INFINIPATH_RHF_LENGTH_SHIFT) & INFINIPATH_RHF_LENGTH_MASK) << 2;}static inline __u32 ipath_hdrget_index(const __le32 * rbuf){ return (__le32_to_cpu(rbuf[0]) >> INFINIPATH_RHF_EGRINDEX_SHIFT) & INFINIPATH_RHF_EGRINDEX_MASK;}static inline __u32 ipath_hdrget_ipath_ver(__le32 hdrword){ return (__le32_to_cpu(hdrword) >> INFINIPATH_I_VERS_SHIFT) & INFINIPATH_I_VERS_MASK;}#endif /* _IPATH_COMMON_H */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?