1#ifndef _I40E_CLIENT_H_
2#define _I40E_CLIENT_H_
3
4#define I40EVF_CLIENT_STR_LENGTH 10
5
6
7
8
9#define I40EVF_CLIENT_VERSION_MAJOR 0
10#define I40EVF_CLIENT_VERSION_MINOR 01
11#define I40EVF_CLIENT_VERSION_BUILD 00
12#define I40EVF_CLIENT_VERSION_STR \
13 __stringify(I40EVF_CLIENT_VERSION_MAJOR) "." \
14 __stringify(I40EVF_CLIENT_VERSION_MINOR) "." \
15 __stringify(I40EVF_CLIENT_VERSION_BUILD)
16
17struct i40e_client_version {
18 u8 major;
19 u8 minor;
20 u8 build;
21 u8 rsvd;
22};
23
24enum i40e_client_state {
25 __I40E_CLIENT_NULL,
26 __I40E_CLIENT_REGISTERED
27};
28
29enum i40e_client_instance_state {
30 __I40E_CLIENT_INSTANCE_NONE,
31 __I40E_CLIENT_INSTANCE_OPENED,
32};
33
34struct i40e_ops;
35struct i40e_client;
36
37
38
39
40
41#define I40E_QUEUE_TYPE_PE_AEQ 0x80
42#define I40E_QUEUE_INVALID_IDX 0xFFFF
43
44struct i40e_qv_info {
45 u32 v_idx;
46 u16 ceq_idx;
47 u16 aeq_idx;
48 u8 itr_idx;
49};
50
51struct i40e_qvlist_info {
52 u32 num_vectors;
53 struct i40e_qv_info qv_info[1];
54};
55
56#define I40E_CLIENT_MSIX_ALL 0xFFFFFFFF
57
58
59
60
61struct i40e_prio_qos_params {
62 u16 qs_handle;
63 u8 tc;
64 u8 reserved;
65};
66
67#define I40E_CLIENT_MAX_USER_PRIORITY 8
68
69struct i40e_qos_params {
70 struct i40e_prio_qos_params prio_qos[I40E_CLIENT_MAX_USER_PRIORITY];
71};
72
73struct i40e_params {
74 struct i40e_qos_params qos;
75 u16 mtu;
76 u16 link_up;
77};
78
79
80struct i40e_info {
81 struct i40e_client_version version;
82 u8 lanmac[6];
83 struct net_device *netdev;
84 struct pci_dev *pcidev;
85 u8 __iomem *hw_addr;
86 u8 fid;
87#define I40E_CLIENT_FTYPE_PF 0
88#define I40E_CLIENT_FTYPE_VF 1
89 u8 ftype;
90 void *vf;
91
92
93
94
95 struct i40e_params params;
96 struct i40e_ops *ops;
97
98 u16 msix_count;
99
100 struct msix_entry *msix_entries;
101 u16 itr_index;
102};
103
104struct i40e_ops {
105
106 int (*setup_qvlist)(struct i40e_info *ldev, struct i40e_client *client,
107 struct i40e_qvlist_info *qv_info);
108
109 u32 (*virtchnl_send)(struct i40e_info *ldev, struct i40e_client *client,
110 u8 *msg, u16 len);
111
112
113 void (*request_reset)(struct i40e_info *ldev,
114 struct i40e_client *client);
115};
116
117struct i40e_client_ops {
118
119
120
121 int (*open)(struct i40e_info *ldev, struct i40e_client *client);
122
123
124
125
126
127 void (*close)(struct i40e_info *ldev, struct i40e_client *client,
128 bool reset);
129
130
131 void (*l2_param_change)(struct i40e_info *ldev,
132 struct i40e_client *client,
133 struct i40e_params *params);
134
135
136 int (*virtchnl_receive)(struct i40e_info *ldev,
137 struct i40e_client *client,
138 u8 *msg, u16 len);
139};
140
141
142struct i40e_client_instance {
143 struct list_head list;
144 struct i40e_info lan_info;
145 struct i40e_client *client;
146 unsigned long state;
147};
148
149struct i40e_client {
150 struct list_head list;
151 char name[I40EVF_CLIENT_STR_LENGTH];
152 struct i40e_client_version version;
153 unsigned long state;
154 atomic_t ref_cnt;
155 u32 flags;
156#define I40E_CLIENT_FLAGS_LAUNCH_ON_PROBE BIT(0)
157#define I40E_TX_FLAGS_NOTIFY_OTHER_EVENTS BIT(2)
158 u8 type;
159#define I40E_CLIENT_IWARP 0
160 struct i40e_client_ops *ops;
161};
162
163
164int i40evf_register_client(struct i40e_client *client);
165int i40evf_unregister_client(struct i40e_client *client);
166#endif
167