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

s390/qeth: handle error when backing RX buffer

qeth_init_qdio_queues() fills the RX ring with an initial set of
RX buffers. If qeth_init_input_buffer() fails to back one of the RX
buffers with memory, we need to bail out and report the error.

Fixes: 4a71df50 ("qeth: new qeth device driver")
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 240c1948
...@@ -2624,12 +2624,12 @@ static int qeth_init_input_buffer(struct qeth_card *card, ...@@ -2624,12 +2624,12 @@ static int qeth_init_input_buffer(struct qeth_card *card,
ETH_HLEN + ETH_HLEN +
sizeof(struct ipv6hdr)); sizeof(struct ipv6hdr));
if (!buf->rx_skb) if (!buf->rx_skb)
return 1; return -ENOMEM;
} }
pool_entry = qeth_find_free_buffer_pool_entry(card); pool_entry = qeth_find_free_buffer_pool_entry(card);
if (!pool_entry) if (!pool_entry)
return 1; return -ENOBUFS;
/* /*
* since the buffer is accessed only from the input_tasklet * since the buffer is accessed only from the input_tasklet
...@@ -2674,10 +2674,15 @@ static int qeth_init_qdio_queues(struct qeth_card *card) ...@@ -2674,10 +2674,15 @@ static int qeth_init_qdio_queues(struct qeth_card *card)
/* inbound queue */ /* inbound queue */
qdio_reset_buffers(card->qdio.in_q->qdio_bufs, QDIO_MAX_BUFFERS_PER_Q); qdio_reset_buffers(card->qdio.in_q->qdio_bufs, QDIO_MAX_BUFFERS_PER_Q);
memset(&card->rx, 0, sizeof(struct qeth_rx)); memset(&card->rx, 0, sizeof(struct qeth_rx));
qeth_initialize_working_pool_list(card); qeth_initialize_working_pool_list(card);
/*give only as many buffers to hardware as we have buffer pool entries*/ /*give only as many buffers to hardware as we have buffer pool entries*/
for (i = 0; i < card->qdio.in_buf_pool.buf_count - 1; ++i) for (i = 0; i < card->qdio.in_buf_pool.buf_count - 1; i++) {
qeth_init_input_buffer(card, &card->qdio.in_q->bufs[i]); rc = qeth_init_input_buffer(card, &card->qdio.in_q->bufs[i]);
if (rc)
return rc;
}
card->qdio.in_q->next_buf_to_init = card->qdio.in_q->next_buf_to_init =
card->qdio.in_buf_pool.buf_count - 1; card->qdio.in_buf_pool.buf_count - 1;
rc = do_QDIO(CARD_DDEV(card), QDIO_FLAG_SYNC_INPUT, 0, 0, rc = do_QDIO(CARD_DDEV(card), QDIO_FLAG_SYNC_INPUT, 0, 0,
......
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