cxgbe: Add counters for POSIX async I/O requests handled by the driver

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D43668

(cherry picked from commit c3d4aea6c5)
This commit is contained in:
John Baldwin 2024-01-30 16:40:31 -08:00
parent dff5ad1361
commit d50a1d0ace
5 changed files with 39 additions and 3 deletions

View file

@ -690,6 +690,8 @@ struct sge_ofld_rxq {
uint64_t rx_iscsi_padding_errors;
uint64_t rx_iscsi_header_digest_errors;
uint64_t rx_iscsi_data_digest_errors;
uint64_t rx_aio_ddp_jobs;
uint64_t rx_aio_ddp_octets;
u_long rx_toe_tls_records;
u_long rx_toe_tls_octets;
} __aligned(CACHE_LINE_SIZE);
@ -756,6 +758,8 @@ struct sge_ofld_txq {
counter_u64_t tx_iscsi_pdus;
counter_u64_t tx_iscsi_octets;
counter_u64_t tx_iscsi_iso_wrs;
counter_u64_t tx_aio_jobs;
counter_u64_t tx_aio_octets;
counter_u64_t tx_toe_tls_records;
counter_u64_t tx_toe_tls_octets;
} __aligned(CACHE_LINE_SIZE);

View file

@ -12190,6 +12190,8 @@ clear_stats(struct adapter *sc, u_int port_id)
counter_u64_zero(ofld_txq->tx_iscsi_pdus);
counter_u64_zero(ofld_txq->tx_iscsi_octets);
counter_u64_zero(ofld_txq->tx_iscsi_iso_wrs);
counter_u64_zero(ofld_txq->tx_aio_jobs);
counter_u64_zero(ofld_txq->tx_aio_octets);
counter_u64_zero(ofld_txq->tx_toe_tls_records);
counter_u64_zero(ofld_txq->tx_toe_tls_octets);
}
@ -12207,6 +12209,8 @@ clear_stats(struct adapter *sc, u_int port_id)
ofld_rxq->rx_iscsi_ddp_octets = 0;
ofld_rxq->rx_iscsi_fl_pdus = 0;
ofld_rxq->rx_iscsi_fl_octets = 0;
ofld_rxq->rx_aio_ddp_jobs = 0;
ofld_rxq->rx_aio_ddp_octets = 0;
ofld_rxq->rx_toe_tls_records = 0;
ofld_rxq->rx_toe_tls_octets = 0;
}

View file

@ -4217,6 +4217,12 @@ add_ofld_rxq_sysctls(struct sysctl_ctx_list *ctx, struct sysctl_oid *oid,
return;
children = SYSCTL_CHILDREN(oid);
SYSCTL_ADD_U64(ctx, children, OID_AUTO, "rx_aio_ddp_jobs",
CTLFLAG_RD, &ofld_rxq->rx_aio_ddp_jobs, 0,
"# of aio_read(2) jobs completed via DDP");
SYSCTL_ADD_U64(ctx, children, OID_AUTO, "rx_aio_ddp_octets",
CTLFLAG_RD, &ofld_rxq->rx_aio_ddp_octets, 0,
"# of octets placed directly for aio_read(2) jobs");
SYSCTL_ADD_ULONG(ctx, children, OID_AUTO,
"rx_toe_tls_records", CTLFLAG_RD, &ofld_rxq->rx_toe_tls_records,
"# of TOE TLS records received");
@ -4880,6 +4886,8 @@ alloc_ofld_txq(struct vi_info *vi, struct sge_ofld_txq *ofld_txq, int idx)
ofld_txq->tx_iscsi_pdus = counter_u64_alloc(M_WAITOK);
ofld_txq->tx_iscsi_octets = counter_u64_alloc(M_WAITOK);
ofld_txq->tx_iscsi_iso_wrs = counter_u64_alloc(M_WAITOK);
ofld_txq->tx_aio_jobs = counter_u64_alloc(M_WAITOK);
ofld_txq->tx_aio_octets = counter_u64_alloc(M_WAITOK);
ofld_txq->tx_toe_tls_records = counter_u64_alloc(M_WAITOK);
ofld_txq->tx_toe_tls_octets = counter_u64_alloc(M_WAITOK);
add_ofld_txq_sysctls(&vi->ctx, oid, ofld_txq);
@ -4918,6 +4926,8 @@ free_ofld_txq(struct vi_info *vi, struct sge_ofld_txq *ofld_txq)
counter_u64_free(ofld_txq->tx_iscsi_pdus);
counter_u64_free(ofld_txq->tx_iscsi_octets);
counter_u64_free(ofld_txq->tx_iscsi_iso_wrs);
counter_u64_free(ofld_txq->tx_aio_jobs);
counter_u64_free(ofld_txq->tx_aio_octets);
counter_u64_free(ofld_txq->tx_toe_tls_records);
counter_u64_free(ofld_txq->tx_toe_tls_octets);
free_wrq(sc, &ofld_txq->wrq);
@ -4945,6 +4955,12 @@ add_ofld_txq_sysctls(struct sysctl_ctx_list *ctx, struct sysctl_oid *oid,
SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "tx_iscsi_iso_wrs",
CTLFLAG_RD, &ofld_txq->tx_iscsi_iso_wrs,
"# of iSCSI segmentation offload work requests");
SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "tx_aio_jobs",
CTLFLAG_RD, &ofld_txq->tx_aio_jobs,
"# of zero-copy aio_write(2) jobs transmitted");
SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "tx_aio_octets",
CTLFLAG_RD, &ofld_txq->tx_aio_octets,
"# of payload octets in transmitted zero-copy aio_write(2) jobs");
SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "tx_toe_tls_records",
CTLFLAG_RD, &ofld_txq->tx_toe_tls_records,
"# of TOE TLS records transmitted");

