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.
Showing the changes to include/uapi/linux (1 of 2 files). Show all
Unified · Split
| @@ -617,6 +617,14 @@ struct tc_drr_stats { · 616 unmodified lines | |||
| 617 | #define TC_QOPT_BITMASK 15 | 617 | #define TC_QOPT_BITMASK 15 |
| 618 | #define TC_QOPT_MAX_QUEUE 16 | 618 | #define TC_QOPT_MAX_QUEUE 16 |
| 619 | 619 | ||
| 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 | |||
| 620 | struct tc_mqprio_qopt { | 628 | struct tc_mqprio_qopt { |
| 621 | __u8 num_tc; | 629 | __u8 num_tc; |
| 622 | __u8 prio_tc_map[TC_QOPT_BITMASK + 1]; | 630 | __u8 prio_tc_map[TC_QOPT_BITMASK + 1]; |