sfxge(4): add method to make checksum option descriptors

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18160
This commit is contained in:
Andrew Rybchenko 2018-11-27 12:23:01 +00:00
parent 8da3f86b16
commit 4effeb9e7b
5 changed files with 59 additions and 13 deletions

View File

@ -793,6 +793,11 @@ ef10_tx_qdesc_vlantci_create(
__in uint16_t vlan_tci,
__out efx_desc_t *edp);
extern void
ef10_tx_qdesc_checksum_create(
__in efx_txq_t *etp,
__in uint16_t flags,
__out efx_desc_t *edp);
#if EFSYS_OPT_QSTATS

View File

@ -203,7 +203,7 @@ ef10_tx_qcreate(
{
efx_nic_cfg_t *encp = &enp->en_nic_cfg;
uint16_t inner_csum;
efx_qword_t desc;
efx_desc_t desc;
efx_rc_t rc;
_NOTE(ARGUNUSED(id))
@ -228,19 +228,9 @@ ef10_tx_qcreate(
* a no-op TX option descriptor. See bug29981 for details.
*/
*addedp = 1;
EFX_POPULATE_QWORD_6(desc,
ESF_DZ_TX_DESC_IS_OPT, 1,
ESF_DZ_TX_OPTION_TYPE, ESE_DZ_TX_OPTION_DESC_CRC_CSUM,
ESF_DZ_TX_OPTION_UDP_TCP_CSUM,
(flags & EFX_TXQ_CKSUM_TCPUDP) ? 1 : 0,
ESF_DZ_TX_OPTION_IP_CSUM,
(flags & EFX_TXQ_CKSUM_IPV4) ? 1 : 0,
ESF_DZ_TX_OPTION_INNER_UDP_TCP_CSUM,
(flags & EFX_TXQ_CKSUM_INNER_TCPUDP) ? 1 : 0,
ESF_DZ_TX_OPTION_INNER_IP_CSUM,
(flags & EFX_TXQ_CKSUM_INNER_IPV4) ? 1 : 0);
ef10_tx_qdesc_checksum_create(etp, flags, &desc);
EFSYS_MEM_WRITEQ(etp->et_esmp, 0, &desc);
EFSYS_MEM_WRITEQ(etp->et_esmp, 0, &desc.ed_eq);
ef10_tx_qpush(etp, *addedp, 0);
return (0);
@ -702,6 +692,30 @@ ef10_tx_qdesc_vlantci_create(
ESF_DZ_TX_VLAN_TAG1, tci);
}
void
ef10_tx_qdesc_checksum_create(
__in efx_txq_t *etp,
__in uint16_t flags,
__out efx_desc_t *edp)
{
_NOTE(ARGUNUSED(etp));
EFSYS_PROBE2(tx_desc_checksum_create, unsigned int, etp->et_index,
uint32_t, flags);
EFX_POPULATE_QWORD_6(edp->ed_eq,
ESF_DZ_TX_DESC_IS_OPT, 1,
ESF_DZ_TX_OPTION_TYPE, ESE_DZ_TX_OPTION_DESC_CRC_CSUM,
ESF_DZ_TX_OPTION_UDP_TCP_CSUM,
(flags & EFX_TXQ_CKSUM_TCPUDP) ? 1 : 0,
ESF_DZ_TX_OPTION_IP_CSUM,
(flags & EFX_TXQ_CKSUM_IPV4) ? 1 : 0,
ESF_DZ_TX_OPTION_INNER_UDP_TCP_CSUM,
(flags & EFX_TXQ_CKSUM_INNER_TCPUDP) ? 1 : 0,
ESF_DZ_TX_OPTION_INNER_IP_CSUM,
(flags & EFX_TXQ_CKSUM_INNER_IPV4) ? 1 : 0);
}
__checkReturn efx_rc_t
ef10_tx_qpace(

View File

@ -2280,6 +2280,12 @@ efx_tx_qdesc_vlantci_create(
__in uint16_t tci,
__out efx_desc_t *edp);
extern void
efx_tx_qdesc_checksum_create(
__in efx_txq_t *etp,
__in uint16_t flags,
__out efx_desc_t *edp);
#if EFSYS_OPT_QSTATS
#if EFSYS_OPT_NAMES

View File

@ -149,6 +149,8 @@ typedef struct efx_tx_ops_s {
efx_desc_t *, int);
void (*etxo_qdesc_vlantci_create)(efx_txq_t *, uint16_t,
efx_desc_t *);
void (*etxo_qdesc_checksum_create)(efx_txq_t *, uint16_t,
efx_desc_t *);
#if EFSYS_OPT_QSTATS
void (*etxo_qstats_update)(efx_txq_t *,
efsys_stat_t *);

View File

@ -146,6 +146,7 @@ static const efx_tx_ops_t __efx_tx_siena_ops = {
NULL, /* etxo_qdesc_tso_create */
NULL, /* etxo_qdesc_tso2_create */
NULL, /* etxo_qdesc_vlantci_create */
NULL, /* etxo_qdesc_checksum_create */
#if EFSYS_OPT_QSTATS
siena_tx_qstats_update, /* etxo_qstats_update */
#endif
@ -172,6 +173,7 @@ static const efx_tx_ops_t __efx_tx_hunt_ops = {
ef10_tx_qdesc_tso_create, /* etxo_qdesc_tso_create */
ef10_tx_qdesc_tso2_create, /* etxo_qdesc_tso2_create */
ef10_tx_qdesc_vlantci_create, /* etxo_qdesc_vlantci_create */
ef10_tx_qdesc_checksum_create, /* etxo_qdesc_checksum_create */
#if EFSYS_OPT_QSTATS
ef10_tx_qstats_update, /* etxo_qstats_update */
#endif
@ -198,6 +200,7 @@ static const efx_tx_ops_t __efx_tx_medford_ops = {
NULL, /* etxo_qdesc_tso_create */
ef10_tx_qdesc_tso2_create, /* etxo_qdesc_tso2_create */
ef10_tx_qdesc_vlantci_create, /* etxo_qdesc_vlantci_create */
ef10_tx_qdesc_checksum_create, /* etxo_qdesc_checksum_create */
#if EFSYS_OPT_QSTATS
ef10_tx_qstats_update, /* etxo_qstats_update */
#endif
@ -224,6 +227,7 @@ static const efx_tx_ops_t __efx_tx_medford2_ops = {
NULL, /* etxo_qdesc_tso_create */
ef10_tx_qdesc_tso2_create, /* etxo_qdesc_tso2_create */
ef10_tx_qdesc_vlantci_create, /* etxo_qdesc_vlantci_create */
ef10_tx_qdesc_checksum_create, /* etxo_qdesc_checksum_create */
#if EFSYS_OPT_QSTATS
ef10_tx_qstats_update, /* etxo_qstats_update */
#endif
@ -679,6 +683,21 @@ efx_tx_qdesc_vlantci_create(
etxop->etxo_qdesc_vlantci_create(etp, tci, edp);
}
void
efx_tx_qdesc_checksum_create(
__in efx_txq_t *etp,
__in uint16_t flags,
__out efx_desc_t *edp)
{
efx_nic_t *enp = etp->et_enp;
const efx_tx_ops_t *etxop = enp->en_etxop;
EFSYS_ASSERT3U(etp->et_magic, ==, EFX_TXQ_MAGIC);
EFSYS_ASSERT(etxop->etxo_qdesc_checksum_create != NULL);
etxop->etxo_qdesc_checksum_create(etp, flags, edp);
}
#if EFSYS_OPT_QSTATS
void