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 6D07FA04E6; Fri, 30 Oct 2020 18:47:50 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1F5795AAE; Fri, 30 Oct 2020 18:45:23 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id BF6C05913 for ; Fri, 30 Oct 2020 18:45:06 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 7436A5C0221; Fri, 30 Oct 2020 13:45:06 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 30 Oct 2020 13:45:06 -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=1PIv/Ly/apQEX HhrzPrT/4w1V6sIZN9yh8eCG39yyOQ=; b=Q2jCVi/V6+8ILwMmGwQ7l970YY/nt L/W4SvMxqszDZVT8qmjIG3UaCGILAe2sYEmXLwTb92hK4HKM3HZkWv6YzwVI478K qdy9VL6+Tu+5xQucal6NKaolRgbRHeocv+rQFvEavmAhz9LXq3Icl5898wZoruzo QMIL5m3z6Ul/jCu9KpoQrLQXGtAv67Ktlo4F58ctHDpLd/SRYgLvgEdedLH2BfO4 q1TtvpMm5WF6Iqny/bUc1ClRUdRmEevlyDmsRCtfaYKwyB536QaNaxeJ/6ZxPFHZ 8Hkqqp9YxNIFd6/BqnvhRpoi0TKrXApQBhXcXueZ3r2idUPu3vep5xrhA== 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=1PIv/Ly/apQEXHhrzPrT/4w1V6sIZN9yh8eCG39yyOQ=; b=GxbL3Ydx aiDeLLz+MEWJhAXbV77tONO4Oq4WNbjF/KjivsW0TW6CYV9SWyyQrxhTXJpJKjNB /QGhNM5Fjsi7lvYKG/SayRZsLYHZw0H+riYLatAUoiT7x9XbKe9rNY6ya2EQ0jtc Zf3FiPfhGpu/BnrnSgm12AblHa5SKeex597pLCuDa+JdzdDV+NfonJsaLUhFqadI aWTAimKYT9mBxM/jizfr+MP7pw3cnrxSuYEM+e7nLpG+HQQouIF9W3qXknNiU2+p Jd4YkiOH0ohQjlewZydpiFkZ+gw4QMJBKC412cOUe8k5mlNpYf1fdPPZSB1EvY6a Pw4d7UtO4+moXw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleehgdellecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepieenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth 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 4E19A3064610; Fri, 30 Oct 2020 13:45:05 -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, jerinj@marvell.com, Yong Wang Date: Fri, 30 Oct 2020 18:44:35 +0100 Message-Id: <20201030174441.1076264-10-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201030174441.1076264-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201030174441.1076264-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v6 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 | 11 +++++++++++ drivers/net/vmxnet3/vmxnet3_rxtx.c | 9 +++++---- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 6920ab568c..23a2ebbefa 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 = -1; + 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_t), + .align = __alignof__(vmxnet3_segs_dynfield_t), + }; 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..9d00f5d127 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.h +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.h @@ -193,4 +193,15 @@ 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); +#define VMXNET3_SEGS_DYNFIELD_NAME "rte_net_vmxnet3_dynfield_segs" +typedef uint8_t vmxnet3_segs_dynfield_t; +extern int vmxnet3_segs_dynfield_offset; + +static inline vmxnet3_segs_dynfield_t * +vmxnet3_segs_dynfield(struct rte_mbuf *mbuf) +{ + return RTE_MBUF_DYNFIELD(mbuf, \ + vmxnet3_segs_dynfield_offset, vmxnet3_segs_dynfield_t *); +} + #endif /* _VMXNET3_ETHDEV_H_ */ diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index e10f9ee870..95c697f8e3 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