// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* * Copyright(c) 2016 Intel Corporation. */ #include <linux/slab.h> #include <linux/sched.h> #include <linux/rculist.h> #include <rdma/rdma_vt.h> #include <rdma/rdmavt_qp.h> #include "mcast.h" /** * rvt_driver_mcast_init - init resources for multicast * @rdi: rvt dev struct * * This is per device that registers with rdmavt */ void rvt_driver_mcast_init(struct rvt_dev_info *rdi) { … } /** * rvt_mcast_qp_alloc - alloc a struct to link a QP to mcast GID struct * @qp: the QP to link */ static struct rvt_mcast_qp *rvt_mcast_qp_alloc(struct rvt_qp *qp) { … } static void rvt_mcast_qp_free(struct rvt_mcast_qp *mqp) { … } /** * rvt_mcast_alloc - allocate the multicast GID structure * @mgid: the multicast GID * @lid: the muilticast LID (host order) * * A list of QPs will be attached to this structure. */ static struct rvt_mcast *rvt_mcast_alloc(union ib_gid *mgid, u16 lid) { … } static void rvt_mcast_free(struct rvt_mcast *mcast) { … } /** * rvt_mcast_find - search the global table for the given multicast GID/LID * NOTE: It is valid to have 1 MLID with multiple MGIDs. It is not valid * to have 1 MGID with multiple MLIDs. * @ibp: the IB port structure * @mgid: the multicast GID to search for * @lid: the multicast LID portion of the multicast address (host order) * * The caller is responsible for decrementing the reference count if found. * * Return: NULL if not found. */ struct rvt_mcast *rvt_mcast_find(struct rvt_ibport *ibp, union ib_gid *mgid, u16 lid) { … } EXPORT_SYMBOL(…); /* * rvt_mcast_add - insert mcast GID into table and attach QP struct * @mcast: the mcast GID table * @mqp: the QP to attach * * Return: zero if both were added. Return EEXIST if the GID was already in * the table but the QP was added. Return ESRCH if the QP was already * attached and neither structure was added. Return EINVAL if the MGID was * found, but the MLID did NOT match. */ static int rvt_mcast_add(struct rvt_dev_info *rdi, struct rvt_ibport *ibp, struct rvt_mcast *mcast, struct rvt_mcast_qp *mqp) { … } /** * rvt_attach_mcast - attach a qp to a multicast group * @ibqp: Infiniband qp * @gid: multicast guid * @lid: multicast lid * * Return: 0 on success */ int rvt_attach_mcast(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) { … } /** * rvt_detach_mcast - remove a qp from a multicast group * @ibqp: Infiniband qp * @gid: multicast guid * @lid: multicast lid * * Return: 0 on success */ int rvt_detach_mcast(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) { … } /** * rvt_mcast_tree_empty - determine if any qps are attached to any mcast group * @rdi: rvt dev struct * * Return: in use count */ int rvt_mcast_tree_empty(struct rvt_dev_info *rdi) { … }