1/*-
2 * Copyright (C) 2013 Emulex
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
--- 20 unchanged lines hidden (view full) ---
31 * Contact Information:
32 * freebsd-drivers@emulex.com
33 *
34 * Emulex
35 * 3333 Susan Street
36 * Costa Mesa, CA 92626
37 */
38
39/* $FreeBSD: head/sys/dev/oce/oce_sysctl.c 252869 2013-07-06 08:30:45Z delphij $ */
40
41
42#include "oce_if.h"
43
44static void copy_stats_to_sc_xe201(POCE_SOFTC sc);
45static void copy_stats_to_sc_be3(POCE_SOFTC sc);
46static void copy_stats_to_sc_be2(POCE_SOFTC sc);
47static int oce_sysctl_loopback(SYSCTL_HANDLER_ARGS);
--- 87 unchanged lines hidden (view full) ---
135 "I", "Initiate a sfp_vpd_dump operation");
136 SYSCTL_ADD_OPAQUE(ctx, child, OID_AUTO, "sfp_vpd_dump_buffer",
137 CTLFLAG_RD, sfp_vpd_dump_buffer,
138 TRANSCEIVER_DATA_SIZE, "IU", "Access sfp_vpd_dump buffer");
139
140 stats_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "stats",
141 CTLFLAG_RD, NULL, "Ethernet Statistics");
142
143 if (IS_BE(sc) || IS_SH(sc))
144 oce_add_stats_sysctls_be3(sc, ctx, stats_node);
145 else
146 oce_add_stats_sysctls_xe201(sc, ctx, stats_node);
147
148
149}
150
151
--- 66 unchanged lines hidden (view full) ---
218
219 fw = firmware_get(ufiname);
220 if (fw == NULL) {
221 device_printf(sc->dev, "Unable to get Firmware. "
222 "Make sure %s is copied to /boot/modules\n", ufiname);
223 return ENOENT;
224 }
225
226 if (IS_BE(sc) || IS_SH(sc)) {
227 if ((sc->flags & OCE_FLAGS_BE2)) {
228 device_printf(sc->dev,
229 "Flashing not supported for BE2 yet.\n");
230 status = 1;
231 goto done;
232 }
233 status = oce_be3_fwupgrade(sc, fw);
234 } else
--- 1030 unchanged lines hidden (view full) ---
1265}
1266
1267
1268int
1269oce_stats_init(POCE_SOFTC sc)
1270{
1271 int rc = 0, sz;
1272
1273 if (IS_BE(sc) || IS_SH(sc)) {
1274 if (sc->flags & OCE_FLAGS_BE2)
1275 sz = sizeof(struct mbx_get_nic_stats_v0);
1276 else
1277 sz = sizeof(struct mbx_get_nic_stats);
1278 } else
1279 sz = sizeof(struct mbx_get_pport_stats);
1280
1281 rc = oce_dma_alloc(sc, sz, &sc->stats_mem, 0);
--- 11 unchanged lines hidden (view full) ---
1293}
1294
1295
1296int
1297oce_refresh_nic_stats(POCE_SOFTC sc)
1298{
1299 int rc = 0, reset = 0;
1300
1301 if (IS_BE(sc) || IS_SH(sc)) {
1302 if (sc->flags & OCE_FLAGS_BE2) {
1303 rc = oce_mbox_get_nic_stats_v0(sc, &sc->stats_mem);
1304 if (!rc)
1305 copy_stats_to_sc_be2(sc);
1306 } else {
1307 rc = oce_mbox_get_nic_stats(sc, &sc->stats_mem);
1308 if (!rc)
1309 copy_stats_to_sc_be3(sc);
--- 38 unchanged lines hidden ---
2 * Copyright (C) 2013 Emulex
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
--- 20 unchanged lines hidden (view full) ---
31 * Contact Information:
32 * freebsd-drivers@emulex.com
33 *
34 * Emulex
35 * 3333 Susan Street
36 * Costa Mesa, CA 92626
37 */
38
39/* $FreeBSD: head/sys/dev/oce/oce_sysctl.c 252869 2013-07-06 08:30:45Z delphij $ */
40
41
42#include "oce_if.h"
43
44static void copy_stats_to_sc_xe201(POCE_SOFTC sc);
45static void copy_stats_to_sc_be3(POCE_SOFTC sc);
46static void copy_stats_to_sc_be2(POCE_SOFTC sc);
47static int oce_sysctl_loopback(SYSCTL_HANDLER_ARGS);
--- 87 unchanged lines hidden (view full) ---
135 "I", "Initiate a sfp_vpd_dump operation");
136 SYSCTL_ADD_OPAQUE(ctx, child, OID_AUTO, "sfp_vpd_dump_buffer",
137 CTLFLAG_RD, sfp_vpd_dump_buffer,
138 TRANSCEIVER_DATA_SIZE, "IU", "Access sfp_vpd_dump buffer");
139
140 stats_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "stats",
141 CTLFLAG_RD, NULL, "Ethernet Statistics");
142
143 if (IS_BE(sc) || IS_SH(sc))
144 oce_add_stats_sysctls_be3(sc, ctx, stats_node);
145 else
146 oce_add_stats_sysctls_xe201(sc, ctx, stats_node);
147
148
149}
150
151
--- 66 unchanged lines hidden (view full) ---
218
219 fw = firmware_get(ufiname);
220 if (fw == NULL) {
221 device_printf(sc->dev, "Unable to get Firmware. "
222 "Make sure %s is copied to /boot/modules\n", ufiname);
223 return ENOENT;
224 }
225
226 if (IS_BE(sc) || IS_SH(sc)) {
227 if ((sc->flags & OCE_FLAGS_BE2)) {
228 device_printf(sc->dev,
229 "Flashing not supported for BE2 yet.\n");
230 status = 1;
231 goto done;
232 }
233 status = oce_be3_fwupgrade(sc, fw);
234 } else
--- 1030 unchanged lines hidden (view full) ---
1265}
1266
1267
1268int
1269oce_stats_init(POCE_SOFTC sc)
1270{
1271 int rc = 0, sz;
1272
1273 if (IS_BE(sc) || IS_SH(sc)) {
1274 if (sc->flags & OCE_FLAGS_BE2)
1275 sz = sizeof(struct mbx_get_nic_stats_v0);
1276 else
1277 sz = sizeof(struct mbx_get_nic_stats);
1278 } else
1279 sz = sizeof(struct mbx_get_pport_stats);
1280
1281 rc = oce_dma_alloc(sc, sz, &sc->stats_mem, 0);
--- 11 unchanged lines hidden (view full) ---
1293}
1294
1295
1296int
1297oce_refresh_nic_stats(POCE_SOFTC sc)
1298{
1299 int rc = 0, reset = 0;
1300
1301 if (IS_BE(sc) || IS_SH(sc)) {
1302 if (sc->flags & OCE_FLAGS_BE2) {
1303 rc = oce_mbox_get_nic_stats_v0(sc, &sc->stats_mem);
1304 if (!rc)
1305 copy_stats_to_sc_be2(sc);
1306 } else {
1307 rc = oce_mbox_get_nic_stats(sc, &sc->stats_mem);
1308 if (!rc)
1309 copy_stats_to_sc_be3(sc);
--- 38 unchanged lines hidden ---