Commit 25becba6 authored by Vladimir Oltean's avatar Vladimir Oltean Committed by Jakub Kicinski

net/sched: taprio: stop going through private ops for dequeue and peek

Since commit 13511704 ("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: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent fa65edde
...@@ -78,8 +78,6 @@ struct taprio_sched { ...@@ -78,8 +78,6 @@ struct taprio_sched {
struct sched_gate_list __rcu *admin_sched; struct sched_gate_list __rcu *admin_sched;
struct hrtimer advance_timer; struct hrtimer advance_timer;
struct list_head taprio_list; struct list_head taprio_list;
struct sk_buff *(*dequeue)(struct Qdisc *sch);
struct sk_buff *(*peek)(struct Qdisc *sch);
u32 txtime_delay; u32 txtime_delay;
}; };
...@@ -491,7 +489,7 @@ static int taprio_enqueue(struct sk_buff *skb, struct Qdisc *sch, ...@@ -491,7 +489,7 @@ static int taprio_enqueue(struct sk_buff *skb, struct Qdisc *sch,
return taprio_enqueue_one(skb, sch, child, to_free); 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 taprio_sched *q = qdisc_priv(sch);
struct net_device *dev = qdisc_dev(sch); struct net_device *dev = qdisc_dev(sch);
...@@ -500,6 +498,11 @@ static struct sk_buff *taprio_peek_soft(struct Qdisc *sch) ...@@ -500,6 +498,11 @@ static struct sk_buff *taprio_peek_soft(struct Qdisc *sch)
u32 gate_mask; u32 gate_mask;
int i; 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(); rcu_read_lock();
entry = rcu_dereference(q->current_entry); entry = rcu_dereference(q->current_entry);
gate_mask = entry ? entry->gate_mask : TAPRIO_ALL_GATES_OPEN; gate_mask = entry ? entry->gate_mask : TAPRIO_ALL_GATES_OPEN;
...@@ -535,20 +538,6 @@ static struct sk_buff *taprio_peek_soft(struct Qdisc *sch) ...@@ -535,20 +538,6 @@ static struct sk_buff *taprio_peek_soft(struct Qdisc *sch)
return NULL; 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) static void taprio_set_budget(struct taprio_sched *q, struct sched_entry *entry)
{ {
atomic_set(&entry->budget, atomic_set(&entry->budget,
...@@ -556,7 +545,7 @@ static void taprio_set_budget(struct taprio_sched *q, struct sched_entry *entry) ...@@ -556,7 +545,7 @@ static void taprio_set_budget(struct taprio_sched *q, struct sched_entry *entry)
atomic64_read(&q->picos_per_byte))); 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 taprio_sched *q = qdisc_priv(sch);
struct net_device *dev = qdisc_dev(sch); struct net_device *dev = qdisc_dev(sch);
...@@ -565,6 +554,11 @@ static struct sk_buff *taprio_dequeue_soft(struct Qdisc *sch) ...@@ -565,6 +554,11 @@ static struct sk_buff *taprio_dequeue_soft(struct Qdisc *sch)
u32 gate_mask; u32 gate_mask;
int i; 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(); rcu_read_lock();
entry = rcu_dereference(q->current_entry); entry = rcu_dereference(q->current_entry);
/* if there's no entry, it means that the schedule didn't /* 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) ...@@ -644,20 +638,6 @@ static struct sk_buff *taprio_dequeue_soft(struct Qdisc *sch)
return skb; 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, static bool should_restart_cycle(const struct sched_gate_list *oper,
const struct sched_entry *entry) const struct sched_entry *entry)
{ {
...@@ -1555,17 +1535,6 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt, ...@@ -1555,17 +1535,6 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
q->advance_timer.function = advance_sched; 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); err = taprio_get_start_time(sch, new_admin, &start);
if (err < 0) { if (err < 0) {
NL_SET_ERR_MSG(extack, "Internal error: failed get start time"); 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, ...@@ -1680,9 +1649,6 @@ static int taprio_init(struct Qdisc *sch, struct nlattr *opt,
hrtimer_init(&q->advance_timer, CLOCK_TAI, HRTIMER_MODE_ABS); hrtimer_init(&q->advance_timer, CLOCK_TAI, HRTIMER_MODE_ABS);
q->advance_timer.function = advance_sched; q->advance_timer.function = advance_sched;
q->dequeue = taprio_dequeue_soft;
q->peek = taprio_peek_soft;
q->root = sch; q->root = sch;
/* We only support static clockids. Use an invalid value as default /* We only support static clockids. Use an invalid value as default
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment