Commit f3aa3136 authored by Sachin Sant's avatar Sachin Sant Committed by David S. Miller

qeth lcs: convert mc rwlock to RCU

Commit 1d7138de
igmp: RCU conversion of in_dev->mc_list

converted rwlock to RCU.

Update the s390 network drivers(qeth & lcs) code to adapt to this change.
V2 : Changes based on suggestions given by Eric Dumazet
Signed-off-by: default avatarSachin Sant <sachinp@in.ibm.com>
Signed-off-by: default avatarUrsula Braun <ursula.braun@de.ibm.com>
Signed-off-by: default avatarFrank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5e955968
...@@ -1188,7 +1188,8 @@ lcs_remove_mc_addresses(struct lcs_card *card, struct in_device *in4_dev) ...@@ -1188,7 +1188,8 @@ lcs_remove_mc_addresses(struct lcs_card *card, struct in_device *in4_dev)
spin_lock_irqsave(&card->ipm_lock, flags); spin_lock_irqsave(&card->ipm_lock, flags);
list_for_each(l, &card->ipm_list) { list_for_each(l, &card->ipm_list) {
ipm = list_entry(l, struct lcs_ipm_list, list); ipm = list_entry(l, struct lcs_ipm_list, list);
for (im4 = in4_dev->mc_list; im4 != NULL; im4 = im4->next) { for (im4 = rcu_dereference(in4_dev->mc_list);
im4 != NULL; im4 = rcu_dereference(im4->next_rcu)) {
lcs_get_mac_for_ipm(im4->multiaddr, buf, card->dev); lcs_get_mac_for_ipm(im4->multiaddr, buf, card->dev);
if ( (ipm->ipm.ip_addr == im4->multiaddr) && if ( (ipm->ipm.ip_addr == im4->multiaddr) &&
(memcmp(buf, &ipm->ipm.mac_addr, (memcmp(buf, &ipm->ipm.mac_addr,
...@@ -1233,7 +1234,8 @@ lcs_set_mc_addresses(struct lcs_card *card, struct in_device *in4_dev) ...@@ -1233,7 +1234,8 @@ lcs_set_mc_addresses(struct lcs_card *card, struct in_device *in4_dev)
unsigned long flags; unsigned long flags;
LCS_DBF_TEXT(4, trace, "setmclst"); LCS_DBF_TEXT(4, trace, "setmclst");
for (im4 = in4_dev->mc_list; im4; im4 = im4->next) { for (im4 = rcu_dereference(in4_dev->mc_list); im4 != NULL;
im4 = rcu_dereference(im4->next_rcu)) {
lcs_get_mac_for_ipm(im4->multiaddr, buf, card->dev); lcs_get_mac_for_ipm(im4->multiaddr, buf, card->dev);
ipm = lcs_check_addr_entry(card, im4, buf); ipm = lcs_check_addr_entry(card, im4, buf);
if (ipm != NULL) if (ipm != NULL)
...@@ -1269,10 +1271,10 @@ lcs_register_mc_addresses(void *data) ...@@ -1269,10 +1271,10 @@ lcs_register_mc_addresses(void *data)
in4_dev = in_dev_get(card->dev); in4_dev = in_dev_get(card->dev);
if (in4_dev == NULL) if (in4_dev == NULL)
goto out; goto out;
read_lock(&in4_dev->mc_list_lock); rcu_read_lock();
lcs_remove_mc_addresses(card,in4_dev); lcs_remove_mc_addresses(card,in4_dev);
lcs_set_mc_addresses(card, in4_dev); lcs_set_mc_addresses(card, in4_dev);
read_unlock(&in4_dev->mc_list_lock); rcu_read_unlock();
in_dev_put(in4_dev); in_dev_put(in4_dev);
netif_carrier_off(card->dev); netif_carrier_off(card->dev);
......
...@@ -1796,7 +1796,8 @@ static void qeth_l3_add_mc(struct qeth_card *card, struct in_device *in4_dev) ...@@ -1796,7 +1796,8 @@ static void qeth_l3_add_mc(struct qeth_card *card, struct in_device *in4_dev)
char buf[MAX_ADDR_LEN]; char buf[MAX_ADDR_LEN];
QETH_CARD_TEXT(card, 4, "addmc"); QETH_CARD_TEXT(card, 4, "addmc");
for (im4 = in4_dev->mc_list; im4; im4 = im4->next) { for (im4 = rcu_dereference(in4_dev->mc_list); im4 != NULL;
im4 = rcu_dereference(im4->next_rcu)) {
qeth_l3_get_mac_for_ipm(im4->multiaddr, buf, in4_dev->dev); qeth_l3_get_mac_for_ipm(im4->multiaddr, buf, in4_dev->dev);
ipm = qeth_l3_get_addr_buffer(QETH_PROT_IPV4); ipm = qeth_l3_get_addr_buffer(QETH_PROT_IPV4);
if (!ipm) if (!ipm)
...@@ -1828,9 +1829,9 @@ static void qeth_l3_add_vlan_mc(struct qeth_card *card) ...@@ -1828,9 +1829,9 @@ static void qeth_l3_add_vlan_mc(struct qeth_card *card)
in_dev = in_dev_get(netdev); in_dev = in_dev_get(netdev);
if (!in_dev) if (!in_dev)
continue; continue;
read_lock(&in_dev->mc_list_lock); rcu_read_lock();
qeth_l3_add_mc(card, in_dev); qeth_l3_add_mc(card, in_dev);
read_unlock(&in_dev->mc_list_lock); rcu_read_unlock();
in_dev_put(in_dev); in_dev_put(in_dev);
} }
} }
...@@ -1843,10 +1844,10 @@ static void qeth_l3_add_multicast_ipv4(struct qeth_card *card) ...@@ -1843,10 +1844,10 @@ static void qeth_l3_add_multicast_ipv4(struct qeth_card *card)
in4_dev = in_dev_get(card->dev); in4_dev = in_dev_get(card->dev);
if (in4_dev == NULL) if (in4_dev == NULL)
return; return;
read_lock(&in4_dev->mc_list_lock); rcu_read_lock();
qeth_l3_add_mc(card, in4_dev); qeth_l3_add_mc(card, in4_dev);
qeth_l3_add_vlan_mc(card); qeth_l3_add_vlan_mc(card);
read_unlock(&in4_dev->mc_list_lock); rcu_read_unlock();
in_dev_put(in4_dev); in_dev_put(in4_dev);
} }
......
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