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

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: default avatarJulian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2edc4bf6
...@@ -194,9 +194,6 @@ static void qeth_clear_working_pool_list(struct qeth_card *card) ...@@ -194,9 +194,6 @@ static void qeth_clear_working_pool_list(struct qeth_card *card)
&card->qdio.in_buf_pool.entry_list, list) &card->qdio.in_buf_pool.entry_list, list)
list_del(&pool_entry->list); list_del(&pool_entry->list);
if (!queue)
return;
for (i = 0; i < ARRAY_SIZE(queue->bufs); i++) for (i = 0; i < ARRAY_SIZE(queue->bufs); i++)
queue->bufs[i].pool_entry = NULL; queue->bufs[i].pool_entry = NULL;
} }
...@@ -275,8 +272,8 @@ int qeth_resize_buffer_pool(struct qeth_card *card, unsigned int count) ...@@ -275,8 +272,8 @@ int qeth_resize_buffer_pool(struct qeth_card *card, unsigned int count)
QETH_CARD_TEXT(card, 2, "realcbp"); QETH_CARD_TEXT(card, 2, "realcbp");
/* Defer until queue is allocated: */ /* Defer until pool is allocated: */
if (!card->qdio.in_q) if (list_empty(&pool->entry_list))
goto out; goto out;
/* Remove entries from the pool: */ /* Remove entries from the pool: */
...@@ -2557,14 +2554,9 @@ static int qeth_alloc_qdio_queues(struct qeth_card *card) ...@@ -2557,14 +2554,9 @@ static int qeth_alloc_qdio_queues(struct qeth_card *card)
QETH_QDIO_ALLOCATED) != QETH_QDIO_UNINITIALIZED) QETH_QDIO_ALLOCATED) != QETH_QDIO_UNINITIALIZED)
return 0; return 0;
QETH_CARD_TEXT(card, 2, "inq");
card->qdio.in_q = qeth_alloc_qdio_queue();
if (!card->qdio.in_q)
goto out_nomem;
/* inbound buffer pool */ /* inbound buffer pool */
if (qeth_alloc_buffer_pool(card)) if (qeth_alloc_buffer_pool(card))
goto out_freeinq; goto out_buffer_pool;
/* outbound */ /* outbound */
for (i = 0; i < card->qdio.no_out_queues; ++i) { for (i = 0; i < card->qdio.no_out_queues; ++i) {
...@@ -2605,10 +2597,7 @@ static int qeth_alloc_qdio_queues(struct qeth_card *card) ...@@ -2605,10 +2597,7 @@ static int qeth_alloc_qdio_queues(struct qeth_card *card)
card->qdio.out_qs[i] = NULL; card->qdio.out_qs[i] = NULL;
} }
qeth_free_buffer_pool(card); qeth_free_buffer_pool(card);
out_freeinq: out_buffer_pool:
qeth_free_qdio_queue(card->qdio.in_q);
card->qdio.in_q = NULL;
out_nomem:
atomic_set(&card->qdio.state, QETH_QDIO_UNINITIALIZED); atomic_set(&card->qdio.state, QETH_QDIO_UNINITIALIZED);
return -ENOMEM; return -ENOMEM;
} }
...@@ -2623,11 +2612,12 @@ static void qeth_free_qdio_queues(struct qeth_card *card) ...@@ -2623,11 +2612,12 @@ static void qeth_free_qdio_queues(struct qeth_card *card)
qeth_free_cq(card); qeth_free_cq(card);
for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; ++j) { for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; ++j) {
if (card->qdio.in_q->bufs[j].rx_skb) if (card->qdio.in_q->bufs[j].rx_skb) {
consume_skb(card->qdio.in_q->bufs[j].rx_skb); consume_skb(card->qdio.in_q->bufs[j].rx_skb);
card->qdio.in_q->bufs[j].rx_skb = NULL;
} }
qeth_free_qdio_queue(card->qdio.in_q); }
card->qdio.in_q = NULL;
/* inbound buffer pool */ /* inbound buffer pool */
qeth_free_buffer_pool(card); qeth_free_buffer_pool(card);
/* free outbound qdio_qs */ /* free outbound qdio_qs */
...@@ -6447,6 +6437,12 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev) ...@@ -6447,6 +6437,12 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev)
qeth_determine_capabilities(card); qeth_determine_capabilities(card);
qeth_set_blkt_defaults(card); qeth_set_blkt_defaults(card);
card->qdio.in_q = qeth_alloc_qdio_queue();
if (!card->qdio.in_q) {
rc = -ENOMEM;
goto err_rx_queue;
}
card->qdio.no_out_queues = card->dev->num_tx_queues; card->qdio.no_out_queues = card->dev->num_tx_queues;
rc = qeth_update_from_chp_desc(card); rc = qeth_update_from_chp_desc(card);
if (rc) if (rc)
...@@ -6473,6 +6469,8 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev) ...@@ -6473,6 +6469,8 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev)
err_setup_disc: err_setup_disc:
err_chp_desc: err_chp_desc:
qeth_free_qdio_queue(card->qdio.in_q);
err_rx_queue:
free_netdev(card->dev); free_netdev(card->dev);
err_card: err_card:
qeth_core_free_card(card); qeth_core_free_card(card);
...@@ -6494,6 +6492,7 @@ static void qeth_core_remove_device(struct ccwgroup_device *gdev) ...@@ -6494,6 +6492,7 @@ static void qeth_core_remove_device(struct ccwgroup_device *gdev)
qeth_free_qdio_queues(card); qeth_free_qdio_queues(card);
qeth_free_qdio_queue(card->qdio.in_q);
free_netdev(card->dev); free_netdev(card->dev);
qeth_core_free_card(card); qeth_core_free_card(card);
put_device(&gdev->dev); put_device(&gdev->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