Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'net-sched-sch_cake-fixes-for-cake_mq'

Jonas Köppeler says:

====================
net/sched: sch_cake: fixes for cake_mq

This patch contains two fixes for cake_mq:
- do not sync when bandwidth is unlimited
- adjust the rates for all tins during sync
====================

Link: https://patch.msgid.link/20260226-cake-mq-skip-sync-bandwidth-unlimited-v1-0-01830bb4db87@tu-berlin.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+25 -28
+25 -28
net/sched/sch_cake.c
··· 391 391 1239850263, 1191209601, 1147878294, 1108955788 392 392 }; 393 393 394 - static void cake_set_rate(struct cake_tin_data *b, u64 rate, u32 mtu, 395 - u64 target_ns, u64 rtt_est_ns); 394 + static void cake_configure_rates(struct Qdisc *sch, u64 rate, bool rate_adjust); 395 + 396 396 /* http://en.wikipedia.org/wiki/Methods_of_computing_square_roots 397 397 * new_invsqrt = (invsqrt / 2) * (3 - count * invsqrt^2) 398 398 * ··· 2013 2013 u64 delay; 2014 2014 u32 len; 2015 2015 2016 - if (q->config->is_shared && now - q->last_checked_active >= q->config->sync_time) { 2016 + if (q->config->is_shared && q->rate_ns && 2017 + now - q->last_checked_active >= q->config->sync_time) { 2017 2018 struct net_device *dev = qdisc_dev(sch); 2018 2019 struct cake_sched_data *other_priv; 2019 2020 u64 new_rate = q->config->rate_bps; ··· 2040 2039 if (num_active_qs > 1) 2041 2040 new_rate = div64_u64(q->config->rate_bps, num_active_qs); 2042 2041 2043 - /* mtu = 0 is used to only update the rate and not mess with cobalt params */ 2044 - cake_set_rate(b, new_rate, 0, 0, 0); 2042 + cake_configure_rates(sch, new_rate, true); 2045 2043 q->last_checked_active = now; 2046 2044 q->active_queues = num_active_qs; 2047 - q->rate_ns = b->tin_rate_ns; 2048 - q->rate_shft = b->tin_rate_shft; 2049 2045 } 2050 2046 2051 2047 begin: ··· 2359 2361 b->cparams.p_dec = 1 << 20; /* 1/4096 */ 2360 2362 } 2361 2363 2362 - static int cake_config_besteffort(struct Qdisc *sch) 2364 + static int cake_config_besteffort(struct Qdisc *sch, u64 rate, u32 mtu) 2363 2365 { 2364 2366 struct cake_sched_data *q = qdisc_priv(sch); 2365 2367 struct cake_tin_data *b = &q->tins[0]; 2366 - u32 mtu = psched_mtu(qdisc_dev(sch)); 2367 - u64 rate = q->config->rate_bps; 2368 2368 2369 2369 q->tin_cnt = 1; 2370 2370 ··· 2376 2380 return 0; 2377 2381 } 2378 2382 2379 - static int cake_config_precedence(struct Qdisc *sch) 2383 + static int cake_config_precedence(struct Qdisc *sch, u64 rate, u32 mtu) 2380 2384 { 2381 2385 /* convert high-level (user visible) parameters into internal format */ 2382 2386 struct cake_sched_data *q = qdisc_priv(sch); 2383 - u32 mtu = psched_mtu(qdisc_dev(sch)); 2384 - u64 rate = q->config->rate_bps; 2385 2387 u32 quantum = 256; 2386 2388 u32 i; 2387 2389 ··· 2450 2456 * Total 12 traffic classes. 2451 2457 */ 2452 2458 2453 - static int cake_config_diffserv8(struct Qdisc *sch) 2459 + static int cake_config_diffserv8(struct Qdisc *sch, u64 rate, u32 mtu) 2454 2460 { 2455 2461 /* Pruned list of traffic classes for typical applications: 2456 2462 * ··· 2467 2473 */ 2468 2474 2469 2475 struct cake_sched_data *q = qdisc_priv(sch); 2470 - u32 mtu = psched_mtu(qdisc_dev(sch)); 2471 - u64 rate = q->config->rate_bps; 2472 2476 u32 quantum = 256; 2473 2477 u32 i; 2474 2478 ··· 2496 2504 return 0; 2497 2505 } 2498 2506 2499 - static int cake_config_diffserv4(struct Qdisc *sch) 2507 + static int cake_config_diffserv4(struct Qdisc *sch, u64 rate, u32 mtu) 2500 2508 { 2501 2509 /* Further pruned list of traffic classes for four-class system: 2502 2510 * ··· 2509 2517 */ 2510 2518 2511 2519 struct cake_sched_data *q = qdisc_priv(sch); 2512 - u32 mtu = psched_mtu(qdisc_dev(sch)); 2513 - u64 rate = q->config->rate_bps; 2514 2520 u32 quantum = 1024; 2515 2521 2516 2522 q->tin_cnt = 4; ··· 2536 2546 return 0; 2537 2547 } 2538 2548 2539 - static int cake_config_diffserv3(struct Qdisc *sch) 2549 + static int cake_config_diffserv3(struct Qdisc *sch, u64 rate, u32 mtu) 2540 2550 { 2541 2551 /* Simplified Diffserv structure with 3 tins. 2542 2552 * Latency Sensitive (CS7, CS6, EF, VA, TOS4) ··· 2544 2554 * Low Priority (LE, CS1) 2545 2555 */ 2546 2556 struct cake_sched_data *q = qdisc_priv(sch); 2547 - u32 mtu = psched_mtu(qdisc_dev(sch)); 2548 - u64 rate = q->config->rate_bps; 2549 2557 u32 quantum = 1024; 2550 2558 2551 2559 q->tin_cnt = 3; ··· 2568 2580 return 0; 2569 2581 } 2570 2582 2571 - static void cake_reconfigure(struct Qdisc *sch) 2583 + static void cake_configure_rates(struct Qdisc *sch, u64 rate, bool rate_adjust) 2572 2584 { 2585 + u32 mtu = likely(rate_adjust) ? 0 : psched_mtu(qdisc_dev(sch)); 2573 2586 struct cake_sched_data *qd = qdisc_priv(sch); 2574 2587 struct cake_sched_config *q = qd->config; 2575 2588 int c, ft; 2576 2589 2577 2590 switch (q->tin_mode) { 2578 2591 case CAKE_DIFFSERV_BESTEFFORT: 2579 - ft = cake_config_besteffort(sch); 2592 + ft = cake_config_besteffort(sch, rate, mtu); 2580 2593 break; 2581 2594 2582 2595 case CAKE_DIFFSERV_PRECEDENCE: 2583 - ft = cake_config_precedence(sch); 2596 + ft = cake_config_precedence(sch, rate, mtu); 2584 2597 break; 2585 2598 2586 2599 case CAKE_DIFFSERV_DIFFSERV8: 2587 - ft = cake_config_diffserv8(sch); 2600 + ft = cake_config_diffserv8(sch, rate, mtu); 2588 2601 break; 2589 2602 2590 2603 case CAKE_DIFFSERV_DIFFSERV4: 2591 - ft = cake_config_diffserv4(sch); 2604 + ft = cake_config_diffserv4(sch, rate, mtu); 2592 2605 break; 2593 2606 2594 2607 case CAKE_DIFFSERV_DIFFSERV3: 2595 2608 default: 2596 - ft = cake_config_diffserv3(sch); 2609 + ft = cake_config_diffserv3(sch, rate, mtu); 2597 2610 break; 2598 2611 } 2599 2612 ··· 2605 2616 2606 2617 qd->rate_ns = qd->tins[ft].tin_rate_ns; 2607 2618 qd->rate_shft = qd->tins[ft].tin_rate_shft; 2619 + } 2620 + 2621 + static void cake_reconfigure(struct Qdisc *sch) 2622 + { 2623 + struct cake_sched_data *qd = qdisc_priv(sch); 2624 + struct cake_sched_config *q = qd->config; 2625 + 2626 + cake_configure_rates(sch, qd->config->rate_bps, false); 2608 2627 2609 2628 if (q->buffer_config_limit) { 2610 2629 qd->buffer_limit = q->buffer_config_limit;