Commit 902c2a31 authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents 2c956a5a 3427e13e
......@@ -3527,6 +3527,10 @@ DEFINE_SHOW_ATTRIBUTE(meminfo);
static int chcr_stats_show(struct seq_file *seq, void *v)
{
#if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE)
struct ch_ktls_port_stats_debug *ktls_port;
int i = 0;
#endif
struct adapter *adap = seq->private;
seq_puts(seq, "Chelsio Crypto Accelerator Stats \n");
......@@ -3557,18 +3561,6 @@ static int chcr_stats_show(struct seq_file *seq, void *v)
seq_puts(seq, "\nChelsio KTLS Crypto Accelerator Stats\n");
seq_printf(seq, "Tx TLS offload refcount: %20u\n",
refcount_read(&adap->chcr_ktls.ktls_refcount));
seq_printf(seq, "Tx HW offload contexts added: %20llu\n",
atomic64_read(&adap->ch_ktls_stats.ktls_tx_ctx));
seq_printf(seq, "Tx connection created: %20llu\n",
atomic64_read(&adap->ch_ktls_stats.ktls_tx_connection_open));
seq_printf(seq, "Tx connection failed: %20llu\n",
atomic64_read(&adap->ch_ktls_stats.ktls_tx_connection_fail));
seq_printf(seq, "Tx connection closed: %20llu\n",
atomic64_read(&adap->ch_ktls_stats.ktls_tx_connection_close));
seq_printf(seq, "Packets passed for encryption : %20llu\n",
atomic64_read(&adap->ch_ktls_stats.ktls_tx_encrypted_packets));
seq_printf(seq, "Bytes passed for encryption : %20llu\n",
atomic64_read(&adap->ch_ktls_stats.ktls_tx_encrypted_bytes));
seq_printf(seq, "Tx records send: %20llu\n",
atomic64_read(&adap->ch_ktls_stats.ktls_tx_send_records));
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)
atomic64_read(&adap->ch_ktls_stats.ktls_tx_complete_pkts));
seq_printf(seq, "TX trim pkts : %20llu\n",
atomic64_read(&adap->ch_ktls_stats.ktls_tx_trimmed_pkts));
seq_printf(seq, "Tx out of order packets: %20llu\n",
atomic64_read(&adap->ch_ktls_stats.ktls_tx_ooo));
seq_printf(seq, "Tx drop pkts before HW offload: %20llu\n",
atomic64_read(&adap->ch_ktls_stats.ktls_tx_skip_no_sync_data));
seq_printf(seq, "Tx drop not synced packets: %20llu\n",
atomic64_read(&adap->ch_ktls_stats.ktls_tx_drop_no_sync_data));
seq_printf(seq, "Tx drop bypass req: %20llu\n",
atomic64_read(&adap->ch_ktls_stats.ktls_tx_drop_bypass_req));
while (i < MAX_NPORTS) {
ktls_port = &adap->ch_ktls_stats.ktls_port[i];
seq_printf(seq, "Port %d\n", i);
seq_printf(seq, "Tx connection created: %20llu\n",
atomic64_read(&ktls_port->ktls_tx_connection_open));
seq_printf(seq, "Tx connection failed: %20llu\n",
atomic64_read(&ktls_port->ktls_tx_connection_fail));
seq_printf(seq, "Tx connection closed: %20llu\n",
atomic64_read(&ktls_port->ktls_tx_connection_close));
i++;
}
#endif
return 0;
}
......
......@@ -117,14 +117,6 @@ static const char stats_strings[][ETH_GSTRING_LEN] = {
"vlan_insertions ",
"gro_packets ",
"gro_merged ",
};
static char adapter_stats_strings[][ETH_GSTRING_LEN] = {
"db_drop ",
"db_full ",
"db_empty ",
"write_coal_success ",
"write_coal_fail ",
#if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE)
"tx_tls_encrypted_packets",
"tx_tls_encrypted_bytes ",
......@@ -136,6 +128,14 @@ static char adapter_stats_strings[][ETH_GSTRING_LEN] = {
#endif
};
static char adapter_stats_strings[][ETH_GSTRING_LEN] = {
"db_drop ",
"db_full ",
"db_empty ",
"write_coal_success ",
"write_coal_fail ",
};
static char loopback_stats_strings[][ETH_GSTRING_LEN] = {
"-------Loopback----------- ",
"octets_ok ",
......@@ -257,14 +257,6 @@ struct queue_port_stats {
u64 vlan_ins;
u64 gro_pkts;
u64 gro_merged;
};
struct adapter_stats {
u64 db_drop;
u64 db_full;
u64 db_empty;
u64 wc_success;
u64 wc_fail;
#if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE)
u64 tx_tls_encrypted_packets;
u64 tx_tls_encrypted_bytes;
......@@ -276,12 +268,23 @@ struct adapter_stats {
#endif
};
struct adapter_stats {
u64 db_drop;
u64 db_full;
u64 db_empty;
u64 wc_success;
u64 wc_fail;
};
static void collect_sge_port_stats(const struct adapter *adap,
const struct port_info *p,
struct queue_port_stats *s)
{
const struct sge_eth_txq *tx = &adap->sge.ethtxq[p->first_qset];
const struct sge_eth_rxq *rx = &adap->sge.ethrxq[p->first_qset];
#if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE)
const struct ch_ktls_port_stats_debug *ktls_stats;
#endif
struct sge_eohw_txq *eohw_tx;
unsigned int i;
......@@ -306,6 +309,21 @@ static void collect_sge_port_stats(const struct adapter *adap,
s->vlan_ins += eohw_tx->vlan_ins;
}
}
#if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE)
ktls_stats = &adap->ch_ktls_stats.ktls_port[p->port_id];
s->tx_tls_encrypted_packets =
atomic64_read(&ktls_stats->ktls_tx_encrypted_packets);
s->tx_tls_encrypted_bytes =
atomic64_read(&ktls_stats->ktls_tx_encrypted_bytes);
s->tx_tls_ctx = atomic64_read(&ktls_stats->ktls_tx_ctx);
s->tx_tls_ooo = atomic64_read(&ktls_stats->ktls_tx_ooo);
s->tx_tls_skip_no_sync_data =
atomic64_read(&ktls_stats->ktls_tx_skip_no_sync_data);
s->tx_tls_drop_no_sync_data =
atomic64_read(&ktls_stats->ktls_tx_drop_no_sync_data);
s->tx_tls_drop_bypass_req =
atomic64_read(&ktls_stats->ktls_tx_drop_bypass_req);
#endif
}
static void collect_adapter_stats(struct adapter *adap, struct adapter_stats *s)
......
......@@ -690,7 +690,7 @@ int cxgb4_set_ktls_feature(struct adapter *adap, bool enable)
* ULD is/are already active, return failure.
*/
if (cxgb4_uld_in_use(adap)) {
dev_warn(adap->pdev_dev,
dev_dbg(adap->pdev_dev,
"ULD connections (tid/stid) active. Can't enable kTLS\n");
return -EINVAL;
}
......@@ -699,7 +699,7 @@ int cxgb4_set_ktls_feature(struct adapter *adap, bool enable)
if (ret)
return ret;
refcount_set(&adap->chcr_ktls.ktls_refcount, 1);
pr_info("kTLS has been enabled. Restrictions placed on ULD support\n");
pr_debug("kTLS has been enabled. Restrictions placed on ULD support\n");
} else {
/* ktls settings already up, just increment refcount. */
refcount_inc(&adap->chcr_ktls.ktls_refcount);
......@@ -716,7 +716,7 @@ int cxgb4_set_ktls_feature(struct adapter *adap, bool enable)
0, 1, &params, &params);
if (ret)
return ret;
pr_info("kTLS is disabled. Restrictions on ULD support removed\n");
pr_debug("kTLS is disabled. Restrictions on ULD support removed\n");
}
}
......
......@@ -44,6 +44,7 @@
#include "cxgb4.h"
#define MAX_ULD_QSETS 16
#define MAX_ULD_NPORTS 4
/* CPL message priority levels */
enum {
......@@ -365,17 +366,10 @@ struct cxgb4_virt_res { /* virtualized HW resources */
};
#if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE)
struct ch_ktls_stats_debug {
struct ch_ktls_port_stats_debug {
atomic64_t ktls_tx_connection_open;
atomic64_t ktls_tx_connection_fail;
atomic64_t ktls_tx_connection_close;
atomic64_t ktls_tx_send_records;
atomic64_t ktls_tx_end_pkts;
atomic64_t ktls_tx_start_pkts;
atomic64_t ktls_tx_middle_pkts;
atomic64_t ktls_tx_retransmit_pkts;
atomic64_t ktls_tx_complete_pkts;
atomic64_t ktls_tx_trimmed_pkts;
atomic64_t ktls_tx_encrypted_packets;
atomic64_t ktls_tx_encrypted_bytes;
atomic64_t ktls_tx_ctx;
......@@ -384,6 +378,17 @@ struct ch_ktls_stats_debug {
atomic64_t ktls_tx_drop_no_sync_data;
atomic64_t ktls_tx_drop_bypass_req;
};
struct ch_ktls_stats_debug {
struct ch_ktls_port_stats_debug ktls_port[MAX_ULD_NPORTS];
atomic64_t ktls_tx_send_records;
atomic64_t ktls_tx_end_pkts;
atomic64_t ktls_tx_start_pkts;
atomic64_t ktls_tx_middle_pkts;
atomic64_t ktls_tx_retransmit_pkts;
atomic64_t ktls_tx_complete_pkts;
atomic64_t ktls_tx_trimmed_pkts;
};
#endif
struct chcr_stats_debug {
......
......@@ -27,22 +27,20 @@
#define CHCR_KTLS_WR_SIZE (CHCR_PLAIN_TX_DATA_LEN +\
sizeof(struct cpl_tx_sec_pdu))
enum chcr_ktls_conn_state {
KTLS_CONN_CLOSED,
KTLS_CONN_ACT_OPEN_REQ,
KTLS_CONN_ACT_OPEN_RPL,
KTLS_CONN_SET_TCB_REQ,
KTLS_CONN_SET_TCB_RPL,
KTLS_CONN_TX_READY,
enum ch_ktls_open_state {
CH_KTLS_OPEN_SUCCESS = 0,
CH_KTLS_OPEN_PENDING = 1,
CH_KTLS_OPEN_FAILURE = 2,
};
struct chcr_ktls_info {
struct sock *sk;
spinlock_t lock; /* state machine lock */
spinlock_t lock; /* lock for pending_close */
struct ktls_key_ctx key_ctx;
struct adapter *adap;
struct l2t_entry *l2te;
struct net_device *netdev;
struct completion completion;
u64 iv;
u64 record_no;
int tid;
......@@ -58,13 +56,14 @@ struct chcr_ktls_info {
u32 tcp_start_seq_number;
u32 scmd0_short_seqno_numivs;
u32 scmd0_short_ivgen_hdrlen;
enum chcr_ktls_conn_state connection_state;
u16 prev_win;
u8 tx_chan;
u8 smt_idx;
u8 port_id;
u8 ip_family;
u8 first_qset;
enum ch_ktls_open_state open_state;
bool pending_close;
};
struct chcr_ktls_ofld_ctx_tx {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment