summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2018-10-11 13:43:06 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2018-10-11 13:43:06 +0000
commit245c5e733cb4161ea3ba9f516ee25b41621cb81c (patch)
tree6e42160d15aeacbbe36692391ab07e21f26d54ce
parent33e0c5714b4f9d45a34618dadc55f6b248aeef74 (diff)
parent5267591016146502784860802129b16dab6f135c (diff)
downloadillumos-joyent-245c5e733cb4161ea3ba9f516ee25b41621cb81c.tar.gz
[illumos-gate merge]
commit 5267591016146502784860802129b16dab6f135c 9466 add JSON output support to channel programs commit b68ddc76a8be9a9b8d7a1eae3a3613b6bce942e5 9724 qede needs updates for newer GCC Conflicts: exception_lists/wscheck
-rw-r--r--exception_lists/wscheck1
-rw-r--r--usr/src/cmd/zfs/zfs_main.c22
-rw-r--r--usr/src/man/man1m/zfs-program.1m8
-rw-r--r--usr/src/man/man1m/zfs.1m10
-rw-r--r--usr/src/pkg/manifests/system-test-zfstest.mf7
-rw-r--r--usr/src/test/zfs-tests/runfiles/delphix.run3
-rw-r--r--usr/src/test/zfs-tests/runfiles/omnios.run3
-rw-r--r--usr/src/test/zfs-tests/runfiles/openindiana.run3
-rw-r--r--usr/src/test/zfs-tests/tests/functional/cli_root/zfs_program/Makefile21
-rw-r--r--usr/src/test/zfs-tests/tests/functional/cli_root/zfs_program/cleanup.ksh30
-rw-r--r--usr/src/test/zfs-tests/tests/functional/cli_root/zfs_program/setup.ksh32
-rw-r--r--usr/src/test/zfs-tests/tests/functional/cli_root/zfs_program/zfs_program_json.ksh161
-rw-r--r--usr/src/uts/common/io/qede/579xx/drivers/ecore/ecore_dcbx.c8
-rw-r--r--usr/src/uts/common/io/qede/579xx/drivers/ecore/ecore_mcp.c14
-rw-r--r--usr/src/uts/common/io/qede/579xx/drivers/ecore/ecore_phy.c6
-rw-r--r--usr/src/uts/common/io/qede/qede_gld.c32
16 files changed, 322 insertions, 39 deletions
diff --git a/exception_lists/wscheck b/exception_lists/wscheck
index 7d0795bc7f..cd76277d9c 100644
--- a/exception_lists/wscheck
+++ b/exception_lists/wscheck
@@ -96,3 +96,4 @@ usr/src/uts/i86pc/io/vmm/x86.[ch]
usr/src/uts/i86pc/sys/vmm.h
usr/src/uts/i86pc/sys/vmm_dev.h
usr/src/uts/i86pc/sys/vmm_instruction_emul.h
+usr/src/uts/common/io/qede/*
diff --git a/usr/src/cmd/zfs/zfs_main.c b/usr/src/cmd/zfs/zfs_main.c
index d9f253fbf8..e1dde9861f 100644
--- a/usr/src/cmd/zfs/zfs_main.c
+++ b/usr/src/cmd/zfs/zfs_main.c
@@ -29,6 +29,7 @@
* Copyright (c) 2014 Integros [integros.com]
* Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>.
* Copyright 2016 Nexenta Systems, Inc.
+ * Copyright (c) 2018 Datto Inc.
*/
#include <assert.h>
@@ -335,7 +336,7 @@ get_usage(zfs_help_t idx)
case HELP_BOOKMARK:
return (gettext("\tbookmark <snapshot> <bookmark>\n"));
case HELP_CHANNEL_PROGRAM:
- return (gettext("\tprogram [-n] [-t <instruction limit>] "
+ return (gettext("\tprogram [-jn] [-t <instruction limit>] "
"[-m <memory limit (b)>] <pool> <program file> "
"[lua args...]\n"));
}
@@ -7179,12 +7180,12 @@ zfs_do_channel_program(int argc, char **argv)
nvlist_t *outnvl;
uint64_t instrlimit = ZCP_DEFAULT_INSTRLIMIT;
uint64_t memlimit = ZCP_DEFAULT_MEMLIMIT;
- boolean_t sync_flag = B_TRUE;
+ boolean_t sync_flag = B_TRUE, json_output = B_FALSE;
zpool_handle_t *zhp;
/* check options */
while (-1 !=
- (c = getopt(argc, argv, "nt:(instr-limit)m:(memory-limit)"))) {
+ (c = getopt(argc, argv, "jnt:(instr-limit)m:(memory-limit)"))) {
switch (c) {
case 't':
case 'm': {
@@ -7226,6 +7227,10 @@ zfs_do_channel_program(int argc, char **argv)
sync_flag = B_FALSE;
break;
}
+ case 'j': {
+ json_output = B_TRUE;
+ break;
+ }
case '?':
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
optopt);
@@ -7344,11 +7349,14 @@ zfs_do_channel_program(int argc, char **argv)
gettext("Channel program execution failed:\n%s\n"),
errstring);
} else {
- (void) printf("Channel program fully executed ");
- if (nvlist_empty(outnvl)) {
- (void) printf("with no return value.\n");
+ if (json_output) {
+ (void) nvlist_print_json(stdout, outnvl);
+ } else if (nvlist_empty(outnvl)) {
+ (void) fprintf(stdout, gettext("Channel program fully "
+ "executed and did not produce output.\n"));
} else {
- (void) printf("with return value:\n");
+ (void) fprintf(stdout, gettext("Channel program fully "
+ "executed and produced output:\n"));
dump_nvlist(outnvl, 4);
}
}
diff --git a/usr/src/man/man1m/zfs-program.1m b/usr/src/man/man1m/zfs-program.1m
index abd93a5a73..cf617136bd 100644
--- a/usr/src/man/man1m/zfs-program.1m
+++ b/usr/src/man/man1m/zfs-program.1m
@@ -9,6 +9,7 @@
.\"
.\"
.\" Copyright (c) 2016, 2017 by Delphix. All rights reserved.
+.\" Copyright (c) 2018 Datto Inc.
.\"
.Dd January 21, 2016
.Dt ZFS-PROGRAM 1M
@@ -18,7 +19,7 @@
.Nd executes ZFS channel programs
.Sh SYNOPSIS
.Cm "zfs program"
-.Op Fl n
+.Op Fl jn
.Op Fl t Ar instruction-limit
.Op Fl m Ar memory-limit
.Ar pool
@@ -46,6 +47,11 @@ will be run on
and any attempts to access or modify other pools will cause an error.
.Sh OPTIONS
.Bl -tag -width "-t"
+.It Fl j
+Display channel program output in JSON format.
+When this flag is specified and standard output is empty -
+channel program encountered an error.
+The details of such an error will be printed to standard error in plain text.
.It Fl n
Executes a read-only channel program, which runs faster.
The program cannot change on-disk state by calling functions from the
diff --git a/usr/src/man/man1m/zfs.1m b/usr/src/man/man1m/zfs.1m
index 22d6c98310..7701f54966 100644
--- a/usr/src/man/man1m/zfs.1m
+++ b/usr/src/man/man1m/zfs.1m
@@ -28,6 +28,7 @@
.\" Copyright (c) 2014 Integros [integros.com]
.\" Copyright 2018 Nexenta Systems, Inc.
.\" Copyright 2018 Joyent, Inc.
+.\" Copyright (c) 2018 Datto Inc.
.\"
.Dd Feb 10, 2018
.Dt ZFS 1M
@@ -271,7 +272,7 @@
.Ar snapshot Ar snapshot Ns | Ns Ar filesystem
.Nm
.Cm program
-.Op Fl n
+.Op Fl jn
.Op Fl t Ar timeout
.Op Fl m Ar memory_limit
.Ar pool script
@@ -3475,7 +3476,7 @@ Display the path's inode change time as the first column of output.
.It Xo
.Nm
.Cm program
-.Op Fl n
+.Op Fl jn
.Op Fl t Ar timeout
.Op Fl m Ar memory_limit
.Ar pool script
@@ -3496,6 +3497,11 @@ Channel programs may only be run with root privileges.
For full documentation of the ZFS channel program interface, see the manual
page for
.Bl -tag -width ""
+.It Fl j
+Display channel program output in JSON format.
+When this flag is specified and standard output is empty -
+channel program encountered an error.
+The details of such an error will be printed to standard error in plain text.
.It Fl n
Executes a read-only channel program, which runs faster.
The program cannot change on-disk state by calling functions from
diff --git a/usr/src/pkg/manifests/system-test-zfstest.mf b/usr/src/pkg/manifests/system-test-zfstest.mf
index a009ec8392..ccd9d94f48 100644
--- a/usr/src/pkg/manifests/system-test-zfstest.mf
+++ b/usr/src/pkg/manifests/system-test-zfstest.mf
@@ -14,6 +14,7 @@
# Copyright 2015, 2016 Nexenta Systems, Inc. All rights reserved.
# Copyright 2016, OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright 2018 Joyent, Inc.
+# Copyright (c) 2018 Datto Inc.
#
set name=pkg.fmri value=pkg:/system/test/zfstest@$(PKGVERS)
@@ -53,6 +54,7 @@ dir path=opt/zfs-tests/tests/functional/cli_root/zfs_destroy
dir path=opt/zfs-tests/tests/functional/cli_root/zfs_get
dir path=opt/zfs-tests/tests/functional/cli_root/zfs_inherit
dir path=opt/zfs-tests/tests/functional/cli_root/zfs_mount
+dir path=opt/zfs-tests/tests/functional/cli_root/zfs_program
dir path=opt/zfs-tests/tests/functional/cli_root/zfs_promote
dir path=opt/zfs-tests/tests/functional/cli_root/zfs_property
dir path=opt/zfs-tests/tests/functional/cli_root/zfs_receive
@@ -879,6 +881,11 @@ file path=opt/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_all_fail \
file \
path=opt/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_all_mountpoints \
mode=0555
+file path=opt/zfs-tests/tests/functional/cli_root/zfs_program/cleanup \
+ mode=0555
+file path=opt/zfs-tests/tests/functional/cli_root/zfs_program/setup mode=0555
+file path=opt/zfs-tests/tests/functional/cli_root/zfs_program/zfs_program_json \
+ mode=0555
file path=opt/zfs-tests/tests/functional/cli_root/zfs_promote/cleanup \
mode=0555
file path=opt/zfs-tests/tests/functional/cli_root/zfs_promote/setup mode=0555
diff --git a/usr/src/test/zfs-tests/runfiles/delphix.run b/usr/src/test/zfs-tests/runfiles/delphix.run
index 3210452f70..fac8836b72 100644
--- a/usr/src/test/zfs-tests/runfiles/delphix.run
+++ b/usr/src/test/zfs-tests/runfiles/delphix.run
@@ -147,6 +147,9 @@ tests = ['zfs_mount_001_pos', 'zfs_mount_002_pos', 'zfs_mount_003_pos',
'zfs_mount_010_neg', 'zfs_mount_011_neg', 'zfs_mount_012_neg',
'zfs_mount_all_001_pos', 'zfs_mount_all_fail', 'zfs_mount_all_mountpoints']
+[/opt/zfs-tests/tests/functional/cli_root/zfs_program]
+tests = ['zfs_program_json']
+
[/opt/zfs-tests/tests/functional/cli_root/zfs_promote]
tests = ['zfs_promote_001_pos', 'zfs_promote_002_pos', 'zfs_promote_003_pos',
'zfs_promote_004_pos', 'zfs_promote_005_pos', 'zfs_promote_006_neg',
diff --git a/usr/src/test/zfs-tests/runfiles/omnios.run b/usr/src/test/zfs-tests/runfiles/omnios.run
index eb14376f64..761e06c1cf 100644
--- a/usr/src/test/zfs-tests/runfiles/omnios.run
+++ b/usr/src/test/zfs-tests/runfiles/omnios.run
@@ -140,6 +140,9 @@ tests = ['zfs_mount_001_pos', 'zfs_mount_002_pos', 'zfs_mount_003_pos',
'zfs_mount_007_pos', 'zfs_mount_008_pos', 'zfs_mount_009_neg',
'zfs_mount_010_neg', 'zfs_mount_011_neg', 'zfs_mount_all_001_pos']
+[/opt/zfs-tests/tests/functional/cli_root/zfs_program]
+tests = ['zfs_program_json']
+
[/opt/zfs-tests/tests/functional/cli_root/zfs_promote]
tests = ['zfs_promote_001_pos', 'zfs_promote_002_pos', 'zfs_promote_003_pos',
'zfs_promote_004_pos', 'zfs_promote_005_pos', 'zfs_promote_006_neg',
diff --git a/usr/src/test/zfs-tests/runfiles/openindiana.run b/usr/src/test/zfs-tests/runfiles/openindiana.run
index 71096bdbdc..5c6d853984 100644
--- a/usr/src/test/zfs-tests/runfiles/openindiana.run
+++ b/usr/src/test/zfs-tests/runfiles/openindiana.run
@@ -140,6 +140,9 @@ tests = ['zfs_mount_001_pos', 'zfs_mount_002_pos', 'zfs_mount_003_pos',
'zfs_mount_007_pos', 'zfs_mount_008_pos', 'zfs_mount_009_neg',
'zfs_mount_010_neg', 'zfs_mount_011_neg', 'zfs_mount_all_001_pos']
+[/opt/zfs-tests/tests/functional/cli_root/zfs_program]
+tests = ['zfs_program_json']
+
[/opt/zfs-tests/tests/functional/cli_root/zfs_promote]
tests = ['zfs_promote_001_pos', 'zfs_promote_002_pos', 'zfs_promote_003_pos',
'zfs_promote_004_pos', 'zfs_promote_005_pos', 'zfs_promote_006_neg',
diff --git a/usr/src/test/zfs-tests/tests/functional/cli_root/zfs_program/Makefile b/usr/src/test/zfs-tests/tests/functional/cli_root/zfs_program/Makefile
new file mode 100644
index 0000000000..92ca8e3e10
--- /dev/null
+++ b/usr/src/test/zfs-tests/tests/functional/cli_root/zfs_program/Makefile
@@ -0,0 +1,21 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright (c) 2018 Datto Inc.
+#
+
+include $(SRC)/Makefile.master
+
+ROOTOPTPKG = $(ROOT)/opt/zfs-tests
+TARGETDIR = $(ROOTOPTPKG)/tests/functional/cli_root/zfs_program
+
+include $(SRC)/test/zfs-tests/Makefile.com
diff --git a/usr/src/test/zfs-tests/tests/functional/cli_root/zfs_program/cleanup.ksh b/usr/src/test/zfs-tests/tests/functional/cli_root/zfs_program/cleanup.ksh
new file mode 100644
index 0000000000..37874e70a7
--- /dev/null
+++ b/usr/src/test/zfs-tests/tests/functional/cli_root/zfs_program/cleanup.ksh
@@ -0,0 +1,30 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or https://opensource.org/licenses/CDDL-1.0
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, usr/src/common/zfs this CDDL HEADER in each
+# file and usr/src/common/zfs the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+default_cleanup
diff --git a/usr/src/test/zfs-tests/tests/functional/cli_root/zfs_program/setup.ksh b/usr/src/test/zfs-tests/tests/functional/cli_root/zfs_program/setup.ksh
new file mode 100644
index 0000000000..364922b213
--- /dev/null
+++ b/usr/src/test/zfs-tests/tests/functional/cli_root/zfs_program/setup.ksh
@@ -0,0 +1,32 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or https://opensource.org/licenses/CDDL-1.0
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, usr/src/common/zfs this CDDL HEADER in each
+# file and usr/src/common/zfs the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+DISK=${DISKS%% *}
+
+default_setup $DISK
diff --git a/usr/src/test/zfs-tests/tests/functional/cli_root/zfs_program/zfs_program_json.ksh b/usr/src/test/zfs-tests/tests/functional/cli_root/zfs_program/zfs_program_json.ksh
new file mode 100644
index 0000000000..cc6e3281ab
--- /dev/null
+++ b/usr/src/test/zfs-tests/tests/functional/cli_root/zfs_program/zfs_program_json.ksh
@@ -0,0 +1,161 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy is of the CDDL is also available via the Internet
+# at http://www.illumos.org/license/CDDL.
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2018 Datto Inc.
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+#
+# DESCRIPTION:
+#
+# STRATEGY:
+# 1. Ensure empty JSON is printed when there is no channel program output
+# 2. Compare JSON output formatting for a channel program to template
+# 3. Using bad command line option (-Z) gives correct error output
+#
+
+verify_runnable "both"
+
+function cleanup
+{
+ log_must zfs destroy -r $TESTDS
+ return 0
+}
+log_onexit cleanup
+
+log_assert "Channel programs output valid JSON"
+
+TESTDS="$TESTPOOL/zcp-json"
+TESTSNAP="$TESTDS@snap0"
+log_must zfs create $TESTDS
+
+# 1. Ensure empty JSON is printed when there is no channel program output
+TESTZCP="/$TESTDS/zfs_destroy.zcp"
+cat > "$TESTZCP" << EOF
+ args = ...
+ argv = args["argv"]
+ zfs.sync.destroy(argv[1])
+EOF
+
+EMPTY_OUTPUT=("{}")
+log_must zfs snap $TESTSNAP 2>&1
+log_must zfs list $TESTSNAP 2>&1
+log_must zfs program $TESTPOOL $TESTZCP $TESTSNAP 2>&1
+log_mustnot zfs list $TESTSNAP 2>&1
+log_must zfs snap $TESTSNAP 2>&1
+log_must zfs list $TESTSNAP 2>&1
+log_must zfs program -j $TESTPOOL $TESTZCP $TESTSNAP 2>&1
+log_mustnot zfs list $TESTSNAP 2>&1
+log_must zfs snap $TESTSNAP 2>&1
+log_must zfs list $TESTSNAP 2>&1
+OUTPUT=$(zfs program -j $TESTPOOL $TESTZCP $TESTSNAP 2>&1)
+if [ "$OUTPUT" != "$EMPTY_OUTPUT" ]; then
+ log_note "Got :$OUTPUT"
+ log_note "Expected:$EMPTY_OUTPUT"
+ log_fail "Channel program output not empty";
+fi
+log_mustnot zfs list $TESTSNAP 2>&1
+
+# 2. Compare JSON output formatting for a channel program to template
+TESTZCP="/$TESTDS/zfs_rlist.zcp"
+cat > "$TESTZCP" << EOF
+ succeeded = {}
+ failed = {}
+
+ function list_recursive(root, prop)
+ for child in zfs.list.children(root) do
+ list_recursive(child, prop)
+ end
+ val, src = zfs.get_prop(root, prop)
+ if (val == nil) then
+ failed[root] = val
+ else
+ succeeded[root] = val
+ end
+ end
+
+ args = ...
+
+ argv = args["argv"]
+
+ list_recursive(argv[1], argv[2])
+
+ results = {}
+ results["succeeded"] = succeeded
+ results["failed"] = failed
+ return results
+EOF
+
+typeset -a pos_cmds=("recordsize" "type")
+typeset -a pos_cmds_out=(
+"{
+ \"return\": {
+ \"failed\": {},
+ \"succeeded\": {
+ \"$TESTDS\": 131072
+ }
+ }
+}"
+"{
+ \"return\": {
+ \"failed\": {},
+ \"succeeded\": {
+ \"$TESTDS\": \"filesystem\"
+ }
+ }
+}")
+typeset -i cnt=0
+typeset cmd
+for cmd in ${pos_cmds[@]}; do
+ log_must zfs program $TESTPOOL $TESTZCP $TESTDS $cmd 2>&1
+ log_must zfs program -j $TESTPOOL $TESTZCP $TESTDS $cmd 2>&1
+ # json.tool is needed to guarantee consistent ordering of fields
+ # sed is needed to trim trailing space in CentOS 6's json.tool output
+ OUTPUT=$(zfs program -j $TESTPOOL $TESTZCP $TESTDS $cmd 2>&1 | python -m json.tool | sed 's/[[:space:]]*$//')
+ if [ "$OUTPUT" != "${pos_cmds_out[$cnt]}" ]; then
+ log_note "Got :$OUTPUT"
+ log_note "Expected:${pos_cmds_out[$cnt]}"
+ log_fail "Unexpected channel program output";
+ fi
+ cnt=$((cnt + 1))
+done
+
+# 3. Using bad command line option (-Z) gives correct error output
+typeset -a neg_cmds=("-Z")
+typeset -a neg_cmds_out=(
+"invalid option 'Z'
+usage:
+ program [-jn] [-t <instruction limit>] [-m <memory limit (b)>] <pool> <program file> [lua args...]
+
+For the property list, run: zfs set|get
+
+For the delegated permission list, run: zfs allow|unallow")
+cnt=0
+for cmd in ${neg_cmds[@]}; do
+ log_mustnot zfs program $cmd $TESTPOOL $TESTZCP $TESTDS 2>&1
+ log_mustnot zfs program -j $cmd $TESTPOOL $TESTZCP $TESTDS 2>&1
+ OUTPUT=$(zfs program -j $cmd $TESTPOOL $TESTZCP $TESTDS 2>&1)
+ if [ "$OUTPUT" != "${neg_cmds_out[$cnt]}" ]; then
+ log_note "Got :$OUTPUT"
+ log_note "Expected:${neg_cmds_out[$cnt]}"
+ log_fail "Unexpected channel program error output";
+ fi
+ cnt=$((cnt + 1))
+done
+
+log_pass "Channel programs output valid JSON"
diff --git a/usr/src/uts/common/io/qede/579xx/drivers/ecore/ecore_dcbx.c b/usr/src/uts/common/io/qede/579xx/drivers/ecore/ecore_dcbx.c
index de7b5db08c..c325cdecf8 100644
--- a/usr/src/uts/common/io/qede/579xx/drivers/ecore/ecore_dcbx.c
+++ b/usr/src/uts/common/io/qede/579xx/drivers/ecore/ecore_dcbx.c
@@ -33,6 +33,10 @@
* limitations under the License.
*/
+/*
+ * Copyright 2018 Joyent, Inc.
+ */
+
#include "bcm_osal.h"
#include "ecore.h"
#include "ecore_sp_commands.h"
@@ -241,7 +245,6 @@ ecore_dcbx_update_app_info(struct ecore_dcbx_results *p_data,
{
enum ecore_pci_personality personality;
enum dcbx_protocol_type id;
- char *name;
int i;
for (i = 0; i < OSAL_ARRAY_SIZE(ecore_dcbx_app_update); i++) {
@@ -251,7 +254,6 @@ ecore_dcbx_update_app_info(struct ecore_dcbx_results *p_data,
continue;
personality = ecore_dcbx_app_update[i].personality;
- name = ecore_dcbx_app_update[i].name;
ecore_dcbx_set_params(p_data, p_hwfn, enable,
prio, tc, type, personality);
@@ -999,7 +1001,7 @@ ecore_dcbx_mib_update_event(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
rc = ecore_dcbx_process_mib_info(p_hwfn);
if (!rc) {
- bool enabled;
+ bool enabled __unused;
/* reconfigure tcs of QM queues according
* to negotiation results
diff --git a/usr/src/uts/common/io/qede/579xx/drivers/ecore/ecore_mcp.c b/usr/src/uts/common/io/qede/579xx/drivers/ecore/ecore_mcp.c
index e83225708d..a2450dc34c 100644
--- a/usr/src/uts/common/io/qede/579xx/drivers/ecore/ecore_mcp.c
+++ b/usr/src/uts/common/io/qede/579xx/drivers/ecore/ecore_mcp.c
@@ -33,6 +33,10 @@
* limitations under the License.
*/
+/*
+ * Copyright 2018 Joyent, Inc.
+ */
+
#include "bcm_osal.h"
#include "ecore.h"
#include "ecore_status.h"
@@ -362,7 +366,7 @@ static enum _ecore_status_t ecore_do_mcp_cmd(struct ecore_hwfn *p_hwfn,
{
u32 delay = CHIP_MCP_RESP_ITER_US;
u32 max_retries = ECORE_DRV_MB_MAX_RETRIES;
- u32 seq, cnt = 1, actual_mb_seq;
+ u32 seq, cnt = 1, actual_mb_seq __unused;
enum _ecore_status_t rc = ECORE_SUCCESS;
#ifndef ASIC_ONLY
@@ -1433,7 +1437,7 @@ static void ecore_mcp_send_protocol_stats(struct ecore_hwfn *p_hwfn,
struct ecore_ptt *p_ptt,
enum MFW_DRV_MSG_TYPE type)
{
- enum ecore_mcp_protocol_type stats_type;
+ enum ecore_mcp_protocol_type stats_type __unused;
union ecore_mcp_protocol_stats stats;
struct ecore_mcp_mb_params mb_params;
u32 hsi_param;
@@ -3128,7 +3132,6 @@ enum _ecore_status_t ecore_mcp_phy_sfp_read(struct ecore_hwfn *p_hwfn,
u32 len, u8 *p_buf)
{
struct ecore_mcp_nvm_params params;
- enum _ecore_status_t rc;
u32 bytes_left, bytes_to_copy, buf_size;
OSAL_MEMSET(&params, 0, sizeof(struct ecore_mcp_nvm_params));
@@ -3153,7 +3156,7 @@ enum _ecore_status_t ecore_mcp_phy_sfp_read(struct ecore_hwfn *p_hwfn,
DRV_MB_PARAM_TRANSCEIVER_OFFSET_SHIFT);
params.nvm_common.offset |=
(bytes_to_copy << DRV_MB_PARAM_TRANSCEIVER_SIZE_SHIFT);
- rc = ecore_mcp_nvm_command(p_hwfn, p_ptt, &params);
+ (void) ecore_mcp_nvm_command(p_hwfn, p_ptt, &params);
if ((params.nvm_common.resp & FW_MSG_CODE_MASK) ==
FW_MSG_CODE_TRANSCEIVER_NOT_PRESENT) {
return ECORE_NODEV;
@@ -3174,7 +3177,6 @@ enum _ecore_status_t ecore_mcp_phy_sfp_write(struct ecore_hwfn *p_hwfn,
u32 len, u8 *p_buf)
{
struct ecore_mcp_nvm_params params;
- enum _ecore_status_t rc;
u32 buf_idx, buf_size;
OSAL_MEMSET(&params, 0, sizeof(struct ecore_mcp_nvm_params));
@@ -3197,7 +3199,7 @@ enum _ecore_status_t ecore_mcp_phy_sfp_write(struct ecore_hwfn *p_hwfn,
(buf_size << DRV_MB_PARAM_TRANSCEIVER_SIZE_SHIFT);
params.nvm_wr.buf_size = buf_size;
params.nvm_wr.buf = (u32 *)&p_buf[buf_idx];
- rc = ecore_mcp_nvm_command(p_hwfn, p_ptt, &params);
+ (void) ecore_mcp_nvm_command(p_hwfn, p_ptt, &params);
if ((params.nvm_common.resp & FW_MSG_CODE_MASK) ==
FW_MSG_CODE_TRANSCEIVER_NOT_PRESENT) {
return ECORE_NODEV;
diff --git a/usr/src/uts/common/io/qede/579xx/drivers/ecore/ecore_phy.c b/usr/src/uts/common/io/qede/579xx/drivers/ecore/ecore_phy.c
index b05d08881d..1bb37f7954 100644
--- a/usr/src/uts/common/io/qede/579xx/drivers/ecore/ecore_phy.c
+++ b/usr/src/uts/common/io/qede/579xx/drivers/ecore/ecore_phy.c
@@ -33,6 +33,10 @@
* limitations under the License.
*/
+/*
+ * Copyright 2018 Joyent, Inc.
+ */
+
#include "bcm_osal.h"
#include "ecore.h"
#include "reg_addr.h"
@@ -626,7 +630,7 @@ static int ecore_ah_e5_phy_mac_stat(struct ecore_hwfn *p_hwfn,
struct ecore_ptt *p_ptt, u32 port,
char *p_phy_result_buf)
{
- u32 length, reg_id, addr, data_hi, data_lo;
+ u32 length, reg_id, addr, data_hi __unused, data_lo;
length = OSAL_SPRINTF(p_phy_result_buf,
"MAC stats for port %d (only non-zero)\n", port);
diff --git a/usr/src/uts/common/io/qede/qede_gld.c b/usr/src/uts/common/io/qede/qede_gld.c
index cb3dfaa7d7..f38e0f17cf 100644
--- a/usr/src/uts/common/io/qede/qede_gld.c
+++ b/usr/src/uts/common/io/qede/qede_gld.c
@@ -33,6 +33,9 @@
* limitations under the License.
*/
+/*
+ * Copyright 2018 Joyent, Inc.
+ */
#include "qede.h"
@@ -1263,7 +1266,7 @@ static lb_property_t loopmodes[] = {
static enum ioc_reply
qede_set_loopback_mode(qede_t *qede, uint32_t mode)
{
- int ret, i = 0;
+ int i = 0;
struct ecore_dev *edev = &qede->edev;
struct ecore_hwfn *hwfn;
struct ecore_ptt *ptt = NULL;
@@ -1290,7 +1293,7 @@ qede_set_loopback_mode(qede_t *qede, uint32_t mode)
link_params->loopback_mode = ETH_LOOPBACK_NONE;
qede->loop_back_mode = QEDE_LOOP_NONE;
- ret = ecore_mcp_set_link(hwfn, ptt, 1);
+ (void) ecore_mcp_set_link(hwfn, ptt, 1);
ecore_ptt_release(hwfn, ptt);
while (!qede->params.link_state && i < 5000) {
@@ -1311,7 +1314,7 @@ qede_set_loopback_mode(qede_t *qede, uint32_t mode)
i = 0;
link_params->loopback_mode = ETH_LOOPBACK_INT_PHY;
qede->loop_back_mode = QEDE_LOOP_INTERNAL;
- ret = ecore_mcp_set_link(hwfn, ptt, 1);
+ (void) ecore_mcp_set_link(hwfn, ptt, 1);
ecore_ptt_release(hwfn, ptt);
while(!qede->params.link_state && i < 5000) {
@@ -1464,7 +1467,7 @@ qede_ioctl_rd_wr_nvram(qede_t *qede, mblk_t *mp)
qede_nvram_data_t *data1 = (qede_nvram_data_t *)(mp->b_cont->b_rptr);
qede_nvram_data_t *data2, *next_data;
struct ecore_dev *edev = &qede->edev;
- uint32_t ret = 0, hdr_size = 24, bytes_to_copy, copy_len = 0;
+ uint32_t hdr_size = 24, bytes_to_copy, copy_len = 0;
uint32_t copy_len1 = 0;
uint32_t addr = data1->off;
uint32_t size = data1->size, i, buf_size;
@@ -1482,14 +1485,13 @@ qede_ioctl_rd_wr_nvram(qede_t *qede, mblk_t *mp)
" in nvram read ioctl\n");
return (DDI_FAILURE);
}
- ret = ecore_mcp_nvm_read(edev, addr, buf, data1->size);
+ (void) ecore_mcp_nvm_read(edev, addr, buf, data1->size);
copy_len = (MBLKL(mp->b_cont)) - hdr_size;
if(copy_len > size) {
(void) memcpy(data1->uabc, buf, size);
kmem_free(buf, size);
//OSAL_FREE(edev, buf);
- ret = 0;
break;
}
(void) memcpy(data1->uabc, buf, copy_len);
@@ -1529,7 +1531,6 @@ qede_ioctl_rd_wr_nvram(qede_t *qede, mblk_t *mp)
addr = data1->off;
buf_size = size; //data1->buf_size;
//buf_size = data1->buf_size;
- ret = 0;
switch(cmd2){
case START_NVM_WRITE:
@@ -1547,7 +1548,6 @@ qede_ioctl_rd_wr_nvram(qede_t *qede, mblk_t *mp)
qede->nvm_buf = buf;
qede->copy_len = 0;
//tmp_buf = buf + addr;
- ret = 0;
break;
case ACCUMULATE_NVM_BUF:
@@ -1569,7 +1569,6 @@ qede_ioctl_rd_wr_nvram(qede_t *qede, mblk_t *mp)
//qede->copy_len = qede->copy_len + buf_size;
cmn_err(CE_NOTE,
"buf_size from app = %x\n", copy_len);
- ret = 0;
break;
}
(void) memcpy(tmp_buf, data1->uabc, copy_len);
@@ -1590,7 +1589,6 @@ qede_ioctl_rd_wr_nvram(qede_t *qede, mblk_t *mp)
bytes_to_copy);
qede->copy_len = qede->copy_len +
bytes_to_copy;
- ret = 0;
break;
}
(void) memcpy(tmp_buf, next_data->uabc,
@@ -1602,12 +1600,10 @@ qede_ioctl_rd_wr_nvram(qede_t *qede, mblk_t *mp)
mp1 = mp1->b_cont;
}
qede->nvm_buf = tmp_buf;
- ret = 0;
break;
case STOP_NVM_WRITE:
//qede->nvm_buf = tmp_buf;
- ret = 0;
break;
case READ_BUF:
tmp_buf = (uint8_t *)qede->nvm_buf_start;
@@ -1616,13 +1612,12 @@ qede_ioctl_rd_wr_nvram(qede_t *qede, mblk_t *mp)
"buff (%d) : %d\n", i, *tmp_buf);
tmp_buf ++;
}
- ret = 0;
break;
}
break;
case QEDE_NVRAM_CMD_PUT_FILE_DATA:
tmp_buf = qede->nvm_buf_start;
- ret = ecore_mcp_nvm_write(edev, ECORE_PUT_FILE_DATA,
+ (void) ecore_mcp_nvm_write(edev, ECORE_PUT_FILE_DATA,
addr, tmp_buf, size);
kmem_free(qede->nvm_buf_start, size);
//OSAL_FREE(edev, tmp_buf);
@@ -1631,24 +1626,23 @@ qede_ioctl_rd_wr_nvram(qede_t *qede, mblk_t *mp)
tmp_buf = NULL;
qede->nvm_buf = NULL;
qede->nvm_buf_start = NULL;
- ret = 0;
break;
case QEDE_NVRAM_CMD_SET_SECURE_MODE:
- ret = ecore_mcp_nvm_set_secure_mode(edev, addr);
+ (void) ecore_mcp_nvm_set_secure_mode(edev, addr);
break;
case QEDE_NVRAM_CMD_DEL_FILE:
- ret = ecore_mcp_nvm_del_file(edev, addr);
+ (void) ecore_mcp_nvm_del_file(edev, addr);
break;
case QEDE_NVRAM_CMD_PUT_FILE_BEGIN:
- ret = ecore_mcp_nvm_put_file_begin(edev, addr);
+ (void) ecore_mcp_nvm_put_file_begin(edev, addr);
break;
case QEDE_NVRAM_CMD_GET_NVRAM_RESP:
buf = kmem_zalloc(size, KM_SLEEP);
- ret = ecore_mcp_nvm_resp(edev, buf);
+ (void) ecore_mcp_nvm_resp(edev, buf);
(void)memcpy(data1->uabc, buf, size);
kmem_free(buf, size);
break;