aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid S. Miller <[email protected]>2017-08-11 13:47:01 -0700
committerDavid S. Miller <[email protected]>2017-08-11 13:47:01 -0700
commitd853d11239712260d529ae94673071ee1aaa4e50 (patch)
tree3235e5848cd8d033f4e4c3abbd8dbb392c4f9e54 /include
parentc5ebc4409f2bb2c0b053c204ba197c6b71527eed (diff)
parent7b06e8aed283081010596c98a67f06c595affe51 (diff)
Merge branch 'net-sched-let-the-offloader-decide-what-to-offload'
Jiri Pirko says: ==================== net: sched: let the offloader decide what to offload Currently there is a Qdisc_class_ops->tcf_cl_offload callback that is called to find out if cls would offload rule or not. This is only supported by sch_ingress and sch_clsact. So the Qdisc are to decide. However, the driver knows what is he able to offload, so move the decision making to drivers completely. Just pass classid there and provide set of helpers to allow identification of qdisc. As a side effect, this actually allows clsact egress rules offload in mlxsw. ==================== Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'include')
-rw-r--r--include/net/pkt_cls.h18
-rw-r--r--include/net/pkt_sched.h14
-rw-r--r--include/net/sch_generic.h1
3 files changed, 19 insertions, 14 deletions
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index 0f78e6560b2d..e80edd8879ef 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -406,20 +406,20 @@ tcf_match_indev(struct sk_buff *skb, int ifindex)
#endif /* CONFIG_NET_CLS_IND */
struct tc_cls_common_offload {
- u32 handle;
u32 chain_index;
__be16 protocol;
u32 prio;
+ u32 classid;
};
static inline void
tc_cls_common_offload_init(struct tc_cls_common_offload *cls_common,
const struct tcf_proto *tp)
{
- cls_common->handle = tp->q->handle;
cls_common->chain_index = tp->chain->index;
cls_common->protocol = tp->protocol;
cls_common->prio = tp->prio;
+ cls_common->classid = tp->classid;
}
struct tc_cls_u32_knode {
@@ -457,19 +457,12 @@ struct tc_cls_u32_offload {
};
};
-static inline bool tc_can_offload(const struct net_device *dev,
- const struct tcf_proto *tp)
+static inline bool tc_can_offload(const struct net_device *dev)
{
- const struct Qdisc *sch = tp->q;
- const struct Qdisc_class_ops *cops = sch->ops->cl_ops;
-
if (!(dev->features & NETIF_F_HW_TC))
return false;
if (!dev->netdev_ops->ndo_setup_tc)
return false;
- if (cops && cops->tcf_cl_offload)
- return cops->tcf_cl_offload(tp->classid);
-
return true;
}
@@ -478,12 +471,11 @@ static inline bool tc_skip_hw(u32 flags)
return (flags & TCA_CLS_FLAGS_SKIP_HW) ? true : false;
}
-static inline bool tc_should_offload(const struct net_device *dev,
- const struct tcf_proto *tp, u32 flags)
+static inline bool tc_should_offload(const struct net_device *dev, u32 flags)
{
if (tc_skip_hw(flags))
return false;
- return tc_can_offload(dev, tp);
+ return tc_can_offload(dev);
}
static inline bool tc_skip_sw(u32 flags)
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 2579c209ea51..259bc191ba59 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -5,6 +5,7 @@
#include <linux/ktime.h>
#include <linux/if_vlan.h>
#include <net/sch_generic.h>
+#include <uapi/linux/pkt_sched.h>
#define DEFAULT_TX_QUEUE_LEN 1000
@@ -132,4 +133,17 @@ static inline unsigned int psched_mtu(const struct net_device *dev)
return dev->mtu + dev->hard_header_len;
}
+static inline bool is_classid_clsact_ingress(u32 classid)
+{
+ /* This also returns true for ingress qdisc */
+ return TC_H_MAJ(classid) == TC_H_MAJ(TC_H_CLSACT) &&
+ TC_H_MIN(classid) != TC_H_MIN(TC_H_MIN_EGRESS);
+}
+
+static inline bool is_classid_clsact_egress(u32 classid)
+{
+ return TC_H_MAJ(classid) == TC_H_MAJ(TC_H_CLSACT) &&
+ TC_H_MIN(classid) == TC_H_MIN(TC_H_MIN_EGRESS);
+}
+
#endif
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index e79f5ad1c5f3..5865db91976b 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -156,7 +156,6 @@ struct Qdisc_class_ops {
/* Filter manipulation */
struct tcf_block * (*tcf_block)(struct Qdisc *, unsigned long);
- bool (*tcf_cl_offload)(u32 classid);
unsigned long (*bind_tcf)(struct Qdisc *, unsigned long,
u32 classid);
void (*unbind_tcf)(struct Qdisc *, unsigned long);