Author: karels
Date: Sat Dec  8 14:54:33 2018
New Revision: 341737
URL: https://svnweb.freebsd.org/changeset/base/341737

Log:
  MFC r340474:
  Fix flags collision causing inability to enable CBQ in ALTQ
  
  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.
  
  PR:             215716
  Reviewed by:    pkelsey
  Sponsored by:   Forcepoint LLC
  Differential Revision:  https://reviews.freebsd.org/D17758

Modified:
  stable/12/sys/net/altq/altq_cbq.h
  stable/12/sys/net/altq/altq_rmclass.h

Modified: stable/12/sys/net/altq/altq_cbq.h
==============================================================================
--- stable/12/sys/net/altq/altq_cbq.h   Sat Dec  8 14:32:19 2018        
(r341736)
+++ stable/12/sys/net/altq/altq_cbq.h   Sat Dec  8 14:54:33 2018        
(r341737)
@@ -46,7 +46,7 @@ extern "C" {
 
 #define        NULL_CLASS_HANDLE       0
 
-/* class flags should be same as class flags in rm_class.h */
+/* class flags must be same as class flags in altq_rmclass.h */
 #define        CBQCLF_RED              0x0001  /* use RED */
 #define        CBQCLF_ECN              0x0002  /* use RED/ECN */
 #define        CBQCLF_RIO              0x0004  /* use RIO */
@@ -54,6 +54,15 @@ extern "C" {
 #define        CBQCLF_CLEARDSCP        0x0010  /* clear diffserv codepoint */
 #define        CBQCLF_BORROW           0x0020  /* borrow from parent */
 #define        CBQCLF_CODEL            0x0040  /* use CoDel */
+
+#ifdef _KERNEL
+CTASSERT(CBQCLF_RED == RMCF_RED);
+CTASSERT(CBQCLF_ECN == RMCF_ECN);
+CTASSERT(CBQCLF_RIO == RMCF_RIO);
+CTASSERT(CBQCLF_FLOWVALVE == RMCF_FLOWVALVE);
+CTASSERT(CBQCLF_CLEARDSCP == RMCF_CLEARDSCP);
+CTASSERT(CBQCLF_CODEL == RMCF_CODEL);
+#endif
 
 /* class flags only for root class */
 #define        CBQCLF_WRR              0x0100  /* weighted-round robin */

Modified: stable/12/sys/net/altq/altq_rmclass.h
==============================================================================
--- stable/12/sys/net/altq/altq_rmclass.h       Sat Dec  8 14:32:19 2018        
(r341736)
+++ stable/12/sys/net/altq/altq_rmclass.h       Sat Dec  8 14:54:33 2018        
(r341737)
@@ -233,13 +233,13 @@ struct rm_ifdat {
 };
 
 /* flags for rmc_init and rmc_newclass */
-/* class flags */
+/* class flags; must be the same as class flags in altq_cbq.h */
 #define        RMCF_RED                0x0001
 #define        RMCF_ECN                0x0002
 #define        RMCF_RIO                0x0004
 #define        RMCF_FLOWVALVE          0x0008  /* use flowvalve (aka 
penalty-box) */
 #define        RMCF_CLEARDSCP          0x0010  /* clear diffserv codepoint */
-#define        RMCF_CODEL              0x0020
+#define        RMCF_CODEL              0x0040
 
 /* flags for rmc_init */
 #define        RMCF_WRR                0x0100
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to