2 * Copyright (c) 2015 Mellanox Technologies. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 #include <net/sff8472.h>
32 mlx5e_create_stats(struct sysctl_ctx_list *ctx,
33 struct sysctl_oid_list *parent, const char *buffer,
34 const char **desc, unsigned num, u64 * arg)
36 struct sysctl_oid *node;
41 node = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO,
42 buffer, CTLFLAG_RD, NULL, "Statistics");
45 for (x = 0; x != num; x++) {
46 SYSCTL_ADD_UQUAD(ctx, SYSCTL_CHILDREN(node), OID_AUTO,
47 desc[2 * x], CTLFLAG_RD, arg + x, desc[2 * x + 1]);
52 mlx5e_ethtool_sync_tx_completion_fact(struct mlx5e_priv *priv)
55 * Limit the maximum distance between completion events to
56 * half of the currently set TX queue size.
58 * The maximum number of queue entries a single IP packet can
59 * consume is given by MLX5_SEND_WQE_MAX_WQEBBS.
61 * The worst case max value is then given as below:
63 uint64_t max = priv->params_ethtool.tx_queue_size /
64 (2 * MLX5_SEND_WQE_MAX_WQEBBS);
67 * Update the maximum completion factor value in case the
68 * tx_queue_size field changed. Ensure we don't overflow
75 priv->params_ethtool.tx_completion_fact_max = max;
78 * Verify that the current TX completion factor is within the
81 if (priv->params_ethtool.tx_completion_fact < 1)
82 priv->params_ethtool.tx_completion_fact = 1;
83 else if (priv->params_ethtool.tx_completion_fact > max)
84 priv->params_ethtool.tx_completion_fact = max;
87 #define MLX5_PARAM_OFFSET(n) \
88 __offsetof(struct mlx5e_priv, params_ethtool.n)
91 mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS)
93 struct mlx5e_priv *priv = arg1;
100 value = priv->params_ethtool.arg[arg2];
102 error = sysctl_handle_64(oidp, &value, 0, req);
103 if (error || req->newptr == NULL ||
104 value == priv->params_ethtool.arg[arg2])
107 /* assign new value */
108 priv->params_ethtool.arg[arg2] = value;
112 /* check if device is gone */
117 was_opened = test_bit(MLX5E_STATE_OPENED, &priv->state);
118 mode_modify = MLX5_CAP_GEN(priv->mdev, cq_period_mode_modify);
120 switch (MLX5_PARAM_OFFSET(arg[arg2])) {
121 case MLX5_PARAM_OFFSET(rx_coalesce_usecs):
122 /* import RX coal time */
123 if (priv->params_ethtool.rx_coalesce_usecs < 1)
124 priv->params_ethtool.rx_coalesce_usecs = 0;
125 else if (priv->params_ethtool.rx_coalesce_usecs >
126 MLX5E_FLD_MAX(cqc, cq_period)) {
127 priv->params_ethtool.rx_coalesce_usecs =
128 MLX5E_FLD_MAX(cqc, cq_period);
130 priv->params.rx_cq_moderation_usec =
131 priv->params_ethtool.rx_coalesce_usecs;
133 /* check to avoid down and up the network interface */
135 error = mlx5e_refresh_channel_params(priv);
138 case MLX5_PARAM_OFFSET(rx_coalesce_pkts):
139 /* import RX coal pkts */
140 if (priv->params_ethtool.rx_coalesce_pkts < 1)
141 priv->params_ethtool.rx_coalesce_pkts = 0;
142 else if (priv->params_ethtool.rx_coalesce_pkts >
143 MLX5E_FLD_MAX(cqc, cq_max_count)) {
144 priv->params_ethtool.rx_coalesce_pkts =
145 MLX5E_FLD_MAX(cqc, cq_max_count);
147 priv->params.rx_cq_moderation_pkts =
148 priv->params_ethtool.rx_coalesce_pkts;
150 /* check to avoid down and up the network interface */
152 error = mlx5e_refresh_channel_params(priv);
155 case MLX5_PARAM_OFFSET(tx_coalesce_usecs):
156 /* import TX coal time */
157 if (priv->params_ethtool.tx_coalesce_usecs < 1)
158 priv->params_ethtool.tx_coalesce_usecs = 0;
159 else if (priv->params_ethtool.tx_coalesce_usecs >
160 MLX5E_FLD_MAX(cqc, cq_period)) {
161 priv->params_ethtool.tx_coalesce_usecs =
162 MLX5E_FLD_MAX(cqc, cq_period);
164 priv->params.tx_cq_moderation_usec =
165 priv->params_ethtool.tx_coalesce_usecs;
167 /* check to avoid down and up the network interface */
169 error = mlx5e_refresh_channel_params(priv);
172 case MLX5_PARAM_OFFSET(tx_coalesce_pkts):
173 /* import TX coal pkts */
174 if (priv->params_ethtool.tx_coalesce_pkts < 1)
175 priv->params_ethtool.tx_coalesce_pkts = 0;
176 else if (priv->params_ethtool.tx_coalesce_pkts >
177 MLX5E_FLD_MAX(cqc, cq_max_count)) {
178 priv->params_ethtool.tx_coalesce_pkts =
179 MLX5E_FLD_MAX(cqc, cq_max_count);
181 priv->params.tx_cq_moderation_pkts =
182 priv->params_ethtool.tx_coalesce_pkts;
184 /* check to avoid down and up the network interface */
186 error = mlx5e_refresh_channel_params(priv);
189 case MLX5_PARAM_OFFSET(tx_queue_size):
190 /* network interface must be down */
192 mlx5e_close_locked(priv->ifp);
194 /* import TX queue size */
195 if (priv->params_ethtool.tx_queue_size <
196 (1 << MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE)) {
197 priv->params_ethtool.tx_queue_size =
198 (1 << MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE);
199 } else if (priv->params_ethtool.tx_queue_size >
200 priv->params_ethtool.tx_queue_size_max) {
201 priv->params_ethtool.tx_queue_size =
202 priv->params_ethtool.tx_queue_size_max;
204 /* store actual TX queue size */
205 priv->params.log_sq_size =
206 order_base_2(priv->params_ethtool.tx_queue_size);
207 priv->params_ethtool.tx_queue_size =
208 1 << priv->params.log_sq_size;
210 /* verify TX completion factor */
211 mlx5e_ethtool_sync_tx_completion_fact(priv);
213 /* restart network interface, if any */
215 mlx5e_open_locked(priv->ifp);
218 case MLX5_PARAM_OFFSET(rx_queue_size):
219 /* network interface must be down */
221 mlx5e_close_locked(priv->ifp);
223 /* import RX queue size */
224 if (priv->params_ethtool.rx_queue_size <
225 (1 << MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE)) {
226 priv->params_ethtool.rx_queue_size =
227 (1 << MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE);
228 } else if (priv->params_ethtool.rx_queue_size >
229 priv->params_ethtool.rx_queue_size_max) {
230 priv->params_ethtool.rx_queue_size =
231 priv->params_ethtool.rx_queue_size_max;
233 /* store actual RX queue size */
234 priv->params.log_rq_size =
235 order_base_2(priv->params_ethtool.rx_queue_size);
236 priv->params_ethtool.rx_queue_size =
237 1 << priv->params.log_rq_size;
239 /* update least number of RX WQEs */
240 priv->params.min_rx_wqes = min(
241 priv->params_ethtool.rx_queue_size - 1,
242 MLX5E_PARAMS_DEFAULT_MIN_RX_WQES);
244 /* restart network interface, if any */
246 mlx5e_open_locked(priv->ifp);
249 case MLX5_PARAM_OFFSET(channels):
250 /* network interface must be down */
252 mlx5e_close_locked(priv->ifp);
254 /* import number of channels */
255 if (priv->params_ethtool.channels < 1)
256 priv->params_ethtool.channels = 1;
257 else if (priv->params_ethtool.channels >
258 (u64) priv->mdev->priv.eq_table.num_comp_vectors) {
259 priv->params_ethtool.channels =
260 (u64) priv->mdev->priv.eq_table.num_comp_vectors;
262 priv->params.num_channels = priv->params_ethtool.channels;
264 /* restart network interface, if any */
266 mlx5e_open_locked(priv->ifp);
269 case MLX5_PARAM_OFFSET(rx_coalesce_mode):
270 /* network interface must be down */
271 if (was_opened != 0 && mode_modify == 0)
272 mlx5e_close_locked(priv->ifp);
274 /* import RX coalesce mode */
275 if (priv->params_ethtool.rx_coalesce_mode != 0)
276 priv->params_ethtool.rx_coalesce_mode = 1;
277 priv->params.rx_cq_moderation_mode =
278 priv->params_ethtool.rx_coalesce_mode;
280 /* restart network interface, if any */
281 if (was_opened != 0) {
282 if (mode_modify == 0)
283 mlx5e_open_locked(priv->ifp);
285 error = mlx5e_refresh_channel_params(priv);
289 case MLX5_PARAM_OFFSET(tx_coalesce_mode):
290 /* network interface must be down */
291 if (was_opened != 0 && mode_modify == 0)
292 mlx5e_close_locked(priv->ifp);
294 /* import TX coalesce mode */
295 if (priv->params_ethtool.tx_coalesce_mode != 0)
296 priv->params_ethtool.tx_coalesce_mode = 1;
297 priv->params.tx_cq_moderation_mode =
298 priv->params_ethtool.tx_coalesce_mode;
300 /* restart network interface, if any */
301 if (was_opened != 0) {
302 if (mode_modify == 0)
303 mlx5e_open_locked(priv->ifp);
305 error = mlx5e_refresh_channel_params(priv);
309 case MLX5_PARAM_OFFSET(hw_lro):
310 /* network interface must be down */
312 mlx5e_close_locked(priv->ifp);
314 /* import HW LRO mode */
315 if (priv->params_ethtool.hw_lro != 0) {
316 if ((priv->ifp->if_capenable & IFCAP_LRO) &&
317 MLX5_CAP_ETH(priv->mdev, lro_cap)) {
318 priv->params.hw_lro_en = 1;
319 priv->params_ethtool.hw_lro = 1;
321 priv->params.hw_lro_en = 0;
322 priv->params_ethtool.hw_lro = 0;
325 if_printf(priv->ifp, "Can't enable HW LRO: "
326 "The HW or SW LRO feature is disabled\n");
329 priv->params.hw_lro_en = 0;
331 /* restart network interface, if any */
333 mlx5e_open_locked(priv->ifp);
336 case MLX5_PARAM_OFFSET(cqe_zipping):
337 /* network interface must be down */
339 mlx5e_close_locked(priv->ifp);
341 /* import CQE zipping mode */
342 if (priv->params_ethtool.cqe_zipping &&
343 MLX5_CAP_GEN(priv->mdev, cqe_compression)) {
344 priv->params.cqe_zipping_en = true;
345 priv->params_ethtool.cqe_zipping = 1;
347 priv->params.cqe_zipping_en = false;
348 priv->params_ethtool.cqe_zipping = 0;
350 /* restart network interface, if any */
352 mlx5e_open_locked(priv->ifp);
355 case MLX5_PARAM_OFFSET(tx_bufring_disable):
356 /* rangecheck input value */
357 priv->params_ethtool.tx_bufring_disable =
358 priv->params_ethtool.tx_bufring_disable ? 1 : 0;
360 /* reconfigure the sendqueues, if any */
362 mlx5e_close_locked(priv->ifp);
363 mlx5e_open_locked(priv->ifp);
367 case MLX5_PARAM_OFFSET(tx_completion_fact):
368 /* network interface must be down */
370 mlx5e_close_locked(priv->ifp);
372 /* verify parameter */
373 mlx5e_ethtool_sync_tx_completion_fact(priv);
375 /* restart network interface, if any */
377 mlx5e_open_locked(priv->ifp);
389 * Read the first three bytes of the eeprom in order to get the needed info
390 * for the whole reading.
391 * Byte 0 - Identifier byte
392 * Byte 1 - Revision byte
393 * Byte 2 - Status byte
396 mlx5e_get_eeprom_info(struct mlx5e_priv *priv, struct mlx5e_eeprom *eeprom)
398 struct mlx5_core_dev *dev = priv->mdev;
403 ret = mlx5_query_module_num(dev, &eeprom->module_num);
405 if_printf(priv->ifp, "%s:%d: Failed query module error=%d\n",
406 __func__, __LINE__, ret);
410 /* Read the first three bytes to get Identifier, Revision and Status */
411 ret = mlx5_query_eeprom(dev, eeprom->i2c_addr, eeprom->page_num,
412 eeprom->device_addr, MLX5E_EEPROM_INFO_BYTES, eeprom->module_num, &data,
415 if_printf(priv->ifp, "%s:%d: Failed query eeprom module error=0x%x\n",
416 __func__, __LINE__, ret);
420 switch (data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK) {
421 case SFF_8024_ID_QSFP:
422 eeprom->type = MLX5E_ETH_MODULE_SFF_8436;
423 eeprom->len = MLX5E_ETH_MODULE_SFF_8436_LEN;
425 case SFF_8024_ID_QSFPPLUS:
426 case SFF_8024_ID_QSFP28:
427 if ((data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK) == SFF_8024_ID_QSFP28 ||
428 ((data & MLX5_EEPROM_REVISION_ID_BYTE_MASK) >> 8) >= 0x3) {
429 eeprom->type = MLX5E_ETH_MODULE_SFF_8636;
430 eeprom->len = MLX5E_ETH_MODULE_SFF_8636_LEN;
432 eeprom->type = MLX5E_ETH_MODULE_SFF_8436;
433 eeprom->len = MLX5E_ETH_MODULE_SFF_8436_LEN;
435 if ((data & MLX5_EEPROM_PAGE_3_VALID_BIT_MASK) == 0)
436 eeprom->page_valid = 1;
438 case SFF_8024_ID_SFP:
439 eeprom->type = MLX5E_ETH_MODULE_SFF_8472;
440 eeprom->len = MLX5E_ETH_MODULE_SFF_8472_LEN;
443 if_printf(priv->ifp, "%s:%d: Not recognized cable type = 0x%x(%s)\n",
444 __func__, __LINE__, data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK,
445 sff_8024_id[data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK]);
451 /* Read both low and high pages of the eeprom */
453 mlx5e_get_eeprom(struct mlx5e_priv *priv, struct mlx5e_eeprom *ee)
455 struct mlx5_core_dev *dev = priv->mdev;
462 /* Read low page of the eeprom */
463 while (ee->device_addr < ee->len) {
464 ret = mlx5_query_eeprom(dev, ee->i2c_addr, ee->page_num, ee->device_addr,
465 ee->len - ee->device_addr, ee->module_num,
466 ee->data + (ee->device_addr / 4), &size_read);
468 if_printf(priv->ifp, "%s:%d: Failed reading eeprom, "
469 "error = 0x%02x\n", __func__, __LINE__, ret);
472 ee->device_addr += size_read;
475 /* Read high page of the eeprom */
476 if (ee->page_valid) {
477 ee->device_addr = MLX5E_EEPROM_HIGH_PAGE_OFFSET;
478 ee->page_num = MLX5E_EEPROM_HIGH_PAGE;
480 while (ee->device_addr < MLX5E_EEPROM_PAGE_LENGTH) {
481 ret = mlx5_query_eeprom(dev, ee->i2c_addr, ee->page_num,
482 ee->device_addr, MLX5E_EEPROM_PAGE_LENGTH - ee->device_addr,
483 ee->module_num, ee->data + (ee->len / 4) +
484 ((ee->device_addr - MLX5E_EEPROM_HIGH_PAGE_OFFSET) / 4),
487 if_printf(priv->ifp, "%s:%d: Failed reading eeprom, "
488 "error = 0x%02x\n", __func__, __LINE__, ret);
491 ee->device_addr += size_read;
498 mlx5e_print_eeprom(struct mlx5e_eeprom *eeprom)
502 int byte_to_write = 0;
503 int line_length = 16;
505 printf("\nOffset\t\tValues\n");
506 printf("------\t\t------");
507 while (byte_to_write < eeprom->len) {
508 printf("\n0x%04X\t\t", byte_to_write);
509 for (index_in_row = 0; index_in_row < line_length; index_in_row++) {
510 printf("%02X ", ((u8 *)eeprom->data)[byte_to_write]);
515 if (eeprom->page_valid) {
516 row = MLX5E_EEPROM_HIGH_PAGE_OFFSET;
517 printf("\n\nUpper Page 0x03\n");
518 printf("\nOffset\t\tValues\n");
519 printf("------\t\t------");
520 while (row < MLX5E_EEPROM_PAGE_LENGTH) {
521 printf("\n0x%04X\t\t", row);
522 for (index_in_row = 0; index_in_row < line_length; index_in_row++) {
523 printf("%02X ", ((u8 *)eeprom->data)[byte_to_write]);
532 * Read cable EEPROM module information by first inspecting the first
533 * three bytes to get the initial information for a whole reading.
534 * Information will be printed to dmesg.
537 mlx5e_read_eeprom(SYSCTL_HANDLER_ARGS)
539 struct mlx5e_priv *priv = arg1;
540 struct mlx5e_eeprom eeprom;
545 error = sysctl_handle_int(oidp, &result, 0, req);
546 if (error || !req->newptr)
549 /* Check if device is gone */
556 eeprom.i2c_addr = MLX5E_I2C_ADDR_LOW;
557 eeprom.device_addr = 0;
558 eeprom.page_num = MLX5E_EEPROM_LOW_PAGE;
559 eeprom.page_valid = 0;
561 /* Read three first bytes to get important info */
562 error = mlx5e_get_eeprom_info(priv, &eeprom);
564 if_printf(priv->ifp, "%s:%d: Failed reading eeprom's "
565 "initial information\n", __func__, __LINE__);
570 * Allocate needed length buffer and additional space for
573 eeprom.data = malloc(eeprom.len + MLX5E_EEPROM_PAGE_LENGTH,
574 M_MLX5EN, M_WAITOK | M_ZERO);
576 /* Read the whole eeprom information */
577 error = mlx5e_get_eeprom(priv, &eeprom);
579 if_printf(priv->ifp, "%s:%d: Failed reading eeprom\n",
583 * Continue printing partial information in case of
587 mlx5e_print_eeprom(&eeprom);
588 free(eeprom.data, M_MLX5EN);
595 static const char *mlx5e_params_desc[] = {
596 MLX5E_PARAMS(MLX5E_STATS_DESC)
599 static const char *mlx5e_port_stats_debug_desc[] = {
600 MLX5E_PORT_STATS_DEBUG(MLX5E_STATS_DESC)
604 mlx5e_ethtool_debug_stats(SYSCTL_HANDLER_ARGS)
606 struct mlx5e_priv *priv = arg1;
610 sys_debug = priv->sysctl_debug;
611 error = sysctl_handle_int(oidp, &priv->sysctl_debug, 0, req);
612 if (error || !req->newptr)
614 priv->sysctl_debug = !!priv->sysctl_debug;
615 if (sys_debug == priv->sysctl_debug)
617 if (priv->sysctl_debug)
618 mlx5e_create_stats(&priv->stats.port_stats_debug.ctx,
619 SYSCTL_CHILDREN(priv->sysctl_ifnet), "debug_stats",
620 mlx5e_port_stats_debug_desc, MLX5E_PORT_STATS_DEBUG_NUM,
621 priv->stats.port_stats_debug.arg);
623 sysctl_ctx_free(&priv->stats.port_stats_debug.ctx);
628 mlx5e_create_ethtool(struct mlx5e_priv *priv)
630 struct sysctl_oid *node;
631 const char *pnameunit;
634 /* set some defaults */
635 priv->params_ethtool.tx_queue_size_max = 1 << MLX5E_PARAMS_MAXIMUM_LOG_SQ_SIZE;
636 priv->params_ethtool.rx_queue_size_max = 1 << MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE;
637 priv->params_ethtool.tx_queue_size = 1 << priv->params.log_sq_size;
638 priv->params_ethtool.rx_queue_size = 1 << priv->params.log_rq_size;
639 priv->params_ethtool.channels = priv->params.num_channels;
640 priv->params_ethtool.coalesce_pkts_max = MLX5E_FLD_MAX(cqc, cq_max_count);
641 priv->params_ethtool.coalesce_usecs_max = MLX5E_FLD_MAX(cqc, cq_period);
642 priv->params_ethtool.rx_coalesce_mode = priv->params.rx_cq_moderation_mode;
643 priv->params_ethtool.rx_coalesce_usecs = priv->params.rx_cq_moderation_usec;
644 priv->params_ethtool.rx_coalesce_pkts = priv->params.rx_cq_moderation_pkts;
645 priv->params_ethtool.tx_coalesce_mode = priv->params.tx_cq_moderation_mode;
646 priv->params_ethtool.tx_coalesce_usecs = priv->params.tx_cq_moderation_usec;
647 priv->params_ethtool.tx_coalesce_pkts = priv->params.tx_cq_moderation_pkts;
648 priv->params_ethtool.hw_lro = priv->params.hw_lro_en;
649 priv->params_ethtool.cqe_zipping = priv->params.cqe_zipping_en;
650 mlx5e_ethtool_sync_tx_completion_fact(priv);
652 /* create root node */
653 node = SYSCTL_ADD_NODE(&priv->sysctl_ctx,
654 SYSCTL_CHILDREN(priv->sysctl_ifnet), OID_AUTO,
655 "conf", CTLFLAG_RW, NULL, "Configuration");
658 for (x = 0; x != MLX5E_PARAMS_NUM; x++) {
659 /* check for read-only parameter */
660 if (strstr(mlx5e_params_desc[2 * x], "_max") != NULL) {
661 SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(node), OID_AUTO,
662 mlx5e_params_desc[2 * x], CTLTYPE_U64 | CTLFLAG_RD |
663 CTLFLAG_MPSAFE, priv, x, &mlx5e_ethtool_handler, "QU",
664 mlx5e_params_desc[2 * x + 1]);
666 #if (__FreeBSD_version < 1100000)
670 * NOTE: In FreeBSD-11 and newer the
671 * CTLFLAG_RWTUN flag will take care of
672 * loading default sysctl value from the
673 * kernel environment, if any:
675 SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(node), OID_AUTO,
676 mlx5e_params_desc[2 * x], CTLTYPE_U64 | CTLFLAG_RWTUN |
677 CTLFLAG_MPSAFE, priv, x, &mlx5e_ethtool_handler, "QU",
678 mlx5e_params_desc[2 * x + 1]);
680 #if (__FreeBSD_version < 1100000)
681 /* compute path for sysctl */
682 snprintf(path, sizeof(path), "dev.mce.%d.conf.%s",
683 device_get_unit(priv->mdev->pdev->dev.bsddev),
684 mlx5e_params_desc[2 * x]);
686 /* try to fetch tunable, if any */
687 if (TUNABLE_QUAD_FETCH(path, &priv->params_ethtool.arg[x]))
688 mlx5e_ethtool_handler(NULL, priv, x, NULL);
693 SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(node), OID_AUTO,
694 "debug_stats", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, priv,
695 0, &mlx5e_ethtool_debug_stats, "I", "Extended debug statistics");
697 pnameunit = device_get_nameunit(priv->mdev->pdev->dev.bsddev);
699 SYSCTL_ADD_STRING(&priv->sysctl_ctx, SYSCTL_CHILDREN(node),
700 OID_AUTO, "device_name", CTLFLAG_RD,
701 __DECONST(void *, pnameunit), 0,
705 SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(node), OID_AUTO, "eeprom_info",
706 CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, priv, 0,
707 mlx5e_read_eeprom, "I", "EEPROM information");