Skip to content

Commit 832585d

Browse files
julianwiedmanndavem330
authored andcommitted
s390/qeth: allocate RX queue at probe time
We always need an RX queue, and there's no reconfig situation either where we would need to free & rebuild the queue. So allocate the RX queue right from the start, and avoid freeing it during unrelated qeth_free_qdio_queues() calls. Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Karsten Graul <kgraul@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 2edc4bf commit 832585d

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

drivers/s390/net/qeth_core_main.c

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,6 @@ static void qeth_clear_working_pool_list(struct qeth_card *card)
194194
&card->qdio.in_buf_pool.entry_list, list)
195195
list_del(&pool_entry->list);
196196

197-
if (!queue)
198-
return;
199-
200197
for (i = 0; i < ARRAY_SIZE(queue->bufs); i++)
201198
queue->bufs[i].pool_entry = NULL;
202199
}
@@ -275,8 +272,8 @@ int qeth_resize_buffer_pool(struct qeth_card *card, unsigned int count)
275272

276273
QETH_CARD_TEXT(card, 2, "realcbp");
277274

278-
/* Defer until queue is allocated: */
279-
if (!card->qdio.in_q)
275+
/* Defer until pool is allocated: */
276+
if (list_empty(&pool->entry_list))
280277
goto out;
281278

282279
/* Remove entries from the pool: */
@@ -2557,14 +2554,9 @@ static int qeth_alloc_qdio_queues(struct qeth_card *card)
25572554
QETH_QDIO_ALLOCATED) != QETH_QDIO_UNINITIALIZED)
25582555
return 0;
25592556

2560-
QETH_CARD_TEXT(card, 2, "inq");
2561-
card->qdio.in_q = qeth_alloc_qdio_queue();
2562-
if (!card->qdio.in_q)
2563-
goto out_nomem;
2564-
25652557
/* inbound buffer pool */
25662558
if (qeth_alloc_buffer_pool(card))
2567-
goto out_freeinq;
2559+
goto out_buffer_pool;
25682560

25692561
/* outbound */
25702562
for (i = 0; i < card->qdio.no_out_queues; ++i) {
@@ -2605,10 +2597,7 @@ static int qeth_alloc_qdio_queues(struct qeth_card *card)
26052597
card->qdio.out_qs[i] = NULL;
26062598
}
26072599
qeth_free_buffer_pool(card);
2608-
out_freeinq:
2609-
qeth_free_qdio_queue(card->qdio.in_q);
2610-
card->qdio.in_q = NULL;
2611-
out_nomem:
2600+
out_buffer_pool:
26122601
atomic_set(&card->qdio.state, QETH_QDIO_UNINITIALIZED);
26132602
return -ENOMEM;
26142603
}
@@ -2623,11 +2612,12 @@ static void qeth_free_qdio_queues(struct qeth_card *card)
26232612

26242613
qeth_free_cq(card);
26252614
for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; ++j) {
2626-
if (card->qdio.in_q->bufs[j].rx_skb)
2615+
if (card->qdio.in_q->bufs[j].rx_skb) {
26272616
consume_skb(card->qdio.in_q->bufs[j].rx_skb);
2617+
card->qdio.in_q->bufs[j].rx_skb = NULL;
2618+
}
26282619
}
2629-
qeth_free_qdio_queue(card->qdio.in_q);
2630-
card->qdio.in_q = NULL;
2620+
26312621
/* inbound buffer pool */
26322622
qeth_free_buffer_pool(card);
26332623
/* free outbound qdio_qs */
@@ -6447,6 +6437,12 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev)
64476437
qeth_determine_capabilities(card);
64486438
qeth_set_blkt_defaults(card);
64496439

6440+
card->qdio.in_q = qeth_alloc_qdio_queue();
6441+
if (!card->qdio.in_q) {
6442+
rc = -ENOMEM;
6443+
goto err_rx_queue;
6444+
}
6445+
64506446
card->qdio.no_out_queues = card->dev->num_tx_queues;
64516447
rc = qeth_update_from_chp_desc(card);
64526448
if (rc)
@@ -6473,6 +6469,8 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev)
64736469

64746470
err_setup_disc:
64756471
err_chp_desc:
6472+
qeth_free_qdio_queue(card->qdio.in_q);
6473+
err_rx_queue:
64766474
free_netdev(card->dev);
64776475
err_card:
64786476
qeth_core_free_card(card);
@@ -6494,6 +6492,7 @@ static void qeth_core_remove_device(struct ccwgroup_device *gdev)
64946492

64956493
qeth_free_qdio_queues(card);
64966494

6495+
qeth_free_qdio_queue(card->qdio.in_q);
64976496
free_netdev(card->dev);
64986497
qeth_core_free_card(card);
64996498
put_device(&gdev->dev);

0 commit comments

Comments
 (0)