History

mqprio: Change handling of hw u8 to allow for multiple hardware offload modes

This patch is meant to allow for support of multiple hardware offload type for a single device. There is currently no bounds checking for the hw member of the mqprio_qopt structure. This results in us being able to pass values from 1 to 255 with all being treated the same. On retreiving the value it is returned as 1 for anything 1 or greater being set. With this change we are currently adding limited bounds checking by defining an enum and using those values to limit the reported hardware offloads.

Alexander Duyck committed 9 years ago

Commit 2026fec1 parent 5b769642 files · +24 −10Browse files

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

Unified · Split

include/uapi/linux/pkt_sched.h+8−0
@@ -617,6 +617,14 @@ struct tc_drr_stats { · 616 unmodified lines
617617 #define TC_QOPT_BITMASK 15
618618 #define TC_QOPT_MAX_QUEUE 16
619619
620+enum {
621+ TC_MQPRIO_HW_OFFLOAD_NONE, /* no offload requested */
622+ TC_MQPRIO_HW_OFFLOAD_TCS, /* offload TCs, no queue counts */
623+ __TC_MQPRIO_HW_OFFLOAD_MAX
624+};
625+
626+#define TC_MQPRIO_HW_OFFLOAD_MAX (__TC_MQPRIO_HW_OFFLOAD_MAX - 1)
627+
620628 struct tc_mqprio_qopt {
621629 __u8 num_tc;
622630 __u8 prio_tc_map[TC_QOPT_BITMASK + 1];