linux/net/smc/smc_ib.c

// SPDX-License-Identifier: GPL-2.0
/*
 *  Shared Memory Communications over RDMA (SMC-R) and RoCE
 *
 *  IB infrastructure:
 *  Establish SMC-R as an Infiniband Client to be notified about added and
 *  removed IB devices of type RDMA.
 *  Determine device and port characteristics for these IB devices.
 *
 *  Copyright IBM Corp. 2016
 *
 *  Author(s):  Ursula Braun <[email protected]>
 */

#include <linux/etherdevice.h>
#include <linux/if_vlan.h>
#include <linux/random.h>
#include <linux/workqueue.h>
#include <linux/scatterlist.h>
#include <linux/wait.h>
#include <linux/mutex.h>
#include <linux/inetdevice.h>
#include <rdma/ib_verbs.h>
#include <rdma/ib_cache.h>

#include "smc_pnet.h"
#include "smc_ib.h"
#include "smc_core.h"
#include "smc_wr.h"
#include "smc.h"
#include "smc_netlink.h"

#define SMC_MAX_CQE

#define SMC_QP_MIN_RNR_TIMER
#define SMC_QP_TIMEOUT
#define SMC_QP_RETRY_CNT
#define SMC_QP_RNR_RETRY

struct smc_ib_devices smc_ib_devices =;

u8 local_systemid[SMC_SYSTEMID_LEN];		/* unique system identifier */

static int smc_ib_modify_qp_init(struct smc_link *lnk)
{}

static int smc_ib_modify_qp_rtr(struct smc_link *lnk)
{}

int smc_ib_modify_qp_rts(struct smc_link *lnk)
{}

int smc_ib_modify_qp_error(struct smc_link *lnk)
{}

int smc_ib_ready_link(struct smc_link *lnk)
{}

static int smc_ib_fill_mac(struct smc_ib_device *smcibdev, u8 ibport)
{}

/* Create an identifier unique for this instance of SMC-R.
 * The MAC-address of the first active registered IB device
 * plus a random 2-byte number is used to create this identifier.
 * This name is delivered to the peer during connection initialization.
 */
static inline void smc_ib_define_local_systemid(struct smc_ib_device *smcibdev,
						u8 ibport)
{}

bool smc_ib_is_valid_local_systemid(void)
{}

static void smc_ib_init_local_systemid(void)
{}

bool smc_ib_port_active(struct smc_ib_device *smcibdev, u8 ibport)
{}

int smc_ib_find_route(struct net *net, __be32 saddr, __be32 daddr,
		      u8 nexthop_mac[], u8 *uses_gateway)
{}

static int smc_ib_determine_gid_rcu(const struct net_device *ndev,
				    const struct ib_gid_attr *attr,
				    u8 gid[], u8 *sgid_index,
				    struct smc_init_info_smcrv2 *smcrv2)
{}

/* determine the gid for an ib-device port and vlan id */
int smc_ib_determine_gid(struct smc_ib_device *smcibdev, u8 ibport,
			 unsigned short vlan_id, u8 gid[], u8 *sgid_index,
			 struct smc_init_info_smcrv2 *smcrv2)
{}

/* check if gid is still defined on smcibdev */
static bool smc_ib_check_link_gid(u8 gid[SMC_GID_SIZE], bool smcrv2,
				  struct smc_ib_device *smcibdev, u8 ibport)
{}

/* check all links if the gid is still defined on smcibdev */
static void smc_ib_gid_check(struct smc_ib_device *smcibdev, u8 ibport)
{}

static int smc_ib_remember_port_attr(struct smc_ib_device *smcibdev, u8 ibport)
{}

/* process context wrapper for might_sleep smc_ib_remember_port_attr */
static void smc_ib_port_event_work(struct work_struct *work)
{}

/* can be called in IRQ context */
static void smc_ib_global_event_handler(struct ib_event_handler *handler,
					struct ib_event *ibevent)
{}

void smc_ib_dealloc_protection_domain(struct smc_link *lnk)
{}

int smc_ib_create_protection_domain(struct smc_link *lnk)
{}

static bool smcr_diag_is_dev_critical(struct smc_lgr_list *smc_lgr,
				      struct smc_ib_device *smcibdev)
{}

static int smc_nl_handle_dev_port(struct sk_buff *skb,
				  struct ib_device *ibdev,
				  struct smc_ib_device *smcibdev,
				  int port)
{}

static bool smc_nl_handle_pci_values(const struct smc_pci_dev *smc_pci_dev,
				     struct sk_buff *skb)
{}

static int smc_nl_handle_smcr_dev(struct smc_ib_device *smcibdev,
				  struct sk_buff *skb,
				  struct netlink_callback *cb)
{}

static void smc_nl_prep_smcr_dev(struct smc_ib_devices *dev_list,
				 struct sk_buff *skb,
				 struct netlink_callback *cb)
{}

int smcr_nl_get_device(struct sk_buff *skb, struct netlink_callback *cb)
{}

static void smc_ib_qp_event_handler(struct ib_event *ibevent, void *priv)
{}

void smc_ib_destroy_queue_pair(struct smc_link *lnk)
{}

/* create a queue pair within the protection domain for a link */
int smc_ib_create_queue_pair(struct smc_link *lnk)
{}

void smc_ib_put_memory_region(struct ib_mr *mr)
{}

static int smc_ib_map_mr_sg(struct smc_buf_desc *buf_slot, u8 link_idx)
{}

/* Allocate a memory region and map the dma mapped SG list of buf_slot */
int smc_ib_get_memory_region(struct ib_pd *pd, int access_flags,
			     struct smc_buf_desc *buf_slot, u8 link_idx)
{}

bool smc_ib_is_sg_need_sync(struct smc_link *lnk,
			    struct smc_buf_desc *buf_slot)
{}

/* synchronize buffer usage for cpu access */
void smc_ib_sync_sg_for_cpu(struct smc_link *lnk,
			    struct smc_buf_desc *buf_slot,
			    enum dma_data_direction data_direction)
{}

/* synchronize buffer usage for device access */
void smc_ib_sync_sg_for_device(struct smc_link *lnk,
			       struct smc_buf_desc *buf_slot,
			       enum dma_data_direction data_direction)
{}

/* Map a new TX or RX buffer SG-table to DMA */
int smc_ib_buf_map_sg(struct smc_link *lnk,
		      struct smc_buf_desc *buf_slot,
		      enum dma_data_direction data_direction)
{}

void smc_ib_buf_unmap_sg(struct smc_link *lnk,
			 struct smc_buf_desc *buf_slot,
			 enum dma_data_direction data_direction)
{}

long smc_ib_setup_per_ibdev(struct smc_ib_device *smcibdev)
{}

static void smc_ib_cleanup_per_ibdev(struct smc_ib_device *smcibdev)
{}

static struct ib_client smc_ib_client;

static void smc_copy_netdev_ifindex(struct smc_ib_device *smcibdev, int port)
{}

void smc_ib_ndev_change(struct net_device *ndev, unsigned long event)
{}

/* callback function for ib_register_client() */
static int smc_ib_add_dev(struct ib_device *ibdev)
{}

/* callback function for ib_unregister_client() */
static void smc_ib_remove_dev(struct ib_device *ibdev, void *client_data)
{}

static struct ib_client smc_ib_client =;

int __init smc_ib_register_client(void)
{}

void smc_ib_unregister_client(void)
{}