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 9F57D433AC for ; Thu, 23 Nov 2023 17:17:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 99D4B42F73; Thu, 23 Nov 2023 17:17:36 +0100 (CET) Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by mails.dpdk.org (Postfix) with ESMTP id A926B42F21 for ; Thu, 23 Nov 2023 17:17:34 +0100 (CET) Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-40b31232bf0so8058295e9.1 for ; Thu, 23 Nov 2023 08:17:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700756254; x=1701361054; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OBGWzeE+s+yJE87p0X5DznrdSkirkNkbq0/eotNUs68=; b=S4tdDOq86AewCJN/VO/zoMRTN7yP+/3k8P78KKCJK1M8jGWsTodzbsLOfJmFu81RSb B4n5gJllbGsMBZ1a7dZK5Ot7sCmIoB3kCXZr60p2zKylAWEmX0CmnqNyKqEHqYUYnbiz RulTmPFoiPG6pa8clUfXMRbhHjwNemFmVsSIZimO7jBKYP8AgoT490DSCwKYKIc2Yicf tYC6JqqFZA8gH+o4AIyAftghwnvZkKTuqZi6qLWczEuCJTSmaE7dbp6O+pf7r2780f6h ZGaocG9/ob3pjk3X62d4EWm5vY42bbJ6uSiDM5UP5/iwyrtjCkmQuwSFT1NA4ZFPMsVk lgCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700756254; x=1701361054; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OBGWzeE+s+yJE87p0X5DznrdSkirkNkbq0/eotNUs68=; b=JTuOwc+8dL8eL8XG/8CRa6vyj03A72+RSlP7fxz06zHC0vgCjRBa4kJ6OGsPU64szg KhWV68s1QOi7y+pHrBisgeLrl+ipef5LOlzBus5oEg57a3wyeXqnbZ0Qi6XSMFaTgXu1 wDI+mbYMnUnyc5HvSjwJe+gLOAiAuhyWEBbBWABBHfie+NZm4tlByA5UXS0M5gP2GMwI Z6c/fpDUETNFuboipnwuZK0rKCxmBnPnSuAenUyoubRoaU6g+FvA5gjyWofRBLhB2TkD 9P5yUcXFFSS1tf/z04tgoKeWOhtNXG+YsWsoejHHYIonH8XRAfKMbklE5YBSyvPJWCA7 15Dw== X-Gm-Message-State: AOJu0YygOzo9ARpmEuqwlRNM7czLDQzH5ut2DnB6gsilMSJwGmORMEaA siZ/2mF++VLL+8L4cYCDvtExYA9tZa9F4xzj X-Google-Smtp-Source: AGHT+IH7ORVXIjFYOx69hv4NEd96wBY5BYDaln+vSbXSZCQqXjonnWUPMMd0IAg84oDxlswYDQXU/g== X-Received: by 2002:adf:fa0b:0:b0:332:c3bf:600e with SMTP id m11-20020adffa0b000000b00332c3bf600emr2797655wrr.18.1700756254245; Thu, 23 Nov 2023 08:17:34 -0800 (PST) Received: from localhost ([2a01:4b00:d307:1000:f1d3:eb5e:11f4:a7d9]) by smtp.gmail.com with ESMTPSA id o12-20020adfe80c000000b003316b8607cesm2027629wrm.1.2023.11.23.08.17.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 08:17:33 -0800 (PST) From: luca.boccassi@gmail.com To: Huisong Li Cc: Min Hu , Stephen Hemminger , dpdk stable Subject: patch 'examples/ethtool: fix pause configuration' has been queued to stable release 20.11.10 Date: Thu, 23 Nov 2023 16:17:07 +0000 Message-Id: <20231123161709.670852-7-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231123161709.670852-1-luca.boccassi@gmail.com> References: <20231115114515.2355140-16-luca.boccassi@gmail.com> <20231123161709.670852-1-luca.boccassi@gmail.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 20.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 11/25/23. 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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/a6a44fddafd1ae5179f5f00f30195c2b09f063ea Thanks. Luca Boccassi --- >From a6a44fddafd1ae5179f5f00f30195c2b09f063ea Mon Sep 17 00:00:00 2001 From: Huisong Li Date: Fri, 10 Nov 2023 11:30:39 +0800 Subject: [PATCH] examples/ethtool: fix pause configuration [ upstream commit 29cb7cf999bd5b3cb44ec6937529b2b197e7e25f ] Currently, the pause command in ethtool to enable Rx/Tx pause has the following problem. Namely, Assume that the device supports flow control auto-negotiation to set pause parameters, which will the device that does not support flow control auto-negotiation fails to run this command. This patch supports the configuration of flow control auto-negotiation and fixes the print format and style of the pause cmd to make it more readable. Fixes: bda68ab9d1e7 ("examples/ethtool: add user-space ethtool sample application") Signed-off-by: Huisong Li Signed-off-by: Min Hu (Connor) Acked-by: Stephen Hemminger --- examples/ethtool/ethtool-app/ethapp.c | 63 ++++++++++++++++----------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethtool-app/ethapp.c index 36a1c374f4..057fa974bf 100644 --- a/examples/ethtool/ethtool-app/ethapp.c +++ b/examples/ethtool/ethtool-app/ethapp.c @@ -49,6 +49,13 @@ struct pcmd_intintint_params { uint16_t rx; }; +struct pcmd_pause_params { + cmdline_fixed_string_t cmd; + uint16_t port; + cmdline_fixed_string_t mode; + cmdline_fixed_string_t autoneg; + cmdline_fixed_string_t an_status; +}; /* Parameter-less commands */ cmdline_parse_token_string_t pcmd_quit_token_cmd = @@ -116,12 +123,18 @@ cmdline_parse_token_num_t pcmd_intintint_token_rx = /* Pause commands */ cmdline_parse_token_string_t pcmd_pause_token_cmd = - TOKEN_STRING_INITIALIZER(struct pcmd_intstr_params, cmd, "pause"); + TOKEN_STRING_INITIALIZER(struct pcmd_pause_params, cmd, "pause"); cmdline_parse_token_num_t pcmd_pause_token_port = - TOKEN_NUM_INITIALIZER(struct pcmd_intstr_params, port, RTE_UINT16); -cmdline_parse_token_string_t pcmd_pause_token_opt = - TOKEN_STRING_INITIALIZER(struct pcmd_intstr_params, - opt, "all#tx#rx#none"); + TOKEN_NUM_INITIALIZER(struct pcmd_pause_params, port, RTE_UINT16); +cmdline_parse_token_string_t pcmd_pause_token_mode = + TOKEN_STRING_INITIALIZER(struct pcmd_pause_params, + mode, "full#tx#rx#none"); +cmdline_parse_token_string_t pcmd_pause_token_autoneg = + TOKEN_STRING_INITIALIZER(struct pcmd_pause_params, + autoneg, "autoneg"); +cmdline_parse_token_string_t pcmd_pause_token_an_status = + TOKEN_STRING_INITIALIZER(struct pcmd_pause_params, + an_status, "on#off"); /* VLAN commands */ cmdline_parse_token_string_t pcmd_vlan_token_cmd = @@ -348,13 +361,12 @@ pcmd_module_eeprom_callback(void *ptr_params, fclose(fp_eeprom); } - static void pcmd_pause_callback(void *ptr_params, __rte_unused struct cmdline *ctx, void *ptr_data) { - struct pcmd_intstr_params *params = ptr_params; + struct pcmd_pause_params *params = ptr_params; struct ethtool_pauseparam info; int stat; @@ -366,39 +378,38 @@ pcmd_pause_callback(void *ptr_params, stat = rte_ethtool_get_pauseparam(params->port, &info); } else { memset(&info, 0, sizeof(info)); - if (strcasecmp("all", params->opt) == 0) { + if (strcasecmp("full", params->mode) == 0) { info.tx_pause = 1; info.rx_pause = 1; - } else if (strcasecmp("tx", params->opt) == 0) { + } else if (strcasecmp("tx", params->mode) == 0) { info.tx_pause = 1; info.rx_pause = 0; - } else if (strcasecmp("rx", params->opt) == 0) { + } else if (strcasecmp("rx", params->mode) == 0) { info.tx_pause = 0; info.rx_pause = 1; } else { info.tx_pause = 0; info.rx_pause = 0; } - /* Assume auto-negotiation wanted */ - info.autoneg = 1; - stat = rte_ethtool_set_pauseparam(params->port, &info); - } - if (stat == 0) { - if (info.rx_pause && info.tx_pause) - printf("Port %i: Tx & Rx Paused\n", params->port); - else if (info.rx_pause) - printf("Port %i: Rx Paused\n", params->port); - else if (info.tx_pause) - printf("Port %i: Tx Paused\n", params->port); + + if (strcasecmp("on", params->an_status) == 0) + info.autoneg = 1; else - printf("Port %i: Tx & Rx not paused\n", params->port); + info.autoneg = 0; + + stat = rte_ethtool_set_pauseparam(params->port, &info); + } + if (stat == 0) { + printf("Pause parameters for Port %i:\n", params->port); + printf("Rx pause: %s\n", info.rx_pause ? "on" : "off"); + printf("Tx pause: %s\n", info.tx_pause ? "on" : "off"); + printf("Autoneg: %s\n", info.autoneg ? "on" : "off"); } else if (stat == -ENOTSUP) printf("Port %i: Operation not supported\n", params->port); else printf("Port %i: Error %i\n", params->port, stat); } - static void pcmd_open_callback(__rte_unused void *ptr_params, __rte_unused struct cmdline *ctx, @@ -741,11 +752,13 @@ cmdline_parse_inst_t pcmd_pause = { .f = pcmd_pause_callback, .data = NULL, .help_str = - "pause \n Pause/unpause port", + "pause autoneg \n Pause/unpause port", .tokens = { (void *)&pcmd_pause_token_cmd, (void *)&pcmd_pause_token_port, - (void *)&pcmd_pause_token_opt, + (void *)&pcmd_pause_token_mode, + (void *)&pcmd_pause_token_autoneg, + (void *)&pcmd_pause_token_an_status, NULL }, }; -- 2.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-11-23 16:15:19.498504878 +0000 +++ 0007-examples-ethtool-fix-pause-configuration.patch 2023-11-23 16:15:19.215058380 +0000 @@ -1 +1 @@ -From 29cb7cf999bd5b3cb44ec6937529b2b197e7e25f Mon Sep 17 00:00:00 2001 +From a6a44fddafd1ae5179f5f00f30195c2b09f063ea Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 29cb7cf999bd5b3cb44ec6937529b2b197e7e25f ] + @@ -16 +17,0 @@ -Cc: stable@dpdk.org @@ -26 +27 @@ -index 4ea504ed6a..489cd4f515 100644 +index 36a1c374f4..057fa974bf 100644 @@ -29 +30 @@ -@@ -51,6 +51,13 @@ struct pcmd_intintint_params { +@@ -49,6 +49,13 @@ struct pcmd_intintint_params { @@ -43 +44 @@ -@@ -118,12 +125,18 @@ cmdline_parse_token_num_t pcmd_intintint_token_rx = +@@ -116,12 +123,18 @@ cmdline_parse_token_num_t pcmd_intintint_token_rx = @@ -67 +68 @@ -@@ -350,13 +363,12 @@ pcmd_module_eeprom_callback(void *ptr_params, +@@ -348,13 +361,12 @@ pcmd_module_eeprom_callback(void *ptr_params, @@ -82 +83 @@ -@@ -368,39 +380,38 @@ pcmd_pause_callback(void *ptr_params, +@@ -366,39 +378,38 @@ pcmd_pause_callback(void *ptr_params, @@ -137 +138 @@ -@@ -737,11 +748,13 @@ cmdline_parse_inst_t pcmd_pause = { +@@ -741,11 +752,13 @@ cmdline_parse_inst_t pcmd_pause = {