Rebase mstflint to latest upstream release v4.11.0-4

Signed-off-by: Honggang Li <honli@redhat.com>
This commit is contained in:
Honggang Li 2019-04-16 00:20:42 -04:00
parent 4d9bba1983
commit eed048ad9e
7 changed files with 15 additions and 342 deletions

1
.gitignore vendored
View File

@ -25,3 +25,4 @@ noarch/
/mstflint-4.10.0.tar.gz /mstflint-4.10.0.tar.gz
/mstflint-4.11.0-2.tar.gz /mstflint-4.11.0-2.tar.gz
/mstflint-4.11.0-3.tar.gz /mstflint-4.11.0-3.tar.gz
/mstflint-4.11.0-4.tar.gz

View File

@ -1,119 +0,0 @@
From f355d4902890e5b4db15b87903a299697764bc8a Mon Sep 17 00:00:00 2001
From: Honggang Li <honli@redhat.com>
Date: Fri, 8 Feb 2019 21:26:39 -0500
Subject: [PATCH] Fix shebang for python scripts
rhel-8 does not support python2. User '#!/usr/bin/python3' for all
python scripts which with a shebang.
The substitution was done with following bash script.
====
pys=$(find . -type f -name '*.py')
for f in $pys; do
sed -ne '1p' $f | grep -q -E '^#!/usr/bin'
if [ $? -eq 0 ]; then
echo $f
sed -e '/^#!\/usr\/bin/d' -i $f
sed -e '1 i\#!/usr/bin/python3' -i $f
fi
done
===
Signed-off-by: Honggang Li <honli@redhat.com>
---
mtcr_py/test.py | 2 +-
small_utils/mlxfwresetlib/mcra.py | 2 +-
small_utils/mlxfwresetlib/mlnx_peripheral_components.py | 2 +-
small_utils/mlxfwresetlib/mlxfwreset_mlnxdriver.py | 2 +-
small_utils/mlxfwresetlib/mlxfwreset_status_checker.py | 2 +-
small_utils/mlxfwresetlib/mlxfwreset_utils.py | 2 +-
small_utils/mlxfwresetlib/pci_device.py | 2 +-
small_utils/mstfwreset.py | 2 +-
8 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/mtcr_py/test.py b/mtcr_py/test.py
index 74c5d28..1e44232 100755
--- a/mtcr_py/test.py
+++ b/mtcr_py/test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
# Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved.
#
# This software is available to you under a choice of one of two
diff --git a/small_utils/mlxfwresetlib/mcra.py b/small_utils/mlxfwresetlib/mcra.py
index 2144d43..bc44356 100644
--- a/small_utils/mlxfwresetlib/mcra.py
+++ b/small_utils/mlxfwresetlib/mcra.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved.
#
diff --git a/small_utils/mlxfwresetlib/mlnx_peripheral_components.py b/small_utils/mlxfwresetlib/mlnx_peripheral_components.py
index 0ddf8d9..469e24b 100644
--- a/small_utils/mlxfwresetlib/mlnx_peripheral_components.py
+++ b/small_utils/mlxfwresetlib/mlnx_peripheral_components.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved.
#
diff --git a/small_utils/mlxfwresetlib/mlxfwreset_mlnxdriver.py b/small_utils/mlxfwresetlib/mlxfwreset_mlnxdriver.py
index 4971b00..1f34925 100755
--- a/small_utils/mlxfwresetlib/mlxfwreset_mlnxdriver.py
+++ b/small_utils/mlxfwresetlib/mlxfwreset_mlnxdriver.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved.
#
diff --git a/small_utils/mlxfwresetlib/mlxfwreset_status_checker.py b/small_utils/mlxfwresetlib/mlxfwreset_status_checker.py
index 1d614ac..153c87b 100755
--- a/small_utils/mlxfwresetlib/mlxfwreset_status_checker.py
+++ b/small_utils/mlxfwresetlib/mlxfwreset_status_checker.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved.
#
diff --git a/small_utils/mlxfwresetlib/mlxfwreset_utils.py b/small_utils/mlxfwresetlib/mlxfwreset_utils.py
index 9b07328..2c64044 100755
--- a/small_utils/mlxfwresetlib/mlxfwreset_utils.py
+++ b/small_utils/mlxfwresetlib/mlxfwreset_utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved.
#
diff --git a/small_utils/mlxfwresetlib/pci_device.py b/small_utils/mlxfwresetlib/pci_device.py
index 69a65ed..04a6c9a 100644
--- a/small_utils/mlxfwresetlib/pci_device.py
+++ b/small_utils/mlxfwresetlib/pci_device.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved.
#
diff --git a/small_utils/mstfwreset.py b/small_utils/mstfwreset.py
index 6d45200..f764de3 100755
--- a/small_utils/mstfwreset.py
+++ b/small_utils/mstfwreset.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved.
#
--
2.20.1

