mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 10:49:33 +00:00
net/sched: taprio: stop going through private ops for dequeue and peek
Since commit 13511704f8
("net: taprio offload: enforce qdisc to netdev
queue mapping"), taprio_dequeue_soft() and taprio_peek_soft() are de
facto the only implementations for Qdisc_ops :: dequeue and Qdisc_ops ::
peek that taprio provides.
This is because in full offload mode, __dev_queue_xmit() will select a
txq->qdisc which is never root taprio qdisc. So if nothing is enqueued
in the root qdisc, it will never be run and nothing will get dequeued
from it.
Therefore, we can remove the private indirection from taprio, and always
point Qdisc_ops :: dequeue to taprio_dequeue_soft (now simply named
taprio_dequeue) and Qdisc_ops :: peek to taprio_peek_soft (now simply
named taprio_peek).
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
fa65edde5e
commit
25becba629
1 changed files with 12 additions and 46 deletions
|
@ -78,8 +78,6 @@ struct taprio_sched {
|
|||
struct sched_gate_list __rcu *admin_sched;
|
||||
struct hrtimer advance_timer;
|
||||
struct list_head taprio_list;
|
||||
struct sk_buff *(*dequeue)(struct Qdisc *sch);
|
||||
struct sk_buff *(*peek)(struct Qdisc *sch);
|
||||
u32 txtime_delay;
|
||||
};
|
||||
|
||||
|
@ -491,7 +489,7 @@ static int taprio_enqueue(struct sk_buff *skb, struct Qdisc *sch,
|
|||
return taprio_enqueue_one(skb, sch, child, to_free);
|
||||
}
|
||||
|
||||
static struct sk_buff *taprio_peek_soft(struct Qdisc *sch)
|
||||
static struct sk_buff *taprio_peek(struct Qdisc *sch)
|
||||
{
|
||||
struct taprio_sched *q = qdisc_priv(sch);
|
||||
struct net_device *dev = qdisc_dev(sch);
|
||||
|
@ -500,6 +498,11 @@ static struct sk_buff *taprio_peek_soft(struct Qdisc *sch)
|
|||
u32 gate_mask;
|
||||
int i;
|
||||
|
||||
if (unlikely(FULL_OFFLOAD_IS_ENABLED(q->flags))) {
|
||||
WARN_ONCE(1, "Trying to peek into the root of a taprio qdisc configured with full offload\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rcu_read_lock();
|
||||
entry = rcu_dereference(q->current_entry);
|
||||
gate_mask = entry ? entry->gate_mask : TAPRIO_ALL_GATES_OPEN;
|
||||
|
@ -535,20 +538,6 @@ static struct sk_buff *taprio_peek_soft(struct Qdisc *sch)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static struct sk_buff *taprio_peek_offload(struct Qdisc *sch)
|
||||
{
|
||||
WARN_ONCE(1, "Trying to peek into the root of a taprio qdisc configured with full offload\n");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct sk_buff *taprio_peek(struct Qdisc *sch)
|
||||
{
|
||||
struct taprio_sched *q = qdisc_priv(sch);
|
||||
|
||||
return q->peek(sch);
|
||||
}
|
||||
|
||||
static void taprio_set_budget(struct taprio_sched *q, struct sched_entry *entry)
|
||||
{
|
||||
atomic_set(&entry->budget,
|
||||
|
@ -556,7 +545,7 @@ static void taprio_set_budget(struct taprio_sched *q, struct sched_entry *entry)
|
|||
atomic64_read(&q->picos_per_byte)));
|
||||
}
|
||||
|
||||
static struct sk_buff *taprio_dequeue_soft(struct Qdisc *sch)
|
||||
static struct sk_buff *taprio_dequeue(struct Qdisc *sch)
|
||||
{
|
||||
struct taprio_sched *q = qdisc_priv(sch);
|
||||
struct net_device *dev = qdisc_dev(sch);
|
||||
|
@ -565,6 +554,11 @@ static struct sk_buff *taprio_dequeue_soft(struct Qdisc *sch)
|
|||
u32 gate_mask;
|
||||
int i;
|
||||
|
||||
if (unlikely(FULL_OFFLOAD_IS_ENABLED(q->flags))) {
|
||||
WARN_ONCE(1, "Trying to dequeue from the root of a taprio qdisc configured with full offload\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rcu_read_lock();
|
||||
entry = rcu_dereference(q->current_entry);
|
||||
/* if there's no entry, it means that the schedule didn't
|
||||
|
@ -644,20 +638,6 @@ static struct sk_buff *taprio_dequeue_soft(struct Qdisc *sch)
|
|||
return skb;
|
||||
}
|
||||
|
||||
static struct sk_buff *taprio_dequeue_offload(struct Qdisc *sch)
|
||||
{
|
||||
WARN_ONCE(1, "Trying to dequeue from the root of a taprio qdisc configured with full offload\n");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct sk_buff *taprio_dequeue(struct Qdisc *sch)
|
||||
{
|
||||
struct taprio_sched *q = qdisc_priv(sch);
|
||||
|
||||
return q->dequeue(sch);
|
||||
}
|
||||
|
||||
static bool should_restart_cycle(const struct sched_gate_list *oper,
|
||||
const struct sched_entry *entry)
|
||||
{
|
||||
|
@ -1555,17 +1535,6 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
|
|||
q->advance_timer.function = advance_sched;
|
||||
}
|
||||
|
||||
if (FULL_OFFLOAD_IS_ENABLED(q->flags)) {
|
||||
q->dequeue = taprio_dequeue_offload;
|
||||
q->peek = taprio_peek_offload;
|
||||
} else {
|
||||
/* Be sure to always keep the function pointers
|
||||
* in a consistent state.
|
||||
*/
|
||||
q->dequeue = taprio_dequeue_soft;
|
||||
q->peek = taprio_peek_soft;
|
||||
}
|
||||
|
||||
err = taprio_get_start_time(sch, new_admin, &start);
|
||||
if (err < 0) {
|
||||
NL_SET_ERR_MSG(extack, "Internal error: failed get start time");
|
||||
|
@ -1680,9 +1649,6 @@ static int taprio_init(struct Qdisc *sch, struct nlattr *opt,
|
|||
hrtimer_init(&q->advance_timer, CLOCK_TAI, HRTIMER_MODE_ABS);
|
||||
q->advance_timer.function = advance_sched;
|
||||
|
||||
q->dequeue = taprio_dequeue_soft;
|
||||
q->peek = taprio_peek_soft;
|
||||
|
||||
q->root = sch;
|
||||
|
||||
/* We only support static clockids. Use an invalid value as default
|
||||
|
|
Loading…
Reference in a new issue