]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blame - net/smc/smc_ib.h
tipc: fix unitilized skb list crash
[mirror_ubuntu-hirsute-kernel.git] / net / smc / smc_ib.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
a4cf0443
UB
2/*
3 * Shared Memory Communications over RDMA (SMC-R) and RoCE
4 *
5 * Definitions for IB environment
6 *
7 * Copyright IBM Corp. 2016
8 *
9 * Author(s): Ursula Braun <Ursula Braun@linux.vnet.ibm.com>
10 */
11
12#ifndef _SMC_IB_H
13#define _SMC_IB_H
14
282ccf6e 15#include <linux/interrupt.h>
143c0171 16#include <linux/if_ether.h>
a4cf0443 17#include <rdma/ib_verbs.h>
0afff91c 18#include <net/smc.h>
a4cf0443
UB
19
20#define SMC_MAX_PORTS 2 /* Max # of ports */
21#define SMC_GID_SIZE sizeof(union ib_gid)
22
f38ba179
UB
23#define SMC_IB_MAX_SEND_SGE 2
24
a4cf0443
UB
25struct smc_ib_devices { /* list of smc ib devices definition */
26 struct list_head list;
27 spinlock_t lock; /* protects list of smc ib devices */
28};
29
30extern struct smc_ib_devices smc_ib_devices; /* list of smc ib devices */
31
32struct smc_ib_device { /* ib-device infos for smc */
33 struct list_head list;
34 struct ib_device *ibdev;
35 struct ib_port_attr pattr[SMC_MAX_PORTS]; /* ib dev. port attrs */
bd4ad577 36 struct ib_event_handler event_handler; /* global ib_event handler */
f38ba179
UB
37 struct ib_cq *roce_cq_send; /* send completion queue */
38 struct ib_cq *roce_cq_recv; /* recv completion queue */
39 struct tasklet_struct send_tasklet; /* called by send cq handler */
40 struct tasklet_struct recv_tasklet; /* called by recv cq handler */
143c0171
UB
41 char mac[SMC_MAX_PORTS][ETH_ALEN];
42 /* mac address per port*/
0afff91c
UB
43 u8 pnetid[SMC_MAX_PORTS][SMC_MAX_PNETID_LEN];
44 /* pnetid per port */
890a2cb4
HW
45 bool pnetid_by_user[SMC_MAX_PORTS];
46 /* pnetid defined by user? */
a4cf0443 47 u8 initialized : 1; /* ib dev CQ, evthdl done */
bd4ad577
UB
48 struct work_struct port_event_work;
49 unsigned long port_event_mask;
a4cf0443
UB
50};
51
cd6851f3 52struct smc_buf_desc;
f38ba179 53struct smc_link;
cd6851f3 54
a4cf0443
UB
55int smc_ib_register_client(void) __init;
56void smc_ib_unregister_client(void);
57bool smc_ib_port_active(struct smc_ib_device *smcibdev, u8 ibport);
a3fe3d01
UB
58int smc_ib_buf_map_sg(struct smc_ib_device *smcibdev,
59 struct smc_buf_desc *buf_slot,
60 enum dma_data_direction data_direction);
61void smc_ib_buf_unmap_sg(struct smc_ib_device *smcibdev,
62 struct smc_buf_desc *buf_slot,
63 enum dma_data_direction data_direction);
f38ba179
UB
64void smc_ib_dealloc_protection_domain(struct smc_link *lnk);
65int smc_ib_create_protection_domain(struct smc_link *lnk);
66void smc_ib_destroy_queue_pair(struct smc_link *lnk);
67int smc_ib_create_queue_pair(struct smc_link *lnk);
bd4ad577
UB
68int smc_ib_ready_link(struct smc_link *lnk);
69int smc_ib_modify_qp_rts(struct smc_link *lnk);
70int smc_ib_modify_qp_reset(struct smc_link *lnk);
71long smc_ib_setup_per_ibdev(struct smc_ib_device *smcibdev);
897e1c24
UB
72int smc_ib_get_memory_region(struct ib_pd *pd, int access_flags,
73 struct smc_buf_desc *buf_slot);
74void smc_ib_put_memory_region(struct ib_mr *mr);
10428dd8
UB
75void smc_ib_sync_sg_for_cpu(struct smc_ib_device *smcibdev,
76 struct smc_buf_desc *buf_slot,
77 enum dma_data_direction data_direction);
78void smc_ib_sync_sg_for_device(struct smc_ib_device *smcibdev,
79 struct smc_buf_desc *buf_slot,
80 enum dma_data_direction data_direction);
7005ada6
UB
81int smc_ib_determine_gid(struct smc_ib_device *smcibdev, u8 ibport,
82 unsigned short vlan_id, u8 gid[], u8 *sgid_index);
a4cf0443 83#endif