net: rename reference+tracking helpers
authorJakub Kicinski <kuba@kernel.org>
Wed, 8 Jun 2022 04:39:55 +0000 (21:39 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 10 Jun 2022 04:52:55 +0000 (21:52 -0700)
Netdev reference helpers have a dev_ prefix for historic
reasons. Renaming the old helpers would be too much churn
but we can rename the tracking ones which are relatively
recent and should be the default for new code.

Rename:
 dev_hold_track()    -> netdev_hold()
 dev_put_track()     -> netdev_put()
 dev_replace_track() -> netdev_ref_replace()

Link: https://lore.kernel.org/r/20220608043955.919359-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
48 files changed:
drivers/net/eql.c
drivers/net/macsec.c
drivers/net/macvlan.c
drivers/net/netconsole.c
drivers/net/vrf.c
include/linux/netdevice.h
include/net/xfrm.h
net/8021q/vlan_dev.c
net/ax25/af_ax25.c
net/ax25/ax25_dev.c
net/bridge/br_if.c
net/core/dev.c
net/core/dev_ioctl.c
net/core/drop_monitor.c
net/core/dst.c
net/core/failover.c
net/core/link_watch.c
net/core/neighbour.c
net/core/net-sysfs.c
net/core/netpoll.c
net/core/pktgen.c
net/ethtool/ioctl.c
net/ethtool/netlink.c
net/ethtool/netlink.h
net/ipv4/devinet.c
net/ipv4/fib_semantics.c
net/ipv4/ipmr.c
net/ipv4/route.c
net/ipv4/xfrm4_policy.c
net/ipv6/addrconf.c
net/ipv6/addrconf_core.c
net/ipv6/ip6_gre.c
net/ipv6/ip6_tunnel.c
net/ipv6/ip6_vti.c
net/ipv6/ip6mr.c
net/ipv6/route.c
net/ipv6/sit.c
net/ipv6/xfrm6_policy.c
net/llc/af_llc.c
net/openvswitch/vport-netdev.c
net/packet/af_packet.c
net/sched/act_mirred.c
net/sched/sch_api.c
net/sched/sch_generic.c
net/smc/smc_pnet.c
net/switchdev/switchdev.c
net/tipc/bearer.c
net/xfrm/xfrm_device.c

index 557ca8f..ca3e470 100644 (file)
@@ -225,7 +225,7 @@ static void eql_kill_one_slave(slave_queue_t *queue, slave_t *slave)
        list_del(&slave->list);
        queue->num_slaves--;
        slave->dev->flags &= ~IFF_SLAVE;
-       dev_put_track(slave->dev, &slave->dev_tracker);
+       netdev_put(slave->dev, &slave->dev_tracker);
        kfree(slave);
 }
 
@@ -399,7 +399,7 @@ static int __eql_insert_slave(slave_queue_t *queue, slave_t *slave)
                if (duplicate_slave)
                        eql_kill_one_slave(queue, duplicate_slave);
 
-               dev_hold_track(slave->dev, &slave->dev_tracker, GFP_ATOMIC);
+               netdev_hold(slave->dev, &slave->dev_tracker, GFP_ATOMIC);
                list_add(&slave->list, &queue->all_slaves);
                queue->num_slaves++;
                slave->dev->flags |= IFF_SLAVE;
index 817577e..815738c 100644 (file)
@@ -3462,7 +3462,7 @@ static int macsec_dev_init(struct net_device *dev)
                memcpy(dev->broadcast, real_dev->broadcast, dev->addr_len);
 
        /* Get macsec's reference to real_dev */
-       dev_hold_track(real_dev, &macsec->dev_tracker, GFP_KERNEL);
+       netdev_hold(real_dev, &macsec->dev_tracker, GFP_KERNEL);
 
        return 0;
 }
@@ -3710,7 +3710,7 @@ static void macsec_free_netdev(struct net_device *dev)
        free_percpu(macsec->secy.tx_sc.stats);
 
        /* Get rid of the macsec's reference to real_dev */
-       dev_put_track(macsec->real_dev, &macsec->dev_tracker);
+       netdev_put(macsec->real_dev, &macsec->dev_tracker);
 }
 
 static void macsec_setup(struct net_device *dev)
index eff75be..5b46a65 100644 (file)
@@ -915,7 +915,7 @@ static int macvlan_init(struct net_device *dev)
        port->count += 1;
 
        /* Get macvlan's reference to lowerdev */
-       dev_hold_track(lowerdev, &vlan->dev_tracker, GFP_KERNEL);
+       netdev_hold(lowerdev, &vlan->dev_tracker, GFP_KERNEL);
 
        return 0;
 }
@@ -1185,7 +1185,7 @@ static void macvlan_dev_free(struct net_device *dev)
        struct macvlan_dev *vlan = netdev_priv(dev);
 
        /* Get rid of the macvlan's reference to lowerdev */
-       dev_put_track(vlan->lowerdev, &vlan->dev_tracker);
+       netdev_put(vlan->lowerdev, &vlan->dev_tracker);
 }
 
 void macvlan_common_setup(struct net_device *dev)
index ab8cd55..ddac61d 100644 (file)
@@ -721,7 +721,7 @@ restart:
                                __netpoll_cleanup(&nt->np);
 
                                spin_lock_irqsave(&target_list_lock, flags);
-                               dev_put_track(nt->np.dev, &nt->np.dev_tracker);
+                               netdev_put(nt->np.dev, &nt->np.dev_tracker);
                                nt->np.dev = NULL;
                                nt->enabled = false;
                                stopped = true;
index cfc30ce..40445a1 100644 (file)
@@ -814,8 +814,8 @@ static void vrf_rt6_release(struct net_device *dev, struct net_vrf *vrf)
         */
        if (rt6) {
                dst = &rt6->dst;
-               dev_replace_track(dst->dev, net->loopback_dev,
-                                 &dst->dev_tracker, GFP_KERNEL);
+               netdev_ref_replace(dst->dev, net->loopback_dev,
+                                  &dst->dev_tracker, GFP_KERNEL);
                dst->dev = net->loopback_dev;
                dst_release(dst);
        }
@@ -1061,8 +1061,8 @@ static void vrf_rtable_release(struct net_device *dev, struct net_vrf *vrf)
         */
        if (rth) {
                dst = &rth->dst;
-               dev_replace_track(dst->dev, net->loopback_dev,
-                                 &dst->dev_tracker, GFP_KERNEL);
+               netdev_ref_replace(dst->dev, net->loopback_dev,
+                                  &dst->dev_tracker, GFP_KERNEL);
                dst->dev = net->loopback_dev;
                dst_release(dst);
        }
index f615a66..e2e5088 100644 (file)
@@ -3981,8 +3981,8 @@ static inline void netdev_tracker_free(struct net_device *dev,
 #endif
 }
 
