1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright(c) 2013 - 2018 Intel Corporation. */
4 #ifndef _IAVF_CLIENT_H_
5 #define _IAVF_CLIENT_H_
7 #define IAVF_CLIENT_STR_LENGTH 10
9 /* Client interface version should be updated anytime there is a change in the
10 * existing APIs or data structures.
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)
20 struct iavf_client_version
{
27 enum iavf_client_state
{
29 __IAVF_CLIENT_REGISTERED
32 enum iavf_client_instance_state
{
33 __IAVF_CLIENT_INSTANCE_NONE
,
34 __IAVF_CLIENT_INSTANCE_OPENED
,
40 /* HW does not define a type value for AEQ; only for RX/TX and CEQ.
41 * In order for us to keep the interface simple, SW will define a
42 * unique type value for AEQ.
44 #define IAVF_QUEUE_TYPE_PE_AEQ 0x80
45 #define IAVF_QUEUE_INVALID_IDX 0xFFFF
48 u32 v_idx
; /* msix_vector */
54 struct iavf_qvlist_info
{
56 struct iavf_qv_info qv_info
[1];
59 #define IAVF_CLIENT_MSIX_ALL 0xFFFFFFFF
61 /* set of LAN parameters useful for clients managed by LAN */
63 /* Struct to hold per priority info */
64 struct iavf_prio_qos_params
{
65 u16 qs_handle
; /* qs handle for prio */
66 u8 tc
; /* TC mapped to prio */
70 #define IAVF_CLIENT_MAX_USER_PRIORITY 8
71 /* Struct to hold Client QoS */
72 struct iavf_qos_params
{
73 struct iavf_prio_qos_params prio_qos
[IAVF_CLIENT_MAX_USER_PRIORITY
];
77 struct iavf_qos_params qos
;
79 u16 link_up
; /* boolean */
82 /* Structure to hold LAN device info for a client device */
84 struct iavf_client_version version
;
86 struct net_device
*netdev
;
87 struct pci_dev
*pcidev
;
89 u8 fid
; /* function id, PF id or VF id */
90 #define IAVF_CLIENT_FTYPE_PF 0
91 #define IAVF_CLIENT_FTYPE_VF 1
92 u8 ftype
; /* function type, PF or VF */
93 void *vf
; /* cast to iavf_adapter */
95 /* All L2 params that could change during the life span of the device
96 * and needs to be communicated to the client when they change
98 struct iavf_params params
;
101 u16 msix_count
; /* number of msix vectors*/
102 /* Array down below will be dynamically allocated based on msix_count */
103 struct msix_entry
*msix_entries
;
104 u16 itr_index
; /* Which ITR index the PE driver is suppose to use */
108 /* setup_q_vector_list enables queues with a particular vector */
109 int (*setup_qvlist
)(struct iavf_info
*ldev
, struct iavf_client
*client
,
110 struct iavf_qvlist_info
*qv_info
);
112 u32 (*virtchnl_send
)(struct iavf_info
*ldev
, struct iavf_client
*client
,
115 /* If the PE Engine is unresponsive, RDMA driver can request a reset.*/
116 void (*request_reset
)(struct iavf_info
*ldev
,
117 struct iavf_client
*client
);
120 struct iavf_client_ops
{
121 /* Should be called from register_client() or whenever the driver is
122 * ready to create a specific client instance.
124 int (*open
)(struct iavf_info
*ldev
, struct iavf_client
*client
);
126 /* Should be closed when netdev is unavailable or when unregister
127 * call comes in. If the close happens due to a reset, set the reset
130 void (*close
)(struct iavf_info
*ldev
, struct iavf_client
*client
,
133 /* called when some l2 managed parameters changes - mss */
134 void (*l2_param_change
)(struct iavf_info
*ldev
,
135 struct iavf_client
*client
,
136 struct iavf_params
*params
);
138 /* called when a message is received from the PF */
139 int (*virtchnl_receive
)(struct iavf_info
*ldev
,
140 struct iavf_client
*client
,
145 struct iavf_client_instance
{
146 struct list_head list
;
147 struct iavf_info lan_info
;
148 struct iavf_client
*client
;
153 struct list_head list
; /* list of registered clients */
154 char name
[IAVF_CLIENT_STR_LENGTH
];
155 struct iavf_client_version version
;
156 unsigned long state
; /* client state */
157 atomic_t ref_cnt
; /* Count of all the client devices of this kind */
159 #define IAVF_CLIENT_FLAGS_LAUNCH_ON_PROBE BIT(0)
160 #define IAVF_TX_FLAGS_NOTIFY_OTHER_EVENTS BIT(2)
162 #define IAVF_CLIENT_IWARP 0
163 struct iavf_client_ops
*ops
; /* client ops provided by the client */
166 /* used by clients */
167 int iavf_register_client(struct iavf_client
*client
);
168 int iavf_unregister_client(struct iavf_client
*client
);
169 #endif /* _IAVF_CLIENT_H_ */