1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /* Copyright (c) 2022, Intel Corporation
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * 3. Neither the name of the Intel Corporation nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31 /*$FreeBSD$*/
32
33 /**
34 * @file ice_rdma_internal.h
35 * @brief internal header for the RMDA driver interface setup
36 *
37 * Contains the definitions and functions used by the ice driver to setup the
38 * RDMA driver interface. Functions and definitions in this file are not
39 * shared with the RDMA client driver.
40 */
41 #ifndef _ICE_RDMA_INTERNAL_H_
42 #define _ICE_RDMA_INTERNAL_H_
43
44 #include "ice_rdma.h"
45
46 /* Forward declare the softc structure */
47 struct ice_softc;
48
49 /* Global sysctl variable indicating if the RDMA client interface is enabled */
50 extern bool ice_enable_irdma;
51
52 /**
53 * @struct ice_rdma_entry
54 * @brief RDMA peer list node
55 *
56 * Structure used to store peer entries for each PF in a linked list.
57 */
58 struct ice_rdma_entry {
59 LIST_ENTRY(ice_rdma_entry) node;
60 struct ice_rdma_peer peer;
61 bool attached;
62 bool initiated;
63 };
64
65 #define ice_rdma_peer_to_entry(p) __containerof(p, struct ice_rdma_entry, peer)
66 #define ice_rdma_entry_to_sc(e) __containerof(e, struct ice_softc, rdma_entry)
67 #define ice_rdma_peer_to_sc(p) ice_rdma_entry_to_sc(ice_rdma_peer_to_entry(p))
68
69 /**
70 * @struct ice_rdma_peers
71 * @brief Head list structure for the RDMA entry list
72 *
73 * Type defining the head of the linked list of RDMA entries.
74 */
75 LIST_HEAD(ice_rdma_peers, ice_rdma_entry);
76
77 /**
78 * @struct ice_rdma_state
79 * @brief global driver state for RDMA
80 *
81 * Contains global state shared across all PFs by the device driver, such as
82 * the kobject class of the currently connected peer driver, and the linked
83 * list of peer entries for each PF.
84 */
85 struct ice_rdma_state {
86 bool registered;
87 kobj_class_t peer_class;
88 struct sx mtx;
89 struct ice_rdma_peers peers;
90 };
91
92 void ice_rdma_init(void);
93 void ice_rdma_exit(void);
94
95 int ice_rdma_pf_attach(struct ice_softc *sc);
96 void ice_rdma_pf_detach(struct ice_softc *sc);
97 int ice_rdma_pf_init(struct ice_softc *sc);
98 int ice_rdma_pf_stop(struct ice_softc *sc);
99 void ice_rdma_link_change(struct ice_softc *sc, int linkstate, uint64_t baudrate);
100 void ice_rdma_notify_dcb_qos_change(struct ice_softc *sc);
101 void ice_rdma_dcb_qos_update(struct ice_softc *sc, struct ice_port_info *pi);
102 #endif
Cache object: c3813a8ec197acdf4d3bc1991ee37725
|