-static inline void dev_hold_track(struct net_device *dev,
-                                 netdevice_tracker *tracker, gfp_t gfp)
+static inline void netdev_hold(struct net_device *dev,
+                              netdevice_tracker *tracker, gfp_t gfp)
 {
        if (dev) {
                __dev_hold(dev);
@@ -3990,8 +3990,8 @@ static inline void dev_hold_track(struct net_device *dev,
        }
 }
 
-static inline void dev_put_track(struct net_device *dev,
-                                netdevice_tracker *tracker)
+static inline void netdev_put(struct net_device *dev,
+                             netdevice_tracker *tracker)
 {
        if (dev) {
                netdev_tracker_free(dev, tracker);
@@ -4004,11 +4004,11 @@ static inline void dev_put_track(struct net_device *dev,
  *     @dev: network device
  *
  * Hold reference to device to keep it from being freed.
- * Try using dev_hold_track() instead.
+ * Try using netdev_hold() instead.
  */
 static inline void dev_hold(struct net_device *dev)
 {
-       dev_hold_track(dev, NULL, GFP_ATOMIC);
+       netdev_hold(dev, NULL, GFP_ATOMIC);
 }
 
 /**
@@ -4016,17 +4016,17 @@ static inline void dev_hold(struct net_device *dev)
  *     @dev: network device
  *
  * Release reference to device to allow it to be freed.
- * Try using dev_put_track() instead.
+ * Try using netdev_put() instead.
  */
 static inline void dev_put(struct net_device *dev)
 {
-       dev_put_track(dev, NULL);
+       netdev_put(dev, NULL);
 }
 
-static inline void dev_replace_track(struct net_device *odev,
-                                    struct net_device *ndev,
-                                    netdevice_tracker *tracker,
-                                    gfp_t gfp)
+static inline void netdev_ref_replace(struct net_device *odev,
+                                     struct net_device *ndev,
+                                     netdevice_tracker *tracker,
+                                     gfp_t gfp)
 {
        if (odev)
                netdev_tracker_free(odev, tracker);
index c39d910..9287712 100644 (file)
@@ -1923,7 +1923,7 @@ static inline void xfrm_dev_state_free(struct xfrm_state *x)
                if (dev->xfrmdev_ops->xdo_dev_state_free)
                        dev->xfrmdev_ops->xdo_dev_state_free(x);
                xso->dev = NULL;
-               dev_put_track(dev, &xso->dev_tracker);
+               netdev_put(dev, &xso->dev_tracker);
        }
 }
 #else
index 839f202..e3dff2d 100644 (file)
@@ -615,7 +615,7 @@ static int vlan_dev_init(struct net_device *dev)
                return -ENOMEM;
 
        /* Get vlan's reference to real_dev */
-       dev_hold_track(real_dev, &vlan->dev_tracker, GFP_KERNEL);
+       netdev_hold(real_dev, &vlan->dev_tracker, GFP_KERNEL);
 
        return 0;
 }
@@ -852,7 +852,7 @@ static void vlan_dev_free(struct net_device *dev)
        vlan->vlan_pcpu_stats = NULL;
 
        /* Get rid of the vlan's reference to real_dev */
-       dev_put_track(vlan->real_dev, &vlan->dev_tracker);
+       netdev_put(vlan->real_dev, &vlan->dev_tracker);
 }
 
 void vlan_setup(struct net_device *dev)
index 95393bb..1a5c0b0 100644 (file)
@@ -102,7 +102,8 @@ again:
                        ax25_disconnect(s, ENETUNREACH);
                        s->ax25_dev = NULL;
                        if (sk->sk_socket) {
-                               dev_put_track(ax25_dev->dev, &ax25_dev->dev_tracker);
+                               netdev_put(ax25_dev->dev,
+                                          &ax25_dev->dev_tracker);
                                ax25_dev_put(ax25_dev);
                        }
                        ax25_cb_del(s);
@@ -1065,7 +1066,7 @@ static int ax25_release(struct socket *sock)
                        del_timer_sync(&ax25->t3timer);
                        del_timer_sync(&ax25->idletimer);
                }
-               dev_put_track(ax25_dev->dev, &ax25_dev->dev_tracker);
+               netdev_put(ax25_dev->dev, &ax25_dev->dev_tracker);
                ax25_dev_put(ax25_dev);
        }
 
@@ -1146,7 +1147,7 @@ static int ax25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
 
        if (ax25_dev) {
                ax25_fillin_cb(ax25, ax25_dev);
-               dev_hold_track(ax25_dev->dev, &ax25_dev->dev_tracker, GFP_ATOMIC);
+               netdev_hold(ax25_dev->dev, &ax25_dev->dev_tracker, GFP_ATOMIC);
        }
 
 done:
index 95a76d5..ab88b6a 100644 (file)
@@ -60,7 +60,7 @@ void ax25_dev_device_up(struct net_device *dev)
        refcount_set(&ax25_dev->refcount, 1);
        dev->ax25_ptr     = ax25_dev;
        ax25_dev->dev     = dev;
-       dev_hold_track(dev, &ax25_dev->dev_tracker, GFP_ATOMIC);
+       netdev_hold(dev, &ax25_dev->dev_tracker, GFP_ATOMIC);
        ax25_dev->forward = NULL;
        ax25_dev->device_up = true;
 
@@ -136,7 +136,7 @@ unlock_put:
        spin_unlock_bh(&ax25_dev_lock);
        ax25_dev_put(ax25_dev);
        dev->ax25_ptr = NULL;
-       dev_put_track(dev, &ax25_dev->dev_tracker);
+       netdev_put(dev, &ax25_dev->dev_tracker);
        ax25_dev_put(ax25_dev);
 }
 
@@ -205,7 +205,7 @@ void __exit ax25_dev_free(void)
        ax25_dev = ax25_dev_list;
        while (ax25_dev != NULL) {
                s        = ax25_dev;
-               dev_put_track(ax25_dev->dev, &ax25_dev->dev_tracker);
+               netdev_put(ax25_dev->dev, &ax25_dev->dev_tracker);
                ax25_dev = ax25_dev->next;
                kfree(s);
        }
index 47fcbad..a84a7cf 100644 (file)
@@ -274,7 +274,7 @@ static void destroy_nbp(struct net_bridge_port *p)
 
        p->br = NULL;
        p->dev = NULL;
-       dev_put_track(dev, &p->dev_tracker);
+       netdev_put(dev, &p->dev_tracker);
 
        kobject_put(&p->kobj);
 }
