提交 855319be 编写于 作者: J Jiri Pirko 提交者: David S. Miller

net: sched: store net pointer in block and introduce qdisc_net helper

Store net pointer in the block structure. Along the way, introduce
qdisc_net helper which allows to easily obtain net pointer for
qdisc instance.
Signed-off-by: NJiri Pirko <jiri@mellanox.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 69d78ef2
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/ktime.h> #include <linux/ktime.h>
#include <linux/if_vlan.h> #include <linux/if_vlan.h>
#include <linux/netdevice.h>
#include <net/sch_generic.h> #include <net/sch_generic.h>
#include <net/net_namespace.h>
#include <uapi/linux/pkt_sched.h> #include <uapi/linux/pkt_sched.h>
#define DEFAULT_TX_QUEUE_LEN 1000 #define DEFAULT_TX_QUEUE_LEN 1000
...@@ -146,4 +148,9 @@ static inline bool is_classid_clsact_egress(u32 classid) ...@@ -146,4 +148,9 @@ static inline bool is_classid_clsact_egress(u32 classid)
TC_H_MIN(classid) == TC_H_MIN(TC_H_MIN_EGRESS); TC_H_MIN(classid) == TC_H_MIN(TC_H_MIN_EGRESS);
} }
static inline struct net *qdisc_net(struct Qdisc *q)
{
return dev_net(q->dev_queue->dev);
}
#endif #endif
...@@ -270,6 +270,7 @@ struct tcf_chain { ...@@ -270,6 +270,7 @@ struct tcf_chain {
struct tcf_block { struct tcf_block {
struct list_head chain_list; struct list_head chain_list;
struct net *net;
struct Qdisc *q; struct Qdisc *q;
}; };
......
...@@ -257,6 +257,7 @@ int tcf_block_get(struct tcf_block **p_block, ...@@ -257,6 +257,7 @@ int tcf_block_get(struct tcf_block **p_block,
goto err_chain_create; goto err_chain_create;
} }
tcf_chain_filter_chain_ptr_set(chain, p_filter_chain); tcf_chain_filter_chain_ptr_set(chain, p_filter_chain);
block->net = qdisc_net(q);
block->q = q; block->q = q;
*p_block = block; *p_block = block;
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册