0001
0002
0003
0004 #ifndef _IAVF_CLIENT_H_
0005 #define _IAVF_CLIENT_H_
0006
0007 #define IAVF_CLIENT_STR_LENGTH 10
0008
0009
0010
0011
0012 #define IAVF_CLIENT_VERSION_MAJOR 0
0013 #define IAVF_CLIENT_VERSION_MINOR 01
0014 #define IAVF_CLIENT_VERSION_BUILD 00
0015 #define IAVF_CLIENT_VERSION_STR \
0016 __stringify(IAVF_CLIENT_VERSION_MAJOR) "." \
0017 __stringify(IAVF_CLIENT_VERSION_MINOR) "." \
0018 __stringify(IAVF_CLIENT_VERSION_BUILD)
0019
0020 struct iavf_client_version {
0021 u8 major;
0022 u8 minor;
0023 u8 build;
0024 u8 rsvd;
0025 };
0026
0027 enum iavf_client_state {
0028 __IAVF_CLIENT_NULL,
0029 __IAVF_CLIENT_REGISTERED
0030 };
0031
0032 enum iavf_client_instance_state {
0033 __IAVF_CLIENT_INSTANCE_NONE,
0034 __IAVF_CLIENT_INSTANCE_OPENED,
0035 };
0036
0037 struct iavf_ops;
0038 struct iavf_client;
0039
0040
0041
0042
0043
0044 #define IAVF_QUEUE_TYPE_PE_AEQ 0x80
0045 #define IAVF_QUEUE_INVALID_IDX 0xFFFF
0046
0047 struct iavf_qv_info {
0048 u32 v_idx;
0049 u16 ceq_idx;
0050 u16 aeq_idx;
0051 u8 itr_idx;
0052 };
0053
0054 struct iavf_qvlist_info {
0055 u32 num_vectors;
0056 struct iavf_qv_info qv_info[1];
0057 };
0058
0059 #define IAVF_CLIENT_MSIX_ALL 0xFFFFFFFF
0060
0061
0062
0063
0064 struct iavf_prio_qos_params {
0065 u16 qs_handle;
0066 u8 tc;
0067 u8 reserved;
0068 };
0069
0070 #define IAVF_CLIENT_MAX_USER_PRIORITY 8
0071
0072 struct iavf_qos_params {
0073 struct iavf_prio_qos_params prio_qos[IAVF_CLIENT_MAX_USER_PRIORITY];
0074 };
0075
0076 struct iavf_params {
0077 struct iavf_qos_params qos;
0078 u16 mtu;
0079 u16 link_up;
0080 };
0081
0082
0083 struct iavf_info {
0084 struct iavf_client_version version;
0085 u8 lanmac[6];
0086 struct net_device *netdev;
0087 struct pci_dev *pcidev;
0088 u8 __iomem *hw_addr;
0089 u8 fid;
0090 #define IAVF_CLIENT_FTYPE_PF 0
0091 #define IAVF_CLIENT_FTYPE_VF 1
0092 u8 ftype;
0093 void *vf;
0094
0095
0096
0097
0098 struct iavf_params params;
0099 struct iavf_ops *ops;
0100
0101 u16 msix_count;
0102
0103 struct msix_entry *msix_entries;
0104 u16 itr_index;
0105 };
0106
0107 struct iavf_ops {
0108
0109 int (*setup_qvlist)(struct iavf_info *ldev, struct iavf_client *client,
0110 struct iavf_qvlist_info *qv_info);
0111
0112 u32 (*virtchnl_send)(struct iavf_info *ldev, struct iavf_client *client,
0113 u8 *msg, u16 len);
0114
0115
0116 void (*request_reset)(struct iavf_info *ldev,
0117 struct iavf_client *client);
0118 };
0119
0120 struct iavf_client_ops {
0121
0122
0123
0124 int (*open)(struct iavf_info *ldev, struct iavf_client *client);
0125
0126
0127
0128
0129
0130 void (*close)(struct iavf_info *ldev, struct iavf_client *client,
0131 bool reset);
0132
0133
0134 void (*l2_param_change)(struct iavf_info *ldev,
0135 struct iavf_client *client,
0136 struct iavf_params *params);
0137
0138
0139 int (*virtchnl_receive)(struct iavf_info *ldev,
0140 struct iavf_client *client,
0141 u8 *msg, u16 len);
0142 };
0143
0144
0145 struct iavf_client_instance {
0146 struct list_head list;
0147 struct iavf_info lan_info;
0148 struct iavf_client *client;
0149 unsigned long state;
0150 };
0151
0152 struct iavf_client {
0153 struct list_head list;
0154 char name[IAVF_CLIENT_STR_LENGTH];
0155 struct iavf_client_version version;
0156 unsigned long state;
0157 atomic_t ref_cnt;
0158 u32 flags;
0159 #define IAVF_CLIENT_FLAGS_LAUNCH_ON_PROBE BIT(0)
0160 #define IAVF_TX_FLAGS_NOTIFY_OTHER_EVENTS BIT(2)
0161 u8 type;
0162 #define IAVF_CLIENT_IWARP 0
0163 struct iavf_client_ops *ops;
0164 };
0165
0166
0167 int iavf_register_client(struct iavf_client *client);
0168 int iavf_unregister_client(struct iavf_client *client);
0169 #endif