]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
net: sched: store net pointer in block and introduce qdisc_net helper
authorJiri Pirko <jiri@mellanox.com>
Fri, 13 Oct 2017 12:00:58 +0000 (14:00 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 16 Oct 2017 20:00:40 +0000 (21:00 +0100)
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: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/pkt_sched.h
include/net/sch_generic.h
net/sched/cls_api.c

index 259bc191ba5942bcb01b5033ef866c22c7608ad8..2d234af15f3ea46c21d0f253dedeeb7668720d76 100644 (file)
@@ -4,7 +4,9 @@
 #include <linux/jiffies.h>
 #include <linux/ktime.h>
 #include <linux/if_vlan.h>
+#include <linux/netdevice.h>
 #include <net/sch_generic.h>
+#include <net/net_namespace.h>
 #include <uapi/linux/pkt_sched.h>
 
 #define DEFAULT_TX_QUEUE_LEN   1000
@@ -146,4 +148,9 @@ static inline bool is_classid_clsact_egress(u32 classid)
               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
index df4032ca1b7ff65e0cb457de0f8e1b52c8cf1eb2..9b2cb91dc0d9ee51ffdd31f37c70f6d9b6115d37 100644 (file)
@@ -270,6 +270,7 @@ struct tcf_chain {
 
 struct tcf_block {
        struct list_head chain_list;
+       struct net *net;
        struct Qdisc *q;
 };
 
index f7d3f1f539b7b18a40d3e94a9c4acf998705c6d0..856003caa3bbe8d2265517be4e994bd25e077606 100644 (file)
@@ -257,6 +257,7 @@ int tcf_block_get(struct tcf_block **p_block,
                goto err_chain_create;
        }
        tcf_chain_filter_chain_ptr_set(chain, p_filter_chain);
+       block->net = qdisc_net(q);
        block->q = q;
        *p_block = block;
        return 0;