]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
s390/qeth: collect more TX statistics
authorJulian Wiedmann <jwi@linux.ibm.com>
Wed, 25 Mar 2020 09:35:03 +0000 (10:35 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 25 Mar 2020 19:07:15 +0000 (12:07 -0700)
Count the number of TX doorbells we issue to the qdio layer.

Also count the number of actual frames in a TX buffer, and then
use this data along with the byte count during TX completion.
We'll make additional use of the frame count in a subsequent patch.

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
drivers/s390/net/qeth_ethtool.c

index 911dcef6adc6b17740c5bbe6c0f5aff6516f8d17..f56670bfcd0a85f4bf9724aef24903b23755045d 100644 (file)
@@ -402,6 +402,7 @@ struct qeth_qdio_out_buffer {
        struct qdio_buffer *buffer;
        atomic_t state;
        int next_element_to_fill;
+       unsigned int frames;
        unsigned int bytes;
        struct sk_buff_head skb_list;
        int is_header[QDIO_MAX_ELEMENTS_PER_BUFFER];
@@ -457,6 +458,7 @@ struct qeth_out_q_stats {
        u64 tso_bytes;
        u64 packing_mode_switch;
        u64 stopped;
+       u64 doorbell;
        u64 completion_yield;
        u64 completion_timer;
 
index 68bba8d057d1f0c9525cf350c6a0296593750f98..108dd9a34f3025ee5fc754f723d03a2629fb2310 100644 (file)
@@ -1155,17 +1155,20 @@ static void qeth_tx_complete_buf(struct qeth_qdio_out_buffer *buf, bool error,
 
        QETH_TXQ_STAT_INC(queue, bufs);
        QETH_TXQ_STAT_ADD(queue, buf_elements, buf->next_element_to_fill);
+       if (error) {
+               QETH_TXQ_STAT_ADD(queue, tx_errors, buf->frames);
+       } else {
+               QETH_TXQ_STAT_ADD(queue, tx_packets, buf->frames);
+               QETH_TXQ_STAT_ADD(queue, tx_bytes, buf->bytes);
+       }
+
        while ((skb = __skb_dequeue(&buf->skb_list)) != NULL) {
                unsigned int bytes = qdisc_pkt_len(skb);
                bool is_tso = skb_is_gso(skb);
                unsigned int packets;
 
                packets = is_tso ? skb_shinfo(skb)->gso_segs : 1;
-               if (error) {
-                       QETH_TXQ_STAT_ADD(queue, tx_errors, packets);
-               } else {
-                       QETH_TXQ_STAT_ADD(queue, tx_packets, packets);
-                       QETH_TXQ_STAT_ADD(queue, tx_bytes, bytes);
+               if (!error) {
                        if (skb->ip_summed == CHECKSUM_PARTIAL)
                                QETH_TXQ_STAT_ADD(queue, skbs_csum, packets);
                        if (skb_is_nonlinear(skb))
@@ -1202,6 +1205,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->frames = 0;
        buf->bytes = 0;
        atomic_set(&buf->state, QETH_QDIO_BUF_EMPTY);
 }
@@ -3389,6 +3393,7 @@ static void qeth_flush_buffers(struct qeth_qdio_out_q *queue, int index,
                }
        }
 
+       QETH_TXQ_STAT_INC(queue, doorbell);
        qdio_flags = QDIO_FLAG_SYNC_OUTPUT;
        if (atomic_read(&queue->set_pci_flags_count))
                qdio_flags |= QDIO_FLAG_PCI_OUT;
@@ -3942,6 +3947,7 @@ static int __qeth_xmit(struct qeth_card *card, struct qeth_qdio_out_q *queue,
 
        next_element = qeth_fill_buffer(buffer, skb, hdr, offset, hd_len);
        buffer->bytes += bytes;
+       buffer->frames += skb_is_gso(skb) ? skb_shinfo(skb)->gso_segs : 1;
        queue->prev_hdr = hdr;
 
        flush = __netdev_tx_sent_queue(txq, bytes,
@@ -4032,6 +4038,8 @@ int qeth_do_send_packet(struct qeth_card *card, struct qeth_qdio_out_q *queue,
        }
 
        next_element = qeth_fill_buffer(buffer, skb, hdr, offset, hd_len);
+       buffer->bytes += qdisc_pkt_len(skb);
+       buffer->frames += skb_is_gso(skb) ? skb_shinfo(skb)->gso_segs : 1;
 
        if (queue->do_pack)
                QETH_TXQ_STAT_INC(queue, skbs_pack);
@@ -5668,7 +5676,7 @@ static int qeth_tx_poll(struct napi_struct *napi, int budget)
                        unsigned int bidx = QDIO_BUFNR(i);
 
                        buffer = queue->bufs[bidx];
-                       packets += skb_queue_len(&buffer->skb_list);
+                       packets += buffer->frames;
                        bytes += buffer->bytes;
 
                        qeth_handle_send_error(card, buffer, error);
index 31e019085fc39d74f58e9d8d37170da6afd23bf0..6f0cc6fcc75920514b7149ca88ef943f854f5037 100644 (file)
@@ -39,6 +39,7 @@ static const struct qeth_stats txq_stats[] = {
        QETH_TXQ_STAT("TSO bytes", tso_bytes),
        QETH_TXQ_STAT("Packing mode switches", packing_mode_switch),
        QETH_TXQ_STAT("Queue stopped", stopped),
+       QETH_TXQ_STAT("Doorbell", doorbell),
        QETH_TXQ_STAT("Completion yield", completion_yield),
        QETH_TXQ_STAT("Completion timer", completion_timer),
 };