From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A8752A04DD; Mon, 26 Oct 2020 23:23:24 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B833C4C87; Mon, 26 Oct 2020 23:20:50 +0100 (CET) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 64DFA2BD0 for ; Mon, 26 Oct 2020 23:20:45 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id EE2F35C0181; Mon, 26 Oct 2020 18:20:43 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 26 Oct 2020 18:20:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=o49n++PVaZRrl CkmRp4D7CGHS/jzIxJ6DsIX8WohrEg=; b=Bq06yliXmM0lelDXbFzBl67bUmfQ0 DIXnlNn5RvFktw9v2/B3SfjHfLXdIvIJqjENSTm6olLIkxjl6G4RteWpB9X7MqJ8 PVMbmh7vk+znAXCBXBK5vI5tyx0x/vb4OnB5SGD7+OhertgheTHB3UTDQtW97aU7 8f8qvNJ3vfk++gf5ChonlqrP46KMRZEYdn/vdohx/RsMqKflXhH6DBo2O3T3uI12 /XJGkBy42d0zrgY3/IqVSTtKhyX/eSqYsnKiM7d26+Q6F+MEEBkf9uNx9kRXrWwu zDA9+tOs0DG1nwhzZNqUqqTj4Y2ev5Uhi/Whpn6Qw8hue3xjoO9twn41A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=o49n++PVaZRrlCkmRp4D7CGHS/jzIxJ6DsIX8WohrEg=; b=FE97tZyB 43Sn/ZYu5PsUb/wn7Ngth7iXgwKDVVKfehsJPdnx5UJOh688J0Y6lVZxj31HdTYe FMf+kUuCDdfuz1Z2685cVymqDHiF/V983IjcIqKTCuTuttsYrrVlHttWPZShzjq3 KCsvvb68EPW9q0lyLkfVxty3X41O55eoor45cPBlzcj3abPPnO6tUTum8k9gtNSI C9Ou3HuECsraVSItGS+A1MuoU+tEr9HDVECqu3nf7N2U5nuT4KCpZqqN0D9Usxro vmMDFGX0tFF4fo+a4tSry6C1oRd+aZHxPQYG5rbLZ2z4Tgv5MSRoDTlB6nf3Otzp nNX1JoPK3uf+Fg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeejgdduvdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpeejnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id CC89A306467D; Mon, 26 Oct 2020 18:20:42 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com, Yong Wang Date: Mon, 26 Oct 2020 23:20:07 +0100 Message-Id: <20201026222013.2147904-10-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201026222013.2147904-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201026222013.2147904-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 09/15] net/vmxnet3: switch MSS hint to dynamic mbuf field 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 segment count, used for MSS guess, was stored in the deprecated mbuf field udata64. It is moved to a dynamic field in order to allow removal of udata64. Signed-off-by: Thomas Monjalon --- drivers/net/vmxnet3/vmxnet3_ethdev.c | 15 +++++++++++++++ drivers/net/vmxnet3/vmxnet3_ethdev.h | 6 ++++++ drivers/net/vmxnet3/vmxnet3_rxtx.c | 9 +++++---- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 6920ab568c..6e99b67b5a 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -59,6 +59,8 @@ DEV_RX_OFFLOAD_JUMBO_FRAME | \ DEV_RX_OFFLOAD_RSS_HASH) +int vmxnet3_segs_dynfield_offset; + static int eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev); static int eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev); static int vmxnet3_dev_configure(struct rte_eth_dev *dev); @@ -233,6 +235,11 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev) struct vmxnet3_hw *hw = eth_dev->data->dev_private; uint32_t mac_hi, mac_lo, ver; struct rte_eth_link link; + static const struct rte_mbuf_dynfield vmxnet3_segs_dynfield_desc = { + .name = VMXNET3_SEGS_DYNFIELD_NAME, + .size = sizeof(VMXNET3_SEGS_DYNFIELD_TYPE), + .align = __alignof__(VMXNET3_SEGS_DYNFIELD_TYPE), + }; PMD_INIT_FUNC_TRACE(); @@ -242,6 +249,14 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev) eth_dev->tx_pkt_prepare = vmxnet3_prep_pkts; pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); + /* extra mbuf field is required to guess MSS */ + vmxnet3_segs_dynfield_offset = + rte_mbuf_dynfield_register(&vmxnet3_segs_dynfield_desc); + if (vmxnet3_segs_dynfield_offset < 0) { + PMD_INIT_LOG(ERR, "Cannot register mbuf field."); + return -rte_errno; + } + /* * for secondary processes, we don't initialize any further as primary * has already done this work. diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.h b/drivers/net/vmxnet3/vmxnet3_ethdev.h index dd685b02b7..e35edf07be 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.h +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.h @@ -193,4 +193,10 @@ uint16_t vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t vmxnet3_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts); +extern int vmxnet3_segs_dynfield_offset; +#define VMXNET3_SEGS_DYNFIELD_NAME "rte_net_vmxnet3_dynfield_segs" +#define VMXNET3_SEGS_DYNFIELD_TYPE uint8_t +#define VMXNET3_SEGS_DYNFIELD(mbuf) (*RTE_MBUF_DYNFIELD(rxm, \ + vmxnet3_segs_dynfield_offset, VMXNET3_SEGS_DYNFIELD_TYPE *)) + #endif /* _VMXNET3_ETHDEV_H_ */ diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index e10f9ee870..2b0e2e6f19 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -674,6 +674,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, struct rte_ipv6_hdr *ipv6_hdr; struct rte_tcp_hdr *tcp_hdr; char *ptr; + uint8_t segs; RTE_ASSERT(rcd->tcp); @@ -710,9 +711,9 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, tcp_hdr = (struct rte_tcp_hdr *)(ptr + hlen); hlen += (tcp_hdr->data_off & 0xf0) >> 2; - if (rxm->udata64 > 1) - return (rte_pktmbuf_pkt_len(rxm) - hlen + - rxm->udata64 - 1) / rxm->udata64; + segs = VMXNET3_SEGS_DYNFIELD(rxm); + if (segs > 1) + return (rte_pktmbuf_pkt_len(rxm) - hlen + segs - 1) / segs; else return hw->mtu - hlen + sizeof(struct rte_ether_hdr); } @@ -737,7 +738,7 @@ vmxnet3_rx_offload(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, (const Vmxnet3_RxCompDescExt *)rcd; rxm->tso_segsz = rcde->mss; - rxm->udata64 = rcde->segCnt; + VMXNET3_SEGS_DYNFIELD(rxm) = rcde->segCnt; ol_flags |= PKT_RX_LRO; } } else { /* Offloads set in eop */ -- 2.28.0