xref: /openbmc/linux/drivers/infiniband/hw/qedr/qedr_roce_cm.h (revision 762f99f4f3cb41a775b5157dd761217beba65873)
199d195ccSKalderon, Michal /* QLogic qedr NIC Driver
299d195ccSKalderon, Michal  * Copyright (c) 2015-2016  QLogic Corporation
399d195ccSKalderon, Michal  *
499d195ccSKalderon, Michal  * This software is available to you under a choice of one of two
599d195ccSKalderon, Michal  * licenses.  You may choose to be licensed under the terms of the GNU
699d195ccSKalderon, Michal  * General Public License (GPL) Version 2, available from the file
799d195ccSKalderon, Michal  * COPYING in the main directory of this source tree, or the
899d195ccSKalderon, Michal  * OpenIB.org BSD license below:
999d195ccSKalderon, Michal  *
1099d195ccSKalderon, Michal  *     Redistribution and use in source and binary forms, with or
1199d195ccSKalderon, Michal  *     without modification, are permitted provided that the following
1299d195ccSKalderon, Michal  *     conditions are met:
1399d195ccSKalderon, Michal  *
1499d195ccSKalderon, Michal  *      - Redistributions of source code must retain the above
1599d195ccSKalderon, Michal  *        copyright notice, this list of conditions and the following
1699d195ccSKalderon, Michal  *        disclaimer.
1799d195ccSKalderon, Michal  *
1899d195ccSKalderon, Michal  *      - Redistributions in binary form must reproduce the above
1999d195ccSKalderon, Michal  *        copyright notice, this list of conditions and the following
2099d195ccSKalderon, Michal  *        disclaimer in the documentation and /or other materials
2199d195ccSKalderon, Michal  *        provided with the distribution.
2299d195ccSKalderon, Michal  *
2399d195ccSKalderon, Michal  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
2499d195ccSKalderon, Michal  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2599d195ccSKalderon, Michal  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
2699d195ccSKalderon, Michal  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
2799d195ccSKalderon, Michal  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
2899d195ccSKalderon, Michal  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2999d195ccSKalderon, Michal  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3099d195ccSKalderon, Michal  * SOFTWARE.
3199d195ccSKalderon, Michal  */
3299d195ccSKalderon, Michal #ifndef LINUX_QEDR_CM_H_
3399d195ccSKalderon, Michal #define LINUX_QEDR_CM_H_
3499d195ccSKalderon, Michal 
3599d195ccSKalderon, Michal #define QEDR_GSI_MAX_RECV_WR	(4096)
3699d195ccSKalderon, Michal #define QEDR_GSI_MAX_SEND_WR	(4096)
3799d195ccSKalderon, Michal 
3899d195ccSKalderon, Michal #define QEDR_GSI_MAX_RECV_SGE	(1)	/* LL2 FW limitation */
3999d195ccSKalderon, Michal 
4099d195ccSKalderon, Michal #define QEDR_ROCE_V2_UDP_SPORT	(0000)
4199d195ccSKalderon, Michal 
qedr_get_ipv4_from_gid(const u8 * gid)4299d195ccSKalderon, Michal static inline u32 qedr_get_ipv4_from_gid(const u8 *gid)
4399d195ccSKalderon, Michal {
4499d195ccSKalderon, Michal 	return *(u32 *)(void *)&gid[12];
4599d195ccSKalderon, Michal }
4699d195ccSKalderon, Michal 
4799d195ccSKalderon, Michal /* RDMA CM */
4899d195ccSKalderon, Michal int qedr_gsi_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc);
49d34ac5cdSBart Van Assche int qedr_gsi_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *wr,
50d34ac5cdSBart Van Assche 		       const struct ib_recv_wr **bad_wr);
51d34ac5cdSBart Van Assche int qedr_gsi_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr,
52d34ac5cdSBart Van Assche 		       const struct ib_send_wr **bad_wr);
53*514aee66SLeon Romanovsky int qedr_create_gsi_qp(struct qedr_dev *dev, struct ib_qp_init_attr *attrs,
5499d195ccSKalderon, Michal 		       struct qedr_qp *qp);
5599d195ccSKalderon, Michal void qedr_store_gsi_qp_cq(struct qedr_dev *dev,
5699d195ccSKalderon, Michal 			  struct qedr_qp *qp, struct ib_qp_init_attr *attrs);
5799d195ccSKalderon, Michal int qedr_destroy_gsi_qp(struct qedr_dev *dev);
5899d195ccSKalderon, Michal void qedr_inc_sw_gsi_cons(struct qedr_qp_hwq_info *info);
5999d195ccSKalderon, Michal #endif
60