@@ -147,13 +147,17 @@ enum idpf_vport_state {
147147 * @vport_id: Vport identifier
148148 * @vport_idx: Relative vport index
149149 * @state: See enum idpf_vport_state
150+ * @netstats: Packet and byte stats
151+ * @stats_lock: Lock to protect stats update
150152 */
151153struct idpf_netdev_priv {
152154 struct idpf_adapter * adapter ;
153155 struct idpf_vport * vport ;
154156 u32 vport_id ;
155157 u16 vport_idx ;
156158 enum idpf_vport_state state ;
159+ struct rtnl_link_stats64 netstats ;
160+ spinlock_t stats_lock ;
157161};
158162
159163/**
@@ -239,6 +243,8 @@ struct idpf_dev_ops {
239243 STATE(IDPF_VC_ALLOC_VECTORS_ERR) \
240244 STATE(IDPF_VC_DEALLOC_VECTORS) \
241245 STATE(IDPF_VC_DEALLOC_VECTORS_ERR) \
246+ STATE(IDPF_VC_SET_SRIOV_VFS) \
247+ STATE(IDPF_VC_SET_SRIOV_VFS_ERR) \
242248 STATE(IDPF_VC_GET_RSS_LUT) \
243249 STATE(IDPF_VC_GET_RSS_LUT_ERR) \
244250 STATE(IDPF_VC_SET_RSS_LUT) \
@@ -247,12 +253,16 @@ struct idpf_dev_ops {
247253 STATE(IDPF_VC_GET_RSS_KEY_ERR) \
248254 STATE(IDPF_VC_SET_RSS_KEY) \
249255 STATE(IDPF_VC_SET_RSS_KEY_ERR) \
256+ STATE(IDPF_VC_GET_STATS) \
257+ STATE(IDPF_VC_GET_STATS_ERR) \
250258 STATE(IDPF_VC_ADD_MAC_ADDR) \
251259 STATE(IDPF_VC_ADD_MAC_ADDR_ERR) \
252260 STATE(IDPF_VC_DEL_MAC_ADDR) \
253261 STATE(IDPF_VC_DEL_MAC_ADDR_ERR) \
254262 STATE(IDPF_VC_GET_PTYPE_INFO) \
255263 STATE(IDPF_VC_GET_PTYPE_INFO_ERR) \
264+ STATE(IDPF_VC_LOOPBACK_STATE) \
265+ STATE(IDPF_VC_LOOPBACK_STATE_ERR) \
256266 STATE(IDPF_VC_NBITS)
257267
258268#define IDPF_GEN_ENUM (ENUM ) ENUM,
@@ -268,10 +278,14 @@ extern const char * const idpf_vport_vc_state_str[];
268278 * enum idpf_vport_reset_cause - Vport soft reset causes
269279 * @IDPF_SR_Q_CHANGE: Soft reset queue change
270280 * @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
271283 */
272284enum idpf_vport_reset_cause {
273285 IDPF_SR_Q_CHANGE ,
274286 IDPF_SR_Q_DESC_CHANGE ,
287+ IDPF_SR_MTU_CHANGE ,
288+ IDPF_SR_RSC_CHANGE ,
275289};
276290
277291/**
@@ -402,6 +416,19 @@ struct idpf_vport {
402416 struct mutex vc_buf_lock ;
403417};
404418
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+
405432/**
406433 * struct idpf_rss_data - Associated RSS data
407434 * @rss_key_size: Size of RSS hash key
@@ -428,6 +455,7 @@ struct idpf_rss_data {
428455 * ethtool
429456 * @num_req_rxq_desc: Number of user requested RX queue descriptors through
430457 * ethtool
458+ * @user_flags: User toggled config flags
431459 * @mac_filter_list: List of MAC filters
432460 *
433461 * Used to restore configuration after a reset as the vport will get wiped.
@@ -438,6 +466,7 @@ struct idpf_vport_user_config_data {
438466 u16 num_req_rx_qs ;
439467 u32 num_req_txq_desc ;
440468 u32 num_req_rxq_desc ;
469+ DECLARE_BITMAP (user_flags , __IDPF_USER_FLAGS_NBITS );
441470 struct list_head mac_filter_list ;
442471};
443472
@@ -548,6 +577,7 @@ struct idpf_vport_config {
548577 * @mb_vector: Mailbox vector data
549578 * @vector_stack: Stack to store the msix vector indexes
550579 * @irq_mb_handler: Handler for hard interrupt for mailbox
580+ * @tx_timeout_count: Number of TX timeouts that have occurred
551581 * @avail_queues: Device given queue limits
552582 * @vports: Array to store vports created by the driver
553583 * @netdevs: Associated Vport netdevs
@@ -566,6 +596,8 @@ struct idpf_vport_config {
566596 * @mbx_wq: Workqueue for mailbox responses
567597 * @vc_event_task: Task to handle out of band virtchnl event notifications
568598 * @vc_event_wq: Workqueue for virtchnl events
599+ * @stats_task: Periodic statistics retrieval task
600+ * @stats_wq: Workqueue for statistics task
569601 * @caps: Negotiated capabilities with device
570602 * @vchnl_wq: Wait queue for virtchnl messages
571603 * @vc_state: Virtchnl message state
@@ -601,6 +633,7 @@ struct idpf_adapter {
601633 struct idpf_vector_lifo vector_stack ;
602634 irqreturn_t (* irq_mb_handler )(int irq , void * data );
603635
636+ u32 tx_timeout_count ;
604637 struct idpf_avail_queue_info avail_queues ;
605638 struct idpf_vport * * vports ;
606639 struct net_device * * netdevs ;
@@ -621,6 +654,8 @@ struct idpf_adapter {
621654 struct workqueue_struct * mbx_wq ;
622655 struct delayed_work vc_event_task ;
623656 struct workqueue_struct * vc_event_wq ;
657+ struct delayed_work stats_task ;
658+ struct workqueue_struct * stats_wq ;
624659 struct virtchnl2_get_capabilities caps ;
625660
626661 wait_queue_head_t vchnl_wq ;
@@ -825,6 +860,15 @@ static inline bool idpf_is_feature_ena(const struct idpf_vport *vport,
825860 return vport -> netdev -> features & feature ;
826861}
827862
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+
828872/**
829873 * idpf_vport_ctrl_lock - Acquire the vport control lock
830874 * @netdev: Network interface device structure
@@ -850,6 +894,7 @@ static inline void idpf_vport_ctrl_unlock(struct net_device *netdev)
850894 mutex_unlock (& np -> adapter -> vport_ctrl_lock );
851895}
852896
897+ void idpf_statistics_task (struct work_struct * work );
853898void idpf_init_task (struct work_struct * work );
854899void idpf_service_task (struct work_struct * work );
855900void idpf_mbx_task (struct work_struct * work );
@@ -865,6 +910,7 @@ int idpf_intr_req(struct idpf_adapter *adapter);
865910void idpf_intr_rel (struct idpf_adapter * adapter );
866911int idpf_get_reg_intr_vecs (struct idpf_vport * vport ,
867912 struct idpf_vec_regs * reg_vals );
913+ u16 idpf_get_max_tx_hdr_size (struct idpf_adapter * adapter );
868914int idpf_send_delete_queues_msg (struct idpf_vport * vport );
869915int idpf_send_add_queues_msg (const struct idpf_vport * vport , u16 num_tx_q ,
870916 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);
874920int idpf_send_disable_vport_msg (struct idpf_vport * vport );
875921int idpf_send_destroy_vport_msg (struct idpf_vport * vport );
876922int idpf_send_get_rx_ptype_msg (struct idpf_vport * vport );
923+ int idpf_send_ena_dis_loopback_msg (struct idpf_vport * vport );
877924int idpf_send_get_set_rss_key_msg (struct idpf_vport * vport , bool get );
878925int idpf_send_get_set_rss_lut_msg (struct idpf_vport * vport , bool get );
879926int idpf_send_dealloc_vectors_msg (struct idpf_adapter * adapter );
@@ -883,6 +930,7 @@ int idpf_req_rel_vector_indexes(struct idpf_adapter *adapter,
883930 u16 * q_vector_idxs ,
884931 struct idpf_vector_info * vec_info );
885932int idpf_vport_alloc_vec_indexes (struct idpf_vport * vport );
933+ int idpf_send_get_stats_msg (struct idpf_vport * vport );
886934int idpf_get_vec_ids (struct idpf_adapter * adapter ,
887935 u16 * vecids , int num_vecids ,
888936 struct virtchnl2_vector_chunks * chunks );
@@ -898,6 +946,9 @@ void idpf_vport_dealloc_max_qs(struct idpf_adapter *adapter,
898946int idpf_add_del_mac_filters (struct idpf_vport * vport ,
899947 struct idpf_netdev_priv * np ,
900948 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 );
901952int idpf_send_disable_queues_msg (struct idpf_vport * vport );
902953void idpf_vport_init (struct idpf_vport * vport , struct idpf_vport_max_q * max_q );
903954u32 idpf_get_vport_id (struct idpf_vport * vport );
0 commit comments