s390/qeth: add BQL support for IQD devices
authorJulian Wiedmann <jwi@linux.ibm.com>
Fri, 23 Aug 2019 09:48:52 +0000 (11:48 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 24 Aug 2019 23:39:19 +0000 (16:39 -0700)
Each TX buffer may contain multiple skbs. So just accumulate the sent
byte count in the buffer struct, and later use the same count when
completing the buffer.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/s390/net/qeth_core.h
drivers/s390/net/qeth_core_main.c

index ae2ae17e3e76833092c2ed7a53f16cc1b5a86e6b..d5f796380cd0fc1c7e3f1565ab12db772590744e 100644 (file)
@@ -426,6 +426,7 @@ struct qeth_qdio_out_buffer {
        struct qdio_buffer *buffer;
        atomic_t state;
        int next_element_to_fill;
+       unsigned int bytes;
        struct sk_buff_head skb_list;
        int is_header[QDIO_MAX_ELEMENTS_PER_BUFFER];
 
index 70c7e675431e1ba0025e3c353e5b105308458ec8..4c7c7d320c9cce5113c6ab4785fe34b89286433c 100644 (file)
@@ -1142,6 +1142,7 @@ static void qeth_clear_output_buffer(struct qeth_qdio_out_q *queue,
 
        qeth_scrub_qdio_buffer(buf->buffer, queue->max_elements);
        buf->next_element_to_fill = 0;
+       buf->bytes = 0;
        atomic_set(&buf->state, QETH_QDIO_BUF_EMPTY);
 }
 
@@ -2673,6 +2674,7 @@ int qeth_init_qdio_queues(struct qeth_card *card)
                atomic_set(&queue->used_buffers, 0);
                atomic_set(&queue->set_pci_flags_count, 0);
                atomic_set(&queue->state, QETH_OUT_Q_UNLOCKED);
+               netdev_tx_reset_queue(netdev_get_tx_queue(card->dev, i));
        }
        return 0;
 }
@@ -3790,6 +3792,7 @@ static int qeth_do_send_packet_fast(struct qeth_qdio_out_q *queue,
 {
        int index = queue->next_buf_to_fill;
        struct qeth_qdio_out_buffer *buffer = queue->bufs[index];
+       unsigned int bytes = qdisc_pkt_len(skb);
        struct netdev_queue *txq;
        bool stopped = false;
 
@@ -3811,6 +3814,9 @@ static int qeth_do_send_packet_fast(struct qeth_qdio_out_q *queue,
        }
 
        qeth_fill_buffer(queue, buffer, skb, hdr, offset, hd_len, stopped);
+       netdev_tx_sent_queue(txq, bytes);
+       buffer->bytes += bytes;
+
        qeth_flush_buffers(queue, index, 1);
 
        if (stopped && !qeth_out_queue_is_full(queue))
@@ -5186,6 +5192,8 @@ static int qeth_tx_poll(struct napi_struct *napi, int budget)
 
        while (1) {
                unsigned int start, error, i;
+               unsigned int packets = 0;
+               unsigned int bytes = 0;
                int completed;
 
                if (qeth_out_queue_is_empty(queue)) {
@@ -5211,13 +5219,19 @@ static int qeth_tx_poll(struct napi_struct *napi, int budget)
                }
 
                for (i = start; i < start + completed; i++) {
+                       struct qeth_qdio_out_buffer *buffer;
                        unsigned int bidx = QDIO_BUFNR(i);
 
-                       qeth_handle_send_error(card, queue->bufs[bidx], error);
+                       buffer = queue->bufs[bidx];
+                       packets += skb_queue_len(&buffer->skb_list);
+                       bytes += buffer->bytes;
+
+                       qeth_handle_send_error(card, buffer, error);
                        qeth_iqd_tx_complete(queue, bidx, error, budget);
                        qeth_cleanup_handled_pending(queue, bidx, false);
                }
 
+               netdev_tx_completed_queue(txq, packets, bytes);
                atomic_sub(completed, &queue->used_buffers);
                work_done += completed;