drivers: use in_dev_for_each_ifa_rtnl/rcu
Like previous patches, use the new iterator macros to avoid sparse warnings once proper __rcu annotations are added. Compile tested only. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
cd5a411dba
commit
cb8f1478ce
|
@ -330,6 +330,7 @@ static void bond_delete_netdev_default_gids(struct ib_device *ib_dev,
|
|||
static void enum_netdev_ipv4_ips(struct ib_device *ib_dev,
|
||||
u8 port, struct net_device *ndev)
|
||||
{
|
||||
const struct in_ifaddr *ifa;
|
||||
struct in_device *in_dev;
|
||||
struct sin_list {
|
||||
struct list_head list;
|
||||
|
@ -349,7 +350,7 @@ static void enum_netdev_ipv4_ips(struct ib_device *ib_dev,
|
|||
return;
|
||||
}
|
||||
|
||||
for_ifa(in_dev) {
|
||||
in_dev_for_each_ifa_rcu(ifa, in_dev) {
|
||||
struct sin_list *entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
|
||||
|
||||
if (!entry)
|
||||
|
@ -359,7 +360,7 @@ static void enum_netdev_ipv4_ips(struct ib_device *ib_dev,
|
|||
entry->ip.sin_addr.s_addr = ifa->ifa_address;
|
||||
list_add_tail(&entry->list, &sin_list);
|
||||
}
|
||||
endfor_ifa(in_dev);
|
||||
|
||||
rcu_read_unlock();
|
||||
|
||||
list_for_each_entry_safe(sin_iter, sin_temp, &sin_list, list) {
|
||||
|
|
|
@ -3230,17 +3230,22 @@ static int pick_local_ipaddrs(struct c4iw_dev *dev, struct iw_cm_id *cm_id)
|
|||
int found = 0;
|
||||
struct sockaddr_in *laddr = (struct sockaddr_in *)&cm_id->m_local_addr;
|
||||
struct sockaddr_in *raddr = (struct sockaddr_in *)&cm_id->m_remote_addr;
|
||||
const struct in_ifaddr *ifa;
|
||||
|
||||
ind = in_dev_get(dev->rdev.lldi.ports[0]);
|
||||
if (!ind)
|
||||
return -EADDRNOTAVAIL;
|
||||
for_primary_ifa(ind) {
|
||||
rcu_read_lock();
|
||||
in_dev_for_each_ifa_rcu(ifa, ind) {
|
||||
if (ifa->ifa_flags & IFA_F_SECONDARY)
|
||||
continue;
|
||||
laddr->sin_addr.s_addr = ifa->ifa_address;
|
||||
raddr->sin_addr.s_addr = ifa->ifa_address;
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
endfor_ifa(ind);
|
||||
rcu_read_unlock();
|
||||
|
||||
in_dev_put(ind);
|
||||
return found ? 0 : -EADDRNOTAVAIL;
|
||||
}
|
||||
|
|
|
@ -1773,8 +1773,11 @@ static enum i40iw_status_code i40iw_add_mqh_4(
|
|||
if ((((rdma_vlan_dev_vlan_id(dev) < I40IW_NO_VLAN) &&
|
||||
(rdma_vlan_dev_real_dev(dev) == iwdev->netdev)) ||
|
||||
(dev == iwdev->netdev)) && (dev->flags & IFF_UP)) {
|
||||
const struct in_ifaddr *ifa;
|
||||
|
||||
idev = in_dev_get(dev);
|
||||
for_ifa(idev) {
|
||||
|
||||
in_dev_for_each_ifa_rtnl(ifa, idev) {
|
||||
i40iw_debug(&iwdev->sc_dev,
|
||||
I40IW_DEBUG_CM,
|
||||
"Allocating child CM Listener forIP=%pI4, vlan_id=%d, MAC=%pM\n",
|
||||
|
@ -1819,7 +1822,7 @@ static enum i40iw_status_code i40iw_add_mqh_4(
|
|||
cm_parent_listen_node->cm_core->stats_listen_nodes_created--;
|
||||
}
|
||||
}
|
||||
endfor_ifa(idev);
|
||||
|
||||
in_dev_put(idev);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1222,8 +1222,10 @@ static void i40iw_add_ipv4_addr(struct i40iw_device *iwdev)
|
|||
if ((((rdma_vlan_dev_vlan_id(dev) < 0xFFFF) &&
|
||||
(rdma_vlan_dev_real_dev(dev) == iwdev->netdev)) ||
|
||||
(dev == iwdev->netdev)) && (dev->flags & IFF_UP)) {
|
||||
const struct in_ifaddr *ifa;
|
||||
|
||||
idev = in_dev_get(dev);
|
||||
for_ifa(idev) {
|
||||
in_dev_for_each_ifa_rtnl(ifa, idev) {
|
||||
i40iw_debug(&iwdev->sc_dev, I40IW_DEBUG_CM,
|
||||
"IP=%pI4, vlan_id=%d, MAC=%pM\n", &ifa->ifa_address,
|
||||
rdma_vlan_dev_vlan_id(dev), dev->dev_addr);
|
||||
|
@ -1235,7 +1237,7 @@ static void i40iw_add_ipv4_addr(struct i40iw_device *iwdev)
|
|||
true,
|
||||
I40IW_ARP_ADD);
|
||||
}
|
||||
endfor_ifa(idev);
|
||||
|
||||
in_dev_put(idev);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3248,6 +3248,7 @@ netxen_config_indev_addr(struct netxen_adapter *adapter,
|
|||
struct net_device *dev, unsigned long event)
|
||||
{
|
||||
struct in_device *indev;
|
||||
struct in_ifaddr *ifa;
|
||||
|
||||
if (!netxen_destip_supported(adapter))
|
||||
return;
|
||||
|
@ -3256,7 +3257,8 @@ netxen_config_indev_addr(struct netxen_adapter *adapter,
|
|||
if (!indev)
|
||||
return;
|
||||
|
||||
for_ifa(indev) {
|
||||
rcu_read_lock();
|
||||
in_dev_for_each_ifa_rcu(ifa, indev) {
|
||||
switch (event) {
|
||||
case NETDEV_UP:
|
||||
netxen_list_config_ip(adapter, ifa, NX_IP_UP);
|
||||
|
@ -3267,8 +3269,8 @@ netxen_config_indev_addr(struct netxen_adapter *adapter,
|
|||
default:
|
||||
break;
|
||||
}
|
||||
} endfor_ifa(indev);
|
||||
|
||||
}
|
||||
rcu_read_unlock();
|
||||
in_dev_put(indev);
|
||||
}
|
||||
|
||||
|
|
|
@ -4119,13 +4119,14 @@ static void
|
|||
qlcnic_config_indev_addr(struct qlcnic_adapter *adapter,
|
||||
struct net_device *dev, unsigned long event)
|
||||
{
|
||||
const struct in_ifaddr *ifa;
|
||||
struct in_device *indev;
|
||||
|
||||
indev = in_dev_get(dev);
|
||||
if (!indev)
|
||||
return;
|
||||
|
||||
for_ifa(indev) {
|
||||
in_dev_for_each_ifa_rtnl(ifa, indev) {
|
||||
switch (event) {
|
||||
case NETDEV_UP:
|
||||
qlcnic_config_ipaddr(adapter,
|
||||
|
@ -4138,7 +4139,7 @@ qlcnic_config_indev_addr(struct qlcnic_adapter *adapter,
|
|||
default:
|
||||
break;
|
||||
}
|
||||
} endfor_ifa(indev);
|
||||
}
|
||||
|
||||
in_dev_put(indev);
|
||||
}
|
||||
|
|
|
@ -196,16 +196,15 @@ static int cisco_rx(struct sk_buff *skb)
|
|||
mask = ~cpu_to_be32(0); /* is the mask correct? */
|
||||
|
||||
if (in_dev != NULL) {
|
||||
struct in_ifaddr **ifap = &in_dev->ifa_list;
|
||||
const struct in_ifaddr *ifa;
|
||||
|
||||
while (*ifap != NULL) {
|
||||
in_dev_for_each_ifa_rcu(ifa, in_dev) {
|
||||
if (strcmp(dev->name,
|
||||
(*ifap)->ifa_label) == 0) {
|
||||
addr = (*ifap)->ifa_local;
|
||||
mask = (*ifap)->ifa_mask;
|
||||
ifa->ifa_label) == 0) {
|
||||
addr = ifa->ifa_local;
|
||||
mask = ifa->ifa_mask;
|
||||
break;
|
||||
}
|
||||
ifap = &(*ifap)->ifa_next;
|
||||
}
|
||||
|
||||
cisco_keepalive_send(dev, CISCO_ADDR_REPLY,
|
||||
|
|
Loading…
Reference in New Issue