xref: /freebsd/sys/dev/ice/irdma_if.m (revision 015f8cc5b0c10336a048f37a7071ea03516de242)
18a13362dSEric Joyner# SPDX-License-Identifier: BSD-3-Clause
2*015f8cc5SEric Joyner#  Copyright (c) 2024, Intel Corporation
38a13362dSEric Joyner#  All rights reserved.
48a13362dSEric Joyner#
58a13362dSEric Joyner#  Redistribution and use in source and binary forms, with or without
68a13362dSEric Joyner#  modification, are permitted provided that the following conditions are met:
78a13362dSEric Joyner#
88a13362dSEric Joyner#   1. Redistributions of source code must retain the above copyright notice,
98a13362dSEric Joyner#      this list of conditions and the following disclaimer.
108a13362dSEric Joyner#
118a13362dSEric Joyner#   2. Redistributions in binary form must reproduce the above copyright
128a13362dSEric Joyner#      notice, this list of conditions and the following disclaimer in the
138a13362dSEric Joyner#      documentation and/or other materials provided with the distribution.
148a13362dSEric Joyner#
158a13362dSEric Joyner#   3. Neither the name of the Intel Corporation nor the names of its
168a13362dSEric Joyner#      contributors may be used to endorse or promote products derived from
178a13362dSEric Joyner#      this software without specific prior written permission.
188a13362dSEric Joyner#
198a13362dSEric Joyner#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
208a13362dSEric Joyner#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
218a13362dSEric Joyner#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
228a13362dSEric Joyner#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
238a13362dSEric Joyner#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
248a13362dSEric Joyner#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
258a13362dSEric Joyner#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
268a13362dSEric Joyner#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
278a13362dSEric Joyner#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
288a13362dSEric Joyner#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
298a13362dSEric Joyner#  POSSIBILITY OF SUCH DAMAGE.
308a13362dSEric Joyner
318a13362dSEric Joyner/**
328a13362dSEric Joyner * @file irdma_if.m
338a13362dSEric Joyner * @brief RDMA client kobject interface
348a13362dSEric Joyner *
358a13362dSEric Joyner * KOBject methods implemented by the RDMA client driver. These functions will
368a13362dSEric Joyner * be called from the ice driver to notify the RDMA client driver of device
378a13362dSEric Joyner * driver events.
388a13362dSEric Joyner */
398a13362dSEric Joyner#include "ice_rdma.h"
408a13362dSEric Joyner
418a13362dSEric JoynerINTERFACE irdma;
428a13362dSEric Joyner
438a13362dSEric Joyner/**
448a13362dSEric Joyner * probe - Notify the RDMA client driver that a peer device has been created
458a13362dSEric Joyner * @peer: the RDMA peer structure
468a13362dSEric Joyner *
478a13362dSEric Joyner * Called by the ice driver during attach to notify the RDMA client driver
488a13362dSEric Joyner * that a new PF has been initialized.
499c30461dSEric Joyner * @returns 0 on success, EIO, ENOMEM, EINVAL, EBUSY if a problem is encountered
508a13362dSEric Joyner */
518a13362dSEric JoynerMETHOD int probe {
528a13362dSEric Joyner	struct ice_rdma_peer *peer;
538a13362dSEric Joyner};
548a13362dSEric Joyner
558a13362dSEric Joyner/**
568a13362dSEric Joyner * open - Notify the RDMA client driver that a peer device has been opened
578a13362dSEric Joyner * @peer: the RDMA peer structure
588a13362dSEric Joyner *
598a13362dSEric Joyner * Called by the ice driver during the if_init routine to notify the RDMA
608a13362dSEric Joyner * client driver that a PF has been activated.
619c30461dSEric Joyner * @returns 0
628a13362dSEric Joyner */
638a13362dSEric JoynerMETHOD int open {
648a13362dSEric Joyner	struct ice_rdma_peer *peer;
658a13362dSEric Joyner};
668a13362dSEric Joyner
678a13362dSEric Joyner/**
688a13362dSEric Joyner * close - Notify the RDMA client driver that a peer device has closed
698a13362dSEric Joyner * @peer: the RDMA peer structure
708a13362dSEric Joyner *
718a13362dSEric Joyner * Called by the ice driver during the if_stop routine to notify the RDMA
728a13362dSEric Joyner * client driver that a PF has been deactivated.
739c30461dSEric Joyner * @returns 0
748a13362dSEric Joyner */
758a13362dSEric JoynerMETHOD int close {
768a13362dSEric Joyner	struct ice_rdma_peer *peer;
778a13362dSEric Joyner};
788a13362dSEric Joyner
798a13362dSEric Joyner/**
808a13362dSEric Joyner * remove - Notify the RDMA client driver that a peer device has been removed
818a13362dSEric Joyner * @peer: the RDMA peer structure
828a13362dSEric Joyner *
838a13362dSEric Joyner * Called by the ice driver during detach to notify the RDMA client driver
848a13362dSEric Joyner * that a PF has been removed.
859c30461dSEric Joyner * @returns 0
868a13362dSEric Joyner */
878a13362dSEric JoynerMETHOD int remove {
888a13362dSEric Joyner	struct ice_rdma_peer *peer;
898a13362dSEric Joyner}
908a13362dSEric Joyner
918a13362dSEric Joyner/**
928a13362dSEric Joyner * link_change - Notify the RDMA client driver that link status has changed
938a13362dSEric Joyner * @peer: the RDMA peer structure
948a13362dSEric Joyner * @linkstate: link status
958a13362dSEric Joyner * @baudrate: link rate in bits per second
968a13362dSEric Joyner *
978a13362dSEric Joyner * Called by the ice driver when link status changes to notify the RDMA client
988a13362dSEric Joyner * driver of the new status.
998a13362dSEric Joyner */
1008a13362dSEric JoynerMETHOD void link_change {
1018a13362dSEric Joyner	struct ice_rdma_peer *peer;
1028a13362dSEric Joyner	int linkstate;
1038a13362dSEric Joyner	uint64_t baudrate;
1048a13362dSEric Joyner}
1058a13362dSEric Joyner
1068a13362dSEric JoynerMETHOD void event_handler {
1078a13362dSEric Joyner	struct ice_rdma_peer *peer;
1088a13362dSEric Joyner	struct ice_rdma_event *event;
1098a13362dSEric Joyner}
110