Skip to content

Commit ed0e894

Browse files
mawilli1Jeff Kirsher
authored andcommitted
i40evf: add client interface
In preparation for upcoming RDMA-capable hardware, add a client interface to the VF driver. This is a slightly-simplified version of the PF client interface, with the names changed to protect the innocent. Due to the nature of the VF<->PF interactions, the client interface sometimes needs to call back into itself to pass messages. Because of this, we can't use the coarse-grained locking like the PF's client interface uses. Instead, we handle all client interactions in a separate thread so the watchdog can still run and process virtual channel messages. Signed-off-by: Mitch Williams <[email protected]> Signed-off-by: Jesse Brandeburg <[email protected]> Signed-off-by: Anjali Singhai Jain <[email protected]> Signed-off-by: Avinash Dayanand <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent d60be2c commit ed0e894

File tree

7 files changed

+879
-10
lines changed

7 files changed

+879
-10
lines changed

drivers/net/ethernet/intel/i40evf/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
obj-$(CONFIG_I40EVF) += i40evf.o
3333

3434
i40evf-objs := i40evf_main.o i40evf_ethtool.o i40evf_virtchnl.o \
35-
i40e_txrx.o i40e_common.o i40e_adminq.o
35+
i40e_txrx.o i40e_common.o i40e_adminq.o i40evf_client.o
3636

drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ enum i40e_virtchnl_ops {
8181
I40E_VIRTCHNL_OP_GET_STATS = 15,
8282
I40E_VIRTCHNL_OP_FCOE = 16,
8383
I40E_VIRTCHNL_OP_EVENT = 17, /* must ALWAYS be 17 */
84+
I40E_VIRTCHNL_OP_IWARP = 20,
8485
I40E_VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP = 21,
86+
I40E_VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP = 22,
8587
I40E_VIRTCHNL_OP_CONFIG_RSS_KEY = 23,
8688
I40E_VIRTCHNL_OP_CONFIG_RSS_LUT = 24,
8789
I40E_VIRTCHNL_OP_GET_RSS_HENA_CAPS = 25,
@@ -393,6 +395,37 @@ struct i40e_virtchnl_pf_event {
393395
int severity;
394396
};
395397

398+
/* I40E_VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP
399+
* VF uses this message to request PF to map IWARP vectors to IWARP queues.
400+
* The request for this originates from the VF IWARP driver through
401+
* a client interface between VF LAN and VF IWARP driver.
402+
* A vector could have an AEQ and CEQ attached to it although
403+
* there is a single AEQ per VF IWARP instance in which case
404+
* most vectors will have an INVALID_IDX for aeq and valid idx for ceq.
405+
* There will never be a case where there will be multiple CEQs attached
406+
* to a single vector.
407+
* PF configures interrupt mapping and returns status.
408+
*/
409+
410+
/* HW does not define a type value for AEQ; only for RX/TX and CEQ.
411+
* In order for us to keep the interface simple, SW will define a
412+
* unique type value for AEQ.
413+
*/
414+
#define I40E_QUEUE_TYPE_PE_AEQ 0x80
415+
#define I40E_QUEUE_INVALID_IDX 0xFFFF
416+
417+
struct i40e_virtchnl_iwarp_qv_info {
418+
u32 v_idx; /* msix_vector */
419+
u16 ceq_idx;
420+
u16 aeq_idx;
421+
u8 itr_idx;
422+
};
423+
424+
struct i40e_virtchnl_iwarp_qvlist_info {
425+
u32 num_vectors;
426+
struct i40e_virtchnl_iwarp_qv_info qv_info[1];
427+
};
428+
396429
/* VF reset states - these are written into the RSTAT register:
397430
* I40E_VFGEN_RSTAT1 on the PF
398431
* I40E_VFGEN_RSTAT on the VF

drivers/net/ethernet/intel/i40evf/i40evf.h

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ struct i40e_vsi {
6060
int base_vector;
6161
u16 work_limit;
6262
u16 qs_handle;
63+
void *priv; /* client driver data reference. */
6364
};
6465

