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 373C0A04F0 for ; Thu, 19 Dec 2019 15:42:02 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2BF071C01F; Thu, 19 Dec 2019 15:42:02 +0100 (CET) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by dpdk.org (Postfix) with ESMTP id AEBF51C02A for ; Thu, 19 Dec 2019 15:41:59 +0100 (CET) Received: by mail-wr1-f66.google.com with SMTP id q10so6214641wrm.11 for ; Thu, 19 Dec 2019 06:41:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ozyr39g7fnpOfqA0QjRhCggTtGG5G/ti8LD4F8z5r3s=; b=s+uzS+ns2l3pXdwv3A6li4Kdq01lBds8EKwglv70TdIrxQvRPvB/NNAX5ah0PC8BEC et4icWzLsBP3V16XHJzb4vY5s2ysR/v2lkntxBI/Z0e79EMV9S5o5x649zJGlbbanoG5 zXVbNQVwj4pWp9e5dC+UH1yJBXAY9ACLEO4dT7RIWm5ytbOqVOx3woA7SEx/Xuawodgb 2VOt8+56LuDcTRjbYf6eg3vUVmFMddif3AWfoGQVSN2ASU/ffgwt8UXafzLXr4Z3wNKc BknfdwlF36LxIiGHfWgaO242VkJL8KOlRXSev/tYBpsBJ/nqqOAKH6BBukJGmGs81vWr OprA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ozyr39g7fnpOfqA0QjRhCggTtGG5G/ti8LD4F8z5r3s=; b=qy/kY188jocC95FZ0NQGEXd9uJzQK/fhBQeKUHBM5oO4S1whgcfH6ejlDjKepwBsij 58dow0N914QBqzdYFp9qkqCtTcmEApk3rwTgHMlQvu28GC7snAj7q5bhXn96/B1E38D0 9nyzhmrPYE9oVPZ5SEl0ARFGzefVyuGanC9ahX/v6P/ZE9RUR94zcOpv5w34ftSMfcnZ 7Iewm/oBYCs//sDMT4XdN8BE8nVsEI6qbOWTcJgQ3ClPjQCC0VmklCuP+Hp3HxRdqJ7y XseoezVUz1qcntH02/aGvkJyiDLl83r1nqwl7E3BtXOylE+zTu4eQi1YGJemsQl0KGUQ I/Nw== X-Gm-Message-State: APjAAAW+XXZxLN1DGVVTQbv0AG0y+w07NnnBZpqQJFfYaPWXk88YnlND +V6fVwN1YiH7ELY1dFfZBYQ= X-Google-Smtp-Source: APXvYqzUKPfj8BT0JldOk7diMClGPvFVFF4Lrx4p4EPOKMexs82ItTODewyBT1ojWeafk+q4LdmpAw== X-Received: by 2002:adf:f288:: with SMTP id k8mr10408842wro.301.1576766519406; Thu, 19 Dec 2019 06:41:59 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id g9sm7072355wro.67.2019.12.19.06.41.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 06:41:58 -0800 (PST) From: luca.boccassi@gmail.com To: Stephen Hemminger Cc: Matan Azrad , dpdk stable Date: Thu, 19 Dec 2019 14:34:38 +0000 Message-Id: <20191219143447.21506-131-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191219143447.21506-1-luca.boccassi@gmail.com> References: <20191219143447.21506-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'examples/multi_process: fix client crash with sparse ports' has been queued to LTS release 17.11.10 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 17.11.10 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/21/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 rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From d8b5e014364d4baf67424236cd7575caf793ee32 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/examples/multi_process/client_server_mp/mp_client/client.c index 30ce4b34c8..a9076d1e0b 100644 --- a/examples/multi_process/client_server_mp/mp_client/client.c +++ b/examples/multi_process/client_server_mp/mp_client/client.c @@ -275,19 +275,19 @@ main(int argc, char *argv[]) for (;;) { uint16_t i, rx_pkts; - uint16_t port; rx_pkts = rte_ring_dequeue_burst(rx_ring, pkts, PKT_READ_SIZE, NULL); - if (unlikely(rx_pkts == 0)){ - if (need_flush) - for (port = 0; port < ports->num_ports; port++) { - sent = rte_eth_tx_buffer_flush(ports->id[port], client_id, - tx_buffer[port]); - if (unlikely(sent)) - tx_stats->tx[port] += sent; - } + if (rx_pkts == 0 && need_flush) { + for (i = 0; i < ports->num_ports; i++) { + uint16_t port = ports->id[i]; + + sent = rte_eth_tx_buffer_flush(port, + client_id, + tx_buffer[port]); + tx_stats->tx[port] += sent; + } need_flush = 0; continue; } -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-12-19 14:32:31.530834635 +0000 +++ 0131-examples-multi_process-fix-client-crash-with-sparse-.patch 2019-12-19 14:32:26.337302426 +0000 @@ -1,8 +1,10 @@ -From 6b124806a3181855fed969d0ad8520831ae0d7e2 Mon Sep 17 00:00:00 2001 +From d8b5e014364d4baf67424236cd7575caf793ee32 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. @@ -18,7 +20,6 @@ - avoid unnecessary if() if sent is zero. Fixes: e2366e74e029 ("examples: use buffered Tx") -Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger Acked-by: Matan Azrad @@ -27,10 +28,10 @@ 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/multi_process/client_server_mp/mp_client/client.c b/examples/multi_process/client_server_mp/mp_client/client.c -index c23dd3f378..361d90b54b 100644 +index 30ce4b34c8..a9076d1e0b 100644 --- a/examples/multi_process/client_server_mp/mp_client/client.c +++ b/examples/multi_process/client_server_mp/mp_client/client.c -@@ -246,19 +246,19 @@ main(int argc, char *argv[]) +@@ -275,19 +275,19 @@ main(int argc, char *argv[]) for (;;) { uint16_t i, rx_pkts;