Skip to content

Commit e551755

Browse files
vladimirolteandavem330
authored andcommitted
net/sched: taprio: rename close_time to end_time
There is a confusion in terms in taprio which makes what is called "close_time" to be actually used for 2 things: 1. determining when an entry "closes" such that transmitted skbs are never allowed to overrun that time (?!) 2. an aid for determining when to advance and/or restart the schedule using the hrtimer It makes more sense to call this so-called "close_time" "end_time", because it's not clear at all to me what "closes". Future patches will hopefully make better use of the term "to close". This is an absolutely mechanical change. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Kurt Kanzenbach <kurt@linutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent a306a90 commit e551755

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

net/sched/sch_taprio.c

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ struct sched_entry {
4545
u64 gate_duration[TC_MAX_QUEUE];
4646
struct list_head list;
4747

48-
/* The instant that this entry "closes" and the next one
48+
/* The instant that this entry ends and the next one
4949
* should open, the qdisc will make some effort so that no
5050
* packet leaves after this time.
5151
*/
52-
ktime_t close_time;
52+
ktime_t end_time;
5353
ktime_t next_txtime;
5454
atomic_t budget;
5555
int index;
@@ -66,7 +66,7 @@ struct sched_gate_list {
6666
struct rcu_head rcu;
6767
struct list_head entries;
6868
size_t num_entries;
69-
ktime_t cycle_close_time;
69+
ktime_t cycle_end_time;
7070
s64 cycle_time;
7171
s64 cycle_time_extension;
7272
s64 base_time;
@@ -606,7 +606,7 @@ static struct sk_buff *taprio_dequeue_from_txq(struct Qdisc *sch, int txq,
606606
* guard band ...
607607
*/
608608
if (gate_mask != TAPRIO_ALL_GATES_OPEN &&
609-
ktime_after(guard, entry->close_time))
609+
ktime_after(guard, entry->end_time))
610610
return NULL;
611611

612612
/* ... and no budget. */
@@ -738,15 +738,15 @@ static bool should_restart_cycle(const struct sched_gate_list *oper,
738738
if (list_is_last(&entry->list, &oper->entries))
739739
return true;
740740

741-
if (ktime_compare(entry->close_time, oper->cycle_close_time) == 0)
741+
if (ktime_compare(entry->end_time, oper->cycle_end_time) == 0)
742742
return true;
743743

744744
return false;
745745
}
746746

747747
static bool should_change_schedules(const struct sched_gate_list *admin,
748748
const struct sched_gate_list *oper,
749-
ktime_t close_time)
749+
ktime_t end_time)
750750
{
751751
ktime_t next_base_time, extension_time;
752752

@@ -755,18 +755,18 @@ static bool should_change_schedules(const struct sched_gate_list *admin,
755755

756756
next_base_time = sched_base_time(admin);
757757

758-
/* This is the simple case, the close_time would fall after
758+
/* This is the simple case, the end_time would fall after
759759
* the next schedule base_time.
760760
*/
761-
if (ktime_compare(next_base_time, close_time) <= 0)
761+
if (ktime_compare(next_base_time, end_time) <= 0)
762762
return true;
763763

764-
/* This is the cycle_time_extension case, if the close_time
764+
/* This is the cycle_time_extension case, if the end_time
765765
* plus the amount that can be extended would fall after the
766766
* next schedule base_time, we can extend the current schedule
767767
* for that amount.
768768
*/
769-
extension_time = ktime_add_ns(close_time, oper->cycle_time_extension);
769+
extension_time = ktime_add_ns(end_time, oper->cycle_time_extension);
770770

771771
/* FIXME: the IEEE 802.1Q-2018 Specification isn't clear about
772772
* how precisely the extension should be made. So after
@@ -785,7 +785,7 @@ static enum hrtimer_restart advance_sched(struct hrtimer *timer)
785785
struct sched_gate_list *oper, *admin;
786786
struct sched_entry *entry, *next;
787787
struct Qdisc *sch = q->root;
788-
ktime_t close_time;
788+
ktime_t end_time;
789789

790790
spin_lock(&q->current_entry_lock);
791791
entry = rcu_dereference_protected(q->current_entry,
@@ -804,41 +804,41 @@ static enum hrtimer_restart advance_sched(struct hrtimer *timer)
804804
* entry of all schedules are pre-calculated during the
805805
* schedule initialization.
806806
*/
807-
if (unlikely(!entry || entry->close_time == oper->base_time)) {
807+
if (unlikely(!entry || entry->end_time == oper->base_time)) {
808808
next = list_first_entry(&oper->entries, struct sched_entry,
809809
list);
810-
close_time = next->close_time;
810+
end_time = next->end_time;
811811
goto first_run;
812812
}
813813

814814
if (should_restart_cycle(oper, entry)) {
815815
next = list_first_entry(&oper->entries, struct sched_entry,
816816
list);
817-
oper->cycle_close_time = ktime_add_ns(oper->cycle_close_time,
818-
oper->cycle_time);
817+
oper->cycle_end_time = ktime_add_ns(oper->cycle_end_time,
818+
oper->cycle_time);
819819
} else {
820820
next = list_next_entry(entry, list);
821821
}
822822

823-
close_time = ktime_add_ns(entry->close_time, next->interval);
824-
close_time = min_t(ktime_t, close_time, oper->cycle_close_time);
823+
end_time = ktime_add_ns(entry->end_time, next->interval);
824+
end_time = min_t(ktime_t, end_time, oper->cycle_end_time);
825825

826-
if (should_change_schedules(admin, oper, close_time)) {
826+
if (should_change_schedules(admin, oper, end_time)) {
827827
/* Set things so the next time this runs, the new
828828
* schedule runs.
829829
*/
830-
close_time = sched_base_time(admin);
830+
end_time = sched_base_time(admin);
831831
switch_schedules(q, &admin, &oper);
832832
}
833833

834-
next->close_time = close_time;
834+
next->end_time = end_time;
835835
taprio_set_budget(q, next);
836836

837837
first_run:
838838
rcu_assign_pointer(q->current_entry, next);
839839
spin_unlock(&q->current_entry_lock);
840840

841-
hrtimer_set_expires(&q->advance_timer, close_time);
841+
hrtimer_set_expires(&q->advance_timer, end_time);
842842

843843
rcu_read_lock();
844844
__netif_schedule(sch);
@@ -1076,8 +1076,8 @@ static int taprio_get_start_time(struct Qdisc *sch,
10761076
return 0;
10771077
}
10781078

1079-
static void setup_first_close_time(struct taprio_sched *q,
1080-
struct sched_gate_list *sched, ktime_t base)
1079+
static void setup_first_end_time(struct taprio_sched *q,
1080+
struct sched_gate_list *sched, ktime_t base)
10811081
{
10821082
struct sched_entry *first;
10831083
ktime_t cycle;
@@ -1088,9 +1088,9 @@ static void setup_first_close_time(struct taprio_sched *q,
10881088
cycle = sched->cycle_time;
10891089

10901090
/* FIXME: find a better place to do this */
1091-
sched->cycle_close_time = ktime_add_ns(base, cycle);
1091+
sched->cycle_end_time = ktime_add_ns(base, cycle);
10921092

1093-
first->close_time = ktime_add_ns(base, first->interval);
1093+
first->end_time = ktime_add_ns(base, first->interval);
10941094
taprio_set_budget(q, first);
10951095
rcu_assign_pointer(q->current_entry, NULL);
10961096
}
@@ -1756,7 +1756,7 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
17561756
if (admin)
17571757
call_rcu(&admin->rcu, taprio_free_sched_cb);
17581758
} else {
1759-
setup_first_close_time(q, new_admin, start);
1759+
setup_first_end_time(q, new_admin, start);
17601760

17611761
/* Protects against advance_sched() */
17621762
spin_lock_irqsave(&q->current_entry_lock, flags);

0 commit comments

Comments
 (0)