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 D0908A034C for ; Fri, 25 Feb 2022 18:17:58 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CA1D441148; Fri, 25 Feb 2022 18:17:58 +0100 (CET) Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by mails.dpdk.org (Postfix) with ESMTP id BF34141148 for ; Fri, 25 Feb 2022 18:17:56 +0100 (CET) Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 9DF813F1DD for ; Fri, 25 Feb 2022 17:17:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1645809476; bh=mHIDiXYt9aggNUcpyYZ2kTuA42OgvKvhyYpYsbellFs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=vHHJg/MvjM4M0AajxoC8rWHuQvzVmqZHO2tT6dpLwKG+AF5zS6+Y7JYrBILs9Bm29 PiSX5aszys/ck1ItJPK2urFyf7ebzM6zXv4dbMUcjh7PCqP/phtj0jNt5pIzGVQ+vm NymioVRcftD36Sgzk4zjgCwn25w9+nrUrunpnfAEPe4Qa6Ablhefq4LSWAvAnMB6XL y/JeXfluMVPLMGfeok79HtLhFR2Q+2zYLpfhNL3WtM1rQCROq01FU3whBXh9tKLgs7 jRLE1/bQ+pYCzcW27sW1EQbNXBg8beQ/UuWOA2rwwfGFp6GmCTbe1Y+kQoQMNyiqGe W14iuVrrpCS0g== Received: by mail-wm1-f70.google.com with SMTP id h206-20020a1c21d7000000b003552c13626cso1845810wmh.3 for ; Fri, 25 Feb 2022 09:17:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mHIDiXYt9aggNUcpyYZ2kTuA42OgvKvhyYpYsbellFs=; b=ntYYkwP7+tYaXtnsQgWT9nr2afiwGP9s2G1xzOvOj75C2bVtSbOMBnJ9Mo9APPBMaA Gh34yroU4ZoGE0vf4l1VNefqPCTrt0psOyHJNw/TZ5NS2ukPIoIrxqH5a8Ou2hXsvs2k h70ZVqpKp/YaEeCDkPtZIC0ffAFeiL5DuEYIUX+4ipDSdASOO+XzRhRkINTZBpfTt4Rp QUkTo8QmydNJquIXoZfoPP6ivhExMpBPMzWBN8xmpMOZ0ekGgAwvqxsUTd9hpa+ssatu 7xjjfSteIzNTT+61ftHI/8wx573C4GzQacJ0TPwfGCB7v9SEiUd6lBkkrZKMruk/DM5A Ih/w== X-Gm-Message-State: AOAM530LFeQ/ORGk+u19mfg8lQtsNyjnt8RcG5+kxq3aG6KqC7CjjQtZ 0lmyVWHfYctRbqIZkpQzq38tT6o9Up37XJyMTuy54BvbG0InuJJTCpk0qfT1N2z/Q24Ys5pY6pE l2diS2IaFtzx69b6WaT7Bxc+p X-Received: by 2002:adf:fd87:0:b0:1ed:e0c3:a2d4 with SMTP id d7-20020adffd87000000b001ede0c3a2d4mr6792270wrr.374.1645809475878; Fri, 25 Feb 2022 09:17:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJw0F3ScKa/3YVKGMB/sMbCMo6PvXRASMHWq2G8EGW0nxIZIAyd7uB324a3VuhnfHWLu+ajGNA== X-Received: by 2002:adf:fd87:0:b0:1ed:e0c3:a2d4 with SMTP id d7-20020adffd87000000b001ede0c3a2d4mr6792252wrr.374.1645809475609; Fri, 25 Feb 2022 09:17:55 -0800 (PST) Received: from Keschdeichel.fritz.box (068-133-067-156.ip-addr.inexio.net. [156.67.133.68]) by smtp.gmail.com with ESMTPSA id p18-20020adfba92000000b001e4ae791663sm2899611wrg.62.2022.02.25.09.17.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Feb 2022 09:17:55 -0800 (PST) From: christian.ehrhardt@canonical.com To: "Min Hu (Connor)" Cc: Ferruh Yigit , dpdk stable Subject: patch 'app/testpmd: fix bonding mode set' has been queued to stable release 19.11.12 Date: Fri, 25 Feb 2022 18:15:36 +0100 Message-Id: <20220225171550.3499040-43-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.35.0 In-Reply-To: <20220225171550.3499040-1-christian.ehrhardt@canonical.com> References: <20220225171550.3499040-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Hi, FYI, your patch has been queued to stable release 19.11.12 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/27/22. 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. Queued patches are on a temporary branch at: https://github.com/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/81decddb44d9da3a9d3571e26008b80408b62375 Thanks. Christian Ehrhardt --- >From 81decddb44d9da3a9d3571e26008b80408b62375 Mon Sep 17 00:00:00 2001 From: "Min Hu (Connor)" Date: Fri, 28 Jan 2022 10:35:19 +0800 Subject: [PATCH] app/testpmd: fix bonding mode set [ upstream commit 39ddd5d1895e72ba2bc974eddbc12a3135639ed1 ] when start testpmd, and type command like this, it will lead to Segmentation fault, like: testpmd> create bonded device 4 0 testpmd> add bonding slave 0 2 testpmd> add bonding slave 1 2 testpmd> port start 2 testpmd> set bonding mode 0 2 testpmd> quit Stopping port 0... Stopping ports... ... Bye... Segmentation fault The reason to the bug is that rte timer do not be cancelled when quit. That is, in 'bond_ethdev_start', resources are allocated according to different bonding mode. In 'bond_ethdev_stop', resources are free by the corresponding mode. For example, 'bond_ethdev_start' start bond_mode_8023ad_ext_periodic_cb timer for bonding mode 4. and 'bond_ethdev_stop' cancel the timer only when the current bonding mode is 4. If the bonding mode is changed, and directly quit the process, the timer will still on, and freed memory will be accessed, then segmentation fault. 'bonding mode' changed means resources changed, reallocate resources for different mode should be done, that is, device should be restarted. Fixes: 2950a769315e ("bond: testpmd support") Signed-off-by: Min Hu (Connor) Tested-by: Ferruh Yigit --- app/test-pmd/cmdline.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 1e44a998fc..a3b991ea1b 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -5672,6 +5672,19 @@ static void cmd_set_bonding_mode_parsed(void *parsed_result, { struct cmd_set_bonding_mode_result *res = parsed_result; portid_t port_id = res->port_id; + struct rte_port *port = &ports[port_id]; + + /* + * Bonding mode changed means resources of device changed, like whether + * started rte timer or not. Device should be restarted when resources + * of device changed. + */ + if (port->port_status != RTE_PORT_STOPPED) { + fprintf(stderr, + "\t Error: Can't set bonding mode when port %d is not stopped\n", + port_id); + return; + } /* Set the bonding mode for the relevant port. */ if (0 != rte_eth_bond_mode_set(port_id, res->value)) -- 2.35.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-02-25 16:58:45.890479958 +0100 +++ 0043-app-testpmd-fix-bonding-mode-set.patch 2022-02-25 16:58:44.288990455 +0100 @@ -1 +1 @@ -From 39ddd5d1895e72ba2bc974eddbc12a3135639ed1 Mon Sep 17 00:00:00 2001 +From 81decddb44d9da3a9d3571e26008b80408b62375 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 39ddd5d1895e72ba2bc974eddbc12a3135639ed1 ] + @@ -36 +37,0 @@ -Cc: stable@dpdk.org @@ -45 +46 @@ -index e626b1c7d9..16ad4be005 100644 +index 1e44a998fc..a3b991ea1b 100644 @@ -48 +49 @@ -@@ -5915,6 +5915,19 @@ static void cmd_set_bonding_mode_parsed(void *parsed_result, +@@ -5672,6 +5672,19 @@ static void cmd_set_bonding_mode_parsed(void *parsed_result,