Package init

This commit is contained in:
overweight 2019-09-30 10:38:22 -04:00
commit 7506c3bd33
6 changed files with 366 additions and 0 deletions

View File

@ -0,0 +1,179 @@
From 8fb3b26d62aa31893608ef702d28e1029569ce79 Mon Sep 17 00:00:00 2001
From: Nicholas Nunley <nicholas.d.nunley@intel.com>
Date: Fri, 1 Mar 2019 00:15:28 -0800
Subject: [PATCH 26/39] ethtool: move cmdline_coalesce out of do_scoalesce
Move the definition of cmdline_coalesce out of do_scoalesce and into a
macro so it can be resused across functions.
No behavior change.
Based on patch by Kan Liang <kan.liang@intel.com>
Signed-off-by: Nicholas Nunley <nicholas.d.nunley@intel.com>
Reviewed-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
ethtool.c | 142 ++++++++++++++++++++++++++++++++------------------------------
1 file changed, 74 insertions(+), 68 deletions(-)
diff --git a/ethtool.c b/ethtool.c
index 4ba98bf..25339fb 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -2148,78 +2148,84 @@ static int do_gcoalesce(struct cmd_context *ctx)
return 0;
}
+#define DECLARE_COALESCE_OPTION_VARS() \
+ s32 coal_stats_wanted = -1; \
+ int coal_adaptive_rx_wanted = -1; \
+ int coal_adaptive_tx_wanted = -1; \
+ s32 coal_sample_rate_wanted = -1; \
+ s32 coal_pkt_rate_low_wanted = -1; \
+ s32 coal_pkt_rate_high_wanted = -1; \
+ s32 coal_rx_usec_wanted = -1; \
+ s32 coal_rx_frames_wanted = -1; \
+ s32 coal_rx_usec_irq_wanted = -1; \
+ s32 coal_rx_frames_irq_wanted = -1; \
+ s32 coal_tx_usec_wanted = -1; \
+ s32 coal_tx_frames_wanted = -1; \
+ s32 coal_tx_usec_irq_wanted = -1; \
+ s32 coal_tx_frames_irq_wanted = -1; \
+ s32 coal_rx_usec_low_wanted = -1; \
+ s32 coal_rx_frames_low_wanted = -1; \
+ s32 coal_tx_usec_low_wanted = -1; \
+ s32 coal_tx_frames_low_wanted = -1; \
+ s32 coal_rx_usec_high_wanted = -1; \
+ s32 coal_rx_frames_high_wanted = -1; \
+ s32 coal_tx_usec_high_wanted = -1; \
+ s32 coal_tx_frames_high_wanted = -1
+
+#define COALESCE_CMDLINE_INFO(__ecoal) \
+{ \
+ { "adaptive-rx", CMDL_BOOL, &coal_adaptive_rx_wanted, \
+ &__ecoal.use_adaptive_rx_coalesce }, \
+ { "adaptive-tx", CMDL_BOOL, &coal_adaptive_tx_wanted, \
+ &__ecoal.use_adaptive_tx_coalesce }, \
+ { "sample-interval", CMDL_S32, &coal_sample_rate_wanted, \
+ &__ecoal.rate_sample_interval }, \
+ { "stats-block-usecs", CMDL_S32, &coal_stats_wanted, \
+ &__ecoal.stats_block_coalesce_usecs }, \
+ { "pkt-rate-low", CMDL_S32, &coal_pkt_rate_low_wanted, \
+ &__ecoal.pkt_rate_low }, \
+ { "pkt-rate-high", CMDL_S32, &coal_pkt_rate_high_wanted, \
+ &__ecoal.pkt_rate_high }, \
+ { "rx-usecs", CMDL_S32, &coal_rx_usec_wanted, \
+ &__ecoal.rx_coalesce_usecs }, \
+ { "rx-frames", CMDL_S32, &coal_rx_frames_wanted, \
+ &__ecoal.rx_max_coalesced_frames }, \
+ { "rx-usecs-irq", CMDL_S32, &coal_rx_usec_irq_wanted, \
+ &__ecoal.rx_coalesce_usecs_irq }, \
+ { "rx-frames-irq", CMDL_S32, &coal_rx_frames_irq_wanted, \
+ &__ecoal.rx_max_coalesced_frames_irq }, \
+ { "tx-usecs", CMDL_S32, &coal_tx_usec_wanted, \
+ &__ecoal.tx_coalesce_usecs }, \
+ { "tx-frames", CMDL_S32, &coal_tx_frames_wanted, \
+ &__ecoal.tx_max_coalesced_frames }, \
+ { "tx-usecs-irq", CMDL_S32, &coal_tx_usec_irq_wanted, \
+ &__ecoal.tx_coalesce_usecs_irq }, \
+ { "tx-frames-irq", CMDL_S32, &coal_tx_frames_irq_wanted, \
+ &__ecoal.tx_max_coalesced_frames_irq }, \
+ { "rx-usecs-low", CMDL_S32, &coal_rx_usec_low_wanted, \
+ &__ecoal.rx_coalesce_usecs_low }, \
+ { "rx-frames-low", CMDL_S32, &coal_rx_frames_low_wanted, \
+ &__ecoal.rx_max_coalesced_frames_low }, \
+ { "tx-usecs-low", CMDL_S32, &coal_tx_usec_low_wanted, \
+ &__ecoal.tx_coalesce_usecs_low }, \
+ { "tx-frames-low", CMDL_S32, &coal_tx_frames_low_wanted, \
+ &__ecoal.tx_max_coalesced_frames_low }, \
+ { "rx-usecs-high", CMDL_S32, &coal_rx_usec_high_wanted, \
+ &__ecoal.rx_coalesce_usecs_high }, \
+ { "rx-frames-high", CMDL_S32, &coal_rx_frames_high_wanted, \
+ &__ecoal.rx_max_coalesced_frames_high }, \
+ { "tx-usecs-high", CMDL_S32, &coal_tx_usec_high_wanted, \
+ &__ecoal.tx_coalesce_usecs_high }, \
+ { "tx-frames-high", CMDL_S32, &coal_tx_frames_high_wanted, \
+ &__ecoal.tx_max_coalesced_frames_high }, \
+}
+
static int do_scoalesce(struct cmd_context *ctx)
{
struct ethtool_coalesce ecoal;
int gcoalesce_changed = 0;
- s32 coal_stats_wanted = -1;
- int coal_adaptive_rx_wanted = -1;
- int coal_adaptive_tx_wanted = -1;
- s32 coal_sample_rate_wanted = -1;
- s32 coal_pkt_rate_low_wanted = -1;
- s32 coal_pkt_rate_high_wanted = -1;
- s32 coal_rx_usec_wanted = -1;
- s32 coal_rx_frames_wanted = -1;
- s32 coal_rx_usec_irq_wanted = -1;
- s32 coal_rx_frames_irq_wanted = -1;
- s32 coal_tx_usec_wanted = -1;
- s32 coal_tx_frames_wanted = -1;
- s32 coal_tx_usec_irq_wanted = -1;
- s32 coal_tx_frames_irq_wanted = -1;
- s32 coal_rx_usec_low_wanted = -1;
- s32 coal_rx_frames_low_wanted = -1;
- s32 coal_tx_usec_low_wanted = -1;
- s32 coal_tx_frames_low_wanted = -1;
- s32 coal_rx_usec_high_wanted = -1;
- s32 coal_rx_frames_high_wanted = -1;
- s32 coal_tx_usec_high_wanted = -1;
- s32 coal_tx_frames_high_wanted = -1;
- struct cmdline_info cmdline_coalesce[] = {
- { "adaptive-rx", CMDL_BOOL, &coal_adaptive_rx_wanted,
- &ecoal.use_adaptive_rx_coalesce },
- { "adaptive-tx", CMDL_BOOL, &coal_adaptive_tx_wanted,
- &ecoal.use_adaptive_tx_coalesce },
- { "sample-interval", CMDL_S32, &coal_sample_rate_wanted,
- &ecoal.rate_sample_interval },
- { "stats-block-usecs", CMDL_S32, &coal_stats_wanted,
- &ecoal.stats_block_coalesce_usecs },
- { "pkt-rate-low", CMDL_S32, &coal_pkt_rate_low_wanted,
- &ecoal.pkt_rate_low },
- { "pkt-rate-high", CMDL_S32, &coal_pkt_rate_high_wanted,
- &ecoal.pkt_rate_high },
- { "rx-usecs", CMDL_S32, &coal_rx_usec_wanted,
- &ecoal.rx_coalesce_usecs },
- { "rx-frames", CMDL_S32, &coal_rx_frames_wanted,
- &ecoal.rx_max_coalesced_frames },
- { "rx-usecs-irq", CMDL_S32, &coal_rx_usec_irq_wanted,
- &ecoal.rx_coalesce_usecs_irq },
- { "rx-frames-irq", CMDL_S32, &coal_rx_frames_irq_wanted,
- &ecoal.rx_max_coalesced_frames_irq },
- { "tx-usecs", CMDL_S32, &coal_tx_usec_wanted,
- &ecoal.tx_coalesce_usecs },
- { "tx-frames", CMDL_S32, &coal_tx_frames_wanted,
- &ecoal.tx_max_coalesced_frames },
- { "tx-usecs-irq", CMDL_S32, &coal_tx_usec_irq_wanted,
- &ecoal.tx_coalesce_usecs_irq },
- { "tx-frames-irq", CMDL_S32, &coal_tx_frames_irq_wanted,
- &ecoal.tx_max_coalesced_frames_irq },
- { "rx-usecs-low", CMDL_S32, &coal_rx_usec_low_wanted,
- &ecoal.rx_coalesce_usecs_low },
- { "rx-frames-low", CMDL_S32, &coal_rx_frames_low_wanted,
- &ecoal.rx_max_coalesced_frames_low },
- { "tx-usecs-low", CMDL_S32, &coal_tx_usec_low_wanted,
- &ecoal.tx_coalesce_usecs_low },
- { "tx-frames-low", CMDL_S32, &coal_tx_frames_low_wanted,
- &ecoal.tx_max_coalesced_frames_low },
- { "rx-usecs-high", CMDL_S32, &coal_rx_usec_high_wanted,
- &ecoal.rx_coalesce_usecs_high },
- { "rx-frames-high", CMDL_S32, &coal_rx_frames_high_wanted,
- &ecoal.rx_max_coalesced_frames_high },
- { "tx-usecs-high", CMDL_S32, &coal_tx_usec_high_wanted,
- &ecoal.tx_coalesce_usecs_high },
- { "tx-frames-high", CMDL_S32, &coal_tx_frames_high_wanted,
- &ecoal.tx_max_coalesced_frames_high },
- };
+ DECLARE_COALESCE_OPTION_VARS();
+ struct cmdline_info cmdline_coalesce[] = COALESCE_CMDLINE_INFO(ecoal);
int err, changed = 0;
parse_generic_cmdline(ctx, &gcoalesce_changed,
--
2.7.4

View File

@ -0,0 +1,47 @@
From 66501a7e93decf629ea8cd00a0539653ed7ac7c5 Mon Sep 17 00:00:00 2001
From: Nicholas Nunley <nicholas.d.nunley@intel.com>
Date: Fri, 1 Mar 2019 00:15:32 -0800
Subject: [PATCH 30/39] ethtool: fix up dump_coalesce output to match actual
option names
When the coalesce settings are printed with --show-coalesce a few of the
option names lack the pluralization that is present in the man page and
usage info, but are otherwise identical.
This inconsistency could lead to some confusion if a user attempts to set
the coalesce settings by matching the output they see from --show-coalesce,
so fix this.
Signed-off-by: Nicholas Nunley <nicholas.d.nunley@intel.com>
Reviewed-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
ethtool.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/ethtool.c b/ethtool.c
index d1b82f0..8fbb4bd 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -1420,14 +1420,14 @@ static int dump_coalesce(const struct ethtool_coalesce *ecoal)
"tx-frames-irq: %u\n"
"\n"
"rx-usecs-low: %u\n"
- "rx-frame-low: %u\n"
+ "rx-frames-low: %u\n"
"tx-usecs-low: %u\n"
- "tx-frame-low: %u\n"
+ "tx-frames-low: %u\n"
"\n"
"rx-usecs-high: %u\n"
- "rx-frame-high: %u\n"
+ "rx-frames-high: %u\n"
"tx-usecs-high: %u\n"
- "tx-frame-high: %u\n"
+ "tx-frames-high: %u\n"
"\n",
ecoal->stats_block_coalesce_usecs,
ecoal->rate_sample_interval,
--
2.7.4

View File

@ -0,0 +1,40 @@
From 5da4e23263a21a25cc8615427a6a55b4d38c1e9b Mon Sep 17 00:00:00 2001
From: Michal Kubecek <mkubecek@suse.cz>
Date: Thu, 14 Mar 2019 19:33:16 +0100
Subject: [PATCH 32/39] ethtool: qsfp: fix special value comparison
One of the warnings gcc issues when building ethtool with -Wall seems to
point to an actual problem:
qsfp.c: In function 'sff8636_show_dom':
qsfp.c:709:57: warning: comparison is always false due to limited range of data type [-Wtype-limits]
if ((sd.sfp_temp[MCURR] == 0x0) || (sd.sfp_temp[MCURR] == 0xFFFF))
^~
Rather than writing the special value as -1 which would be a bit confusing,
cast 0xFFFF to __s16.
Fixes: a5e73bb05ee4 ("ethtool:QSFP Plus/QSFP28 Diagnostics Information Support")
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
qsfp.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/qsfp.c b/qsfp.c
index d196aa1..d0774b0 100644
--- a/qsfp.c
+++ b/qsfp.c
@@ -706,7 +706,8 @@ static void sff8636_show_dom(const __u8 *id, __u32 eeprom_len)
* current fields are supported or not. A valid temperature
* reading is used as existence for TX/RX power.
*/
- if ((sd.sfp_temp[MCURR] == 0x0) || (sd.sfp_temp[MCURR] == 0xFFFF))
+ if ((sd.sfp_temp[MCURR] == 0x0) ||
+ (sd.sfp_temp[MCURR] == (__s16)0xFFFF))
return;
printf("\t%-41s : %s\n", "Alarm/warning flags implemented",
--
2.7.4

View File

@ -0,0 +1,49 @@
author Eran Ben Elisha <eranbe@mellanox.com> 2018-10-02 10:24:19 +0300
committer John W. Linville <linville@tuxdriver.com> 2018-10-04 15:02:21 -0400
commit ecdf2952521c8e37bb608bb61384be95bceb68cd (patch)
tree 67f0321651b8493af4bb0ffa9c7a2f83f9e64239
parent 98c148e8651b01561a8fb1ad8201c1d4a6c30d64 (diff)
download ethtool-ecdf2952521c8e37bb608bb61384be95bceb68cd.tar.gz
ethtool: Fix uninitialized variable use at qsfp dump
Struct sff_diags can be used uninitialized at sff8636_show_dom, this
caused the tool to show unreported fields (supports_alarms) by the lower
level driver.
In addition, make sure the same struct is being initialized at
sff8472_parse_eeprom function, to avoid the same issue here.
Fixes: a5e73bb05ee4 ("ethtool:QSFP Plus/QSFP28 Diagnostics Information Support")
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat
-rw-r--r-- qsfp.c 2
-rw-r--r-- sfpdiag.c 2
2 files changed, 2 insertions, 2 deletions
diff --git a/qsfp.c b/qsfp.c
index 32e195d..d196aa1 100644
--- a/qsfp.c
+++ b/qsfp.c
@@ -671,7 +671,7 @@ static void sff8636_dom_parse(const __u8 *id, struct sff_diags *sd)
static void sff8636_show_dom(const __u8 *id, __u32 eeprom_len)
{
- struct sff_diags sd;
+ struct sff_diags sd = {0};
char *rx_power_string = NULL;
char power_string[MAX_DESC_SIZE];
int i;
diff --git a/sfpdiag.c b/sfpdiag.c
index 32e4cd8..fa41651 100644
--- a/sfpdiag.c
+++ b/sfpdiag.c
@@ -241,7 +241,7 @@ static void sff8472_parse_eeprom(const __u8 *id, struct sff_diags *sd)
void sff8472_show_all(const __u8 *id)
{
- struct sff_diags sd;
+ struct sff_diags sd = {0};
char *rx_power_string = NULL;
int i;

BIN
ethtool-4.17.tar.xz Normal file

Binary file not shown.

51
ethtool.spec Normal file
View File

@ -0,0 +1,51 @@
Name: ethtool
Version: 4.17
Release: 4
Epoch: 2
Summary: Query or control network driver and hardware settings
License: GPLv2
URL: https://linux.die.net/man/8/ethtool
Source0: https://mirrors.edge.kernel.org/pub/software/network/ethtool/%{name}-%{version}.tar.xz
BuildRequires: gcc
Patch6000: Fix-uninitialized-variable-use-at-qsfp-dump.patch
Patch6001: 0026-ethtool-move-cmdline_coalesce-out-of-do_scoalesce.patch
Patch6002: 0030-ethtool-fix-up-dump_coalesce-output-to-match-actual-.patch
Patch6003: 0032-ethtool-qsfp-fix-special-value-comparison.patch
%description
Ethtool is used to query and control network device driver and hardware
settings, particularly for wired Ethernet devices.
%package_help
%prep
%autosetup -n %{name}-%{version} -p1
%build
%configure
%make_build
%install
make install DESTDIR=%{buildroot} INSTALL='install -p'
%files
%doc ChangeLog* AUTHORS
%license COPYING LICENSE
%{_sbindir}/ethtool
%files help
%doc README NEWS
%{_mandir}/man8/ethtool.8.gz
%changelog
* Wed Sep 4 2019 openEuler Buildteam <buildteam@openeuler.org> - 2:4.17-4
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:add requires
* Thu Aug 22 2019 openEuler Buildteam <buildteam@openeuler.org> - 2:4.17-3
- Package Init