net: sched: Pass ingress block to tcf_classify_ingress
On ingress and cls_act qdiscs init, save the block on ingress mini_Qdisc and and pass it on to ingress classification, so it can be used for the looking up a specified chain index. Co-developed-by: Vlad Buslov <vladbu@mellanox.com> Signed-off-by: Vlad Buslov <vladbu@mellanox.com> Signed-off-by: Paul Blakey <paulb@mellanox.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
Родитель
9410c9409d
Коммит
7d17c544cd
|
@ -72,8 +72,10 @@ static inline struct Qdisc *tcf_block_q(struct tcf_block *block)
|
|||
|
||||
int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
|
||||
struct tcf_result *res, bool compat_mode);
|
||||
int tcf_classify_ingress(struct sk_buff *skb, const struct tcf_proto *tp,
|
||||
struct tcf_result *res, bool compat_mode);
|
||||
int tcf_classify_ingress(struct sk_buff *skb,
|
||||
const struct tcf_block *ingress_block,
|
||||
const struct tcf_proto *tp, struct tcf_result *res,
|
||||
bool compat_mode);
|
||||
|
||||
#else
|
||||
static inline bool tcf_block_shared(struct tcf_block *block)
|
||||
|
@ -137,6 +139,7 @@ static inline int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
|
|||
}
|
||||
|
||||
static inline int tcf_classify_ingress(struct sk_buff *skb,
|
||||
const struct tcf_block *ingress_block,
|
||||
const struct tcf_proto *tp,
|
||||
struct tcf_result *res, bool compat_mode)
|
||||
{
|
||||
|
|
|
@ -1269,6 +1269,7 @@ static inline void psched_ratecfg_getrate(struct tc_ratespec *res,
|
|||
*/
|
||||
struct mini_Qdisc {
|
||||
struct tcf_proto *filter_list;
|
||||
struct tcf_block *block;
|
||||
struct gnet_stats_basic_cpu __percpu *cpu_bstats;
|
||||
struct gnet_stats_queue __percpu *cpu_qstats;
|
||||
struct rcu_head rcu;
|
||||
|
@ -1295,6 +1296,8 @@ void mini_qdisc_pair_swap(struct mini_Qdisc_pair *miniqp,
|
|||
struct tcf_proto *tp_head);
|
||||
void mini_qdisc_pair_init(struct mini_Qdisc_pair *miniqp, struct Qdisc *qdisc,
|
||||
struct mini_Qdisc __rcu **p_miniq);
|
||||
void mini_qdisc_pair_block_init(struct mini_Qdisc_pair *miniqp,
|
||||
struct tcf_block *block);
|
||||
|
||||
static inline int skb_tc_reinsert(struct sk_buff *skb, struct tcf_result *res)
|
||||
{
|
||||
|
|
|
@ -4860,8 +4860,8 @@ sch_handle_ingress(struct sk_buff *skb, struct packet_type **pt_prev, int *ret,
|
|||
skb->tc_at_ingress = 1;
|
||||
mini_qdisc_bstats_cpu_update(miniq, skb);
|
||||
|
||||
switch (tcf_classify_ingress(skb, miniq->filter_list, &cl_res,
|
||||
false)) {
|
||||
switch (tcf_classify_ingress(skb, miniq->block, miniq->filter_list,
|
||||
&cl_res, false)) {
|
||||
case TC_ACT_OK:
|
||||
case TC_ACT_RECLASSIFY:
|
||||
skb->tc_index = TC_H_MIN(cl_res.classid);
|
||||
|
|
|
@ -1623,7 +1623,9 @@ int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
|
|||
}
|
||||
EXPORT_SYMBOL(tcf_classify);
|
||||
|
||||
int tcf_classify_ingress(struct sk_buff *skb, const struct tcf_proto *tp,
|
||||
int tcf_classify_ingress(struct sk_buff *skb,
|
||||
const struct tcf_block *ingress_block,
|
||||
const struct tcf_proto *tp,
|
||||
struct tcf_result *res, bool compat_mode)
|
||||
{
|
||||
#if !IS_ENABLED(CONFIG_NET_TC_SKB_EXT)
|
||||
|
|
|
@ -1391,6 +1391,14 @@ void mini_qdisc_pair_swap(struct mini_Qdisc_pair *miniqp,
|
|||
}
|
||||
EXPORT_SYMBOL(mini_qdisc_pair_swap);
|
||||
|
||||
void mini_qdisc_pair_block_init(struct mini_Qdisc_pair *miniqp,
|
||||
struct tcf_block *block)
|
||||
{
|
||||
miniqp->miniq1.block = block;
|
||||
miniqp->miniq2.block = block;
|
||||
}
|
||||
EXPORT_SYMBOL(mini_qdisc_pair_block_init);
|
||||
|
||||
void mini_qdisc_pair_init(struct mini_Qdisc_pair *miniqp, struct Qdisc *qdisc,
|
||||
struct mini_Qdisc __rcu **p_miniq)
|
||||
{
|
||||
|
|
|
@ -78,6 +78,7 @@ static int ingress_init(struct Qdisc *sch, struct nlattr *opt,
|
|||
{
|
||||
struct ingress_sched_data *q = qdisc_priv(sch);
|
||||
struct net_device *dev = qdisc_dev(sch);
|
||||
int err;
|
||||
|
||||
net_inc_ingress_queue();
|
||||
|
||||
|
@ -87,7 +88,13 @@ static int ingress_init(struct Qdisc *sch, struct nlattr *opt,
|
|||
q->block_info.chain_head_change = clsact_chain_head_change;
|
||||
q->block_info.chain_head_change_priv = &q->miniqp;
|
||||
|
||||
return tcf_block_get_ext(&q->block, sch, &q->block_info, extack);
|
||||
err = tcf_block_get_ext(&q->block, sch, &q->block_info, extack);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
mini_qdisc_pair_block_init(&q->miniqp, q->block);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ingress_destroy(struct Qdisc *sch)
|
||||
|
@ -226,6 +233,8 @@ static int clsact_init(struct Qdisc *sch, struct nlattr *opt,
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
mini_qdisc_pair_block_init(&q->miniqp_ingress, q->ingress_block);
|
||||
|
||||
mini_qdisc_pair_init(&q->miniqp_egress, sch, &dev->miniq_egress);
|
||||
|
||||
q->egress_block_info.binder_type = FLOW_BLOCK_BINDER_TYPE_CLSACT_EGRESS;
|
||||
|
|
Загрузка…
Ссылка в новой задаче