Commit 58490f18 authored by Klaus-Dieter Wacker's avatar Klaus-Dieter Wacker Committed by David S. Miller

qeth: HiperSockets SIGA retry support on CC=2.

Qeth HiperSockets support now retries sending of packets when the
IBM System z signals a temporary resource shortage (e.g. target
buffer full). The packet is enqueued into the device queue.
After 3 times of unsuccessful send the packet is dropped.
Signed-off-by: default avatarKlaus-Dieter Wacker <kdwacker@de.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 31ffe249
...@@ -435,6 +435,7 @@ struct qeth_qdio_out_q { ...@@ -435,6 +435,7 @@ struct qeth_qdio_out_q {
* index of buffer to be filled by driver; state EMPTY or PACKING * index of buffer to be filled by driver; state EMPTY or PACKING
*/ */
int next_buf_to_fill; int next_buf_to_fill;
int sync_iqdio_error;
/* /*
* number of buffers that are currently filled (PRIMED) * number of buffers that are currently filled (PRIMED)
* -> these buffers are hardware-owned * -> these buffers are hardware-owned
...@@ -685,6 +686,14 @@ struct qeth_mc_mac { ...@@ -685,6 +686,14 @@ struct qeth_mc_mac {
int is_vmac; int is_vmac;
}; };
struct qeth_skb_data {
__u32 magic;
int count;
};
#define QETH_SKB_MAGIC 0x71657468
#define QETH_SIGA_CC2_RETRIES 3
struct qeth_card { struct qeth_card {
struct list_head list; struct list_head list;
enum qeth_card_states state; enum qeth_card_states state;
......
...@@ -927,8 +927,8 @@ static void qeth_irq(struct ccw_device *cdev, unsigned long intparm, ...@@ -927,8 +927,8 @@ static void qeth_irq(struct ccw_device *cdev, unsigned long intparm,
return; return;
} }
static void qeth_clear_output_buffer(struct qeth_qdio_out_q *queue, static void __qeth_clear_output_buffer(struct qeth_qdio_out_q *queue,
struct qeth_qdio_out_buffer *buf) struct qeth_qdio_out_buffer *buf, unsigned int qeth_skip_skb)
{ {
int i; int i;
struct sk_buff *skb; struct sk_buff *skb;
...@@ -937,12 +937,14 @@ static void qeth_clear_output_buffer(struct qeth_qdio_out_q *queue, ...@@ -937,12 +937,14 @@ static void qeth_clear_output_buffer(struct qeth_qdio_out_q *queue,
if (buf->buffer->element[0].flags & 0x40) if (buf->buffer->element[0].flags & 0x40)
atomic_dec(&queue->set_pci_flags_count); atomic_dec(&queue->set_pci_flags_count);
if (!qeth_skip_skb) {
skb = skb_dequeue(&buf->skb_list); skb = skb_dequeue(&buf->skb_list);
while (skb) { while (skb) {
atomic_dec(&skb->users); atomic_dec(&skb->users);
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
skb = skb_dequeue(&buf->skb_list); skb = skb_dequeue(&buf->skb_list);
} }
}
for (i = 0; i < QETH_MAX_BUFFER_ELEMENTS(queue->card); ++i) { for (i = 0; i < QETH_MAX_BUFFER_ELEMENTS(queue->card); ++i) {
if (buf->buffer->element[i].addr && buf->is_header[i]) if (buf->buffer->element[i].addr && buf->is_header[i])
kmem_cache_free(qeth_core_header_cache, kmem_cache_free(qeth_core_header_cache,
...@@ -957,6 +959,12 @@ static void qeth_clear_output_buffer(struct qeth_qdio_out_q *queue, ...@@ -957,6 +959,12 @@ static void qeth_clear_output_buffer(struct qeth_qdio_out_q *queue,
atomic_set(&buf->state, QETH_QDIO_BUF_EMPTY); atomic_set(&buf->state, QETH_QDIO_BUF_EMPTY);
} }
static void qeth_clear_output_buffer(struct qeth_qdio_out_q *queue,
struct qeth_qdio_out_buffer *buf)
{
__qeth_clear_output_buffer(queue, buf, 0);
}
void qeth_clear_qdio_buffers(struct qeth_card *card) void qeth_clear_qdio_buffers(struct qeth_card *card)
{ {
int i, j; int i, j;
...@@ -2685,6 +2693,13 @@ static int qeth_handle_send_error(struct qeth_card *card, ...@@ -2685,6 +2693,13 @@ static int qeth_handle_send_error(struct qeth_card *card,
int sbalf15 = buffer->buffer->element[15].flags & 0xff; int sbalf15 = buffer->buffer->element[15].flags & 0xff;
QETH_DBF_TEXT(TRACE, 6, "hdsnderr"); QETH_DBF_TEXT(TRACE, 6, "hdsnderr");
if (card->info.type == QETH_CARD_TYPE_IQD) {
if (sbalf15 == 0) {
qdio_err = 0;
} else {
qdio_err = 1;
}
}
qeth_check_qdio_errors(buffer->buffer, qdio_err, "qouterr"); qeth_check_qdio_errors(buffer->buffer, qdio_err, "qouterr");
if (!qdio_err) if (!qdio_err)
...@@ -2817,6 +2832,7 @@ static void qeth_flush_buffers(struct qeth_qdio_out_q *queue, int index, ...@@ -2817,6 +2832,7 @@ static void qeth_flush_buffers(struct qeth_qdio_out_q *queue, int index,
} }
} }
queue->sync_iqdio_error = 0;
queue->card->dev->trans_start = jiffies; queue->card->dev->trans_start = jiffies;
if (queue->card->options.performance_stats) { if (queue->card->options.performance_stats) {
queue->card->perf_stats.outbound_do_qdio_cnt++; queue->card->perf_stats.outbound_do_qdio_cnt++;
...@@ -2832,6 +2848,10 @@ static void qeth_flush_buffers(struct qeth_qdio_out_q *queue, int index, ...@@ -2832,6 +2848,10 @@ static void qeth_flush_buffers(struct qeth_qdio_out_q *queue, int index,
queue->card->perf_stats.outbound_do_qdio_time += queue->card->perf_stats.outbound_do_qdio_time +=
qeth_get_micros() - qeth_get_micros() -
queue->card->perf_stats.outbound_do_qdio_start_time; queue->card->perf_stats.outbound_do_qdio_start_time;
if (rc > 0) {
if (!(rc & QDIO_ERROR_SIGA_BUSY))
queue->sync_iqdio_error = rc & 3;
}
if (rc) { if (rc) {
queue->card->stats.tx_errors += count; queue->card->stats.tx_errors += count;
/* ignore temporary SIGA errors without busy condition */ /* ignore temporary SIGA errors without busy condition */
...@@ -2899,6 +2919,7 @@ void qeth_qdio_output_handler(struct ccw_device *ccwdev, ...@@ -2899,6 +2919,7 @@ void qeth_qdio_output_handler(struct ccw_device *ccwdev,
struct qeth_qdio_out_q *queue = card->qdio.out_qs[__queue]; struct qeth_qdio_out_q *queue = card->qdio.out_qs[__queue];
struct qeth_qdio_out_buffer *buffer; struct qeth_qdio_out_buffer *buffer;
int i; int i;
unsigned qeth_send_err;
QETH_DBF_TEXT(TRACE, 6, "qdouhdl"); QETH_DBF_TEXT(TRACE, 6, "qdouhdl");
if (qdio_error & QDIO_ERROR_ACTIVATE_CHECK_CONDITION) { if (qdio_error & QDIO_ERROR_ACTIVATE_CHECK_CONDITION) {
...@@ -2915,8 +2936,9 @@ void qeth_qdio_output_handler(struct ccw_device *ccwdev, ...@@ -2915,8 +2936,9 @@ void qeth_qdio_output_handler(struct ccw_device *ccwdev,
} }
for (i = first_element; i < (first_element + count); ++i) { for (i = first_element; i < (first_element + count); ++i) {
buffer = &queue->bufs[i % QDIO_MAX_BUFFERS_PER_Q]; buffer = &queue->bufs[i % QDIO_MAX_BUFFERS_PER_Q];
qeth_handle_send_error(card, buffer, qdio_error); qeth_send_err = qeth_handle_send_error(card, buffer, qdio_error);
qeth_clear_output_buffer(queue, buffer); __qeth_clear_output_buffer(queue, buffer,
(qeth_send_err == QETH_SEND_ERROR_RETRY) ? 1 : 0);
} }
atomic_sub(count, &queue->used_buffers); atomic_sub(count, &queue->used_buffers);
/* check if we need to do something on this outbound queue */ /* check if we need to do something on this outbound queue */
...@@ -3159,7 +3181,10 @@ int qeth_do_send_packet_fast(struct qeth_card *card, ...@@ -3159,7 +3181,10 @@ int qeth_do_send_packet_fast(struct qeth_card *card,
int offset, int hd_len) int offset, int hd_len)
{ {
struct qeth_qdio_out_buffer *buffer; struct qeth_qdio_out_buffer *buffer;
struct sk_buff *skb1;
struct qeth_skb_data *retry_ctrl;
int index; int index;
int rc;
/* spin until we get the queue ... */ /* spin until we get the queue ... */
while (atomic_cmpxchg(&queue->state, QETH_OUT_Q_UNLOCKED, while (atomic_cmpxchg(&queue->state, QETH_OUT_Q_UNLOCKED,
...@@ -3178,6 +3203,25 @@ int qeth_do_send_packet_fast(struct qeth_card *card, ...@@ -3178,6 +3203,25 @@ int qeth_do_send_packet_fast(struct qeth_card *card,
atomic_set(&queue->state, QETH_OUT_Q_UNLOCKED); atomic_set(&queue->state, QETH_OUT_Q_UNLOCKED);
qeth_fill_buffer(queue, buffer, skb, hdr, offset, hd_len); qeth_fill_buffer(queue, buffer, skb, hdr, offset, hd_len);
qeth_flush_buffers(queue, index, 1); qeth_flush_buffers(queue, index, 1);
if (queue->sync_iqdio_error == 2) {
skb1 = skb_dequeue(&buffer->skb_list);
while (skb1) {
atomic_dec(&skb1->users);
skb1 = skb_dequeue(&buffer->skb_list);
}
retry_ctrl = (struct qeth_skb_data *) &skb->cb[16];
if (retry_ctrl->magic != QETH_SKB_MAGIC) {
retry_ctrl->magic = QETH_SKB_MAGIC;
retry_ctrl->count = 0;
}
if (retry_ctrl->count < QETH_SIGA_CC2_RETRIES) {
retry_ctrl->count++;
rc = dev_queue_xmit(skb);
} else {
dev_kfree_skb_any(skb);
QETH_DBF_TEXT(QERR, 2, "qrdrop");
}
}
return 0; return 0;
out: out:
atomic_set(&queue->state, QETH_OUT_Q_UNLOCKED); atomic_set(&queue->state, QETH_OUT_Q_UNLOCKED);
......
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