Skip to content

Commit

Permalink
qsfpinfo: New tool to print QSFP EEPROM information for cards with qs…
Browse files Browse the repository at this point in the history
…fp feature (id 0x13).

Signed-off-by: Roger Christensen <rc@silicom.dk>
  • Loading branch information
rchriste1 committed Apr 15, 2024
1 parent afb66cd commit d2ea7f5
Show file tree
Hide file tree
Showing 14 changed files with 655 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,7 @@ set(CPACK_COMPONENTS_ALL
toolfpgadiagapps
toolpackager
tooluserclk
toolqsfpinfo
toolras
toolcoreidle
toolmmlink
Expand Down Expand Up @@ -1049,6 +1050,7 @@ define_pkg(tools
define_pkg(tools-extra
COMPONENTS
tooluserclk
toolqsfpinfo
toolras
toolmmlink
toolcoreidle
Expand Down
6 changes: 6 additions & 0 deletions binaries/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ opae_add_subdirectory(fpgametrics)
option(OPAE_BUILD_USERCLK "Enable building extra tool userclk" ON)
mark_as_advanced(OPAE_BUILD_USERCLK)

option(OPAE_BUILD_QSFPINFO "Enable building extra tool qsfpinfo" ON)
mark_as_advanced(OPAE_BUILD_QSFPINFO)

option(OPAE_BUILD_FPGADIAG "Enable building extra tool fpgadiag" ON)
mark_as_advanced(OPAE_BUILD_FPGADIAG)

Expand All @@ -52,6 +55,9 @@ if(OPAE_BUILD_EXTRA_TOOLS)
if(OPAE_BUILD_USERCLK)
opae_add_subdirectory(userclk)
endif()
if(OPAE_BUILD_QSFPINFO)
opae_add_subdirectory(qsfpinfo)
endif()
if(OPAE_BUILD_FPGADIAG)
set(OPAE_BUILD_CXXUTILS ON)
opae_add_subdirectory(fpgadiag)
Expand Down
73 changes: 73 additions & 0 deletions binaries/qsfpinfo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
## Copyright(c) 2024, Silciom Denmark A/S
##
## 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.
## * Neither the name of Intel Corporation nor the names of its contributors
## may be used to endorse or promote products derived from this software
## without specific prior written permission.
##
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
## POSSIBILITY OF SUCH DAMAGE.

opae_add_executable(TARGET qsfpinfo
SOURCE
main.c
cmis_wrap.c
sff-common_wrap.c
LIBS
argsfilter
opae-c
m
COMPONENT toolqsfpinfo
)

target_include_directories(qsfpinfo
PRIVATE
${OPAE_LIB_SOURCE}/argsfilter
)

include(ExternalProject)

ExternalProject_Add(
ethtool_project
GIT_REPOSITORY "https://git.kernel.org/pub/scm/network/ethtool/ethtool.git"
GIT_TAG "v6.7"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
UPDATE_COMMAND ""
)

ExternalProject_Get_Property(ethtool_project SOURCE_DIR)

add_custom_target(get-ethtool-files
DEPENDS ethtool_project
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${SOURCE_DIR}/cmis.c"
"${SOURCE_DIR}/cmis.h"
"${SOURCE_DIR}/qsfp.c"
"${SOURCE_DIR}/qsfp.h"
"${SOURCE_DIR}/sff-common.c"
"${SOURCE_DIR}/sff-common.h"
"${SOURCE_DIR}/internal.h"
"${SOURCE_DIR}/json_print.h"
"${SOURCE_DIR}/json_writer.h" "${CMAKE_CURRENT_SOURCE_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SOURCE_DIR}/netlink/extapi.h" "${CMAKE_CURRENT_SOURCE_DIR}/netlink/extapi.h"
)

add_dependencies(qsfpinfo get-ethtool-files)
28 changes: 28 additions & 0 deletions binaries/qsfpinfo/cmis_wrap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright(c) 2024, Silciom Denmark A/S
//
// 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.
// * Neither the name of Intel Corporation nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

#undef HAVE_CONFIG_H
#include "cmis.c"
Loading

0 comments on commit d2ea7f5

Please sign in to comment.