forked from pool/s390-tools
7e8b34210d
- Upgraded to version 2.15.1. (bsc#1178250, jsc#SLE-13663) - Added s390-tools-sles15sp3-dasdfmt-Fix-segfault-when-an-incorrect-option-is-spe.patch (bsc#1178313). When specifying an incorrect program option, dasdfmt segfaults as the format string for the corresponding error message has no parameter. - Added s390-tools-sles15sp3-libutil-Compare-proc-entries-to-vfstype.patch (bsc#1178315). The fdasd command was failing if sysfs was mounted this way: mount -t sysfs none /sys To make sure that the mount point of the sysfs is still found when mounted with a device keyword specified other than 'sysfs', check for the filesystem type instead, which is more specific. - Added the following patches for bsc#1178427, and jsc#SLE-13768, Log DASD info for endpoint security * s390-tools-sles15sp3-01-zdev-Add-FC-Endpoint-Security-information-for-DASD-d.patch * s390-tools-sles15sp3-02-lsdasd-Add-FC-Endpoint-Security-information.patch - Added the following patch for bsc#1178628 and jsc#SLE-13765, Converged HiperSockets/Ethernet Interface * s390-tools-sles15sp3-hsci-Add-new-tool-to-control-HiperSockets-Converged-.patch - Added the following patches for bsc#1178992 and jsc#SLE-13772, Add host-key document verification support to genprotimg. * s390-tools-sles15sp3-01-genprotimg-abort-if-one-of-the-recursive-targets-is-.patch * s390-tools-sles15sp3-02-genprotimg-fix-two-memory-leaks.patch * s390-tools-sles15sp3-03-genprotimg-require-argument-for-ramdisk-and-parmfile.patch * s390-tools-sles15sp3-04-genprotimg-add-host-key-document-verification-suppor.patch - Added the following patch for bsc#1178734. Running zcryptstats when many domains are available per cryto card does not produce any output, and is hanging in a loop. * s390-tools-sles15sp3-zcryptstats-Fix-handling-of-partial-results-with-man.patch - Reworked and renamed the following patches to accommodate changes made by IBM to the structure of the dasdfmt command. * s390-tools-sles15-Allow-multiple-device-arguments.patch renamed to s390-tools-sles15sp3-Allow-multiple-device-arguments.patch. * s390-tools-sles15-Format-devices-in-parallel.patch renamed to s390-tools-sles15sp3-Format-devices-in-parallel.patch * dasdfmt-retry-BIODASDINFO-if-device-is-busy.patch renamed to s390-tools-sles15sp3-dasdfmt-retry-BIODASDINFO-if-device-is-busy.patch * s390-tools-sles15-Implement-f-for-backwards-compability.patch renamed to s390-tools-sles15-Implement-Y-yast_mode.patch - Upgraded to version 2.15.0 (jsc#SLE-13662, jsc#SLE-13663, jsc#SLE-13667, jsc#SLE-13724, jsc#SLE-13728, jsc#SLE-13730, jsc#SLE-13739, jsc#SLE-13744, jsc#SLE-13751, jsc#SLE-13755, jsc#SLE-13765, jsc#SLE-13768, jsc#SLE-13777, jsc#SLE-13814, jsc#SLE-13819, jsc#SLE-13820) - Reworked s390-tools-sles12-sysconfig-compatible-dumpconf.patch to fit the current version and renamed it to s390-tools-sles15-sysconfig-compatible-dumpconf.patch - Removed the following obsolete patches: * s390-tools-sles15sp2-01-zkey-Separate-and-rework-CCA-host-library-loading.patch * s390-tools-sles15sp2-02-zkey-Move-utility-functions-into-separate-source-fil.patch * s390-tools-sles15sp2-03-zkey-Add-utility-function-to-get-the-serial-number-o.patch * s390-tools-sles15sp2-04-zkey-Add-utility-function-to-get-the-mkvp-of-a-crypt.patch * s390-tools-sles15sp2-05-zkey-add-function-to-iterate-over-all-available-CCA-.patch * s390-tools-sles15sp2-06-zkey-Add-function-to-print-the-MKVPs-of-APQNs.patch * s390-tools-sles15sp2-07-zkey-Add-function-to-cross-check-APQNs-for-valid-mas.patch * s390-tools-sles15sp2-08-zkey-Add-function-to-obtain-the-mkvp-of-a-secure-key.patch * s390-tools-sles15sp2-09-zkey-Display-MKVP-when-validating-a-secure-key.patch * s390-tools-sles15sp2-10-zkey-Cross-check-APQNs-when-generating-secure-keys.patch * s390-tools-sles15sp2-11-zkey-Cross-check-APQNs-when-validating-secure-keys.patch * s390-tools-sles15sp2-12-zkey-Cross-check-APQNs-when-importing-secure-keys.patch * s390-tools-sles15sp2-13-zkey-Cross-check-APQNs-when-changing-APQN-associatio.patch * s390-tools-sles15sp2-14-zkey-Add-function-to-select-a-specific-CCA-adapter.patch * s390-tools-sles15sp2-15-zkey-Add-function-to-select-a-CCA-adapter-by-mkvp.patch * s390-tools-sles15sp2-16-zkey-Select-CCA-adapter-when-re-enciphering.patch * s390-tools-sles15sp2-17-zkey-cryptsetup-Add-to-new-and-from-old-options.patch * s390-tools-sles15sp2-18-zkey-Display-key-type-with-list-and-validate-command.patch * s390-tools-sles15sp2-19-zkey-Allow-to-filter-list-output-by-key-type.patch * s390-tools-sles15sp2-20-zkey-Allow-to-specify-the-key-type-with-the-generate.patch * s390-tools-sles15sp2-21-zkey-Preparations-for-introducing-a-new-key-type.patch * s390-tools-sles15sp2-22-zkey-Introduce-the-CCA-AESCIPHER-key-type.patch * s390-tools-sles15sp2-23-zkey-Add-wrappers-for-the-new-IOCTLs-with-fallback-t.patch * s390-tools-sles15sp2-24-zkey-Add-helper-functions-to-build-lists-of-APQNs.patch * s390-tools-sles15sp2-25-zkey-Add-support-for-generating-AES-CIPHER-keys.patch * s390-tools-sles15sp2-26-zkey-Add-support-for-validating-AES-CIPHER-keys.patch * s390-tools-sles15sp2-27-zkey-Add-support-for-re-enciphering-AES-CIPHER-keys.patch * s390-tools-sles15sp2-28-zkey-Check-crypto-card-level-during-APQN-cross-check.patch * s390-tools-sles15sp2-29-zkey-Add-helper-function-to-query-the-CCA-firmware-v.patch * s390-tools-sles15sp2-30-zkey-Add-helper-function-to-convert-secure-keys-betw.patch * s390-tools-sles15sp2-31-zkey-Add-helper-function-to-restrict-export-of-secur.patch * s390-tools-sles15sp2-32-zkey-Add-helper-function-to-check-an-AES-CIPHER-key.patch * s390-tools-sles15sp2-33-zkey-Add-key-checks-when-importing-a-CCA-AESCIPHER-k.patch * s390-tools-sles15sp2-34-zkey-Add-convert-command-to-convert-keys-from-one-ty.patch * s390-tools-sles15sp2-35-zkey-Allow-zkey-cryptsetup-setkey-to-set-different-k.patch * s390-tools-sles15sp2-zcrypt-CEX7S-exploitation-support.patch * s390-tools-sles15sp2-zcryptstats-Add-support-for-CEX7.patch * s390-tools-sles15sp2-zkey-Fix-listing-of-keys-on-file-systems-reporting-D.patch * s390-tools-sles15sp2-zkey-Fix-display-of-clear-key-size-for-XTS-keys.patch * s390-tools-sles15sp2-zkey-Fix-display-of-XTS-attribute-for-validate-comma.patch * s390-tools-sles15sp2-zkey-Fix-display-of-clear-key-size-for-CCA-AESCIPHER.patch * s390-tools-sles15sp2-01-zipl-libc-Introduce-vsnprintf.patch * s390-tools-sles15sp2-02-zipl-libc-Fix-potential-buffer-overflow-in-printf.patch * s390-tools-sles15sp2-03-zipl-libc-Replace-sprintf-with-snprintf.patch * s390-tools-sles15sp2-04-zipl-libc-Indicate-truncated-lines-in-printf-with.patch * s390-tools-sles15sp2-01-zpcictl-Initiate-recover-after-reset.patch * s390-tools-sles15sp2-02-zpcictl-Rename-misleading-sysfs_write_data.patch * s390-tools-sles15sp2-03-zpcitctl-Exit-on-error-in-sysfs_report_error.patch * s390-tools-sles15sp2-01-zipl-fix-Wdiscarded-qualifiers.patch * s390-tools-sles15sp2-02-zipl-fix-Waddress-of-packed-member.patch * s390-tools-sles15sp2-03-zipl-remove-some-useless-__packed___-attributes.patch * s390-tools-sles15sp2-04-zipl-Fix-entry-point-for-stand-alone-kdump.patch * s390-tools-sles15sp2-05-zipl-Fix-dependency-generation-in-zipl-boot.patch * s390-tools-sles15sp2-06-zipl-Make-use-of-__packed-macro.patch * s390-tools-sles15sp2-07-zipl-define-__section-macro-and-make-use-of-it.patch * s390-tools-sles15sp2-08-zipl-Make-use-of-__noreturn-macro.patch * s390-tools-sles15sp2-09-zipl-Define-__noinline-macro-and-make-use-of-it.patch * s390-tools-sles15sp2-10-zipl-stage3-Mark-start_kernel-__noreturn.patch * s390-tools-sles15sp2-11-zipl-sclp-Remove-duplicate-macros.patch * s390-tools-sles15sp2-12-zipl-Make-address-size-mask-macros-UL.patch * s390-tools-sles15sp2-13-zipl-libc-Use-stdint.h-instead-of-self-defined-macro.patch * s390-tools-sles15sp2-14-zipl-Consolidate-IMAGE-macros.patch * s390-tools-sles15sp2-15-zipl-Consolidate-STAGE-2-3-macros.patch * s390-tools-sles15sp2-16-zipl-stfle-use-uint64_t-instead-of-u64.patch * s390-tools-sles15sp2-17-zipl-boot-fix-comment-in-stage3.lds.patch * s390-tools-sles15sp2-18-lib-zt_common-add-STATIC_ASSERT-macro.patch * s390-tools-sles15sp2-19-zipl-use-STATIC_ASSERT-macro-for-no-padding-verifica.patch * s390-tools-sles15sp2-20-Support-lib-zt_common.h-to-be-used-in-assembler-and-.patch * s390-tools-sles15sp2-21-zipl-move-IPL-related-definitions-into-separate-head.patch * s390-tools-sles15sp2-22-zipl-move-SIGP-related-functions-and-definitions-int.patch * s390-tools-sles15sp2-23-zipl-add-SIGP_SET_ARCHITECTURE-to-sigp.h-and-use-it.patch * s390-tools-sles15sp2-24-zipl-stage3-make-IPL_DEVICE-definition-consistent-wi.patch * s390-tools-sles15sp2-25-zipl-move-Linux-layout-definitions-into-separate-hea.patch * s390-tools-sles15sp2-26-zipl-tape0-use-constants-defined-in-linux_layout.h.patch * s390-tools-sles15sp2-27-zipl-use-STAGE3_ENTRY-for-STAGE3_LOAD_ADDRESS.patch * s390-tools-sles15sp2-28-zipl-move-loaders-layout-definitions-into-separate-h.patch * s390-tools-sles15sp2-29-zipl-s390.h-rename-inline-macro-into-__always_inline.patch * s390-tools-sles15sp2-30-zipl-move-__always_inline-barrier-__pa32-pa-to-zt_co.patch * s390-tools-sles15sp2-31-zipl-make-BLK_PWRT-unsigned-int.patch * s390-tools-sles15sp2-32-Consolidate-MIN-and-MAX-macros.patch * s390-tools-sles15sp2-33-zipl-remove-libc.h-include-in-s390.h.patch * s390-tools-sles15sp2-34-zipl-move-s390.h-to-include-boot-s390.h.patch * s390-tools-sles15sp2-35-zipl-libc-include-s390.h.patch * s390-tools-sles15sp2-36-include-boot-s390.h-move-panic-and-panic_notify-to-l.patch * s390-tools-sles15sp2-37-include-boot-s390.h-fixes-for-Werror-sign-conversion.patch * s390-tools-sles15sp2-38-zipl-refactor-all-EBCDIC-code-into-separate-files.patch * s390-tools-sles15sp2-39-zipl-sclp-add-macros-for-the-control-program-masks.patch * s390-tools-sles15sp2-40-zipl-sclp-add-sclp_print_ascii.patch * s390-tools-sles15sp2-41-zipl-libc-printf-print-on-linemode-and-ASCII-console.patch * s390-tools-sles15sp2-42-Consolidate-ALIGN-__ALIGN_MASK-ARRAY_SIZE-macros.patch * s390-tools-sles15sp2-43-genprotimg-boot-initial-bootloader-support.patch * s390-tools-sles15sp2-44-genprotimg-boot-use-C-pre-processor-for-linker-scrip.patch * s390-tools-sles15sp2-45-genprotimg-add-relocator-for-stage3b.patch * s390-tools-sles15sp2-46-README.md-remove-useless-empty-line.patch * s390-tools-sles15sp2-47-include-boot-s390.h-add-guard-for-struct-__vector128.patch * s390-tools-sles15sp2-48-genprotimg-introduce-new-tool-for-the-creation-of-PV.patch * s390-tools-sles15sp2-01-zipl-Add-missing-options-to-help-output.patch * s390-tools-sles15sp2-02-zipl-allow-stand-alone-secure-option-on-command-l.patch * s390-tools-sles15sp2-03-zipl-correct-secure-boot-config-handling.patch * s390-tools-sles15sp2-04-zipl-fix-zipl.conf-man-page-example-for-secure-boot.patch * s390-tools-sles15sp2-01-cpumf-add-new-deflate-counters-for-z15.patch * s390-tools-sles15sp2-vmcp-exit-code.patch * s390-tools-sles15sp2-zipl-prevent-endless-loop-during-IPL.patch * s390-tools-sles15sp2-zipl-check-for-valid-ipl-parmblock-lowcore-pointer.patch * s390-tools-sles15sp2-01-zipl-libc-libc_stop-move-noreturn-to-declaration.patch * s390-tools-sles15sp2-02-zipl-stage3-correctly-handle-diag308-response-code.patch * s390-tools-sles15sp2-lsluns-try-harder-to-find-udevadm.patch * s390-tools-sles15sp2-znetconf-introduce-better-ways-to-locate-udevadm.patch * s390-tools-sles15sp2-mon_tools-update-udevadm-location.patch * s390-tools-sles15sp2-lscpumf-change-dflt-ccerror-counter-name.patch * s390-tools-sles15sp2-01-zdev-Introduce-read-only-attributes.patch * s390-tools-sles15sp2-02-zdev-Handle-special-case-in-if-case.patch * s390-tools-sles15sp2-03-zdev-Report-FC-Endpoint-Security-of-zfcp-devices.patch * s390-tools-sles15sp2-04-zfcpdbf-print-HBA-FC-Endpoint-Security-trace-records.patch * s390-tools-sles15sp1-zdev-Also-include-the-ctc-driver-in-the-initrd.patch not in spec file * s390-tools-sles15sp2-Close-file-descriptor-when-checking-for-read-only.patch not in spec file - Added s390-tools-sles15sp2-lscpumf-change-dflt-ccerror-counter-name.patch (bsc#1176508) lscpumf displays counter number 265 as DFLT_CCERROR. This is wrong and differs from the counter name as defined in the Linux kernel version 5.8 and later. - Added the following patches to implement the post-GA feature jsc#ECO-2636 Log FCP link info for endpoint security (bsc#1175477) * s390-tools-sles15sp2-01-zdev-Introduce-read-only-attributes.patch * s390-tools-sles15sp2-02-zdev-Handle-special-case-in-if-case.patch * s390-tools-sles15sp2-03-zdev-Report-FC-Endpoint-Security-of-zfcp-devices.patch * s390-tools-sles15sp2-04-zfcpdbf-print-HBA-FC-Endpoint-Security-trace-records.patch OBS-URL: https://build.opensuse.org/request/show/854117 OBS-URL: https://build.opensuse.org/package/show/Base:System/s390-tools?expand=0&rev=101
634 lines
17 KiB
Diff
634 lines
17 KiB
Diff
From ef090dda8333a778cb2d9e7f65ca8021e2ae9e67 Mon Sep 17 00:00:00 2001
|
|
From: Karsten Graul <kgraul@linux.ibm.com>
|
|
Date: Tue, 10 Nov 2020 12:07:03 +0100
|
|
Subject: [PATCH] hsci: Add new tool to control HiperSockets Converged
|
|
Interfaces
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
hsci is used to control and show HSCI (HiperSockets Converged Interfaces)
|
|
settings. A HiperSockets interface and an external network interface are
|
|
converged to an HSCI interface.
|
|
|
|
Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
|
|
Signed-off-by: Wenjia Zhang <wenjia@linux.ibm.com>
|
|
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
|
|
Signed-off-by: Jan Hoeppner <hoeppner@linux.ibm.com>
|
|
---
|
|
Makefile | 2 +-
|
|
README.md | 3 +
|
|
hsci/Makefile | 16 ++
|
|
hsci/hsci | 441 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
hsci/hsci.8 | 100 ++++++++++++
|
|
5 files changed, 561 insertions(+), 1 deletion(-)
|
|
create mode 100644 hsci/Makefile
|
|
create mode 100755 hsci/hsci
|
|
create mode 100644 hsci/hsci.8
|
|
|
|
diff --git a/Makefile b/Makefile
|
|
index cc277b8e..cfbbd950 100644
|
|
--- a/Makefile
|
|
+++ b/Makefile
|
|
@@ -9,7 +9,7 @@ TOOL_DIRS = zipl zdump fdasd dasdfmt dasdview tunedasd \
|
|
vmconvert vmcp man mon_tools dasdinfo vmur cpuplugd ipl_tools \
|
|
ziomon iucvterm hyptop cmsfs-fuse qethqoat zfcpdump zdsfs cpumf \
|
|
systemd hmcdrvfs cpacfstats zdev dump2tar zkey netboot etc zpcictl \
|
|
- genprotimg lsstp
|
|
+ genprotimg lsstp hsci
|
|
|
|
SUB_DIRS = $(LIB_DIRS) $(TOOL_DIRS)
|
|
|
|
diff --git a/README.md b/README.md
|
|
index aa2188a5..581353fd 100644
|
|
--- a/README.md
|
|
+++ b/README.md
|
|
@@ -249,6 +249,9 @@ Package contents
|
|
Management Foundation - Web Edition, and is used to manage keys in an
|
|
enterprise.
|
|
|
|
+ * hsci:
|
|
+ Manage HiperSockets Converged Interfaces (HSCI).
|
|
+
|
|
For more information refer to the following publications:
|
|
|
|
* "Device Drivers, Features, and Commands" chapter "Useful Linux commands"
|
|
diff --git a/hsci/Makefile b/hsci/Makefile
|
|
new file mode 100644
|
|
index 00000000..6f7474c5
|
|
--- /dev/null
|
|
+++ b/hsci/Makefile
|
|
@@ -0,0 +1,16 @@
|
|
+include ../common.mak
|
|
+
|
|
+all:
|
|
+
|
|
+install: hsci
|
|
+ $(SED) -e 's/%S390_TOOLS_VERSION%/$(S390_TOOLS_RELEASE)/' \
|
|
+ < hsci >$(DESTDIR)$(BINDIR)/hsci; \
|
|
+ chown $(OWNER).$(GROUP) $(DESTDIR)$(BINDIR)/hsci; \
|
|
+ chmod 755 $(DESTDIR)$(BINDIR)/hsci; \
|
|
+ $(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man8
|
|
+ $(INSTALL) -g $(GROUP) -o $(OWNER) -m 644 hsci.8 \
|
|
+ $(DESTDIR)$(MANDIR)/man8
|
|
+
|
|
+clean:
|
|
+
|
|
+.PHONY: all install clean
|
|
diff --git a/hsci/hsci b/hsci/hsci
|
|
new file mode 100755
|
|
index 00000000..9a56aa0d
|
|
--- /dev/null
|
|
+++ b/hsci/hsci
|
|
@@ -0,0 +1,441 @@
|
|
+#!/bin/bash
|
|
+#
|
|
+# hsci - Tool to manage HiperSockets Converged Interfaces (HSCI)
|
|
+#
|
|
+# Copyright IBM Corp. 2020
|
|
+#
|
|
+# s390-tools is free software; you can redistribute it and/or modify
|
|
+# it under the terms of the MIT license. See LICENSE for details.
|
|
+#
|
|
+
|
|
+hsdev=""
|
|
+ndev=""
|
|
+hsci=""
|
|
+hsdev_mac=""
|
|
+hsif_pnetid=""
|
|
+netif_pnetid=""
|
|
+hsci_pnetid=""
|
|
+
|
|
+function usage {
|
|
+cat <<-EOD
|
|
+Usage: hsci COMMAND [OPTION]
|
|
+
|
|
+This tool is designed to control and show HSCI (HiperSockets Converged
|
|
+Interfaces) settings. A HiperSockets interface and an external network
|
|
+
|
|
+COMMANDS
|
|
+ add HIPERSOCKETS_DEV NET_DEV Adds an HSCI interface
|
|
+ del HSCI_NAME Deletes an HSCI interface
|
|
+ show Lists the configured HSCI interfaces
|
|
+
|
|
+OPTIONS:
|
|
+ -v, --version Prints the version number of the hsci tool and exits
|
|
+ -h, --help Displays the help information for the command
|
|
+EOD
|
|
+}
|
|
+
|
|
+function prereqs_check {
|
|
+ if ! [ -x "$(command -v ip)" ]; then
|
|
+ echo "Error: No iproute2 installed on this system" >&2
|
|
+ return 1
|
|
+ fi
|
|
+}
|
|
+
|
|
+function check_pnetids {
|
|
+ # get PNETID of the HS
|
|
+ local hsif_pnetids=""
|
|
+ local netif_pnetids=""
|
|
+
|
|
+ if [ -e /sys/class/net/$hsdev/device/util_string ]; then
|
|
+ hsif_pnetids="$(cat /sys/class/net/$hsdev/device/util_string | tr -d '\000' | iconv -f IBM-1047 -t ASCII)"
|
|
+ else
|
|
+ if [ -e /sys/class/net/$hsdev/device/chpid ]; then
|
|
+ chpid="$(cat /sys/class/net/$hsdev/device/chpid | tr [:upper:] [:lower:])"
|
|
+ hsif_pnetids="$(cat /sys/devices/css0/chp0.$chpid/util_string | tr -d '\000' | iconv -f IBM-1047 -t ASCII)"
|
|
+ fi
|
|
+ fi
|
|
+ if [ "$hsif_pnetids" != "" ]; then
|
|
+ port_hsif="$(cat /sys/class/net/$hsdev/dev_port)"
|
|
+ (( idx=16*$port_hsif+1 ))
|
|
+ (( end=$idx+15 ))
|
|
+ hsif_pnetid="$(echo "$hsif_pnetids" | cut -c $idx-$end | tr -d ' ')"
|
|
+ fi
|
|
+
|
|
+ # get PNETID of the NET_DEV
|
|
+ if [ -e /sys/class/net/$ndev/device/util_string ]; then
|
|
+ netif_pnetids="$(cat /sys/class/net/$ndev/device/util_string | tr -d '\000' | iconv -f IBM-1047 -t ASCII)"
|
|
+ else
|
|
+ if [ -e /sys/class/net/$ndev/device/chpid ]; then
|
|
+ chpid="$(cat /sys/class/net/$ndev/device/chpid | tr [:upper:] [:lower:])"
|
|
+ netif_pnetids="$(cat /sys/devices/css0/chp0.$chpid/util_string | tr -d '\000' | iconv -f IBM-1047 -t ASCII)"
|
|
+ fi
|
|
+ fi
|
|
+ if [ "$netif_pnetids" != "" ]; then
|
|
+ port_netif="$(cat /sys/class/net/$ndev/dev_port)"
|
|
+ (( idx=16*$port_netif+1 ))
|
|
+ (( end=$idx+15 ))
|
|
+ netif_pnetid="$(echo "$netif_pnetids" | cut -c $idx-$end | tr -d ' ')"
|
|
+ fi
|
|
+
|
|
+ #Check PNETIDs
|
|
+ if [ "$hsif_pnetid" != "" ] && [ "$netif_pnetid" != "" ] && [ "$netif_pnetid" != "$hsif_pnetid" ]; then
|
|
+ echo "Error: $hsdev and $ndev have different PNETIDs! They are $hsif_pnetid and $netif_pnetid respectively" >&2
|
|
+ return 1
|
|
+ fi
|
|
+
|
|
+ if [ "$hsif_pnetid" != "" ] && [ "$netif_pnetid" != "" ] && [ "$netif_pnetid" == "$hsif_pnetid" ]; then
|
|
+ hsci_pnetid=$hsif_pnetid
|
|
+ fi
|
|
+}
|
|
+
|
|
+function verify_precon {
|
|
+ echo "Verifying net dev $ndev and HiperSockets dev $hsdev"
|
|
+
|
|
+ if [ ! -e /sys/class/net/$hsdev ]; then
|
|
+ echo "Error: $hsdev does not exist" >&2
|
|
+ return 1
|
|
+ fi
|
|
+ if [ "$(cat /sys/class/net/$hsdev/device/card_type)" != "HiperSockets" ]; then
|
|
+ echo "Error: $hsdev is not a HiperSockets device" >&2
|
|
+ return 1
|
|
+ fi
|
|
+ if [ "$(cat /sys/class/net/$hsdev/device/layer2)" != "1" ]; then
|
|
+ echo "Error: $hsdev is not in layer 2 mode" >&2
|
|
+ return 1
|
|
+ fi
|
|
+ if [ ! -e /sys/class/net/$hsdev/device/vnicc/bridge_invisible ]; then
|
|
+ echo "Error: Missing vnic-characteristics support" >&2
|
|
+ return 1
|
|
+ fi
|
|
+ if [ "$(cat /sys/class/net/$hsdev/device/vnicc/bridge_invisible)" == "n/a" ]; then
|
|
+ echo "Error: $hsdev does not support vnicc" >&2
|
|
+ return 1
|
|
+ fi
|
|
+ if [ $(ip link show $hsdev | grep UP | wc -l) -eq 0 ]; then
|
|
+ echo "Error: $hsdev is not in state UP" >&2
|
|
+ return 1
|
|
+ fi
|
|
+ if [ $(bridge -d link show dev $hsdev self | grep learning_sync | wc -l) -eq 0 ]; then
|
|
+ echo "Error: $hsdev does not support attribute learning_sync" >&2
|
|
+ return 1
|
|
+ fi
|
|
+ if [ $(ip link show $hsdev | grep master | wc -l) -ne 0 ]; then
|
|
+ echo "Error: $hsdev is already a bridge port" >&2
|
|
+ return 1
|
|
+ fi
|
|
+
|
|
+ #Pre-verify net_dev
|
|
+ if [ ! -e /sys/class/net/$ndev ]; then
|
|
+ echo "Error: $ndev does not exist" >&2
|
|
+ return 1
|
|
+ fi
|
|
+ if [ "$(cat /sys/class/net/$ndev/device/card_type)" == "HiperSockets" ]; then
|
|
+ echo "Error: $ndev is also a HiperSockets device" >&2
|
|
+ return 1
|
|
+ fi
|
|
+ if [ $(ip link show $ndev | grep UP | wc -l) -eq 0 ]; then
|
|
+ echo "Error: $ndev is not in state UP" >&2
|
|
+ return 1
|
|
+ fi
|
|
+ if [ $(ip link show $ndev | grep master | wc -l) -ne 0 ]; then
|
|
+ echo "Error: $ndev is already a bridge port" >&2
|
|
+ return 1
|
|
+ fi
|
|
+
|
|
+ #Check PNETIDs
|
|
+ check_pnetids
|
|
+ if [ $? -ne 0 ]; then
|
|
+ return $?
|
|
+ fi
|
|
+
|
|
+ return 0
|
|
+}
|
|
+
|
|
+function clean_up {
|
|
+ bridge link set dev $hsdev learning_sync off self >/dev/null 2>&1
|
|
+ echo 0 > /sys/class/net/$hsdev/device/vnicc/bridge_invisible >/dev/null 2>&1
|
|
+ bridge fdb del $hsdev_mac dev $ndev >/dev/null 2>&1
|
|
+ ip link del $hsci >/dev/null 2>&1
|
|
+}
|
|
+
|
|
+##############################################################################
|
|
+## add a new HSCI interface
|
|
+##############################################################################
|
|
+function add_hsci {
|
|
+
|
|
+ if [ $# != 2 ]; then
|
|
+ echo "hsci: Invalid parameters" >&2
|
|
+ echo "Use 'hsci --help' for more information" >&2
|
|
+ return 1
|
|
+ fi
|
|
+ hsdev=$1
|
|
+ ndev=$2
|
|
+
|
|
+ #### Verify preconditions
|
|
+ verify_precon
|
|
+ if [ $? -ne 0 ]; then
|
|
+ return $?
|
|
+ fi
|
|
+
|
|
+ hsci_postfix="$(readlink /sys/class/net/$hsdev/device/cdev0 | tail -c5)"
|
|
+ hsci=hsci$hsci_postfix
|
|
+
|
|
+ echo "Adding $hsci with a HiperSockets dev $hsdev and an external dev $ndev"
|
|
+
|
|
+ #### Create bridge
|
|
+ ip link add name $hsci type bridge stp_state 0 >/dev/null 2>&1
|
|
+ if [ $? -ne 0 ]; then
|
|
+ echo "Error: Could not create a bridge" >&2
|
|
+ return 1
|
|
+ fi
|
|
+
|
|
+ #### Prepare hsdev
|
|
+ # Set VNICC of hsdev to invisible
|
|
+ #(mandatory for co-existence with HS-OSA bridges!)
|
|
+ echo 1 > /sys/class/net/$hsdev/device/vnicc/bridge_invisible
|
|
+
|
|
+ #### Create bridge ports
|
|
+ ip link set dev $ndev master $hsci >/dev/null 2>&1
|
|
+ if [ $? -ne 0 ]; then
|
|
+ echo "Error: Could not set master for $ndev" >&2
|
|
+ clean_up
|
|
+ return 1
|
|
+ fi
|
|
+ ip link set dev $hsdev master $hsci >/dev/null 2>&1
|
|
+ if [ $? -ne 0 ]; then
|
|
+ echo "Error: Could not set master for $hsdev" >&2
|
|
+ clean_up
|
|
+ return 1
|
|
+ fi
|
|
+
|
|
+ # no forwarding between ndev and hsdev -> isolated on
|
|
+ # ndev is default for outgoing unknown targets -> flood on
|
|
+ # no need to learn external LAN targets into fdb -> learning off
|
|
+ bridge link set dev $ndev isolated on learning off flood on mcast_flood on >/dev/null 2>&1
|
|
+ if [ $? -ne 0 ]; then
|
|
+ echo "Error: Failed to set bridge attributes on $ndev" >&2
|
|
+ clean_up
|
|
+ return 1
|
|
+ fi
|
|
+
|
|
+ # no forwarding between ndev and hsdev -> isolated on
|
|
+ # fdb will be populated by dev-to-bridge-notification, no need to learn
|
|
+ # -> learning off
|
|
+ # only send to hsdev, if listed in fdb -> flood off
|
|
+ # don't send MC/BC on hsdev -> mcast_flood off
|
|
+ bridge link set dev $hsdev isolated on learning off flood off mcast_flood off >/dev/null 2>&1
|
|
+ if [ $? -ne 0 ]; then
|
|
+ echo "Error: Failed to set bridge attributes on $hsdev" >&2
|
|
+ clean_up
|
|
+ return 1
|
|
+ fi
|
|
+
|
|
+ # NOTE: Although not required, BCs will be sent out on hsdev.
|
|
+ # NOTE: We need to receive BCs on hsdev, as z/OS HSCI does ARP requests on HS.
|
|
+
|
|
+ hsdev_mac="$(cat /sys/class/net/$hsdev/address)"
|
|
+ echo "Set $hsdev MAC $hsdev_mac on $ndev and $hsci"
|
|
+
|
|
+ # set HS MAC on OSA as secondary MAC
|
|
+ bridge fdb add $hsdev_mac dev $ndev >/dev/null 2>&1
|
|
+ if [ $? -ne 0 ]; then
|
|
+ echo "Error: Failed to set HS MAC on OSA as secondary MAC" >&2
|
|
+ clean_up
|
|
+ return 1
|
|
+ fi
|
|
+
|
|
+ # set HS MAC (common MAC) on HSCI as primary MAC
|
|
+ ip link set address $hsdev_mac dev $hsci >/dev/null 2>&1
|
|
+ if [ $? -ne 0 ]; then
|
|
+ echo "Error: Failed to set HiperSockets MAC (common MAC) on HSCI as primary MAC" >&2
|
|
+ clean_up
|
|
+ return 1
|
|
+ fi
|
|
+
|
|
+ # use hsdev MTU
|
|
+ if [ -e /sys/class/net/$hsdev/mtu ]; then
|
|
+ hs_mtu="$(cat /sys/class/net/$hsdev/mtu)"
|
|
+ ip link set dev $hsci mtu $hs_mtu >/dev/null 2>&1
|
|
+ if [ $? -ne 0 ]; then
|
|
+ echo "Error: Failed to set MTU for $hsci " >&2
|
|
+ clean_up
|
|
+ return 1
|
|
+ fi
|
|
+ fi
|
|
+ ip link set dev $hsci up >/dev/null 2>&1
|
|
+ if [ $? -ne 0 ]; then
|
|
+ echo "Error: Failed to set $hsci up" >&2
|
|
+ clean_up
|
|
+ return 1
|
|
+ fi
|
|
+
|
|
+ # Turn on device for bridge notification
|
|
+ bridge link set dev $hsdev learning_sync on self >/dev/null 2>&1
|
|
+ if [ $? -ne 0 ]; then
|
|
+ echo "Error: Failed to turn on device for bridge notification" >&2
|
|
+ clean_up
|
|
+ return 1
|
|
+ fi
|
|
+ echo "Successfully added HSCI interface $hsci"
|
|
+ return 0
|
|
+}
|
|
+
|
|
+##############################################################################
|
|
+## Delete HSCI
|
|
+##############################################################################
|
|
+
|
|
+function del_hsci {
|
|
+ if [ $# != 1 ]; then
|
|
+ echo "hsci: invalid parameters" >&2
|
|
+ echo "Use 'hsci --help' for more information" >&2
|
|
+ return 1
|
|
+ fi
|
|
+ hsci=$1
|
|
+ if [ $(ip link show dev $hsci | wc -l) -eq 0 ]; then
|
|
+ echo "Error: $hsci does not exit" >&2
|
|
+ return 1
|
|
+ fi
|
|
+ if [ $(ip link show | grep "master $hsci" | wc -l) -eq 0 ]; then
|
|
+ echo "Error: $hsci is not an active HSCI interface" >&2
|
|
+ return 1
|
|
+ fi
|
|
+
|
|
+ bports="$(ip link show | grep "master $hsci" | awk '{print $2}')"
|
|
+ for bport in $bports; do
|
|
+ if [ $(bridge -d link show dev $bport | grep "learning_sync on" | wc -l) -ne 0 ]; then
|
|
+ hsdev=${bport%:}
|
|
+ else
|
|
+ ndev=${bport%:}
|
|
+ fi
|
|
+ done
|
|
+ if [ "$hsdev" == "" ]; then
|
|
+ echo "Error: $hsci has no active HiperSockets port" >&2
|
|
+ return 1
|
|
+ fi
|
|
+ echo "Deleting HSCI interface $hsci with the HiperSockets $hsdev and the external $ndev"
|
|
+
|
|
+ bridge link set dev $hsdev learning_sync off self >/dev/null 2>&1
|
|
+ if [ $? -ne 0 ]; then
|
|
+ echo "Error: Failed to turn off learning_sync on $hsdev" >&2
|
|
+ return 1
|
|
+ fi
|
|
+ echo 0 > /sys/class/net/$hsdev/device/vnicc/bridge_invisible
|
|
+
|
|
+ hsdev_mac="$(cat /sys/class/net/$hsdev/address)"
|
|
+ echo "Deleting $hsev MAC $hsdev_mac on $ndev"
|
|
+ bridge fdb del $hsdev_mac dev $ndev >/dev/null 2>&1
|
|
+ if [ $? -ne 0 ]; then
|
|
+ echo "Error: Failed to delete $hsev MAC $hsdev_mac on $ndev" >&2
|
|
+ return 1
|
|
+ fi
|
|
+
|
|
+ ip link del $hsci >/dev/null 2>&1
|
|
+ if [ $? -ne 0 ]; then
|
|
+ echo "Error: Failed to delete $hsci" >&2
|
|
+ return 1
|
|
+ fi
|
|
+ echo "Successfully deleted device $hsci"
|
|
+
|
|
+ return 0
|
|
+}
|
|
+
|
|
+##############################################################################
|
|
+## Show HSCI
|
|
+##############################################################################
|
|
+
|
|
+function list_active {
|
|
+ hsdev=$1
|
|
+ local ext=""
|
|
+
|
|
+ hsci="$(ip link show dev $hsdev | awk '{for(x=1;x<NF;x++) if($x~/master/) print $(x+1)}')"
|
|
+ ext="$(ip link show | grep "master $hsci" | grep --invert-match $hsdev | awk '{print $2}')"
|
|
+ # remove trailing ':'
|
|
+ ndev="${ext%:}"
|
|
+
|
|
+ check_pnetids
|
|
+
|
|
+ printf '%-8s %-16s %-15s %-15s\n' "$hsci" "$hsci_pnetid" "$hsdev" "$ndev"
|
|
+
|
|
+ return 0
|
|
+}
|
|
+
|
|
+function print_header {
|
|
+ if [ $header -eq 0 ]; then
|
|
+ echo "HSCI PNET_ID HiperSockets External "
|
|
+ echo "------------------------------------------------------------"
|
|
+ fi
|
|
+}
|
|
+
|
|
+function list_one {
|
|
+ local hsnetdev=$1
|
|
+
|
|
+ if [ $(bridge -d link show dev $hsnetdev | grep "learning_sync on" | wc -l) -ne 0 ]; then
|
|
+ print_header
|
|
+ list_active $hsnetdev
|
|
+ fi
|
|
+
|
|
+ return 0
|
|
+}
|
|
+
|
|
+function show_hsci {
|
|
+ if [ $# != 0 ]; then
|
|
+ echo "hsci: invalid parameters" >&2
|
|
+ echo "Use 'hsci --help' for more information" >&2
|
|
+ return 1
|
|
+ fi
|
|
+ header=0
|
|
+
|
|
+ for hs_net_dev in $(ls -1 /sys/class/net/); do
|
|
+ list_one $hs_net_dev
|
|
+ done
|
|
+
|
|
+ return 0
|
|
+}
|
|
+
|
|
+#==============================================================================
|
|
+
|
|
+function print_version()
|
|
+{
|
|
+ echo "hsci utility: version %S390_TOOLS_VERSION%"
|
|
+ echo "Copyright IBM Corp. 2020"
|
|
+}
|
|
+
|
|
+##############################################################################
|
|
+##### Main
|
|
+##############################################################################
|
|
+prereqs_check
|
|
+
|
|
+args="$(getopt -u -o hv -l help,version -- $*)"
|
|
+[ $? -ne 0 ] && exit 2
|
|
+set -- $args
|
|
+while true; do
|
|
+ case $1 in
|
|
+ -v | --version)
|
|
+ print_version
|
|
+ exit 0
|
|
+ ;;
|
|
+ -h | --help)
|
|
+ usage
|
|
+ exit 0
|
|
+ ;;
|
|
+ --)
|
|
+ ;;
|
|
+ add) shift
|
|
+ add_hsci "$@"
|
|
+ exit $?
|
|
+ ;;
|
|
+ del) shift
|
|
+ del_hsci "$@"
|
|
+ exit $?
|
|
+ ;;
|
|
+ show) shift
|
|
+ show_hsci "$@"
|
|
+ exit $?
|
|
+ ;;
|
|
+ *) echo "hsci: Please specify a valid command or option" >&2
|
|
+ echo "Use 'hsci --help' for more information" >&2
|
|
+ exit 1
|
|
+ esac
|
|
+ shift
|
|
+done
|
|
+
|
|
diff --git a/hsci/hsci.8 b/hsci/hsci.8
|
|
new file mode 100644
|
|
index 00000000..fc170532
|
|
--- /dev/null
|
|
+++ b/hsci/hsci.8
|
|
@@ -0,0 +1,100 @@
|
|
+.\" Copyright IBM Corp. 2020
|
|
+
|
|
+.TH HSCI 8 "November 2020" "s390-tools" "Linux Programmer's Manual"
|
|
+
|
|
+
|
|
+.SH NAME
|
|
+.B hsci
|
|
+\- control and show HSCI settings.
|
|
+
|
|
+
|
|
+.SH SYNOPSIS
|
|
+.B hsci add
|
|
+.I HSDEV
|
|
+.I NETDEV
|
|
+.br
|
|
+.B hsci del
|
|
+.I HSCINAME
|
|
+.br
|
|
+.B hsci show
|
|
+.br
|
|
+.B hsci [\-hv]
|
|
+
|
|
+.SH DESCRIPTION
|
|
+.BI hsci
|
|
+is used to control and show HSCI (HiperSockets Converged Interfaces) settings. A HiperSockets interface and an external network interface are converged into an HSCI interface.
|
|
+
|
|
+.SH COMMANDS
|
|
+.TP
|
|
+.B add \fIHSDEV\fR \fINETDEV\fR
|
|
+.RS .4i
|
|
+.PP
|
|
+Adds an HSCI interface
|
|
+.PP
|
|
+.I HSDEV
|
|
+is the interface name of the HiperSockets device to be converged into the HSCI interface.
|
|
+.PP
|
|
+.I NETDEV
|
|
+is the interface name of the external network device to be converged into the HSCI interface.
|
|
+.RE
|
|
+
|
|
+.TP
|
|
+.B del \fIHSCINAME\fR
|
|
+.RS .4i
|
|
+.PP
|
|
+Deletes an HSCI interface
|
|
+.PP
|
|
+.I HSCINAME
|
|
+is the name of the HSCI interface for the HiperSockets device and the external network device.
|
|
+.RE
|
|
+
|
|
+.TP
|
|
+.B show
|
|
+.RS .4i
|
|
+.PP
|
|
+Lists the configured HSCI interfaces.
|
|
+.RE
|
|
+
|
|
+.SH OPTIONS
|
|
+.TP
|
|
+.BR \-v ", " \-\-version
|
|
+Prints the version number of hsci and exits.
|
|
+.TP
|
|
+.BR \-h ", " \-\-help
|
|
+Displays the help information for the command.
|
|
+
|
|
+.SH EXIT CODES
|
|
+.TP
|
|
+.BR "0"
|
|
+The hsci command ran successfully.
|
|
+
|
|
+.TP
|
|
+.BR "1"
|
|
+An error occurred.
|
|
+
|
|
+.SH EXAMPLE
|
|
+.BR "hsci show"
|
|
+.TP
|
|
+.RB
|
|
+Lists the configured HSCI interfaces:
|
|
+.RS 1.2i
|
|
+
|
|
+HSCI PNET_ID HiperSockets External
|
|
+.br
|
|
+-----------------------------------------
|
|
+.br
|
|
+hsci8410 NET1 enc8410 encb040
|
|
+
|
|
+.RE
|
|
+
|
|
+.SH SEE ALSO
|
|
+.nf
|
|
+ip(8), bridge(8)
|
|
+.fi
|
|
+
|
|
+.SH AUTHOR
|
|
+.nf
|
|
+Written by Alexandra Winter <wintera@linux.ibm.com>
|
|
+ Wenjia Zhang <wenjia@linux.ibm.com>
|
|
+.fi
|
|
+
|
|
--
|
|
2.17.1
|
|
|