Re: [PATCH] net/sched: cbs: fix calculation error of idleslope credits

From: kernel test robot
Date: Sat Sep 19 2020 - 07:36:32 EST


Hi Xiaoyong,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.9-rc5 next-20200918]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Xiaoyong-Yan/net-sched-cbs-fix-calculation-error-of-idleslope-credits/20200918-164430
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 10b82d5176488acee2820e5a2cf0f2ec5c3488b6
config: h8300-randconfig-m031-20200917 (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

smatch warnings:
net/sched/sch_cbs.c:224 cbs_dequeue_soft() warn: inconsistent indenting

# https://github.com/0day-ci/linux/commit/6e3656a6f5879070aaee0343f90e633de7d2d85a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Xiaoyong-Yan/net-sched-cbs-fix-calculation-error-of-idleslope-credits/20200918-164430
git checkout 6e3656a6f5879070aaee0343f90e633de7d2d85a
vim +224 net/sched/sch_cbs.c

205
206 static struct sk_buff *cbs_dequeue_soft(struct Qdisc *sch)
207 {
208 struct cbs_sched_data *q = qdisc_priv(sch);
209 struct Qdisc *qdisc = q->qdisc;
210 s64 now = ktime_get_ns();
211 struct sk_buff *skb;
212 s64 credits;
213 int len;
214
215 /* The previous packet is still being sent */
216 if (now < q->last) {
217 cbs_timer_schedule(q, q->last);
218 return NULL;
219 }
220 if (q->credits < 0) {
221 s64 delay;
222
223 delay = delay_from_credits(q->credits, q->idleslope);
> 224 cbs_timer_schedule(q, now+ delay);
225 q->last = now;
226
227 return NULL;
228 }
229 skb = cbs_child_dequeue(sch, qdisc);
230 if (!skb)
231 return NULL;
232
233 len = qdisc_pkt_len(skb);
234
235 /* As sendslope is a negative number, this will decrease the
236 * amount of q->credits.
237 */
238 credits = credits_from_len(len, q->sendslope,
239 atomic64_read(&q->port_rate));
240 credits += q->credits;
241
242 q->credits = max_t(s64, credits, q->locredit);
243 /* Estimate of the transmission of the last byte of the packet in ns */
244 if (unlikely(atomic64_read(&q->port_rate) == 0))
245 q->last = now;
246 else
247 q->last = now + div64_s64(len * NSEC_PER_SEC,
248 atomic64_read(&q->port_rate));
249
250 return skb;
251 }
252

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip