The CBQ BORROW flag conflicts with the RMCF_CODEL flag; the
two sets of definitions actually define the same things. The symptom
is that a kernel with CBQ support and not CODEL fails to load a QoS
policy with the obscure error "pfctl: DIOCADDALTQ: Cannot allocate memory."
If ALTQ_DEBUG is enabled, the error becomes a little clearer:
"rmc_newclass: CODEL not configured for CBQ!" is printed by the kernel.
There really shouldn't be two sets of macros that have to be defined
consistently, but the include structure isn't right for exporting
CBQ flags to altq_rmclass.h. Re-align the definitions, and add
CTASSERTs in the kernel to ensure that the definitions are consistent.
Details
- Configure kernel with ALTQ and ALTQ_CBC (and not ALTQ_CODEL).
- Test that a pf configuration such as the one in bug 215716 can be
loaded.
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 20507 Build 19935: arc lint + arc unit
Event Timeline
To clarify 'the symptom is that a kernel with CBQ support and not CODEL fails to load a QoS policy with the obscure error "pfctl: DIOCADDALTQ: Cannot allocate memory."', to experience this failure it is also required that the queue configuration include the BORROW flag ('borrow' keyword in pf.conf), as that sets the bit that is misinterpreted by rmclass as requesting CODEL.
I verified that cbq is the only user of rm_class, and that for other disciplines, their queue configuration flags are unrelated - in other words, cbq is the only discipline that requires that it's flag values be consistent with the RMCF_* values.
Also, there is no associated compat work required in the pfctl ioctl API, as changing the value of RMCF_CODEL does not affect the meaning of the cbq flag bits in that API, it only fixes the following bugs:
- Users with CODEL configured in the kernel who are cbq queues with the BORROW flag ('borrow' keyword in pf.conf) will no longer wind up with CODEL also being erroneously enabled for that queue
- BORROW no longer erroneously requires CODEL to be configured in the kernel in order 'to work'
- CODEL will correctly be enabled for cbq queues when the BORROW flag ('borrow' keyword in pf.conf) is not also present