1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _I40E_CLIENT_H_
3 #define _I40E_CLIENT_H_
5 #define I40EVF_CLIENT_STR_LENGTH 10
7 /* Client interface version should be updated anytime there is a change in the
8 * existing APIs or data structures.
10 #define I40EVF_CLIENT_VERSION_MAJOR 0
11 #define I40EVF_CLIENT_VERSION_MINOR 01
12 #define I40EVF_CLIENT_VERSION_BUILD 00
13 #define I40EVF_CLIENT_VERSION_STR \
14 __stringify(I40EVF_CLIENT_VERSION_MAJOR) "." \
15 __stringify(I40EVF_CLIENT_VERSION_MINOR) "." \
16 __stringify(I40EVF_CLIENT_VERSION_BUILD)
18 struct i40e_client_version {
25 enum i40e_client_state {
27 __I40E_CLIENT_REGISTERED
30 enum i40e_client_instance_state {
31 __I40E_CLIENT_INSTANCE_NONE,
32 __I40E_CLIENT_INSTANCE_OPENED,
38 /* HW does not define a type value for AEQ; only for RX/TX and CEQ.
39 * In order for us to keep the interface simple, SW will define a
40 * unique type value for AEQ.
42 #define I40E_QUEUE_TYPE_PE_AEQ 0x80
43 #define I40E_QUEUE_INVALID_IDX 0xFFFF
46 u32 v_idx; /* msix_vector */
52 struct i40e_qvlist_info {
54 struct i40e_qv_info qv_info[1];
57 #define I40E_CLIENT_MSIX_ALL 0xFFFFFFFF
59 /* set of LAN parameters useful for clients managed by LAN */
61 /* Struct to hold per priority info */
62 struct i40e_prio_qos_params {
63 u16 qs_handle; /* qs handle for prio */
64 u8 tc; /* TC mapped to prio */
68 #define I40E_CLIENT_MAX_USER_PRIORITY 8
69 /* Struct to hold Client QoS */
70 struct i40e_qos_params {
71 struct i40e_prio_qos_params prio_qos[I40E_CLIENT_MAX_USER_PRIORITY];
75 struct i40e_qos_params qos;
77 u16 link_up; /* boolean */
80 /* Structure to hold LAN device info for a client device */
82 struct i40e_client_version version;
84 struct net_device *netdev;
85 struct pci_dev *pcidev;
87 u8 fid; /* function id, PF id or VF id */
88 #define I40E_CLIENT_FTYPE_PF 0
89 #define I40E_CLIENT_FTYPE_VF 1
90 u8 ftype; /* function type, PF or VF */
91 void *vf; /* cast to i40evf_adapter */
93 /* All L2 params that could change during the life span of the device
94 * and needs to be communicated to the client when they change
96 struct i40e_params params;
99 u16 msix_count; /* number of msix vectors*/
100 /* Array down below will be dynamically allocated based on msix_count */
101 struct msix_entry *msix_entries;
102 u16 itr_index; /* Which ITR index the PE driver is suppose to use */
106 /* setup_q_vector_list enables queues with a particular vector */
107 int (*setup_qvlist)(struct i40e_info *ldev, struct i40e_client *client,
108 struct i40e_qvlist_info *qv_info);
110 u32 (*virtchnl_send)(struct i40e_info *ldev, struct i40e_client *client,
113 /* If the PE Engine is unresponsive, RDMA driver can request a reset.*/
114 void (*request_reset)(struct i40e_info *ldev,
115 struct i40e_client *client);
118 struct i40e_client_ops {
119 /* Should be called from register_client() or whenever the driver is
120 * ready to create a specific client instance.
122 int (*open)(struct i40e_info *ldev, struct i40e_client *client);
124 /* Should be closed when netdev is unavailable or when unregister
125 * call comes in. If the close happens due to a reset, set the reset
128 void (*close)(struct i40e_info *ldev, struct i40e_client *client,
131 /* called when some l2 managed parameters changes - mss */
132 void (*l2_param_change)(struct i40e_info *ldev,
133 struct i40e_client *client,
134 struct i40e_params *params);
136 /* called when a message is received from the PF */
137 int (*virtchnl_receive)(struct i40e_info *ldev,
138 struct i40e_client *client,
143 struct i40e_client_instance {
144 struct list_head list;
145 struct i40e_info lan_info;
146 struct i40e_client *client;
151 struct list_head list; /* list of registered clients */
152 char name[I40EVF_CLIENT_STR_LENGTH];
153 struct i40e_client_version version;
154 unsigned long state; /* client state */
155 atomic_t ref_cnt; /* Count of all the client devices of this kind */
157 #define I40E_CLIENT_FLAGS_LAUNCH_ON_PROBE BIT(0)
158 #define I40E_TX_FLAGS_NOTIFY_OTHER_EVENTS BIT(2)
160 #define I40E_CLIENT_IWARP 0
161 struct i40e_client_ops *ops; /* client ops provided by the client */
164 /* used by clients */
165 int i40evf_register_client(struct i40e_client *client);
166 int i40evf_unregister_client(struct i40e_client *client);
167 #endif /* _I40E_CLIENT_H_ */