Deleted Added
sdiff udiff text old ( 231879 ) new ( 247880 )
full compact
1/*-
2 * Copyright (C) 2012 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,

--- 22 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 231879 2012-02-17 13:55:17Z luigi $ */
40
41#include "oce_if.h"
42
43static void copy_stats_to_sc_xe201(POCE_SOFTC sc);
44static void copy_stats_to_sc_be3(POCE_SOFTC sc);
45static void copy_stats_to_sc_be2(POCE_SOFTC sc);
46static int oce_sysctl_loopback(SYSCTL_HANDLER_ARGS);
47static int oce_be3_fwupgrade(POCE_SOFTC sc, const struct firmware *fw);
48static int oce_sys_fwupgrade(SYSCTL_HANDLER_ARGS);
49static int oce_be3_flashdata(POCE_SOFTC sc, const struct firmware
50 *fw, int num_imgs);
51static int oce_lancer_fwupgrade(POCE_SOFTC sc, const struct firmware *fw);
52static boolean_t oce_phy_flashing_required(POCE_SOFTC sc);
53static boolean_t oce_img_flashing_required(POCE_SOFTC sc, const char *p,
54 int img_optype, uint32_t img_offset,
55 uint32_t img_size, uint32_t hdrs_size);
56static void oce_add_stats_sysctls_be3(POCE_SOFTC sc,
57 struct sysctl_ctx_list *ctx,
58 struct sysctl_oid *stats_node);
59static void oce_add_stats_sysctls_xe201(POCE_SOFTC sc,
60 struct sysctl_ctx_list *ctx,
61 struct sysctl_oid *stats_node);
62
63extern char component_revision[32];
64
65
66void
67oce_add_sysctls(POCE_SOFTC sc)
68{
69
70 struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->dev);
71 struct sysctl_oid *tree = device_get_sysctl_tree(sc->dev);
72 struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree);
73 struct sysctl_oid *stats_node;

--- 14 unchanged lines hidden (view full) ---

88
89 SYSCTL_ADD_INT(ctx, child,
90 OID_AUTO, "max_rsp_handled",
91 CTLTYPE_INT | CTLFLAG_RW,
92 &oce_max_rsp_handled,
93 sizeof(oce_max_rsp_handled),
94 "Maximum receive frames handled per interupt");
95
96 if (sc->function_mode & FNM_FLEX10_MODE)
97 SYSCTL_ADD_UINT(ctx, child,
98 OID_AUTO, "speed",
99 CTLFLAG_RD,
100 &sc->qos_link_speed,
101 0,"QOS Speed");
102 else
103 SYSCTL_ADD_UINT(ctx, child,
104 OID_AUTO, "speed",

--- 11 unchanged lines hidden (view full) ---

116 SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "loop_back",
117 CTLTYPE_INT | CTLFLAG_RW, (void *)sc, 0,
118 oce_sysctl_loopback, "I", "Loop Back Tests");
119
120 SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "fw_upgrade",
121 CTLTYPE_STRING | CTLFLAG_RW, (void *)sc, 0,
122 oce_sys_fwupgrade, "A", "Firmware ufi file");
123
124 stats_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "stats",
125 CTLFLAG_RD, NULL, "Ethernet Statistics");
126
127 if (IS_BE(sc))
128 oce_add_stats_sysctls_be3(sc, ctx, stats_node);
129 else
130 oce_add_stats_sysctls_xe201(sc, ctx, stats_node);
131
132
133}
134
135
136
137static uint32_t
138oce_loopback_test(struct oce_softc *sc, uint8_t loopback_type)
139{
140 uint32_t status = 0;
141
142 oce_mbox_cmd_set_loopback(sc, sc->if_id, loopback_type, 1);
143 status = oce_mbox_cmd_test_loopback(sc, sc->if_id, loopback_type,
144 1500, 2, 0xabc);
145 oce_mbox_cmd_set_loopback(sc, sc->if_id, OCE_NO_LOOPBACK, 1);
146
147 return status;
148}
149
150
151static int
152oce_sysctl_loopback(SYSCTL_HANDLER_ARGS)
153{
154 int value = 0;
155 uint32_t status;
156 struct oce_softc *sc = (struct oce_softc *)arg1;
157
158 status = sysctl_handle_int(oidp, &value, 0, req);

--- 1139 unchanged lines hidden (view full) ---

1298 } else {
1299 rc = oce_mbox_get_pport_stats(sc, &sc->stats_mem, reset);
1300 if (!rc)
1301 copy_stats_to_sc_xe201(sc);
1302 }
1303
1304 return rc;
1305}