[Cake] checkpatch and cake

Dave Taht dave at taht.net
Fri Nov 17 11:31:06 EST 2017


Checkpatch reports 130 or so errors and warnings against kernel standards.
Amusingly it reports my name as a warning.

Fixing that is going to require peeing on a lot of code.

So far as I know, there is a patch missing from the cobalt repo that
was lost when jonathon's machine crashed, but there is no other out of
tree work pending, besides maybe some ack work.

the state of the cobalt branch vs the head branch is hard to discern,
but since that has been "head" for a while - (what commit is in lede?),
it's the easiest for me to start fixing.

I'd folded the ack work in progress into cobalt. I kind expect that
to evolve....

...

Anyway, what I'm doing right now is merely producing a patch for
mainline (I'm testing against net-next), which is serving as a form of
code review for me, rather than trying to fix up the repo.

I don't care much what happens to the main cake repo, after cake is
mainlined. The upstreaming process will churn the code so much that it
would probably be best to do the upstreaming, then fold the backporting
code back into that repo.

It would be best to have a checkpatch hook in the future on the cake repo.

...



WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#19: 
new file mode 100644

WARNING: 'Taht' may be misspelled - perhaps 'That'?
#33: FILE: include/net/cobalt.h:10:
+ *  Copyright (C) 2016 Michael D. Taht <dave.taht at bufferbloat.net>

WARNING: 'taht' may be misspelled - perhaps 'that'?
#33: FILE: include/net/cobalt.h:10:
+ *  Copyright (C) 2016 Michael D. Taht <dave.taht at bufferbloat.net>

WARNING: LINUX_VERSION_CODE should be avoided, code should be for the version to which it is merged
#84: FILE: include/net/cobalt.h:61:
+#if KERNEL_VERSION(3, 18, 0) > LINUX_VERSION_CODE

WARNING: line over 80 characters
#145: FILE: include/net/cobalt.h:122:
+bool cobalt_queue_full(struct cobalt_vars *vars, struct cobalt_params *p, cobalt_time_t now);

WARNING: line over 80 characters
#148: FILE: include/net/cobalt.h:125:
+bool cobalt_queue_empty(struct cobalt_vars *vars, struct cobalt_params *p, cobalt_time_t now);

WARNING: 'Taht' may be misspelled - perhaps 'That'?
#272: FILE: net/sched/cobalt.c:7:
+ *  Copyright (C) 2016 Michael D. Taht <dave.taht at bufferbloat.net>

WARNING: 'taht' may be misspelled - perhaps 'that'?
#272: FILE: net/sched/cobalt.c:7:
+ *  Copyright (C) 2016 Michael D. Taht <dave.taht at bufferbloat.net>

WARNING: networking block comments don't use an empty /* line, use /* Comment...
#317: FILE: net/sched/cobalt.c:52:
+/*
+ * COBALT operates the Codel and BLUE algorithms in parallel, in order

WARNING: line over 80 characters
#343: FILE: net/sched/cobalt.c:78:
+ * http://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Iterative_methods_for_reciprocal_square_roots

WARNING: networking block comments don't use an empty /* line, use /* Comment...
#343: FILE: net/sched/cobalt.c:78:
+/*
+ * http://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Iterative_methods_for_reciprocal_square_roots

WARNING: braces {} are not necessary for any arm of this statement
#362: FILE: net/sched/cobalt.c:97:
+	if (vars->count < REC_INV_SQRT_CACHE) {
[...]
+	} else {
[...]

ERROR: space required before the open parenthesis '('
#391: FILE: net/sched/cobalt.c:126:
+	if(!cobalt_rec_inv_sqrt_cache[0]) {

WARNING: networking block comments don't use an empty /* line, use /* Comment...
#398: FILE: net/sched/cobalt.c:133:
+/*
+ * CoDel control_law is t + interval/sqrt(count)

CHECK: Alignment should match open parenthesis
#403: FILE: net/sched/cobalt.c:138:
+static cobalt_time_t cobalt_control_law(cobalt_time_t t,
+				      cobalt_time_t interval,

WARNING: line over 80 characters
#410: FILE: net/sched/cobalt.c:145:
+ * Returns true if the BLUE state was quiescent before but active after this call.

WARNING: line over 80 characters
#412: FILE: net/sched/cobalt.c:147:
+bool cobalt_queue_full(struct cobalt_vars *vars, struct cobalt_params *p, cobalt_time_t now)

ERROR: space required before the open parenthesis '('
#416: FILE: net/sched/cobalt.c:151:
+	if((now - vars->blue_timer) > p->target) {

ERROR: space required before the open parenthesis '('
#419: FILE: net/sched/cobalt.c:154:
+		if(vars->p_drop < p->p_inc)

ERROR: space required before the open parenthesis '('
#425: FILE: net/sched/cobalt.c:160:
+	if(!vars->count)

WARNING: line over 80 characters
#432: FILE: net/sched/cobalt.c:167:
+ * Returns true if the BLUE state was active before but quiescent after this call.

WARNING: line over 80 characters
#434: FILE: net/sched/cobalt.c:169:
+bool cobalt_queue_empty(struct cobalt_vars *vars, struct cobalt_params *p, cobalt_time_t now)

ERROR: space required before the open parenthesis '('
#438: FILE: net/sched/cobalt.c:173:
+	if(vars->p_drop && (now - vars->blue_timer) > p->target) {

ERROR: space required before the open parenthesis '('
#439: FILE: net/sched/cobalt.c:174:
+		if(vars->p_drop < p->p_dec)

ERROR: space required before the open parenthesis '('
#448: FILE: net/sched/cobalt.c:183:
+	if(vars->count && (now - vars->drop_next) >= 0) {

WARNING: line over 80 characters
#451: FILE: net/sched/cobalt.c:186:
+		vars->drop_next = cobalt_control_law(vars->drop_next, p->interval, vars->rec_inv_sqrt);

CHECK: Alignment should match open parenthesis
#461: FILE: net/sched/cobalt.c:196:
+bool cobalt_should_drop(struct cobalt_vars *vars,
+	struct cobalt_params *p,

ERROR: space required before the open parenthesis '('
#475: FILE: net/sched/cobalt.c:210:
+	if(over_target) {

ERROR: space required before the open parenthesis '('
#476: FILE: net/sched/cobalt.c:211:
+		if(!vars->dropping) {

WARNING: line over 80 characters
#478: FILE: net/sched/cobalt.c:213:
+			vars->drop_next = cobalt_control_law(now, p->interval, vars->rec_inv_sqrt);

ERROR: space required before the open parenthesis '('
#480: FILE: net/sched/cobalt.c:215:
+		if(!vars->count)

ERROR: space required before the open parenthesis '('
#482: FILE: net/sched/cobalt.c:217:
+	} else if(vars->dropping) {

ERROR: space required before the open parenthesis '('
#486: FILE: net/sched/cobalt.c:221:
+	if(next_due && vars->dropping) {

ERROR: space required before the open parenthesis '('
#491: FILE: net/sched/cobalt.c:226:
+		if(!vars->count)

WARNING: line over 80 characters
#494: FILE: net/sched/cobalt.c:229:
+		vars->drop_next = cobalt_control_law(vars->drop_next, p->interval, vars->rec_inv_sqrt);

ERROR: space required before the open parenthesis '('
#497: FILE: net/sched/cobalt.c:232:
+		while(next_due) {

WARNING: line over 80 characters
#500: FILE: net/sched/cobalt.c:235:
+			vars->drop_next = cobalt_control_law(vars->drop_next, p->interval, vars->rec_inv_sqrt);

ERROR: space required before the open parenthesis '('
#507: FILE: net/sched/cobalt.c:242:
+	if(vars->p_drop)

ERROR: space required before the open parenthesis '('
#511: FILE: net/sched/cobalt.c:246:
+	if(!vars->count)

ERROR: space required before the open parenthesis '('
#513: FILE: net/sched/cobalt.c:248:
+	else if(schedule > 0 && !drop)

WARNING: line over 80 characters
#531: FILE: net/sched/sch_cake.c:8:
+ * Copyright (C) 2015-2017 Kevin Darbyshire-Bryant <kevin at darbyshire-bryant.me.uk>

WARNING: Prefer IS_ENABLED(<FOO>) to CONFIG_<FOO> || CONFIG_<FOO>_MODULE
#586: FILE: net/sched/sch_cake.c:63:
+#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)

CHECK: spaces preferred around that '+' (ctx:VxV)
#810: FILE: net/sched/sch_cake.c:287:
+static u16 quantum_div[CAKE_QUEUES+1] = {0};
                                   ^

CHECK: Please don't use multiple blank lines
#878: FILE: net/sched/sch_cake.c:355:
+
+

WARNING: Prefer IS_ENABLED(<FOO>) to CONFIG_<FOO> || CONFIG_<FOO>_MODULE
#879: FILE: net/sched/sch_cake.c:356:
+#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)

WARNING: line over 80 characters
#881: FILE: net/sched/sch_cake.c:358:
+static inline void cake_update_flowkeys(struct flow_keys *keys, const struct sk_buff *skb)

CHECK: Comparison to NULL could be written "ct"
#893: FILE: net/sched/sch_cake.c:370:
+	if (ct != NULL) {

ERROR: space prohibited after that '!' (ctx:BxW)
#899: FILE: net/sched/sch_cake.c:376:
+		if (! nf_ct_get_tuplepr(skb, skb_network_offset(skb),
 		    ^

WARNING: line over 80 characters
#900: FILE: net/sched/sch_cake.c:377:
+					NFPROTO_IPV4, dev_net(skb->dev), &srctuple))

CHECK: Alignment should match open parenthesis
#904: FILE: net/sched/sch_cake.c:381:
+		hash = nf_conntrack_find_get(dev_net(skb->dev),
+				&nf_ct_zone_dflt, &srctuple);

CHECK: Comparison to NULL could be written "!hash"
#905: FILE: net/sched/sch_cake.c:382:
+		if (hash == NULL)

WARNING: line over 80 characters
#913: FILE: net/sched/sch_cake.c:390:
+	keys->addrs.v4addrs.src = ( reverse ? tuple->dst.u3.ip : tuple->src.u3.ip );

ERROR: space prohibited after that open parenthesis '('
#913: FILE: net/sched/sch_cake.c:390:
+	keys->addrs.v4addrs.src = ( reverse ? tuple->dst.u3.ip : tuple->src.u3.ip );

ERROR: space prohibited before that close parenthesis ')'
#913: FILE: net/sched/sch_cake.c:390:
+	keys->addrs.v4addrs.src = ( reverse ? tuple->dst.u3.ip : tuple->src.u3.ip );

WARNING: line over 80 characters
#914: FILE: net/sched/sch_cake.c:391:
+	keys->addrs.v4addrs.dst = ( reverse ? tuple->src.u3.ip : tuple->dst.u3.ip );

ERROR: space prohibited after that open parenthesis '('
#914: FILE: net/sched/sch_cake.c:391:
+	keys->addrs.v4addrs.dst = ( reverse ? tuple->src.u3.ip : tuple->dst.u3.ip );

ERROR: space prohibited before that close parenthesis ')'
#914: FILE: net/sched/sch_cake.c:391:
+	keys->addrs.v4addrs.dst = ( reverse ? tuple->src.u3.ip : tuple->dst.u3.ip );

WARNING: line over 80 characters
#917: FILE: net/sched/sch_cake.c:394:
+		keys->ports.src = ( reverse ? tuple->dst.u.all : tuple->src.u.all );

ERROR: space prohibited after that open parenthesis '('
#917: FILE: net/sched/sch_cake.c:394:
+		keys->ports.src = ( reverse ? tuple->dst.u.all : tuple->src.u.all );

ERROR: space prohibited before that close parenthesis ')'
#917: FILE: net/sched/sch_cake.c:394:
+		keys->ports.src = ( reverse ? tuple->dst.u.all : tuple->src.u.all );

WARNING: line over 80 characters
#918: FILE: net/sched/sch_cake.c:395:
+		keys->ports.dst = ( reverse ? tuple->src.u.all : tuple->dst.u.all );

ERROR: space prohibited after that open parenthesis '('
#918: FILE: net/sched/sch_cake.c:395:
+		keys->ports.dst = ( reverse ? tuple->src.u.all : tuple->dst.u.all );

ERROR: space prohibited before that close parenthesis ')'
#918: FILE: net/sched/sch_cake.c:395:
+		keys->ports.dst = ( reverse ? tuple->src.u.all : tuple->dst.u.all );

WARNING: void function return statements are not generally useful
#923: FILE: net/sched/sch_cake.c:400:
+	return;
+}

WARNING: line over 80 characters
#925: FILE: net/sched/sch_cake.c:402:
+static inline void cake_update_flowkeys(struct flow_keys *keys, const struct sk_buff *skb)

WARNING: void function return statements are not generally useful
#929: FILE: net/sched/sch_cake.c:406:
+	return;
+}

ERROR: spaces required around that '=' (ctx:VxV)
#936: FILE: net/sched/sch_cake.c:413:
+	u32 flow_hash=0, srchost_hash, dsthost_hash;
 	             ^

CHECK: Alignment should match open parenthesis
#943: FILE: net/sched/sch_cake.c:420:
+	skb_flow_dissect_flow_keys(skb, &keys,
+				FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL);

ERROR: space required before the open parenthesis '('
#944: FILE: net/sched/sch_cake.c:421:
+	if(flow_mode & CAKE_FLOW_NAT_FLAG)

CHECK: Alignment should match open parenthesis
#968: FILE: net/sched/sch_cake.c:445:
+		memset(&host_keys.addrs.v6addrs.src, 0,
+			   sizeof(host_keys.addrs.v6addrs.src));

CHECK: Alignment should match open parenthesis
#972: FILE: net/sched/sch_cake.c:449:
+		memset(&host_keys.addrs.v6addrs.dst, 0,
+			   sizeof(host_keys.addrs.v6addrs.dst));

CHECK: multiple assignments should be avoided
#977: FILE: net/sched/sch_cake.c:454:
+		dsthost_hash = srchost_hash = 0;

ERROR: space required before the open parenthesis '('
#987: FILE: net/sched/sch_cake.c:464:
+		if(flow_mode & CAKE_FLOW_SRC_IP)

ERROR: space required before the open parenthesis '('
#990: FILE: net/sched/sch_cake.c:467:
+		if(flow_mode & CAKE_FLOW_DST_IP)

WARNING: line over 80 characters
#1000: FILE: net/sched/sch_cake.c:477:
+	if (likely(q->tags[reduced_hash] == flow_hash && q->flows[reduced_hash].set)) {

ERROR: space required before the open parenthesis '('
#1015: FILE: net/sched/sch_cake.c:492:
+				if(i)

ERROR: space required before the open parenthesis '('
#1018: FILE: net/sched/sch_cake.c:495:
+				if(!q->flows[outer_hash + k].set) {

ERROR: space required before the open parenthesis '('
#1055: FILE: net/sched/sch_cake.c:532:
+		if(need_allocate_src) {

ERROR: space required before the open parenthesis '('
#1058: FILE: net/sched/sch_cake.c:535:
+			for(i = 0, k = inner_hash; i < CAKE_SET_WAYS;

WARNING: line over 80 characters
#1060: FILE: net/sched/sch_cake.c:537:
+				if(q->hosts[outer_hash + k].srchost_tag == srchost_hash)

ERROR: space required before the open parenthesis '('
#1060: FILE: net/sched/sch_cake.c:537:
+				if(q->hosts[outer_hash + k].srchost_tag == srchost_hash)

ERROR: space required before the open parenthesis '('
#1063: FILE: net/sched/sch_cake.c:540:
+			for(i = 0; i < CAKE_SET_WAYS;

ERROR: space required before the open parenthesis '('
#1065: FILE: net/sched/sch_cake.c:542:
+				if(!q->hosts[outer_hash + k].srchost_refcnt)

ERROR: space required before the open parenthesis '('
#1075: FILE: net/sched/sch_cake.c:552:
+		if(need_allocate_dst) {

ERROR: space required before the open parenthesis '('
#1078: FILE: net/sched/sch_cake.c:555:
+			for(i = 0, k = inner_hash; i < CAKE_SET_WAYS;

WARNING: line over 80 characters
#1080: FILE: net/sched/sch_cake.c:557:
+				if(q->hosts[outer_hash + k].dsthost_tag == dsthost_hash)

ERROR: space required before the open parenthesis '('
#1080: FILE: net/sched/sch_cake.c:557:
+				if(q->hosts[outer_hash + k].dsthost_tag == dsthost_hash)

ERROR: space required before the open parenthesis '('
#1083: FILE: net/sched/sch_cake.c:560:
+			for(i = 0; i < CAKE_SET_WAYS;

ERROR: space required before the open parenthesis '('
#1085: FILE: net/sched/sch_cake.c:562:
+				if(!q->hosts[outer_hash + k].dsthost_refcnt)

ERROR: space required before the open parenthesis '('
#1106: FILE: net/sched/sch_cake.c:583:
+	if(skb) {

CHECK: spaces preferred around that '*' (ctx:VxV)
#1149: FILE: net/sched/sch_cake.c:626:
+		seglen = ntohs(iph->tot_len) - (4*iph->ihl);
 		                                 ^

CHECK: spaces preferred around that '*' (ctx:VxV)
#1150: FILE: net/sched/sch_cake.c:627:
+		tcph = (struct tcphdr *)((void *)iph + (4*iph->ihl));
 		                                         ^

CHECK: spaces preferred around that '+' (ctx:VxV)
#1155: FILE: net/sched/sch_cake.c:632:
+		tcph = (struct tcphdr *)((void *)ipv6h+sizeof(struct ipv6hdr));
 		                                      ^

CHECK: spaces preferred around that '*' (ctx:VxV)
#1195: FILE: net/sched/sch_cake.c:672:
+			seglen = ntohs(iph_check->tot_len) - (4*iph_check->ihl);
 			                                       ^

CHECK: spaces preferred around that '*' (ctx:VxV)
#1197: FILE: net/sched/sch_cake.c:674:
+				+ (4*iph_check->ihl));
 				    ^

CHECK: spaces preferred around that '*' (ctx:VxV)
#1220: FILE: net/sched/sch_cake.c:697:
+		    ((seglen - 4*tcph_check->doff) != 0)) {
 		                ^

CHECK: Unnecessary parentheses around 'tcph_check->source != tcph->source'
#1229: FILE: net/sched/sch_cake.c:706:
+		if ((tcph_check->source != tcph->source) ||
+		    (tcph_check->dest != tcph->dest) ||
+		    (iph_check->version == 4 && iph->version == 4 &&
+			((iph_check->saddr != iph->saddr) ||
+			 (iph_check->daddr != iph->daddr))) ||
+		    (ipv6h_check->version == 6 && ipv6h->version == 6 &&
+			(ipv6_addr_cmp(&ipv6h_check->saddr, &ipv6h->saddr) ||
+			 ipv6_addr_cmp(&ipv6h_check->daddr, &ipv6h->daddr)))) {

CHECK: Unnecessary parentheses around 'tcph_check->dest != tcph->dest'
#1229: FILE: net/sched/sch_cake.c:706:
+		if ((tcph_check->source != tcph->source) ||
+		    (tcph_check->dest != tcph->dest) ||
+		    (iph_check->version == 4 && iph->version == 4 &&
+			((iph_check->saddr != iph->saddr) ||
+			 (iph_check->daddr != iph->daddr))) ||
+		    (ipv6h_check->version == 6 && ipv6h->version == 6 &&
+			(ipv6_addr_cmp(&ipv6h_check->saddr, &ipv6h->saddr) ||
+			 ipv6_addr_cmp(&ipv6h_check->daddr, &ipv6h->daddr)))) {

CHECK: Unnecessary parentheses around 'iph_check->saddr != iph->saddr'
#1229: FILE: net/sched/sch_cake.c:706:
+		if ((tcph_check->source != tcph->source) ||
+		    (tcph_check->dest != tcph->dest) ||
+		    (iph_check->version == 4 && iph->version == 4 &&
+			((iph_check->saddr != iph->saddr) ||
+			 (iph_check->daddr != iph->daddr))) ||
+		    (ipv6h_check->version == 6 && ipv6h->version == 6 &&
+			(ipv6_addr_cmp(&ipv6h_check->saddr, &ipv6h->saddr) ||
+			 ipv6_addr_cmp(&ipv6h_check->daddr, &ipv6h->daddr)))) {

CHECK: Unnecessary parentheses around 'iph_check->daddr != iph->daddr'
#1229: FILE: net/sched/sch_cake.c:706:
+		if ((tcph_check->source != tcph->source) ||
+		    (tcph_check->dest != tcph->dest) ||
+		    (iph_check->version == 4 && iph->version == 4 &&
+			((iph_check->saddr != iph->saddr) ||
+			 (iph_check->daddr != iph->daddr))) ||
+		    (ipv6h_check->version == 6 && ipv6h->version == 6 &&
+			(ipv6_addr_cmp(&ipv6h_check->saddr, &ipv6h->saddr) ||
+			 ipv6_addr_cmp(&ipv6h_check->daddr, &ipv6h->daddr)))) {

CHECK: Unnecessary parentheses around 'skb_check != flow->head'
#1243: FILE: net/sched/sch_cake.c:720:
+			if (!rogue_ack && (skb_check != flow->head))

WARNING: braces {} are not necessary for single statement blocks
#1277: FILE: net/sched/sch_cake.c:754:
+	if (q->rate_mpu && out < q->rate_mpu) {
+		out = q->rate_mpu;
+	}

ERROR: space required before the open parenthesis '('
#1285: FILE: net/sched/sch_cake.c:762:
+	} else if(q->rate_flags & CAKE_FLAG_PTM) {

CHECK: Alignment should match open parenthesis
#1297: FILE: net/sched/sch_cake.c:774:
+static inline cobalt_time_t cake_ewma(cobalt_time_t avg, cobalt_time_t sample,
+				     u32 shift)

ERROR: space required after that ',' (ctx:VxV)
#1327: FILE: net/sched/sch_cake.c:804:
+	u32 mb = cake_heap_get_backlog(q,m);
 	                                ^

ERROR: space required before the open parenthesis '('
#1329: FILE: net/sched/sch_cake.c:806:
+	while(m < a) {

CHECK: spaces preferred around that '+' (ctx:VxV)
#1330: FILE: net/sched/sch_cake.c:807:
+		u32 l = m+m+1;
 		         ^

CHECK: spaces preferred around that '+' (ctx:VxV)
#1330: FILE: net/sched/sch_cake.c:807:
+		u32 l = m+m+1;
 		           ^

CHECK: spaces preferred around that '+' (ctx:VxV)
#1331: FILE: net/sched/sch_cake.c:808:
+		u32 r = l+1;
 		         ^

ERROR: space required before the open parenthesis '('
#1333: FILE: net/sched/sch_cake.c:810:
+		if(l < a) {

ERROR: space required after that ',' (ctx:VxV)
#1334: FILE: net/sched/sch_cake.c:811:
+			u32 lb = cake_heap_get_backlog(q,l);
 			                                ^

ERROR: space required before the open parenthesis '('
#1336: FILE: net/sched/sch_cake.c:813:
+			if(lb > mb) {

ERROR: space required before the open parenthesis '('
#1342: FILE: net/sched/sch_cake.c:819:
+		if(r < a) {

ERROR: space required after that ',' (ctx:VxV)
#1343: FILE: net/sched/sch_cake.c:820:
+			u32 rb = cake_heap_get_backlog(q,r);
 			                                ^

ERROR: space required before the open parenthesis '('
#1345: FILE: net/sched/sch_cake.c:822:
+			if(rb > mb) {

ERROR: space required before the open parenthesis '('
#1351: FILE: net/sched/sch_cake.c:828:
+		if(m != i) {

ERROR: space required after that ',' (ctx:VxV)
#1352: FILE: net/sched/sch_cake.c:829:
+			cake_heap_swap(q,i,m);
 			                ^

ERROR: space required after that ',' (ctx:VxV)
#1352: FILE: net/sched/sch_cake.c:829:
+			cake_heap_swap(q,i,m);
 			                  ^

ERROR: space required before the open parenthesis '('
#1362: FILE: net/sched/sch_cake.c:839:
+	while(i > 0 && i < CAKE_MAX_TINS * CAKE_QUEUES) {

CHECK: spaces preferred around that '-' (ctx:VxV)
#1363: FILE: net/sched/sch_cake.c:840:
+		u16 p = (i-1) >> 1;
 		          ^

ERROR: space required after that ',' (ctx:VxV)
#1364: FILE: net/sched/sch_cake.c:841:
+		u32 ib = cake_heap_get_backlog(q,i);
 		                                ^

ERROR: space required after that ',' (ctx:VxV)
#1365: FILE: net/sched/sch_cake.c:842:
+		u32 pb = cake_heap_get_backlog(q,p);
 		                                ^

ERROR: space required before the open parenthesis '('
#1367: FILE: net/sched/sch_cake.c:844:
+		if(ib > pb) {

ERROR: space required after that ',' (ctx:VxV)
#1368: FILE: net/sched/sch_cake.c:845:
+			cake_heap_swap(q,i,p);
 			                ^

ERROR: space required after that ',' (ctx:VxV)
#1368: FILE: net/sched/sch_cake.c:845:
+			cake_heap_swap(q,i,p);
 			                  ^

WARNING: line over 80 characters
#1376: FILE: net/sched/sch_cake.c:853:
+static void cake_advance_shaper(struct cake_sched_data *q, struct cake_tin_data *b, u32 len, u64 now);

ERROR: space required before the open parenthesis '('
#1388: FILE: net/sched/sch_cake.c:865:
+	if(!q->overflow_timeout) {

ERROR: space required before the open parenthesis '('
#1391: FILE: net/sched/sch_cake.c:868:
+		for(i = CAKE_MAX_TINS * CAKE_QUEUES / 2; i >= 0; i--)

ERROR: space required after that ',' (ctx:VxV)
#1392: FILE: net/sched/sch_cake.c:869:
+			cake_heapify(q,i);
 			              ^

ERROR: space required before the open parenthesis '('
#1404: FILE: net/sched/sch_cake.c:881:
+	if(unlikely(!skb)) {

ERROR: space required before the open parenthesis '('
#1410: FILE: net/sched/sch_cake.c:887:
+	if(cobalt_queue_full(&flow->cvars, &b->cparams, now))

ERROR: space required before the open parenthesis '('
#1423: FILE: net/sched/sch_cake.c:900:
+	if(q->rate_flags & CAKE_FLAG_INGRESS)

ERROR: space required after that ',' (ctx:VxV)
#1429: FILE: net/sched/sch_cake.c:906:
+	cake_heapify(q,0);
 	              ^

WARNING: line over 80 characters
#1476: FILE: net/sched/sch_cake.c:953:
+static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free)

WARNING: line over 80 characters
#1516: FILE: net/sched/sch_cake.c:993:
+				qdisc_watchdog_schedule_ns(&q->watchdog, q->time_next_packet);

WARNING: Missing a blank line after declarations
#1535: FILE: net/sched/sch_cake.c:1012:
+		int slen = 0;
+		segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK);

CHECK: Alignment should match open parenthesis
#1555: FILE: net/sched/sch_cake.c:1032:
+				qdisc_tree_reduce_backlog(sch, 1,
+					qdisc_pkt_len(skb_filtered_ack));

CHECK: Alignment should match open parenthesis
#1587: FILE: net/sched/sch_cake.c:1064:
+			qdisc_tree_reduce_backlog(sch, 1,
+				qdisc_pkt_len(skb_filtered_ack));

ERROR: space required before the open parenthesis '('
#1602: FILE: net/sched/sch_cake.c:1079:
+	if(q->overflow_timeout)

ERROR: that open brace { should be on the previous line
#1606: FILE: net/sched/sch_cake.c:1083:
+	if (q->rate_flags & CAKE_FLAG_AUTORATE_INGRESS)
+	{

CHECK: Alignment should match open parenthesis
#1615: FILE: net/sched/sch_cake.c:1092:
+		q->avg_packet_interval = cake_ewma(q->avg_packet_interval,
+			packet_interval,

CHECK: No space is necessary after a cast
#1622: FILE: net/sched/sch_cake.c:1099:
+			u64 b = q->avg_window_bytes * (u64) NSEC_PER_SEC;

CHECK: Alignment should match open parenthesis
#1627: FILE: net/sched/sch_cake.c:1104:
+				cake_ewma(q->avg_peak_bandwidth, b,
+					b > q->avg_peak_bandwidth ? 2 : 8);

CHECK: Alignment should match open parenthesis
#1632: FILE: net/sched/sch_cake.c:1109:
+			if (q->rate_flags & CAKE_FLAG_AUTORATE_INGRESS &&
+				now - q->last_reconfig_time >

CHECK: Unnecessary parentheses around b->hosts[flow->srchost]
#1645: FILE: net/sched/sch_cake.c:1122:
+		struct cake_host *srchost = &(b->hosts[flow->srchost]);

CHECK: Unnecessary parentheses around b->hosts[flow->dsthost]
#1646: FILE: net/sched/sch_cake.c:1123:
+		struct cake_host *dsthost = &(b->hosts[flow->dsthost]);

ERROR: space required before the open parenthesis '('
#1649: FILE: net/sched/sch_cake.c:1126:
+		if(!flow->set) {

ERROR: space required before the open parenthesis '('
#1658: FILE: net/sched/sch_cake.c:1135:
+		if((q->flow_mode & CAKE_FLOW_DUAL_SRC) == CAKE_FLOW_DUAL_SRC)

ERROR: space required before the open parenthesis '('
#1661: FILE: net/sched/sch_cake.c:1138:
+		if((q->flow_mode & CAKE_FLOW_DUAL_DST) == CAKE_FLOW_DUAL_DST)

WARNING: line over 80 characters
#1664: FILE: net/sched/sch_cake.c:1141:
+		flow->deficit = (b->flow_quantum * quantum_div[host_load]) >> 16;

ERROR: space required before the open parenthesis '('
#1665: FILE: net/sched/sch_cake.c:1142:
+	} else if(flow->set == CAKE_SET_SPARSE_WAIT) {

WARNING: line over 80 characters
#1666: FILE: net/sched/sch_cake.c:1143:
+		/* this flow was empty, accounted as a sparse flow, but actually in the bulk rotation */

ERROR: space required before the open parenthesis '('
#1706: FILE: net/sched/sch_cake.c:1183:
+		if(q->overflow_timeout)

ERROR: space required before the open parenthesis '('
#1750: FILE: net/sched/sch_cake.c:1227:
+	if(!q->rate_ns) {

WARNING: line over 80 characters
#1751: FILE: net/sched/sch_cake.c:1228:
+		/* in unlimited mode, can't rely on shaper timings, just balance with DRR */

WARNING: line over 80 characters
#1752: FILE: net/sched/sch_cake.c:1229:
+		while (b->tin_deficit < 0 || !(b->sparse_flow_count + b->bulk_flow_count)) {

WARNING: line over 80 characters
#1765: FILE: net/sched/sch_cake.c:1242:
+		 * - the highest-priority tin with queue and meeting schedule, if any

ERROR: spaces required around that '=' (ctx:VxV)
#1768: FILE: net/sched/sch_cake.c:1245:
+		int oi, best_tin=0;
 		                ^

ERROR: spaces required around that '=' (ctx:VxV)
#1771: FILE: net/sched/sch_cake.c:1248:
+		for(oi=0; oi < q->tin_cnt; oi++) {
 		      ^

ERROR: space required before the open parenthesis '('
#1771: FILE: net/sched/sch_cake.c:1248:
+		for(oi=0; oi < q->tin_cnt; oi++) {

WARNING: Missing a blank line after declarations
#1773: FILE: net/sched/sch_cake.c:1250:
+			int tin = q->tin_order[oi];
+			b = q->tins + tin;

ERROR: space required before the open parenthesis '('
#1774: FILE: net/sched/sch_cake.c:1251:
+			if((b->sparse_flow_count + b->bulk_flow_count) > 0) {

WARNING: Missing a blank line after declarations
#1776: FILE: net/sched/sch_cake.c:1253:
+				s64 tdiff = b->tin_time_next_packet - now;
+				if(tdiff <= 0 || tdiff <= best_time) {

ERROR: space required before the open parenthesis '('
#1776: FILE: net/sched/sch_cake.c:1253:
+				if(tdiff <= 0 || tdiff <= best_time) {

CHECK: Unnecessary parentheses around b->hosts[flow->srchost]
#1806: FILE: net/sched/sch_cake.c:1283:
+	srchost = &(b->hosts[flow->srchost]);

CHECK: Unnecessary parentheses around b->hosts[flow->dsthost]
#1807: FILE: net/sched/sch_cake.c:1284:
+	dsthost = &(b->hosts[flow->dsthost]);

ERROR: space required before the open parenthesis '('
#1810: FILE: net/sched/sch_cake.c:1287:
+	if((q->flow_mode & CAKE_FLOW_DUAL_SRC) == CAKE_FLOW_DUAL_SRC)

ERROR: space required before the open parenthesis '('
#1813: FILE: net/sched/sch_cake.c:1290:
+	if((q->flow_mode & CAKE_FLOW_DUAL_DST) == CAKE_FLOW_DUAL_DST)

WARNING: line over 80 characters
#1820: FILE: net/sched/sch_cake.c:1297:
+		flow->deficit += (b->flow_quantum * quantum_div[host_load] + (prandom_u32() >> 16)) >> 16;

WARNING: line over 80 characters
#1823: FILE: net/sched/sch_cake.c:1300:
+		/* here we keep all flows with deficits out of the sparse and decaying rotations

WARNING: line over 80 characters
#1824: FILE: net/sched/sch_cake.c:1301:
+		   no non-empty flow can go into the decaying rotation, so they can't get deficits */

WARNING: Block comments use * on subsequent lines
#1824: FILE: net/sched/sch_cake.c:1301:
+		/* here we keep all flows with deficits out of the sparse and decaying rotations
+		   no non-empty flow can go into the decaying rotation, so they can't get deficits */

WARNING: Block comments use a trailing */ on a separate line
#1824: FILE: net/sched/sch_cake.c:1301:
+		   no non-empty flow can go into the decaying rotation, so they can't get deficits */

WARNING: line over 80 characters
#1831: FILE: net/sched/sch_cake.c:1308:
+				// we've moved it to the bulk rotation for correct deficit accounting

WARNING: line over 80 characters
#1832: FILE: net/sched/sch_cake.c:1309:
+				// but we still want to count it as a sparse flow, not a bulk one

ERROR: space required before the open parenthesis '('
#1840: FILE: net/sched/sch_cake.c:1317:
+	while(1) {

ERROR: space required before the open parenthesis '('
#1842: FILE: net/sched/sch_cake.c:1319:
+		if(!skb) {

ERROR: space required before the open parenthesis '('
#1844: FILE: net/sched/sch_cake.c:1321:
+			if(cobalt_queue_empty(&flow->cvars, &b->cparams, now))

WARNING: line over 80 characters
#1847: FILE: net/sched/sch_cake.c:1324:
+			if (flow->cvars.p_drop || flow->cvars.count || (now - flow->cvars.drop_next) < 0) {

WARNING: line over 80 characters
#1848: FILE: net/sched/sch_cake.c:1325:
+				/* keep in the flowchain until the state has decayed to rest */

WARNING: line over 80 characters
#1849: FILE: net/sched/sch_cake.c:1326:
+				list_move_tail(&flow->flowchain, &b->decaying_flows);

ERROR: space required before the open parenthesis '('
#1850: FILE: net/sched/sch_cake.c:1327:
+				if(flow->set == CAKE_SET_BULK) {

WARNING: line over 80 characters
#1853: FILE: net/sched/sch_cake.c:1330:
+				} else if (flow->set == CAKE_SET_SPARSE || flow->set == CAKE_SET_SPARSE_WAIT) {

WARNING: line over 80 characters
#1861: FILE: net/sched/sch_cake.c:1338:
+				if (flow->set == CAKE_SET_SPARSE || flow->set == CAKE_SET_SPARSE_WAIT)

ERROR: space required before the open parenthesis '('
#1863: FILE: net/sched/sch_cake.c:1340:
+				else if(flow->set == CAKE_SET_BULK)

WARNING: line over 80 characters
#1876: FILE: net/sched/sch_cake.c:1353:
+		if(!cobalt_should_drop(&flow->cvars, &b->cparams, now, skb) || !flow->head)

ERROR: space required before the open parenthesis '('
#1876: FILE: net/sched/sch_cake.c:1353:
+		if(!cobalt_should_drop(&flow->cvars, &b->cparams, now, skb) || !flow->head)

ERROR: space required before the open parenthesis '('
#1880: FILE: net/sched/sch_cake.c:1357:
+		if(q->rate_flags & CAKE_FLAG_INGRESS) {

ERROR: space required before the open parenthesis '('
#1890: FILE: net/sched/sch_cake.c:1367:
+		if(q->rate_flags & CAKE_FLAG_INGRESS)

CHECK: Alignment should match open parenthesis
#1905: FILE: net/sched/sch_cake.c:1382:
+	b->peak_delay = cake_ewma(b->peak_delay, delay,
+				     delay > b->peak_delay ? 2 : 8);

CHECK: Alignment should match open parenthesis
#1907: FILE: net/sched/sch_cake.c:1384:
+	b->base_delay = cake_ewma(b->base_delay, delay,
+				     delay < b->base_delay ? 2 : 8);

ERROR: space required before the open parenthesis '('
#1912: FILE: net/sched/sch_cake.c:1389:
+	} else if(!sch->q.qlen) {

WARNING: Missing a blank line after declarations
#1914: FILE: net/sched/sch_cake.c:1391:
+		int i;
+		for(i=0; i < q->tin_cnt; i++) {

ERROR: spaces required around that '=' (ctx:VxV)
#1914: FILE: net/sched/sch_cake.c:1391:
+		for(i=0; i < q->tin_cnt; i++) {
 		     ^

ERROR: space required before the open parenthesis '('
#1914: FILE: net/sched/sch_cake.c:1391:
+		for(i=0; i < q->tin_cnt; i++) {

ERROR: space required before the open parenthesis '('
#1915: FILE: net/sched/sch_cake.c:1392:
+			if(q->tins[i].decaying_flow_count) {

WARNING: line over 80 characters
#1916: FILE: net/sched/sch_cake.c:1393:
+				qdisc_watchdog_schedule_ns(&q->watchdog, now + q->tins[i].cparams.target);

ERROR: space required before the open parenthesis '('
#1922: FILE: net/sched/sch_cake.c:1399:
+	if(q->overflow_timeout)

WARNING: line over 80 characters
#1928: FILE: net/sched/sch_cake.c:1405:
+static void cake_advance_shaper(struct cake_sched_data *q, struct cake_tin_data *b, u32 len, u64 now)

ERROR: space required before the open parenthesis '('
#1933: FILE: net/sched/sch_cake.c:1410:
+	if(q->rate_ns) {

ERROR: space required before the open parenthesis '('
#1938: FILE: net/sched/sch_cake.c:1415:
+		if(tdiff1 < 0)

ERROR: space required before the open parenthesis '('
#1940: FILE: net/sched/sch_cake.c:1417:
+		else if(tdiff1 < tdiff2)

CHECK: No space is necessary after a cast
#1989: FILE: net/sched/sch_cake.c:1466:
+		rate_ns = ((u64) NSEC_PER_SEC) << rate_shft;

CHECK: Alignment should match open parenthesis
#2048: FILE: net/sched/sch_cake.c:1525:
+		cake_set_rate(b, rate, mtu, US2TIME(q->target),
+				US2TIME(q->interval));

WARNING: Block comments should align the * on each line
#2125: FILE: net/sched/sch_cake.c:1602:
+ *		Total 8 traffic classes.
+*/

CHECK: Alignment should match open parenthesis
#2145: FILE: net/sched/sch_cake.c:1622:
+		cake_set_rate(b, rate, mtu, US2TIME(q->target),
+				US2TIME(q->interval));

CHECK: spaces preferred around that '/' (ctx:VxV)
#2276: FILE: net/sched/sch_cake.c:1753:
+	cake_set_rate(&q->tins[0], rate/3, mtu,
 	                               ^

CHECK: spaces preferred around that '/' (ctx:VxV)
#2278: FILE: net/sched/sch_cake.c:1755:
+	cake_set_rate(&q->tins[1], rate/3, mtu,
 	                               ^

CHECK: spaces preferred around that '/' (ctx:VxV)
#2280: FILE: net/sched/sch_cake.c:1757:
+	cake_set_rate(&q->tins[2], rate/3, mtu,
 	                               ^

WARNING: Avoid crashing the kernel - try using WARN_ON & recovery code rather than BUG() or BUG_ON()
#2336: FILE: net/sched/sch_cake.c:1813:
+	BUG_ON(q->tin_cnt > CAKE_MAX_TINS);

CHECK: No space is necessary after a cast
#2346: FILE: net/sched/sch_cake.c:1823:
+		u64 t = (u64) q->rate_bps * q->interval;

WARNING: Missing a blank line after declarations
#2347: FILE: net/sched/sch_cake.c:1824:
+		u64 t = (u64) q->rate_bps * q->interval;
+		do_div(t, USEC_PER_SEC / 4);

CHECK: Alignment should match open parenthesis
#2359: FILE: net/sched/sch_cake.c:1836:
+	q->buffer_limit = min(q->buffer_limit,
+		max(sch->limit * psched_mtu(qdisc_dev(sch)),

WARNING: line over 80 characters
#2384: FILE: net/sched/sch_cake.c:1861:
+		q->rate_flags |= nla_get_u32(tb[TCA_CAKE_ATM]) & (CAKE_FLAG_ATM | CAKE_FLAG_PTM);

WARNING: line over 80 characters
#2399: FILE: net/sched/sch_cake.c:1876:
+		q->flow_mode |= CAKE_FLOW_NAT_FLAG * !!nla_get_u32(tb[TCA_CAKE_NAT]);

WARNING: line over 80 characters
#2404: FILE: net/sched/sch_cake.c:1881:
+			q->rate_overhead = -(nla_get_s32(tb[TCA_CAKE_ETHERNET]));

WARNING: braces {} are not necessary for single statement blocks
#2410: FILE: net/sched/sch_cake.c:1887:
+	if (tb[TCA_CAKE_MPU]) {
+		q->rate_mpu = nla_get_u32(tb[TCA_CAKE_MPU]);
+	}

ERROR: spaces required around that '=' (ctx:VxV)
#2516: FILE: net/sched/sch_cake.c:1993:
+	for(i=1; i <= CAKE_QUEUES; i++)
 	     ^

ERROR: space required before the open parenthesis '('
#2516: FILE: net/sched/sch_cake.c:1993:
+	for(i=1; i <= CAKE_QUEUES; i++)

CHECK: spaces preferred around that '*' (ctx:VxV)
#2537: FILE: net/sched/sch_cake.c:2014:
+			u32 k = j*CAKE_MAX_TINS + i;
 			         ^

WARNING: line over 80 characters
#2572: FILE: net/sched/sch_cake.c:2049:
+	if (nla_put_u32(skb, TCA_CAKE_ATM, (q->rate_flags & (CAKE_FLAG_ATM | CAKE_FLAG_PTM))))

WARNING: line over 80 characters
#2582: FILE: net/sched/sch_cake.c:2059:
+	if (nla_put_u32(skb, TCA_CAKE_OVERHEAD, q->rate_overhead + qdisc_dev(sch)->hard_header_len))

WARNING: line over 80 characters
#2588: FILE: net/sched/sch_cake.c:2065:
+	if (nla_put_u32(skb, TCA_CAKE_ETHERNET, qdisc_dev(sch)->hard_header_len))

WARNING: Avoid crashing the kernel - try using WARN_ON & recovery code rather than BUG() or BUG_ON()
#2628: FILE: net/sched/sch_cake.c:2105:
+	BUG_ON(q->tin_cnt > TC_CAKE_MAX_TINS);

WARNING: line over 80 characters
#2657: FILE: net/sched/sch_cake.c:2134:
+		st->sparse_flows[i]      = b->sparse_flow_count + b->decaying_flow_count;

ERROR: Missing Signed-off-by: line(s)

total: 102 errors, 76 warnings, 48 checks, 2651 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

0001-Attempt-at-cake-backport.patch has style problems, please review.

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.


More information about the Cake mailing list