Commit d4ac0246 authored by Julian Wiedmann's avatar Julian Wiedmann Committed by David S. Miller

s390/qeth: convert vlan spinlock to mutex

As the vid_list is only accessed from process context, there's no need to
protect it with a spinlock.
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7bcd64eb
...@@ -777,9 +777,9 @@ struct qeth_card { ...@@ -777,9 +777,9 @@ struct qeth_card {
struct qeth_card_options options; struct qeth_card_options options;
wait_queue_head_t wait_q; wait_queue_head_t wait_q;
spinlock_t vlanlock;
spinlock_t mclock; spinlock_t mclock;
unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
struct mutex vid_list_mutex; /* vid_list */
struct list_head vid_list; struct list_head vid_list;
DECLARE_HASHTABLE(mac_htable, 4); DECLARE_HASHTABLE(mac_htable, 4);
DECLARE_HASHTABLE(ip_htable, 4); DECLARE_HASHTABLE(ip_htable, 4);
......
...@@ -1467,13 +1467,13 @@ static int qeth_setup_card(struct qeth_card *card) ...@@ -1467,13 +1467,13 @@ static int qeth_setup_card(struct qeth_card *card)
card->lan_online = 0; card->lan_online = 0;
card->read_or_write_problem = 0; card->read_or_write_problem = 0;
card->dev = NULL; card->dev = NULL;
spin_lock_init(&card->vlanlock);
spin_lock_init(&card->mclock); spin_lock_init(&card->mclock);
spin_lock_init(&card->lock); spin_lock_init(&card->lock);
spin_lock_init(&card->ip_lock); spin_lock_init(&card->ip_lock);
spin_lock_init(&card->thread_mask_lock); spin_lock_init(&card->thread_mask_lock);
mutex_init(&card->conf_mutex); mutex_init(&card->conf_mutex);
mutex_init(&card->discipline_mutex); mutex_init(&card->discipline_mutex);
mutex_init(&card->vid_list_mutex);
card->thread_start_mask = 0; card->thread_start_mask = 0;
card->thread_allowed_mask = 0; card->thread_allowed_mask = 0;
card->thread_running_mask = 0; card->thread_running_mask = 0;
......
...@@ -297,12 +297,13 @@ static int qeth_l2_send_setdelvlan(struct qeth_card *card, __u16 i, ...@@ -297,12 +297,13 @@ static int qeth_l2_send_setdelvlan(struct qeth_card *card, __u16 i,
static void qeth_l2_process_vlans(struct qeth_card *card) static void qeth_l2_process_vlans(struct qeth_card *card)
{ {
struct qeth_vlan_vid *id; struct qeth_vlan_vid *id;
QETH_CARD_TEXT(card, 3, "L2prcvln"); QETH_CARD_TEXT(card, 3, "L2prcvln");
spin_lock_bh(&card->vlanlock); mutex_lock(&card->vid_list_mutex);
list_for_each_entry(id, &card->vid_list, list) { list_for_each_entry(id, &card->vid_list, list) {
qeth_l2_send_setdelvlan(card, id->vid, IPA_CMD_SETVLAN); qeth_l2_send_setdelvlan(card, id->vid, IPA_CMD_SETVLAN);
} }
spin_unlock_bh(&card->vlanlock); mutex_unlock(&card->vid_list_mutex);
} }
static int qeth_l2_vlan_rx_add_vid(struct net_device *dev, static int qeth_l2_vlan_rx_add_vid(struct net_device *dev,
...@@ -319,7 +320,7 @@ static int qeth_l2_vlan_rx_add_vid(struct net_device *dev, ...@@ -319,7 +320,7 @@ static int qeth_l2_vlan_rx_add_vid(struct net_device *dev,
QETH_CARD_TEXT(card, 3, "aidREC"); QETH_CARD_TEXT(card, 3, "aidREC");
return 0; return 0;
} }
id = kmalloc(sizeof(struct qeth_vlan_vid), GFP_ATOMIC); id = kmalloc(sizeof(*id), GFP_KERNEL);
if (id) { if (id) {
id->vid = vid; id->vid = vid;
rc = qeth_l2_send_setdelvlan(card, vid, IPA_CMD_SETVLAN); rc = qeth_l2_send_setdelvlan(card, vid, IPA_CMD_SETVLAN);
...@@ -327,9 +328,9 @@ static int qeth_l2_vlan_rx_add_vid(struct net_device *dev, ...@@ -327,9 +328,9 @@ static int qeth_l2_vlan_rx_add_vid(struct net_device *dev,
kfree(id); kfree(id);
return rc; return rc;
} }
spin_lock_bh(&card->vlanlock); mutex_lock(&card->vid_list_mutex);
list_add_tail(&id->list, &card->vid_list); list_add_tail(&id->list, &card->vid_list);
spin_unlock_bh(&card->vlanlock); mutex_unlock(&card->vid_list_mutex);
} else { } else {
return -ENOMEM; return -ENOMEM;
} }
...@@ -348,7 +349,7 @@ static int qeth_l2_vlan_rx_kill_vid(struct net_device *dev, ...@@ -348,7 +349,7 @@ static int qeth_l2_vlan_rx_kill_vid(struct net_device *dev,
QETH_CARD_TEXT(card, 3, "kidREC"); QETH_CARD_TEXT(card, 3, "kidREC");
return 0; return 0;
} }
spin_lock_bh(&card->vlanlock); mutex_lock(&card->vid_list_mutex);
list_for_each_entry(id, &card->vid_list, list) { list_for_each_entry(id, &card->vid_list, list) {
if (id->vid == vid) { if (id->vid == vid) {
list_del(&id->list); list_del(&id->list);
...@@ -356,7 +357,7 @@ static int qeth_l2_vlan_rx_kill_vid(struct net_device *dev, ...@@ -356,7 +357,7 @@ static int qeth_l2_vlan_rx_kill_vid(struct net_device *dev,
break; break;
} }
} }
spin_unlock_bh(&card->vlanlock); mutex_unlock(&card->vid_list_mutex);
if (tmpid) { if (tmpid) {
rc = qeth_l2_send_setdelvlan(card, vid, IPA_CMD_DELVLAN); rc = qeth_l2_send_setdelvlan(card, vid, IPA_CMD_DELVLAN);
kfree(tmpid); kfree(tmpid);
......
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