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 1814AA04A2; Thu, 3 Mar 2022 07:03:09 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B21074068B; Thu, 3 Mar 2022 07:03:07 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 8B4A440141 for ; Thu, 3 Mar 2022 07:03:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646287386; x=1677823386; h=from:to:cc:subject:date:message-id; bh=X8p2FzXlEHvbo9nZEPoTdhvK/jeta8aHM2SHkyMJBYU=; b=AZQfstYq8VcI6OMNoTFDNDNCWhxsPKID6Vl8zGYHincOOX3KNKYL/ecq UX5brTENhxamxGTTgtMLWomQdHWSxzqX1eC7lOhIWWBgIaUNN5HOHvW0i cw1/k6+RSCqfJG3BE8C9NIC1FXpqtTk7PDH0q+83L6OoRcYR1P8rRAp3m EQ40XOO5c4s5f/edimcBAAEng+lQ4OJynGzdRLxzXyUrO4QLZAw/s86P5 VIel4QTQeAYebphiUSbGsFM4OpjJZBHaI7bDNLCzbgbvDNQaG2zc048jQ eDJkGuzQVDHk5Et0gth3iOmA8T8GoLBxDTYFstE4cKRoCzHyZkzQDobRI A==; X-IronPort-AV: E=McAfee;i="6200,9189,10274"; a="253315744" X-IronPort-AV: E=Sophos;i="5.90,151,1643702400"; d="scan'208";a="253315744" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Mar 2022 22:03:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,151,1643702400"; d="scan'208";a="551605664" Received: from npg-dpdk-xuan-cbdma.sh.intel.com ([10.67.110.228]) by orsmga008.jf.intel.com with ESMTP; 02 Mar 2022 22:03:02 -0800 From: xuan.ding@intel.com To: thomas@monjalon.net, ferruh.yigit@intel.com, andrew.rybchenko@oktetlabs.ru Cc: dev@dpdk.org, viacheslavo@nvidia.com, qi.z.zhang@intel.com, ping.yu@intel.com, Xuan Ding , Yuan Wang Subject: [RFC] ethdev: introduce protocol type based header split Date: Thu, 3 Mar 2022 06:01:36 +0000 Message-Id: <20220303060136.36427-1-xuan.ding@intel.com> X-Mailer: git-send-email 2.17.1 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Xuan Ding Header split consists of splitting a received packet into two separate regions based on the packet content. Splitting is usually between the packet header that can be posted to a dedicated buffer and the packet payload that can be posted to a different buffer. This kind of splitting is useful in some use cases, such as GPU. GPU can directly process the payload part and improve the performance significantly. Currently, Rx buffer split supports length and offset based packet split. This is not suitable for some NICs that do split based on protocol types. Tunneling makes the conversion from offset to protocol inaccurate. This patch extends the current buffer split to support protocol based header split. A new proto field is introduced in the rte_eth_rxseg_split structure reserved field to specify header split type. With Rx offload flag RTE_ETH_RX_OFFLOAD_HEADER_SPLIT enabled and protocol type configured, PMD will split the ingress packets into two separate regions. Currently, L2/L3/L4 level header split is supported. Signed-off-by: Xuan Ding Signed-off-by: Yuan Wang --- lib/ethdev/rte_ethdev.c | 2 +- lib/ethdev/rte_ethdev.h | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 70c850a2f1..d37c8f9d7e 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -1784,7 +1784,7 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, &dev_info); if (ret != 0) return ret; - } else { + } else if (!(rx_conf->offloads & RTE_ETH_RX_OFFLOAD_HEADER_SPLIT)) { RTE_ETHDEV_LOG(ERR, "No Rx segmentation offload configured\n"); return -EINVAL; } diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index c2d1f9a972..6743648c22 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -1202,7 +1202,8 @@ struct rte_eth_rxseg_split { struct rte_mempool *mp; /**< Memory pool to allocate segment from. */ uint16_t length; /**< Segment data length, configures split point. */ uint16_t offset; /**< Data offset from beginning of mbuf data buffer. */ - uint32_t reserved; /**< Reserved field. */ + uint16_t proto; + uint16_t reserved; /**< Reserved field. */ }; /** @@ -1664,6 +1665,20 @@ struct rte_eth_conf { RTE_ETH_RX_OFFLOAD_QINQ_STRIP) #define DEV_RX_OFFLOAD_VLAN RTE_DEPRECATED(DEV_RX_OFFLOAD_VLAN) RTE_ETH_RX_OFFLOAD_VLAN +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice. + * This enum indicates the header split protocol type + */ +enum rte_eth_rx_header_split_protocol_type { + RTE_ETH_RX_HEADER_SPLIT_DEFAULT = 0, + RTE_ETH_RX_HEADER_SPLIT_INNER_L2, + RTE_ETH_RX_HEADER_SPLIT_OUTER_L2, + RTE_ETH_RX_HEADER_SPLIT_IP, + RTE_ETH_RX_HEADER_SPLIT_TCP_UDP, + RTE_ETH_RX_HEADER_SPLIT_SCTP +}; + /* * If new Rx offload capabilities are defined, they also must be * mentioned in rte_rx_offload_names in rte_ethdev.c file. -- 2.17.1