@@ -423,7 +423,7 @@ static struct net_bridge_port *new_nbp(struct net_bridge *br,
                return ERR_PTR(-ENOMEM);
 
        p->br = br;
-       dev_hold_track(dev, &p->dev_tracker, GFP_KERNEL);
+       netdev_hold(dev, &p->dev_tracker, GFP_KERNEL);
        p->dev = dev;
        p->path_cost = port_cost(dev);
        p->priority = 0x8000 >> BR_PORT_BITS;
@@ -434,7 +434,7 @@ static struct net_bridge_port *new_nbp(struct net_bridge *br,
        br_stp_port_timer_init(p);
        err = br_multicast_add_port(p);
        if (err) {
-               dev_put_track(dev, &p->dev_tracker);
+               netdev_put(dev, &p->dev_tracker);
                kfree(p);
                p = ERR_PTR(err);
        }
@@ -615,7 +615,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev,
        err = dev_set_allmulti(dev, 1);
        if (err) {
                br_multicast_del_port(p);
-               dev_put_track(dev, &p->dev_tracker);
+               netdev_put(dev, &p->dev_tracker);
                kfree(p);       /* kobject not yet init'd, manually free */
                goto err1;
        }
@@ -725,7 +725,7 @@ err3:
        sysfs_remove_link(br->ifobj, p->dev->name);
 err2:
        br_multicast_del_port(p);
-       dev_put_track(dev, &p->dev_tracker);
+       netdev_put(dev, &p->dev_tracker);
        kobject_put(&p->kobj);
        dev_set_allmulti(dev, -1);
 err1:
index 08ce317..c9d96b8 100644 (file)
@@ -7463,7 +7463,7 @@ static int __netdev_adjacent_dev_insert(struct net_device *dev,
        adj->ref_nr = 1;
        adj->private = private;
        adj->ignore = false;
-       dev_hold_track(adj_dev, &adj->dev_tracker, GFP_KERNEL);
+       netdev_hold(adj_dev, &adj->dev_tracker, GFP_KERNEL);
 
        pr_debug("Insert adjacency: dev %s adj_dev %s adj->ref_nr %d; dev_hold on %s\n",
                 dev->name, adj_dev->name, adj->ref_nr, adj_dev->name);
@@ -7492,7 +7492,7 @@ remove_symlinks:
        if (netdev_adjacent_is_neigh_list(dev, adj_dev, dev_list))
                netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list);
 free_adj:
-       dev_put_track(adj_dev, &adj->dev_tracker);
+       netdev_put(adj_dev, &adj->dev_tracker);
        kfree(adj);
 
        return ret;
@@ -7534,7 +7534,7 @@ static void __netdev_adjacent_dev_remove(struct net_device *dev,
        list_del_rcu(&adj->list);
        pr_debug("adjacency: dev_put for %s, because link removed from %s to %s\n",
                 adj_dev->name, dev->name, adj_dev->name);
-       dev_put_track(adj_dev, &adj->dev_tracker);
+       netdev_put(adj_dev, &adj->dev_tracker);
        kfree_rcu(adj, rcu);
 }
 
@@ -10062,7 +10062,7 @@ int register_netdevice(struct net_device *dev)
 
        dev_init_scheduler(dev);
 
-       dev_hold_track(dev, &dev->dev_registered_tracker, GFP_KERNEL);
+       netdev_hold(dev, &dev->dev_registered_tracker, GFP_KERNEL);
        list_netdevice(dev);
 
        add_device_randomness(dev->dev_addr, dev->addr_len);
@@ -10868,7 +10868,7 @@ void unregister_netdevice_many(struct list_head *head)
        synchronize_net();
 
        list_for_each_entry(dev, head, unreg_list) {
-               dev_put_track(dev, &dev->dev_registered_tracker);
+               netdev_put(dev, &dev->dev_registered_tracker);
                net_set_todo(dev);
        }
 
index 4f6be44..7674bb9 100644 (file)
@@ -384,10 +384,10 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, void __user *data,
                        return -ENODEV;
                if (!netif_is_bridge_master(dev))
                        return -EOPNOTSUPP;
-               dev_hold_track(dev, &dev_tracker, GFP_KERNEL);
+               netdev_hold(dev, &dev_tracker, GFP_KERNEL);
                rtnl_unlock();
                err = br_ioctl_call(net, netdev_priv(dev), cmd, ifr, NULL);
-               dev_put_track(dev, &dev_tracker);
+               netdev_put(dev, &dev_tracker);
                rtnl_lock();
                return err;
 
index 4ad1dec..804d02f 100644 (file)
@@ -864,7 +864,8 @@ net_dm_hw_metadata_copy(const struct devlink_trap_metadata *metadata)
        }
 
        hw_metadata->input_dev = metadata->input_dev;
-       dev_hold_track(hw_metadata->input_dev, &hw_metadata->dev_tracker, GFP_ATOMIC);
+       netdev_hold(hw_metadata->input_dev, &hw_metadata->dev_tracker,
+                   GFP_ATOMIC);
 
        return hw_metadata;
 
@@ -880,7 +881,7 @@ free_hw_metadata:
 static void
 net_dm_hw_metadata_free(struct devlink_trap_metadata *hw_metadata)
 {
-       dev_put_track(hw_metadata->input_dev, &hw_metadata->dev_tracker);
+       netdev_put(hw_metadata->input_dev, &hw_metadata->dev_tracker);
        kfree(hw_metadata->fa_cookie);
        kfree(hw_metadata->trap_name);
        kfree(hw_metadata->trap_group_name);
index d16c2c9..bc9c9be 100644 (file)
@@ -49,7 +49,7 @@ void dst_init(struct dst_entry *dst, struct dst_ops *ops,
              unsigned short flags)
 {
        dst->dev = dev;
-       dev_hold_track(dev, &dst->dev_tracker, GFP_ATOMIC);
+       netdev_hold(dev, &dst->dev_tracker, GFP_ATOMIC);
        dst->ops = ops;
        dst_init_metrics(dst, dst_default_metrics.metrics, true);
        dst->expires = 0UL;
@@ -117,7 +117,7 @@ struct dst_entry *dst_destroy(struct dst_entry * dst)
 
        if (dst->ops->destroy)
                dst->ops->destroy(dst);
-       dev_put_track(dst->dev, &dst->dev_tracker);
+       netdev_put(dst->dev, &dst->dev_tracker);
 
        lwtstate_put(dst->lwtstate);
 
@@ -159,8 +159,8 @@ void dst_dev_put(struct dst_entry *dst)
        dst->input = dst_discard;
        dst->output = dst_discard_out;
        dst->dev = blackhole_netdev;
-       dev_replace_track(dev, blackhole_netdev, &dst->dev_tracker,
-                         GFP_ATOMIC);
+       netdev_ref_replace(dev, blackhole_netdev, &dst->dev_tracker,
+                          GFP_ATOMIC);
 }
 EXPORT_SYMBOL(dst_dev_put);
 
index dcaa92a..864d2d8 100644 (file)
@@ -252,7 +252,7 @@ struct failover *failover_register(struct net_device *dev,
                return ERR_PTR(-ENOMEM);
 
        rcu_assign_pointer(failover->ops, ops);
-       dev_hold_track(dev, &failover->dev_tracker, GFP_KERNEL);
+       netdev_hold(dev, &failover->dev_tracker, GFP_KERNEL);
        dev->priv_flags |= IFF_FAILOVER;
        rcu_assign_pointer(failover->failover_dev, dev);
 
@@ -285,7 +285,7 @@ void failover_unregister(struct failover *failover)
                    failover_dev->name);
 
        failover_dev->priv_flags &= ~IFF_FAILOVER;
-       dev_put_track(failover_dev, &failover->dev_tracker);
+       netdev_put(failover_dev, &failover->dev_tracker);
 
        spin_lock(&failover_lock);
        list_del(&failover->list);
index a244d3b..aa6cb1f 100644 (file)
@@ -110,7 +110,7 @@ static void linkwatch_add_event(struct net_device *dev)
        spin_lock_irqsave(&lweventlist_lock, flags);
        if (list_empty(&dev->link_watch_list)) {
                list_add_tail(&dev->link_watch_list, &lweventlist);
-               dev_hold_track(dev, &dev->linkwatch_dev_tracker, GFP_ATOMIC);
+               netdev_hold(dev, &dev->linkwatch_dev_tracker, GFP_ATOMIC);
        }
        spin_unlock_irqrestore(&lweventlist_lock, flags);
 }
index 5462528..d8ec706 100644 (file)
@@ -624,7 +624,7 @@ ___neigh_create(struct neigh_table *tbl, const void *pkey,
 
        memcpy(n->primary_key, pkey, key_len);
        n->dev = dev;
-       dev_hold_track(dev, &n->dev_tracker, GFP_ATOMIC);
+       netdev_hold(dev, &n->dev_tracker, GFP_ATOMIC);
 
        /* Protocol specific setup. */
        if (tbl->constructor && (error = tbl->constructor(n)) < 0) {
@@ -770,10 +770,10 @@ struct pneigh_entry * pneigh_lookup(struct neigh_table *tbl,
        write_pnet(&n->net, net);
        memcpy(n->key, pkey, key_len);
        n->dev = dev;
-       dev_hold_track(dev, &n->dev_tracker, GFP_KERNEL);
+       netdev_hold(dev, &n->dev_tracker, GFP_KERNEL);
 
        if (tbl->pconstructor && tbl->pconstructor(n)) {
-               dev_put_track(dev, &n->dev_tracker);
+               netdev_put(dev, &n->dev_tracker);
                kfree(n);
                n = NULL;
                goto out;
@@ -805,7 +805,7 @@ int pneigh_delete(struct neigh_table *tbl, struct net *net, const void *pkey,
                        write_unlock_bh(&tbl->lock);
                        if (tbl->pdestructor)
                                tbl->pdestructor(n);
-                       dev_put_track(n->dev, &n->dev_tracker);
+                       netdev_put(n->dev, &n->dev_tracker);
                        kfree(n);
                        return 0;
                }
@@ -838,7 +838,7 @@ static int pneigh_ifdown_and_unlock(struct neigh_table *tbl,
                n->next = NULL;
                if (tbl->pdestructor)
                        tbl->pdestructor(n);
-               dev_put_track(n->dev, &n->dev_tracker);
+               netdev_put(n->dev, &n->dev_tracker);
                kfree(n);
        }
        return -ENOENT;
@@ -879,7 +879,7 @@ void neigh_destroy(struct neighbour *neigh)
        if (dev->netdev_ops->ndo_neigh_destroy)
                dev->netdev_ops->ndo_neigh_destroy(dev, neigh);
 
-       dev_put_track(dev, &neigh->dev_tracker);
+       netdev_put(dev, &neigh->dev_tracker);
        neigh_parms_put(neigh->parms);
 
        neigh_dbg(2, "neigh %p is destroyed\n", neigh);
@@ -1671,13 +1671,13 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev,
                refcount_set(&p->refcnt, 1);
                p->reachable_time =
                                neigh_rand_reach_time(NEIGH_VAR(p, BASE_REACHABLE_TIME));
-               dev_hold_track(dev, &p->dev_tracker, GFP_KERNEL);
+               netdev_hold(dev, &p->dev_tracker, GFP_KERNEL);
                p->dev = dev;
                write_pnet(&p->net, net);
                p->sysctl_table = NULL;
 
                if (ops->ndo_neigh_setup && ops->ndo_neigh_setup(dev, p)) {
-                       dev_put_track(dev, &p->dev_tracker);
+                       netdev_put(dev, &p->dev_tracker);
                        kfree(p);
                        return NULL;
                }
@@ -1708,7 +1708,7 @@ void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms)
        list_del(&parms->list);
        parms->dead = 1;
        write_unlock_bh(&tbl->lock);
-       dev_put_track(parms->dev, &parms->dev_tracker);
+       netdev_put(parms->dev, &parms->dev_tracker);
        call_rcu(&parms->rcu_head, neigh_rcu_free_parms);
 }
 EXPORT_SYMBOL(neigh_parms_release);
index e319e24..d49fc97 100644 (file)
@@ -1016,7 +1016,7 @@ static void rx_queue_release(struct kobject *kobj)
 #endif
 
        memset(kobj, 0, sizeof(*kobj));
-       dev_put_track(queue->dev, &queue->dev_tracker);
+       netdev_put(queue->dev, &queue->dev_tracker);
 }
 
 static const void *rx_queue_namespace(struct kobject *kobj)
@@ -1056,7 +1056,7 @@ static int rx_queue_add_kobject(struct net_device *dev, int index)
        /* Kobject_put later will trigger rx_queue_release call which
         * decreases dev refcount: Take that reference here
         */
-       dev_hold_track(queue->dev, &queue->dev_tracker, GFP_KERNEL);
+       netdev_hold(queue->dev, &queue->dev_tracker, GFP_KERNEL);
 
        kobj->kset = dev->queues_kset;
        error = kobject_init_and_add(kobj, &rx_queue_ktype, NULL,
@@ -1619,7 +1619,7 @@ static void netdev_queue_release(struct kobject *kobj)
        struct netdev_queue *queue = to_netdev_queue(kobj);
 
        memset(kobj, 0, sizeof(*kobj));
-       dev_put_track(queue->dev, &queue->dev_tracker);
+       netdev_put(queue->dev, &queue->dev_tracker);
 }
 
 static const void *netdev_queue_namespace(struct kobject *kobj)
@@ -1659,7 +1659,7 @@ static int netdev_queue_add_kobject(struct net_device *dev, int index)
        /* Kobject_put later will trigger netdev_queue_release call
         * which decreases dev refcount: Take that reference here
         */
-       dev_hold_track(queue->dev, &queue->dev_tracker, GFP_KERNEL);
+       netdev_hold(queue->dev, &queue->dev_tracker, GFP_KERNEL);
 
        kobj->kset = dev->queues_kset;
        error = kobject_init_and_add(kobj, &netdev_queue_ktype, NULL,
index db72446..5d27067 100644 (file)
@@ -853,7 +853,7 @@ void netpoll_cleanup(struct netpoll *np)
        if (!np->dev)
                goto out;
        __netpoll_cleanup(np);
-       dev_put_track(np->dev, &np->dev_tracker);
+       netdev_put(np->dev, &np->dev_tracker);
        np->dev = NULL;
 out:
        rtnl_unlock();
index 84b62cd..88906ba 100644 (file)
@@ -2100,7 +2100,7 @@ static int pktgen_setup_dev(const struct pktgen_net *pn,
 
        /* Clean old setups */
        if (pkt_dev->odev) {
-               dev_put_track(pkt_dev->odev, &pkt_dev->dev_tracker);
+               netdev_put(pkt_dev->odev, &pkt_dev->dev_tracker);
                pkt_dev->odev = NULL;
        }
 
@@ -3807,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_track(pkt_dev->odev, &pkt_dev->dev_tracker);
+       netdev_put(pkt_dev->odev, &pkt_dev->dev_tracker);
 out1:
 #ifdef CONFIG_XFRM
        free_SAs(pkt_dev);
@@ -3901,7 +3901,7 @@ static int pktgen_remove_device(struct pktgen_thread *t,
        /* Dis-associate from the interface */
 
        if (pkt_dev->odev) {
-               dev_put_track(pkt_dev->odev, &pkt_dev->dev_tracker);
+               netdev_put(pkt_dev->odev, &pkt_dev->dev_tracker);
                pkt_dev->odev = NULL;
        }
 
index 326e14e..d05ff6a 100644 (file)
@@ -2010,7 +2010,7 @@ static int ethtool_phys_id(struct net_device *dev, void __user *useraddr)
         * removal of the device.
         */
        busy = true;
-       dev_hold_track(dev, &dev_tracker, GFP_KERNEL);
+       netdev_hold(dev, &dev_tracker, GFP_KERNEL);
        rtnl_unlock();
 
        if (rc == 0) {
@@ -2034,7 +2034,7 @@ static int ethtool_phys_id(struct net_device *dev, void __user *useraddr)
        }
 
        rtnl_lock();
-       dev_put_track(dev, &dev_tracker);
+       netdev_put(dev, &dev_tracker);
        busy = false;
 
        (void) ops->set_phys_id(dev, ETHTOOL_ID_INACTIVE);
index 5fe8f4a..e26079e 100644 (file)
@@ -402,7 +402,7 @@ static int ethnl_default_doit(struct sk_buff *skb, struct genl_info *info)
                ops->cleanup_data(reply_data);
 
        genlmsg_end(rskb, reply_payload);
-       dev_put_track(req_info->dev, &req_info->dev_tracker);
+       netdev_put(req_info->dev, &req_info->dev_tracker);
        kfree(reply_data);
        kfree(req_info);
        return genlmsg_reply(rskb, info);
@@ -414,7 +414,7 @@ err_cleanup:
        if (ops->cleanup_data)
                ops->cleanup_data(reply_data);
 err_dev:
-       dev_put_track(req_info->dev, &req_info->dev_tracker);
+       netdev_put(req_info->dev, &req_info->dev_tracker);
        kfree(reply_data);
        kfree(req_info);
        return ret;
@@ -550,7 +550,7 @@ static int ethnl_default_start(struct netlink_callback *cb)
                 * same parser as for non-dump (doit) requests is used, it
                 * would take reference to the device if it finds one
                 */
-               dev_put_track(req_info->dev, &req_info->dev_tracker);
+               netdev_put(req_info->dev, &req_info->dev_tracker);
                req_info->dev = NULL;
        }
        if (ret < 0)
index 7919ddb..c0d5876 100644 (file)
@@ -237,7 +237,7 @@ struct ethnl_req_info {
 
 static inline void ethnl_parse_header_dev_put(struct ethnl_req_info *req_info)
 {
-       dev_put_track(req_info->dev, &req_info->dev_tracker);
+       netdev_put(req_info->dev, &req_info->dev_tracker);
 }
 
 /**
index b2366ad..92b778e 100644 (file)
@@ -244,7 +244,7 @@ void in_dev_finish_destroy(struct in_device *idev)
 #ifdef NET_REFCNT_DEBUG
        pr_debug("%s: %p=%s\n", __func__, idev, dev ? dev->name : "NIL");
 #endif
-       dev_put_track(dev, &idev->dev_tracker);
+       netdev_put(dev, &idev->dev_tracker);
        if (!idev->dead)
                pr_err("Freeing alive in_device %p\n", idev);
        else
@@ -272,7 +272,7 @@ static struct in_device *inetdev_init(struct net_device *dev)
        if (IPV4_DEVCONF(in_dev->cnf, FORWARDING))
                dev_disable_lro(dev);
        /* Reference in_dev->dev */
-       dev_hold_track(dev, &in_dev->dev_tracker, GFP_KERNEL);
+       netdev_hold(dev, &in_dev->dev_tracker, GFP_KERNEL);
        /* Account for reference dev->ip_ptr (below) */
        refcount_set(&in_dev->refcnt, 1);
 
index a57ba23..a5439a8 100644 (file)
@@ -211,7 +211,7 @@ static void rt_fibinfo_free_cpus(struct rtable __rcu * __percpu *rtp)
 
 void fib_nh_common_release(struct fib_nh_common *nhc)
 {
-       dev_put_track(nhc->nhc_dev, &nhc->nhc_dev_tracker);
+       netdev_put(nhc->nhc_dev, &nhc->nhc_dev_tracker);
        lwtstate_put(nhc->nhc_lwtstate);
        rt_fibinfo_free_cpus(nhc->nhc_pcpu_rth_output);
        rt_fibinfo_free(&nhc->nhc_rth_input);
@@ -1057,7 +1057,8 @@ static int fib_check_nh_v6_gw(struct net *net, struct fib_nh *nh,
        err = ipv6_stub->fib6_nh_init(net, &fib6_nh, &cfg, GFP_KERNEL, extack);
        if (!err) {
                nh->fib_nh_dev = fib6_nh.fib_nh_dev;
-               dev_hold_track(nh->fib_nh_dev, &nh->fib_nh_dev_tracker, GFP_KERNEL);
+               netdev_hold(nh->fib_nh_dev, &nh->fib_nh_dev_tracker,
+                           GFP_KERNEL);
                nh->fib_nh_oif = nh->fib_nh_dev->ifindex;
                nh->fib_nh_scope = RT_SCOPE_LINK;
 
@@ -1141,7 +1142,7 @@ static int fib_check_nh_v4_gw(struct net *net, struct fib_nh *nh, u32 table,
                if (!netif_carrier_ok(dev))
                        nh->fib_nh_flags |= RTNH_F_LINKDOWN;
                nh->fib_nh_dev = dev;
-               dev_hold_track(dev, &nh->fib_nh_dev_tracker, GFP_ATOMIC);
+               netdev_hold(dev, &nh->fib_nh_dev_tracker, GFP_ATOMIC);
                nh->fib_nh_scope = RT_SCOPE_LINK;
                return 0;
        }
@@ -1195,7 +1196,7 @@ static int fib_check_nh_v4_gw(struct net *net, struct fib_nh *nh, u32 table,
                               "No egress device for nexthop gateway");
                goto out;
        }
-       dev_hold_track(dev, &nh->fib_nh_dev_tracker, GFP_ATOMIC);
+       netdev_hold(dev, &nh->fib_nh_dev_tracker, GFP_ATOMIC);
        if (!netif_carrier_ok(dev))
                nh->fib_nh_flags |= RTNH_F_LINKDOWN;
        err = (dev->flags & IFF_UP) ? 0 : -ENETDOWN;
@@ -1229,7 +1230,7 @@ static int fib_check_nh_nongw(struct net *net, struct fib_nh *nh,
        }
 
        nh->fib_nh_dev = in_dev->dev;
-       dev_hold_track(nh->fib_nh_dev, &nh->fib_nh_dev_tracker, GFP_ATOMIC);
+       netdev_hold(nh->fib_nh_dev, &nh->fib_nh_dev_tracker, GFP_ATOMIC);
        nh->fib_nh_scope = RT_SCOPE_HOST;
        if (!netif_carrier_ok(nh->fib_nh_dev))
                nh->fib_nh_flags |= RTNH_F_LINKDOWN;
index 13e6329..8324e54 100644 (file)
@@ -691,7 +691,7 @@ static int vif_delete(struct mr_table *mrt, int vifi, int notify,
        if (v->flags & (VIFF_TUNNEL | VIFF_REGISTER) && !notify)
                unregister_netdevice_queue(dev, head);
 
-       dev_put_track(dev, &v->dev_tracker);
+       netdev_put(dev, &v->dev_tracker);
        return 0;
 }
 
index 356f535..2d16bcc 100644 (file)
@@ -1550,9 +1550,8 @@ void rt_flush_dev(struct net_device *dev)
                        if (rt->dst.dev != dev)
                                continue;
                        rt->dst.dev = blackhole_netdev;
-                       dev_replace_track(dev, blackhole_netdev,
-                                         &rt->dst.dev_tracker,
-                                         GFP_ATOMIC);
+                       netdev_ref_replace(dev, blackhole_netdev,
+                                          &rt->dst.dev_tracker, GFP_ATOMIC);
                        list_move(&rt->rt_uncached, &ul->quarantine);
                }
                spin_unlock_bh(&ul->lock);
@@ -2851,7 +2850,7 @@ struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_or
                new->output = dst_discard_out;
 
                new->dev = net->loopback_dev;
-               dev_hold_track(new->dev, &new->dev_tracker, GFP_ATOMIC);
+               netdev_hold(new->dev, &new->dev_tracker, GFP_ATOMIC);
 
                rt->rt_is_input = ort->rt_is_input;
                rt->rt_iif = ort->rt_iif;
index 6fde0b1..3d0dfa6 100644 (file)
@@ -75,7 +75,7 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
        xdst->u.rt.rt_iif = fl4->flowi4_iif;
 
        xdst->u.dst.dev = dev;
-       dev_hold_track(dev, &xdst->u.dst.dev_tracker, GFP_ATOMIC);
+       netdev_hold(dev, &xdst->u.dst.dev_tracker, GFP_ATOMIC);
 
        /* Sheit... I remember I did this right. Apparently,
         * it was magically lost, so this code needs audit */
index 1b19325..3497ad1 100644 (file)
@@ -398,13 +398,13 @@ static struct inet6_dev *ipv6_add_dev(struct net_device *dev)
        if (ndev->cnf.forwarding)
                dev_disable_lro(dev);
        /* We refer to the device */
-       dev_hold_track(dev, &ndev->dev_tracker, GFP_KERNEL);
+       netdev_hold(dev, &ndev->dev_tracker, GFP_KERNEL);
 
        if (snmp6_alloc_dev(ndev) < 0) {
                netdev_dbg(dev, "%s: cannot allocate memory for statistics\n",
                           __func__);
                neigh_parms_release(&nd_tbl, ndev->nd_parms);
-               dev_put_track(dev, &ndev->dev_tracker);
+               netdev_put(dev, &ndev->dev_tracker);
                kfree(ndev);
                return ERR_PTR(err);
        }
index 881d147..507a835 100644 (file)
@@ -263,7 +263,7 @@ void in6_dev_finish_destroy(struct inet6_dev *idev)
 #ifdef NET_REFCNT_DEBUG
        pr_debug("%s: %s\n", __func__, dev ? dev->name : "NIL");
 #endif
-       dev_put_track(dev, &idev->dev_tracker);
+       netdev_put(dev, &idev->dev_tracker);
        if (!idev->dead) {
                pr_warn("Freeing alive inet6 device %p\n", idev);
                return;
index 4e37f7c..3e22cbe 100644 (file)
@@ -398,7 +398,7 @@ static void ip6erspan_tunnel_uninit(struct net_device *dev)
        ip6erspan_tunnel_unlink_md(ign, t);
        ip6gre_tunnel_unlink(ign, t);
        dst_cache_reset(&t->dst_cache);
-       dev_put_track(dev, &t->dev_tracker);
+       netdev_put(dev, &t->dev_tracker);
 }
 
 static void ip6gre_tunnel_uninit(struct net_device *dev)
@@ -411,7 +411,7 @@ static void ip6gre_tunnel_uninit(struct net_device *dev)
        if (ign->fb_tunnel_dev == dev)
                WRITE_ONCE(ign->fb_tunnel_dev, NULL);
        dst_cache_reset(&t->dst_cache);
-       dev_put_track(dev, &t->dev_tracker);
+       netdev_put(dev, &t->dev_tracker);
 }
 
 
@@ -1495,7 +1495,7 @@ static int ip6gre_tunnel_init_common(struct net_device *dev)
        }
        ip6gre_tnl_init_features(dev);
 
-       dev_hold_track(dev, &tunnel->dev_tracker, GFP_KERNEL);
+       netdev_hold(dev, &tunnel->dev_tracker, GFP_KERNEL);
        return 0;
 
 cleanup_dst_cache_init:
@@ -1887,7 +1887,7 @@ static int ip6erspan_tap_init(struct net_device *dev)
        dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
        ip6erspan_tnl_link_config(tunnel, 1);
 
-       dev_hold_track(dev, &tunnel->dev_tracker, GFP_KERNEL);
+       netdev_hold(dev, &tunnel->dev_tracker, GFP_KERNEL);
        return 0;
 
 cleanup_dst_cache_init:
index 19325b7..689de5e 100644 (file)
@@ -381,7 +381,7 @@ ip6_tnl_dev_uninit(struct net_device *dev)
        else
                ip6_tnl_unlink(ip6n, t);
        dst_cache_reset(&t->dst_cache);
-       dev_put_track(dev, &t->dev_tracker);
+       netdev_put(dev, &t->dev_tracker);
 }
 
 /**
@@ -1889,7 +1889,7 @@ ip6_tnl_dev_init_gen(struct net_device *dev)
        dev->min_mtu = ETH_MIN_MTU;
        dev->max_mtu = IP6_MAX_MTU - dev->hard_header_len;
 
-       dev_hold_track(dev, &t->dev_tracker, GFP_KERNEL);
+       netdev_hold(dev, &t->dev_tracker, GFP_KERNEL);
        return 0;
 
 destroy_dst:
index 3a434d7..8fe59a7 100644 (file)
@@ -293,7 +293,7 @@ static void vti6_dev_uninit(struct net_device *dev)
                RCU_INIT_POINTER(ip6n->tnls_wc[0], NULL);
        else
                vti6_tnl_unlink(ip6n, t);
-       dev_put_track(dev, &t->dev_tracker);
+       netdev_put(dev, &t->dev_tracker);
 }
 
 static int vti6_input_proto(struct sk_buff *skb, int nexthdr, __be32 spi,
@@ -936,7 +936,7 @@ static inline int vti6_dev_init_gen(struct net_device *dev)
        dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
        if (!dev->tstats)
                return -ENOMEM;
-       dev_hold_track(dev, &t->dev_tracker, GFP_KERNEL);
+       netdev_hold(dev, &t->dev_tracker, GFP_KERNEL);
        return 0;
 }
 
index 4e74bc6..d4aad41 100644 (file)
@@ -741,7 +741,7 @@ static int mif6_delete(struct mr_table *mrt, int vifi, int notify,
        if ((v->flags & MIFF_REGISTER) && !notify)
                unregister_netdevice_queue(dev, head);
 
-       dev_put_track(dev, &v->dev_tracker);
+       netdev_put(dev, &v->dev_tracker);
        return 0;
 }
 
index d25dc83..0be01a4 100644 (file)
@@ -182,9 +182,9 @@ static void rt6_uncached_list_flush_dev(struct net_device *dev)
 
                        if (rt_dev == dev) {
                                rt->dst.dev = blackhole_netdev;
-                               dev_replace_track(rt_dev, blackhole_netdev,
-                                                 &rt->dst.dev_tracker,
-                                                 GFP_ATOMIC);
+                               netdev_ref_replace(rt_dev, blackhole_netdev,
+                                                  &rt->dst.dev_tracker,
+                                                  GFP_ATOMIC);
                                handled = true;
                        }
                        if (handled)
@@ -607,7 +607,7 @@ static void rt6_probe_deferred(struct work_struct *w)
 
        addrconf_addr_solict_mult(&work->target, &mcaddr);
        ndisc_send_ns(work->dev, &work->target, &mcaddr, NULL, 0);
-       dev_put_track(work->dev, &work->dev_tracker);
+       netdev_put(work->dev, &work->dev_tracker);
        kfree(work);
 }
 
@@ -661,7 +661,7 @@ static void rt6_probe(struct fib6_nh *fib6_nh)
        } else {
                INIT_WORK(&work->work, rt6_probe_deferred);
                work->target = *nh_gw;
-               dev_hold_track(dev, &work->dev_tracker, GFP_ATOMIC);
+               netdev_hold(dev, &work->dev_tracker, GFP_ATOMIC);
                work->dev = dev;
                schedule_work(&work->work);
        }
index c0b138c..4f17218 100644 (file)
@@ -521,7 +521,7 @@ static void ipip6_tunnel_uninit(struct net_device *dev)
                ipip6_tunnel_del_prl(tunnel, NULL);
        }
        dst_cache_reset(&tunnel->dst_cache);
-       dev_put_track(dev, &tunnel->dev_tracker);
+       netdev_put(dev, &tunnel->dev_tracker);
 }
 
 static int ipip6_err(struct sk_buff *skb, u32 info)
@@ -1463,7 +1463,7 @@ static int ipip6_tunnel_init(struct net_device *dev)
                dev->tstats = NULL;
                return err;
        }
-       dev_hold_track(dev, &tunnel->dev_tracker, GFP_KERNEL);
+       netdev_hold(dev, &tunnel->dev_tracker, GFP_KERNEL);
        return 0;
 }
 
index e64e427..4a4b0e4 100644 (file)
@@ -73,11 +73,11 @@ static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
        struct rt6_info *rt = (struct rt6_info *)xdst->route;
 
        xdst->u.dst.dev = dev;
-       dev_hold_track(dev, &xdst->u.dst.dev_tracker, GFP_ATOMIC);
+       netdev_hold(dev, &xdst->u.dst.dev_tracker, GFP_ATOMIC);
 
        xdst->u.rt6.rt6i_idev = in6_dev_get(dev);
        if (!xdst->u.rt6.rt6i_idev) {
-               dev_put_track(dev, &xdst->u.dst.dev_tracker);
+               netdev_put(dev, &xdst->u.dst.dev_tracker);
                return -ENODEV;
        }
 
index 7f555d2..da7fe94 100644 (file)
@@ -224,7 +224,7 @@ static int llc_ui_release(struct socket *sock)
        } else {
                release_sock(sk);
        }
-       dev_put_track(llc->dev, &llc->dev_tracker);
+       netdev_put(llc->dev, &llc->dev_tracker);
        sock_put(sk);
        llc_sk_free(sk);
 out:
index b498dac..2f61d5b 100644 (file)
@@ -115,7 +115,7 @@ error_master_upper_dev_unlink:
 error_unlock:
        rtnl_unlock();
 error_put:
-       dev_put_track(vport->dev, &vport->dev_tracker);
+       netdev_put(vport->dev, &vport->dev_tracker);
 error_free_vport:
        ovs_vport_free(vport);
        return ERR_PTR(err);
@@ -137,7 +137,7 @@ static void vport_netdev_free(struct rcu_head *rcu)
 {
        struct vport *vport = container_of(rcu, struct vport, rcu);
 
-       dev_put_track(vport->dev, &vport->dev_tracker);
+       netdev_put(vport->dev, &vport->dev_tracker);
        ovs_vport_free(vport);
 }
 
@@ -173,7 +173,7 @@ void ovs_netdev_tunnel_destroy(struct vport *vport)
         */
        if (vport->dev->reg_state == NETREG_REGISTERED)
                rtnl_delete_link(vport->dev);
-       dev_put_track(vport->dev, &vport->dev_tracker);
+       netdev_put(vport->dev, &vport->dev_tracker);
        vport->dev = NULL;
        rtnl_unlock();
 
index ca6e92a..d08c472 100644 (file)
@@ -3134,7 +3134,7 @@ static int packet_release(struct socket *sock)
        packet_cached_dev_reset(po);
 
        if (po->prot_hook.dev) {
-               dev_put_track(po->prot_hook.dev, &po->prot_hook.dev_tracker);
+               netdev_put(po->prot_hook.dev, &po->prot_hook.dev_tracker);
                po->prot_hook.dev = NULL;
        }
        spin_unlock(&po->bind_lock);
@@ -3235,15 +3235,15 @@ static int packet_do_bind(struct sock *sk, const char *name, int ifindex,
                WRITE_ONCE(po->num, proto);
                po->prot_hook.type = proto;
 
-               dev_put_track(po->prot_hook.dev, &po->prot_hook.dev_tracker);
+               netdev_put(po->prot_hook.dev, &po->prot_hook.dev_tracker);
 
                if (unlikely(unlisted)) {
                        po->prot_hook.dev = NULL;
                        WRITE_ONCE(po->ifindex, -1);
                        packet_cached_dev_reset(po);
                } else {
-                       dev_hold_track(dev, &po->prot_hook.dev_tracker,
-                                      GFP_ATOMIC);
+                       netdev_hold(dev, &po->prot_hook.dev_tracker,
+                                   GFP_ATOMIC);
                        po->prot_hook.dev = dev;
                        WRITE_ONCE(po->ifindex, dev ? dev->ifindex : 0);
                        packet_cached_dev_assign(po, dev);
@@ -4167,8 +4167,8 @@ static int packet_notifier(struct notifier_block *this,
                                if (msg == NETDEV_UNREGISTER) {
                                        packet_cached_dev_reset(po);
                                        WRITE_ONCE(po->ifindex, -1);
-                                       dev_put_track(po->prot_hook.dev,
-                                                     &po->prot_hook.dev_tracker);
+                                       netdev_put(po->prot_hook.dev,
+                                                  &po->prot_hook.dev_tracker);
                                        po->prot_hook.dev = NULL;
                                }
                                spin_unlock(&po->bind_lock);
index ebb92fb..a1d70cf 100644 (file)
@@ -79,7 +79,7 @@ static void tcf_mirred_release(struct tc_action *a)
 
        /* last reference to action, no need to lock */
        dev = rcu_dereference_protected(m->tcfm_dev, 1);
-       dev_put_track(dev, &m->tcfm_dev_tracker);
+       netdev_put(dev, &m->tcfm_dev_tracker);
 }
 
 static const struct nla_policy mirred_policy[TCA_MIRRED_MAX + 1] = {
@@ -181,7 +181,7 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
                mac_header_xmit = dev_is_mac_header_xmit(ndev);
                odev = rcu_replace_pointer(m->tcfm_dev, ndev,
                                          lockdep_is_held(&m->tcf_lock));
-               dev_put_track(odev, &m->tcfm_dev_tracker);
+               netdev_put(odev, &m->tcfm_dev_tracker);
                netdev_tracker_alloc(ndev, &m->tcfm_dev_tracker, GFP_ATOMIC);
                m->tcfm_mac_header_xmit = mac_header_xmit;
        }
@@ -402,7 +402,7 @@ static int mirred_device_event(struct notifier_block *unused,
                list_for_each_entry(m, &mirred_list, tcfm_list) {
                        spin_lock_bh(&m->tcf_lock);
                        if (tcf_mirred_dev_dereference(m) == dev) {
-                               dev_put_track(dev, &m->tcfm_dev_tracker);
+                               netdev_put(dev, &m->tcfm_dev_tracker);
                                /* Note : no rcu grace period necessary, as
                                 * net_device are already rcu protected.
                                 */
index e3c0e8e..bf87b50 100644 (file)
@@ -1292,7 +1292,7 @@ err_out5:
        if (ops->destroy)
                ops->destroy(sch);
 err_out3:
-       dev_put_track(dev, &sch->dev_tracker);
+       netdev_put(dev, &sch->dev_tracker);
        qdisc_free(sch);
 err_out2:
        module_put(ops->owner);
index dba0b3e..cc6eabe 100644 (file)
@@ -541,7 +541,7 @@ static void dev_watchdog(struct timer_list *t)
        spin_unlock(&dev->tx_global_lock);
 
        if (release)
-               dev_put_track(dev, &dev->watchdog_dev_tracker);
+               netdev_put(dev, &dev->watchdog_dev_tracker);
 }
 
 void __netdev_watchdog_up(struct net_device *dev)
@@ -551,7 +551,8 @@ void __netdev_watchdog_up(struct net_device *dev)
                        dev->watchdog_timeo = 5*HZ;
                if (!mod_timer(&dev->watchdog_timer,
                               round_jiffies(jiffies + dev->watchdog_timeo)))
-                       dev_hold_track(dev, &dev->watchdog_dev_tracker, GFP_ATOMIC);
+                       netdev_hold(dev, &dev->watchdog_dev_tracker,
+                                   GFP_ATOMIC);
        }
 }
 EXPORT_SYMBOL_GPL(__netdev_watchdog_up);
@@ -565,7 +566,7 @@ static void dev_watchdog_down(struct net_device *dev)
 {
        netif_tx_lock_bh(dev);
        if (del_timer(&dev->watchdog_timer))
-               dev_put_track(dev, &dev->watchdog_dev_tracker);
+               netdev_put(dev, &dev->watchdog_dev_tracker);
        netif_tx_unlock_bh(dev);
 }
 
@@ -975,7 +976,7 @@ struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
        sch->enqueue = ops->enqueue;
        sch->dequeue = ops->dequeue;
        sch->dev_queue = dev_queue;
-       dev_hold_track(dev, &sch->dev_tracker, GFP_KERNEL);
+       netdev_hold(dev, &sch->dev_tracker, GFP_KERNEL);
        refcount_set(&sch->refcnt, 1);
 
        return sch;
@@ -1067,7 +1068,7 @@ static void qdisc_destroy(struct Qdisc *qdisc)
                ops->destroy(qdisc);
 
        module_put(ops->owner);
-       dev_put_track(qdisc_dev(qdisc), &qdisc->dev_tracker);
+       netdev_put(qdisc_dev(qdisc), &qdisc->dev_tracker);
 
        trace_qdisc_destroy(qdisc);
 
index 7055ed1..4c3bf6d 100644 (file)
@@ -120,7 +120,8 @@ static int smc_pnet_remove_by_pnetid(struct net *net, char *pnet_name)
                    smc_pnet_match(pnetelem->pnet_name, pnet_name)) {
                        list_del(&pnetelem->list);
                        if (pnetelem->type == SMC_PNET_ETH && pnetelem->ndev) {
-                               dev_put_track(pnetelem->ndev, &pnetelem->dev_tracker);
+                               netdev_put(pnetelem->ndev,
+                                          &pnetelem->dev_tracker);
                                pr_warn_ratelimited("smc: net device %s "
                                                    "erased user defined "
                                                    "pnetid %.16s\n",
@@ -196,7 +197,7 @@ static int smc_pnet_add_by_ndev(struct net_device *ndev)
        list_for_each_entry_safe(pnetelem, tmp_pe, &pnettable->pnetlist, list) {
                if (pnetelem->type == SMC_PNET_ETH && !pnetelem->ndev &&
                    !strncmp(pnetelem->eth_name, ndev->name, IFNAMSIZ)) {
-                       dev_hold_track(ndev, &pnetelem->dev_tracker, GFP_ATOMIC);
+                       netdev_hold(ndev, &pnetelem->dev_tracker, GFP_ATOMIC);
                        pnetelem->ndev = ndev;
                        rc = 0;
                        pr_warn_ratelimited("smc: adding net device %s with "
@@ -227,7 +228,7 @@ static int smc_pnet_remove_by_ndev(struct net_device *ndev)
        mutex_lock(&pnettable->lock);
        list_for_each_entry_safe(pnetelem, tmp_pe, &pnettable->pnetlist, list) {
                if (pnetelem->type == SMC_PNET_ETH && pnetelem->ndev == ndev) {
-                       dev_put_track(pnetelem->ndev, &pnetelem->dev_tracker);
+                       netdev_put(pnetelem->ndev, &pnetelem->dev_tracker);
                        pnetelem->ndev = NULL;
                        rc = 0;
                        pr_warn_ratelimited("smc: removing net device %s with "
index 474f763..8cc42ae 100644 (file)
@@ -64,7 +64,7 @@ void switchdev_deferred_process(void)
 
        while ((dfitem = switchdev_deferred_dequeue())) {
                dfitem->func(dfitem->dev, dfitem->data);
-               dev_put_track(dfitem->dev, &dfitem->dev_tracker);
+               netdev_put(dfitem->dev, &dfitem->dev_tracker);
                kfree(dfitem);
        }
 }
@@ -91,7 +91,7 @@ static int switchdev_deferred_enqueue(struct net_device *dev,
        dfitem->dev = dev;
        dfitem->func = func;
        memcpy(dfitem->data, data, data_len);
-       dev_hold_track(dev, &dfitem->dev_tracker, GFP_ATOMIC);
+       netdev_hold(dev, &dfitem->dev_tracker, GFP_ATOMIC);
        spin_lock_bh(&deferred_lock);
        list_add_tail(&dfitem->list, &deferred);
        spin_unlock_bh(&deferred_lock);
index 932c87b..35cac77 100644 (file)
@@ -788,7 +788,7 @@ int tipc_attach_loopback(struct net *net)
        if (!dev)
                return -ENODEV;
 
-       dev_hold_track(dev, &tn->loopback_pt.dev_tracker, GFP_KERNEL);
+       netdev_hold(dev, &tn->loopback_pt.dev_tracker, GFP_KERNEL);
        tn->loopback_pt.dev = dev;
        tn->loopback_pt.type = htons(ETH_P_TIPC);
        tn->loopback_pt.func = tipc_loopback_rcv_pkt;
@@ -801,7 +801,7 @@ void tipc_detach_loopback(struct net *net)
        struct tipc_net *tn = tipc_net(net);
 
        dev_remove_pack(&tn->loopback_pt);
-       dev_put_track(net->loopback_dev, &tn->loopback_pt.dev_tracker);
+       netdev_put(net->loopback_dev, &tn->loopback_pt.dev_tracker);
 }
 
 /* Caller should hold rtnl_lock to protect the bearer */
index 35c7e89..637ca88 100644 (file)
@@ -275,7 +275,7 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x,
                xso->dev = NULL;
                xso->dir = 0;
                xso->real_dev = NULL;
-               dev_put_track(dev, &xso->dev_tracker);
+               netdev_put(dev, &xso->dev_tracker);
 
                if (err != -EOPNOTSUPP)
                        return err;