Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Nov 2018 03:42:29 +0000 (UTC)
From:      Mike Karels <karels@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r340474 - head/sys/net/altq
Message-ID:  <201811160342.wAG3gTcd003670@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: karels
Date: Fri Nov 16 03:42:29 2018
New Revision: 340474
URL: https://svnweb.freebsd.org/changeset/base/340474

Log:
  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
  MFC after:	2 weeks
  Sponsored by:	Forcepoint LLC
  Differential Revision:	https://reviews.freebsd.org/D17758

Modified:
  head/sys/net/altq/altq_cbq.h
  head/sys/net/altq/altq_rmclass.h

Modified: head/sys/net/altq/altq_cbq.h
==============================================================================
--- head/sys/net/altq/altq_cbq.h	Fri Nov 16 01:27:24 2018	(r340473)
+++ head/sys/net/altq/altq_cbq.h	Fri Nov 16 03:42:29 2018	(r340474)
@@ -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: head/sys/net/altq/altq_rmclass.h
==============================================================================
--- head/sys/net/altq/altq_rmclass.h	Fri Nov 16 01:27:24 2018	(r340473)
+++ head/sys/net/altq/altq_rmclass.h	Fri Nov 16 03:42:29 2018	(r340474)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811160342.wAG3gTcd003670>