133ec1ccbSHans Petter Selasky /*
233ec1ccbSHans Petter Selasky * Copyright (c) 2004 Topspin Communications. All rights reserved.
333ec1ccbSHans Petter Selasky * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved.
433ec1ccbSHans Petter Selasky * Copyright (c) 2005 Mellanox Technologies. All rights reserved.
533ec1ccbSHans Petter Selasky *
633ec1ccbSHans Petter Selasky * This software is available to you under a choice of one of two
733ec1ccbSHans Petter Selasky * licenses. You may choose to be licensed under the terms of the GNU
833ec1ccbSHans Petter Selasky * General Public License (GPL) Version 2, available from the file
933ec1ccbSHans Petter Selasky * COPYING in the main directory of this source tree, or the
1033ec1ccbSHans Petter Selasky * OpenIB.org BSD license below:
1133ec1ccbSHans Petter Selasky *
1233ec1ccbSHans Petter Selasky * Redistribution and use in source and binary forms, with or
1333ec1ccbSHans Petter Selasky * without modification, are permitted provided that the following
1433ec1ccbSHans Petter Selasky * conditions are met:
1533ec1ccbSHans Petter Selasky *
1633ec1ccbSHans Petter Selasky * - Redistributions of source code must retain the above
1733ec1ccbSHans Petter Selasky * copyright notice, this list of conditions and the following
1833ec1ccbSHans Petter Selasky * disclaimer.
1933ec1ccbSHans Petter Selasky *
2033ec1ccbSHans Petter Selasky * - Redistributions in binary form must reproduce the above
2133ec1ccbSHans Petter Selasky * copyright notice, this list of conditions and the following
2233ec1ccbSHans Petter Selasky * disclaimer in the documentation and/or other materials
2333ec1ccbSHans Petter Selasky * provided with the distribution.
2433ec1ccbSHans Petter Selasky *
2533ec1ccbSHans Petter Selasky * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
2633ec1ccbSHans Petter Selasky * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2733ec1ccbSHans Petter Selasky * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
2833ec1ccbSHans Petter Selasky * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
2933ec1ccbSHans Petter Selasky * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
3033ec1ccbSHans Petter Selasky * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
3133ec1ccbSHans Petter Selasky * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3233ec1ccbSHans Petter Selasky * SOFTWARE.
3333ec1ccbSHans Petter Selasky */
3433ec1ccbSHans Petter Selasky
3533ec1ccbSHans Petter Selasky #ifndef MTHCA_PROVIDER_H
3633ec1ccbSHans Petter Selasky #define MTHCA_PROVIDER_H
3733ec1ccbSHans Petter Selasky
3833ec1ccbSHans Petter Selasky #include <rdma/ib_verbs.h>
3933ec1ccbSHans Petter Selasky #include <rdma/ib_pack.h>
4033ec1ccbSHans Petter Selasky
4133ec1ccbSHans Petter Selasky #include <linux/wait.h>
4233ec1ccbSHans Petter Selasky
4333ec1ccbSHans Petter Selasky #define MTHCA_MPT_FLAG_ATOMIC (1 << 14)
4433ec1ccbSHans Petter Selasky #define MTHCA_MPT_FLAG_REMOTE_WRITE (1 << 13)
4533ec1ccbSHans Petter Selasky #define MTHCA_MPT_FLAG_REMOTE_READ (1 << 12)
4633ec1ccbSHans Petter Selasky #define MTHCA_MPT_FLAG_LOCAL_WRITE (1 << 11)
4733ec1ccbSHans Petter Selasky #define MTHCA_MPT_FLAG_LOCAL_READ (1 << 10)
4833ec1ccbSHans Petter Selasky
4933ec1ccbSHans Petter Selasky struct mthca_buf_list {
5033ec1ccbSHans Petter Selasky void *buf;
5133ec1ccbSHans Petter Selasky DEFINE_DMA_UNMAP_ADDR(mapping);
5233ec1ccbSHans Petter Selasky };
5333ec1ccbSHans Petter Selasky
5433ec1ccbSHans Petter Selasky union mthca_buf {
5533ec1ccbSHans Petter Selasky struct mthca_buf_list direct;
5633ec1ccbSHans Petter Selasky struct mthca_buf_list *page_list;
5733ec1ccbSHans Petter Selasky };
5833ec1ccbSHans Petter Selasky
5933ec1ccbSHans Petter Selasky struct mthca_uar {
6033ec1ccbSHans Petter Selasky unsigned long pfn;
6133ec1ccbSHans Petter Selasky int index;
6233ec1ccbSHans Petter Selasky };
6333ec1ccbSHans Petter Selasky
6433ec1ccbSHans Petter Selasky struct mthca_user_db_table;
6533ec1ccbSHans Petter Selasky
6633ec1ccbSHans Petter Selasky struct mthca_ucontext {
6733ec1ccbSHans Petter Selasky struct ib_ucontext ibucontext;
6833ec1ccbSHans Petter Selasky struct mthca_uar uar;
6933ec1ccbSHans Petter Selasky struct mthca_user_db_table *db_tab;
7033ec1ccbSHans Petter Selasky int reg_mr_warned;
7133ec1ccbSHans Petter Selasky };
7233ec1ccbSHans Petter Selasky
7333ec1ccbSHans Petter Selasky struct mthca_mtt;
7433ec1ccbSHans Petter Selasky
7533ec1ccbSHans Petter Selasky struct mthca_mr {
7633ec1ccbSHans Petter Selasky struct ib_mr ibmr;
7733ec1ccbSHans Petter Selasky struct ib_umem *umem;
7833ec1ccbSHans Petter Selasky struct mthca_mtt *mtt;
7933ec1ccbSHans Petter Selasky };
8033ec1ccbSHans Petter Selasky
8133ec1ccbSHans Petter Selasky struct mthca_fmr {
8233ec1ccbSHans Petter Selasky struct ib_fmr ibmr;
8333ec1ccbSHans Petter Selasky struct ib_fmr_attr attr;
8433ec1ccbSHans Petter Selasky struct mthca_mtt *mtt;
8533ec1ccbSHans Petter Selasky int maps;
8633ec1ccbSHans Petter Selasky union {
8733ec1ccbSHans Petter Selasky struct {
8833ec1ccbSHans Petter Selasky struct mthca_mpt_entry __iomem *mpt;
8933ec1ccbSHans Petter Selasky u64 __iomem *mtts;
9033ec1ccbSHans Petter Selasky } tavor;
9133ec1ccbSHans Petter Selasky struct {
9233ec1ccbSHans Petter Selasky struct mthca_mpt_entry *mpt;
9333ec1ccbSHans Petter Selasky __be64 *mtts;
9433ec1ccbSHans Petter Selasky dma_addr_t dma_handle;
9533ec1ccbSHans Petter Selasky } arbel;
9633ec1ccbSHans Petter Selasky } mem;
9733ec1ccbSHans Petter Selasky };
9833ec1ccbSHans Petter Selasky
9933ec1ccbSHans Petter Selasky struct mthca_pd {
10033ec1ccbSHans Petter Selasky struct ib_pd ibpd;
10133ec1ccbSHans Petter Selasky u32 pd_num;
10233ec1ccbSHans Petter Selasky atomic_t sqp_count;
10333ec1ccbSHans Petter Selasky struct mthca_mr ntmr;
10433ec1ccbSHans Petter Selasky int privileged;
10533ec1ccbSHans Petter Selasky };
10633ec1ccbSHans Petter Selasky
10733ec1ccbSHans Petter Selasky struct mthca_eq {
10833ec1ccbSHans Petter Selasky struct mthca_dev *dev;
10933ec1ccbSHans Petter Selasky int eqn;
11033ec1ccbSHans Petter Selasky u32 eqn_mask;
11133ec1ccbSHans Petter Selasky u32 cons_index;
11233ec1ccbSHans Petter Selasky u16 msi_x_vector;
11333ec1ccbSHans Petter Selasky u16 msi_x_entry;
11433ec1ccbSHans Petter Selasky int have_irq;
11533ec1ccbSHans Petter Selasky int nent;
11633ec1ccbSHans Petter Selasky struct mthca_buf_list *page_list;
11733ec1ccbSHans Petter Selasky struct mthca_mr mr;
11833ec1ccbSHans Petter Selasky char irq_name[IB_DEVICE_NAME_MAX];
11933ec1ccbSHans Petter Selasky };
12033ec1ccbSHans Petter Selasky
12133ec1ccbSHans Petter Selasky struct mthca_av;
12233ec1ccbSHans Petter Selasky
12333ec1ccbSHans Petter Selasky enum mthca_ah_type {
12433ec1ccbSHans Petter Selasky MTHCA_AH_ON_HCA,
12533ec1ccbSHans Petter Selasky MTHCA_AH_PCI_POOL,
12633ec1ccbSHans Petter Selasky MTHCA_AH_KMALLOC
12733ec1ccbSHans Petter Selasky };
12833ec1ccbSHans Petter Selasky
12933ec1ccbSHans Petter Selasky struct mthca_ah {
13033ec1ccbSHans Petter Selasky struct ib_ah ibah;
13133ec1ccbSHans Petter Selasky enum mthca_ah_type type;
13233ec1ccbSHans Petter Selasky u32 key;
13333ec1ccbSHans Petter Selasky struct mthca_av *av;
13433ec1ccbSHans Petter Selasky dma_addr_t avdma;
13533ec1ccbSHans Petter Selasky };
13633ec1ccbSHans Petter Selasky
13733ec1ccbSHans Petter Selasky /*
13833ec1ccbSHans Petter Selasky * Quick description of our CQ/QP locking scheme:
13933ec1ccbSHans Petter Selasky *
14033ec1ccbSHans Petter Selasky * We have one global lock that protects dev->cq/qp_table. Each
14133ec1ccbSHans Petter Selasky * struct mthca_cq/qp also has its own lock. An individual qp lock
14233ec1ccbSHans Petter Selasky * may be taken inside of an individual cq lock. Both cqs attached to
14333ec1ccbSHans Petter Selasky * a qp may be locked, with the cq with the lower cqn locked first.
14433ec1ccbSHans Petter Selasky * No other nesting should be done.
14533ec1ccbSHans Petter Selasky *
14633ec1ccbSHans Petter Selasky * Each struct mthca_cq/qp also has an ref count, protected by the
14733ec1ccbSHans Petter Selasky * corresponding table lock. The pointer from the cq/qp_table to the
14833ec1ccbSHans Petter Selasky * struct counts as one reference. This reference also is good for
14933ec1ccbSHans Petter Selasky * access through the consumer API, so modifying the CQ/QP etc doesn't
15033ec1ccbSHans Petter Selasky * need to take another reference. Access to a QP because of a
15133ec1ccbSHans Petter Selasky * completion being polled does not need a reference either.
15233ec1ccbSHans Petter Selasky *
15333ec1ccbSHans Petter Selasky * Finally, each struct mthca_cq/qp has a wait_queue_head_t for the
15433ec1ccbSHans Petter Selasky * destroy function to sleep on.
15533ec1ccbSHans Petter Selasky *
15633ec1ccbSHans Petter Selasky * This means that access from the consumer API requires nothing but
15733ec1ccbSHans Petter Selasky * taking the struct's lock.
15833ec1ccbSHans Petter Selasky *
15933ec1ccbSHans Petter Selasky * Access because of a completion event should go as follows:
16033ec1ccbSHans Petter Selasky * - lock cq/qp_table and look up struct
16133ec1ccbSHans Petter Selasky * - increment ref count in struct
16233ec1ccbSHans Petter Selasky * - drop cq/qp_table lock
16333ec1ccbSHans Petter Selasky * - lock struct, do your thing, and unlock struct
16433ec1ccbSHans Petter Selasky * - decrement ref count; if zero, wake up waiters
16533ec1ccbSHans Petter Selasky *
16633ec1ccbSHans Petter Selasky * To destroy a CQ/QP, we can do the following:
16733ec1ccbSHans Petter Selasky * - lock cq/qp_table
16833ec1ccbSHans Petter Selasky * - remove pointer and decrement ref count
16933ec1ccbSHans Petter Selasky * - unlock cq/qp_table lock
17033ec1ccbSHans Petter Selasky * - wait_event until ref count is zero
17133ec1ccbSHans Petter Selasky *
17233ec1ccbSHans Petter Selasky * It is the consumer's responsibilty to make sure that no QP
17333ec1ccbSHans Petter Selasky * operations (WQE posting or state modification) are pending when a
17433ec1ccbSHans Petter Selasky * QP is destroyed. Also, the consumer must make sure that calls to
17533ec1ccbSHans Petter Selasky * qp_modify are serialized. Similarly, the consumer is responsible
17633ec1ccbSHans Petter Selasky * for ensuring that no CQ resize operations are pending when a CQ
17733ec1ccbSHans Petter Selasky * is destroyed.
17833ec1ccbSHans Petter Selasky *
17933ec1ccbSHans Petter Selasky * Possible optimizations (wait for profile data to see if/where we
18033ec1ccbSHans Petter Selasky * have locks bouncing between CPUs):
18133ec1ccbSHans Petter Selasky * - split cq/qp table lock into n separate (cache-aligned) locks,
18233ec1ccbSHans Petter Selasky * indexed (say) by the page in the table
18333ec1ccbSHans Petter Selasky * - split QP struct lock into three (one for common info, one for the
18433ec1ccbSHans Petter Selasky * send queue and one for the receive queue)
18533ec1ccbSHans Petter Selasky */
18633ec1ccbSHans Petter Selasky
18733ec1ccbSHans Petter Selasky struct mthca_cq_buf {
18833ec1ccbSHans Petter Selasky union mthca_buf queue;
18933ec1ccbSHans Petter Selasky struct mthca_mr mr;
19033ec1ccbSHans Petter Selasky int is_direct;
19133ec1ccbSHans Petter Selasky };
19233ec1ccbSHans Petter Selasky
19333ec1ccbSHans Petter Selasky struct mthca_cq_resize {
19433ec1ccbSHans Petter Selasky struct mthca_cq_buf buf;
19533ec1ccbSHans Petter Selasky int cqe;
19633ec1ccbSHans Petter Selasky enum {
19733ec1ccbSHans Petter Selasky CQ_RESIZE_ALLOC,
19833ec1ccbSHans Petter Selasky CQ_RESIZE_READY,
19933ec1ccbSHans Petter Selasky CQ_RESIZE_SWAPPED
20033ec1ccbSHans Petter Selasky } state;
20133ec1ccbSHans Petter Selasky };
20233ec1ccbSHans Petter Selasky
20333ec1ccbSHans Petter Selasky struct mthca_cq {
20433ec1ccbSHans Petter Selasky struct ib_cq ibcq;
20533ec1ccbSHans Petter Selasky spinlock_t lock;
20633ec1ccbSHans Petter Selasky int refcount;
20733ec1ccbSHans Petter Selasky int cqn;
20833ec1ccbSHans Petter Selasky u32 cons_index;
20933ec1ccbSHans Petter Selasky struct mthca_cq_buf buf;
21033ec1ccbSHans Petter Selasky struct mthca_cq_resize *resize_buf;
21133ec1ccbSHans Petter Selasky int is_kernel;
21233ec1ccbSHans Petter Selasky
21333ec1ccbSHans Petter Selasky /* Next fields are Arbel only */
21433ec1ccbSHans Petter Selasky int set_ci_db_index;
21533ec1ccbSHans Petter Selasky __be32 *set_ci_db;
21633ec1ccbSHans Petter Selasky int arm_db_index;
21733ec1ccbSHans Petter Selasky __be32 *arm_db;
21833ec1ccbSHans Petter Selasky int arm_sn;
21933ec1ccbSHans Petter Selasky
22033ec1ccbSHans Petter Selasky wait_queue_head_t wait;
22133ec1ccbSHans Petter Selasky struct mutex mutex;
22233ec1ccbSHans Petter Selasky };
22333ec1ccbSHans Petter Selasky
22433ec1ccbSHans Petter Selasky struct mthca_srq {
22533ec1ccbSHans Petter Selasky struct ib_srq ibsrq;
22633ec1ccbSHans Petter Selasky spinlock_t lock;
22733ec1ccbSHans Petter Selasky int refcount;
22833ec1ccbSHans Petter Selasky int srqn;
22933ec1ccbSHans Petter Selasky int max;
23033ec1ccbSHans Petter Selasky int max_gs;
23133ec1ccbSHans Petter Selasky int wqe_shift;
23233ec1ccbSHans Petter Selasky int first_free;
23333ec1ccbSHans Petter Selasky int last_free;
23433ec1ccbSHans Petter Selasky u16 counter; /* Arbel only */
23533ec1ccbSHans Petter Selasky int db_index; /* Arbel only */
23633ec1ccbSHans Petter Selasky __be32 *db; /* Arbel only */
23733ec1ccbSHans Petter Selasky void *last;
23833ec1ccbSHans Petter Selasky
23933ec1ccbSHans Petter Selasky int is_direct;
24033ec1ccbSHans Petter Selasky u64 *wrid;
24133ec1ccbSHans Petter Selasky union mthca_buf queue;
24233ec1ccbSHans Petter Selasky struct mthca_mr mr;
24333ec1ccbSHans Petter Selasky
24433ec1ccbSHans Petter Selasky wait_queue_head_t wait;
24533ec1ccbSHans Petter Selasky struct mutex mutex;
24633ec1ccbSHans Petter Selasky };
24733ec1ccbSHans Petter Selasky
24833ec1ccbSHans Petter Selasky struct mthca_wq {
24933ec1ccbSHans Petter Selasky spinlock_t lock;
25033ec1ccbSHans Petter Selasky int max;
25133ec1ccbSHans Petter Selasky unsigned next_ind;
25233ec1ccbSHans Petter Selasky unsigned last_comp;
25333ec1ccbSHans Petter Selasky unsigned head;
25433ec1ccbSHans Petter Selasky unsigned tail;
25533ec1ccbSHans Petter Selasky void *last;
25633ec1ccbSHans Petter Selasky int max_gs;
25733ec1ccbSHans Petter Selasky int wqe_shift;
25833ec1ccbSHans Petter Selasky
25933ec1ccbSHans Petter Selasky int db_index; /* Arbel only */
26033ec1ccbSHans Petter Selasky __be32 *db;
26133ec1ccbSHans Petter Selasky };
26233ec1ccbSHans Petter Selasky
26333ec1ccbSHans Petter Selasky struct mthca_qp {
26433ec1ccbSHans Petter Selasky struct ib_qp ibqp;
26533ec1ccbSHans Petter Selasky int refcount;
26633ec1ccbSHans Petter Selasky u32 qpn;
26733ec1ccbSHans Petter Selasky int is_direct;
26833ec1ccbSHans Petter Selasky u8 port; /* for SQP and memfree use only */
26933ec1ccbSHans Petter Selasky u8 alt_port; /* for memfree use only */
27033ec1ccbSHans Petter Selasky u8 transport;
27133ec1ccbSHans Petter Selasky u8 state;
27233ec1ccbSHans Petter Selasky u8 atomic_rd_en;
27333ec1ccbSHans Petter Selasky u8 resp_depth;
27433ec1ccbSHans Petter Selasky
27533ec1ccbSHans Petter Selasky struct mthca_mr mr;
27633ec1ccbSHans Petter Selasky
27733ec1ccbSHans Petter Selasky struct mthca_wq rq;
27833ec1ccbSHans Petter Selasky struct mthca_wq sq;
27933ec1ccbSHans Petter Selasky enum ib_sig_type sq_policy;
28033ec1ccbSHans Petter Selasky int send_wqe_offset;
28133ec1ccbSHans Petter Selasky int max_inline_data;
28233ec1ccbSHans Petter Selasky
28333ec1ccbSHans Petter Selasky u64 *wrid;
28433ec1ccbSHans Petter Selasky union mthca_buf queue;
28533ec1ccbSHans Petter Selasky
28633ec1ccbSHans Petter Selasky wait_queue_head_t wait;
28733ec1ccbSHans Petter Selasky struct mutex mutex;
28833ec1ccbSHans Petter Selasky };
28933ec1ccbSHans Petter Selasky
29033ec1ccbSHans Petter Selasky struct mthca_sqp {
29133ec1ccbSHans Petter Selasky struct mthca_qp qp;
29233ec1ccbSHans Petter Selasky int pkey_index;
29333ec1ccbSHans Petter Selasky u32 qkey;
29433ec1ccbSHans Petter Selasky u32 send_psn;
29533ec1ccbSHans Petter Selasky struct ib_ud_header ud_header;
29633ec1ccbSHans Petter Selasky int header_buf_size;
29733ec1ccbSHans Petter Selasky void *header_buf;
29833ec1ccbSHans Petter Selasky dma_addr_t header_dma;
29933ec1ccbSHans Petter Selasky };
30033ec1ccbSHans Petter Selasky
to_mucontext(struct ib_ucontext * ibucontext)30133ec1ccbSHans Petter Selasky static inline struct mthca_ucontext *to_mucontext(struct ib_ucontext *ibucontext)
30233ec1ccbSHans Petter Selasky {
30333ec1ccbSHans Petter Selasky return container_of(ibucontext, struct mthca_ucontext, ibucontext);
30433ec1ccbSHans Petter Selasky }
30533ec1ccbSHans Petter Selasky
to_mfmr(struct ib_fmr * ibmr)30633ec1ccbSHans Petter Selasky static inline struct mthca_fmr *to_mfmr(struct ib_fmr *ibmr)
30733ec1ccbSHans Petter Selasky {
30833ec1ccbSHans Petter Selasky return container_of(ibmr, struct mthca_fmr, ibmr);
30933ec1ccbSHans Petter Selasky }
31033ec1ccbSHans Petter Selasky
to_mmr(struct ib_mr * ibmr)31133ec1ccbSHans Petter Selasky static inline struct mthca_mr *to_mmr(struct ib_mr *ibmr)
31233ec1ccbSHans Petter Selasky {
31333ec1ccbSHans Petter Selasky return container_of(ibmr, struct mthca_mr, ibmr);
31433ec1ccbSHans Petter Selasky }
31533ec1ccbSHans Petter Selasky
to_mpd(struct ib_pd * ibpd)31633ec1ccbSHans Petter Selasky static inline struct mthca_pd *to_mpd(struct ib_pd *ibpd)
31733ec1ccbSHans Petter Selasky {
31833ec1ccbSHans Petter Selasky return container_of(ibpd, struct mthca_pd, ibpd);
31933ec1ccbSHans Petter Selasky }
32033ec1ccbSHans Petter Selasky
to_mah(struct ib_ah * ibah)32133ec1ccbSHans Petter Selasky static inline struct mthca_ah *to_mah(struct ib_ah *ibah)
32233ec1ccbSHans Petter Selasky {
32333ec1ccbSHans Petter Selasky return container_of(ibah, struct mthca_ah, ibah);
32433ec1ccbSHans Petter Selasky }
32533ec1ccbSHans Petter Selasky
to_mcq(struct ib_cq * ibcq)32633ec1ccbSHans Petter Selasky static inline struct mthca_cq *to_mcq(struct ib_cq *ibcq)
32733ec1ccbSHans Petter Selasky {
32833ec1ccbSHans Petter Selasky return container_of(ibcq, struct mthca_cq, ibcq);
32933ec1ccbSHans Petter Selasky }
33033ec1ccbSHans Petter Selasky
to_msrq(struct ib_srq * ibsrq)33133ec1ccbSHans Petter Selasky static inline struct mthca_srq *to_msrq(struct ib_srq *ibsrq)
33233ec1ccbSHans Petter Selasky {
33333ec1ccbSHans Petter Selasky return container_of(ibsrq, struct mthca_srq, ibsrq);
33433ec1ccbSHans Petter Selasky }
33533ec1ccbSHans Petter Selasky
to_mqp(struct ib_qp * ibqp)33633ec1ccbSHans Petter Selasky static inline struct mthca_qp *to_mqp(struct ib_qp *ibqp)
33733ec1ccbSHans Petter Selasky {
33833ec1ccbSHans Petter Selasky return container_of(ibqp, struct mthca_qp, ibqp);
33933ec1ccbSHans Petter Selasky }
34033ec1ccbSHans Petter Selasky
to_msqp(struct mthca_qp * qp)34133ec1ccbSHans Petter Selasky static inline struct mthca_sqp *to_msqp(struct mthca_qp *qp)
34233ec1ccbSHans Petter Selasky {
34333ec1ccbSHans Petter Selasky return container_of(qp, struct mthca_sqp, qp);
34433ec1ccbSHans Petter Selasky }
34533ec1ccbSHans Petter Selasky
34633ec1ccbSHans Petter Selasky #endif /* MTHCA_PROVIDER_H */
347