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 16C4AA0A0E; Mon, 10 May 2021 09:09:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7D94F40147; Mon, 10 May 2021 09:09:05 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 8EFF64003E for ; Mon, 10 May 2021 09:09:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620630543; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=O0l0QLNOosIUag3Jcd4wS8ooNFRT273CtuQ8XZ5qKQw=; b=GFsbRJT5xbPmkmHWvfVXv/kIzXU7LUxVyzyteeOx467GmgKIbJqKP4U/ums0JETY5Dkv84 xmD0G0PJ3p8moAKJNks7VkM0Xa7zRq1hEWVqnsSr8m6/C2G8PpJjSmqPRwDnT9LihczliR EpOBZ1lo1bnWSP563b4y8RGjjiul1DI= Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-136-fvDf8rzGPry1XSMRzlCWTw-1; Mon, 10 May 2021 03:08:59 -0400 X-MC-Unique: fvDf8rzGPry1XSMRzlCWTw-1 Received: by mail-pj1-f70.google.com with SMTP id gf19-20020a17090ac7d3b0290155e8c1b68eso10485749pjb.8 for ; Mon, 10 May 2021 00:08:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=O0l0QLNOosIUag3Jcd4wS8ooNFRT273CtuQ8XZ5qKQw=; b=HzC0gE15aXGaSPJs4bC+Bzws1pQ1Rqkl2mbEsjQyHIMJ5f94xG0mBRML0hhbat7S+b ZzIB29lRNW9O7p1Ty+y0wNJfshAsmMzpWkDXjA97NZUDr5lrI3ZKYCpNKx3B8+XSZbqb LfIHsZg1gUgPEMD9gGscD1k4uxaA5NxoWdf4yZdjeKTT8vDawIZmuu7RSqM7Ov11mU1h GJSBkLwHRzjEk51HFOVFHAeFSyKX063SJLFycLBtBNU4QaT+kOLiHupTxCuRlQoSnrph EFoup0tEoJmIDprr4y49qIruSr11rYHgH0ewBHg/QgJ/Fp55r+6PLcQdN95myoNVTKq4 Y2Pw== X-Gm-Message-State: AOAM533Sq0ofDv9H2QhXKaei5t7eUTNEGZmAKpWJkWndeBI8pu0rNkvA izfDlQYEp38FMFNIAkIIiINTthalSYpqKb8IpMP6wqJfgvuJ0ul74vD/YVwodArKwEePROlEM1x Ic4Ad6g33gIgBVLyXgNY= X-Received: by 2002:a17:90a:390a:: with SMTP id y10mr25921639pjb.9.1620630537739; Mon, 10 May 2021 00:08:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydeXM/3KupFN5ZAXBtd8fJq+WRBahxcerS1JS15vmeuq4sdFCsUZIyV5qO57D07Md4vl18kE5A79sMg1ZBfI4= X-Received: by 2002:a17:90a:390a:: with SMTP id y10mr25921625pjb.9.1620630537564; Mon, 10 May 2021 00:08:57 -0700 (PDT) MIME-Version: 1.0 References: <8b9b42cf2b18feb41c4b64a174ccc154847c59f9.1617789063.git.bnemeth@redhat.com> <8b9b42cf2b18feb41c4b64a174ccc154847c59f9.1617789236.git.bnemeth@redhat.com> In-Reply-To: From: Balazs Nemeth Date: Mon, 10 May 2021 09:08:46 +0200 Message-ID: To: "Ling, WeiX" Cc: "dev@dpdk.org" Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=bnemeth@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [dpdk-dev] [PATCH v3] vhost: read last used index once 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 Sender: "dev" Hi Ling, I will take a look. Thanks for reporting. Regards, Balazs On Sat, May 8, 2021 at 10:44 AM Ling, WeiX wrote: > Hi Balazs Nemeth, > > Your patch cause a bug about virtio-user can't recieve packets when use > packed ring and ring size is 255. > > Please have a look about it. > > https://bugs.dpdk.org/show_bug.cgi?id=699 > > Thanks. > > Regards, > Ling Wei > > > -----Original Message----- > > From: dev On Behalf Of Balazs Nemeth > > Sent: Wednesday, April 7, 2021 05:55 PM > > To: bnemeth@redhat.com; dev@dpdk.org > > Subject: [dpdk-dev] [PATCH v3] vhost: read last used index once > > > > Instead of calculating the address of a packed descriptor based on the > > vq->desc_packed and vq->last_used_idx every time, store that base > > address in desc_base. On arm, this saves 176 bytes in code size of > function in > > which vhost_flush_enqueue_batch_packed gets inlined. > > > > Signed-off-by: Balazs Nemeth > > --- > > lib/librte_vhost/virtio_net.c | 13 ++++++++----- > > 1 file changed, 8 insertions(+), 5 deletions(-) > > > > diff --git a/lib/librte_vhost/virtio_net.c > b/lib/librte_vhost/virtio_net.c index > > 179c57b46..f091384a6 100644 > > --- a/lib/librte_vhost/virtio_net.c > > +++ b/lib/librte_vhost/virtio_net.c > > @@ -217,6 +217,8 @@ vhost_flush_enqueue_batch_packed(struct > > virtio_net *dev, { > > uint16_t i; > > uint16_t flags; > > + uint16_t last_used_idx = vq->last_used_idx; > > + struct vring_packed_desc *desc_base = &vq- > > >desc_packed[last_used_idx]; > > > > if (vq->shadow_used_idx) { > > do_data_copy_enqueue(dev, vq); > > @@ -226,16 +228,17 @@ vhost_flush_enqueue_batch_packed(struct > > virtio_net *dev, > > flags = PACKED_DESC_ENQUEUE_USED_FLAG(vq- > > >used_wrap_counter); > > > > vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) { > > - vq->desc_packed[vq->last_used_idx + i].id = ids[i]; > > - vq->desc_packed[vq->last_used_idx + i].len = lens[i]; > > + desc_base[i].id = ids[i]; > > + desc_base[i].len = lens[i]; > > } > > > > rte_atomic_thread_fence(__ATOMIC_RELEASE); > > > > - vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) > > - vq->desc_packed[vq->last_used_idx + i].flags = flags; > > + vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) { > > + desc_base[i].flags = flags; > > + } > > > > - vhost_log_cache_used_vring(dev, vq, vq->last_used_idx * > > + vhost_log_cache_used_vring(dev, vq, last_used_idx * > > sizeof(struct vring_packed_desc), > > sizeof(struct vring_packed_desc) * > > PACKED_BATCH_SIZE); > > -- > > 2.30.2 > >