xref: /freebsd/sys/dev/ice/irdma_if.m (revision 2a9021898c4ee2154787da862c238cfeccd655df)
1# SPDX-License-Identifier: BSD-3-Clause
2#  Copyright (c) 2023, 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/**
32 * @file irdma_if.m
33 * @brief RDMA client kobject interface
34 *
35 * KOBject methods implemented by the RDMA client driver. These functions will
36 * be called from the ice driver to notify the RDMA client driver of device
37 * driver events.
38 */
39#include "ice_rdma.h"
40
41INTERFACE irdma;
42
43/**
44 * probe - Notify the RDMA client driver that a peer device has been created
45 * @peer: the RDMA peer structure
46 *
47 * Called by the ice driver during attach to notify the RDMA client driver
48 * that a new PF has been initialized.
49 */
50METHOD int probe {
51	struct ice_rdma_peer *peer;
52};
53
54/**
55 * open - Notify the RDMA client driver that a peer device has been opened
56 * @peer: the RDMA peer structure
57 *
58 * Called by the ice driver during the if_init routine to notify the RDMA
59 * client driver that a PF has been activated.
60 */
61METHOD int open {
62	struct ice_rdma_peer *peer;
63};
64
65/**
66 * close - Notify the RDMA client driver that a peer device has closed
67 * @peer: the RDMA peer structure
68 *
69 * Called by the ice driver during the if_stop routine to notify the RDMA
70 * client driver that a PF has been deactivated.
71 */
72METHOD int close {
73	struct ice_rdma_peer *peer;
74};
75
76/**
77 * remove - Notify the RDMA client driver that a peer device has been removed
78 * @peer: the RDMA peer structure
79 *
80 * Called by the ice driver during detach to notify the RDMA client driver
81 * that a PF has been removed.
82 */
83METHOD int remove {
84	struct ice_rdma_peer *peer;
85}
86
87/**
88 * link_change - Notify the RDMA client driver that link status has changed
89 * @peer: the RDMA peer structure
90 * @linkstate: link status
91 * @baudrate: link rate in bits per second
92 *
93 * Called by the ice driver when link status changes to notify the RDMA client
94 * driver of the new status.
95 */
96METHOD void link_change {
97	struct ice_rdma_peer *peer;
98	int linkstate;
99	uint64_t baudrate;
100}
101
102METHOD void event_handler {
103	struct ice_rdma_peer *peer;
104	struct ice_rdma_event *event;
105}
106