summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorSachin Saxena <sachin.saxena@freescale.com>2013-04-15 09:38:38 (GMT)
committerFleming Andrew-AFLEMING <AFLEMING@freescale.com>2013-04-16 22:39:41 (GMT)
commit107eeafdd3d8dd59d4c493460902ce5d79269068 (patch)
tree506d4094899e0050385dacfab454d56bb5c92ab1 /net
parent76d92610a3ba8bacb6703eeb6a44ba7159745a22 (diff)
downloadlinux-fsl-qoriq-107eeafdd3d8dd59d4c493460902ce5d79269068.tar.xz
Changes to support ASF QOS Integration with Kernel
Signed-off-by: Sachin Saxena <sachin.saxena@freescale.com> CQ ID : ENGR00253307 Change-Id: If090285cc4fdfe6a09bd62da1697a55404cdbce4 Reviewed-on: http://git.am.freescale.net:8181/1345 Reviewed-by: Gupta Rajan-B15745 <rajan.gupta@freescale.com> Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com> Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Diffstat (limited to 'net')
-rw-r--r--net/core/dev.c26
-rw-r--r--net/sched/sch_prio.c60
2 files changed, 86 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 29aab09..68dd7f8 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2617,6 +2617,24 @@ static void skb_update_prio(struct sk_buff *skb)
static DEFINE_PER_CPU(int, xmit_recursion);
#define RECURSION_LIMIT 10
+#ifdef CONFIG_ASF_EGRESS_QOS
+/* Linux QoS hook to tranfer all packet to ASF QoS */
+static asf_qos_fn_hook *asf_qos_fn;
+
+void asf_qos_fn_register(asf_qos_fn_hook *fn)
+{
+ asf_qos_fn = fn;
+}
+EXPORT_SYMBOL(asf_qos_fn_register);
+
+void asf_qos_fn_unregister(void)
+{
+ asf_qos_fn = NULL;
+}
+EXPORT_SYMBOL(asf_qos_fn_unregister);
+#endif
+
+
/**
* dev_loopback_xmit - loop back @skb
* @skb: buffer to transmit
@@ -2686,6 +2704,14 @@ int dev_queue_xmit(struct sk_buff *skb)
#ifdef CONFIG_NET_CLS_ACT
skb->tc_verd = SET_TC_AT(skb->tc_verd, AT_EGRESS);
#endif
+
+#ifdef CONFIG_ASF_EGRESS_QOS
+ if (asf_qos_fn) {
+ rc = asf_qos_fn(skb);
+ goto out;
+ }
+#endif
+
trace_net_dev_queue(skb);
if (q->enqueue) {
rc = __dev_xmit_skb(skb, q, dev, txq);
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
index 79359b6..868ab9a 100644
--- a/net/sched/sch_prio.c
+++ b/net/sched/sch_prio.c
@@ -22,6 +22,16 @@
#include <net/pkt_sched.h>
+#if defined(CONFIG_ASF_EGRESS_SCH) || defined(CONFIG_ASF_HW_SCH)
+static inline void _prio_add_hook(struct Qdisc *sch,
+ uint32_t bands);
+static inline void _prio_flush_hook(struct Qdisc *sch);
+
+/* Define ADD/DELETE Hooks */
+static prio_add_hook *prio_add_fn;
+static prio_flush_hook *prio_flush_fn;
+#endif
+
struct prio_sched_data {
int bands;
struct tcf_proto *filter_list;
@@ -161,6 +171,11 @@ prio_destroy(struct Qdisc *sch)
tcf_destroy_chain(&q->filter_list);
for (prio = 0; prio < q->bands; prio++)
qdisc_destroy(q->queues[prio]);
+
+#if defined(CONFIG_ASF_EGRESS_SCH) || defined(CONFIG_ASF_HW_SCH)
+ /* Invoke PRIO Qdisc Deletiion */
+ _prio_flush_hook(sch);
+#endif
}
static int prio_tune(struct Qdisc *sch, struct nlattr *opt)
@@ -234,6 +249,12 @@ static int prio_init(struct Qdisc *sch, struct nlattr *opt)
if ((err = prio_tune(sch, opt)) != 0)
return err;
+
+#if defined(CONFIG_ASF_EGRESS_SCH) || defined(CONFIG_ASF_HW_SCH)
+ /* PRIO Qdisc creation is complete, now safe to offload */
+ _prio_add_hook(sch, q->bands);
+#endif
+
}
return 0;
}
@@ -360,6 +381,45 @@ static struct tcf_proto **prio_find_tcf(struct Qdisc *sch, unsigned long cl)
return &q->filter_list;
}
+#if defined(CONFIG_ASF_EGRESS_SCH) || defined(CONFIG_ASF_HW_SCH)
+static inline void _prio_add_hook(
+ struct Qdisc *sch,
+ uint32_t bands)
+{
+ if (prio_add_fn) {
+ struct net_device *dev = qdisc_dev(sch);
+
+ if (prio_add_fn(dev, sch->handle, sch->parent, bands) < 0) {
+ printk(KERN_DEBUG "%s: PRIO Creation on %s: fail: handle 0x%X\n",
+ __func__, dev->name, sch->handle);
+ }
+ }
+}
+
+static inline void _prio_flush_hook(struct Qdisc *sch)
+{
+
+ if (prio_flush_fn) {
+ struct net_device *dev = qdisc_dev(sch);
+
+ if (prio_flush_fn(dev, sch->handle, sch->parent) < 0) {
+ printk(KERN_DEBUG "%s: PRIO Fush on %s: fail: handle 0x%X\n",
+ __func__, dev->name, sch->handle);
+ }
+ }
+}
+
+
+void prio_hook_fn_register(prio_add_hook *add,
+ prio_flush_hook *flush)
+{
+ prio_add_fn = add;
+ prio_flush_fn = flush;
+}
+EXPORT_SYMBOL(prio_hook_fn_register);
+#endif
+
+
static const struct Qdisc_class_ops prio_class_ops = {
.graft = prio_graft,
.leaf = prio_leaf,