18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright(c) 2018 Intel Corporation.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci#ifndef HFI1_TID_RDMA_H
78c2ecf20Sopenharmony_ci#define HFI1_TID_RDMA_H
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <linux/circ_buf.h>
108c2ecf20Sopenharmony_ci#include "common.h"
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/* Add a convenience helper */
138c2ecf20Sopenharmony_ci#define CIRC_ADD(val, add, size) (((val) + (add)) & ((size) - 1))
148c2ecf20Sopenharmony_ci#define CIRC_NEXT(val, size) CIRC_ADD(val, 1, size)
158c2ecf20Sopenharmony_ci#define CIRC_PREV(val, size) CIRC_ADD(val, -1, size)
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#define TID_RDMA_MIN_SEGMENT_SIZE       BIT(18)   /* 256 KiB (for now) */
188c2ecf20Sopenharmony_ci#define TID_RDMA_MAX_SEGMENT_SIZE       BIT(18)   /* 256 KiB (for now) */
198c2ecf20Sopenharmony_ci#define TID_RDMA_MAX_PAGES              (BIT(18) >> PAGE_SHIFT)
208c2ecf20Sopenharmony_ci#define TID_RDMA_SEGMENT_SHIFT		18
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci/*
238c2ecf20Sopenharmony_ci * Bit definitions for priv->s_flags.
248c2ecf20Sopenharmony_ci * These bit flags overload the bit flags defined for the QP's s_flags.
258c2ecf20Sopenharmony_ci * Due to the fact that these bit fields are used only for the QP priv
268c2ecf20Sopenharmony_ci * s_flags, there are no collisions.
278c2ecf20Sopenharmony_ci *
288c2ecf20Sopenharmony_ci * HFI1_S_TID_WAIT_INTERLCK - QP is waiting for requester interlock
298c2ecf20Sopenharmony_ci * HFI1_R_TID_WAIT_INTERLCK - QP is waiting for responder interlock
308c2ecf20Sopenharmony_ci */
318c2ecf20Sopenharmony_ci#define HFI1_S_TID_BUSY_SET       BIT(0)
328c2ecf20Sopenharmony_ci/* BIT(1) reserved for RVT_S_BUSY. */
338c2ecf20Sopenharmony_ci#define HFI1_R_TID_RSC_TIMER      BIT(2)
348c2ecf20Sopenharmony_ci/* BIT(3) reserved for RVT_S_RESP_PENDING. */
358c2ecf20Sopenharmony_ci/* BIT(4) reserved for RVT_S_ACK_PENDING. */
368c2ecf20Sopenharmony_ci#define HFI1_S_TID_WAIT_INTERLCK  BIT(5)
378c2ecf20Sopenharmony_ci#define HFI1_R_TID_WAIT_INTERLCK  BIT(6)
388c2ecf20Sopenharmony_ci/* BIT(7) - BIT(15) reserved for RVT_S_WAIT_*. */
398c2ecf20Sopenharmony_ci/* BIT(16) reserved for RVT_S_SEND_ONE */
408c2ecf20Sopenharmony_ci#define HFI1_S_TID_RETRY_TIMER    BIT(17)
418c2ecf20Sopenharmony_ci/* BIT(18) reserved for RVT_S_ECN. */
428c2ecf20Sopenharmony_ci#define HFI1_R_TID_SW_PSN         BIT(19)
438c2ecf20Sopenharmony_ci/* BIT(26) reserved for HFI1_S_WAIT_HALT */
448c2ecf20Sopenharmony_ci/* BIT(27) reserved for HFI1_S_WAIT_TID_RESP */
458c2ecf20Sopenharmony_ci/* BIT(28) reserved for HFI1_S_WAIT_TID_SPACE */
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/*
488c2ecf20Sopenharmony_ci * Unlike regular IB RDMA VERBS, which do not require an entry
498c2ecf20Sopenharmony_ci * in the s_ack_queue, TID RDMA WRITE requests do because they
508c2ecf20Sopenharmony_ci * generate responses.
518c2ecf20Sopenharmony_ci * Therefore, the s_ack_queue needs to be extended by a certain
528c2ecf20Sopenharmony_ci * amount. The key point is that the queue needs to be extended
538c2ecf20Sopenharmony_ci * without letting the "user" know so they user doesn't end up
548c2ecf20Sopenharmony_ci * using these extra entries.
558c2ecf20Sopenharmony_ci */
568c2ecf20Sopenharmony_ci#define HFI1_TID_RDMA_WRITE_CNT 8
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_cistruct tid_rdma_params {
598c2ecf20Sopenharmony_ci	struct rcu_head rcu_head;
608c2ecf20Sopenharmony_ci	u32 qp;
618c2ecf20Sopenharmony_ci	u32 max_len;
628c2ecf20Sopenharmony_ci	u16 jkey;
638c2ecf20Sopenharmony_ci	u8 max_read;
648c2ecf20Sopenharmony_ci	u8 max_write;
658c2ecf20Sopenharmony_ci	u8 timeout;
668c2ecf20Sopenharmony_ci	u8 urg;
678c2ecf20Sopenharmony_ci	u8 version;
688c2ecf20Sopenharmony_ci};
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_cistruct tid_rdma_qp_params {
718c2ecf20Sopenharmony_ci	struct work_struct trigger_work;
728c2ecf20Sopenharmony_ci	struct tid_rdma_params local;
738c2ecf20Sopenharmony_ci	struct tid_rdma_params __rcu *remote;
748c2ecf20Sopenharmony_ci};
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci/* Track state for each hardware flow */
778c2ecf20Sopenharmony_cistruct tid_flow_state {
788c2ecf20Sopenharmony_ci	u32 generation;
798c2ecf20Sopenharmony_ci	u32 psn;
808c2ecf20Sopenharmony_ci	u8 index;
818c2ecf20Sopenharmony_ci	u8 last_index;
828c2ecf20Sopenharmony_ci};
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_cienum tid_rdma_req_state {
858c2ecf20Sopenharmony_ci	TID_REQUEST_INACTIVE = 0,
868c2ecf20Sopenharmony_ci	TID_REQUEST_INIT,
878c2ecf20Sopenharmony_ci	TID_REQUEST_INIT_RESEND,
888c2ecf20Sopenharmony_ci	TID_REQUEST_ACTIVE,
898c2ecf20Sopenharmony_ci	TID_REQUEST_RESEND,
908c2ecf20Sopenharmony_ci	TID_REQUEST_RESEND_ACTIVE,
918c2ecf20Sopenharmony_ci	TID_REQUEST_QUEUED,
928c2ecf20Sopenharmony_ci	TID_REQUEST_SYNC,
938c2ecf20Sopenharmony_ci	TID_REQUEST_RNR_NAK,
948c2ecf20Sopenharmony_ci	TID_REQUEST_COMPLETE,
958c2ecf20Sopenharmony_ci};
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_cistruct tid_rdma_request {
988c2ecf20Sopenharmony_ci	struct rvt_qp *qp;
998c2ecf20Sopenharmony_ci	struct hfi1_ctxtdata *rcd;
1008c2ecf20Sopenharmony_ci	union {
1018c2ecf20Sopenharmony_ci		struct rvt_swqe *swqe;
1028c2ecf20Sopenharmony_ci		struct rvt_ack_entry *ack;
1038c2ecf20Sopenharmony_ci	} e;
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci	struct tid_rdma_flow *flows;	/* array of tid flows */
1068c2ecf20Sopenharmony_ci	struct rvt_sge_state ss; /* SGE state for TID RDMA requests */
1078c2ecf20Sopenharmony_ci	u16 n_flows;		/* size of the flow buffer window */
1088c2ecf20Sopenharmony_ci	u16 setup_head;		/* flow index we are setting up */
1098c2ecf20Sopenharmony_ci	u16 clear_tail;		/* flow index we are clearing */
1108c2ecf20Sopenharmony_ci	u16 flow_idx;		/* flow index most recently set up */
1118c2ecf20Sopenharmony_ci	u16 acked_tail;
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci	u32 seg_len;
1148c2ecf20Sopenharmony_ci	u32 total_len;
1158c2ecf20Sopenharmony_ci	u32 r_ack_psn;          /* next expected ack PSN */
1168c2ecf20Sopenharmony_ci	u32 r_flow_psn;         /* IB PSN of next segment start */
1178c2ecf20Sopenharmony_ci	u32 r_last_acked;       /* IB PSN of last ACK'ed packet */
1188c2ecf20Sopenharmony_ci	u32 s_next_psn;		/* IB PSN of next segment start for read */
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci	u32 total_segs;		/* segments required to complete a request */
1218c2ecf20Sopenharmony_ci	u32 cur_seg;		/* index of current segment */
1228c2ecf20Sopenharmony_ci	u32 comp_seg;           /* index of last completed segment */
1238c2ecf20Sopenharmony_ci	u32 ack_seg;            /* index of last ack'ed segment */
1248c2ecf20Sopenharmony_ci	u32 alloc_seg;          /* index of next segment to be allocated */
1258c2ecf20Sopenharmony_ci	u32 isge;		/* index of "current" sge */
1268c2ecf20Sopenharmony_ci	u32 ack_pending;        /* num acks pending for this request */
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci	enum tid_rdma_req_state state;
1298c2ecf20Sopenharmony_ci};
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci/*
1328c2ecf20Sopenharmony_ci * When header suppression is used, PSNs associated with a "flow" are
1338c2ecf20Sopenharmony_ci * relevant (and not the PSNs maintained by verbs). Track per-flow
1348c2ecf20Sopenharmony_ci * PSNs here for a TID RDMA segment.
1358c2ecf20Sopenharmony_ci *
1368c2ecf20Sopenharmony_ci */
1378c2ecf20Sopenharmony_cistruct flow_state {
1388c2ecf20Sopenharmony_ci	u32 flags;
1398c2ecf20Sopenharmony_ci	u32 resp_ib_psn;     /* The IB PSN of the response for this flow */
1408c2ecf20Sopenharmony_ci	u32 generation;      /* generation of flow */
1418c2ecf20Sopenharmony_ci	u32 spsn;            /* starting PSN in TID space */
1428c2ecf20Sopenharmony_ci	u32 lpsn;            /* last PSN in TID space */
1438c2ecf20Sopenharmony_ci	u32 r_next_psn;      /* next PSN to be received (in TID space) */
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci	/* For tid rdma read */
1468c2ecf20Sopenharmony_ci	u32 ib_spsn;         /* starting PSN in Verbs space */
1478c2ecf20Sopenharmony_ci	u32 ib_lpsn;         /* last PSn in Verbs space */
1488c2ecf20Sopenharmony_ci};
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_cistruct tid_rdma_pageset {
1518c2ecf20Sopenharmony_ci	dma_addr_t addr : 48; /* Only needed for the first page */
1528c2ecf20Sopenharmony_ci	u8 idx: 8;
1538c2ecf20Sopenharmony_ci	u8 count : 7;
1548c2ecf20Sopenharmony_ci	u8 mapped: 1;
1558c2ecf20Sopenharmony_ci};
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci/**
1588c2ecf20Sopenharmony_ci * kern_tid_node - used for managing TID's in TID groups
1598c2ecf20Sopenharmony_ci *
1608c2ecf20Sopenharmony_ci * @grp_idx: rcd relative index to tid_group
1618c2ecf20Sopenharmony_ci * @map: grp->map captured prior to programming this TID group in HW
1628c2ecf20Sopenharmony_ci * @cnt: Only @cnt of available group entries are actually programmed
1638c2ecf20Sopenharmony_ci */
1648c2ecf20Sopenharmony_cistruct kern_tid_node {
1658c2ecf20Sopenharmony_ci	struct tid_group *grp;
1668c2ecf20Sopenharmony_ci	u8 map;
1678c2ecf20Sopenharmony_ci	u8 cnt;
1688c2ecf20Sopenharmony_ci};
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_ci/* Overall info for a TID RDMA segment */
1718c2ecf20Sopenharmony_cistruct tid_rdma_flow {
1728c2ecf20Sopenharmony_ci	/*
1738c2ecf20Sopenharmony_ci	 * While a TID RDMA segment is being transferred, it uses a QP number
1748c2ecf20Sopenharmony_ci	 * from the "KDETH section of QP numbers" (which is different from the
1758c2ecf20Sopenharmony_ci	 * QP number that originated the request). Bits 11-15 of these QP
1768c2ecf20Sopenharmony_ci	 * numbers identify the "TID flow" for the segment.
1778c2ecf20Sopenharmony_ci	 */
1788c2ecf20Sopenharmony_ci	struct flow_state flow_state;
1798c2ecf20Sopenharmony_ci	struct tid_rdma_request *req;
1808c2ecf20Sopenharmony_ci	u32 tid_qpn;
1818c2ecf20Sopenharmony_ci	u32 tid_offset;
1828c2ecf20Sopenharmony_ci	u32 length;
1838c2ecf20Sopenharmony_ci	u32 sent;
1848c2ecf20Sopenharmony_ci	u8 tnode_cnt;
1858c2ecf20Sopenharmony_ci	u8 tidcnt;
1868c2ecf20Sopenharmony_ci	u8 tid_idx;
1878c2ecf20Sopenharmony_ci	u8 idx;
1888c2ecf20Sopenharmony_ci	u8 npagesets;
1898c2ecf20Sopenharmony_ci	u8 npkts;
1908c2ecf20Sopenharmony_ci	u8 pkt;
1918c2ecf20Sopenharmony_ci	u8 resync_npkts;
1928c2ecf20Sopenharmony_ci	struct kern_tid_node tnode[TID_RDMA_MAX_PAGES];
1938c2ecf20Sopenharmony_ci	struct tid_rdma_pageset pagesets[TID_RDMA_MAX_PAGES];
1948c2ecf20Sopenharmony_ci	u32 tid_entry[TID_RDMA_MAX_PAGES];
1958c2ecf20Sopenharmony_ci};
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_cienum tid_rnr_nak_state {
1988c2ecf20Sopenharmony_ci	TID_RNR_NAK_INIT = 0,
1998c2ecf20Sopenharmony_ci	TID_RNR_NAK_SEND,
2008c2ecf20Sopenharmony_ci	TID_RNR_NAK_SENT,
2018c2ecf20Sopenharmony_ci};
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_cibool tid_rdma_conn_req(struct rvt_qp *qp, u64 *data);
2048c2ecf20Sopenharmony_cibool tid_rdma_conn_reply(struct rvt_qp *qp, u64 data);
2058c2ecf20Sopenharmony_cibool tid_rdma_conn_resp(struct rvt_qp *qp, u64 *data);
2068c2ecf20Sopenharmony_civoid tid_rdma_conn_error(struct rvt_qp *qp);
2078c2ecf20Sopenharmony_civoid tid_rdma_opfn_init(struct rvt_qp *qp, struct tid_rdma_params *p);
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ciint hfi1_kern_exp_rcv_init(struct hfi1_ctxtdata *rcd, int reinit);
2108c2ecf20Sopenharmony_ciint hfi1_kern_exp_rcv_setup(struct tid_rdma_request *req,
2118c2ecf20Sopenharmony_ci			    struct rvt_sge_state *ss, bool *last);
2128c2ecf20Sopenharmony_ciint hfi1_kern_exp_rcv_clear(struct tid_rdma_request *req);
2138c2ecf20Sopenharmony_civoid hfi1_kern_exp_rcv_clear_all(struct tid_rdma_request *req);
2148c2ecf20Sopenharmony_civoid __trdma_clean_swqe(struct rvt_qp *qp, struct rvt_swqe *wqe);
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_ci/**
2178c2ecf20Sopenharmony_ci * trdma_clean_swqe - clean flows for swqe if large send queue
2188c2ecf20Sopenharmony_ci * @qp: the qp
2198c2ecf20Sopenharmony_ci * @wqe: the send wqe
2208c2ecf20Sopenharmony_ci */
2218c2ecf20Sopenharmony_cistatic inline void trdma_clean_swqe(struct rvt_qp *qp, struct rvt_swqe *wqe)
2228c2ecf20Sopenharmony_ci{
2238c2ecf20Sopenharmony_ci	if (!wqe->priv)
2248c2ecf20Sopenharmony_ci		return;
2258c2ecf20Sopenharmony_ci	__trdma_clean_swqe(qp, wqe);
2268c2ecf20Sopenharmony_ci}
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_civoid hfi1_kern_read_tid_flow_free(struct rvt_qp *qp);
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_ciint hfi1_qp_priv_init(struct rvt_dev_info *rdi, struct rvt_qp *qp,
2318c2ecf20Sopenharmony_ci		      struct ib_qp_init_attr *init_attr);
2328c2ecf20Sopenharmony_civoid hfi1_qp_priv_tid_free(struct rvt_dev_info *rdi, struct rvt_qp *qp);
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_civoid hfi1_tid_rdma_flush_wait(struct rvt_qp *qp);
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ciint hfi1_kern_setup_hw_flow(struct hfi1_ctxtdata *rcd, struct rvt_qp *qp);
2378c2ecf20Sopenharmony_civoid hfi1_kern_clear_hw_flow(struct hfi1_ctxtdata *rcd, struct rvt_qp *qp);
2388c2ecf20Sopenharmony_civoid hfi1_kern_init_ctxt_generations(struct hfi1_ctxtdata *rcd);
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_cistruct cntr_entry;
2418c2ecf20Sopenharmony_ciu64 hfi1_access_sw_tid_wait(const struct cntr_entry *entry,
2428c2ecf20Sopenharmony_ci			    void *context, int vl, int mode, u64 data);
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_ciu32 hfi1_build_tid_rdma_read_packet(struct rvt_swqe *wqe,
2458c2ecf20Sopenharmony_ci				    struct ib_other_headers *ohdr,
2468c2ecf20Sopenharmony_ci				    u32 *bth1, u32 *bth2, u32 *len);
2478c2ecf20Sopenharmony_ciu32 hfi1_build_tid_rdma_read_req(struct rvt_qp *qp, struct rvt_swqe *wqe,
2488c2ecf20Sopenharmony_ci				 struct ib_other_headers *ohdr, u32 *bth1,
2498c2ecf20Sopenharmony_ci				 u32 *bth2, u32 *len);
2508c2ecf20Sopenharmony_civoid hfi1_rc_rcv_tid_rdma_read_req(struct hfi1_packet *packet);
2518c2ecf20Sopenharmony_ciu32 hfi1_build_tid_rdma_read_resp(struct rvt_qp *qp, struct rvt_ack_entry *e,
2528c2ecf20Sopenharmony_ci				  struct ib_other_headers *ohdr, u32 *bth0,
2538c2ecf20Sopenharmony_ci				  u32 *bth1, u32 *bth2, u32 *len, bool *last);
2548c2ecf20Sopenharmony_civoid hfi1_rc_rcv_tid_rdma_read_resp(struct hfi1_packet *packet);
2558c2ecf20Sopenharmony_cibool hfi1_handle_kdeth_eflags(struct hfi1_ctxtdata *rcd,
2568c2ecf20Sopenharmony_ci			      struct hfi1_pportdata *ppd,
2578c2ecf20Sopenharmony_ci			      struct hfi1_packet *packet);
2588c2ecf20Sopenharmony_civoid hfi1_tid_rdma_restart_req(struct rvt_qp *qp, struct rvt_swqe *wqe,
2598c2ecf20Sopenharmony_ci			       u32 *bth2);
2608c2ecf20Sopenharmony_civoid hfi1_qp_kern_exp_rcv_clear_all(struct rvt_qp *qp);
2618c2ecf20Sopenharmony_cibool hfi1_tid_rdma_wqe_interlock(struct rvt_qp *qp, struct rvt_swqe *wqe);
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_civoid setup_tid_rdma_wqe(struct rvt_qp *qp, struct rvt_swqe *wqe);
2648c2ecf20Sopenharmony_cistatic inline void hfi1_setup_tid_rdma_wqe(struct rvt_qp *qp,
2658c2ecf20Sopenharmony_ci					   struct rvt_swqe *wqe)
2668c2ecf20Sopenharmony_ci{
2678c2ecf20Sopenharmony_ci	if (wqe->priv &&
2688c2ecf20Sopenharmony_ci	    (wqe->wr.opcode == IB_WR_RDMA_READ ||
2698c2ecf20Sopenharmony_ci	     wqe->wr.opcode == IB_WR_RDMA_WRITE) &&
2708c2ecf20Sopenharmony_ci	    wqe->length >= TID_RDMA_MIN_SEGMENT_SIZE)
2718c2ecf20Sopenharmony_ci		setup_tid_rdma_wqe(qp, wqe);
2728c2ecf20Sopenharmony_ci}
2738c2ecf20Sopenharmony_ci
2748c2ecf20Sopenharmony_ciu32 hfi1_build_tid_rdma_write_req(struct rvt_qp *qp, struct rvt_swqe *wqe,
2758c2ecf20Sopenharmony_ci				  struct ib_other_headers *ohdr,
2768c2ecf20Sopenharmony_ci				  u32 *bth1, u32 *bth2, u32 *len);
2778c2ecf20Sopenharmony_ci
2788c2ecf20Sopenharmony_civoid hfi1_rc_rcv_tid_rdma_write_req(struct hfi1_packet *packet);
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_ciu32 hfi1_build_tid_rdma_write_resp(struct rvt_qp *qp, struct rvt_ack_entry *e,
2818c2ecf20Sopenharmony_ci				   struct ib_other_headers *ohdr, u32 *bth1,
2828c2ecf20Sopenharmony_ci				   u32 bth2, u32 *len,
2838c2ecf20Sopenharmony_ci				   struct rvt_sge_state **ss);
2848c2ecf20Sopenharmony_ci
2858c2ecf20Sopenharmony_civoid hfi1_del_tid_reap_timer(struct rvt_qp *qp);
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_civoid hfi1_rc_rcv_tid_rdma_write_resp(struct hfi1_packet *packet);
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_cibool hfi1_build_tid_rdma_packet(struct rvt_swqe *wqe,
2908c2ecf20Sopenharmony_ci				struct ib_other_headers *ohdr,
2918c2ecf20Sopenharmony_ci				u32 *bth1, u32 *bth2, u32 *len);
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_civoid hfi1_rc_rcv_tid_rdma_write_data(struct hfi1_packet *packet);
2948c2ecf20Sopenharmony_ci
2958c2ecf20Sopenharmony_ciu32 hfi1_build_tid_rdma_write_ack(struct rvt_qp *qp, struct rvt_ack_entry *e,
2968c2ecf20Sopenharmony_ci				  struct ib_other_headers *ohdr, u16 iflow,
2978c2ecf20Sopenharmony_ci				  u32 *bth1, u32 *bth2);
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_civoid hfi1_rc_rcv_tid_rdma_ack(struct hfi1_packet *packet);
3008c2ecf20Sopenharmony_ci
3018c2ecf20Sopenharmony_civoid hfi1_add_tid_retry_timer(struct rvt_qp *qp);
3028c2ecf20Sopenharmony_civoid hfi1_del_tid_retry_timer(struct rvt_qp *qp);
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ciu32 hfi1_build_tid_rdma_resync(struct rvt_qp *qp, struct rvt_swqe *wqe,
3058c2ecf20Sopenharmony_ci			       struct ib_other_headers *ohdr, u32 *bth1,
3068c2ecf20Sopenharmony_ci			       u32 *bth2, u16 fidx);
3078c2ecf20Sopenharmony_ci
3088c2ecf20Sopenharmony_civoid hfi1_rc_rcv_tid_rdma_resync(struct hfi1_packet *packet);
3098c2ecf20Sopenharmony_ci
3108c2ecf20Sopenharmony_cistruct hfi1_pkt_state;
3118c2ecf20Sopenharmony_ciint hfi1_make_tid_rdma_pkt(struct rvt_qp *qp, struct hfi1_pkt_state *ps);
3128c2ecf20Sopenharmony_ci
3138c2ecf20Sopenharmony_civoid _hfi1_do_tid_send(struct work_struct *work);
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_cibool hfi1_schedule_tid_send(struct rvt_qp *qp);
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_cibool hfi1_tid_rdma_ack_interlock(struct rvt_qp *qp, struct rvt_ack_entry *e);
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci#endif /* HFI1_TID_RDMA_H */
320