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 7F0FAA0A04; Fri, 15 Jan 2021 15:00:11 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 530F51410F2; Fri, 15 Jan 2021 15:00:11 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mails.dpdk.org (Postfix) with ESMTP id B31F81410E7 for ; Fri, 15 Jan 2021 15:00:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610719209; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=u8u+I2xKju2aYMTr7PYBey3mzgTqMzjvEcazx5QCEXE=; b=e+UJvg7ZdvPwyZC0n+3XTvY+ZfxtAo70SWwH2ghcDluQPrdD/z81kodG+gaBi5lPSEXLS5 psrvRpfC3JW/y+0H6t449IUCMVCQEw4gLDiGGgBE7xzjqd3MxSuREzYz1aob0GOUWu42QU XHZXZjj3paK4lY4B3S6O39qcD1ZQN78= Received: from mail-vs1-f71.google.com (mail-vs1-f71.google.com [209.85.217.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-310-vvY50uUvNzmNKsQz5t3iYw-1; Fri, 15 Jan 2021 09:00:04 -0500 X-MC-Unique: vvY50uUvNzmNKsQz5t3iYw-1 Received: by mail-vs1-f71.google.com with SMTP id g12so1500300vsm.5 for ; Fri, 15 Jan 2021 06:00:04 -0800 (PST) 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:content-transfer-encoding; bh=u8u+I2xKju2aYMTr7PYBey3mzgTqMzjvEcazx5QCEXE=; b=q1RsL8dyxjrGJOHDuFDFZzRdj3BO7gRQS8f79H1iCkoziijuuXmnghzN6m398ejH5Z o1YGHn4A3yzxBEEkfVOhu5U4WKTSxC9Mh+ubuxWxOc8iw4eFlL+hpEsk6V0mROy3/cxF s7rwkJsLow5h2LMo6vqidvaYe8yYd+PRfjXquwFdrBXPhDuPaCS0YlFyGIopJrvpexTJ yqiDffudxGf5wyNwx2twZuvA7PgtUO0d0Og3gRQvyqhK0eG4VJROO3izKSDE9Lh3vErB 2oN+65z9zCOl/8mMPHNF/qloNZTba5R98JUv58/Hbv5g1azwQo7CcGOjg9W1Am3KBp0o kmFw== X-Gm-Message-State: AOAM5337giUDqYtqDP4vxcC6s5IOsgUuG2IDqHla5ZhkSeGGO3emobDg 3MPnSkn1FXS2Os9ZTzU+hfsHwRCa9MIToxNx577nhCZJ6a0MtjdLrgEHdmisASonVjV8G92p7J3 mzinlXRgFn2t/li0c8jk= X-Received: by 2002:a1f:9e83:: with SMTP id h125mr10485657vke.18.1610719204017; Fri, 15 Jan 2021 06:00:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJyO1CEcklWEjjJ9wy0RCAHQ2N8q4Y/gdASyCCXV6hnzHxB1T0ZiUVpuJWscwuTSoRGtd/EiFFC8ahv4O2MT7ng= X-Received: by 2002:a1f:9e83:: with SMTP id h125mr10485646vke.18.1610719203799; Fri, 15 Jan 2021 06:00:03 -0800 (PST) MIME-Version: 1.0 References: <20201104170007.8026-1-olivier.matz@6wind.com> <20210113132734.1636-1-olivier.matz@6wind.com> In-Reply-To: <20210113132734.1636-1-olivier.matz@6wind.com> From: David Marchand Date: Fri, 15 Jan 2021 14:59:52 +0100 Message-ID: To: Olivier Matz , Ali Alnubani Cc: dev , Andrew Rybchenko , "Ananyev, Konstantin" , =?UTF-8?Q?Morten_Br=C3=B8rup?= , ajitkhaparde@gmail.com, dpdk stable , Ajit Khaparde Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH v4] mbuf: fix reset on mbuf free 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" On Wed, Jan 13, 2021 at 2:28 PM Olivier Matz wrote= : > > m->nb_seg must be reset on mbuf free whatever the value of m->next, > because it can happen that m->nb_seg is !=3D 1. For instance in this > case: > > m1 =3D rte_pktmbuf_alloc(mp); > rte_pktmbuf_append(m1, 500); > m2 =3D rte_pktmbuf_alloc(mp); > rte_pktmbuf_append(m2, 500); > rte_pktmbuf_chain(m1, m2); > m0 =3D rte_pktmbuf_alloc(mp); > rte_pktmbuf_append(m0, 500); > rte_pktmbuf_chain(m0, m1); > > As rte_pktmbuf_chain() does not reset nb_seg in the initial m1 > segment (this is not required), after this code the mbuf chain > have 3 segments: > - m0: next=3Dm1, nb_seg=3D3 > - m1: next=3Dm2, nb_seg=3D2 > - m2: next=3DNULL, nb_seg=3D1 > > Then split this chain between m1 and m2, it would result in 2 packets: > - first packet > - m0: next=3Dm1, nb_seg=3D2 > - m1: next=3DNULL, nb_seg=3D2 > - second packet > - m2: next=3DNULL, nb_seg=3D1 > > Freeing the first packet will not restore nb_seg=3D1 in the second > segment. This is an issue because it is expected that mbufs stored > in pool have their nb_seg field set to 1. > > Fixes: 8f094a9ac5d7 ("mbuf: set mbuf fields while in pool") > Cc: stable@dpdk.org > > Signed-off-by: Olivier Matz > Acked-by: Morten Br=C3=B8rup > Acked-by: Ajit Khaparde > Acked-by: Konstantin Ananyev > --- > > v4 > * add a unit test (suggested by David) Olivier, Thanks, for adding it. Ali, You reported some performance regression, did you confirm it? If I get no reply by monday, I'll proceed with this patch. Thanks. --=20 David Marchand