summaryrefslogtreecommitdiff
path: root/include/linux/net/intel/iidc_rdma.h
blob: 7f191028953468bba93e0eedcac1657f2008ddbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2021-2025, Intel Corporation. */

#ifndef _IIDC_RDMA_H_
#define _IIDC_RDMA_H_

#include <linux/auxiliary_bus.h>
#include <linux/dcbnl.h>
#include <linux/device.h>
#include <linux/if_ether.h>
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <net/dscp.h>

enum iidc_rdma_event_type {
	IIDC_RDMA_EVENT_BEFORE_MTU_CHANGE,
	IIDC_RDMA_EVENT_AFTER_MTU_CHANGE,
	IIDC_RDMA_EVENT_BEFORE_TC_CHANGE,
	IIDC_RDMA_EVENT_AFTER_TC_CHANGE,
	IIDC_RDMA_EVENT_CRIT_ERR,
	IIDC_RDMA_EVENT_NBITS		/* must be last */
};

enum iidc_rdma_reset_type {
	IIDC_PFR,
	IIDC_CORER,
	IIDC_GLOBR,
};

enum iidc_rdma_protocol {
	IIDC_RDMA_PROTOCOL_IWARP = BIT(0),
	IIDC_RDMA_PROTOCOL_ROCEV2 = BIT(1),
};

#define IIDC_MAX_USER_PRIORITY		8
#define IIDC_DSCP_PFC_MODE		0x1

/* Struct to hold per RDMA Qset info */
struct iidc_rdma_qset_params {
	/* Qset TEID returned to the RDMA driver in
	 * ice_add_rdma_qset and used by RDMA driver
	 * for calls to ice_del_rdma_qset
	 */
	u32 teid;	/* Qset TEID */
	u16 qs_handle; /* RDMA driver provides this */
	u16 vport_id; /* VSI index */
	u8 tc; /* TC branch the Qset should belong to */
};

struct iidc_rdma_qos_info {
	u64 tc_ctx;
	u8 rel_bw;
	u8 prio_type;
	u8 egress_virt_up;
	u8 ingress_virt_up;
};

/* Struct to pass QoS info */
struct iidc_rdma_qos_params {
	struct iidc_rdma_qos_info tc_info[IEEE_8021QAZ_MAX_TCS];
	u8 up2tc[IIDC_MAX_USER_PRIORITY];
	u8 vport_relative_bw;
	u8 vport_priority_type;
	u8 num_tc;
	u8 pfc_mode;
	u8 dscp_map[DSCP_MAX];
};

struct iidc_rdma_event {
	DECLARE_BITMAP(type, IIDC_RDMA_EVENT_NBITS);
	u32 reg;
};

/* Structure representing auxiliary driver tailored information about the core
 * PCI dev, each auxiliary driver using the IIDC interface will have an
 * instance of this struct dedicated to it.
 */

struct iidc_rdma_core_auxiliary_dev {
	struct auxiliary_device adev;
	struct ice_pf *pf;
};

/* structure representing the auxiliary driver. This struct is to be
 * allocated and populated by the auxiliary driver's owner. The core PCI
 * driver will access these ops by performing a container_of on the
 * auxiliary_device->dev.driver.
 */
struct iidc_rdma_core_auxiliary_drv {
	struct auxiliary_driver adrv;
	/* This event_handler is meant to be a blocking call.  For instance,
	 * when a BEFORE_MTU_CHANGE event comes in, the event_handler will not
	 * return until the auxiliary driver is ready for the MTU change to
	 * happen.
	 */
	void (*event_handler)(struct ice_pf *pf, struct iidc_rdma_event *event);
};

#endif /* _IIDC_RDMA_H_*/