Dennis Dalessandro | b518d3e | 2016-01-06 09:56:15 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright(c) 2015 Intel Corporation. |
| 3 | * |
| 4 | * This file is provided under a dual BSD/GPLv2 license. When using or |
| 5 | * redistributing this file, you may do so under either license. |
| 6 | * |
| 7 | * GPL LICENSE SUMMARY |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of version 2 of the GNU General Public License as |
| 11 | * published by the Free Software Foundation. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, but |
| 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | * General Public License for more details. |
| 17 | * |
| 18 | * BSD LICENSE |
| 19 | * |
| 20 | * Redistribution and use in source and binary forms, with or without |
| 21 | * modification, are permitted provided that the following conditions |
| 22 | * are met: |
| 23 | * |
| 24 | * - Redistributions of source code must retain the above copyright |
| 25 | * notice, this list of conditions and the following disclaimer. |
| 26 | * - Redistributions in binary form must reproduce the above copyright |
| 27 | * notice, this list of conditions and the following disclaimer in |
| 28 | * the documentation and/or other materials provided with the |
| 29 | * distribution. |
| 30 | * - Neither the name of Intel Corporation nor the names of its |
| 31 | * contributors may be used to endorse or promote products derived |
| 32 | * from this software without specific prior written permission. |
| 33 | * |
| 34 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 35 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 36 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 37 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 38 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 39 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 40 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 41 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 42 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 43 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 44 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 45 | * |
| 46 | */ |
| 47 | |
| 48 | #include "qp.h" |
| 49 | |
| 50 | /** |
| 51 | * rvt_create_qp - create a queue pair for a device |
| 52 | * @ibpd: the protection domain who's device we create the queue pair for |
| 53 | * @init_attr: the attributes of the queue pair |
| 54 | * @udata: user data for libibverbs.so |
| 55 | * |
| 56 | * Returns the queue pair on success, otherwise returns an errno. |
| 57 | * |
| 58 | * Called by the ib_create_qp() core verbs function. |
| 59 | */ |
| 60 | struct ib_qp *rvt_create_qp(struct ib_pd *ibpd, |
| 61 | struct ib_qp_init_attr *init_attr, |
| 62 | struct ib_udata *udata) |
| 63 | { |
| 64 | /* |
| 65 | * Queue pair creation is mostly an rvt issue. However, drivers have |
| 66 | * their own unique idea of what queue pare numbers mean. For instance |
| 67 | * there is a reserved range for PSM. |
| 68 | * |
| 69 | * VI-DRIVER-API: make_qpn() |
| 70 | * Returns a valid QPN for verbs to use |
| 71 | */ |
| 72 | return ERR_PTR(-EOPNOTSUPP); |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * qib_modify_qp - modify the attributes of a queue pair |
| 77 | * @ibqp: the queue pair who's attributes we're modifying |
| 78 | * @attr: the new attributes |
| 79 | * @attr_mask: the mask of attributes to modify |
| 80 | * @udata: user data for libibverbs.so |
| 81 | * |
| 82 | * Returns 0 on success, otherwise returns an errno. |
| 83 | */ |
| 84 | int rvt_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, |
| 85 | int attr_mask, struct ib_udata *udata) |
| 86 | { |
| 87 | /* |
| 88 | * VT-DRIVER-API: qp_mtu() |
| 89 | * OPA devices have a per VL MTU the driver has a mapping of IB SL to SC |
| 90 | * to VL and the mapping table of MTUs per VL. This is not something |
| 91 | * that IB has and should not live in the rvt. |
| 92 | */ |
| 93 | return -EOPNOTSUPP; |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * rvt_destroy_qp - destroy a queue pair |
| 98 | * @ibqp: the queue pair to destroy |
| 99 | * |
| 100 | * Returns 0 on success. |
| 101 | * |
| 102 | * Note that this can be called while the QP is actively sending or |
| 103 | * receiving! |
| 104 | */ |
| 105 | int rvt_destroy_qp(struct ib_qp *ibqp) |
| 106 | { |
| 107 | /* |
| 108 | * VT-DRIVER-API: qp_flush() |
| 109 | * Driver provies a mechanism to flush and wait for that flush to |
| 110 | * finish. |
| 111 | */ |
| 112 | |
| 113 | return -EOPNOTSUPP; |
| 114 | } |
| 115 | |
| 116 | int rvt_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, |
| 117 | int attr_mask, struct ib_qp_init_attr *init_attr) |
| 118 | { |
| 119 | return -EOPNOTSUPP; |
| 120 | } |
Dennis Dalessandro | 8cf4020 | 2016-01-06 10:01:17 -0800 | [diff] [blame^] | 121 | |
| 122 | /** |
| 123 | * rvt_post_receive - post a receive on a QP |
| 124 | * @ibqp: the QP to post the receive on |
| 125 | * @wr: the WR to post |
| 126 | * @bad_wr: the first bad WR is put here |
| 127 | * |
| 128 | * This may be called from interrupt context. |
| 129 | */ |
| 130 | int rvt_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr, |
| 131 | struct ib_recv_wr **bad_wr) |
| 132 | { |
| 133 | /* |
| 134 | * When a packet arrives the driver needs to call up to rvt to process |
| 135 | * the packet. The UD, RC, UC processing will be done in rvt, however |
| 136 | * the driver should be able to override this if it so choses. Perhaps a |
| 137 | * set of function pointers set up at registration time. |
| 138 | */ |
| 139 | |
| 140 | return -EOPNOTSUPP; |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * rvt_post_send - post a send on a QP |
| 145 | * @ibqp: the QP to post the send on |
| 146 | * @wr: the list of work requests to post |
| 147 | * @bad_wr: the first bad WR is put here |
| 148 | * |
| 149 | * This may be called from interrupt context. |
| 150 | */ |
| 151 | int rvt_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, |
| 152 | struct ib_send_wr **bad_wr) |
| 153 | { |
| 154 | /* |
| 155 | * VT-DRIVER-API: do_send() |
| 156 | * Driver needs to have a do_send() call which is a single entry point |
| 157 | * to take an already formed packet and throw it out on the wire. Once |
| 158 | * the packet is sent the driver needs to make an upcall to rvt so the |
| 159 | * completion queue can be notified and/or any other outstanding |
| 160 | * work/book keeping can be finished. |
| 161 | * |
| 162 | * Note that there should also be a way for rvt to protect itself |
| 163 | * against hangs in the driver layer. If a send doesn't actually |
| 164 | * complete in a timely manor rvt needs to return an error event. |
| 165 | */ |
| 166 | |
| 167 | return -EOPNOTSUPP; |
| 168 | } |
| 169 | |
| 170 | /** |
| 171 | * rvt_post_srq_receive - post a receive on a shared receive queue |
| 172 | * @ibsrq: the SRQ to post the receive on |
| 173 | * @wr: the list of work requests to post |
| 174 | * @bad_wr: A pointer to the first WR to cause a problem is put here |
| 175 | * |
| 176 | * This may be called from interrupt context. |
| 177 | */ |
| 178 | int rvt_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, |
| 179 | struct ib_recv_wr **bad_wr) |
| 180 | { |
| 181 | return -EOPNOTSUPP; |
| 182 | } |