3434#include <net/tc_act/tc_gact.h>
3535#include <net/tc_act/tc_mirred.h>
3636#include <net/tc_act/tc_skbedit.h>
37+ #include <net/net_shaper.h>
3738
3839#include "iavf_type.h"
3940#include <linux/avf/virtchnl.h>
4041#include "iavf_txrx.h"
4142#include "iavf_fdir.h"
4243#include "iavf_adv_rss.h"
44+ #include "iavf_types.h"
4345#include <linux/bitmap.h>
4446
4547#define DEFAULT_DEBUG_LEVEL_SHIFT 3
@@ -81,7 +83,7 @@ struct iavf_vsi {
8183
8284#define MAXIMUM_ETHERNET_VLAN_SIZE (VLAN_ETH_FRAME_LEN + ETH_FCS_LEN)
8385
84- #define IAVF_RX_DESC (R , i ) (&(((union iavf_32byte_rx_desc *)((R)->desc))[i]))
86+ #define IAVF_RX_DESC (R , i ) (&(((struct iavf_rx_desc *)((R)->desc))[i]))
8587#define IAVF_TX_DESC (R , i ) (&(((struct iavf_tx_desc *)((R)->desc))[i]))
8688#define IAVF_TX_CTXTDESC (R , i ) \
8789 (&(((struct iavf_tx_context_desc *)((R)->desc))[i]))
@@ -250,6 +252,9 @@ struct iavf_cloud_filter {
250252#define IAVF_RESET_WAIT_DETECTED_COUNT 500
251253#define IAVF_RESET_WAIT_COMPLETE_COUNT 2000
252254
255+ #define IAVF_MAX_QOS_TC_NUM 8
256+ #define IAVF_DEFAULT_QUANTA_SIZE 1024
257+
253258/* board specific private data structure */
254259struct iavf_adapter {
255260 struct workqueue_struct * wq ;
@@ -267,6 +272,7 @@ struct iavf_adapter {
267272 /* Lock to protect accesses to MAC and VLAN lists */
268273 spinlock_t mac_vlan_list_lock ;
269274 char misc_vector_name [IFNAMSIZ + 9 ];
275+ u8 rxdid ;
270276 int num_active_queues ;
271277 int num_req_queues ;
272278
@@ -336,6 +342,20 @@ struct iavf_adapter {
336342#define IAVF_FLAG_AQ_DISABLE_CTAG_VLAN_INSERTION BIT_ULL(36)
337343#define IAVF_FLAG_AQ_ENABLE_STAG_VLAN_INSERTION BIT_ULL(37)
338344#define IAVF_FLAG_AQ_DISABLE_STAG_VLAN_INSERTION BIT_ULL(38)
345+ #define IAVF_FLAG_AQ_CONFIGURE_QUEUES_BW BIT_ULL(39)
346+ #define IAVF_FLAG_AQ_CFG_QUEUES_QUANTA_SIZE BIT_ULL(40)
347+ #define IAVF_FLAG_AQ_GET_QOS_CAPS BIT_ULL(41)
348+ #define IAVF_FLAG_AQ_GET_SUPPORTED_RXDIDS BIT_ULL(42)
349+ #define IAVF_FLAG_AQ_GET_PTP_CAPS BIT_ULL(43)
350+ #define IAVF_FLAG_AQ_SEND_PTP_CMD BIT_ULL(44)
351+
352+ /* AQ messages that must be sent after IAVF_FLAG_AQ_GET_CONFIG, in
353+ * order to negotiated extended capabilities.
354+ */
355+ #define IAVF_FLAG_AQ_EXTENDED_CAPS \
356+ (IAVF_FLAG_AQ_GET_OFFLOAD_VLAN_V2_CAPS | \
357+ IAVF_FLAG_AQ_GET_SUPPORTED_RXDIDS | \
358+ IAVF_FLAG_AQ_GET_PTP_CAPS)
339359
340360 /* flags for processing extended capability messages during
341361 * __IAVF_INIT_EXTENDED_CAPS. Each capability exchange requires
@@ -347,10 +367,18 @@ struct iavf_adapter {
347367 u64 extended_caps ;
348368#define IAVF_EXTENDED_CAP_SEND_VLAN_V2 BIT_ULL(0)
349369#define IAVF_EXTENDED_CAP_RECV_VLAN_V2 BIT_ULL(1)
370+ #define IAVF_EXTENDED_CAP_SEND_RXDID BIT_ULL(2)
371+ #define IAVF_EXTENDED_CAP_RECV_RXDID BIT_ULL(3)
372+ #define IAVF_EXTENDED_CAP_SEND_PTP BIT_ULL(4)
373+ #define IAVF_EXTENDED_CAP_RECV_PTP BIT_ULL(5)
350374
351375#define IAVF_EXTENDED_CAPS \
352376 (IAVF_EXTENDED_CAP_SEND_VLAN_V2 | \
353- IAVF_EXTENDED_CAP_RECV_VLAN_V2)
377+ IAVF_EXTENDED_CAP_RECV_VLAN_V2 | \
378+ IAVF_EXTENDED_CAP_SEND_RXDID | \
379+ IAVF_EXTENDED_CAP_RECV_RXDID | \
380+ IAVF_EXTENDED_CAP_SEND_PTP | \
381+ IAVF_EXTENDED_CAP_RECV_PTP)
354382
355383 /* Lock to prevent possible clobbering of
356384 * current_netdev_promisc_flags
@@ -408,14 +436,23 @@ struct iavf_adapter {
408436 VIRTCHNL_VF_OFFLOAD_FDIR_PF)
409437#define ADV_RSS_SUPPORT (_a ) ((_a)->vf_res->vf_cap_flags & \
410438 VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF)
439+ #define QOS_ALLOWED (_a ) ((_a)->vf_res->vf_cap_flags & \
440+ VIRTCHNL_VF_OFFLOAD_QOS)
441+ #define IAVF_RXDID_ALLOWED (a ) \
442+ ((a)->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
443+ #define IAVF_PTP_ALLOWED (a ) \
444+ ((a)->vf_res->vf_cap_flags & VIRTCHNL_VF_CAP_PTP)
411445 struct virtchnl_vf_resource * vf_res ; /* incl. all VSIs */
412446 struct virtchnl_vsi_resource * vsi_res ; /* our LAN VSI */
413447 struct virtchnl_version_info pf_version ;
414448#define PF_IS_V11 (_a ) (((_a)->pf_version.major == 1) && \
415449 ((_a)->pf_version.minor == 1))
416450 struct virtchnl_vlan_caps vlan_v2_caps ;
451+ u64 supp_rxdids ;
452+ struct iavf_ptp ptp ;
417453 u16 msg_enable ;
418454 struct iavf_eth_stats current_stats ;
455+ struct virtchnl_qos_cap_list * qos_caps ;
419456 struct iavf_vsi vsi ;
420457 u32 aq_wait_count ;
421458 /* RSS stuff */
@@ -529,37 +566,33 @@ static inline void iavf_change_state(struct iavf_adapter *adapter,
529566 iavf_state_str (adapter -> state ));
530567}
531568
532- int iavf_up (struct iavf_adapter * adapter );
533569void iavf_down (struct iavf_adapter * adapter );
534570int iavf_process_config (struct iavf_adapter * adapter );
535571int iavf_parse_vf_resource_msg (struct iavf_adapter * adapter );
536572void iavf_schedule_reset (struct iavf_adapter * adapter , u64 flags );
537573void iavf_schedule_aq_request (struct iavf_adapter * adapter , u64 flags );
538574void iavf_schedule_finish_config (struct iavf_adapter * adapter );
539- void iavf_reset (struct iavf_adapter * adapter );
540575void iavf_set_ethtool_ops (struct net_device * netdev );
541- void iavf_update_stats (struct iavf_adapter * adapter );
542576void iavf_free_all_tx_resources (struct iavf_adapter * adapter );
543577void iavf_free_all_rx_resources (struct iavf_adapter * adapter );
544578
545- void iavf_napi_add_all (struct iavf_adapter * adapter );
546- void iavf_napi_del_all (struct iavf_adapter * adapter );
547-
548579int iavf_send_api_ver (struct iavf_adapter * adapter );
549580int iavf_verify_api_ver (struct iavf_adapter * adapter );
550581int iavf_send_vf_config_msg (struct iavf_adapter * adapter );
551582int iavf_get_vf_config (struct iavf_adapter * adapter );
552583int iavf_get_vf_vlan_v2_caps (struct iavf_adapter * adapter );
553584int iavf_send_vf_offload_vlan_v2_msg (struct iavf_adapter * adapter );
585+ int iavf_send_vf_supported_rxdids_msg (struct iavf_adapter * adapter );
586+ int iavf_get_vf_supported_rxdids (struct iavf_adapter * adapter );
587+ int iavf_send_vf_ptp_caps_msg (struct iavf_adapter * adapter );
588+ int iavf_get_vf_ptp_caps (struct iavf_adapter * adapter );
554589void iavf_set_queue_vlan_tag_loc (struct iavf_adapter * adapter );
555590u16 iavf_get_num_vlans_added (struct iavf_adapter * adapter );
556591void iavf_irq_enable (struct iavf_adapter * adapter , bool flush );
557592void iavf_configure_queues (struct iavf_adapter * adapter );
558- void iavf_deconfigure_queues (struct iavf_adapter * adapter );
559593void iavf_enable_queues (struct iavf_adapter * adapter );
560594void iavf_disable_queues (struct iavf_adapter * adapter );
561595void iavf_map_queues (struct iavf_adapter * adapter );
562- int iavf_request_queues (struct iavf_adapter * adapter , int num );
563596void iavf_add_ether_addrs (struct iavf_adapter * adapter );
564597void iavf_del_ether_addrs (struct iavf_adapter * adapter );
565598void iavf_add_vlans (struct iavf_adapter * adapter );
@@ -579,8 +612,9 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter,
579612 enum virtchnl_ops v_opcode ,
580613 enum iavf_status v_retval , u8 * msg , u16 msglen );
581614int iavf_config_rss (struct iavf_adapter * adapter );
582- int iavf_lan_add_device (struct iavf_adapter * adapter );
583- int iavf_lan_del_device (struct iavf_adapter * adapter );
615+ void iavf_cfg_queues_bw (struct iavf_adapter * adapter );
616+ void iavf_cfg_queues_quanta_size (struct iavf_adapter * adapter );
617+ void iavf_get_qos_caps (struct iavf_adapter * adapter );
584618void iavf_enable_channels (struct iavf_adapter * adapter );
585619void iavf_disable_channels (struct iavf_adapter * adapter );
586620void iavf_add_cloud_filter (struct iavf_adapter * adapter );
0 commit comments