View File

@ -1,26 +0,0 @@
diff --git a/mlxfwops/lib/fs2_ops.cpp b/mlxfwops/lib/fs2_ops.cpp
index 775e242..4af0b9f 100644
--- a/mlxfwops/lib/fs2_ops.cpp
+++ b/mlxfwops/lib/fs2_ops.cpp
@@ -369,7 +369,7 @@ bool Fs2Operations::checkGen(u_int32_t beg, u_int32_t offs, u_int32_t& next, con
// CRC
Crc16 crc;
std::vector<u_int8_t> buffv(size);
- u_int32_t *buff = (u_int32_t*)(&(buffv[0]));
+ u_int32_t *buff = (u_int32_t*)(buffv.size() ? (&(buffv[0])) : NULL);
readBufAux((*_ioAccess), offs + sizeof(gph), buff, size, pr);
diff --git a/mlxfwops/lib/fs4_ops.cpp b/mlxfwops/lib/fs4_ops.cpp
index eb0ca29..4b10307 100644
--- a/mlxfwops/lib/fs4_ops.cpp
+++ b/mlxfwops/lib/fs4_ops.cpp
@@ -403,7 +403,7 @@ bool Fs4Operations::verifyTocEntries(u_int32_t tocAddr, bool show_itoc, bool isD
// Only when we have full verify or the info of this section should be collected for query
std::vector<u_int8_t> buffv(entrySizeInBytes);
- u_int8_t *buff = (u_int8_t *)(&(buffv[0]));
+ u_int8_t *buff = (u_int8_t *)(buffv.size() ? (&(buffv[0])) : NULL);
if (show_itoc) {
cx5fw_itoc_entry_dump(&tocEntry, stdout);

View File

@ -1,180 +0,0 @@
diff --git a/small_utils/mlxfwresetlib/mlxfwreset_status_checker.py b/small_utils/mlxfwresetlib/mlxfwreset_status_checker.py
index 36b82ff..1d614ac 100755
--- a/small_utils/mlxfwresetlib/mlxfwreset_status_checker.py
+++ b/small_utils/mlxfwresetlib/mlxfwreset_status_checker.py
@@ -1,87 +1,87 @@
-#!/usr/bin/python
-
-# Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved.
-#
-# This software is available to you under a choice of one of two
-# licenses. You may choose to be licensed under the terms of the GNU
-# General Public License (GPL) Version 2, available from the file
-# COPYING in the main directory of this source tree, or the
-# OpenIB.org BSD license below:
-#
-# Redistribution and use in source and binary forms, with or
-# without modification, are permitted provided that the following
-# conditions are met:
-#
-# - Redistributions of source code must retain the above
-# copyright notice, this list of conditions and the following
-# disclaimer.
-#
-# - Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following
-# disclaimer in the documentation and/or other materials
-# provided with the distribution.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-#--
-
-"""
-* $Id : fwreset_status_checker.py 2017-11-28
-* $Authors : Ahmad Soboh (ahmads@mellanox.com)
-"""
-
-######################################################################
-# Description: FirmwareResetStatusChecker
-# OS Support : Linux/Windows.
-######################################################################
-
-
-class FirmwareResetStatusChecker(object):
-
- FirmwareUptimeStatusInit = 0x0
- FirmwareUptimeStatusBeforeDone = 0x1
- FirmwareUptimeStatusAfterDone = 0x2
- FirmwareUptimeStatusError = 0x3
-
- FirmwareResetStatusDone = 0x0
- FirmwareResetStatusFailed = 0x1
- FirmwareResetStatusUnknown = 0x2
-
- def __init__(self, regAccessObj):
- self._RegAccessObj = regAccessObj
- self._UptimeBeforeReset = 0x0
- self._UptimeBeforeStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusInit
- self._UptimeAfterReset = 0x0
- self._UptimeAfterStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusInit
-
- def UpdateUptimeBeforeReset(self):
- try:
- self._UptimeBeforeReset = self._RegAccessObj.getFWUptime()
- self._UptimeBeforeStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusBeforeDone
- except Exception as e:
- self._UptimeBeforeStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusError
-
- def UpdateUptimeAfterReset(self):
- try:
- self._UptimeAfterReset = self._RegAccessObj.getFWUptime()
- self._UptimeAfterStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusAfterDone
- except Exception as e:
- self._UptimeAfterStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusError
-
- def GetStatus(self):
- if self._UptimeBeforeStatus == FirmwareResetStatusChecker.FirmwareUptimeStatusBeforeDone and\
- self._UptimeAfterStatus == FirmwareResetStatusChecker.FirmwareUptimeStatusAfterDone:
- if self._UptimeAfterReset < self._UptimeBeforeReset:
- return FirmwareResetStatusChecker.FirmwareResetStatusDone
- else:
- if self._UptimeBeforeReset > 5: #5 seconds
- return FirmwareResetStatusChecker.FirmwareResetStatusFailed
- else:
- return FirmwareResetStatusChecker.FirmwareResetStatusUnknown
- return FirmwareResetStatusChecker.FirmwareResetStatusUnknown
\ No newline at end of file
+#!/usr/bin/python
+
+# Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved.
+#
+# This software is available to you under a choice of one of two
+# licenses. You may choose to be licensed under the terms of the GNU
+# General Public License (GPL) Version 2, available from the file
+# COPYING in the main directory of this source tree, or the
+# OpenIB.org BSD license below:
+#
+# Redistribution and use in source and binary forms, with or
+# without modification, are permitted provided that the following
+# conditions are met:
+#
+# - Redistributions of source code must retain the above
+# copyright notice, this list of conditions and the following
+# disclaimer.
+#
+# - Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials
+# provided with the distribution.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+#--
+
+"""
+* $Id : fwreset_status_checker.py 2017-11-28
+* $Authors : Ahmad Soboh (ahmads@mellanox.com)
+"""
+
+######################################################################
+# Description: FirmwareResetStatusChecker
+# OS Support : Linux/Windows.
+######################################################################
+
+
+class FirmwareResetStatusChecker(object):
+
+ FirmwareUptimeStatusInit = 0x0
+ FirmwareUptimeStatusBeforeDone = 0x1
+ FirmwareUptimeStatusAfterDone = 0x2
+ FirmwareUptimeStatusError = 0x3
+
+ FirmwareResetStatusDone = 0x0
+ FirmwareResetStatusFailed = 0x1
+ FirmwareResetStatusUnknown = 0x2
+
+ def __init__(self, regAccessObj):
+ self._RegAccessObj = regAccessObj
+ self._UptimeBeforeReset = 0x0
+ self._UptimeBeforeStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusInit
+ self._UptimeAfterReset = 0x0
+ self._UptimeAfterStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusInit
+
+ def UpdateUptimeBeforeReset(self):
+ try:
+ self._UptimeBeforeReset = self._RegAccessObj.getFWUptime()
+ self._UptimeBeforeStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusBeforeDone
+ except Exception as e:
+ self._UptimeBeforeStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusError
+
+ def UpdateUptimeAfterReset(self):
+ try:
+ self._UptimeAfterReset = self._RegAccessObj.getFWUptime()
+ self._UptimeAfterStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusAfterDone
+ except Exception as e:
+ self._UptimeAfterStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusError
+
+ def GetStatus(self):
+ if self._UptimeBeforeStatus == FirmwareResetStatusChecker.FirmwareUptimeStatusBeforeDone and\
+ self._UptimeAfterStatus == FirmwareResetStatusChecker.FirmwareUptimeStatusAfterDone:
+ if self._UptimeAfterReset < self._UptimeBeforeReset:
+ return FirmwareResetStatusChecker.FirmwareResetStatusDone
+ else:
+ if self._UptimeBeforeReset > 5: #5 seconds
+ return FirmwareResetStatusChecker.FirmwareResetStatusFailed
+ else:
+ return FirmwareResetStatusChecker.FirmwareResetStatusUnknown
+ return FirmwareResetStatusChecker.FirmwareResetStatusUnknown

View File

@ -3,15 +3,12 @@
Name: mstflint Name: mstflint
Summary: Mellanox firmware burning tool Summary: Mellanox firmware burning tool
Version: 4.11.0 Version: 4.11.0
Release: 4%{?dist} Release: 5%{?dist}
License: GPLv2+ or BSD License: GPLv2+ or BSD
Group: Applications/System Group: Applications/System
Source: https://github.com/Mellanox/mstflint/releases/download/v4.11.0-3/mstflint-4.11.0-3.tar.gz Source: https://github.com/Mellanox/mstflint/releases/download/v4.11.0-4/mstflint-4.11.0-4.tar.gz
Patch1: convert-format-for-mlxfwreset_status_checker.patch
Patch2: 0001-Fix-shebang-for-python-scripts.patch
Patch3: extend-buffer.patch Patch3: extend-buffer.patch
Patch4: add-default-link-flags-for-shared-libraries.patch Patch4: add-default-link-flags-for-shared-libraries.patch
Patch5: 0001-mstflint-crash-when-compiled-with-CXXFLAGS-Wp-D_GLIB.patch
Patch6: replace-mlxfwreset-with-mstfwreset-in-mstflint-message.patch Patch6: replace-mlxfwreset-with-mstfwreset-in-mstflint-message.patch
Url: https://github.com/Mellanox/mstflint Url: https://github.com/Mellanox/mstflint
BuildRequires: libstdc++-devel, zlib-devel, libibmad-devel, gcc-c++, gcc BuildRequires: libstdc++-devel, zlib-devel, libibmad-devel, gcc-c++, gcc
@ -29,11 +26,8 @@ for network adapters based on Mellanox Technologies chips.
%prep %prep
%setup -q %setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1 %patch3 -p1
%patch4 -p1 %patch4 -p1
%patch5 -p1
%patch6 -p1 %patch6 -p1
find . -type f -iname '*.[ch]' -exec chmod a-x '{}' ';' find . -type f -iname '*.[ch]' -exec chmod a-x '{}' ';'
find . -type f -iname '*.cpp' -exec chmod a-x '{}' ';' find . -type f -iname '*.cpp' -exec chmod a-x '{}' ';'
@ -71,6 +65,9 @@ find %{buildroot} -type f -name pci_device.py -exec chmod -v a+x '{}' ';'
%{_mandir}/man1/* %{_mandir}/man1/*
%changelog %changelog
* Mon Apr 15 2019 Honggang Li <honli@redhat.com> - 4.11.0-5
- Rebase mstflint to latest upstream release v4.11.0-4
* Fri Feb 22 2019 Honggang Li <honli@redhat.com> - 4.11.0-4 * Fri Feb 22 2019 Honggang Li <honli@redhat.com> - 4.11.0-4
- Fix mstflint segment fault issue for ConnectX-5 HCA - Fix mstflint segment fault issue for ConnectX-5 HCA
- Resolves: 1679844 - Resolves: 1679844

View File

@ -1,8 +1,8 @@
diff --git a/flint/subcommands.cpp b/flint/subcommands.cpp diff --git a/flint/subcommands.cpp b/flint/subcommands.cpp
index 8c85e55..0822e8b 100644 index 3840579..3d2680b 100644
--- a/flint/subcommands.cpp --- a/flint/subcommands.cpp
+++ b/flint/subcommands.cpp +++ b/flint/subcommands.cpp
@@ -2997,7 +2997,7 @@ FlintStatus SgSubCommand::sgFs2() @@ -3018,7 +3018,7 @@ FlintStatus SgSubCommand::sgFs2()
return FLINT_SUCCESS; return FLINT_SUCCESS;
} }
@ -12,15 +12,15 @@ index 8c85e55..0822e8b 100644
FlintStatus SgSubCommand::sgFs3() FlintStatus SgSubCommand::sgFs3()
{ {
diff --git a/mlxfwops/lib/flint_base.h b/mlxfwops/lib/flint_base.h diff --git a/mlxfwops/lib/flint_base.h b/mlxfwops/lib/flint_base.h
index eb434dc..e851085 100644 index be7a913..e7e7b64 100644
--- a/mlxfwops/lib/flint_base.h --- a/mlxfwops/lib/flint_base.h
+++ b/mlxfwops/lib/flint_base.h +++ b/mlxfwops/lib/flint_base.h
@@ -394,7 +394,7 @@ struct BOARD_ID { @@ -395,7 +395,7 @@ struct BOARD_ID {
#define TLV_FORMAT_SECT "TLVs format section"
#define TRACER_HASH_SECT "Tracer Hash section" #define TRACER_HASH_SECT "Tracer Hash section"
#define REBOOT_REQUIRED_STR "To load new FW run reboot machine." #define REBOOT_REQUIRED_STR "To load new FW run reboot machine."
#ifndef MST_UL
-#define REBOOT_OR_FWRESET_REQUIRED_STR "To load new FW run mlxfwreset or reboot machine." -#define REBOOT_OR_FWRESET_REQUIRED_STR "To load new FW run mlxfwreset or reboot machine."
+#define REBOOT_OR_FWRESET_REQUIRED_STR "To load new FW run mstfwreset or reboot machine." +#define REBOOT_OR_FWRESET_REQUIRED_STR "To load new FW run mstfwreset or reboot machine."
#define numbel(x) (sizeof(x) / sizeof((x)[0])) #else
#define REBOOT_OR_FWRESET_REQUIRED_STR "To load new FW run mstfwreset or reboot machine."
void report(const char *format, ...); #endif

View File

@ -1 +1 @@
SHA512 (mstflint-4.11.0-3.tar.gz) = a7482442df08f97a6e225f8352ce17d361abda1ebe1cff6e9350ece31aaa36c1a7fb1d28751acef7a40ef9f53801aa9b4bfe97f210a9a97c3d2030961dc99da3 SHA512 (mstflint-4.11.0-4.tar.gz) = cdcae2ccf2dc5b24f03fe80b9abc3c8f198254b77eb4f20e48b9473e21b817305f800758147e9bd61642e53698bf9e1d22397c0cae6d8eb1a759f68626d499a2