Commit 035f1f2b authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski

pktgen add net device refcount tracker

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 615d069d
...@@ -410,6 +410,7 @@ struct pktgen_dev { ...@@ -410,6 +410,7 @@ struct pktgen_dev {
* device name (not when the inject is * device name (not when the inject is
* started as it used to do.) * started as it used to do.)
*/ */
netdevice_tracker dev_tracker;
char odevname[32]; char odevname[32];
struct flow_state *flows; struct flow_state *flows;
unsigned int cflows; /* Concurrent flows (config) */ unsigned int cflows; /* Concurrent flows (config) */
...@@ -2099,7 +2100,7 @@ static int pktgen_setup_dev(const struct pktgen_net *pn, ...@@ -2099,7 +2100,7 @@ static int pktgen_setup_dev(const struct pktgen_net *pn,
/* Clean old setups */ /* Clean old setups */
if (pkt_dev->odev) { if (pkt_dev->odev) {
dev_put(pkt_dev->odev); dev_put_track(pkt_dev->odev, &pkt_dev->dev_tracker);
pkt_dev->odev = NULL; pkt_dev->odev = NULL;
} }
...@@ -2117,6 +2118,7 @@ static int pktgen_setup_dev(const struct pktgen_net *pn, ...@@ -2117,6 +2118,7 @@ static int pktgen_setup_dev(const struct pktgen_net *pn,
err = -ENETDOWN; err = -ENETDOWN;
} else { } else {
pkt_dev->odev = odev; pkt_dev->odev = odev;
netdev_tracker_alloc(odev, &pkt_dev->dev_tracker, GFP_KERNEL);
return 0; return 0;
} }
...@@ -3805,7 +3807,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname) ...@@ -3805,7 +3807,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
return add_dev_to_thread(t, pkt_dev); return add_dev_to_thread(t, pkt_dev);
out2: out2:
dev_put(pkt_dev->odev); dev_put_track(pkt_dev->odev, &pkt_dev->dev_tracker);
out1: out1:
#ifdef CONFIG_XFRM #ifdef CONFIG_XFRM
free_SAs(pkt_dev); free_SAs(pkt_dev);
...@@ -3899,7 +3901,7 @@ static int pktgen_remove_device(struct pktgen_thread *t, ...@@ -3899,7 +3901,7 @@ static int pktgen_remove_device(struct pktgen_thread *t,
/* Dis-associate from the interface */ /* Dis-associate from the interface */
if (pkt_dev->odev) { if (pkt_dev->odev) {
dev_put(pkt_dev->odev); dev_put_track(pkt_dev->odev, &pkt_dev->dev_tracker);
pkt_dev->odev = NULL; pkt_dev->odev = NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment