From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C00FEA0547 for ; Tue, 9 Feb 2021 11:35:53 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B94EC40147; Tue, 9 Feb 2021 11:35:53 +0100 (CET) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by mails.dpdk.org (Postfix) with ESMTP id 95FA940147 for ; Tue, 9 Feb 2021 11:35:52 +0100 (CET) Received: by mail-wm1-f44.google.com with SMTP id y134so2967159wmd.3 for ; Tue, 09 Feb 2021 02:35:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=X31/riSg0HPSsNMj40dU2vriWdlb28WTEJl46i/eldQ=; b=iZJhHhlQ3WKkzjAv1DCQh/ZtotBG9PdvST83J5aiAoaZhPW917Q5jjNp+iq1OM+HIc 7zWtgxHcMNhaZ6JaRJQvXhw6VmqJCO6AFfCUsAw+9yNLPgMGc08afNqNWxKxhWBFy/fS 1pU7VH6e4T8h4vIkKEtSlhUEPg2rwsrdDoTdvIlH8q+bCGOJP5+1266UPR9PuVCi2aym CenfhZ5dZiE8Z6J0eh67TR5xSBqZFxkoQbQa7cQ52V744URBmpM8uGiSLfwcU57+GOm8 UB0A4NtF/PebtHI37I9VcmHUNwh+LCJZnGRtgAgM4pWhCHcc5zmo+tJb95Pe51yjhQE0 WM8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=X31/riSg0HPSsNMj40dU2vriWdlb28WTEJl46i/eldQ=; b=pIRU16en7ns+BxncPgYtqXdqg9ETBAK+OEoEqIzpP8T4K1ylGnmVP6BJGPfU/OJNK6 PaFak4viI2xc1gulAFHEKLw71LLdcyESJnqq6/Xm42llfq47AXwv5H25SEijc9WLcuAQ apCXJ0BYJUqRmHJjq0GTNbYbfLe9A7RV0+kn2gurfRNxnGr8m74zTP/gExMXpQQgrrYD iCLBYQSyTGeWetsTfwzQjN4rulr64/BK8yYH6Pd6mMkQsOIw6adO9Nzqo595jovjRtP3 EJ/an0oZitKN9wlXYVI13zVsj9CPudi9btsE1UMERpauNAzr3hmfCS+YdRqdzBJAlL3J 09qQ== X-Gm-Message-State: AOAM531wSCMzVpsO+wsr4/juLupbYK3jHVSWq6YU2rVT1TlpgBPR6qag eNlxrOkb9LxseMF0VRp2DlsEmnmwaXDlow== X-Google-Smtp-Source: ABdhPJyrxemy2JnPWmt16DSrUtYiU0bxA7+AYhnLZ73LVojSSCFxdnJ5t/Bg9cJovaSnBXaqBgz08Q== X-Received: by 2002:a1c:e90d:: with SMTP id q13mr2784040wmc.136.1612866952392; Tue, 09 Feb 2021 02:35:52 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id a17sm37086652wrx.63.2021.02.09.02.35.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Feb 2021 02:35:51 -0800 (PST) From: luca.boccassi@gmail.com To: Ivan Malov Cc: Andrew Rybchenko , Andy Moreton , dpdk stable Date: Tue, 9 Feb 2021 10:35:05 +0000 Message-Id: <20210209103529.466775-7-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210209103529.466775-1-luca.boccassi@gmail.com> References: <20210205111920.1272063-1-luca.boccassi@gmail.com> <20210209103529.466775-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/sfc: fix TSO and checksum offloads for EF10' has been queued to stable release 20.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/11/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/3eb9b664d9d976d5875e13d68e79f50376eb88b0 Thanks. Luca Boccassi --- >From 3eb9b664d9d976d5875e13d68e79f50376eb88b0 Mon Sep 17 00:00:00 2001 From: Ivan Malov Date: Tue, 2 Feb 2021 18:23:45 +0300 Subject: [PATCH] net/sfc: fix TSO and checksum offloads for EF10 [ upstream commit be56d20ff17fdba2568a56e35abf1706cb48bb85 ] This is workaround for 8000-series EF10 hardware TSO bug. Innermost IP length and outer UDP datagram length must be greater than or equal to the corresponding values derived from the MSS; otherwise, the checksum offloads will break. Fixes: c1ce2ba218f8 ("net/sfc: support tunnel TSO on EF10 native Tx datapath") Fixes: 6bc985e41155 ("net/sfc: support TSO in EF10 Tx datapath") Fixes: fec33d5bb3eb ("net/sfc: support firmware-assisted TSO") Signed-off-by: Ivan Malov Reviewed-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- drivers/net/sfc/sfc_ef10_tx.c | 19 +++++++++++++++++++ drivers/net/sfc/sfc_tso.c | 7 +++++++ drivers/net/sfc/sfc_tso.h | 30 ++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) diff --git a/drivers/net/sfc/sfc_ef10_tx.c b/drivers/net/sfc/sfc_ef10_tx.c index 87fa40f3eb..33d2d637c2 100644 --- a/drivers/net/sfc/sfc_ef10_tx.c +++ b/drivers/net/sfc/sfc_ef10_tx.c @@ -481,6 +481,25 @@ sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg, needed_desc--; } + /* + * 8000-series EF10 hardware requires that innermost IP length + * be greater than or equal to the value which each segment is + * supposed to have; otherwise, TCP checksum will be incorrect. + * + * The same concern applies to outer UDP datagram length field. + */ + switch (m_seg->ol_flags & PKT_TX_TUNNEL_MASK) { + case PKT_TX_TUNNEL_VXLAN: + /* FALLTHROUGH */ + case PKT_TX_TUNNEL_GENEVE: + sfc_tso_outer_udp_fix_len(first_m_seg, hdr_addr); + break; + default: + break; + } + + sfc_tso_innermost_ip_fix_len(first_m_seg, hdr_addr, iph_off); + /* * 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. diff --git a/drivers/net/sfc/sfc_tso.c b/drivers/net/sfc/sfc_tso.c index d6f1119890..b090ef14db 100644 --- a/drivers/net/sfc/sfc_tso.c +++ b/drivers/net/sfc/sfc_tso.c @@ -140,6 +140,13 @@ sfc_efx_tso_do(struct sfc_efx_txq *txq, unsigned int idx, tsoh = rte_pktmbuf_mtod(m, uint8_t *); } + /* + * 8000-series EF10 hardware requires that innermost IP length + * be greater than or equal to the value which each segment is + * supposed to have; otherwise, TCP checksum will be incorrect. + */ + sfc_tso_innermost_ip_fix_len(m, tsoh, nh_off); + /* * Handle IP header. Tx prepare has debug-only checks that offload flags * are correctly filled in in TSO mbuf. Use zero IPID if there is no diff --git a/drivers/net/sfc/sfc_tso.h b/drivers/net/sfc/sfc_tso.h index 8597c2868a..361aa22192 100644 --- a/drivers/net/sfc/sfc_tso.h +++ b/drivers/net/sfc/sfc_tso.h @@ -38,6 +38,36 @@ sfc_tso_ip4_get_ipid(const uint8_t *pkt_hdrp, size_t ip_hdr_off) return rte_be_to_cpu_16(ipid); } +static inline void +sfc_tso_outer_udp_fix_len(const struct rte_mbuf *m, uint8_t *tsoh) +{ + rte_be16_t len = rte_cpu_to_be_16(m->l2_len + m->l3_len + m->l4_len + + m->tso_segsz); + + rte_memcpy(tsoh + m->outer_l2_len + m->outer_l3_len + + offsetof(struct rte_udp_hdr, dgram_len), + &len, sizeof(len)); +} + +static inline void +sfc_tso_innermost_ip_fix_len(const struct rte_mbuf *m, uint8_t *tsoh, + size_t iph_ofst) +{ + size_t ip_payload_len = m->l4_len + m->tso_segsz; + size_t field_ofst; + rte_be16_t len; + + if (m->ol_flags & PKT_TX_IPV4) { + field_ofst = offsetof(struct rte_ipv4_hdr, total_length); + len = rte_cpu_to_be_16(m->l3_len + ip_payload_len); + } else { + field_ofst = offsetof(struct rte_ipv6_hdr, payload_len); + len = rte_cpu_to_be_16(ip_payload_len); + } + + rte_memcpy(tsoh + iph_ofst + field_ofst, &len, sizeof(len)); +} + unsigned int sfc_tso_prepare_header(uint8_t *tsoh, size_t header_len, struct rte_mbuf **in_seg, size_t *in_off); -- 2.29.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-02-09 10:34:58.202437380 +0000 +++ 0007-net-sfc-fix-TSO-and-checksum-offloads-for-EF10.patch 2021-02-09 10:34:57.858582996 +0000 @@ -1 +1 @@ -From be56d20ff17fdba2568a56e35abf1706cb48bb85 Mon Sep 17 00:00:00 2001 +From 3eb9b664d9d976d5875e13d68e79f50376eb88b0 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit be56d20ff17fdba2568a56e35abf1706cb48bb85 ] + @@ -14 +15,0 @@ -Cc: stable@dpdk.org