Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
0002 /*
0003  * Copyright(c) 2018 Intel Corporation.
0004  *
0005  */
0006 #ifndef _HFI1_OPFN_H
0007 #define _HFI1_OPFN_H
0008 
0009 /**
0010  * DOC: Omni Path Feature Negotion (OPFN)
0011  *
0012  * OPFN is a discovery protocol for Intel Omni-Path fabric that
0013  * allows two RC QPs to negotiate a common feature that both QPs
0014  * can support. Currently, the only OPA feature that OPFN
0015  * supports is TID RDMA.
0016  *
0017  * Architecture
0018  *
0019  * OPFN involves the communication between two QPs on the HFI
0020  * level on an Omni-Path fabric, and ULPs have no knowledge of
0021  * OPFN at all.
0022  *
0023  * Implementation
0024  *
0025  * OPFN extends the existing IB RC protocol with the following
0026  * changes:
0027  * -- Uses Bit 24 (reserved) of DWORD 1 of Base Transport
0028  *    Header (BTH1) to indicate that the RC QP supports OPFN;
0029  * -- Uses a combination of RC COMPARE_SWAP opcode (0x13) and
0030  *    the address U64_MAX (0xFFFFFFFFFFFFFFFF) as an OPFN
0031  *    request; The 64-bit data carried with the request/response
0032  *    contains the parameters for negotiation and will be
0033  *    defined in tid_rdma.c file;
0034  * -- Defines IB_WR_RESERVED3 as IB_WR_OPFN.
0035  *
0036  * The OPFN communication will be triggered when an RC QP
0037  * receives a request with Bit 24 of BTH1 set. The responder QP
0038  * will then post send an OPFN request with its local
0039  * parameters, which will be sent to the requester QP once all
0040  * existing requests on the responder QP side have been sent.
0041  * Once the requester QP receives the OPFN request, it will
0042  * keep a copy of the responder QP's parameters, and return a
0043  * response packet with its own local parameters. The responder
0044  * QP receives the response packet and keeps a copy of the requester
0045  * QP's parameters. After this exchange, each side has the parameters
0046  * for both sides and therefore can select the right parameters
0047  * for future transactions
0048  */
0049 
0050 #include <linux/workqueue.h>
0051 #include <rdma/ib_verbs.h>
0052 #include <rdma/rdmavt_qp.h>
0053 
0054 /* STL Verbs Extended */
0055 #define IB_BTHE_E_SHIFT           24
0056 #define HFI1_VERBS_E_ATOMIC_VADDR U64_MAX
0057 
0058 enum hfi1_opfn_codes {
0059     STL_VERBS_EXTD_NONE = 0,
0060     STL_VERBS_EXTD_TID_RDMA,
0061     STL_VERBS_EXTD_MAX
0062 };
0063 
0064 struct hfi1_opfn_data {
0065     u8 extended;
0066     u16 requested;
0067     u16 completed;
0068     enum hfi1_opfn_codes curr;
0069     /* serialize opfn function calls */
0070     spinlock_t lock;
0071     struct work_struct opfn_work;
0072 };
0073 
0074 /* WR opcode for OPFN */
0075 #define IB_WR_OPFN IB_WR_RESERVED3
0076 
0077 void opfn_send_conn_request(struct work_struct *work);
0078 void opfn_conn_response(struct rvt_qp *qp, struct rvt_ack_entry *e,
0079             struct ib_atomic_eth *ateth);
0080 void opfn_conn_reply(struct rvt_qp *qp, u64 data);
0081 void opfn_conn_error(struct rvt_qp *qp);
0082 void opfn_qp_init(struct rvt_qp *qp, struct ib_qp_attr *attr, int attr_mask);
0083 void opfn_trigger_conn_request(struct rvt_qp *qp, u32 bth1);
0084 int opfn_init(void);
0085 void opfn_exit(void);
0086 
0087 #endif /* _HFI1_OPFN_H */