History

mqprio: Introduce new hardware offload mode and shaper in mqprio

The offload types currently supported in mqprio are 0 (no offload) and 1 (offload only TCs) by setting these values for the 'hw' option. If offloads are supported by setting the 'hw' option to 1, the default offload mode is 'dcb' where only the TC values are offloaded to the device. This patch introduces a new hardware offload mode called 'channel' with 'hw' set to 1 in mqprio which makes full use of the mqprio options, the TCs, the queue configurations and the QoS parameters for the TCs. This is achieved through a new netlink attribute for the 'mode' option which takes values such as 'dcb' (default) and 'channel'. The 'channel' mode also supports QoS attributes for traffic class such as minimum and maximum values for bandwidth rate limits. This patch enables configuring additional HW shaper attributes associated with a traffic class. Currently the shaper for bandwidth rate limiting is supported which takes options such as minimum and maximum bandwidth rates and are offloaded to the hardware in the 'channel' mode. The min and max limits for bandwidth rates are provided by the user along with the TCs and the queue configurations when creating the mqprio qdisc. The interface can be extended to support new HW shapers in future through the 'shaper' attribute. Introduces a new data structure 'tc_mqprio_qopt_offload' for offloading mqprio queue options and use this to be shared between the kernel and device driver. This contains a copy of the existing data structure for mqprio queue options. This new data structure can be extended when adding new attributes for traffic class such as mode, shaper, shaper parameters (bandwidth rate limits). The existing data structure for mqprio queue options will be shared between the kernel and userspace. Example: queues 4@0 4@4 hw 1 mode channel shaper bw_rlimit\ min_rate 1Gbit 2Gbit max_rate 4Gbit 5Gbit To dump the bandwidth rates: qdisc mqprio 804a: root tc 2 map 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 queues:(0:3) (4:7) mode:channel shaper:bw_rlimit min_rate:1Gbit 2Gbit max_rate:4Gbit 5Gbit

Amritha Nambiar committed 9 years ago

Commit 4e8b86c1 parent a00344b3 files · +215 −9Browse files

Showing the changes to include/uapi/linux (1 of 3 files). Show all

Unified · Split

include/uapi/linux/pkt_sched.h+32−0
@@ -625,6 +625,22 @@ enum { · 624 unmodified lines
625625
626626 #define TC_MQPRIO_HW_OFFLOAD_MAX (__TC_MQPRIO_HW_OFFLOAD_MAX - 1)
627627
628+enum {
629+ TC_MQPRIO_MODE_DCB,
630+ TC_MQPRIO_MODE_CHANNEL,
631+ __TC_MQPRIO_MODE_MAX
632+};
633+
634+#define __TC_MQPRIO_MODE_MAX (__TC_MQPRIO_MODE_MAX - 1)
635+
636+enum {
637+ TC_MQPRIO_SHAPER_DCB,
638+ TC_MQPRIO_SHAPER_BW_RATE, /* Add new shapers below */
639+ __TC_MQPRIO_SHAPER_MAX
640+};
641+
642+#define __TC_MQPRIO_SHAPER_MAX (__TC_MQPRIO_SHAPER_MAX - 1)
643+
628644 struct tc_mqprio_qopt {
629645 __u8 num_tc;
630646 __u8 prio_tc_map[TC_QOPT_BITMASK + 1];
@@ -633,6 +649,22 @@ struct tc_mqprio_qopt { · 2 unmodified lines
633649 __u16 offset[TC_QOPT_MAX_QUEUE];
634650 };
635651
652+#define TC_MQPRIO_F_MODE 0x1
653+#define TC_MQPRIO_F_SHAPER 0x2
654+#define TC_MQPRIO_F_MIN_RATE 0x4
655+#define TC_MQPRIO_F_MAX_RATE 0x8
656+
657+enum {
658+ TCA_MQPRIO_UNSPEC,
659+ TCA_MQPRIO_MODE,
660+ TCA_MQPRIO_SHAPER,
661+ TCA_MQPRIO_MIN_RATE64,
662+ TCA_MQPRIO_MAX_RATE64,
663+ __TCA_MQPRIO_MAX,
664+};
665+
666+#define TCA_MQPRIO_MAX (__TCA_MQPRIO_MAX - 1)
667+
636668 /* SFB */
637669
638670 enum {