From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0052.outbound.protection.outlook.com [104.47.2.52]) by dpdk.org (Postfix) with ESMTP id E35852BA7; Thu, 3 May 2018 12:32:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ITNv6pg7VwRBobaYf/uDy1WMckI2RwA1yjtMcZONAys=; b=kUeDL3rM98ZXWev6Lzki+Uc/zO4JycUkMSCSMx5D/2yM5zGwRKYTQW/d2+tP1jLgFb5Xp7xbH5VrAc1DuH4eZUvvAh7U9cAaqtiC9Gs3lwmWHISJPEfD7j+GcikurxOekRiPtk0KAOgQjqNWBNQhQXR7iJy6RdGdT2Sw0RWLfs4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by HE1PR0501MB2665.eurprd05.prod.outlook.com (2603:10a6:3:cb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.715.22; Thu, 3 May 2018 10:32:11 +0000 From: Matan Azrad To: Wenzhuo Lu , Jingjing Wu Cc: dev@dpdk.org, stable@dpdk.org Date: Thu, 3 May 2018 10:31:44 +0000 Message-Id: <1525343508-29487-3-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.9.5 In-Reply-To: <1525343508-29487-1-git-send-email-matan@mellanox.com> References: <1525343508-29487-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: HE1PR08CA0058.eurprd08.prod.outlook.com (2603:10a6:7:2a::29) To HE1PR0501MB2665.eurprd05.prod.outlook.com (2603:10a6:3:cb::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:HE1PR0501MB2665; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2665; 3:Dc2yvcY1QnMOdmSMhKsvhW/YOiEamUV6D1pTlO2DQjm8MQUdA5+iDlHqVa2OY/qIJ4lZeJLFH9cyhAjUpwP2X+g/e7CJsd3DzJ7vGvtvY0axEc7u9cFWD1urIgwE3csmjmhhnnZqnytNYX0p7uHIvCxuwcidqVnVQjTmlgtbne7a5zOXCZWSpjFMpwFNd/suaKETms9uFZ/2cIxyKQIkTmpSRfcz8BxfNCBHDAkjbsJwmyRxE/hZxy/wKN64FWLD; 25:BRKt9miV9kadIRe8gUgt1+3eHYlkMrANHJNYa3DsNaCkocmwFurVy06E3LqrSrqNeOwfk88e4cCzJt3FlAvQ8OOAmmK3KCPCgG+Kg9SpDpdFgL9F5+7WNxHSQxxD3aW495KKboYJoE7p9Dq/BYeLRcEpBrHcmXlaX8nLhT3ebC0kTn14kqj+B7ai8yJF3RNqIq1pwhMpgbYtPTgaoC5RSmU5/M7+RJCS3ktRJj6ajDTdJRADZG22/QigpZk3Q1EdiAv44eWdv406/VyjRBlhLcfDmDS5wmq84fOdMpH6YBQ8HB/M2P0oMc+AkHKizIiK8hfkEWkID/SGYaG8ApgHww==; 31:/hz7R1+3jJ55APCtimRTVcA+Tse/t9GKNknGIlHdD5/coMnWuOAnyaa0cqxx4h00PGuIDEeub6B4mRJQKh30PKCnwCDNavjI1OrHgkG0DxzuT7wdVe/yEXbj9YENLMG9MqH1xKx+beUUbpeN65eMj8j9/f6whaufKPXB65knNTZ3TgiQIZsPDinTrF8owV7rMpeUo3+TJ7yJRQE91h0o1QrIC7/xoqKW7dNQ7ioyEnw= X-MS-TrafficTypeDiagnostic: HE1PR0501MB2665: X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2665; 20:7xtoU+GFqow7elEdJ9OgjPelZXTt/3N9mYlalkWC8hm7H7WnLsd6eODzpZtq0Fw/n5d3HvceeXD0chP1dBZLIN0izM/QOfU2Rj/xDr1K9ketuzlA+nh9De9UzrETwk21wnpus0rAn920XjRacohTJcaxod07eQl2mxl07dfhK6E3dQfBFe7Zg+wMt7SmwhGv/c9mqCPboWk69KMCtxvQsNK+TIaImR+L7DTLN5FIsaOMOWKQZ+/vjxmLI5u1CzMIGH3bTosFL/8pifgbnPrV4OltjpkisP68QOl/LMNkck9Ov4y4IAN/NMbNmiKX4uBMZaEX70D7hwd6flljL5uHgzUoTm+xS6PUmKiIcRsrqp1oGJthN2QjteNhcp6O0HdCGRYS2SaJAEwReugVIN92Eib63SKh884T/PmFhoeJ6PIoe6cIYxoZdzAlhaT8xSaHCFY+mkuzGOqPXSG6cNxbyjdqNGR43xvgDrgCd3gmC4Ei0L6gYSad8F64eVWLMU//; 4:wh3AgG/rS7GONb6rbfLMl04u02MqH72IDLeW4qiPMNRKIu290J5Rw4FFshBZsLT3t4XpRzvX0cjBJy69DNitwFbOjvaKXMlpcd/2HKc9uWxqiWwP6tfR3YC4Kd1uqLDvzDnmEGvhgKu/rP65hnDiCaJ00EThQtxZNVQ7TwDxWpYqAdlliHuj4YToAu5NXerdtl07xFLmD8A34l6PmFGxENv9kNxDmk/PCqQB6OvVcInp5C9R1hBW0BovQUovvFiQssQgCTPWAzju0wck/p2EVg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231254)(944501410)(52105095)(93006095)(93001095)(10201501046)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:HE1PR0501MB2665; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0501MB2665; X-Forefront-PRVS: 066153096A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(346002)(376002)(39380400002)(39860400002)(396003)(189003)(199004)(97736004)(47776003)(316002)(52116002)(51416003)(36756003)(7696005)(86362001)(25786009)(16586007)(110136005)(68736007)(5660300001)(2906002)(8676002)(81166006)(81156014)(8936002)(66066001)(53936002)(3846002)(6666003)(26005)(305945005)(33026002)(11346002)(69596002)(186003)(106356001)(386003)(50226002)(486006)(55016002)(105586002)(4326008)(6116002)(7736002)(76176011)(446003)(478600001)(476003)(21086003)(59450400001)(48376002)(50466002)(2616005)(956004)(16526019); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0501MB2665; H:mellanox.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0501MB2665; 23:tOP3oOz3L6E5DCHIg3Q3Qoo31eRNOiaPtHhSK9L?= =?us-ascii?Q?19DysDqTAX0fqA1spLhiH3KJAPHzqMFIiMh7gD2qIr7fPZTUSz/ly9JvHIz0?= =?us-ascii?Q?nC72lHgtJdH2s7chj1UXaECAUbCOdDjfv1sLuT55/+fw2mEw3pQCqoQ5/lgN?= =?us-ascii?Q?u1PKQKnnqRHE13X7gLNjS/oCEjxUyWY6B9fsMK2M9XdnZjZf8xYfkGIn6P6x?= =?us-ascii?Q?O8LNMP9zdfejQm24nD2tzAk2mGm5rIU8Ncupsps/e8HeALyJ241X26k0QYW3?= =?us-ascii?Q?wvmXD2KHSrZwUvjyjprXftE8/TvVFqZxL0Fu7dXtzBgyRl7Jpm2ubmeznB4i?= =?us-ascii?Q?fD2t+5+baB+MIJ34zJX2lFUeygv1P2gTaCMZbVvWeKlhzk9008DZUEuPurkR?= =?us-ascii?Q?85UHl+pu0H6ckZy8HSY724+Ai2VXjPG1mNkce2IxkLWjr8jfuyip0qtBOkJb?= =?us-ascii?Q?+cFBYrZZ/8C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az9MDctvWe36u0xVhpQHCb7DNnYBv1w7Ga1ZX0NhGKQnLOhDvevDh6OHx3LQ6AfkKDJ0aOHEq/u9m0hum2cWSal79Ot/vjjHLNOlOWPR X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2665; 6:oTHl7wbhCRxgglTWwg5aTYO0NqaN+zfjc6FqxdbiHFxLI7f2GhwVvuEpMxMgI7GEy7xjRt7KCPIg9V/RqlopEayyfGxeafnF0ojTE6J3KJDnHn0qaSm/FIJ6jzu974IsB13AZCYaMjIrQWiWHaIgX26PIxiN2MI2UPZAI1N4bXrDKoBA4BzJuQs58fI41R3hh0D/ov60pPS5gLfpc0rPMbtjMFvvxulFy0oCL5GFWyzUyNYEzt7mcen6p0J4YRVEeEJCwq1SZMyNl4yQii6R1kl1/0zrgypxHEX+wQVLVldv2pdkfFBip5ha5oqhkGxkH48y5t//3shG9N1aKTj5ijzkvhCB6uF8JfrcR/rZFyHByAcwU1D3jUmTX+jj3xBxJWzPMe75v0CftXgqc5ZJDaxA+v6pu5HWXdCgA1qqFPTYAfRa47mSmzyZWSVmuKKLr10nY6RfXc6KMC3m0MyX1g==; 5:5HCsrQ/ItV7YBubevOlFHV3pHj12Dp/C6+ha3C8HghTgDmG2XHUzWJqrNg15dp5pAgpp7f822IedYPb+ub9vgM91Z7uEiKaKHcFlpi/JOJDZFb8qdWWpF4VZjJvpGomG0IsG/5koTyHbx0eEbwkiB3LdHYnABOifl0euybyjzHg=; 24:lxmjglakoeg0WWhBxl3T7DIlIpY7Ct3KHAIonv/vOqGRMYyeLlI4kRtliTPQ9UF9X4CfKkfqU7JrN8KsKDjQWeSDqw/V8TsUSJ5Q9DkDFH0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2665; 7:zSDEpokTOYTI0lROb7wRWOtjOisePhemky/oZc408z3wuNxogm04J/gQw0KTLjWlLUvt7qeYnWYEgpy11W0PnQHKmUV01l4KyuwsbSrUAiSUBI6jqFrOcHx6jvraUyP6FDIci4NDsWshQZvLaNIzmQGdYiLLuZpukEATeb/9o9eKSFUmV1KOSohCTLiKcEvkGGcQVgskcXdv6E87Y8Vn9NNCRyEQM7LkXf8GXGJtHlUiK9TIhuiqCfry+nq3wDgA X-MS-Office365-Filtering-Correlation-Id: afb12e32-8c73-4a41-2855-08d5b0e121ef X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2018 10:32:11.8432 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: afb12e32-8c73-4a41-2855-08d5b0e121ef X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0501MB2665 Subject: [dpdk-dev] [PATCH 2/6] app/testpmd: fix forward ports update 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: , X-List-Received-Date: Thu, 03 May 2018 10:32:14 -0000 When the forward ports are changed either by new portlist\portmask configurations or by a port detachment, all the old forward streams are freed and new streams are allocated to be aligned with the new forward ports. If the number of the forward ports drops to 0, there is an attempt to wrongly allocate 0 memory for the streams. Skip the streams memory allocation if no forward ports are configured. Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings") Cc: stable@dpdk.org Signed-off-by: Matan Azrad --- app/test-pmd/testpmd.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index db23f23..8ac2070 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -882,18 +882,23 @@ static void eth_dev_event_callback(char *device_name, /* init new */ nb_fwd_streams = nb_fwd_streams_new; - fwd_streams = rte_zmalloc("testpmd: fwd_streams", - sizeof(struct fwd_stream *) * nb_fwd_streams, RTE_CACHE_LINE_SIZE); - if (fwd_streams == NULL) - rte_exit(EXIT_FAILURE, "rte_zmalloc(%d (struct fwd_stream *)) " - "failed\n", nb_fwd_streams); - - for (sm_id = 0; sm_id < nb_fwd_streams; sm_id++) { - fwd_streams[sm_id] = rte_zmalloc("testpmd: struct fwd_stream", - sizeof(struct fwd_stream), RTE_CACHE_LINE_SIZE); - if (fwd_streams[sm_id] == NULL) - rte_exit(EXIT_FAILURE, "rte_zmalloc(struct fwd_stream)" - " failed\n"); + if (nb_fwd_streams) { + fwd_streams = rte_zmalloc("testpmd: fwd_streams", + sizeof(struct fwd_stream *) * nb_fwd_streams, + RTE_CACHE_LINE_SIZE); + if (fwd_streams == NULL) + rte_exit(EXIT_FAILURE, "rte_zmalloc(%d" + " (struct fwd_stream *)) failed\n", + nb_fwd_streams); + + for (sm_id = 0; sm_id < nb_fwd_streams; sm_id++) { + fwd_streams[sm_id] = rte_zmalloc("testpmd:" + " struct fwd_stream", sizeof(struct fwd_stream), + RTE_CACHE_LINE_SIZE); + if (fwd_streams[sm_id] == NULL) + rte_exit(EXIT_FAILURE, "rte_zmalloc" + "(struct fwd_stream) failed\n"); + } } return 0; -- 1.9.5