Skip to content

Commit 902c2a3

Browse files
committed
Merge branch 'cxgb4-ch_ktls-updates-in-net-next'
Rohit Maheshwari says: ==================== cxgb4/ch_ktls: updates in net-next This series of patches improves connections setup and statistics. This series is broken down as follows: Patch 1 fixes the handling of connection setup failure in HW. Driver shouldn't return success to tls_dev_add, until HW returns success. Patch 2 avoids the log flood. Patch 3 adds ktls statistics at port level. v1->v2: - removed conn_up from all places. v2->v3: - Corrected timeout handling. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 2c956a5 + 3427e13 commit 902c2a3

File tree

6 files changed

+235
-203
lines changed

6 files changed

+235
-203
lines changed

drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3527,6 +3527,10 @@ DEFINE_SHOW_ATTRIBUTE(meminfo);
35273527

35283528
static int chcr_stats_show(struct seq_file *seq, void *v)
35293529
{
3530+
#if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE)
3531+
struct ch_ktls_port_stats_debug *ktls_port;
3532+
int i = 0;
3533+
#endif
35303534
struct adapter *adap = seq->private;
35313535

35323536
seq_puts(seq, "Chelsio Crypto Accelerator Stats \n");
@@ -3557,18 +3561,6 @@ static int chcr_stats_show(struct seq_file *seq, void *v)
35573561
seq_puts(seq, "\nChelsio KTLS Crypto Accelerator Stats\n");
35583562
seq_printf(seq, "Tx TLS offload refcount: %20u\n",
35593563
refcount_read(&adap->chcr_ktls.ktls_refcount));
3560-
seq_printf(seq, "Tx HW offload contexts added: %20llu\n",
3561-
atomic64_read(&adap->ch_ktls_stats.ktls_tx_ctx));
3562-
seq_printf(seq, "Tx connection created: %20llu\n",
3563-
atomic64_read(&adap->ch_ktls_stats.ktls_tx_connection_open));
3564-
seq_printf(seq, "Tx connection failed: %20llu\n",
3565-
atomic64_read(&adap->ch_ktls_stats.ktls_tx_connection_fail));
3566-
seq_printf(seq, "Tx connection closed: %20llu\n",
3567-
atomic64_read(&adap->ch_ktls_stats.ktls_tx_connection_close));
3568-
seq_printf(seq, "Packets passed for encryption : %20llu\n",
3569-
atomic64_read(&adap->ch_ktls_stats.ktls_tx_encrypted_packets));
3570-
seq_printf(seq, "Bytes passed for encryption : %20llu\n",
3571-
atomic64_read(&adap->ch_ktls_stats.ktls_tx_encrypted_bytes));
35723564
seq_printf(seq, "Tx records send: %20llu\n",
35733565
atomic64_read(&adap->ch_ktls_stats.ktls_tx_send_records));
35743566
seq_printf(seq, "Tx partial start of records: %20llu\n",
@@ -3581,14 +3573,17 @@ static int chcr_stats_show(struct seq_file *seq, void *v)
35813573
atomic64_read(&adap->ch_ktls_stats.ktls_tx_complete_pkts));
35823574
seq_printf(seq, "TX trim pkts : %20llu\n",
35833575
atomic64_read(&adap->ch_ktls_stats.ktls_tx_trimmed_pkts));
3584-
seq_printf(seq, "Tx out of order packets: %20llu\n",
3585-
atomic64_read(&adap->ch_ktls_stats.ktls_tx_ooo));
3586-
seq_printf(seq, "Tx drop pkts before HW offload: %20llu\n",
3587-
atomic64_read(&adap->ch_ktls_stats.ktls_tx_skip_no_sync_data));
3588-
seq_printf(seq, "Tx drop not synced packets: %20llu\n",
3589-
atomic64_read(&adap->ch_ktls_stats.ktls_tx_drop_no_sync_data));
3590-
seq_printf(seq, "Tx drop bypass req: %20llu\n",
3591-
atomic64_read(&adap->ch_ktls_stats.ktls_tx_drop_bypass_req));
3576+
while (i < MAX_NPORTS) {
3577+
ktls_port = &adap->ch_ktls_stats.ktls_port[i];
3578+
seq_printf(seq, "Port %d\n", i);
3579+
seq_printf(seq, "Tx connection created: %20llu\n",
3580+
atomic64_read(&ktls_port->ktls_tx_connection_open));
3581+
seq_printf(seq, "Tx connection failed: %20llu\n",
3582+
atomic64_read(&ktls_port->ktls_tx_connection_fail));
3583+
seq_printf(seq, "Tx connection closed: %20llu\n",
3584+
atomic64_read(&ktls_port->ktls_tx_connection_close));
3585+
i++;
3586+
}
35923587
#endif
35933588
return 0;
35943589
}

drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,6 @@ static const char stats_strings[][ETH_GSTRING_LEN] = {
117117
"vlan_insertions ",
118118
"gro_packets ",
119119
"gro_merged ",
120-
};
121-
122-
static char adapter_stats_strings[][ETH_GSTRING_LEN] = {
123-
"db_drop ",
124-
"db_full ",
125-
"db_empty ",
126-
"write_coal_success ",
127-
"write_coal_fail ",
128120
#if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE)
129121
"tx_tls_encrypted_packets",
130122
"tx_tls_encrypted_bytes ",
@@ -136,6 +128,14 @@ static char adapter_stats_strings[][ETH_GSTRING_LEN] = {
136128
#endif
137129
};
138130

131+
static char adapter_stats_strings[][ETH_GSTRING_LEN] = {
132+
"db_drop ",
133+
"db_full ",
134+
"db_empty ",
135+
"write_coal_success ",
136+
"write_coal_fail ",
137+
};
138+
139139
static char loopback_stats_strings[][ETH_GSTRING_LEN] = {
140140
"-------Loopback----------- ",
141141
"octets_ok ",
@@ -257,14 +257,6 @@ struct queue_port_stats {
257257
u64 vlan_ins;
258258
u64 gro_pkts;
259259
u64 gro_merged;
260-
};
261-
262-
struct adapter_stats {
263-
u64 db_drop;
264-
u64 db_full;
265-
u64 db_empty;
266-
u64 wc_success;
267-
u64 wc_fail;
268260
#if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE)
269261
u64 tx_tls_encrypted_packets;
270262
u64 tx_tls_encrypted_bytes;
@@ -276,12 +268,23 @@ struct adapter_stats {
276268
#endif
277269
};
278270

271+
struct adapter_stats {
272+
u64 db_drop;
273+
u64 db_full;
274+
u64 db_empty;
275+
u64 wc_success;
276+
u64 wc_fail;
277+
};
278+
279279
static void collect_sge_port_stats(const struct adapter *adap,
280280
const struct port_info *p,
281281
struct queue_port_stats *s)
282282
{
283283
const struct sge_eth_txq *tx = &adap->sge.ethtxq[p->first_qset];
284284
const struct sge_eth_rxq *rx = &adap->sge.ethrxq[p->first_qset];
285+
#if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE)
286+
const struct ch_ktls_port_stats_debug *ktls_stats;
287+
#endif
285288
struct sge_eohw_txq *eohw_tx;
286289
unsigned int i;
287290

@@ -306,6 +309,21 @@ static void collect_sge_port_stats(const struct adapter *adap,
306309
s->vlan_ins += eohw_tx->vlan_ins;
307310
}
308311
}
312+
#if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE)
313+
ktls_stats = &adap->ch_ktls_stats.ktls_port[p->port_id];
314+
s->tx_tls_encrypted_packets =
315+
atomic64_read(&ktls_stats->ktls_tx_encrypted_packets);
316+
s->tx_tls_encrypted_bytes =
317+
atomic64_read(&ktls_stats->ktls_tx_encrypted_bytes);
318+
s->tx_tls_ctx = atomic64_read(&ktls_stats->ktls_tx_ctx);
319+
s->tx_tls_ooo = atomic64_read(&ktls_stats->ktls_tx_ooo);
320+
s->tx_tls_skip_no_sync_data =
321+
atomic64_read(&ktls_stats->ktls_tx_skip_no_sync_data);
322+
s->tx_tls_drop_no_sync_data =
323+
atomic64_read(&ktls_stats->ktls_tx_drop_no_sync_data);
324+
s->tx_tls_drop_bypass_req =
325+
atomic64_read(&ktls_stats->ktls_tx_drop_bypass_req);
326+
#endif
309327
}
310328

311329
static void collect_adapter_stats(struct adapter *adap, struct adapter_stats *s)

drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -690,16 +690,16 @@ int cxgb4_set_ktls_feature(struct adapter *adap, bool enable)
690690
* ULD is/are already active, return failure.
691691
*/
692692
if (cxgb4_uld_in_use(adap)) {
693-
dev_warn(adap->pdev_dev,
694-
"ULD connections (tid/stid) active. Can't enable kTLS\n");
693+
dev_dbg(adap->pdev_dev,
694+
"ULD connections (tid/stid) active. Can't enable kTLS\n");
695695
return -EINVAL;
696696
}
697697
ret = t4_set_params(adap, adap->mbox, adap->pf,
698698
0, 1, &params, &params);
699699
if (ret)
700700
return ret;
701701
refcount_set(&adap->chcr_ktls.ktls_refcount, 1);
702-
pr_info("kTLS has been enabled. Restrictions placed on ULD support\n");
702+
pr_debug("kTLS has been enabled. Restrictions placed on ULD support\n");
703703
} else {
704704
/* ktls settings already up, just increment refcount. */
705705
refcount_inc(&adap->chcr_ktls.ktls_refcount);
@@ -716,7 +716,7 @@ int cxgb4_set_ktls_feature(struct adapter *adap, bool enable)
716716
0, 1, &params, &params);
717717
if (ret)
718718
return ret;
719-
pr_info("kTLS is disabled. Restrictions on ULD support removed\n");
719+
pr_debug("kTLS is disabled. Restrictions on ULD support removed\n");
720720
}
721721
}
722722

drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include "cxgb4.h"
4545

4646
#define MAX_ULD_QSETS 16
47+
#define MAX_ULD_NPORTS 4
4748

4849
/* CPL message priority levels */
4950
enum {
@@ -365,17 +366,10 @@ struct cxgb4_virt_res { /* virtualized HW resources */
365366
};
366367

367368
#if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE)
368-
struct ch_ktls_stats_debug {
369+
struct ch_ktls_port_stats_debug {
369370
atomic64_t ktls_tx_connection_open;
370371
atomic64_t ktls_tx_connection_fail;
371372
atomic64_t ktls_tx_connection_close;
372-
atomic64_t ktls_tx_send_records;
373-
atomic64_t ktls_tx_end_pkts;
374-
atomic64_t ktls_tx_start_pkts;
375-
atomic64_t ktls_tx_middle_pkts;
376-
atomic64_t ktls_tx_retransmit_pkts;
377-
atomic64_t ktls_tx_complete_pkts;
378-
atomic64_t ktls_tx_trimmed_pkts;
379373
atomic64_t ktls_tx_encrypted_packets;
380374
atomic64_t ktls_tx_encrypted_bytes;
381375
atomic64_t ktls_tx_ctx;
@@ -384,6 +378,17 @@ struct ch_ktls_stats_debug {
384378
atomic64_t ktls_tx_drop_no_sync_data;
385379
atomic64_t ktls_tx_drop_bypass_req;
386380
};
381+
382+
struct ch_ktls_stats_debug {
383+
struct ch_ktls_port_stats_debug ktls_port[MAX_ULD_NPORTS];
384+
atomic64_t ktls_tx_send_records;
385+
atomic64_t ktls_tx_end_pkts;
386+
atomic64_t ktls_tx_start_pkts;
387+
atomic64_t ktls_tx_middle_pkts;
388+
atomic64_t ktls_tx_retransmit_pkts;
389+
atomic64_t ktls_tx_complete_pkts;
390+
atomic64_t ktls_tx_trimmed_pkts;
391+
};
387392
#endif
388393

389394
struct chcr_stats_debug {

0 commit comments

Comments
 (0)