The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/ofed/drivers/infiniband/core/mad_priv.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0
    3  *
    4  * Copyright (c) 2004, 2005, Voltaire, Inc. All rights reserved.
    5  * Copyright (c) 2005 Intel Corporation. All rights reserved.
    6  * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
    7  * Copyright (c) 2009 HNR Consulting. All rights reserved.
    8  *
    9  * This software is available to you under a choice of one of two
   10  * licenses.  You may choose to be licensed under the terms of the GNU
   11  * General Public License (GPL) Version 2, available from the file
   12  * COPYING in the main directory of this source tree, or the
   13  * OpenIB.org BSD license below:
   14  *
   15  *     Redistribution and use in source and binary forms, with or
   16  *     without modification, are permitted provided that the following
   17  *     conditions are met:
   18  *
   19  *      - Redistributions of source code must retain the above
   20  *        copyright notice, this list of conditions and the following
   21  *        disclaimer.
   22  *
   23  *      - Redistributions in binary form must reproduce the above
   24  *        copyright notice, this list of conditions and the following
   25  *        disclaimer in the documentation and/or other materials
   26  *        provided with the distribution.
   27  *
   28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
   29  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
   31  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
   32  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
   33  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   34  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   35  * SOFTWARE.
   36  *
   37  * $FreeBSD$
   38  */
   39 
   40 #ifndef __IB_MAD_PRIV_H__
   41 #define __IB_MAD_PRIV_H__
   42 
   43 #include <linux/completion.h>
   44 #include <linux/err.h>
   45 #include <linux/workqueue.h>
   46 #include <rdma/ib_mad.h>
   47 #include <rdma/ib_smi.h>
   48 #include <rdma/opa_smi.h>
   49 
   50 #define IB_MAD_QPS_CORE         2 /* Always QP0 and QP1 as a minimum */
   51 
   52 /* QP and CQ parameters */
   53 #define IB_MAD_QP_SEND_SIZE     128
   54 #define IB_MAD_QP_RECV_SIZE     512
   55 #define IB_MAD_QP_MIN_SIZE      64
   56 #define IB_MAD_QP_MAX_SIZE      8192
   57 #define IB_MAD_SEND_REQ_MAX_SG  2
   58 #define IB_MAD_RECV_REQ_MAX_SG  1
   59 
   60 #define IB_MAD_SEND_Q_PSN       0
   61 
   62 /* Registration table sizes */
   63 #define MAX_MGMT_CLASS          80
   64 #define MAX_MGMT_VERSION        0x83
   65 #define MAX_MGMT_OUI            8
   66 #define MAX_MGMT_VENDOR_RANGE2  (IB_MGMT_CLASS_VENDOR_RANGE2_END - \
   67                                 IB_MGMT_CLASS_VENDOR_RANGE2_START + 1)
   68 
   69 struct ib_mad_list_head {
   70         struct list_head list;
   71         struct ib_cqe cqe;
   72         struct ib_mad_queue *mad_queue;
   73 };
   74 
   75 struct ib_mad_private_header {
   76         struct ib_mad_list_head mad_list;
   77         struct ib_mad_recv_wc recv_wc;
   78         struct ib_wc wc;
   79         u64 mapping;
   80 } __attribute__ ((packed));
   81 
   82 struct ib_mad_private {
   83         struct ib_mad_private_header header;
   84         size_t mad_size;
   85         struct ib_grh grh;
   86         u8 mad[0];
   87 } __attribute__ ((packed));
   88 
   89 struct ib_rmpp_segment {
   90         struct list_head list;
   91         u32 num;
   92         u8 data[0];
   93 };
   94 
   95 struct ib_mad_agent_private {
   96         struct list_head agent_list;
   97         struct ib_mad_agent agent;
   98         struct ib_mad_reg_req *reg_req;
   99         struct ib_mad_qp_info *qp_info;
  100 
  101         spinlock_t lock;
  102         struct list_head send_list;
  103         struct list_head wait_list;
  104         struct list_head done_list;
  105         struct delayed_work timed_work;
  106         unsigned long timeout;
  107         struct list_head local_list;
  108         struct work_struct local_work;
  109         struct list_head rmpp_list;
  110 
  111         atomic_t refcount;
  112         struct completion comp;
  113 };
  114 
  115 struct ib_mad_snoop_private {
  116         struct ib_mad_agent agent;
  117         struct ib_mad_qp_info *qp_info;
  118         int snoop_index;
  119         int mad_snoop_flags;
  120         atomic_t refcount;
  121         struct completion comp;
  122 };
  123 
  124 struct ib_mad_send_wr_private {
  125         struct ib_mad_list_head mad_list;
  126         struct list_head agent_list;
  127         struct ib_mad_agent_private *mad_agent_priv;
  128         struct ib_mad_send_buf send_buf;
  129         u64 header_mapping;
  130         u64 payload_mapping;
  131         struct ib_ud_wr send_wr;
  132         struct ib_sge sg_list[IB_MAD_SEND_REQ_MAX_SG];
  133         __be64 tid;
  134         unsigned long timeout;
  135         int max_retries;
  136         int retries_left;
  137         int retry;
  138         int refcount;
  139         enum ib_wc_status status;
  140 
  141         /* RMPP control */
  142         struct list_head rmpp_list;
  143         struct ib_rmpp_segment *last_ack_seg;
  144         struct ib_rmpp_segment *cur_seg;
  145         int last_ack;
  146         int seg_num;
  147         int newwin;
  148         int pad;
  149 };
  150 
  151 struct ib_mad_local_private {
  152         struct list_head completion_list;
  153         struct ib_mad_private *mad_priv;
  154         struct ib_mad_agent_private *recv_mad_agent;
  155         struct ib_mad_send_wr_private *mad_send_wr;
  156         size_t return_wc_byte_len;
  157 };
  158 
  159 struct ib_mad_mgmt_method_table {
  160         struct ib_mad_agent_private *agent[IB_MGMT_MAX_METHODS];
  161 };
  162 
  163 struct ib_mad_mgmt_class_table {
  164         struct ib_mad_mgmt_method_table *method_table[MAX_MGMT_CLASS];
  165 };
  166 
  167 struct ib_mad_mgmt_vendor_class {
  168         u8      oui[MAX_MGMT_OUI][3];
  169         struct ib_mad_mgmt_method_table *method_table[MAX_MGMT_OUI];
  170 };
  171 
  172 struct ib_mad_mgmt_vendor_class_table {
  173         struct ib_mad_mgmt_vendor_class *vendor_class[MAX_MGMT_VENDOR_RANGE2];
  174 };
  175 
  176 struct ib_mad_mgmt_version_table {
  177         struct ib_mad_mgmt_class_table *class;
  178         struct ib_mad_mgmt_vendor_class_table *vendor;
  179 };
  180 
  181 struct ib_mad_queue {
  182         spinlock_t lock;
  183         struct list_head list;
  184         int count;
  185         int max_active;
  186         struct ib_mad_qp_info *qp_info;
  187 };
  188 
  189 struct ib_mad_qp_info {
  190         struct ib_mad_port_private *port_priv;
  191         struct ib_qp *qp;
  192         struct ib_mad_queue send_queue;
  193         struct ib_mad_queue recv_queue;
  194         struct list_head overflow_list;
  195         spinlock_t snoop_lock;
  196         struct ib_mad_snoop_private **snoop_table;
  197         int snoop_table_size;
  198         atomic_t snoop_count;
  199 };
  200 
  201 struct ib_mad_port_private {
  202         struct list_head port_list;
  203         struct ib_device *device;
  204         int port_num;
  205         struct ib_cq *cq;
  206         struct ib_pd *pd;
  207 
  208         spinlock_t reg_lock;
  209         struct ib_mad_mgmt_version_table version[MAX_MGMT_VERSION];
  210         struct list_head agent_list;
  211         struct workqueue_struct *wq;
  212         struct ib_mad_qp_info qp_info[IB_MAD_QPS_CORE];
  213 };
  214 
  215 int ib_send_mad(struct ib_mad_send_wr_private *mad_send_wr);
  216 
  217 struct ib_mad_send_wr_private *
  218 ib_find_send_mad(const struct ib_mad_agent_private *mad_agent_priv,
  219                  const struct ib_mad_recv_wc *mad_recv_wc);
  220 
  221 void ib_mad_complete_send_wr(struct ib_mad_send_wr_private *mad_send_wr,
  222                              struct ib_mad_send_wc *mad_send_wc);
  223 
  224 void ib_mark_mad_done(struct ib_mad_send_wr_private *mad_send_wr);
  225 
  226 void ib_reset_mad_timeout(struct ib_mad_send_wr_private *mad_send_wr,
  227                           int timeout_ms);
  228 
  229 #endif  /* __IB_MAD_PRIV_H__ */

Cache object: f63ffec25764f3db0bae33767f575109


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.