Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Copyright (C) 2021, Intel Corporation. */
0003 
0004 #ifndef _IIDC_H_
0005 #define _IIDC_H_
0006 
0007 #include <linux/auxiliary_bus.h>
0008 #include <linux/dcbnl.h>
0009 #include <linux/device.h>
0010 #include <linux/if_ether.h>
0011 #include <linux/kernel.h>
0012 #include <linux/netdevice.h>
0013 
0014 enum iidc_event_type {
0015     IIDC_EVENT_BEFORE_MTU_CHANGE,
0016     IIDC_EVENT_AFTER_MTU_CHANGE,
0017     IIDC_EVENT_BEFORE_TC_CHANGE,
0018     IIDC_EVENT_AFTER_TC_CHANGE,
0019     IIDC_EVENT_CRIT_ERR,
0020     IIDC_EVENT_NBITS        /* must be last */
0021 };
0022 
0023 enum iidc_reset_type {
0024     IIDC_PFR,
0025     IIDC_CORER,
0026     IIDC_GLOBR,
0027 };
0028 
0029 enum iidc_rdma_protocol {
0030     IIDC_RDMA_PROTOCOL_IWARP = BIT(0),
0031     IIDC_RDMA_PROTOCOL_ROCEV2 = BIT(1),
0032 };
0033 
0034 #define IIDC_MAX_USER_PRIORITY      8
0035 #define IIDC_MAX_DSCP_MAPPING       64
0036 #define IIDC_DSCP_PFC_MODE      0x1
0037 
0038 /* Struct to hold per RDMA Qset info */
0039 struct iidc_rdma_qset_params {
0040     /* Qset TEID returned to the RDMA driver in
0041      * ice_add_rdma_qset and used by RDMA driver
0042      * for calls to ice_del_rdma_qset
0043      */
0044     u32 teid;   /* Qset TEID */
0045     u16 qs_handle; /* RDMA driver provides this */
0046     u16 vport_id; /* VSI index */
0047     u8 tc; /* TC branch the Qset should belong to */
0048 };
0049 
0050 struct iidc_qos_info {
0051     u64 tc_ctx;
0052     u8 rel_bw;
0053     u8 prio_type;
0054     u8 egress_virt_up;
0055     u8 ingress_virt_up;
0056 };
0057 
0058 /* Struct to pass QoS info */
0059 struct iidc_qos_params {
0060     struct iidc_qos_info tc_info[IEEE_8021QAZ_MAX_TCS];
0061     u8 up2tc[IIDC_MAX_USER_PRIORITY];
0062     u8 vport_relative_bw;
0063     u8 vport_priority_type;
0064     u8 num_tc;
0065     u8 pfc_mode;
0066     u8 dscp_map[IIDC_MAX_DSCP_MAPPING];
0067 };
0068 
0069 struct iidc_event {
0070     DECLARE_BITMAP(type, IIDC_EVENT_NBITS);
0071     u32 reg;
0072 };
0073 
0074 struct ice_pf;
0075 
0076 int ice_add_rdma_qset(struct ice_pf *pf, struct iidc_rdma_qset_params *qset);
0077 int ice_del_rdma_qset(struct ice_pf *pf, struct iidc_rdma_qset_params *qset);
0078 int ice_rdma_request_reset(struct ice_pf *pf, enum iidc_reset_type reset_type);
0079 int ice_rdma_update_vsi_filter(struct ice_pf *pf, u16 vsi_id, bool enable);
0080 void ice_get_qos_params(struct ice_pf *pf, struct iidc_qos_params *qos);
0081 
0082 /* Structure representing auxiliary driver tailored information about the core
0083  * PCI dev, each auxiliary driver using the IIDC interface will have an
0084  * instance of this struct dedicated to it.
0085  */
0086 
0087 struct iidc_auxiliary_dev {
0088     struct auxiliary_device adev;
0089     struct ice_pf *pf;
0090 };
0091 
0092 /* structure representing the auxiliary driver. This struct is to be
0093  * allocated and populated by the auxiliary driver's owner. The core PCI
0094  * driver will access these ops by performing a container_of on the
0095  * auxiliary_device->dev.driver.
0096  */
0097 struct iidc_auxiliary_drv {
0098     struct auxiliary_driver adrv;
0099     /* This event_handler is meant to be a blocking call.  For instance,
0100      * when a BEFORE_MTU_CHANGE event comes in, the event_handler will not
0101      * return until the auxiliary driver is ready for the MTU change to
0102      * happen.
0103      */
0104     void (*event_handler)(struct ice_pf *pf, struct iidc_event *event);
0105 };
0106 
0107 #endif /* _IIDC_H_*/