net: s/dev_get_flags/netif_get_flags/

Commit cc34acd577 ("docs: net: document new locking reality")
introduced netif_ vs dev_ function semantics: the former expects locked
netdev, the latter takes care of the locking. We don't strictly
follow this semantics on either side, but there are more dev_xxx handlers
now that don't fit. Rename them to netif_xxx where appropriate.

Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20250717172333.1288349-6-sdf@fomichev.me
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Stanislav Fomichev 2025-07-17 10:23:31 -07:00 committed by Jakub Kicinski
parent 303a8487a6
commit 93893a57ef
14 changed files with 21 additions and 21 deletions

View file

@ -65,7 +65,7 @@ static int rxe_query_port(struct ib_device *ibdev,
attr->state = ib_get_curr_port_state(ndev); attr->state = ib_get_curr_port_state(ndev);
if (attr->state == IB_PORT_ACTIVE) if (attr->state == IB_PORT_ACTIVE)
attr->phys_state = IB_PORT_PHYS_STATE_LINK_UP; attr->phys_state = IB_PORT_PHYS_STATE_LINK_UP;
else if (dev_get_flags(ndev) & IFF_UP) else if (netif_get_flags(ndev) & IFF_UP)
attr->phys_state = IB_PORT_PHYS_STATE_POLLING; attr->phys_state = IB_PORT_PHYS_STATE_POLLING;
else else
attr->phys_state = IB_PORT_PHYS_STATE_DISABLED; attr->phys_state = IB_PORT_PHYS_STATE_DISABLED;

View file

@ -7847,7 +7847,7 @@ static int fsctl_query_iface_info_ioctl(struct ksmbd_conn *conn,
if (!ksmbd_find_netdev_name_iface_list(netdev->name)) if (!ksmbd_find_netdev_name_iface_list(netdev->name))
continue; continue;
flags = dev_get_flags(netdev); flags = netif_get_flags(netdev);
if (!(flags & IFF_RUNNING)) if (!(flags & IFF_RUNNING))
continue; continue;
ipv6_retry: ipv6_retry:

View file

@ -4196,7 +4196,7 @@ int generic_hwtstamp_set_lower(struct net_device *dev,
struct kernel_hwtstamp_config *kernel_cfg, struct kernel_hwtstamp_config *kernel_cfg,
struct netlink_ext_ack *extack); struct netlink_ext_ack *extack);
int dev_ethtool(struct net *net, struct ifreq *ifr, void __user *userdata); int dev_ethtool(struct net *net, struct ifreq *ifr, void __user *userdata);
unsigned int dev_get_flags(const struct net_device *); unsigned int netif_get_flags(const struct net_device *dev);
int __dev_change_flags(struct net_device *dev, unsigned int flags, int __dev_change_flags(struct net_device *dev, unsigned int flags,
struct netlink_ext_ack *extack); struct netlink_ext_ack *extack);
int netif_change_flags(struct net_device *dev, unsigned int flags, int netif_change_flags(struct net_device *dev, unsigned int flags,

View file

@ -483,7 +483,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
case NETDEV_UP: case NETDEV_UP:
/* Put all VLANs for this dev in the up state too. */ /* Put all VLANs for this dev in the up state too. */
vlan_group_for_each_dev(grp, i, vlandev) { vlan_group_for_each_dev(grp, i, vlandev) {
flgs = dev_get_flags(vlandev); flgs = netif_get_flags(vlandev);
if (flgs & IFF_UP) if (flgs & IFF_UP)
continue; continue;

View file

@ -479,7 +479,7 @@ static int br_fill_ifinfo(struct sk_buff *skb,
hdr->__ifi_pad = 0; hdr->__ifi_pad = 0;
hdr->ifi_type = dev->type; hdr->ifi_type = dev->type;
hdr->ifi_index = dev->ifindex; hdr->ifi_index = dev->ifindex;
hdr->ifi_flags = dev_get_flags(dev); hdr->ifi_flags = netif_get_flags(dev);
hdr->ifi_change = 0; hdr->ifi_change = 0;
if (nla_put_string(skb, IFLA_IFNAME, dev->name) || if (nla_put_string(skb, IFLA_IFNAME, dev->name) ||

View file

@ -9454,12 +9454,12 @@ void dev_set_rx_mode(struct net_device *dev)
} }
/** /**
* dev_get_flags - get flags reported to userspace * netif_get_flags() - get flags reported to userspace
* @dev: device * @dev: device
* *
* Get the combination of flag bits exported through APIs to userspace. * Get the combination of flag bits exported through APIs to userspace.
*/ */
unsigned int dev_get_flags(const struct net_device *dev) unsigned int netif_get_flags(const struct net_device *dev)
{ {
unsigned int flags; unsigned int flags;
@ -9482,7 +9482,7 @@ unsigned int dev_get_flags(const struct net_device *dev)
return flags; return flags;
} }
EXPORT_SYMBOL(dev_get_flags); EXPORT_SYMBOL(netif_get_flags);
int __dev_change_flags(struct net_device *dev, unsigned int flags, int __dev_change_flags(struct net_device *dev, unsigned int flags,
struct netlink_ext_ack *extack) struct netlink_ext_ack *extack)

View file

@ -147,7 +147,7 @@ static int dev_ifsioc_locked(struct net *net, struct ifreq *ifr, unsigned int cm
switch (cmd) { switch (cmd) {
case SIOCGIFFLAGS: /* Get interface flags */ case SIOCGIFFLAGS: /* Get interface flags */
ifr->ifr_flags = (short) dev_get_flags(dev); ifr->ifr_flags = (short)netif_get_flags(dev);
return 0; return 0;
case SIOCGIFMETRIC: /* Get the metric on the interface case SIOCGIFMETRIC: /* Get the metric on the interface

View file

@ -2038,7 +2038,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb,
ifm->__ifi_pad = 0; ifm->__ifi_pad = 0;
ifm->ifi_type = READ_ONCE(dev->type); ifm->ifi_type = READ_ONCE(dev->type);
ifm->ifi_index = READ_ONCE(dev->ifindex); ifm->ifi_index = READ_ONCE(dev->ifindex);
ifm->ifi_flags = dev_get_flags(dev); ifm->ifi_flags = netif_get_flags(dev);
ifm->ifi_change = change; ifm->ifi_change = change;
if (tgt_netnsid >= 0 && nla_put_s32(skb, IFLA_TARGET_NETNSID, tgt_netnsid)) if (tgt_netnsid >= 0 && nla_put_s32(skb, IFLA_TARGET_NETNSID, tgt_netnsid))
@ -5227,7 +5227,7 @@ int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
ifm->__ifi_pad = 0; ifm->__ifi_pad = 0;
ifm->ifi_type = dev->type; ifm->ifi_type = dev->type;
ifm->ifi_index = dev->ifindex; ifm->ifi_index = dev->ifindex;
ifm->ifi_flags = dev_get_flags(dev); ifm->ifi_flags = netif_get_flags(dev);
ifm->ifi_change = 0; ifm->ifi_change = 0;

View file

@ -1524,7 +1524,7 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
fib_disable_ip(dev, event, false); fib_disable_ip(dev, event, false);
break; break;
case NETDEV_CHANGE: case NETDEV_CHANGE:
flags = dev_get_flags(dev); flags = netif_get_flags(dev);
if (flags & (IFF_RUNNING | IFF_LOWER_UP)) if (flags & (IFF_RUNNING | IFF_LOWER_UP))
fib_sync_up(dev, RTNH_F_LINKDOWN); fib_sync_up(dev, RTNH_F_LINKDOWN);
else else

View file

@ -2087,7 +2087,7 @@ int fib_sync_up(struct net_device *dev, unsigned char nh_flags)
return 0; return 0;
if (nh_flags & RTNH_F_DEAD) { if (nh_flags & RTNH_F_DEAD) {
unsigned int flags = dev_get_flags(dev); unsigned int flags = netif_get_flags(dev);
if (flags & (IFF_RUNNING | IFF_LOWER_UP)) if (flags & (IFF_RUNNING | IFF_LOWER_UP))
nh_flags |= RTNH_F_LINKDOWN; nh_flags |= RTNH_F_LINKDOWN;

View file

@ -3884,7 +3884,7 @@ static int nh_netdev_event(struct notifier_block *this,
nexthop_flush_dev(dev, event); nexthop_flush_dev(dev, event);
break; break;
case NETDEV_CHANGE: case NETDEV_CHANGE:
if (!(dev_get_flags(dev) & (IFF_RUNNING | IFF_LOWER_UP))) if (!(netif_get_flags(dev) & (IFF_RUNNING | IFF_LOWER_UP)))
nexthop_flush_dev(dev, event); nexthop_flush_dev(dev, event);
break; break;
case NETDEV_CHANGEMTU: case NETDEV_CHANGEMTU:

View file

@ -6072,7 +6072,7 @@ static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev,
hdr->ifi_type = dev->type; hdr->ifi_type = dev->type;
ifindex = READ_ONCE(dev->ifindex); ifindex = READ_ONCE(dev->ifindex);
hdr->ifi_index = ifindex; hdr->ifi_index = ifindex;
hdr->ifi_flags = dev_get_flags(dev); hdr->ifi_flags = netif_get_flags(dev);
hdr->ifi_change = 0; hdr->ifi_change = 0;
iflink = dev_get_iflink(dev); iflink = dev_get_iflink(dev);

View file

@ -706,7 +706,7 @@ static int mpls_nh_assign_dev(struct net *net, struct mpls_route *rt,
} else { } else {
unsigned int flags; unsigned int flags;
flags = dev_get_flags(dev); flags = netif_get_flags(dev);
if (!(flags & (IFF_RUNNING | IFF_LOWER_UP))) if (!(flags & (IFF_RUNNING | IFF_LOWER_UP)))
nh->nh_flags |= RTNH_F_LINKDOWN; nh->nh_flags |= RTNH_F_LINKDOWN;
} }
@ -1616,14 +1616,14 @@ static int mpls_dev_notify(struct notifier_block *this, unsigned long event,
return notifier_from_errno(err); return notifier_from_errno(err);
break; break;
case NETDEV_UP: case NETDEV_UP:
flags = dev_get_flags(dev); flags = netif_get_flags(dev);
if (flags & (IFF_RUNNING | IFF_LOWER_UP)) if (flags & (IFF_RUNNING | IFF_LOWER_UP))
mpls_ifup(dev, RTNH_F_DEAD | RTNH_F_LINKDOWN); mpls_ifup(dev, RTNH_F_DEAD | RTNH_F_LINKDOWN);
else else
mpls_ifup(dev, RTNH_F_DEAD); mpls_ifup(dev, RTNH_F_DEAD);
break; break;
case NETDEV_CHANGE: case NETDEV_CHANGE:
flags = dev_get_flags(dev); flags = netif_get_flags(dev);
if (flags & (IFF_RUNNING | IFF_LOWER_UP)) { if (flags & (IFF_RUNNING | IFF_LOWER_UP)) {
mpls_ifup(dev, RTNH_F_DEAD | RTNH_F_LINKDOWN); mpls_ifup(dev, RTNH_F_DEAD | RTNH_F_LINKDOWN);
} else { } else {

View file

@ -431,7 +431,7 @@ static struct nlmsghdr *rtnetlink_ifinfo_prep(struct net_device *dev,
r->__ifi_pad = 0; r->__ifi_pad = 0;
r->ifi_type = dev->type; r->ifi_type = dev->type;
r->ifi_index = dev->ifindex; r->ifi_index = dev->ifindex;
r->ifi_flags = dev_get_flags(dev); r->ifi_flags = netif_get_flags(dev);
r->ifi_change = 0; /* Wireless changes don't affect those flags */ r->ifi_change = 0; /* Wireless changes don't affect those flags */
if (nla_put_string(skb, IFLA_IFNAME, dev->name)) if (nla_put_string(skb, IFLA_IFNAME, dev->name))