From: Julian Wiedmann <jwi@linux.ibm.com>
To: David Miller <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <linux-s390@vger.kernel.org>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Stefan Raspl <raspl@linux.ibm.com>,
Ursula Braun <ubraun@linux.ibm.com>,
Julian Wiedmann <jwi@linux.ibm.com>
Subject: [PATCH net-next 6/7] s390/qeth: add BQL support for IQD devices
Date: Fri, 23 Aug 2019 11:48:52 +0200 [thread overview]
Message-ID: <20190823094853.63814-7-jwi@linux.ibm.com> (raw)
In-Reply-To: <20190823094853.63814-1-jwi@linux.ibm.com>
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>
---
drivers/s390/net/qeth_core.h | 1 +
drivers/s390/net/qeth_core_main.c | 16 +++++++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
index ae2ae17e3e76..d5f796380cd0 100644
--- a/drivers/s390/net/qeth_core.h
+++ b/drivers/s390/net/qeth_core.h
@@ -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];
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 70c7e675431e..4c7c7d320c9c 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -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;
--
2.17.1
next prev parent reply other threads:[~2019-08-23 9:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-23 9:48 [PATCH net-next 0/7] s390/qeth: updates 2019-08-23 Julian Wiedmann
2019-08-23 9:48 ` [PATCH net-next 1/7] s390/qdio: enable drivers to poll for Output completions Julian Wiedmann
2019-08-23 9:48 ` [PATCH net-next 2/7] s390/qdio: let drivers opt-out from Output Queue scanning Julian Wiedmann
2019-08-23 9:48 ` [PATCH net-next 3/7] s390/qeth: collect accurate TX statistics Julian Wiedmann
2019-08-23 9:48 ` [PATCH net-next 4/7] s390/qeth: add TX NAPI support for IQD devices Julian Wiedmann
2019-08-23 9:48 ` [PATCH net-next 5/7] s390/qeth: when in TX NAPI mode, use napi_consume_skb() Julian Wiedmann
2019-08-23 9:48 ` Julian Wiedmann [this message]
2019-08-23 9:48 ` [PATCH net-next 7/7] s390/qeth: add xmit_more support for IQD devices Julian Wiedmann
2019-08-24 23:39 ` [PATCH net-next 0/7] s390/qeth: updates 2019-08-23 David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190823094853.63814-7-jwi@linux.ibm.com \
--to=jwi@linux.ibm.com \
--cc=davem@davemloft.net \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=raspl@linux.ibm.com \
--cc=ubraun@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).