@@ -89,6 +89,9 @@ enum virtchnl_rx_hsplit {
8989 VIRTCHNL_RX_HSPLIT_SPLIT_SCTP = 8 ,
9090};
9191
92+ enum virtchnl_bw_limit_type {
93+ VIRTCHNL_BW_SHAPER = 0 ,
94+ };
9295/* END GENERIC DEFINES */
9396
9497/* Opcodes for VF-PF communication. These are placed in the v_opcode field
@@ -151,6 +154,11 @@ enum virtchnl_ops {
151154 VIRTCHNL_OP_DISABLE_VLAN_STRIPPING_V2 = 55 ,
152155 VIRTCHNL_OP_ENABLE_VLAN_INSERTION_V2 = 56 ,
153156 VIRTCHNL_OP_DISABLE_VLAN_INSERTION_V2 = 57 ,
157+ /* opcode 57 - 65 are reserved */
158+ VIRTCHNL_OP_GET_QOS_CAPS = 66 ,
159+ /* opcode 68 through 111 are reserved */
160+ VIRTCHNL_OP_CONFIG_QUEUE_BW = 112 ,
161+ VIRTCHNL_OP_CONFIG_QUANTA = 113 ,
154162 VIRTCHNL_OP_MAX ,
155163};
156164
@@ -261,6 +269,7 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
261269#define VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC BIT(26)
262270#define VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF BIT(27)
263271#define VIRTCHNL_VF_OFFLOAD_FDIR_PF BIT(28)
272+ #define VIRTCHNL_VF_OFFLOAD_QOS BIT(29)
264273
265274#define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \
266275 VIRTCHNL_VF_OFFLOAD_VLAN | \
@@ -1416,6 +1425,85 @@ struct virtchnl_fdir_del {
14161425
14171426VIRTCHNL_CHECK_STRUCT_LEN (12 , virtchnl_fdir_del );
14181427
1428+ struct virtchnl_shaper_bw {
1429+ /* Unit is Kbps */
1430+ u32 committed ;
1431+ u32 peak ;
1432+ };
1433+
1434+ VIRTCHNL_CHECK_STRUCT_LEN (8 , virtchnl_shaper_bw );
1435+
1436+ /* VIRTCHNL_OP_GET_QOS_CAPS
1437+ * VF sends this message to get its QoS Caps, such as
1438+ * TC number, Arbiter and Bandwidth.
1439+ */
1440+ struct virtchnl_qos_cap_elem {
1441+ u8 tc_num ;
1442+ u8 tc_prio ;
1443+ #define VIRTCHNL_ABITER_STRICT 0
1444+ #define VIRTCHNL_ABITER_ETS 2
1445+ u8 arbiter ;
1446+ #define VIRTCHNL_STRICT_WEIGHT 1
1447+ u8 weight ;
1448+ enum virtchnl_bw_limit_type type ;
1449+ union {
1450+ struct virtchnl_shaper_bw shaper ;
1451+ u8 pad2 [32 ];
1452+ };
1453+ };
1454+
1455+ VIRTCHNL_CHECK_STRUCT_LEN (40 , virtchnl_qos_cap_elem );
1456+
1457+ struct virtchnl_qos_cap_list {
1458+ u16 vsi_id ;
1459+ u16 num_elem ;
1460+ struct virtchnl_qos_cap_elem cap [];
1461+ };
1462+
1463+ VIRTCHNL_CHECK_STRUCT_LEN (4 , virtchnl_qos_cap_list );
1464+ #define virtchnl_qos_cap_list_LEGACY_SIZEOF 44
1465+
1466+ /* VIRTCHNL_OP_CONFIG_QUEUE_BW */
1467+ struct virtchnl_queue_bw {
1468+ u16 queue_id ;
1469+ u8 tc ;
1470+ u8 pad ;
1471+ struct virtchnl_shaper_bw shaper ;
1472+ };
1473+
1474+ VIRTCHNL_CHECK_STRUCT_LEN (12 , virtchnl_queue_bw );
1475+
1476+ struct virtchnl_queues_bw_cfg {
1477+ u16 vsi_id ;
1478+ u16 num_queues ;
1479+ struct virtchnl_queue_bw cfg [];
1480+ };
1481+
1482+ VIRTCHNL_CHECK_STRUCT_LEN (4 , virtchnl_queues_bw_cfg );
1483+ #define virtchnl_queues_bw_cfg_LEGACY_SIZEOF 16
1484+
1485+ enum virtchnl_queue_type {
1486+ VIRTCHNL_QUEUE_TYPE_TX = 0 ,
1487+ VIRTCHNL_QUEUE_TYPE_RX = 1 ,
1488+ };
1489+
1490+ /* structure to specify a chunk of contiguous queues */
1491+ struct virtchnl_queue_chunk {
1492+ /* see enum virtchnl_queue_type */
1493+ s32 type ;
1494+ u16 start_queue_id ;
1495+ u16 num_queues ;
1496+ };
1497+
1498+ VIRTCHNL_CHECK_STRUCT_LEN (8 , virtchnl_queue_chunk );
1499+
1500+ struct virtchnl_quanta_cfg {
1501+ u16 quanta_size ;
1502+ struct virtchnl_queue_chunk queue_select ;
1503+ };
1504+
1505+ VIRTCHNL_CHECK_STRUCT_LEN (12 , virtchnl_quanta_cfg );
1506+
14191507#define __vss_byone (p , member , count , old ) \
14201508 (struct_size(p, member, count) + (old - 1 - struct_size(p, member, 0)))
14211509
@@ -1438,6 +1526,8 @@ VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_fdir_del);
14381526 __vss(virtchnl_vlan_filter_list_v2, __vss_byelem, p, m, c), \
14391527 __vss(virtchnl_tc_info, __vss_byelem, p, m, c), \
14401528 __vss(virtchnl_rdma_qvlist_info, __vss_byelem, p, m, c), \
1529+ __vss(virtchnl_qos_cap_list, __vss_byelem, p, m, c), \
1530+ __vss(virtchnl_queues_bw_cfg, __vss_byelem, p, m, c), \
14411531 __vss(virtchnl_rss_key, __vss_byone, p, m, c), \
14421532 __vss(virtchnl_rss_lut, __vss_byone, p, m, c))
14431533
@@ -1637,6 +1727,35 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
16371727 case VIRTCHNL_OP_DISABLE_VLAN_INSERTION_V2 :
16381728 valid_len = sizeof (struct virtchnl_vlan_setting );
16391729 break ;
1730+ case VIRTCHNL_OP_GET_QOS_CAPS :
1731+ break ;
1732+ case VIRTCHNL_OP_CONFIG_QUEUE_BW :
1733+ valid_len = virtchnl_queues_bw_cfg_LEGACY_SIZEOF ;
1734+ if (msglen >= valid_len ) {
1735+ struct virtchnl_queues_bw_cfg * q_bw =
1736+ (struct virtchnl_queues_bw_cfg * )msg ;
1737+
1738+ valid_len = virtchnl_struct_size (q_bw , cfg ,
1739+ q_bw -> num_queues );
1740+ if (q_bw -> num_queues == 0 ) {
1741+ err_msg_format = true;
1742+ break ;
1743+ }
1744+ }
1745+ break ;
1746+ case VIRTCHNL_OP_CONFIG_QUANTA :
1747+ valid_len = sizeof (struct virtchnl_quanta_cfg );
1748+ if (msglen >= valid_len ) {
1749+ struct virtchnl_quanta_cfg * q_quanta =
1750+ (struct virtchnl_quanta_cfg * )msg ;
1751+
1752+ if (q_quanta -> quanta_size == 0 ||
1753+ q_quanta -> queue_select .num_queues == 0 ) {
1754+ err_msg_format = true;
1755+ break ;
1756+ }
1757+ }
1758+ break ;
16401759 /* These are always errors coming from the VF. */
16411760 case VIRTCHNL_OP_EVENT :
16421761 case VIRTCHNL_OP_UNKNOWN :
0 commit comments