From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 6A58EA0679 for ; Tue, 2 Apr 2019 11:30:37 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E36905B26; Tue, 2 Apr 2019 11:29:20 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 79D5B316B for ; Tue, 2 Apr 2019 11:29:00 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us1.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 35E5610007E; Tue, 2 Apr 2019 09:28:59 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 2 Apr 2019 02:28:55 -0700 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Tue, 2 Apr 2019 02:28:55 -0700 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id x329SsEX028284; Tue, 2 Apr 2019 10:28:54 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 21164161612; Tue, 2 Apr 2019 10:28:54 +0100 (BST) From: Andrew Rybchenko To: CC: Ivan Malov Date: Tue, 2 Apr 2019 10:28:44 +0100 Message-ID: <1554197324-32391-13-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1554197324-32391-1-git-send-email-arybchenko@solarflare.com> References: <1554197324-32391-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24526.005 X-TM-AS-Result: No-11.780700-4.000000-10 X-TMASE-MatchedRID: us35pOwHGSnW5rPMDq6HbwPZZctd3P4BWjWsWQUWzVocZFsYO/SuCGlb b2DwZL4DeTDIGcrB15ClyH+LgJssgefb0cmSZ8tZLTHwnYOikQ0/dbvZW+KlFje8rmZLoUfQq3c ttlDobAw2pHVptID8fNtUk87+CryOVCFefQRV3M63UCG/IQp2PofsPVs/8Vw6Mur16mAbAwqBtW EZUkpaMhpSTDpv+VZwW95Ssu8kWvegb9K7EuXabbW9iMx22BZPxKAxBgoYewkKA2OoGAlTk0Xsk ncjbL484vM1YF6AJbbCCfuIMF6xLSAHAopEd76va0adkW4beald78nmpf1KwZBfrDRS3u8K5WzC aGsep4l8uSaRIfxtCQ== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--11.780700-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24526.005 X-MDID: 1554197340-LodwL_H7gkd3 Subject: [dpdk-dev] [PATCH 12/12] net/sfc: support tunnel TSO on EF10 native Tx datapath X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190402092844.kIANJF5p8tWy6n4bX3hEX1RwKBBw3BwlkdIA4KQorQA@z> From: Ivan Malov Handle VXLAN and GENEVE TSO on EF10 native Tx datapath. Signed-off-by: Ivan Malov Signed-off-by: Andrew Rybchenko --- doc/guides/nics/sfc_efx.rst | 2 +- doc/guides/rel_notes/release_19_05.rst | 1 + drivers/net/sfc/sfc.c | 6 ++++++ drivers/net/sfc/sfc.h | 1 + drivers/net/sfc/sfc_dp_tx.h | 18 +++++++++++++++++- drivers/net/sfc/sfc_ef10_tx.c | 22 ++++++++++++++++------ drivers/net/sfc/sfc_tx.c | 17 +++++++++++++++-- 7 files changed, 57 insertions(+), 10 deletions(-) diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst index 028c92cc3..eb47f25e3 100644 --- a/doc/guides/nics/sfc_efx.rst +++ b/doc/guides/nics/sfc_efx.rst @@ -66,7 +66,7 @@ SFC EFX PMD has support for: - Allmulticast mode -- TCP segmentation offload (TSO) +- TCP segmentation offload (TSO) including VXLAN and GENEVE encapsulated - Multicast MAC filter diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst index 173c852c8..f434c4823 100644 --- a/doc/guides/rel_notes/release_19_05.rst +++ b/doc/guides/rel_notes/release_19_05.rst @@ -74,6 +74,7 @@ New Features process. * Added support for Rx packet types list in a secondary process. * Added Tx prepare to do Tx offloads checks. + * Added support for VXLAN and GENEVE encapsulated TSO. * **Updated Mellanox drivers.** diff --git a/drivers/net/sfc/sfc.c b/drivers/net/sfc/sfc.c index dee468f89..406386a8c 100644 --- a/drivers/net/sfc/sfc.c +++ b/drivers/net/sfc/sfc.c @@ -750,6 +750,12 @@ sfc_attach(struct sfc_adapter *sa) sfc_info(sa, "TSO support isn't available on this adapter"); } + if (sa->tso && sa->priv.dp_tx->features & SFC_DP_TX_FEAT_TSO_ENCAP) { + sa->tso_encap = encp->enc_fw_assisted_tso_v2_encap_enabled; + if (!sa->tso_encap) + sfc_info(sa, "Encapsulated TSO support isn't available on this adapter"); + } + sfc_log_init(sa, "estimate resource limits"); rc = sfc_estimate_resource_limits(sa); if (rc != 0) diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h index a4b9a3f33..ecd20e546 100644 --- a/drivers/net/sfc/sfc.h +++ b/drivers/net/sfc/sfc.h @@ -286,6 +286,7 @@ struct sfc_adapter { struct sfc_txq *txq_ctrl; boolean_t tso; + boolean_t tso_encap; uint32_t rxd_wait_timeout_ns; }; diff --git a/drivers/net/sfc/sfc_dp_tx.h b/drivers/net/sfc/sfc_dp_tx.h index ae5524f24..72a69149b 100644 --- a/drivers/net/sfc/sfc_dp_tx.h +++ b/drivers/net/sfc/sfc_dp_tx.h @@ -163,6 +163,7 @@ struct sfc_dp_tx { #define SFC_DP_TX_FEAT_MULTI_PROCESS 0x8 #define SFC_DP_TX_FEAT_MULTI_POOL 0x10 #define SFC_DP_TX_FEAT_REFCNT 0x20 +#define SFC_DP_TX_FEAT_TSO_ENCAP 0x40 sfc_dp_tx_get_dev_info_t *get_dev_info; sfc_dp_tx_qsize_up_rings_t *qsize_up_rings; sfc_dp_tx_qcreate_t *qcreate; @@ -220,7 +221,22 @@ sfc_dp_tx_prepare_pkt(struct rte_mbuf *m, if (m->ol_flags & PKT_TX_TCP_SEG) { unsigned int tcph_off = m->l2_len + m->l3_len; - unsigned int header_len = tcph_off + m->l4_len; + unsigned int header_len; + + switch (m->ol_flags & PKT_TX_TUNNEL_MASK) { + case 0: + break; + case PKT_TX_TUNNEL_VXLAN: + /* FALLTHROUGH */ + case PKT_TX_TUNNEL_GENEVE: + if (!(m->ol_flags & + (PKT_TX_OUTER_IPV4 | PKT_TX_OUTER_IPV6))) + return EINVAL; + + tcph_off += m->outer_l2_len + m->outer_l3_len; + } + + header_len = tcph_off + m->l4_len; if (unlikely(tcph_off > tso_tcp_header_offset_limit)) return EINVAL; diff --git a/drivers/net/sfc/sfc_ef10_tx.c b/drivers/net/sfc/sfc_ef10_tx.c index bcbd15d55..055389efe 100644 --- a/drivers/net/sfc/sfc_ef10_tx.c +++ b/drivers/net/sfc/sfc_ef10_tx.c @@ -366,13 +366,16 @@ sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg, unsigned int *added, unsigned int *dma_desc_space, bool *reap_done) { - size_t iph_off = m_seg->l2_len; - size_t tcph_off = m_seg->l2_len + m_seg->l3_len; - size_t header_len = m_seg->l2_len + m_seg->l3_len + m_seg->l4_len; + size_t iph_off = ((m_seg->ol_flags & PKT_TX_TUNNEL_MASK) ? + m_seg->outer_l2_len + m_seg->outer_l3_len : 0) + + m_seg->l2_len; + size_t tcph_off = iph_off + m_seg->l3_len; + size_t header_len = tcph_off + m_seg->l4_len; /* Offset of the payload in the last segment that contains the header */ size_t in_off = 0; const struct tcp_hdr *th; uint16_t packet_id = 0; + uint16_t outer_packet_id = 0; uint32_t sent_seq; uint8_t *hdr_addr; rte_iova_t hdr_iova; @@ -482,12 +485,16 @@ sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg, if (first_m_seg->ol_flags & PKT_TX_IPV4) packet_id = sfc_tso_ip4_get_ipid(hdr_addr, iph_off); + if (first_m_seg->ol_flags & PKT_TX_OUTER_IPV4) + outer_packet_id = sfc_tso_ip4_get_ipid(hdr_addr, + first_m_seg->outer_l2_len); + th = (const struct tcp_hdr *)(hdr_addr + tcph_off); rte_memcpy(&sent_seq, &th->sent_seq, sizeof(uint32_t)); sent_seq = rte_be_to_cpu_32(sent_seq); - sfc_ef10_tx_qdesc_tso2_create(txq, *added, packet_id, 0, sent_seq, - first_m_seg->tso_segsz); + sfc_ef10_tx_qdesc_tso2_create(txq, *added, packet_id, outer_packet_id, + sent_seq, first_m_seg->tso_segsz); (*added) += SFC_EF10_TSO_OPT_DESCS_NUM; sfc_ef10_tx_qdesc_dma_create(hdr_iova, header_len, false, @@ -927,7 +934,9 @@ sfc_ef10_tx_qcreate(uint16_t port_id, uint16_t queue_id, if (txq->sw_ring == NULL) goto fail_sw_ring_alloc; - if (info->offloads & DEV_TX_OFFLOAD_TCP_TSO) { + if (info->offloads & (DEV_TX_OFFLOAD_TCP_TSO | + DEV_TX_OFFLOAD_VXLAN_TNL_TSO | + DEV_TX_OFFLOAD_GENEVE_TNL_TSO)) { txq->tsoh = rte_calloc_socket("sfc-ef10-txq-tsoh", info->txq_entries, SFC_TSOH_STD_LEN, @@ -1090,6 +1099,7 @@ struct sfc_dp_tx sfc_ef10_tx = { .hw_fw_caps = SFC_DP_HW_FW_CAP_EF10, }, .features = SFC_DP_TX_FEAT_TSO | + SFC_DP_TX_FEAT_TSO_ENCAP | SFC_DP_TX_FEAT_MULTI_SEG | SFC_DP_TX_FEAT_MULTI_POOL | SFC_DP_TX_FEAT_REFCNT | diff --git a/drivers/net/sfc/sfc_tx.c b/drivers/net/sfc/sfc_tx.c index 4037802e6..e1ef00cc7 100644 --- a/drivers/net/sfc/sfc_tx.c +++ b/drivers/net/sfc/sfc_tx.c @@ -70,6 +70,10 @@ sfc_tx_get_queue_offload_caps(struct sfc_adapter *sa) if (sa->tso) caps |= DEV_TX_OFFLOAD_TCP_TSO; + if (sa->tso_encap) + caps |= (DEV_TX_OFFLOAD_VXLAN_TNL_TSO | + DEV_TX_OFFLOAD_GENEVE_TNL_TSO); + return caps; } @@ -469,7 +473,9 @@ sfc_tx_qstart(struct sfc_adapter *sa, unsigned int sw_index) 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, @@ -588,18 +594,25 @@ int 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) { 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) { + 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; -- 2.17.1