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 0D82345EFA; Fri, 20 Dec 2024 17:35:55 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 350EB402CC; Fri, 20 Dec 2024 17:35:54 +0100 (CET) Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by mails.dpdk.org (Postfix) with ESMTP id 155FB40156 for ; Fri, 20 Dec 2024 17:35:52 +0100 (CET) Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-21619108a6bso18726665ad.3 for ; Fri, 20 Dec 2024 08:35:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1734712552; x=1735317352; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=SCG+S7jDNqhTSU1TTRWVvS/BfIE4/nAdmmO36sAthg0=; b=Ufu4oLhhAYrMGCHh+G7MzfwtdnpXD4rilKR/jNdc671UpXsffR/cqHPtXShZ/UKxPx deWx1+KHF3PGIQk68+ZBjP4NNLpA9lIh1QPgAt6xKlQ2k0aH/y9ujXxV5LtuwOh/VU69 7Gwh2Fd99w/lRRApyzPQ+s9EveRrDzLMeXHbWCN0z6Qc5oVYdc7RvPHaqD42JoJMEu4V UrTDFNkVsVWin/upJn/F1f9SHGOTQ8Mdh2y3gFR9lJSMpFxp34JxhjfrfPaEQm1xGCXN q1Ez0NPtzKq7sYQZTyudPbAou8Bu3BYw667bfG/I9m5SRquav3tXPJkEkf1aiOEk8vMX OW1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734712552; x=1735317352; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SCG+S7jDNqhTSU1TTRWVvS/BfIE4/nAdmmO36sAthg0=; b=StkHo+vWbm2qJcchHUEFf72qL+eFEYeTgF8QYym+VkDrNoYX1payGOyz548v0YCfu/ tuqyUa4MciqVvLSLqEUbiWbtllsdkv2LKBLhdZtRHpPTKlpZIp2qde40wngH3zlltCAW Rcx4XLinCwd5ob8TieuY6tFfVoMr7lG817m91XLGSOvVhkOWOoFeuBOuYzCzDBFgXvQ+ hfQbxfyx6xsLmrelGz2Bd2Qkxggn2ux5K2atXr6bCg/wyZkCSQrzxteuHskXIcGS6jlU 8dgRR03WAJS94suH8Tu21D8qTIJBadt2HGVTP592J5FC+lzdidLvMdeUEdAEWMU7IBOZ 6eOA== X-Gm-Message-State: AOJu0Yzwj9MoG3afFYooD90pOrKz9CsGM3V4acJyWfjzHDSyb3r294gm OkNAmZ2GNRHpM5+IWvioX6Hn0idULZSftuH2bJnF9CyaQZ1bsRrLRuti/gO063I= X-Gm-Gg: ASbGncsu9si7fZA7gZnHUq2O7YDUT0qQ88sgZES0mC+79JhfQ9p7RYbpR22e9NbFb/H DujKqSfgTSfi6wH9wITAmaQ5OVsiKs9I4d2vBjBeG2xrtzMCBncd0zDykhFEXNckYazoGkq0cLi fHE8AUozyPwwX4TpT2KQUhTds5ER5QUhDyc4sS25VKRgs4I+O5WSKeJDfKwPK6ZhoEFmR6uMZPr 3bvQjr4z1kpTtBb7xPfsRPDmqyp37rU0kKEsNC8qMU+V3bGdJPrKAzfO2F6fpt4DMxnzD8BCObP v/ge0Vj196iTmGPG1s4QXgesvBWxMky4CA== X-Google-Smtp-Source: AGHT+IHDS2acBEXh6UanLMSWez/jwzaiUArCZZy2B1cXf6zoaB3BSyvRhEVgD9haRNDn6CG1DPD8Qg== X-Received: by 2002:a17:903:94e:b0:212:68e2:6c81 with SMTP id d9443c01a7336-219e6ea0223mr50340765ad.24.1734712552099; Fri, 20 Dec 2024 08:35:52 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dca02397sm31088085ad.238.2024.12.20.08.35.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2024 08:35:51 -0800 (PST) Date: Fri, 20 Dec 2024 08:35:46 -0800 From: Stephen Hemminger To: Yunjian Wang Cc: , , , , , , Subject: Re: [PATCH 1/1] vhost: fix a double fetch when dequeue offloading Message-ID: <20241220083546.4b5ba9c9@hermes.local> In-Reply-To: <91dc12662805a3867413940f856ba9454b91c579.1734588243.git.wangyunjian@huawei.com> References: <91dc12662805a3867413940f856ba9454b91c579.1734588243.git.wangyunjian@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 On Thu, 19 Dec 2024 14:38:28 +0800 Yunjian Wang wrote: > diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c > index 69901ab3b5..5c40ae7069 100644 > --- a/lib/vhost/virtio_net.c > +++ b/lib/vhost/virtio_net.c > @@ -2914,10 +2914,12 @@ desc_to_mbuf(struct virtio_net *dev, struct vhost_virtqueue *vq, > * in a contiguous virtual area. > */ > copy_vnet_hdr_from_desc(&tmp_hdr, buf_vec); > - hdr = &tmp_hdr; > } else { > - hdr = (struct virtio_net_hdr *)((uintptr_t)buf_vec[0].buf_addr); > + rte_memcpy((void *)(uintptr_t)&tmp_hdr, > + (void *)(uintptr_t)buf_vec[0].buf_addr, > + sizeof(struct virtio_net_hdr)); > } > + hdr = &tmp_hdr; Since this if block is just an optimization of the case where vnet header is contiguous why not just always use copy_vnet_hdr_from_desc? and inline it?