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 ACDADA0A04 for ; Fri, 15 Jan 2021 15:00:12 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8A4F41410F8; Fri, 15 Jan 2021 15:00:12 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id C3F8C1410F2 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-131-sFofwbfdNe6UOZ7a0rghsA-1; Fri, 15 Jan 2021 09:00:04 -0500 X-MC-Unique: sFofwbfdNe6UOZ7a0rghsA-1 Received: by mail-vs1-f71.google.com with SMTP id y186so840680vsc.2 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=hv9BP6esuyQ+tOen0en/WmYBGot2TS/p3ybseZus4uCcIHBKxiNAe1zIEmMhyi+XLU Q1ExTDCNao33W1OS8WOYZMd/+Lc40ZhL44vsRiWFu0RWIcS82nCmgGJkzeUeugh+kdIm uwI+3bd9cHoLXbA9ijvFWoJ1WD3FF+mbL1IFsFx6HxRWsoh1eLAoGVe4ENq+9jT+jHBq 8yCAN0brnQzbHwcdV1oj8ht1jZzVCe4uFihK7GRbcQxeA2bLzLPIHL3moqqUmsTt6Uy/ 2vcu/1E65zOS4+nCqW2eq0mlbPIFDPyXhZBSd5vdEHlcDTKwBMo1MLWPIsct1RiVCXFe vq0w== X-Gm-Message-State: AOAM5335Qa1c4u2gex7ry+spna6yXk1PANdUSTai8+6KedGJ3+5NZAfk HBELACrLt3xn/sf4aCNsu+iRNNC5TyD63YOp0kn9KYCKM2nv/17t0R382ERQik/kvqTqrspD06l OM+6Lk/reWdizTFvLEYGT1yo= X-Received: by 2002:a1f:9e83:: with SMTP id h125mr10485658vke.18.1610719204018; 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-stable] [PATCH v4] mbuf: fix reset on mbuf free 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 Sender: "stable" 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