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 66A0DA0679 for ; Tue, 2 Apr 2019 11:29:51 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A6A425592; Tue, 2 Apr 2019 11:29:12 +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 84EBB37A8 for ; Tue, 2 Apr 2019 11:28:59 +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 2F92810007E; Tue, 2 Apr 2019 09:28:58 +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:54 -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 x329SrQc028263; Tue, 2 Apr 2019 10:28:53 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id C4FF4161610; Tue, 2 Apr 2019 10:28:53 +0100 (BST) From: Andrew Rybchenko To: CC: Igor Romanov Date: Tue, 2 Apr 2019 10:28:37 +0100 Message-ID: <1554197324-32391-6-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-9.382400-4.000000-10 X-TMASE-MatchedRID: IPxpSMNZKh8wNBBJ8BaLRVVN8laWo90MTJDl9FKHbrlJJReS9JUB3K1r wNdVdYippxA6VhdDjyYo/ljGvJmOC4x1g1lTiexdIPuyP6EAKjtLxPtqS8Bm599zZd3pUn7KGxC eMfpvMvKR3tFNlgkf27BjnwsvnZG/Fs7KD/fmV+PJ5W6OZe5hhWf6wD367VgtC/+dM49Ci+zHwq F5MCnPXxWeJr23sOVBDo1EepEGBHOTu4o902k1S7MsPmSZxbpkfS0Ip2eEHnz3IzXlXlpamPoLR 4+zsDTt1MYI0Gm2di5BHfnQdOcpqWyQFZKVbrN0EoWcIBAPbm43ctaEW83JYlZca9RSYo/b X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--9.382400-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24526.005 X-MDID: 1554197338-YQRbIdehrnug Subject: [dpdk-dev] [PATCH 05/12] net/sfc: support Tx preparation in EF10 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: <20190402092837.x-PT1pmwp88pTijQG9yNZTDawSh1nOWGFBTjfpStN68@z> From: Igor Romanov Implement tx_prepare callback and update Tx burst function accordingly. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/sfc_ef10_tx.c | 56 ++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 10 deletions(-) diff --git a/drivers/net/sfc/sfc_ef10_tx.c b/drivers/net/sfc/sfc_ef10_tx.c index 999dabd12..05f30cb2e 100644 --- a/drivers/net/sfc/sfc_ef10_tx.c +++ b/drivers/net/sfc/sfc_ef10_tx.c @@ -319,6 +319,44 @@ sfc_ef10_try_reap(struct sfc_ef10_txq * const txq, unsigned int added, return (needed_desc <= *dma_desc_space); } +static uint16_t +sfc_ef10_prepare_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, + uint16_t nb_pkts) +{ + uint16_t i; + + for (i = 0; i < nb_pkts; i++) { + struct rte_mbuf *m = tx_pkts[i]; + int ret; + +#ifdef RTE_LIBRTE_SFC_EFX_DEBUG + /* + * In non-TSO case, check that a packet segments do not exceed + * the size limit. Perform the check in debug mode since MTU + * more than 9k is not supported, but the limit here is 16k-1. + */ + if (!(m->ol_flags & PKT_TX_TCP_SEG)) { + struct rte_mbuf *m_seg; + + for (m_seg = m; m_seg != NULL; m_seg = m_seg->next) { + if (m_seg->data_len > + SFC_EF10_TX_DMA_DESC_LEN_MAX) { + rte_errno = EINVAL; + break; + } + } + } +#endif + ret = sfc_dp_tx_prepare_pkt(m); + if (unlikely(ret != 0)) { + rte_errno = ret; + break; + } + } + + return i; +} + static int sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg, unsigned int *added, unsigned int *dma_desc_space, @@ -330,7 +368,7 @@ sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg, /* 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; + uint16_t packet_id = 0; uint32_t sent_seq; uint8_t *hdr_addr; rte_iova_t hdr_iova; @@ -433,20 +471,17 @@ sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg, needed_desc--; } - switch (first_m_seg->ol_flags & (PKT_TX_IPV4 | PKT_TX_IPV6)) { - case PKT_TX_IPV4: { + /* + * Tx prepare has debug-only checks that offload flags are correctly + * filled in in TSO mbuf. Use zero IPID if there is no IPv4 flag. + * If the packet is still IPv4, HW will simply start from zero IPID. + */ + if (first_m_seg->ol_flags & PKT_TX_IPV4) { const struct ipv4_hdr *iphe4; iphe4 = (const struct ipv4_hdr *)(hdr_addr + iph_off); rte_memcpy(&packet_id, &iphe4->packet_id, sizeof(uint16_t)); packet_id = rte_be_to_cpu_16(packet_id); - break; - } - case PKT_TX_IPV6: - packet_id = 0; - break; - default: - return EINVAL; } th = (const struct tcp_hdr *)(hdr_addr + tcph_off); @@ -1014,6 +1049,7 @@ struct sfc_dp_tx sfc_ef10_tx = { .qstop = sfc_ef10_tx_qstop, .qreap = sfc_ef10_tx_qreap, .qdesc_status = sfc_ef10_tx_qdesc_status, + .pkt_prepare = sfc_ef10_prepare_pkts, .pkt_burst = sfc_ef10_xmit_pkts, }; -- 2.17.1