6566
/* How many Rx Buffers do we bundle into one write to the hardware ? */
@@ -169,6 +170,7 @@ enum i40evf_state_t {
169170

170171
enum i40evf_critical_section_t {
171172
__I40EVF_IN_CRITICAL_TASK, /* cannot be interrupted */
173+
__I40EVF_IN_CLIENT_TASK,
172174
};
173175
/* make common code happy */
174176
#define __I40E_DOWN __I40EVF_DOWN
@@ -178,6 +180,7 @@ struct i40evf_adapter {
178180
struct timer_list watchdog_timer;
179181
struct work_struct reset_task;
180182
struct work_struct adminq_task;
183+
struct delayed_work client_task;
181184
struct delayed_work init_task;
182185
struct i40e_q_vector *q_vectors;
183186
struct list_head vlan_filter_list;
@@ -195,7 +198,10 @@ struct i40evf_adapter {
195198
u64 hw_csum_rx_error;
196199
u32 rx_desc_count;
197200
int num_msix_vectors;
201+
int num_iwarp_msix;
202+
int iwarp_base_vector;
198203
u32 client_pending;
204+
struct i40e_client_instance *cinst;
199205
struct msix_entry *msix_entries;
200206

201207
u32 flags;
@@ -211,8 +217,11 @@ struct i40evf_adapter {
211217
#define I40EVF_FLAG_OUTER_UDP_CSUM_CAPABLE BIT(12)
212218
#define I40EVF_FLAG_ADDR_SET_BY_PF BIT(13)
213219
#define I40EVF_FLAG_SERVICE_CLIENT_REQUESTED BIT(14)
214-
#define I40EVF_FLAG_PROMISC_ON BIT(15)
215-
#define I40EVF_FLAG_ALLMULTI_ON BIT(16)
220+
#define I40EVF_FLAG_CLIENT_NEEDS_OPEN BIT(15)
221+
#define I40EVF_FLAG_CLIENT_NEEDS_CLOSE BIT(16)
222+
#define I40EVF_FLAG_CLIENT_NEEDS_L2_PARAMS BIT(17)
223+
#define I40EVF_FLAG_PROMISC_ON BIT(18)
224+
#define I40EVF_FLAG_ALLMULTI_ON BIT(19)
216225
/* duplicates for common code */
217226
#define I40E_FLAG_FDIR_ATR_ENABLED 0
218227
#define I40E_FLAG_DCB_ENABLED 0
@@ -258,10 +267,11 @@ struct i40evf_adapter {
258267
bool link_up;
259268
enum i40e_aq_link_speed link_speed;
260269
enum i40e_virtchnl_ops current_op;
261-
#define CLIENT_ENABLED(_a) ((_a)->vf_res ? \
270+
#define CLIENT_ALLOWED(_a) ((_a)->vf_res ? \
262271
(_a)->vf_res->vf_offload_flags & \
263272
I40E_VIRTCHNL_VF_OFFLOAD_IWARP : \
264273
0)
274+
#define CLIENT_ENABLED(_a) ((_a)->cinst)
265275
/* RSS by the PF should be preferred over RSS via other methods. */
266276
#define RSS_PF(_a) ((_a)->vf_res->vf_offload_flags & \
267277
I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF)
@@ -292,6 +302,12 @@ struct i40evf_adapter {
292302

293303
/* Ethtool Private Flags */
294304

305+
/* lan device */
306+
struct i40e_device {
307+
struct list_head list;
308+
struct i40evf_adapter *vf;
309+
};
310+
295311
/* needed by i40evf_ethtool.c */
296312
extern char i40evf_driver_name[];
297313
extern const char i40evf_driver_version[];
@@ -337,4 +353,11 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
337353
enum i40e_virtchnl_ops v_opcode,
338354
i40e_status v_retval, u8 *msg, u16 msglen);
339355
int i40evf_config_rss(struct i40evf_adapter *adapter);
356+
int i40evf_lan_add_device(struct i40evf_adapter *adapter);
357+
int i40evf_lan_del_device(struct i40evf_adapter *adapter);
358+
void i40evf_client_subtask(struct i40evf_adapter *adapter);
359+
void i40evf_notify_client_message(struct i40e_vsi *vsi, u8 *msg, u16 len);
360+
void i40evf_notify_client_l2_params(struct i40e_vsi *vsi);
361+
void i40evf_notify_client_open(struct i40e_vsi *vsi);
362+
void i40evf_notify_client_close(struct i40e_vsi *vsi, bool reset);
340363
#endif /* _I40EVF_H_ */

0 commit comments

Comments
 (0)