From patchwork Mon Jun 24 16:02:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 55254 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8E96E34F0; Mon, 24 Jun 2019 18:02:17 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [84.52.114.115]) by dpdk.org (Postfix) with ESMTP id 8001C2C6D for ; Mon, 24 Jun 2019 18:02:16 +0200 (CEST) Received: from olwe.oktetlabs.ru (olwe.oktetlabs.ru [192.168.37.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id E42A67F71C; Mon, 24 Jun 2019 19:02:15 +0300 (MSK) From: Ivan Malov To: Olivier Matz Cc: dev@dpdk.org, "Ananyev, Konstantin" , Andrew Rybchenko Date: Mon, 24 Jun 2019 19:02:06 +0300 Message-Id: <20190624160206.21014-1-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190412150542.12026-1-ivan.malov@oktetlabs.ru> References: <20190412150542.12026-1-ivan.malov@oktetlabs.ru> Subject: [dpdk-dev] [PATCH v2] mbuf: outer offsets are undefined for non-tunnel packets 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" The default policy for offload-specific fields is that they are undefined unless the corresponding offloads are requested in mbuf ol_flags. This is also the case for outer L2 and L3 length fields which must not be assumed to contain zeros for non-tunnel packets. The patch clarifies this behaviour in the comments. PMDs which mistakenly assume these fields to be zero for non-tunnel packets are expected to comply with the clarified comment and have dedicated fixes. Signed-off-by: Ivan Malov Acked-by: Konstantin Ananyev --- lib/librte_mbuf/rte_mbuf.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 0d9fef0..26a0b14 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -702,7 +702,18 @@ struct rte_mbuf { uint64_t tso_segsz:RTE_MBUF_TSO_SEGSZ_BITS; /**< TCP TSO segment size */ - /* fields for TX offloading of tunnels */ + /* + * Fields for Tx offloading of tunnels. + * These are undefined for packets which don't request + * any tunnel offloads (outer IP or UDP checksum, + * tunnel TSO). + * + * PMDs are advised not to use these fields + * unconditionally when calculating offsets. + * + * Applications are expected to set appropriate tunnel + * offload flags when they fill in these fields. + */ uint64_t outer_l3_len:RTE_MBUF_OUTL3_LEN_BITS; /**< Outer L3 (IP) Hdr Length. */ uint64_t outer_l2_len:RTE_MBUF_OUTL2_LEN_BITS;