1
2
3
4#ifndef _IAVF_CLIENT_H_
5#define _IAVF_CLIENT_H_
6
7#define IAVF_CLIENT_STR_LENGTH 10
8
9
10
11
12#define IAVF_CLIENT_VERSION_MAJOR 0
13#define IAVF_CLIENT_VERSION_MINOR 01
14#define IAVF_CLIENT_VERSION_BUILD 00
15#define IAVF_CLIENT_VERSION_STR \
16 __stringify(IAVF_CLIENT_VERSION_MAJOR) "." \
17 __stringify(IAVF_CLIENT_VERSION_MINOR) "." \
18 __stringify(IAVF_CLIENT_VERSION_BUILD)
19
20struct iavf_client_version {
21 u8 major;
22 u8 minor;
23 u8 build;
24 u8 rsvd;
25};
26
27enum iavf_client_state {
28 __IAVF_CLIENT_NULL,
29 __IAVF_CLIENT_REGISTERED
30};
31
32enum iavf_client_instance_state {
33 __IAVF_CLIENT_INSTANCE_NONE,
34 __IAVF_CLIENT_INSTANCE_OPENED,
35};
36
37struct iavf_ops;
38struct iavf_client;
39
40
41
42
43
44#define IAVF_QUEUE_TYPE_PE_AEQ 0x80
45#define IAVF_QUEUE_INVALID_IDX 0xFFFF
46
47struct iavf_qv_info {
48 u32 v_idx;
49 u16 ceq_idx;
50 u16 aeq_idx;
51 u8 itr_idx;
52};
53
54struct iavf_qvlist_info {
55 u32 num_vectors;
56 struct iavf_qv_info qv_info[1];
57};
58
59#define IAVF_CLIENT_MSIX_ALL 0xFFFFFFFF
60
61
62
63
64struct iavf_prio_qos_params {
65 u16 qs_handle;
66 u8 tc;
67 u8 reserved;
68};
69
70#define IAVF_CLIENT_MAX_USER_PRIORITY 8
71
72struct iavf_qos_params {
73 struct iavf_prio_qos_params prio_qos[IAVF_CLIENT_MAX_USER_PRIORITY];
74};
75
76struct iavf_params {
77 struct iavf_qos_params qos;
78 u16 mtu;
79 u16 link_up;
80};
81
82
83struct iavf_info {
84 struct iavf_client_version version;
85 u8 lanmac[6];
86 struct net_device *netdev;
87 struct pci_dev *pcidev;
88 u8 __iomem *hw_addr;
89 u8 fid;
90#define IAVF_CLIENT_FTYPE_PF 0
91#define IAVF_CLIENT_FTYPE_VF 1
92 u8 ftype;
93 void *vf;
94
95
96
97
98 struct iavf_params params;
99 struct iavf_ops *ops;
100
101 u16 msix_count;
102
103 struct msix_entry *msix_entries;
104 u16 itr_index;
105};
106
107struct iavf_ops {
108
109 int (*setup_qvlist)(struct iavf_info *ldev, struct iavf_client *client,
110 struct iavf_qvlist_info *qv_info);
111
112 u32 (*virtchnl_send)(struct iavf_info *ldev, struct iavf_client *client,
113 u8 *msg, u16 len);
114
115
116 void (*request_reset)(struct iavf_info *ldev,
117 struct iavf_client *client);
118};
119
120struct iavf_client_ops {
121
122
123
124 int (*open)(struct iavf_info *ldev, struct iavf_client *client);
125
126
127
128
129
130 void (*close)(struct iavf_info *ldev, struct iavf_client *client,
131 bool reset);
132
133
134 void (*l2_param_change)(struct iavf_info *ldev,
135 struct iavf_client *client,
136 struct iavf_params *params);
137
138
139 int (*virtchnl_receive)(struct iavf_info *ldev,
140 struct iavf_client *client,
141 u8 *msg, u16 len);
142};
143
144
145struct iavf_client_instance {
146 struct list_head list;
147 struct iavf_info lan_info;
148 struct iavf_client *client;
149 unsigned long state;
150};
151
152struct iavf_client {
153 struct list_head list;
154 char name[IAVF_CLIENT_STR_LENGTH];
155 struct iavf_client_version version;
156 unsigned long state;
157 atomic_t ref_cnt;
158 u32 flags;
159#define IAVF_CLIENT_FLAGS_LAUNCH_ON_PROBE BIT(0)
160#define IAVF_TX_FLAGS_NOTIFY_OTHER_EVENTS BIT(2)
161 u8 type;
162#define IAVF_CLIENT_IWARP 0
163 struct iavf_client_ops *ops;
164};
165
166
167int iavf_register_client(struct iavf_client *client);
168int iavf_unregister_client(struct iavf_client *client);
169#endif
170