xref: /freebsd/sys/dev/ice/irdma_if.m (revision f126890ac5386406dadf7c4cfa9566cbb56537c5)
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 * @returns 0 on success, EIO, ENOMEM, EINVAL, EBUSY if a problem is encountered
50 */
51METHOD int probe {
52	struct ice_rdma_peer *peer;
53};
54
55/**
56 * open - Notify the RDMA client driver that a peer device has been opened
57 * @peer: the RDMA peer structure
58 *
59 * Called by the ice driver during the if_init routine to notify the RDMA
60 * client driver that a PF has been activated.
61 * @returns 0
62 */
63METHOD int open {
64	struct ice_rdma_peer *peer;
65};
66
67/**
68 * close - Notify the RDMA client driver that a peer device has closed
69 * @peer: the RDMA peer structure
70 *
71 * Called by the ice driver during the if_stop routine to notify the RDMA
72 * client driver that a PF has been deactivated.
73 * @returns 0
74 */
75METHOD int close {
76	struct ice_rdma_peer *peer;
77};
78
79/**
80 * remove - Notify the RDMA client driver that a peer device has been removed
81 * @peer: the RDMA peer structure
82 *
83 * Called by the ice driver during detach to notify the RDMA client driver
84 * that a PF has been removed.
85 * @returns 0
86 */
87METHOD int remove {
88	struct ice_rdma_peer *peer;
89}
90
91/**
92 * link_change - Notify the RDMA client driver that link status has changed
93 * @peer: the RDMA peer structure
94 * @linkstate: link status
95 * @baudrate: link rate in bits per second
96 *
97 * Called by the ice driver when link status changes to notify the RDMA client
98 * driver of the new status.
99 */
100METHOD void link_change {
101	struct ice_rdma_peer *peer;
102	int linkstate;
103	uint64_t baudrate;
104}
105
106METHOD void event_handler {
107	struct ice_rdma_peer *peer;
108	struct ice_rdma_event *event;
109}
110