From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 90BD6A04F5 for ; Wed, 11 Dec 2019 22:29:02 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 86A531D9E; Wed, 11 Dec 2019 22:29:02 +0100 (CET) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id 5BA582BD3 for ; Wed, 11 Dec 2019 22:29:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576099740; 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=VOQyRF17X8je9w2K+JePo1DNuljarkGyRZYAvVrQzbs=; b=Kvzqg5Oxu87THtZfvMWh+BeUk1TzumPcXZyLgyxPshZv/GH28g12gr7n3gb2tvr9HW0OK1 6GSDtCJRMXs9MV8i2fbVWIBcVXofRRjr2msO6Oj93gxCyATCuN+DtyPAi1EPe20DF1dgzk LwSxTJuqeUFYXSGy1LuNkeWWLGkEXrU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-276-dT9obZImMIyKsau_2P41MA-1; Wed, 11 Dec 2019 16:28:58 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E85541800D45; Wed, 11 Dec 2019 21:28:57 +0000 (UTC) Received: from rh.redhat.com (ovpn-116-64.ams2.redhat.com [10.36.116.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF20210013A1; Wed, 11 Dec 2019 21:28:56 +0000 (UTC) From: Kevin Traynor To: Stephen Hemminger Cc: Matan Azrad , dpdk stable Date: Wed, 11 Dec 2019 21:26:41 +0000 Message-Id: <20191211212702.27851-49-ktraynor@redhat.com> In-Reply-To: <20191211212702.27851-1-ktraynor@redhat.com> References: <20191211212702.27851-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: dT9obZImMIyKsau_2P41MA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Subject: [dpdk-stable] patch 'examples/multi_process: fix client crash with sparse ports' has been queued to LTS release 18.11.6 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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" Hi, FYI, your patch has been queued to LTS release 18.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 12/17/19. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasi= ng (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/f35ffead0d136ca6f7= bea1a1d90095931ffab707 Thanks. Kevin. --- >From f35ffead0d136ca6f7bea1a1d90095931ffab707 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 5 Aug 2019 09:38:17 -0700 Subject: [PATCH] examples/multi_process: fix client crash with sparse ports [ upstream commit 6b124806a3181855fed969d0ad8520831ae0d7e2 ] The mp_client crashes if run on Azure or any system where ethdev ports are owned. In that case, the tx_buffer and tx_stats for the real port were initialized correctly, but the wrong port was used. For example if the server has Ports 3 and 5. Then calling rte_eth_tx_buffer_flush on any other buffer will dereference null because the tx buffer for that port was not allocated. Also: - the flush code is common enough that it should not be marked unlikely - combine conditions to reduce indentation - avoid unnecessary if() if sent is zero. Fixes: e2366e74e029 ("examples: use buffered Tx") Signed-off-by: Stephen Hemminger Acked-by: Matan Azrad --- .../client_server_mp/mp_client/client.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/multi_process/client_server_mp/mp_client/client.c b/e= xamples/multi_process/client_server_mp/mp_client/client.c index c23dd3f37..361d90b54 100644 --- a/examples/multi_process/client_server_mp/mp_client/client.c +++ b/examples/multi_process/client_server_mp/mp_client/client.c @@ -247,17 +247,17 @@ main(int argc, char *argv[]) =09for (;;) { =09=09uint16_t i, rx_pkts; -=09=09uint16_t port; =20 =09=09rx_pkts =3D rte_ring_dequeue_burst(rx_ring, pkts, =09=09=09=09PKT_READ_SIZE, NULL); =20 -=09=09if (unlikely(rx_pkts =3D=3D 0)){ -=09=09=09if (need_flush) -=09=09=09=09for (port =3D 0; port < ports->num_ports; port++) { -=09=09=09=09=09sent =3D rte_eth_tx_buffer_flush(ports->id[port], client_id= , -=09=09=09=09=09=09=09tx_buffer[port]); -=09=09=09=09=09if (unlikely(sent)) -=09=09=09=09=09=09tx_stats->tx[port] +=3D sent; -=09=09=09=09} +=09=09if (rx_pkts =3D=3D 0 && need_flush) { +=09=09=09for (i =3D 0; i < ports->num_ports; i++) { +=09=09=09=09uint16_t port =3D ports->id[i]; + +=09=09=09=09sent =3D rte_eth_tx_buffer_flush(port, +=09=09=09=09=09=09=09 client_id, +=09=09=09=09=09=09=09 tx_buffer[port]); +=09=09=09=09tx_stats->tx[port] +=3D sent; +=09=09=09} =09=09=09need_flush =3D 0; =09=09=09continue; --=20 2.21.0 --- Diff of the applied patch vs upstream commit (please double-check if non-= empty: --- --- -=092019-12-11 21:24:16.579724700 +0000 +++ 0049-examples-multi_process-fix-client-crash-with-sparse-.patch=092019-= 12-11 21:24:12.708650370 +0000 @@ -1 +1 @@ -From 6b124806a3181855fed969d0ad8520831ae0d7e2 Mon Sep 17 00:00:00 2001 +From f35ffead0d136ca6f7bea1a1d90095931ffab707 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 6b124806a3181855fed969d0ad8520831ae0d7e2 ] + @@ -21 +22,0 @@ -Cc: stable@dpdk.org