/* SPDX-License-Identifier: BSD-3-Clause
*
- * Copyright (c) 2016-2018 Solarflare Communications Inc.
- * All rights reserved.
+ * Copyright(c) 2019-2021 Xilinx, Inc.
+ * Copyright(c) 2016-2019 Solarflare Communications Inc.
*
* This software was jointly developed between OKTET Labs (under contract
* for Solarflare) and Solarflare Communications, Inc.
*/
#define SFC_TX_QFLUSH_POLL_ATTEMPTS (2000)
-uint64_t
-sfc_tx_get_dev_offload_caps(struct sfc_adapter *sa)
+static uint64_t
+sfc_tx_get_offload_mask(struct sfc_adapter *sa)
{
const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic);
- uint64_t caps = 0;
+ uint64_t no_caps = 0;
+
+ if (!encp->enc_hw_tx_insert_vlan_enabled)
+ no_caps |= DEV_TX_OFFLOAD_VLAN_INSERT;
- if ((sa->priv.dp_tx->features & SFC_DP_TX_FEAT_VLAN_INSERT) &&
- encp->enc_hw_tx_insert_vlan_enabled)
- caps |= DEV_TX_OFFLOAD_VLAN_INSERT;
+ if (!encp->enc_tunnel_encapsulations_supported)
+ no_caps |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM;
- if (sa->priv.dp_tx->features & SFC_DP_TX_FEAT_MULTI_SEG)
- caps |= DEV_TX_OFFLOAD_MULTI_SEGS;
+ if (!sa->tso)
+ no_caps |= DEV_TX_OFFLOAD_TCP_TSO;
- if ((~sa->priv.dp_tx->features & SFC_DP_TX_FEAT_MULTI_POOL) &&
- (~sa->priv.dp_tx->features & SFC_DP_TX_FEAT_REFCNT))
- caps |= DEV_TX_OFFLOAD_MBUF_FAST_FREE;
+ if (!sa->tso_encap ||
+ (encp->enc_tunnel_encapsulations_supported &
+ (1u << EFX_TUNNEL_PROTOCOL_VXLAN)) == 0)
+ no_caps |= DEV_TX_OFFLOAD_VXLAN_TNL_TSO;
- return caps;
+ if (!sa->tso_encap ||
+ (encp->enc_tunnel_encapsulations_supported &
+ (1u << EFX_TUNNEL_PROTOCOL_GENEVE)) == 0)
+ no_caps |= DEV_TX_OFFLOAD_GENEVE_TNL_TSO;
+
+ return ~no_caps;
}
uint64_t
-sfc_tx_get_queue_offload_caps(struct sfc_adapter *sa)
+sfc_tx_get_dev_offload_caps(struct sfc_adapter *sa)
{
- const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic);
- uint64_t caps = 0;
-
- caps |= DEV_TX_OFFLOAD_IPV4_CKSUM;
- caps |= DEV_TX_OFFLOAD_UDP_CKSUM;
- caps |= DEV_TX_OFFLOAD_TCP_CKSUM;
-
- if (encp->enc_tunnel_encapsulations_supported)
- caps |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM;
-
- if (sa->tso)
- caps |= DEV_TX_OFFLOAD_TCP_TSO;
+ return sa->priv.dp_tx->dev_offload_capa & sfc_tx_get_offload_mask(sa);
+}
- return caps;
+uint64_t
+sfc_tx_get_queue_offload_caps(struct sfc_adapter *sa)
+{
+ return sa->priv.dp_tx->queue_offload_capa & sfc_tx_get_offload_mask(sa);
}
static int
info.vi_window_shift = encp->enc_vi_window_shift;
info.tso_tcp_header_offset_limit =
encp->enc_tx_tso_tcp_header_offset_limit;
+ info.tso_max_nb_header_descs =
+ RTE_MIN(encp->enc_tx_tso_max_header_ndescs,
+ (uint32_t)UINT16_MAX);
+ info.tso_max_header_len =
+ RTE_MIN(encp->enc_tx_tso_max_header_length,
+ (uint32_t)UINT16_MAX);
+ info.tso_max_nb_payload_descs =
+ RTE_MIN(encp->enc_tx_tso_max_payload_ndescs,
+ (uint32_t)UINT16_MAX);
+ info.tso_max_payload_len = encp->enc_tx_tso_max_payload_length;
+ info.tso_max_nb_outgoing_frames = encp->enc_tx_tso_max_nframes;
rc = sa->priv.dp_tx->qcreate(sa->eth_dev->data->port_id, sw_index,
&RTE_ETH_DEV_TO_PCI(sa->eth_dev)->addr,
flags |= EFX_TXQ_CKSUM_INNER_TCPUDP;
}
- if (txq_info->offloads & DEV_TX_OFFLOAD_TCP_TSO)
+ if (txq_info->offloads & (DEV_TX_OFFLOAD_TCP_TSO |
+ DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
+ DEV_TX_OFFLOAD_GENEVE_TNL_TSO))
flags |= EFX_TXQ_FATSOV2;
rc = efx_tx_qcreate(sa->nic, txq->hw_index, 0, &txq->mem,
sfc_tx_start(struct sfc_adapter *sa)
{
struct sfc_adapter_shared * const sas = sfc_sa2shared(sa);
+ const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic);
unsigned int sw_index;
int rc = 0;
sfc_log_init(sa, "txq_count = %u", sas->txq_count);
if (sa->tso) {
- if (!efx_nic_cfg_get(sa->nic)->enc_fw_assisted_tso_v2_enabled) {
+ if (!encp->enc_fw_assisted_tso_v2_enabled &&
+ !encp->enc_tso_v3_enabled) {
sfc_warn(sa, "TSO support was unable to be restored");
sa->tso = B_FALSE;
+ sa->tso_encap = B_FALSE;
}
}
+ if (sa->tso_encap && !encp->enc_fw_assisted_tso_v2_encap_enabled &&
+ !encp->enc_tso_v3_enabled) {
+ sfc_warn(sa, "Encapsulated TSO support was unable to be restored");
+ sa->tso_encap = B_FALSE;
+ }
+
rc = efx_tx_init(sa->nic);
if (rc != 0)
goto fail_efx_tx_init;
}
static uint16_t
-sfc_efx_prepare_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
+sfc_efx_prepare_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t nb_pkts)
{
+ struct sfc_dp_txq *dp_txq = tx_queue;
+ struct sfc_efx_txq *txq = sfc_efx_txq_by_dp_txq(dp_txq);
+ const efx_nic_cfg_t *encp = efx_nic_cfg_get(txq->evq->sa->nic);
uint16_t i;
for (i = 0; i < nb_pkts; i++) {
int ret;
- ret = sfc_dp_tx_prepare_pkt(tx_pkts[i]);
+ /*
+ * EFX Tx datapath may require extra VLAN descriptor if VLAN
+ * insertion offload is requested regardless the offload
+ * requested/supported.
+ */
+ ret = sfc_dp_tx_prepare_pkt(tx_pkts[i], 0, SFC_TSOH_STD_LEN,
+ encp->enc_tx_tso_tcp_header_offset_limit,
+ txq->max_fill_level, EFX_TX_FATSOV2_OPT_NDESCS,
+ 1);
if (unlikely(ret != 0)) {
rte_errno = ret;
break;
*/
if (sfc_efx_tso_do(txq, added, &m_seg, &in_off, &pend,
&pkt_descs, &pkt_len) != 0) {
- /* We may have reached this place for
- * one of the following reasons:
- *
- * 1) Packet header linearization is needed
- * and the header length is greater
- * than SFC_TSOH_STD_LEN
- * 2) TCP header starts at more then
- * 208 bytes into the frame
+ /* We may have reached this place if packet
+ * header linearization is needed but the
+ * header length is greater than
+ * SFC_TSOH_STD_LEN
*
* We will deceive RTE saying that we have sent
* the packet, but we will actually drop it.
.dp = {
.name = SFC_KVARG_DATAPATH_EFX,
.type = SFC_DP_TX,
- .hw_fw_caps = 0,
+ .hw_fw_caps = SFC_DP_HW_FW_CAP_TX_EFX,
},
- .features = SFC_DP_TX_FEAT_VLAN_INSERT |
- SFC_DP_TX_FEAT_TSO |
- SFC_DP_TX_FEAT_MULTI_POOL |
- SFC_DP_TX_FEAT_REFCNT |
- SFC_DP_TX_FEAT_MULTI_SEG,
+ .features = 0,
+ .dev_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT |
+ DEV_TX_OFFLOAD_MULTI_SEGS,
+ .queue_offload_capa = DEV_TX_OFFLOAD_IPV4_CKSUM |
+ DEV_TX_OFFLOAD_UDP_CKSUM |
+ DEV_TX_OFFLOAD_TCP_CKSUM |
+ DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |
+ DEV_TX_OFFLOAD_TCP_TSO,
.qsize_up_rings = sfc_efx_tx_qsize_up_rings,
.qcreate = sfc_efx_tx_qcreate,
.qdestroy = sfc_efx_tx_qdestroy,