18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved.
48c2ecf20Sopenharmony_ci * Copyright (c) 2015 System Fabric Works, Inc. All rights reserved.
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef RXE_OPCODE_H
88c2ecf20Sopenharmony_ci#define RXE_OPCODE_H
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci/*
118c2ecf20Sopenharmony_ci * contains header bit mask definitions and header lengths
128c2ecf20Sopenharmony_ci * declaration of the rxe_opcode_info struct and
138c2ecf20Sopenharmony_ci * rxe_wr_opcode_info struct
148c2ecf20Sopenharmony_ci */
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_cienum rxe_wr_mask {
178c2ecf20Sopenharmony_ci	WR_INLINE_MASK			= BIT(0),
188c2ecf20Sopenharmony_ci	WR_ATOMIC_MASK			= BIT(1),
198c2ecf20Sopenharmony_ci	WR_SEND_MASK			= BIT(2),
208c2ecf20Sopenharmony_ci	WR_READ_MASK			= BIT(3),
218c2ecf20Sopenharmony_ci	WR_WRITE_MASK			= BIT(4),
228c2ecf20Sopenharmony_ci	WR_LOCAL_MASK			= BIT(5),
238c2ecf20Sopenharmony_ci	WR_REG_MASK			= BIT(6),
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci	WR_READ_OR_WRITE_MASK		= WR_READ_MASK | WR_WRITE_MASK,
268c2ecf20Sopenharmony_ci	WR_READ_WRITE_OR_SEND_MASK	= WR_READ_OR_WRITE_MASK | WR_SEND_MASK,
278c2ecf20Sopenharmony_ci	WR_WRITE_OR_SEND_MASK		= WR_WRITE_MASK | WR_SEND_MASK,
288c2ecf20Sopenharmony_ci	WR_ATOMIC_OR_READ_MASK		= WR_ATOMIC_MASK | WR_READ_MASK,
298c2ecf20Sopenharmony_ci};
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#define WR_MAX_QPT		(8)
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_cistruct rxe_wr_opcode_info {
348c2ecf20Sopenharmony_ci	char			*name;
358c2ecf20Sopenharmony_ci	enum rxe_wr_mask	mask[WR_MAX_QPT];
368c2ecf20Sopenharmony_ci};
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ciextern struct rxe_wr_opcode_info rxe_wr_opcode_info[];
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_cienum rxe_hdr_type {
418c2ecf20Sopenharmony_ci	RXE_LRH,
428c2ecf20Sopenharmony_ci	RXE_GRH,
438c2ecf20Sopenharmony_ci	RXE_BTH,
448c2ecf20Sopenharmony_ci	RXE_RETH,
458c2ecf20Sopenharmony_ci	RXE_AETH,
468c2ecf20Sopenharmony_ci	RXE_ATMETH,
478c2ecf20Sopenharmony_ci	RXE_ATMACK,
488c2ecf20Sopenharmony_ci	RXE_IETH,
498c2ecf20Sopenharmony_ci	RXE_RDETH,
508c2ecf20Sopenharmony_ci	RXE_DETH,
518c2ecf20Sopenharmony_ci	RXE_IMMDT,
528c2ecf20Sopenharmony_ci	RXE_PAYLOAD,
538c2ecf20Sopenharmony_ci	NUM_HDR_TYPES
548c2ecf20Sopenharmony_ci};
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_cienum rxe_hdr_mask {
578c2ecf20Sopenharmony_ci	RXE_LRH_MASK		= BIT(RXE_LRH),
588c2ecf20Sopenharmony_ci	RXE_GRH_MASK		= BIT(RXE_GRH),
598c2ecf20Sopenharmony_ci	RXE_BTH_MASK		= BIT(RXE_BTH),
608c2ecf20Sopenharmony_ci	RXE_IMMDT_MASK		= BIT(RXE_IMMDT),
618c2ecf20Sopenharmony_ci	RXE_RETH_MASK		= BIT(RXE_RETH),
628c2ecf20Sopenharmony_ci	RXE_AETH_MASK		= BIT(RXE_AETH),
638c2ecf20Sopenharmony_ci	RXE_ATMETH_MASK		= BIT(RXE_ATMETH),
648c2ecf20Sopenharmony_ci	RXE_ATMACK_MASK		= BIT(RXE_ATMACK),
658c2ecf20Sopenharmony_ci	RXE_IETH_MASK		= BIT(RXE_IETH),
668c2ecf20Sopenharmony_ci	RXE_RDETH_MASK		= BIT(RXE_RDETH),
678c2ecf20Sopenharmony_ci	RXE_DETH_MASK		= BIT(RXE_DETH),
688c2ecf20Sopenharmony_ci	RXE_PAYLOAD_MASK	= BIT(RXE_PAYLOAD),
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci	RXE_REQ_MASK		= BIT(NUM_HDR_TYPES + 0),
718c2ecf20Sopenharmony_ci	RXE_ACK_MASK		= BIT(NUM_HDR_TYPES + 1),
728c2ecf20Sopenharmony_ci	RXE_SEND_MASK		= BIT(NUM_HDR_TYPES + 2),
738c2ecf20Sopenharmony_ci	RXE_WRITE_MASK		= BIT(NUM_HDR_TYPES + 3),
748c2ecf20Sopenharmony_ci	RXE_READ_MASK		= BIT(NUM_HDR_TYPES + 4),
758c2ecf20Sopenharmony_ci	RXE_ATOMIC_MASK		= BIT(NUM_HDR_TYPES + 5),
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci	RXE_RWR_MASK		= BIT(NUM_HDR_TYPES + 6),
788c2ecf20Sopenharmony_ci	RXE_COMP_MASK		= BIT(NUM_HDR_TYPES + 7),
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci	RXE_START_MASK		= BIT(NUM_HDR_TYPES + 8),
818c2ecf20Sopenharmony_ci	RXE_MIDDLE_MASK		= BIT(NUM_HDR_TYPES + 9),
828c2ecf20Sopenharmony_ci	RXE_END_MASK		= BIT(NUM_HDR_TYPES + 10),
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci	RXE_LOOPBACK_MASK	= BIT(NUM_HDR_TYPES + 12),
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci	RXE_READ_OR_ATOMIC	= (RXE_READ_MASK | RXE_ATOMIC_MASK),
878c2ecf20Sopenharmony_ci	RXE_WRITE_OR_SEND	= (RXE_WRITE_MASK | RXE_SEND_MASK),
888c2ecf20Sopenharmony_ci};
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci#define OPCODE_NONE		(-1)
918c2ecf20Sopenharmony_ci#define RXE_NUM_OPCODE		256
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_cistruct rxe_opcode_info {
948c2ecf20Sopenharmony_ci	char			*name;
958c2ecf20Sopenharmony_ci	enum rxe_hdr_mask	mask;
968c2ecf20Sopenharmony_ci	int			length;
978c2ecf20Sopenharmony_ci	int			offset[NUM_HDR_TYPES];
988c2ecf20Sopenharmony_ci};
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ciextern struct rxe_opcode_info rxe_opcode[RXE_NUM_OPCODE];
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci#endif /* RXE_OPCODE_H */
103