File Index
Files and directories
Sign in
FILE

i40e_client.h

File preview with syntax highlighting.

linux-6.19.14/include/linux/net/intel/i40e_client.h C
  1/* SPDX-License-Identifier: GPL-2.0 */
  2/* Copyright(c) 2013 - 2018 Intel Corporation. */
  3
  4#ifndef _I40E_CLIENT_H_
  5#define _I40E_CLIENT_H_
  6
  7#include <linux/auxiliary_bus.h>
  8
  9#define I40E_CLIENT_STR_LENGTH 10
 10
 11/* Client interface version should be updated anytime there is a change in the
 12 * existing APIs or data structures.
 13 */
 14#define I40E_CLIENT_VERSION_MAJOR 0
 15#define I40E_CLIENT_VERSION_MINOR 01
 16#define I40E_CLIENT_VERSION_BUILD 00
 17#define I40E_CLIENT_VERSION_STR     \
 18	__stringify(I40E_CLIENT_VERSION_MAJOR) "." \
 19	__stringify(I40E_CLIENT_VERSION_MINOR) "." \
 20	__stringify(I40E_CLIENT_VERSION_BUILD)
 21
 22struct i40e_client_version {
 23	u8 major;
 24	u8 minor;
 25	u8 build;
 26	u8 rsvd;
 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#define I40E_QUEUE_INVALID_IDX	0xFFFF
 38
 39struct i40e_qv_info {
 40	u32 v_idx; /* msix_vector */
 41	u16 ceq_idx;
 42	u16 aeq_idx;
 43	u8 itr_idx;
 44};
 45
 46struct i40e_qvlist_info {
 47	u32 num_vectors;
 48	struct i40e_qv_info qv_info[] __counted_by(num_vectors);
 49};
 50
 51
 52/* set of LAN parameters useful for clients managed by LAN */
 53
 54/* Struct to hold per priority info */
 55struct i40e_prio_qos_params {
 56	u16 qs_handle; /* qs handle for prio */
 57	u8 tc; /* TC mapped to prio */
 58	u8 reserved;
 59};
 60
 61#define I40E_CLIENT_MAX_USER_PRIORITY        8
 62/* Struct to hold Client QoS */
 63struct i40e_qos_params {
 64	struct i40e_prio_qos_params prio_qos[I40E_CLIENT_MAX_USER_PRIORITY];
 65};
 66
 67struct i40e_params {
 68	struct i40e_qos_params qos;
 69	u16 mtu;
 70};
 71
 72/* Structure to hold Lan device info for a client device */
 73struct i40e_info {
 74	struct i40e_client_version version;
 75	u8 lanmac[6];
 76	struct net_device *netdev;
 77	struct pci_dev *pcidev;
 78	struct auxiliary_device *aux_dev;
 79	u8 __iomem *hw_addr;
 80	u8 fid;	/* function id, PF id or VF id */
 81#define I40E_CLIENT_FTYPE_PF 0
 82	u8 ftype; /* function type, PF or VF */
 83	void *pf;
 84
 85	/* All L2 params that could change during the life span of the PF
 86	 * and needs to be communicated to the client when they change
 87	 */
 88	struct i40e_qvlist_info *qvlist_info;
 89	struct i40e_params params;
 90	struct i40e_ops *ops;
 91
 92	u16 msix_count;	 /* number of msix vectors*/
 93	/* Array down below will be dynamically allocated based on msix_count */
 94	struct msix_entry *msix_entries;
 95	u16 itr_index; /* Which ITR index the PE driver is suppose to use */
 96	u16 fw_maj_ver;                 /* firmware major version */
 97	u16 fw_min_ver;                 /* firmware minor version */
 98	u32 fw_build;                   /* firmware build number */
 99};
100
101struct i40e_auxiliary_device {
102	struct auxiliary_device aux_dev;
103	struct i40e_info *ldev;
104};
105
106#define I40E_CLIENT_RESET_LEVEL_PF   1
107#define I40E_CLIENT_RESET_LEVEL_CORE 2
108#define I40E_CLIENT_VSI_FLAG_TCP_ENABLE  BIT(1)
109
110struct i40e_ops {
111	/* setup_q_vector_list enables queues with a particular vector */
112	int (*setup_qvlist)(struct i40e_info *ldev, struct i40e_client *client,
113			    struct i40e_qvlist_info *qv_info);
114
115	int (*virtchnl_send)(struct i40e_info *ldev, struct i40e_client *client,
116			     u32 vf_id, u8 *msg, u16 len);
117
118	/* If the PE Engine is unresponsive, RDMA driver can request a reset.
119	 * The level helps determine the level of reset being requested.
120	 */
121	void (*request_reset)(struct i40e_info *ldev,
122			      struct i40e_client *client, u32 level);
123
124	/* API for the RDMA driver to set certain VSI flags that control
125	 * PE Engine.
126	 */
127	int (*update_vsi_ctxt)(struct i40e_info *ldev,
128			       struct i40e_client *client,
129			       bool is_vf, u32 vf_id,
130			       u32 flag, u32 valid_flag);
131};
132
133struct i40e_client_ops {
134	/* Should be called from register_client() or whenever PF is ready
135	 * to create a specific client instance.
136	 */
137	int (*open)(struct i40e_info *ldev, struct i40e_client *client);
138
139	/* Should be called when netdev is unavailable or when unregister
140	 * call comes in. If the close is happenening due to a reset being
141	 * triggered set the reset bit to true.
142	 */
143	void (*close)(struct i40e_info *ldev, struct i40e_client *client,
144		      bool reset);
145
146	/* called when some l2 managed parameters changes - mtu */
147	void (*l2_param_change)(struct i40e_info *ldev,
148				struct i40e_client *client,
149				struct i40e_params *params);
150
151	int (*virtchnl_receive)(struct i40e_info *ldev,
152				struct i40e_client *client, u32 vf_id,
153				u8 *msg, u16 len);
154
155	/* called when a VF is reset by the PF */
156	void (*vf_reset)(struct i40e_info *ldev,
157			 struct i40e_client *client, u32 vf_id);
158
159	/* called when the number of VFs changes */
160	void (*vf_enable)(struct i40e_info *ldev,
161			  struct i40e_client *client, u32 num_vfs);
162
163	/* returns true if VF is capable of specified offload */
164	int (*vf_capable)(struct i40e_info *ldev,
165			  struct i40e_client *client, u32 vf_id);
166};
167
168/* Client device */
169struct i40e_client_instance {
170	struct list_head list;
171	struct i40e_info lan_info;
172	struct i40e_client *client;
173	unsigned long  state;
174};
175
176struct i40e_client {
177	struct list_head list;		/* list of registered clients */
178	char name[I40E_CLIENT_STR_LENGTH];
179	struct i40e_client_version version;
180	unsigned long state;		/* client state */
181	atomic_t ref_cnt;  /* Count of all the client devices of this kind */
182	u32 flags;
183	u8 type;
184#define I40E_CLIENT_IWARP 0
185	const struct i40e_client_ops *ops; /* client ops provided by the client */
186};
187
188void i40e_client_device_register(struct i40e_info *ldev, struct i40e_client *client);
189void i40e_client_device_unregister(struct i40e_info *ldev);
190
191#endif /* _I40E_CLIENT_H_ */
~/ Read-only file preview.