1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2021, Intel Corporation. */
7 #include <linux/auxiliary_bus.h>
8 #include <linux/dcbnl.h>
9 #include <linux/device.h>
10 #include <linux/if_ether.h>
11 #include <linux/kernel.h>
12 #include <linux/netdevice.h>
14 enum iidc_event_type {
15 IIDC_EVENT_BEFORE_MTU_CHANGE,
16 IIDC_EVENT_AFTER_MTU_CHANGE,
17 IIDC_EVENT_BEFORE_TC_CHANGE,
18 IIDC_EVENT_AFTER_TC_CHANGE,
20 IIDC_EVENT_NBITS /* must be last */
23 enum iidc_reset_type {
29 #define IIDC_MAX_USER_PRIORITY 8
31 /* Struct to hold per RDMA Qset info */
32 struct iidc_rdma_qset_params {
33 /* Qset TEID returned to the RDMA driver in
34 * ice_add_rdma_qset and used by RDMA driver
35 * for calls to ice_del_rdma_qset
37 u32 teid; /* Qset TEID */
38 u16 qs_handle; /* RDMA driver provides this */
39 u16 vport_id; /* VSI index */
40 u8 tc; /* TC branch the Qset should belong to */
43 struct iidc_qos_info {
51 /* Struct to pass QoS info */
52 struct iidc_qos_params {
53 struct iidc_qos_info tc_info[IEEE_8021QAZ_MAX_TCS];
54 u8 up2tc[IIDC_MAX_USER_PRIORITY];
56 u8 vport_priority_type;
61 DECLARE_BITMAP(type, IIDC_EVENT_NBITS);
67 int ice_add_rdma_qset(struct ice_pf *pf, struct iidc_rdma_qset_params *qset);
68 int ice_del_rdma_qset(struct ice_pf *pf, struct iidc_rdma_qset_params *qset);
69 int ice_rdma_request_reset(struct ice_pf *pf, enum iidc_reset_type reset_type);
70 int ice_rdma_update_vsi_filter(struct ice_pf *pf, u16 vsi_id, bool enable);
71 void ice_get_qos_params(struct ice_pf *pf, struct iidc_qos_params *qos);
73 #define IIDC_RDMA_ROCE_NAME "roce"
75 /* Structure representing auxiliary driver tailored information about the core
76 * PCI dev, each auxiliary driver using the IIDC interface will have an
77 * instance of this struct dedicated to it.
80 struct iidc_auxiliary_dev {
81 struct auxiliary_device adev;
85 /* structure representing the auxiliary driver. This struct is to be
86 * allocated and populated by the auxiliary driver's owner. The core PCI
87 * driver will access these ops by performing a container_of on the
88 * auxiliary_device->dev.driver.
90 struct iidc_auxiliary_drv {
91 struct auxiliary_driver adrv;
92 /* This event_handler is meant to be a blocking call. For instance,
93 * when a BEFORE_MTU_CHANGE event comes in, the event_handler will not
94 * return until the auxiliary driver is ready for the MTU change to
97 void (*event_handler)(struct ice_pf *pf, struct iidc_event *event);