Skip to content

Commit

Permalink
pktgen add net device refcount tracker
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Eric Dumazet authored and Jakub Kicinski committed Dec 8, 2021
1 parent 615d069 commit 035f1f2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions net/core/pktgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ struct pktgen_dev {
* device name (not when the inject is
* started as it used to do.)
*/
netdevice_tracker dev_tracker;
char odevname[32];
struct flow_state *flows;
unsigned int cflows; /* Concurrent flows (config) */
Expand Down Expand Up @@ -2099,7 +2100,7 @@ static int pktgen_setup_dev(const struct pktgen_net *pn,

/* Clean old setups */
if (pkt_dev->odev) {
dev_put(pkt_dev->odev);
dev_put_track(pkt_dev->odev, &pkt_dev->dev_tracker);
pkt_dev->odev = NULL;
}

Expand All @@ -2117,6 +2118,7 @@ static int pktgen_setup_dev(const struct pktgen_net *pn,
err = -ENETDOWN;
} else {
pkt_dev->odev = odev;
netdev_tracker_alloc(odev, &pkt_dev->dev_tracker, GFP_KERNEL);
return 0;
}

Expand Down Expand Up @@ -3805,7 +3807,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)

return add_dev_to_thread(t, pkt_dev);
out2:
dev_put(pkt_dev->odev);
dev_put_track(pkt_dev->odev, &pkt_dev->dev_tracker);
out1:
#ifdef CONFIG_XFRM
free_SAs(pkt_dev);
Expand Down Expand Up @@ -3899,7 +3901,7 @@ static int pktgen_remove_device(struct pktgen_thread *t,
/* Dis-associate from the interface */

if (pkt_dev->odev) {
dev_put(pkt_dev->odev);
dev_put_track(pkt_dev->odev, &pkt_dev->dev_tracker);
pkt_dev->odev = NULL;
}

Expand Down

0 comments on commit 035f1f2

Please sign in to comment.