1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
3 * Copyright(c) 2016 - 2018 Intel Corporation.
6 #ifndef HFI1_VERBS_TXREQ_H
7 #define HFI1_VERBS_TXREQ_H
9 #include <linux/types.h>
10 #include <linux/slab.h>
13 #include "sdma_txreq.h"
17 struct hfi1_sdma_header phdr;
18 struct sdma_txreq txreq;
21 struct rvt_mregion *mr;
22 struct rvt_sge_state *ss;
23 struct sdma_engine *sde;
24 struct send_context *psc;
30 struct verbs_txreq *__get_txreq(struct hfi1_ibdev *dev,
33 #define VERBS_TXREQ_GFP (GFP_ATOMIC | __GFP_NOWARN)
34 static inline struct verbs_txreq *get_txreq(struct hfi1_ibdev *dev,
36 __must_hold(&qp->slock)
38 struct verbs_txreq *tx;
39 struct hfi1_qp_priv *priv = qp->priv;
41 tx = kmem_cache_alloc(dev->verbs_txreq_cache, VERBS_TXREQ_GFP);
43 /* call slow path to get the lock */
44 tx = __get_txreq(dev, qp);
50 tx->sde = priv->s_sde;
51 tx->psc = priv->s_sendcontext;
52 /* so that we can test if the sdma descriptors are there */
53 tx->txreq.num_desc = 0;
54 /* Set the header type */
55 tx->phdr.hdr.hdr_type = priv->hdr_type;
60 static inline struct verbs_txreq *get_waiting_verbs_txreq(struct iowait_work *w)
62 struct sdma_txreq *stx;
64 stx = iowait_get_txhead(w);
66 return container_of(stx, struct verbs_txreq, txreq);
70 static inline bool verbs_txreq_queued(struct iowait_work *w)
72 return iowait_packet_queued(w);
75 void hfi1_put_txreq(struct verbs_txreq *tx);
76 int verbs_txreq_init(struct hfi1_ibdev *dev);
77 void verbs_txreq_exit(struct hfi1_ibdev *dev);
79 #endif /* HFI1_VERBS_TXREQ_H */