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 396D445EFA for ; Fri, 20 Dec 2024 17:35:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0E4CE4003C; Fri, 20 Dec 2024 17:35:54 +0100 (CET) Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by mails.dpdk.org (Postfix) with ESMTP id 127E14003C for ; Fri, 20 Dec 2024 17:35:52 +0100 (CET) Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-2165cb60719so21624475ad.0 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=M/4MeDdi7SX1gbU/lPDrKiMFkPPBepc6R5bImxTJDbJ/Asi9d08aKHLIJaWSZ2uvId 0mFq9JrdRGkPbCvAbeUv6zKqm4PqgEXnQqXP2wmIttMKn9JD6dSeqqpzjLPo7i5ivTDI u5+9ULQ4vSLlCsmiYAwUlb8Dmfnvr/tE21yXFoPZlsjYArax3EaMl8frbTkene1ZyMqo Eho/yvdSYftLljkOHS/80Inlax6YDYTOiHLalJijOWhvvzcjqmoXUvswAtCvj4Kad0P6 qi5vMZ4aYpc+xR5x7mk82KLUFwIgI/wBS5phyKGY34Vr015F1rNqBrDSeGHyDKOdRHy3 jOAA== X-Forwarded-Encrypted: i=1; AJvYcCVwic94EFD1ILw6j1h1xBwpReJM2OvLPC0ji4i9TyQuUKpNCFVUdgdAvJOTb42N1WpfeVn7A14=@dpdk.org X-Gm-Message-State: AOJu0YwVGlpNcAp1zGwIpx4rNBY7YFi9bbt8G2Ny4M00IXZaTTpBZ9O+ +afrC3ReVAYfQGKcIANz66b4PXiKzWo8vWNwKlCi+VqrdKCrQJr55lZ7zJ1fU3U= X-Gm-Gg: ASbGnctMBOpTid7z4SIgcO7tEz4DKg9xzjfprnu7I2htwddjpPgKhznV7ayqZJDbonY u+g+132c8wxU2aJzbY9eDTy1dHMCtDgCBCTmKpKoGNFrpfq4XAS8pMU9l5iD5ak/RAfE39iO6Sw 4fYYuemWV+Frnm5au55jFKDBrWV28OGb7JATLKG8UJa7x1F2kJ4g7EJIr3GvMJzRr5PxiFBZXOd birUKuVXc1fiFvwC2L5v2cKr4NvHS2FkZvkQZ4otewOf+KChLgrx/4IF7l5R6ysJOa97x6kKk19 vz7Rt8QItoEI1NkZNRF9tDjPjqWqAO610g== 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: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-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?