diff options
| author | Robert Mustacchi <rm@joyent.com> | 2016-06-14 07:50:04 -0700 |
|---|---|---|
| committer | Robert Mustacchi <rm@joyent.com> | 2016-06-14 07:50:04 -0700 |
| commit | 9d26e4fc021e249c93c2861629cc665e4f5bd4d6 (patch) | |
| tree | c3c7ce6535235e0bb291389b081bccccfbfedf66 /usr/src/cmd | |
| parent | 08c359e5adeac56f453e23f78c147189cc0896a6 (diff) | |
| download | illumos-joyent-9d26e4fc021e249c93c2861629cc665e4f5bd4d6.tar.gz | |
5115 Want Intel 40GbE NIC driver for illumos
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
Approved by: Richard Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src/cmd')
| -rw-r--r-- | usr/src/cmd/mdb/Makefile.common | 3 | ||||
| -rw-r--r-- | usr/src/cmd/mdb/common/modules/i40e/i40e.c | 114 | ||||
| -rw-r--r-- | usr/src/cmd/mdb/intel/amd64/i40e/Makefile | 35 | ||||
| -rw-r--r-- | usr/src/cmd/mdb/intel/ia32/i40e/Makefile | 33 |
4 files changed, 184 insertions, 1 deletions
diff --git a/usr/src/cmd/mdb/Makefile.common b/usr/src/cmd/mdb/Makefile.common index a344688c1b..003e38d87d 100644 --- a/usr/src/cmd/mdb/Makefile.common +++ b/usr/src/cmd/mdb/Makefile.common @@ -20,7 +20,7 @@ # # Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright 2013 Nexenta Systems, Inc. All rights reserved. -# Copyright (c) 2015, Joyent, Inc. All rights reserved. +# Copyright 2016 Joyent, Inc. # # MDB modules used for debugging user processes that every ISA's build # subdirectory will need to build. @@ -65,6 +65,7 @@ COMMON_MODULES_KVM = \ genunix \ hook \ neti \ + i40e \ idm \ ii \ ip \ diff --git a/usr/src/cmd/mdb/common/modules/i40e/i40e.c b/usr/src/cmd/mdb/common/modules/i40e/i40e.c new file mode 100644 index 0000000000..6d1f900b43 --- /dev/null +++ b/usr/src/cmd/mdb/common/modules/i40e/i40e.c @@ -0,0 +1,114 @@ +/* + * 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 2016 Joyent, Inc. + */ + +#include <sys/mdb_modapi.h> +#include "i40e_sw.h" + +#define RSRC_MAX 0x13 +static const char *i40e_switch_rsrc_names[] = { + "VEBs", + "VSIs", + "Perfect Match MAC Addresses", + "S-Tags", + "Reserved", + "Multicast Hash Entries", + "Reserved", + "VLANs", + "VSI Lists", + "Reserved", + "VLAN Stat pools", + "Mirror rules", + "Queue sets", + "Inner VLAN Forwarding", + "Reserved", + "Inner MACs", + "IPs", + "GRE/VN1 Keys", + "VN2 Keys", + "Tunnelling Ports" +}; + +/* + * i40e mdb dcmds + */ +/* ARGSUSED */ +static int +i40e_switch_rsrcs_dcmd(uintptr_t addr, uint_t flags, int argc, + const mdb_arg_t *argv) +{ + i40e_t i40e; + int i; + + if (!(flags & DCMD_ADDRSPEC)) { + mdb_warn("::i40e_switch_rsrcs does not operate globally\n"); + return (DCMD_USAGE); + } + + if (mdb_vread(&i40e, sizeof (i40e_t), addr) != sizeof (i40e_t)) { + mdb_warn("failed to read i40e_t at %p", addr); + return (DCMD_ERR); + } + + mdb_printf("%-28s %-12s %-8s %-8s %s\n", "TYPE", "GUARANTEE", + "TOTAL", "USED", "UNALLOCED"); + + for (i = 0; i < i40e.i40e_switch_rsrc_actual; i++) { + i40e_switch_rsrc_t rsrc; + uintptr_t raddr = (uintptr_t)i40e.i40e_switch_rsrcs + + i * sizeof (i40e_switch_rsrc_t); + const char *name; + + if (mdb_vread(&rsrc, sizeof (i40e_switch_rsrc_t), raddr) != + sizeof (i40e_switch_rsrc_t)) { + mdb_warn("failed to read i40e_switch_rsrc_t %d at %p", + i, raddr); + return (DCMD_ERR); + } + + if (rsrc.resource_type <= RSRC_MAX) { + name = i40e_switch_rsrc_names[rsrc.resource_type]; + } else { + char *buf; + size_t s = mdb_snprintf(NULL, 0, "Unknown type (%d)", + rsrc.resource_type); + buf = mdb_alloc(s + 1, UM_GC | UM_SLEEP); + (void) mdb_snprintf(buf, s + 1, "Unknown type (%d)", + rsrc.resource_type); + name = buf; + } + + mdb_printf("%-28s %-12d %-8d %-8d %d\n", name, + LE_16(rsrc.guaranteed), LE_16(rsrc.total), LE_16(rsrc.used), + LE_16(rsrc.total_unalloced)); + } + + return (DCMD_OK); +} + +static const mdb_dcmd_t i40e_dcmds[] = { + { "i40e_switch_rsrcs", NULL, "print switch resources", + i40e_switch_rsrcs_dcmd, NULL }, + { NULL } +}; + +static const mdb_modinfo_t i40e_modinfo = { + MDB_API_VERSION, i40e_dcmds, NULL +}; + +const mdb_modinfo_t * +_mdb_init(void) +{ + return (&i40e_modinfo); +} diff --git a/usr/src/cmd/mdb/intel/amd64/i40e/Makefile b/usr/src/cmd/mdb/intel/amd64/i40e/Makefile new file mode 100644 index 0000000000..de089d8a14 --- /dev/null +++ b/usr/src/cmd/mdb/intel/amd64/i40e/Makefile @@ -0,0 +1,35 @@ +# +# 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 2016 Joyent, Inc. +# + + +MODULE = i40e.so +MDBTGT = kvm + +MODSRCS = i40e.c + +include ../../../../Makefile.cmd +include ../../../../Makefile.cmd.64 +include ../../Makefile.amd64 +include ../../../Makefile.module + +CPPFLAGS += -I$(SRC)/uts/common/io/i40e +CPPFLAGS += -I$(SRC)/uts/common/io/i40e/core +CPPFLAGS += -I$(SRC)/uts/common +CPPFLAGS += -D_I40E_MDB_DMOD + +# +# i40e needs this due to the use of Intel provided headers. +# +LINTFLAGS64 += -erroff=E_STATIC_UNUSED diff --git a/usr/src/cmd/mdb/intel/ia32/i40e/Makefile b/usr/src/cmd/mdb/intel/ia32/i40e/Makefile new file mode 100644 index 0000000000..dd3834ae1f --- /dev/null +++ b/usr/src/cmd/mdb/intel/ia32/i40e/Makefile @@ -0,0 +1,33 @@ +# +# 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 2016 Joyent, Inc. +# + +MODULE = i40e.so +MDBTGT = kvm + +MODSRCS = i40e.c + +include ../../../../Makefile.cmd +include ../../Makefile.ia32 +include ../../../Makefile.module + +CPPFLAGS += -I$(SRC)/uts/common/io/i40e +CPPFLAGS += -I$(SRC)/uts/common/io/i40e/core +CPPFLAGS += -I$(SRC)/uts/common +CPPFLAGS += -D_I40E_MDB_DMOD + +# +# i40e needs this due to the use of Intel provided headers. +# +LINTFLAGS += -erroff=E_STATIC_UNUSED |
