mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
The optics monitoring tool opticsmon implements the user-space portion
of reporting optics data to the SE. Its basic functionality is to
collect optical module information equivalent to "ethtool --module-info"
for PCI Physical Functions and forwards this data to the SE using the
new SCLP Write Event Data Action Qualifier 3.
For the part of finding all PFs we need to look at all PCI
functions and determine which ones are PFs and what netdevs they
correspond to. This is a generally useful functionality so this part as
well as the SCLP issuing code go into a new libzpci library which also
includes a standalone example for listing PCI functions and their s390x
specific attributes. Medium term we plan to add this functionality to
lszdev.
For the opticsmon tool itself there are 2 basic operating modes:
* One-shot Mode: Without parameters opticsmon collects optical module
data and prints a summary of the netdevice in JSON format. With
--module-data it also includes a base64 encoded raw dump equivalent to
ethtool --module-info <netdev> raw on.
* Monitor Mode: With the --monitor flag opticsmon runs continuously
usually started via a systemd unit and collects new optical module
data on a time interval (default 24h) or when the operational state
("/sys/class/net/<netdev/operstate") changes. The tool listens for
changes via netlink so no polling on sysfs is necessary
Note: Both modes will *NOT* issues SCLPs without adding the
--send-report flag but will output a JSON summary for each data
collection so can be tested without firmware impact.
Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
84 lines
2.0 KiB
Makefile
84 lines
2.0 KiB
Makefile
include ../common.mak
|
|
|
|
TESTS := tests/
|
|
|
|
libs =$(rootdir)/libzpci/libzpci.a $(rootdir)/libutil/libutil.a
|
|
|
|
ifneq (${HAVE_OPENSSL},0)
|
|
check_dep_openssl:
|
|
$(call check_dep, \
|
|
"opticsmon", \
|
|
"openssl/evp.h", \
|
|
"openssl-devel", \
|
|
"HAVE_OPENSSL=0")
|
|
BUILDTARGET += check_dep_openssl
|
|
endif # HAVE_OPENSSL
|
|
|
|
ifneq (${HAVE_LIBNL3},0)
|
|
check_dep_libnl3:
|
|
$(call check_dep, \
|
|
"opticsmon", \
|
|
"netlink/socket.h", \
|
|
"libnl3-devel", \
|
|
"HAVE_LIBNL3=0")
|
|
BUILDTARGET += check_dep_libnl3
|
|
endif # HAVE_LIBNL3
|
|
|
|
ifeq (${HAVE_OPENSSL},0)
|
|
|
|
all:
|
|
$(SKIP) HAVE_OPENSSL=0
|
|
|
|
install:
|
|
$(SKIP) HAVE_OPENSSL=0
|
|
|
|
else ifeq (${HAVE_LIBNL3},0)
|
|
all:
|
|
$(SKIP) HAVE_LIBNL3=0
|
|
|
|
install:
|
|
$(SKIP) HAVE_LIBNL3=0
|
|
|
|
else
|
|
|
|
ifneq ($(shell sh -c 'command -v pkg-config'),)
|
|
LIB_CFLAGS += $(shell pkg-config --silence-errors --cflags libnl-3.0)
|
|
LIB_CFLAGS += $(shell pkg-config --silence-errors --cflags libnl-genl-3.0)
|
|
LIB_CFLAGS += $(shell pkg-config --silence-errors --cflags libnl-route-3.0)
|
|
|
|
LIB_CFLAGS += $(shell pkg-config --silence-errors --cflags libcrypto)
|
|
|
|
LIB_LFLAGS += $(shell pkg-config --silence-errors --libs libnl-3.0)
|
|
LIB_LFLAGS += $(shell pkg-config --silence-errors --libs libnl-genl-3.0)
|
|
LIB_LFLAGS += $(shell pkg-config --silence-errors --libs libnl-route-3.0)
|
|
|
|
LIB_LFLAGS += $(shell pkg-config --silence-errors --libs libcrypto)
|
|
else
|
|
LIB_CFLAGS += -I /usr/include/libnl3/
|
|
LIB_LFLAGS += -lnl-route-3 -lnl-genl-3 -lnl-3
|
|
|
|
LIB_CFLAGS += -I /usr/include/openssl/
|
|
LIB_LFLAGS += -lcrypto
|
|
endif
|
|
|
|
ALL_CPPFLAGS += $(LIB_CFLAGS)
|
|
LDLIBS += $(LIB_LFLAGS)
|
|
|
|
BUILDTARGET += opticsmon
|
|
|
|
all: ${BUILDTARGET}
|
|
|
|
opticsmon: opticsmon.o optics_info.o optics_sclp.o ethtool.o link_mon.o $(libs)
|
|
|
|
install: all
|
|
$(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man8
|
|
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 opticsmon $(DESTDIR)$(BINDIR)
|
|
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 644 opticsmon.8 \
|
|
$(DESTDIR)$(MANDIR)/man8
|
|
endif # HAVE_OPENSSL3=0 or HAVE_LIBNL3=0
|
|
|
|
clean:
|
|
rm -f *.o *~ opticsmon core
|
|
|
|
.PHONY: all install clean
|