mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-23 20:24:12 +08:00
net: sched: Identify hardware traffic classes using classid
This patch offloads the classid to hardware and uses the classid reserved in the range :ffe0 - :ffef to identify hardware traffic classes reported via dev->num_tc. tcf_result structure contains the class ID of the class to which the packet belongs and is offloaded to hardware via flower filter. A new helper function is introduced to represent HW traffic classes 0 through 15 using the reserved classid values :ffe0 - :ffef. Signed-off-by: Amritha Nambiar <amritha.nambiar@intel.com> Acked-by: Shannon Nelson <shannon.nelson@oracle.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
parent
aa250f1186
commit
384c181e37
@ -666,6 +666,7 @@ struct tc_cls_flower_offload {
|
|||||||
struct fl_flow_key *mask;
|
struct fl_flow_key *mask;
|
||||||
struct fl_flow_key *key;
|
struct fl_flow_key *key;
|
||||||
struct tcf_exts *exts;
|
struct tcf_exts *exts;
|
||||||
|
u32 classid;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum tc_matchall_command {
|
enum tc_matchall_command {
|
||||||
|
@ -411,6 +411,13 @@ qdisc_class_find(const struct Qdisc_class_hash *hash, u32 id)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int tc_classid_to_hwtc(struct net_device *dev, u32 classid)
|
||||||
|
{
|
||||||
|
u32 hwtc = TC_H_MIN(classid) - TC_H_MIN_PRIORITY;
|
||||||
|
|
||||||
|
return (hwtc < netdev_get_num_tc(dev)) ? hwtc : -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
int qdisc_class_hash_init(struct Qdisc_class_hash *);
|
int qdisc_class_hash_init(struct Qdisc_class_hash *);
|
||||||
void qdisc_class_hash_insert(struct Qdisc_class_hash *,
|
void qdisc_class_hash_insert(struct Qdisc_class_hash *,
|
||||||
struct Qdisc_class_common *);
|
struct Qdisc_class_common *);
|
||||||
|
@ -241,6 +241,7 @@ static int fl_hw_replace_filter(struct tcf_proto *tp,
|
|||||||
cls_flower.mask = mask;
|
cls_flower.mask = mask;
|
||||||
cls_flower.key = &f->mkey;
|
cls_flower.key = &f->mkey;
|
||||||
cls_flower.exts = &f->exts;
|
cls_flower.exts = &f->exts;
|
||||||
|
cls_flower.classid = f->res.classid;
|
||||||
|
|
||||||
err = tc_setup_cb_call(block, &f->exts, TC_SETUP_CLSFLOWER,
|
err = tc_setup_cb_call(block, &f->exts, TC_SETUP_CLSFLOWER,
|
||||||
&cls_flower, skip_sw);
|
&cls_flower, skip_sw);
|
||||||
@ -266,6 +267,7 @@ static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f)
|
|||||||
cls_flower.command = TC_CLSFLOWER_STATS;
|
cls_flower.command = TC_CLSFLOWER_STATS;
|
||||||
cls_flower.cookie = (unsigned long) f;
|
cls_flower.cookie = (unsigned long) f;
|
||||||
cls_flower.exts = &f->exts;
|
cls_flower.exts = &f->exts;
|
||||||
|
cls_flower.classid = f->res.classid;
|
||||||
|
|
||||||
tc_setup_cb_call(block, &f->exts, TC_SETUP_CLSFLOWER,
|
tc_setup_cb_call(block, &f->exts, TC_SETUP_CLSFLOWER,
|
||||||
&cls_flower, false);
|
&cls_flower, false);
|
||||||
|
Loading…
Reference in New Issue
Block a user