4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #include <sys/mdb_modapi.h>
27 #include <sys/types.h>
28 #include <inet/ip.h>
29 #include <inet/ip6.h>
30
31 #include <sys/mac.h>
32 #include <sys/mac_provider.h>
33 #include <sys/mac_client.h>
34 #include <sys/mac_client_impl.h>
35 #include <sys/mac_flow_impl.h>
36 #include <sys/mac_soft_ring.h>
37 #include <sys/mac_stat.h>
38
39 #define STRSIZE 64
40 #define MAC_RX_SRS_SIZE (MAX_RINGS_PER_GROUP * sizeof (uintptr_t))
41
42 #define LAYERED_WALKER_FOR_FLOW "flow_entry_cache"
43 #define LAYERED_WALKER_FOR_SRS "mac_srs_cache"
950 case MR_FREE:
951 return ("free");
952 case MR_NEWLY_ADDED:
953 return ("new");
954 case MR_INUSE:
955 return ("inuse");
956 }
957 return ("--");
958 }
959
960 static char *
961 mac_ring_classify2str(mac_classify_type_t classify)
962 {
963 switch (classify) {
964 case MAC_NO_CLASSIFIER:
965 return ("no");
966 case MAC_SW_CLASSIFIER:
967 return ("sw");
968 case MAC_HW_CLASSIFIER:
969 return ("hw");
970 }
971 return ("--");
972 }
973
974 static int
975 mac_ring_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
976 {
977 mac_ring_t ring;
978 mac_group_t group;
979 flow_entry_t flent;
980 mac_soft_ring_set_t srs;
981
982 if (!(flags & DCMD_ADDRSPEC)) {
983 if (mdb_walk_dcmd("mac_ring", "mac_ring", argc, argv) == -1) {
984 mdb_warn("failed to walk 'mac_ring'");
985 return (DCMD_ERR);
986 }
987 return (DCMD_OK);
988 }
989 if (mdb_vread(&ring, sizeof (ring), addr) == -1) {
|
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 * Copyright 2018 Joyent, Inc.
25 */
26
27 #include <sys/mdb_modapi.h>
28 #include <sys/types.h>
29 #include <inet/ip.h>
30 #include <inet/ip6.h>
31
32 #include <sys/mac.h>
33 #include <sys/mac_provider.h>
34 #include <sys/mac_client.h>
35 #include <sys/mac_client_impl.h>
36 #include <sys/mac_flow_impl.h>
37 #include <sys/mac_soft_ring.h>
38 #include <sys/mac_stat.h>
39
40 #define STRSIZE 64
41 #define MAC_RX_SRS_SIZE (MAX_RINGS_PER_GROUP * sizeof (uintptr_t))
42
43 #define LAYERED_WALKER_FOR_FLOW "flow_entry_cache"
44 #define LAYERED_WALKER_FOR_SRS "mac_srs_cache"
951 case MR_FREE:
952 return ("free");
953 case MR_NEWLY_ADDED:
954 return ("new");
955 case MR_INUSE:
956 return ("inuse");
957 }
958 return ("--");
959 }
960
961 static char *
962 mac_ring_classify2str(mac_classify_type_t classify)
963 {
964 switch (classify) {
965 case MAC_NO_CLASSIFIER:
966 return ("no");
967 case MAC_SW_CLASSIFIER:
968 return ("sw");
969 case MAC_HW_CLASSIFIER:
970 return ("hw");
971 case MAC_PASSTHRU_CLASSIFIER:
972 return ("pass");
973 }
974 return ("--");
975 }
976
977 static int
978 mac_ring_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
979 {
980 mac_ring_t ring;
981 mac_group_t group;
982 flow_entry_t flent;
983 mac_soft_ring_set_t srs;
984
985 if (!(flags & DCMD_ADDRSPEC)) {
986 if (mdb_walk_dcmd("mac_ring", "mac_ring", argc, argv) == -1) {
987 mdb_warn("failed to walk 'mac_ring'");
988 return (DCMD_ERR);
989 }
990 return (DCMD_OK);
991 }
992 if (mdb_vread(&ring, sizeof (ring), addr) == -1) {
|