Skip to content

Commit df2a2a5

Browse files
julianwiedmanndavem330
authored andcommitted
s390/qeth: convert IP table spinlock to mutex
All users of the lock are running in process context now. Signed-off-by: Julian Wiedmann <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7686e4b commit df2a2a5

File tree

4 files changed

+28
-29
lines changed

4 files changed

+28
-29
lines changed

drivers/s390/net/qeth_core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,14 +779,14 @@ struct qeth_card {
779779
unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
780780
DECLARE_HASHTABLE(mac_htable, 4);
781781
DECLARE_HASHTABLE(ip_htable, 4);
782+
struct mutex ip_lock;
782783
DECLARE_HASHTABLE(ip_mc_htable, 4);
783784
struct work_struct rx_mode_work;
784785
struct work_struct kernel_thread_starter;
785786
spinlock_t thread_mask_lock;
786787
unsigned long thread_start_mask;
787788
unsigned long thread_allowed_mask;
788789
unsigned long thread_running_mask;
789-
spinlock_t ip_lock;
790790
struct qeth_ipato ipato;
791791
struct list_head cmd_waiter_list;
792792
/* QDIO buffer handling */

drivers/s390/net/qeth_core_main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1410,7 +1410,6 @@ static void qeth_setup_card(struct qeth_card *card)
14101410
card->info.type = CARD_RDEV(card)->id.driver_info;
14111411
card->state = CARD_STATE_DOWN;
14121412
spin_lock_init(&card->lock);
1413-
spin_lock_init(&card->ip_lock);
14141413
spin_lock_init(&card->thread_mask_lock);
14151414
mutex_init(&card->conf_mutex);
14161415
mutex_init(&card->discipline_mutex);

drivers/s390/net/qeth_l3_main.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,9 @@ static int qeth_l3_add_ip(struct qeth_card *card, struct qeth_ipaddr *tmp_addr)
246246
*/
247247
if (addr->proto == QETH_PROT_IPV4) {
248248
addr->in_progress = 1;
249-
spin_unlock_bh(&card->ip_lock);
249+
mutex_unlock(&card->ip_lock);
250250
rc = qeth_l3_register_addr_entry(card, addr);
251-
spin_lock_bh(&card->ip_lock);
251+
mutex_lock(&card->ip_lock);
252252
addr->in_progress = 0;
253253
} else
254254
rc = qeth_l3_register_addr_entry(card, addr);
@@ -273,9 +273,9 @@ static int qeth_l3_modify_ip(struct qeth_card *card, struct qeth_ipaddr *addr,
273273
{
274274
int rc;
275275

276-
spin_lock_bh(&card->ip_lock);
276+
mutex_lock(&card->ip_lock);
277277
rc = add ? qeth_l3_add_ip(card, addr) : qeth_l3_delete_ip(card, addr);
278-
spin_unlock_bh(&card->ip_lock);
278+
mutex_unlock(&card->ip_lock);
279279

280280
return rc;
281281
}
@@ -300,7 +300,7 @@ static void qeth_l3_clear_ip_htable(struct qeth_card *card, int recover)
300300

301301
QETH_CARD_TEXT(card, 4, "clearip");
302302

303-
spin_lock_bh(&card->ip_lock);
303+
mutex_lock(&card->ip_lock);
304304

305305
hash_for_each_safe(card->ip_htable, i, tmp, addr, hnode) {
306306
if (!recover) {
@@ -311,7 +311,7 @@ static void qeth_l3_clear_ip_htable(struct qeth_card *card, int recover)
311311
addr->disp_flag = QETH_DISP_ADDR_ADD;
312312
}
313313

314-
spin_unlock_bh(&card->ip_lock);
314+
mutex_unlock(&card->ip_lock);
315315
}
316316

317317
static void qeth_l3_recover_ip(struct qeth_card *card)
@@ -323,15 +323,15 @@ static void qeth_l3_recover_ip(struct qeth_card *card)
323323

324324
QETH_CARD_TEXT(card, 4, "recovrip");
325325

326-
spin_lock_bh(&card->ip_lock);
326+
mutex_lock(&card->ip_lock);
327327

328328
hash_for_each_safe(card->ip_htable, i, tmp, addr, hnode) {
329329
if (addr->disp_flag == QETH_DISP_ADDR_ADD) {
330330
if (addr->proto == QETH_PROT_IPV4) {
331331
addr->in_progress = 1;
332-
spin_unlock_bh(&card->ip_lock);
332+
mutex_unlock(&card->ip_lock);
333333
rc = qeth_l3_register_addr_entry(card, addr);
334-
spin_lock_bh(&card->ip_lock);
334+
mutex_lock(&card->ip_lock);
335335
addr->in_progress = 0;
336336
} else
337337
rc = qeth_l3_register_addr_entry(card, addr);
@@ -347,8 +347,7 @@ static void qeth_l3_recover_ip(struct qeth_card *card)
347347
}
348348
}
349349

350-
spin_unlock_bh(&card->ip_lock);
351-
350+
mutex_unlock(&card->ip_lock);
352351
}
353352

354353
static int qeth_l3_setdelip_cb(struct qeth_card *card, struct qeth_reply *reply,
@@ -573,15 +572,15 @@ static void qeth_l3_clear_ipato_list(struct qeth_card *card)
573572
{
574573
struct qeth_ipato_entry *ipatoe, *tmp;
575574

576-
spin_lock_bh(&card->ip_lock);
575+
mutex_lock(&card->ip_lock);
577576

578577
list_for_each_entry_safe(ipatoe, tmp, &card->ipato.entries, entry) {
579578
list_del(&ipatoe->entry);
580579
kfree(ipatoe);
581580
}
582581

583582
qeth_l3_update_ipato(card);
584-
spin_unlock_bh(&card->ip_lock);
583+
mutex_unlock(&card->ip_lock);
585584
}
586585

587586
int qeth_l3_add_ipato_entry(struct qeth_card *card,
@@ -592,7 +591,7 @@ int qeth_l3_add_ipato_entry(struct qeth_card *card,
592591

593592
QETH_CARD_TEXT(card, 2, "addipato");
594593

595-
spin_lock_bh(&card->ip_lock);
594+
mutex_lock(&card->ip_lock);
596595

597596
list_for_each_entry(ipatoe, &card->ipato.entries, entry) {
598597
if (ipatoe->proto != new->proto)
@@ -610,7 +609,7 @@ int qeth_l3_add_ipato_entry(struct qeth_card *card,
610609
qeth_l3_update_ipato(card);
611610
}
612611

613-
spin_unlock_bh(&card->ip_lock);
612+
mutex_unlock(&card->ip_lock);
614613

615614
return rc;
616615
}
@@ -624,7 +623,7 @@ int qeth_l3_del_ipato_entry(struct qeth_card *card,
624623

625624
QETH_CARD_TEXT(card, 2, "delipato");
626625

627-
spin_lock_bh(&card->ip_lock);
626+
mutex_lock(&card->ip_lock);
628627

629628
list_for_each_entry_safe(ipatoe, tmp, &card->ipato.entries, entry) {
630629
if (ipatoe->proto != proto)
@@ -639,7 +638,7 @@ int qeth_l3_del_ipato_entry(struct qeth_card *card,
639638
}
640639
}
641640

642-
spin_unlock_bh(&card->ip_lock);
641+
mutex_unlock(&card->ip_lock);
643642
return rc;
644643
}
645644

@@ -2267,6 +2266,7 @@ static int qeth_l3_probe_device(struct ccwgroup_device *gdev)
22672266
int rc;
22682267

22692268
hash_init(card->ip_htable);
2269+
mutex_init(&card->ip_lock);
22702270
card->cmd_wq = alloc_ordered_workqueue("%s_cmd", 0,
22712271
dev_name(&gdev->dev));
22722272
if (!card->cmd_wq)

drivers/s390/net/qeth_l3_sys.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,9 @@ static ssize_t qeth_l3_dev_ipato_enable_store(struct device *dev,
367367

368368
if (card->ipato.enabled != enable) {
369369
card->ipato.enabled = enable;
370-
spin_lock_bh(&card->ip_lock);
370+
mutex_lock(&card->ip_lock);
371371
qeth_l3_update_ipato(card);
372-
spin_unlock_bh(&card->ip_lock);
372+
mutex_unlock(&card->ip_lock);
373373
}
374374
out:
375375
mutex_unlock(&card->conf_mutex);
@@ -412,9 +412,9 @@ static ssize_t qeth_l3_dev_ipato_invert4_store(struct device *dev,
412412

413413
if (card->ipato.invert4 != invert) {
414414
card->ipato.invert4 = invert;
415-
spin_lock_bh(&card->ip_lock);
415+
mutex_lock(&card->ip_lock);
416416
qeth_l3_update_ipato(card);
417-
spin_unlock_bh(&card->ip_lock);
417+
mutex_unlock(&card->ip_lock);
418418
}
419419
out:
420420
mutex_unlock(&card->conf_mutex);
@@ -436,7 +436,7 @@ static ssize_t qeth_l3_dev_ipato_add_show(char *buf, struct qeth_card *card,
436436
entry_len = (proto == QETH_PROT_IPV4)? 12 : 40;
437437
/* add strlen for "/<mask>\n" */
438438
entry_len += (proto == QETH_PROT_IPV4)? 5 : 6;
439-
spin_lock_bh(&card->ip_lock);
439+
mutex_lock(&card->ip_lock);
440440
list_for_each_entry(ipatoe, &card->ipato.entries, entry) {
441441
if (ipatoe->proto != proto)
442442
continue;
@@ -449,7 +449,7 @@ static ssize_t qeth_l3_dev_ipato_add_show(char *buf, struct qeth_card *card,
449449
i += snprintf(buf + i, PAGE_SIZE - i,
450450
"%s/%i\n", addr_str, ipatoe->mask_bits);
451451
}
452-
spin_unlock_bh(&card->ip_lock);
452+
mutex_unlock(&card->ip_lock);
453453
i += snprintf(buf + i, PAGE_SIZE - i, "\n");
454454

455455
return i;
@@ -598,9 +598,9 @@ static ssize_t qeth_l3_dev_ipato_invert6_store(struct device *dev,
598598

599599
if (card->ipato.invert6 != invert) {
600600
card->ipato.invert6 = invert;
601-
spin_lock_bh(&card->ip_lock);
601+
mutex_lock(&card->ip_lock);
602602
qeth_l3_update_ipato(card);
603-
spin_unlock_bh(&card->ip_lock);
603+
mutex_unlock(&card->ip_lock);
604604
}
605605
out:
606606
mutex_unlock(&card->conf_mutex);
@@ -684,7 +684,7 @@ static ssize_t qeth_l3_dev_ip_add_show(struct device *dev, char *buf,
684684

685685
entry_len = (proto == QETH_PROT_IPV4)? 12 : 40;
686686
entry_len += 2; /* \n + terminator */
687-
spin_lock_bh(&card->ip_lock);
687+
mutex_lock(&card->ip_lock);
688688
hash_for_each(card->ip_htable, i, ipaddr, hnode) {
689689
if (ipaddr->proto != proto || ipaddr->type != type)
690690
continue;
@@ -698,7 +698,7 @@ static ssize_t qeth_l3_dev_ip_add_show(struct device *dev, char *buf,
698698
str_len += snprintf(buf + str_len, PAGE_SIZE - str_len, "%s\n",
699699
addr_str);
700700
}
701-
spin_unlock_bh(&card->ip_lock);
701+
mutex_unlock(&card->ip_lock);
702702
str_len += snprintf(buf + str_len, PAGE_SIZE - str_len, "\n");
703703

704704
return str_len;

0 commit comments

Comments
 (0)