Skip to content

Commit

Permalink
Merge branch 'master' into mem_tg_channels
Browse files Browse the repository at this point in the history
  • Loading branch information
pcolberg authored Aug 19, 2024
2 parents 0cbe544 + e7ae66e commit 113b97c
Show file tree
Hide file tree
Showing 14 changed files with 685 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ mark_as_advanced(OPAE_MINIMAL_BUILD)
option(OPAE_BUILD_TESTS "Enable building of OPAE unit tests" OFF)
mark_as_advanced(OPAE_BUILD_TESTS)

option(OPAE_WITH_QSFPINFO_QSFPPRINT "Enable qsfpinfo print qsfp" OFF)
mark_as_advanced(OPAE_WITH_QSFPINFO_QSFPPRINT)

############################################################################
## Python Interpreter/Build Env ###########################################
############################################################################
Expand Down Expand Up @@ -982,6 +985,7 @@ set(CPACK_COMPONENTS_ALL
toolfpgadiagapps
toolpackager
tooluserclk
toolqsfpinfo
toolras
toolcoreidle
toolmmlink
Expand Down Expand Up @@ -1049,6 +1053,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
94 changes: 94 additions & 0 deletions binaries/qsfpinfo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
## 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.

if (OPAE_WITH_QSFPINFO_QSFPPRINT)

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

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"
)

target_compile_options(qsfpinfo PUBLIC
-D_QSFPPRINT
)

add_dependencies(qsfpinfo get-ethtool-files)

else(OPAE_WITH_QSFPINFO_QSFPPRINT)

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

endif(OPAE_WITH_QSFPINFO_QSFPPRINT)

target_include_directories(qsfpinfo
PRIVATE
${OPAE_LIB_SOURCE}/argsfilter
)

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 113b97c

Please sign in to comment.