@@ -147,13 +147,17 @@ enum idpf_vport_state {
147
147
* @vport_id: Vport identifier
148
148
* @vport_idx: Relative vport index
149
149
* @state: See enum idpf_vport_state
150
+ * @netstats: Packet and byte stats
151
+ * @stats_lock: Lock to protect stats update
150
152
*/
151
153
struct idpf_netdev_priv {
152
154
struct idpf_adapter * adapter ;
153
155
struct idpf_vport * vport ;
154
156
u32 vport_id ;
155
157
u16 vport_idx ;
156
158
enum idpf_vport_state state ;
159
+ struct rtnl_link_stats64 netstats ;
160
+ spinlock_t stats_lock ;
157
161
};
158
162
159
163
/**
@@ -239,6 +243,8 @@ struct idpf_dev_ops {
239
243
STATE(IDPF_VC_ALLOC_VECTORS_ERR) \
240
244
STATE(IDPF_VC_DEALLOC_VECTORS) \
241
245
STATE(IDPF_VC_DEALLOC_VECTORS_ERR) \
246
+ STATE(IDPF_VC_SET_SRIOV_VFS) \
247
+ STATE(IDPF_VC_SET_SRIOV_VFS_ERR) \
242
248
STATE(IDPF_VC_GET_RSS_LUT) \
243
249
STATE(IDPF_VC_GET_RSS_LUT_ERR) \
244
250
STATE(IDPF_VC_SET_RSS_LUT) \
@@ -247,12 +253,16 @@ struct idpf_dev_ops {
247
253
STATE(IDPF_VC_GET_RSS_KEY_ERR) \
248
254
STATE(IDPF_VC_SET_RSS_KEY) \
249
255
STATE(IDPF_VC_SET_RSS_KEY_ERR) \
256
+ STATE(IDPF_VC_GET_STATS) \
257
+ STATE(IDPF_VC_GET_STATS_ERR) \
250
258
STATE(IDPF_VC_ADD_MAC_ADDR) \
251
259
STATE(IDPF_VC_ADD_MAC_ADDR_ERR) \
252
260
STATE(IDPF_VC_DEL_MAC_ADDR) \
253
261
STATE(IDPF_VC_DEL_MAC_ADDR_ERR) \
254
262
STATE(IDPF_VC_GET_PTYPE_INFO) \
255
263
STATE(IDPF_VC_GET_PTYPE_INFO_ERR) \
264
+ STATE(IDPF_VC_LOOPBACK_STATE) \
265
+ STATE(IDPF_VC_LOOPBACK_STATE_ERR) \
256
266
STATE(IDPF_VC_NBITS)
257
267
258
268
#define IDPF_GEN_ENUM (ENUM ) ENUM,
@@ -268,10 +278,14 @@ extern const char * const idpf_vport_vc_state_str[];
268
278
* enum idpf_vport_reset_cause - Vport soft reset causes
269
279
* @IDPF_SR_Q_CHANGE: Soft reset queue change
270
280
* @IDPF_SR_Q_DESC_CHANGE: Soft reset descriptor change
281
+ * @IDPF_SR_MTU_CHANGE: Soft reset MTU change
282
+ * @IDPF_SR_RSC_CHANGE: Soft reset RSC change
271
283
*/
272
284
enum idpf_vport_reset_cause {
273
285
IDPF_SR_Q_CHANGE ,
274
286
IDPF_SR_Q_DESC_CHANGE ,
287
+ IDPF_SR_MTU_CHANGE ,
288
+ IDPF_SR_RSC_CHANGE ,
275
289
};
276
290
277
291
/**
@@ -402,6 +416,19 @@ struct idpf_vport {
402
416
struct mutex vc_buf_lock ;
403
417
};
404
418
419
+ /**
420
+ * enum idpf_user_flags
421
+ * @__IDPF_PROMISC_UC: Unicast promiscuous mode
422
+ * @__IDPF_PROMISC_MC: Multicast promiscuous mode
423
+ * @__IDPF_USER_FLAGS_NBITS: Must be last
424
+ */
425
+ enum idpf_user_flags {
426
+ __IDPF_PROMISC_UC = 32 ,
427
+ __IDPF_PROMISC_MC ,
428
+
429
+ __IDPF_USER_FLAGS_NBITS ,
430
+ };
431
+
405
432
/**
406
433
* struct idpf_rss_data - Associated RSS data
407
434
* @rss_key_size: Size of RSS hash key
@@ -428,6 +455,7 @@ struct idpf_rss_data {
428
455
* ethtool
429
456
* @num_req_rxq_desc: Number of user requested RX queue descriptors through
430
457
* ethtool
458
+ * @user_flags: User toggled config flags
431
459
* @mac_filter_list: List of MAC filters
432
460
*
433
461
* Used to restore configuration after a reset as the vport will get wiped.
@@ -438,6 +466,7 @@ struct idpf_vport_user_config_data {
438
466
u16 num_req_rx_qs ;
439
467
u32 num_req_txq_desc ;
440
468
u32 num_req_rxq_desc ;
469
+ DECLARE_BITMAP (user_flags , __IDPF_USER_FLAGS_NBITS );
441
470
struct list_head mac_filter_list ;
442
471
};
443
472
@@ -548,6 +577,7 @@ struct idpf_vport_config {
548
577
* @mb_vector: Mailbox vector data
549
578
* @vector_stack: Stack to store the msix vector indexes
550
579
* @irq_mb_handler: Handler for hard interrupt for mailbox
580
+ * @tx_timeout_count: Number of TX timeouts that have occurred
551
581
* @avail_queues: Device given queue limits
552
582
* @vports: Array to store vports created by the driver
553
583
* @netdevs: Associated Vport netdevs
@@ -566,6 +596,8 @@ struct idpf_vport_config {
566
596
* @mbx_wq: Workqueue for mailbox responses
567
597
* @vc_event_task: Task to handle out of band virtchnl event notifications
568
598
* @vc_event_wq: Workqueue for virtchnl events
599
+ * @stats_task: Periodic statistics retrieval task
600
+ * @stats_wq: Workqueue for statistics task
569
601
* @caps: Negotiated capabilities with device
570
602
* @vchnl_wq: Wait queue for virtchnl messages
571
603
* @vc_state: Virtchnl message state
@@ -601,6 +633,7 @@ struct idpf_adapter {
601
633
struct idpf_vector_lifo vector_stack ;
602
634
irqreturn_t (* irq_mb_handler )(int irq , void * data );
603
635
636
+ u32 tx_timeout_count ;
604
637
struct idpf_avail_queue_info avail_queues ;
605
638
struct idpf_vport * * vports ;
606
639
struct net_device * * netdevs ;
@@ -621,6 +654,8 @@ struct idpf_adapter {
621
654
struct workqueue_struct * mbx_wq ;
622
655
struct delayed_work vc_event_task ;
623
656
struct workqueue_struct * vc_event_wq ;
657
+ struct delayed_work stats_task ;
658
+ struct workqueue_struct * stats_wq ;
624
659
struct virtchnl2_get_capabilities caps ;
625
660
626
661
wait_queue_head_t vchnl_wq ;
@@ -825,6 +860,15 @@ static inline bool idpf_is_feature_ena(const struct idpf_vport *vport,
825
860
return vport -> netdev -> features & feature ;
826
861
}
827
862
863
+ /**
864
+ * idpf_get_max_tx_hdr_size -- get the size of tx header
865
+ * @adapter: Driver specific private structure
866
+ */
867
+ static inline u16 idpf_get_max_tx_hdr_size (struct idpf_adapter * adapter )
868
+ {
869
+ return le16_to_cpu (adapter -> caps .max_tx_hdr_size );
870
+ }
871
+
828
872
/**
829
873
* idpf_vport_ctrl_lock - Acquire the vport control lock
830
874
* @netdev: Network interface device structure
@@ -850,6 +894,7 @@ static inline void idpf_vport_ctrl_unlock(struct net_device *netdev)
850
894
mutex_unlock (& np -> adapter -> vport_ctrl_lock );
851
895
}
852
896
897
+ void idpf_statistics_task (struct work_struct * work );
853
898
void idpf_init_task (struct work_struct * work );
854
899
void idpf_service_task (struct work_struct * work );
855
900
void idpf_mbx_task (struct work_struct * work );
@@ -865,6 +910,7 @@ int idpf_intr_req(struct idpf_adapter *adapter);
865
910
void idpf_intr_rel (struct idpf_adapter * adapter );
866
911
int idpf_get_reg_intr_vecs (struct idpf_vport * vport ,
867
912
struct idpf_vec_regs * reg_vals );
913
+ u16 idpf_get_max_tx_hdr_size (struct idpf_adapter * adapter );
868
914
int idpf_send_delete_queues_msg (struct idpf_vport * vport );
869
915
int idpf_send_add_queues_msg (const struct idpf_vport * vport , u16 num_tx_q ,
870
916
u16 num_complq , u16 num_rx_q , u16 num_rx_bufq );
@@ -874,6 +920,7 @@ int idpf_send_enable_vport_msg(struct idpf_vport *vport);
874
920
int idpf_send_disable_vport_msg (struct idpf_vport * vport );
875
921
int idpf_send_destroy_vport_msg (struct idpf_vport * vport );
876
922
int idpf_send_get_rx_ptype_msg (struct idpf_vport * vport );
923
+ int idpf_send_ena_dis_loopback_msg (struct idpf_vport * vport );
877
924
int idpf_send_get_set_rss_key_msg (struct idpf_vport * vport , bool get );
878
925
int idpf_send_get_set_rss_lut_msg (struct idpf_vport * vport , bool get );
879
926
int idpf_send_dealloc_vectors_msg (struct idpf_adapter * adapter );
@@ -883,6 +930,7 @@ int idpf_req_rel_vector_indexes(struct idpf_adapter *adapter,
883
930
u16 * q_vector_idxs ,
884
931
struct idpf_vector_info * vec_info );
885
932
int idpf_vport_alloc_vec_indexes (struct idpf_vport * vport );
933
+ int idpf_send_get_stats_msg (struct idpf_vport * vport );
886
934
int idpf_get_vec_ids (struct idpf_adapter * adapter ,
887
935
u16 * vecids , int num_vecids ,
888
936
struct virtchnl2_vector_chunks * chunks );
@@ -898,6 +946,9 @@ void idpf_vport_dealloc_max_qs(struct idpf_adapter *adapter,
898
946
int idpf_add_del_mac_filters (struct idpf_vport * vport ,
899
947
struct idpf_netdev_priv * np ,
900
948
bool add , bool async );
949
+ int idpf_set_promiscuous (struct idpf_adapter * adapter ,
950
+ struct idpf_vport_user_config_data * config_data ,
951
+ u32 vport_id );
901
952
int idpf_send_disable_queues_msg (struct idpf_vport * vport );
902
953
void idpf_vport_init (struct idpf_vport * vport , struct idpf_vport_max_q * max_q );
903
954
u32 idpf_get_vport_id (struct idpf_vport * vport );
0 commit comments