From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 500A4A0096 for ; Tue, 4 Jun 2019 02:04:37 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 63AD81B9A3; Tue, 4 Jun 2019 02:04:36 +0200 (CEST) Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by dpdk.org (Postfix) with ESMTP id 1F6501B9A1 for ; Tue, 4 Jun 2019 02:04:34 +0200 (CEST) Received: by mail-pl1-f195.google.com with SMTP id e5so5845202pls.13 for ; Mon, 03 Jun 2019 17:04:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=yq8SdqfY3PLWaPqrDBhRBbY3VczPS3Dol1lZArs0FbE=; b=0Md2462dZROWSfrMayQrPTvvdicm45cTcuR0++344zTEOrVVwGpqreFAbqy4O3z4xM /lpfdFe+WBe568BxSwTo7+bevcFzcINoI5F9SDLk9a05YerwPKlRcpbk/0d+2k7R0swr Owbv8lvL59lc0PW3q8CD1gB3+/a7U4+EhTmSTocdSKou0HmhR2XZQo26wUDpAMOcFm2W 89M0BaudYC3tvZdHIQmZOsy8SEql8e/9oN5ezGb+PdfLHxmL/SO3C4DGa4S8aen9csHP meT+hfVQqknOhBWhCc/PPRx2xl30d7nPa3F8uG/GezQvVzG5FgsWwkcFQqIab8ktwy5u QMZA== 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:mime-version :content-transfer-encoding; bh=yq8SdqfY3PLWaPqrDBhRBbY3VczPS3Dol1lZArs0FbE=; b=s5zzfN2VdnKviXqAtkvsxX9yiE9owe3baxL1TADJrRv24jmz04cKEnVPLSujHuFZvH SVYRVLSer0N0wRydInUwsbCn2WWNEo06vOCApehTD3qGKDugD9p9iKND0eY473aQySnZ gd8gOF87YVaNbfDVkYa6+2b8sHZspoBfq3DUrE2ntcX+3ciuIBEmXzK6gKBOGmvbf/TC ESbHbq5VT4GxPd1CrB5jNKtO82vszogYYq8OA1VFp9jbTX/tjIwQBKqS24i6pEQ8sXQZ NdrjQbMbG4MJX+ZLllS4BQuUz0afSI9C94XC0cMskySsfKg5X4TJJgN3vztFKtmgmIla 67Ow== X-Gm-Message-State: APjAAAVPesBijlixXatuDwtZPnbrqeE+QtuV6l4Bln6YaSdl0+8CpRyf TS5vMxGPNuYEx24qdtuCHzqe0g== X-Google-Smtp-Source: APXvYqxDLX87d/FtIOw73Bctm4PXfBx1RVI9t6xGmtBQchQUMV3kVJz5ntCRqQmY/L8uedTIA8MEvQ== X-Received: by 2002:a17:902:70c4:: with SMTP id l4mr18449179plt.185.1559606673902; Mon, 03 Jun 2019 17:04:33 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id d5sm12462989pgi.86.2019.06.03.17.04.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Jun 2019 17:04:33 -0700 (PDT) From: Stephen Hemminger To: tomaszx.kulasek@intel.com Cc: dev@dpdk.org, Stephen Hemminger Date: Mon, 3 Jun 2019 17:04:31 -0700 Message-Id: <20190604000431.28763-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] examples/multi_process - fix crash in mp_client with sparse ports X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" From: Stephen Hemminger 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. Fixes: e2366e74e029 ("examples: use buffered Tx") Signed-off-by: Stephen Hemminger --- examples/multi_process/client_server_mp/mp_client/client.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 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 c23dd3f378f7..c1d2d975b717 100644 --- a/examples/multi_process/client_server_mp/mp_client/client.c +++ b/examples/multi_process/client_server_mp/mp_client/client.c @@ -246,15 +246,16 @@ 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, + for (i = 0; i < ports->num_ports; i++) { + uint16_t port = ports->id[i]' + + sent = rte_eth_tx_buffer_flush(ports, client_id, tx_buffer[port]); if (unlikely(sent)) tx_stats->tx[port] += sent; -- 2.20.1