xref: /linux/drivers/infiniband/sw/rxe/rxe_opcode.h (revision 5c7af6c7938466aa2f3c52057f4dd28b4a1e9e42)
163fa15dbSBob Pearson /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
28700e3e7SMoni Shoua /*
38700e3e7SMoni Shoua  * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved.
48700e3e7SMoni Shoua  * Copyright (c) 2015 System Fabric Works, Inc. All rights reserved.
58700e3e7SMoni Shoua  */
68700e3e7SMoni Shoua 
78700e3e7SMoni Shoua #ifndef RXE_OPCODE_H
88700e3e7SMoni Shoua #define RXE_OPCODE_H
98700e3e7SMoni Shoua 
108700e3e7SMoni Shoua /*
118700e3e7SMoni Shoua  * contains header bit mask definitions and header lengths
128700e3e7SMoni Shoua  * declaration of the rxe_opcode_info struct and
138700e3e7SMoni Shoua  * rxe_wr_opcode_info struct
148700e3e7SMoni Shoua  */
158700e3e7SMoni Shoua 
168700e3e7SMoni Shoua enum rxe_wr_mask {
178700e3e7SMoni Shoua 	WR_INLINE_MASK			= BIT(0),
188700e3e7SMoni Shoua 	WR_ATOMIC_MASK			= BIT(1),
198700e3e7SMoni Shoua 	WR_SEND_MASK			= BIT(2),
208700e3e7SMoni Shoua 	WR_READ_MASK			= BIT(3),
218700e3e7SMoni Shoua 	WR_WRITE_MASK			= BIT(4),
22886441fbSBob Pearson 	WR_LOCAL_OP_MASK		= BIT(5),
23*5c7af6c7SXiao Yang 	WR_ATOMIC_WRITE_MASK		= BIT(7),
248700e3e7SMoni Shoua 
258700e3e7SMoni Shoua 	WR_READ_OR_WRITE_MASK		= WR_READ_MASK | WR_WRITE_MASK,
268700e3e7SMoni Shoua 	WR_WRITE_OR_SEND_MASK		= WR_WRITE_MASK | WR_SEND_MASK,
278700e3e7SMoni Shoua 	WR_ATOMIC_OR_READ_MASK		= WR_ATOMIC_MASK | WR_READ_MASK,
288700e3e7SMoni Shoua };
298700e3e7SMoni Shoua 
308700e3e7SMoni Shoua #define WR_MAX_QPT		(8)
318700e3e7SMoni Shoua 
328700e3e7SMoni Shoua struct rxe_wr_opcode_info {
338700e3e7SMoni Shoua 	char			*name;
348700e3e7SMoni Shoua 	enum rxe_wr_mask	mask[WR_MAX_QPT];
358700e3e7SMoni Shoua };
368700e3e7SMoni Shoua 
378700e3e7SMoni Shoua extern struct rxe_wr_opcode_info rxe_wr_opcode_info[];
388700e3e7SMoni Shoua 
398700e3e7SMoni Shoua enum rxe_hdr_type {
408700e3e7SMoni Shoua 	RXE_LRH,
418700e3e7SMoni Shoua 	RXE_GRH,
428700e3e7SMoni Shoua 	RXE_BTH,
438700e3e7SMoni Shoua 	RXE_RETH,
448700e3e7SMoni Shoua 	RXE_AETH,
458700e3e7SMoni Shoua 	RXE_ATMETH,
468700e3e7SMoni Shoua 	RXE_ATMACK,
478700e3e7SMoni Shoua 	RXE_IETH,
488700e3e7SMoni Shoua 	RXE_RDETH,
498700e3e7SMoni Shoua 	RXE_DETH,
508700e3e7SMoni Shoua 	RXE_IMMDT,
518700e3e7SMoni Shoua 	RXE_PAYLOAD,
528700e3e7SMoni Shoua 	NUM_HDR_TYPES
538700e3e7SMoni Shoua };
548700e3e7SMoni Shoua 
558700e3e7SMoni Shoua enum rxe_hdr_mask {
568700e3e7SMoni Shoua 	RXE_LRH_MASK		= BIT(RXE_LRH),
578700e3e7SMoni Shoua 	RXE_GRH_MASK		= BIT(RXE_GRH),
588700e3e7SMoni Shoua 	RXE_BTH_MASK		= BIT(RXE_BTH),
598700e3e7SMoni Shoua 	RXE_IMMDT_MASK		= BIT(RXE_IMMDT),
608700e3e7SMoni Shoua 	RXE_RETH_MASK		= BIT(RXE_RETH),
618700e3e7SMoni Shoua 	RXE_AETH_MASK		= BIT(RXE_AETH),
628700e3e7SMoni Shoua 	RXE_ATMETH_MASK		= BIT(RXE_ATMETH),
638700e3e7SMoni Shoua 	RXE_ATMACK_MASK		= BIT(RXE_ATMACK),
648700e3e7SMoni Shoua 	RXE_IETH_MASK		= BIT(RXE_IETH),
658700e3e7SMoni Shoua 	RXE_RDETH_MASK		= BIT(RXE_RDETH),
668700e3e7SMoni Shoua 	RXE_DETH_MASK		= BIT(RXE_DETH),
678700e3e7SMoni Shoua 	RXE_PAYLOAD_MASK	= BIT(RXE_PAYLOAD),
688700e3e7SMoni Shoua 
698700e3e7SMoni Shoua 	RXE_REQ_MASK		= BIT(NUM_HDR_TYPES + 0),
708700e3e7SMoni Shoua 	RXE_ACK_MASK		= BIT(NUM_HDR_TYPES + 1),
718700e3e7SMoni Shoua 	RXE_SEND_MASK		= BIT(NUM_HDR_TYPES + 2),
728700e3e7SMoni Shoua 	RXE_WRITE_MASK		= BIT(NUM_HDR_TYPES + 3),
738700e3e7SMoni Shoua 	RXE_READ_MASK		= BIT(NUM_HDR_TYPES + 4),
748700e3e7SMoni Shoua 	RXE_ATOMIC_MASK		= BIT(NUM_HDR_TYPES + 5),
758700e3e7SMoni Shoua 
768700e3e7SMoni Shoua 	RXE_RWR_MASK		= BIT(NUM_HDR_TYPES + 6),
778700e3e7SMoni Shoua 	RXE_COMP_MASK		= BIT(NUM_HDR_TYPES + 7),
788700e3e7SMoni Shoua 
798700e3e7SMoni Shoua 	RXE_START_MASK		= BIT(NUM_HDR_TYPES + 8),
808700e3e7SMoni Shoua 	RXE_MIDDLE_MASK		= BIT(NUM_HDR_TYPES + 9),
818700e3e7SMoni Shoua 	RXE_END_MASK		= BIT(NUM_HDR_TYPES + 10),
828700e3e7SMoni Shoua 
838700e3e7SMoni Shoua 	RXE_LOOPBACK_MASK	= BIT(NUM_HDR_TYPES + 12),
848700e3e7SMoni Shoua 
85*5c7af6c7SXiao Yang 	RXE_ATOMIC_WRITE_MASK   = BIT(NUM_HDR_TYPES + 14),
86*5c7af6c7SXiao Yang 
8745216d63SXiao Yang 	RXE_READ_OR_ATOMIC_MASK	= (RXE_READ_MASK | RXE_ATOMIC_MASK),
8845216d63SXiao Yang 	RXE_WRITE_OR_SEND_MASK	= (RXE_WRITE_MASK | RXE_SEND_MASK),
89373efe0fSXiao Yang 	RXE_READ_OR_WRITE_MASK	= (RXE_READ_MASK | RXE_WRITE_MASK),
908700e3e7SMoni Shoua };
918700e3e7SMoni Shoua 
928700e3e7SMoni Shoua #define OPCODE_NONE		(-1)
938700e3e7SMoni Shoua #define RXE_NUM_OPCODE		256
948700e3e7SMoni Shoua 
958700e3e7SMoni Shoua struct rxe_opcode_info {
968700e3e7SMoni Shoua 	char			*name;
978700e3e7SMoni Shoua 	enum rxe_hdr_mask	mask;
988700e3e7SMoni Shoua 	int			length;
998700e3e7SMoni Shoua 	int			offset[NUM_HDR_TYPES];
1008700e3e7SMoni Shoua };
1018700e3e7SMoni Shoua 
1028700e3e7SMoni Shoua extern struct rxe_opcode_info rxe_opcode[RXE_NUM_OPCODE];
1038700e3e7SMoni Shoua 
1048700e3e7SMoni Shoua #endif /* RXE_OPCODE_H */
105