View file

@ -2189,6 +2189,7 @@ t4_aiotx_process_job(struct toepcb *toep, struct socket *so, struct kaiocb *job)
struct inpcb *inp;
struct tcpcb *tp;
struct mbuf *m;
u_int sent;
int error, len;
bool moretocome, sendmore;
@ -2292,7 +2293,9 @@ t4_aiotx_process_job(struct toepcb *toep, struct socket *so, struct kaiocb *job)
goto out;
}
job->aio_sent += m_length(m, NULL);
sent = m_length(m, NULL);
job->aio_sent += sent;
counter_u64_add(toep->ofld_txq->tx_aio_octets, sent);
sbappendstream(sb, m, 0);
m = NULL;
@ -2339,6 +2342,7 @@ t4_aiotx_process_job(struct toepcb *toep, struct socket *so, struct kaiocb *job)
* socket.
*/
aiotx_free_job(job);
counter_u64_add(toep->ofld_txq->tx_aio_jobs, 1);
out:
if (error) {

View file

@ -319,8 +319,11 @@ insert_ddp_data(struct toepcb *toep, uint32_t n)
placed = n;
if (placed > job->uaiocb.aio_nbytes - copied)
placed = job->uaiocb.aio_nbytes - copied;
if (placed > 0)
if (placed > 0) {
job->msgrcv = 1;
toep->ofld_rxq->rx_aio_ddp_jobs++;
}
toep->ofld_rxq->rx_aio_ddp_octets += placed;
if (!aio_clear_cancel_function(job)) {
/*
* Update the copied length for when
@ -560,6 +563,8 @@ handle_ddp_data(struct toepcb *toep, __be32 ddp_report, __be32 rcv_nxt, int len)
CURVNET_RESTORE();
job->msgrcv = 1;
toep->ofld_rxq->rx_aio_ddp_jobs++;
toep->ofld_rxq->rx_aio_ddp_octets += len;
if (db->cancel_pending) {
/*
* Update the job's length but defer completion to the
@ -724,8 +729,11 @@ handle_ddp_close(struct toepcb *toep, struct tcpcb *tp, __be32 rcv_nxt)
placed = len;
if (placed > job->uaiocb.aio_nbytes - copied)
placed = job->uaiocb.aio_nbytes - copied;
if (placed > 0)
if (placed > 0) {
job->msgrcv = 1;
toep->ofld_rxq->rx_aio_ddp_jobs++;
}
toep->ofld_rxq->rx_aio_ddp_octets += placed;
if (!aio_clear_cancel_function(job)) {
/*
* Update the copied length for when