2 * Linux network driver for Brocade Converged Network Adapter.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License (GPL) Version 2 as
6 * published by the Free Software Foundation
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
14 * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
21 #include <linux/netdevice.h>
22 #include <linux/skbuff.h>
23 #include <linux/ethtool.h>
24 #include <linux/rtnetlink.h>
30 #define BNAD_NUM_TXF_COUNTERS 12
31 #define BNAD_NUM_RXF_COUNTERS 10
32 #define BNAD_NUM_CQ_COUNTERS 3
33 #define BNAD_NUM_RXQ_COUNTERS 6
34 #define BNAD_NUM_TXQ_COUNTERS 5
36 #define BNAD_ETHTOOL_STATS_NUM \
37 (sizeof(struct rtnl_link_stats64) / sizeof(u64) + \
38 sizeof(struct bnad_drv_stats) / sizeof(u64) + \
39 offsetof(struct bfi_ll_stats, rxf_stats[0]) / sizeof(u64))
41 static char *bnad_net_stats_strings
[BNAD_ETHTOOL_STATS_NUM
] = {
63 "tx_heartbeat_errors",
71 "netif_queue_stopped",
87 "rxp_info_alloc_failed",
90 "tx_unmap_q_alloc_failed",
91 "rx_unmap_q_alloc_failed",
99 "mac_frame_1024_1518",
100 "mac_frame_1518_1522",
106 "mac_rx_control_frames",
108 "mac_rx_unknown_opcode",
109 "mac_rx_alignment_error",
110 "mac_rx_frame_length_error",
112 "mac_rx_carrier_sense_error",
125 "mac_tx_excessive_deferral",
126 "mac_tx_single_collision",
127 "mac_tx_muliple_collision",
128 "mac_tx_late_collision",
129 "mac_tx_excessive_collision",
130 "mac_tx_total_collision",
131 "mac_tx_pause_honored",
135 "mac_tx_control_frame",
148 "bpc_tx_zero_pause_0",
149 "bpc_tx_zero_pause_1",
150 "bpc_tx_zero_pause_2",
151 "bpc_tx_zero_pause_3",
152 "bpc_tx_zero_pause_4",
153 "bpc_tx_zero_pause_5",
154 "bpc_tx_zero_pause_6",
155 "bpc_tx_zero_pause_7",
156 "bpc_tx_first_pause_0",
157 "bpc_tx_first_pause_1",
158 "bpc_tx_first_pause_2",
159 "bpc_tx_first_pause_3",
160 "bpc_tx_first_pause_4",
161 "bpc_tx_first_pause_5",
162 "bpc_tx_first_pause_6",
163 "bpc_tx_first_pause_7",
173 "bpc_rx_zero_pause_0",
174 "bpc_rx_zero_pause_1",
175 "bpc_rx_zero_pause_2",
176 "bpc_rx_zero_pause_3",
177 "bpc_rx_zero_pause_4",
178 "bpc_rx_zero_pause_5",
179 "bpc_rx_zero_pause_6",
180 "bpc_rx_zero_pause_7",
181 "bpc_rx_first_pause_0",
182 "bpc_rx_first_pause_1",
183 "bpc_rx_first_pause_2",
184 "bpc_rx_first_pause_3",
185 "bpc_rx_first_pause_4",
186 "bpc_rx_first_pause_5",
187 "bpc_rx_first_pause_6",
188 "bpc_rx_first_pause_7",
192 "rad_rx_vlan_frames",
194 "rad_rx_ucast_octets",
197 "rad_rx_mcast_octets",
200 "rad_rx_bcast_octets",
204 "fc_rx_ucast_octets",
207 "fc_rx_mcast_octets",
210 "fc_rx_bcast_octets",
214 "fc_tx_ucast_octets",
217 "fc_tx_mcast_octets",
220 "fc_tx_bcast_octets",
223 "fc_tx_parity_errors",
225 "fc_tx_fid_parity_errors",
229 bnad_get_settings(struct net_device
*netdev
, struct ethtool_cmd
*cmd
)
231 cmd
->supported
= SUPPORTED_10000baseT_Full
;
232 cmd
->advertising
= ADVERTISED_10000baseT_Full
;
233 cmd
->autoneg
= AUTONEG_DISABLE
;
234 cmd
->supported
|= SUPPORTED_FIBRE
;
235 cmd
->advertising
|= ADVERTISED_FIBRE
;
236 cmd
->port
= PORT_FIBRE
;
237 cmd
->phy_address
= 0;
239 if (netif_carrier_ok(netdev
)) {
240 cmd
->speed
= SPEED_10000
;
241 cmd
->duplex
= DUPLEX_FULL
;
246 cmd
->transceiver
= XCVR_EXTERNAL
;
254 bnad_set_settings(struct net_device
*netdev
, struct ethtool_cmd
*cmd
)
256 /* 10G full duplex setting supported only */
257 if (cmd
->autoneg
== AUTONEG_ENABLE
)
258 return -EOPNOTSUPP
; else {
259 if ((cmd
->speed
== SPEED_10000
) && (cmd
->duplex
== DUPLEX_FULL
))
267 bnad_get_drvinfo(struct net_device
*netdev
, struct ethtool_drvinfo
*drvinfo
)
269 struct bnad
*bnad
= netdev_priv(netdev
);
270 struct bfa_ioc_attr
*ioc_attr
;
273 strcpy(drvinfo
->driver
, BNAD_NAME
);
274 strcpy(drvinfo
->version
, BNAD_VERSION
);
276 ioc_attr
= kzalloc(sizeof(*ioc_attr
), GFP_KERNEL
);
278 memset(ioc_attr
, 0, sizeof(*ioc_attr
));
279 spin_lock_irqsave(&bnad
->bna_lock
, flags
);
280 bfa_nw_ioc_get_attr(&bnad
->bna
.device
.ioc
, ioc_attr
);
281 spin_unlock_irqrestore(&bnad
->bna_lock
, flags
);
283 strncpy(drvinfo
->fw_version
, ioc_attr
->adapter_attr
.fw_ver
,
284 sizeof(drvinfo
->fw_version
) - 1);
288 strncpy(drvinfo
->bus_info
, pci_name(bnad
->pcidev
), ETHTOOL_BUSINFO_LEN
);
292 get_regs(struct bnad
*bnad
, u32
* regs
)
298 #define BNAD_GET_REG(addr) \
301 regs[num++] = readl(bnad->bar0 + (addr)); \
306 spin_lock_irqsave(&bnad
->bna_lock
, flags
);
308 /* DMA Block Internal Registers */
309 BNAD_GET_REG(DMA_CTRL_REG0
);
310 BNAD_GET_REG(DMA_CTRL_REG1
);
311 BNAD_GET_REG(DMA_ERR_INT_STATUS
);
312 BNAD_GET_REG(DMA_ERR_INT_ENABLE
);
313 BNAD_GET_REG(DMA_ERR_INT_STATUS_SET
);
315 /* APP Block Register Address Offset from BAR0 */
316 BNAD_GET_REG(HOSTFN0_INT_STATUS
);
317 BNAD_GET_REG(HOSTFN0_INT_MASK
);
318 BNAD_GET_REG(HOST_PAGE_NUM_FN0
);
319 BNAD_GET_REG(HOST_MSIX_ERR_INDEX_FN0
);
320 BNAD_GET_REG(FN0_PCIE_ERR_REG
);
321 BNAD_GET_REG(FN0_ERR_TYPE_STATUS_REG
);
322 BNAD_GET_REG(FN0_ERR_TYPE_MSK_STATUS_REG
);
324 BNAD_GET_REG(HOSTFN1_INT_STATUS
);
325 BNAD_GET_REG(HOSTFN1_INT_MASK
);
326 BNAD_GET_REG(HOST_PAGE_NUM_FN1
);
327 BNAD_GET_REG(HOST_MSIX_ERR_INDEX_FN1
);
328 BNAD_GET_REG(FN1_PCIE_ERR_REG
);
329 BNAD_GET_REG(FN1_ERR_TYPE_STATUS_REG
);
330 BNAD_GET_REG(FN1_ERR_TYPE_MSK_STATUS_REG
);
332 BNAD_GET_REG(PCIE_MISC_REG
);
334 BNAD_GET_REG(HOST_SEM0_INFO_REG
);
335 BNAD_GET_REG(HOST_SEM1_INFO_REG
);
336 BNAD_GET_REG(HOST_SEM2_INFO_REG
);
337 BNAD_GET_REG(HOST_SEM3_INFO_REG
);
339 BNAD_GET_REG(TEMPSENSE_CNTL_REG
);
340 BNAD_GET_REG(TEMPSENSE_STAT_REG
);
342 BNAD_GET_REG(APP_LOCAL_ERR_STAT
);
343 BNAD_GET_REG(APP_LOCAL_ERR_MSK
);
345 BNAD_GET_REG(PCIE_LNK_ERR_STAT
);
346 BNAD_GET_REG(PCIE_LNK_ERR_MSK
);
348 BNAD_GET_REG(FCOE_FIP_ETH_TYPE
);
349 BNAD_GET_REG(RESV_ETH_TYPE
);
351 BNAD_GET_REG(HOSTFN2_INT_STATUS
);
352 BNAD_GET_REG(HOSTFN2_INT_MASK
);
353 BNAD_GET_REG(HOST_PAGE_NUM_FN2
);
354 BNAD_GET_REG(HOST_MSIX_ERR_INDEX_FN2
);
355 BNAD_GET_REG(FN2_PCIE_ERR_REG
);
356 BNAD_GET_REG(FN2_ERR_TYPE_STATUS_REG
);
357 BNAD_GET_REG(FN2_ERR_TYPE_MSK_STATUS_REG
);
359 BNAD_GET_REG(HOSTFN3_INT_STATUS
);
360 BNAD_GET_REG(HOSTFN3_INT_MASK
);
361 BNAD_GET_REG(HOST_PAGE_NUM_FN3
);
362 BNAD_GET_REG(HOST_MSIX_ERR_INDEX_FN3
);
363 BNAD_GET_REG(FN3_PCIE_ERR_REG
);
364 BNAD_GET_REG(FN3_ERR_TYPE_STATUS_REG
);
365 BNAD_GET_REG(FN3_ERR_TYPE_MSK_STATUS_REG
);
367 /* Host Command Status Registers */
368 reg_addr
= HOST_CMDSTS0_CLR_REG
;
369 for (i
= 0; i
< 16; i
++) {
370 BNAD_GET_REG(reg_addr
);
371 BNAD_GET_REG(reg_addr
+ 4);
372 BNAD_GET_REG(reg_addr
+ 8);
376 /* Function ID register */
377 BNAD_GET_REG(FNC_ID_REG
);
379 /* Function personality register */
380 BNAD_GET_REG(FNC_PERS_REG
);
382 /* Operation mode register */
383 BNAD_GET_REG(OP_MODE
);
386 BNAD_GET_REG(LPU0_MBOX_CTL_REG
);
387 BNAD_GET_REG(LPU0_MBOX_CMD_REG
);
388 BNAD_GET_REG(LPU0_MBOX_LINK_0REG
);
389 BNAD_GET_REG(LPU1_MBOX_LINK_0REG
);
390 BNAD_GET_REG(LPU0_MBOX_STATUS_0REG
);
391 BNAD_GET_REG(LPU1_MBOX_STATUS_0REG
);
392 BNAD_GET_REG(LPU0_ERR_STATUS_REG
);
393 BNAD_GET_REG(LPU0_ERR_SET_REG
);
396 BNAD_GET_REG(LPU1_MBOX_CTL_REG
);
397 BNAD_GET_REG(LPU1_MBOX_CMD_REG
);
398 BNAD_GET_REG(LPU0_MBOX_LINK_1REG
);
399 BNAD_GET_REG(LPU1_MBOX_LINK_1REG
);
400 BNAD_GET_REG(LPU0_MBOX_STATUS_1REG
);
401 BNAD_GET_REG(LPU1_MBOX_STATUS_1REG
);
402 BNAD_GET_REG(LPU1_ERR_STATUS_REG
);
403 BNAD_GET_REG(LPU1_ERR_SET_REG
);
406 BNAD_GET_REG(PSS_CTL_REG
);
407 BNAD_GET_REG(PSS_ERR_STATUS_REG
);
408 BNAD_GET_REG(ERR_STATUS_SET
);
409 BNAD_GET_REG(PSS_RAM_ERR_STATUS_REG
);
411 /* Catapult CPQ Registers */
412 BNAD_GET_REG(HOSTFN0_LPU0_MBOX0_CMD_STAT
);
413 BNAD_GET_REG(HOSTFN0_LPU1_MBOX0_CMD_STAT
);
414 BNAD_GET_REG(LPU0_HOSTFN0_MBOX0_CMD_STAT
);
415 BNAD_GET_REG(LPU1_HOSTFN0_MBOX0_CMD_STAT
);
417 BNAD_GET_REG(HOSTFN0_LPU0_MBOX1_CMD_STAT
);
418 BNAD_GET_REG(HOSTFN0_LPU1_MBOX1_CMD_STAT
);
419 BNAD_GET_REG(LPU0_HOSTFN0_MBOX1_CMD_STAT
);
420 BNAD_GET_REG(LPU1_HOSTFN0_MBOX1_CMD_STAT
);
422 BNAD_GET_REG(HOSTFN1_LPU0_MBOX0_CMD_STAT
);
423 BNAD_GET_REG(HOSTFN1_LPU1_MBOX0_CMD_STAT
);
424 BNAD_GET_REG(LPU0_HOSTFN1_MBOX0_CMD_STAT
);
425 BNAD_GET_REG(LPU1_HOSTFN1_MBOX0_CMD_STAT
);
427 BNAD_GET_REG(HOSTFN1_LPU0_MBOX1_CMD_STAT
);
428 BNAD_GET_REG(HOSTFN1_LPU1_MBOX1_CMD_STAT
);
429 BNAD_GET_REG(LPU0_HOSTFN1_MBOX1_CMD_STAT
);
430 BNAD_GET_REG(LPU1_HOSTFN1_MBOX1_CMD_STAT
);
432 BNAD_GET_REG(HOSTFN2_LPU0_MBOX0_CMD_STAT
);
433 BNAD_GET_REG(HOSTFN2_LPU1_MBOX0_CMD_STAT
);
434 BNAD_GET_REG(LPU0_HOSTFN2_MBOX0_CMD_STAT
);
435 BNAD_GET_REG(LPU1_HOSTFN2_MBOX0_CMD_STAT
);
437 BNAD_GET_REG(HOSTFN2_LPU0_MBOX1_CMD_STAT
);
438 BNAD_GET_REG(HOSTFN2_LPU1_MBOX1_CMD_STAT
);
439 BNAD_GET_REG(LPU0_HOSTFN2_MBOX1_CMD_STAT
);
440 BNAD_GET_REG(LPU1_HOSTFN2_MBOX1_CMD_STAT
);
442 BNAD_GET_REG(HOSTFN3_LPU0_MBOX0_CMD_STAT
);
443 BNAD_GET_REG(HOSTFN3_LPU1_MBOX0_CMD_STAT
);
444 BNAD_GET_REG(LPU0_HOSTFN3_MBOX0_CMD_STAT
);
445 BNAD_GET_REG(LPU1_HOSTFN3_MBOX0_CMD_STAT
);
447 BNAD_GET_REG(HOSTFN3_LPU0_MBOX1_CMD_STAT
);
448 BNAD_GET_REG(HOSTFN3_LPU1_MBOX1_CMD_STAT
);
449 BNAD_GET_REG(LPU0_HOSTFN3_MBOX1_CMD_STAT
);
450 BNAD_GET_REG(LPU1_HOSTFN3_MBOX1_CMD_STAT
);
452 /* Host Function Force Parity Error Registers */
453 BNAD_GET_REG(HOSTFN0_LPU_FORCE_PERR
);
454 BNAD_GET_REG(HOSTFN1_LPU_FORCE_PERR
);
455 BNAD_GET_REG(HOSTFN2_LPU_FORCE_PERR
);
456 BNAD_GET_REG(HOSTFN3_LPU_FORCE_PERR
);
458 /* LL Port[0|1] Halt Mask Registers */
459 BNAD_GET_REG(LL_HALT_MSK_P0
);
460 BNAD_GET_REG(LL_HALT_MSK_P1
);
462 /* LL Port[0|1] Error Mask Registers */
463 BNAD_GET_REG(LL_ERR_MSK_P0
);
464 BNAD_GET_REG(LL_ERR_MSK_P1
);
466 /* EMC FLI Registers */
467 BNAD_GET_REG(FLI_CMD_REG
);
468 BNAD_GET_REG(FLI_ADDR_REG
);
469 BNAD_GET_REG(FLI_CTL_REG
);
470 BNAD_GET_REG(FLI_WRDATA_REG
);
471 BNAD_GET_REG(FLI_RDDATA_REG
);
472 BNAD_GET_REG(FLI_DEV_STATUS_REG
);
473 BNAD_GET_REG(FLI_SIG_WD_REG
);
475 BNAD_GET_REG(FLI_DEV_VENDOR_REG
);
476 BNAD_GET_REG(FLI_ERR_STATUS_REG
);
478 /* RxAdm 0 Registers */
479 BNAD_GET_REG(RAD0_CTL_REG
);
480 BNAD_GET_REG(RAD0_PE_PARM_REG
);
481 BNAD_GET_REG(RAD0_BCN_REG
);
482 BNAD_GET_REG(RAD0_DEFAULT_REG
);
483 BNAD_GET_REG(RAD0_PROMISC_REG
);
484 BNAD_GET_REG(RAD0_BCNQ_REG
);
485 BNAD_GET_REG(RAD0_DEFAULTQ_REG
);
487 BNAD_GET_REG(RAD0_ERR_STS
);
488 BNAD_GET_REG(RAD0_SET_ERR_STS
);
489 BNAD_GET_REG(RAD0_ERR_INT_EN
);
490 BNAD_GET_REG(RAD0_FIRST_ERR
);
491 BNAD_GET_REG(RAD0_FORCE_ERR
);
493 BNAD_GET_REG(RAD0_MAC_MAN_1H
);
494 BNAD_GET_REG(RAD0_MAC_MAN_1L
);
495 BNAD_GET_REG(RAD0_MAC_MAN_2H
);
496 BNAD_GET_REG(RAD0_MAC_MAN_2L
);
497 BNAD_GET_REG(RAD0_MAC_MAN_3H
);
498 BNAD_GET_REG(RAD0_MAC_MAN_3L
);
499 BNAD_GET_REG(RAD0_MAC_MAN_4H
);
500 BNAD_GET_REG(RAD0_MAC_MAN_4L
);
502 BNAD_GET_REG(RAD0_LAST4_IP
);
504 /* RxAdm 1 Registers */
505 BNAD_GET_REG(RAD1_CTL_REG
);
506 BNAD_GET_REG(RAD1_PE_PARM_REG
);
507 BNAD_GET_REG(RAD1_BCN_REG
);
508 BNAD_GET_REG(RAD1_DEFAULT_REG
);
509 BNAD_GET_REG(RAD1_PROMISC_REG
);
510 BNAD_GET_REG(RAD1_BCNQ_REG
);
511 BNAD_GET_REG(RAD1_DEFAULTQ_REG
);
513 BNAD_GET_REG(RAD1_ERR_STS
);
514 BNAD_GET_REG(RAD1_SET_ERR_STS
);
515 BNAD_GET_REG(RAD1_ERR_INT_EN
);
518 BNAD_GET_REG(TXA0_CTRL_REG
);
519 /* TxA0 TSO Sequence # Registers (RO) */
520 for (i
= 0; i
< 8; i
++) {
521 BNAD_GET_REG(TXA0_TSO_TCP_SEQ_REG(i
));
522 BNAD_GET_REG(TXA0_TSO_IP_INFO_REG(i
));
526 BNAD_GET_REG(TXA1_CTRL_REG
);
527 /* TxA1 TSO Sequence # Registers (RO) */
528 for (i
= 0; i
< 8; i
++) {
529 BNAD_GET_REG(TXA1_TSO_TCP_SEQ_REG(i
));
530 BNAD_GET_REG(TXA1_TSO_IP_INFO_REG(i
));
534 BNAD_GET_REG(RXA0_CTL_REG
);
535 BNAD_GET_REG(RXA1_CTL_REG
);
538 BNAD_GET_REG(PLB0_ECM_TIMER_REG
);
539 BNAD_GET_REG(PLB0_RL_CTL
);
540 for (i
= 0; i
< 8; i
++)
541 BNAD_GET_REG(PLB0_RL_MAX_BC(i
));
542 BNAD_GET_REG(PLB0_RL_TU_PRIO
);
543 for (i
= 0; i
< 8; i
++)
544 BNAD_GET_REG(PLB0_RL_BYTE_CNT(i
));
545 BNAD_GET_REG(PLB0_RL_MIN_REG
);
546 BNAD_GET_REG(PLB0_RL_MAX_REG
);
547 BNAD_GET_REG(PLB0_EMS_ADD_REG
);
550 BNAD_GET_REG(PLB1_ECM_TIMER_REG
);
551 BNAD_GET_REG(PLB1_RL_CTL
);
552 for (i
= 0; i
< 8; i
++)
553 BNAD_GET_REG(PLB1_RL_MAX_BC(i
));
554 BNAD_GET_REG(PLB1_RL_TU_PRIO
);
555 for (i
= 0; i
< 8; i
++)
556 BNAD_GET_REG(PLB1_RL_BYTE_CNT(i
));
557 BNAD_GET_REG(PLB1_RL_MIN_REG
);
558 BNAD_GET_REG(PLB1_RL_MAX_REG
);
559 BNAD_GET_REG(PLB1_EMS_ADD_REG
);
561 /* HQM Control Register */
562 BNAD_GET_REG(HQM0_CTL_REG
);
563 BNAD_GET_REG(HQM0_RXQ_STOP_SEM
);
564 BNAD_GET_REG(HQM0_TXQ_STOP_SEM
);
565 BNAD_GET_REG(HQM1_CTL_REG
);
566 BNAD_GET_REG(HQM1_RXQ_STOP_SEM
);
567 BNAD_GET_REG(HQM1_TXQ_STOP_SEM
);
570 BNAD_GET_REG(LUT0_ERR_STS
);
571 BNAD_GET_REG(LUT0_SET_ERR_STS
);
572 BNAD_GET_REG(LUT1_ERR_STS
);
573 BNAD_GET_REG(LUT1_SET_ERR_STS
);
576 BNAD_GET_REG(TRC_CTL_REG
);
577 BNAD_GET_REG(TRC_MODS_REG
);
578 BNAD_GET_REG(TRC_TRGC_REG
);
579 BNAD_GET_REG(TRC_CNT1_REG
);
580 BNAD_GET_REG(TRC_CNT2_REG
);
581 BNAD_GET_REG(TRC_NXTS_REG
);
582 BNAD_GET_REG(TRC_DIRR_REG
);
583 for (i
= 0; i
< 10; i
++)
584 BNAD_GET_REG(TRC_TRGM_REG(i
));
585 for (i
= 0; i
< 10; i
++)
586 BNAD_GET_REG(TRC_NXTM_REG(i
));
587 for (i
= 0; i
< 10; i
++)
588 BNAD_GET_REG(TRC_STRM_REG(i
));
590 spin_unlock_irqrestore(&bnad
->bna_lock
, flags
);
595 bnad_get_regs_len(struct net_device
*netdev
)
597 int ret
= get_regs(netdev_priv(netdev
), NULL
) * sizeof(u32
);
602 bnad_get_regs(struct net_device
*netdev
, struct ethtool_regs
*regs
, void *buf
)
604 memset(buf
, 0, bnad_get_regs_len(netdev
));
605 get_regs(netdev_priv(netdev
), buf
);
609 bnad_get_wol(struct net_device
*netdev
, struct ethtool_wolinfo
*wolinfo
)
611 wolinfo
->supported
= 0;
612 wolinfo
->wolopts
= 0;
616 bnad_get_coalesce(struct net_device
*netdev
, struct ethtool_coalesce
*coalesce
)
618 struct bnad
*bnad
= netdev_priv(netdev
);
621 /* Lock rqd. to access bnad->bna_lock */
622 spin_lock_irqsave(&bnad
->bna_lock
, flags
);
623 coalesce
->use_adaptive_rx_coalesce
=
624 (bnad
->cfg_flags
& BNAD_CF_DIM_ENABLED
) ? true : false;
625 spin_unlock_irqrestore(&bnad
->bna_lock
, flags
);
627 coalesce
->rx_coalesce_usecs
= bnad
->rx_coalescing_timeo
*
628 BFI_COALESCING_TIMER_UNIT
;
629 coalesce
->tx_coalesce_usecs
= bnad
->tx_coalescing_timeo
*
630 BFI_COALESCING_TIMER_UNIT
;
631 coalesce
->tx_max_coalesced_frames
= BFI_TX_INTERPKT_COUNT
;
637 bnad_set_coalesce(struct net_device
*netdev
, struct ethtool_coalesce
*coalesce
)
639 struct bnad
*bnad
= netdev_priv(netdev
);
641 int dim_timer_del
= 0;
643 if (coalesce
->rx_coalesce_usecs
== 0 ||
644 coalesce
->rx_coalesce_usecs
>
645 BFI_MAX_COALESCING_TIMEO
* BFI_COALESCING_TIMER_UNIT
)
648 if (coalesce
->tx_coalesce_usecs
== 0 ||
649 coalesce
->tx_coalesce_usecs
>
650 BFI_MAX_COALESCING_TIMEO
* BFI_COALESCING_TIMER_UNIT
)
653 mutex_lock(&bnad
->conf_mutex
);
655 * Do not need to store rx_coalesce_usecs here
656 * Every time DIM is disabled, we can get it from the
659 spin_lock_irqsave(&bnad
->bna_lock
, flags
);
660 if (coalesce
->use_adaptive_rx_coalesce
) {
661 if (!(bnad
->cfg_flags
& BNAD_CF_DIM_ENABLED
)) {
662 bnad
->cfg_flags
|= BNAD_CF_DIM_ENABLED
;
663 bnad_dim_timer_start(bnad
);
666 if (bnad
->cfg_flags
& BNAD_CF_DIM_ENABLED
) {
667 bnad
->cfg_flags
&= ~BNAD_CF_DIM_ENABLED
;
668 dim_timer_del
= bnad_dim_timer_running(bnad
);
670 clear_bit(BNAD_RF_DIM_TIMER_RUNNING
,
672 spin_unlock_irqrestore(&bnad
->bna_lock
, flags
);
673 del_timer_sync(&bnad
->dim_timer
);
674 spin_lock_irqsave(&bnad
->bna_lock
, flags
);
676 bnad_rx_coalescing_timeo_set(bnad
);
679 if (bnad
->tx_coalescing_timeo
!= coalesce
->tx_coalesce_usecs
/
680 BFI_COALESCING_TIMER_UNIT
) {
681 bnad
->tx_coalescing_timeo
= coalesce
->tx_coalesce_usecs
/
682 BFI_COALESCING_TIMER_UNIT
;
683 bnad_tx_coalescing_timeo_set(bnad
);
686 if (bnad
->rx_coalescing_timeo
!= coalesce
->rx_coalesce_usecs
/
687 BFI_COALESCING_TIMER_UNIT
) {
688 bnad
->rx_coalescing_timeo
= coalesce
->rx_coalesce_usecs
/
689 BFI_COALESCING_TIMER_UNIT
;
691 if (!(bnad
->cfg_flags
& BNAD_CF_DIM_ENABLED
))
692 bnad_rx_coalescing_timeo_set(bnad
);
696 /* Add Tx Inter-pkt DMA count? */
698 spin_unlock_irqrestore(&bnad
->bna_lock
, flags
);
700 mutex_unlock(&bnad
->conf_mutex
);
705 bnad_get_ringparam(struct net_device
*netdev
,
706 struct ethtool_ringparam
*ringparam
)
708 struct bnad
*bnad
= netdev_priv(netdev
);
710 ringparam
->rx_max_pending
= BNAD_MAX_Q_DEPTH
/ bnad_rxqs_per_cq
;
711 ringparam
->rx_mini_max_pending
= 0;
712 ringparam
->rx_jumbo_max_pending
= 0;
713 ringparam
->tx_max_pending
= BNAD_MAX_Q_DEPTH
;
715 ringparam
->rx_pending
= bnad
->rxq_depth
;
716 ringparam
->rx_mini_max_pending
= 0;
717 ringparam
->rx_jumbo_max_pending
= 0;
718 ringparam
->tx_pending
= bnad
->txq_depth
;
722 bnad_set_ringparam(struct net_device
*netdev
,
723 struct ethtool_ringparam
*ringparam
)
725 int i
, current_err
, err
= 0;
726 struct bnad
*bnad
= netdev_priv(netdev
);
728 mutex_lock(&bnad
->conf_mutex
);
729 if (ringparam
->rx_pending
== bnad
->rxq_depth
&&
730 ringparam
->tx_pending
== bnad
->txq_depth
) {
731 mutex_unlock(&bnad
->conf_mutex
);
735 if (ringparam
->rx_pending
< BNAD_MIN_Q_DEPTH
||
736 ringparam
->rx_pending
> BNAD_MAX_Q_DEPTH
/ bnad_rxqs_per_cq
||
737 !BNA_POWER_OF_2(ringparam
->rx_pending
)) {
738 mutex_unlock(&bnad
->conf_mutex
);
741 if (ringparam
->tx_pending
< BNAD_MIN_Q_DEPTH
||
742 ringparam
->tx_pending
> BNAD_MAX_Q_DEPTH
||
743 !BNA_POWER_OF_2(ringparam
->tx_pending
)) {
744 mutex_unlock(&bnad
->conf_mutex
);
748 if (ringparam
->rx_pending
!= bnad
->rxq_depth
) {
749 bnad
->rxq_depth
= ringparam
->rx_pending
;
750 for (i
= 0; i
< bnad
->num_rx
; i
++) {
751 if (!bnad
->rx_info
[i
].rx
)
753 bnad_cleanup_rx(bnad
, i
);
754 current_err
= bnad_setup_rx(bnad
, i
);
755 if (current_err
&& !err
)
759 if (ringparam
->tx_pending
!= bnad
->txq_depth
) {
760 bnad
->txq_depth
= ringparam
->tx_pending
;
761 for (i
= 0; i
< bnad
->num_tx
; i
++) {
762 if (!bnad
->tx_info
[i
].tx
)
764 bnad_cleanup_tx(bnad
, i
);
765 current_err
= bnad_setup_tx(bnad
, i
);
766 if (current_err
&& !err
)
771 mutex_unlock(&bnad
->conf_mutex
);
776 bnad_get_pauseparam(struct net_device
*netdev
,
777 struct ethtool_pauseparam
*pauseparam
)
779 struct bnad
*bnad
= netdev_priv(netdev
);
781 pauseparam
->autoneg
= 0;
782 pauseparam
->rx_pause
= bnad
->bna
.port
.pause_config
.rx_pause
;
783 pauseparam
->tx_pause
= bnad
->bna
.port
.pause_config
.tx_pause
;
787 bnad_set_pauseparam(struct net_device
*netdev
,
788 struct ethtool_pauseparam
*pauseparam
)
790 struct bnad
*bnad
= netdev_priv(netdev
);
791 struct bna_pause_config pause_config
;
794 if (pauseparam
->autoneg
== AUTONEG_ENABLE
)
797 mutex_lock(&bnad
->conf_mutex
);
798 if (pauseparam
->rx_pause
!= bnad
->bna
.port
.pause_config
.rx_pause
||
799 pauseparam
->tx_pause
!= bnad
->bna
.port
.pause_config
.tx_pause
) {
800 pause_config
.rx_pause
= pauseparam
->rx_pause
;
801 pause_config
.tx_pause
= pauseparam
->tx_pause
;
802 spin_lock_irqsave(&bnad
->bna_lock
, flags
);
803 bna_port_pause_config(&bnad
->bna
.port
, &pause_config
, NULL
);
804 spin_unlock_irqrestore(&bnad
->bna_lock
, flags
);
806 mutex_unlock(&bnad
->conf_mutex
);
811 bnad_get_rx_csum(struct net_device
*netdev
)
814 struct bnad
*bnad
= netdev_priv(netdev
);
816 rx_csum
= bnad
->rx_csum
;
821 bnad_set_rx_csum(struct net_device
*netdev
, u32 rx_csum
)
823 struct bnad
*bnad
= netdev_priv(netdev
);
825 mutex_lock(&bnad
->conf_mutex
);
826 bnad
->rx_csum
= rx_csum
;
827 mutex_unlock(&bnad
->conf_mutex
);
832 bnad_set_tx_csum(struct net_device
*netdev
, u32 tx_csum
)
834 struct bnad
*bnad
= netdev_priv(netdev
);
836 mutex_lock(&bnad
->conf_mutex
);
838 netdev
->features
|= NETIF_F_IP_CSUM
;
839 netdev
->features
|= NETIF_F_IPV6_CSUM
;
841 netdev
->features
&= ~NETIF_F_IP_CSUM
;
842 netdev
->features
&= ~NETIF_F_IPV6_CSUM
;
844 mutex_unlock(&bnad
->conf_mutex
);
849 bnad_set_tso(struct net_device
*netdev
, u32 tso
)
851 struct bnad
*bnad
= netdev_priv(netdev
);
853 mutex_lock(&bnad
->conf_mutex
);
855 netdev
->features
|= NETIF_F_TSO
;
856 netdev
->features
|= NETIF_F_TSO6
;
858 netdev
->features
&= ~NETIF_F_TSO
;
859 netdev
->features
&= ~NETIF_F_TSO6
;
861 mutex_unlock(&bnad
->conf_mutex
);
866 bnad_get_strings(struct net_device
*netdev
, u32 stringset
, u8
* string
)
868 struct bnad
*bnad
= netdev_priv(netdev
);
872 mutex_lock(&bnad
->conf_mutex
);
876 for (i
= 0; i
< BNAD_ETHTOOL_STATS_NUM
; i
++) {
877 BUG_ON(!(strlen(bnad_net_stats_strings
[i
]) <
879 memcpy(string
, bnad_net_stats_strings
[i
],
881 string
+= ETH_GSTRING_LEN
;
883 bmap
= (u64
)bnad
->bna
.tx_mod
.txf_bmap
[0] |
884 ((u64
)bnad
->bna
.tx_mod
.txf_bmap
[1] << 32);
885 for (i
= 0; bmap
&& (i
< BFI_LL_TXF_ID_MAX
); i
++) {
887 sprintf(string
, "txf%d_ucast_octets", i
);
888 string
+= ETH_GSTRING_LEN
;
889 sprintf(string
, "txf%d_ucast", i
);
890 string
+= ETH_GSTRING_LEN
;
891 sprintf(string
, "txf%d_ucast_vlan", i
);
892 string
+= ETH_GSTRING_LEN
;
893 sprintf(string
, "txf%d_mcast_octets", i
);
894 string
+= ETH_GSTRING_LEN
;
895 sprintf(string
, "txf%d_mcast", i
);
896 string
+= ETH_GSTRING_LEN
;
897 sprintf(string
, "txf%d_mcast_vlan", i
);
898 string
+= ETH_GSTRING_LEN
;
899 sprintf(string
, "txf%d_bcast_octets", i
);
900 string
+= ETH_GSTRING_LEN
;
901 sprintf(string
, "txf%d_bcast", i
);
902 string
+= ETH_GSTRING_LEN
;
903 sprintf(string
, "txf%d_bcast_vlan", i
);
904 string
+= ETH_GSTRING_LEN
;
905 sprintf(string
, "txf%d_errors", i
);
906 string
+= ETH_GSTRING_LEN
;
907 sprintf(string
, "txf%d_filter_vlan", i
);
908 string
+= ETH_GSTRING_LEN
;
909 sprintf(string
, "txf%d_filter_mac_sa", i
);
910 string
+= ETH_GSTRING_LEN
;
915 bmap
= (u64
)bnad
->bna
.rx_mod
.rxf_bmap
[0] |
916 ((u64
)bnad
->bna
.rx_mod
.rxf_bmap
[1] << 32);
917 for (i
= 0; bmap
&& (i
< BFI_LL_RXF_ID_MAX
); i
++) {
919 sprintf(string
, "rxf%d_ucast_octets", i
);
920 string
+= ETH_GSTRING_LEN
;
921 sprintf(string
, "rxf%d_ucast", i
);
922 string
+= ETH_GSTRING_LEN
;
923 sprintf(string
, "rxf%d_ucast_vlan", i
);
924 string
+= ETH_GSTRING_LEN
;
925 sprintf(string
, "rxf%d_mcast_octets", i
);
926 string
+= ETH_GSTRING_LEN
;
927 sprintf(string
, "rxf%d_mcast", i
);
928 string
+= ETH_GSTRING_LEN
;
929 sprintf(string
, "rxf%d_mcast_vlan", i
);
930 string
+= ETH_GSTRING_LEN
;
931 sprintf(string
, "rxf%d_bcast_octets", i
);
932 string
+= ETH_GSTRING_LEN
;
933 sprintf(string
, "rxf%d_bcast", i
);
934 string
+= ETH_GSTRING_LEN
;
935 sprintf(string
, "rxf%d_bcast_vlan", i
);
936 string
+= ETH_GSTRING_LEN
;
937 sprintf(string
, "rxf%d_frame_drops", i
);
938 string
+= ETH_GSTRING_LEN
;
944 for (i
= 0; i
< bnad
->num_rx
; i
++) {
945 if (!bnad
->rx_info
[i
].rx
)
947 for (j
= 0; j
< bnad
->num_rxp_per_rx
; j
++) {
948 sprintf(string
, "cq%d_producer_index", q_num
);
949 string
+= ETH_GSTRING_LEN
;
950 sprintf(string
, "cq%d_consumer_index", q_num
);
951 string
+= ETH_GSTRING_LEN
;
952 sprintf(string
, "cq%d_hw_producer_index",
954 string
+= ETH_GSTRING_LEN
;
960 for (i
= 0; i
< bnad
->num_rx
; i
++) {
961 if (!bnad
->rx_info
[i
].rx
)
963 for (j
= 0; j
< bnad
->num_rxp_per_rx
; j
++) {
964 sprintf(string
, "rxq%d_packets", q_num
);
965 string
+= ETH_GSTRING_LEN
;
966 sprintf(string
, "rxq%d_bytes", q_num
);
967 string
+= ETH_GSTRING_LEN
;
968 sprintf(string
, "rxq%d_packets_with_error",
970 string
+= ETH_GSTRING_LEN
;
971 sprintf(string
, "rxq%d_allocbuf_failed", q_num
);
972 string
+= ETH_GSTRING_LEN
;
973 sprintf(string
, "rxq%d_producer_index", q_num
);
974 string
+= ETH_GSTRING_LEN
;
975 sprintf(string
, "rxq%d_consumer_index", q_num
);
976 string
+= ETH_GSTRING_LEN
;
978 if (bnad
->rx_info
[i
].rx_ctrl
[j
].ccb
&&
979 bnad
->rx_info
[i
].rx_ctrl
[j
].ccb
->
981 bnad
->rx_info
[i
].rx_ctrl
[j
].ccb
->
983 sprintf(string
, "rxq%d_packets", q_num
);
984 string
+= ETH_GSTRING_LEN
;
985 sprintf(string
, "rxq%d_bytes", q_num
);
986 string
+= ETH_GSTRING_LEN
;
988 "rxq%d_packets_with_error", q_num
);
989 string
+= ETH_GSTRING_LEN
;
990 sprintf(string
, "rxq%d_allocbuf_failed",
992 string
+= ETH_GSTRING_LEN
;
993 sprintf(string
, "rxq%d_producer_index",
995 string
+= ETH_GSTRING_LEN
;
996 sprintf(string
, "rxq%d_consumer_index",
998 string
+= ETH_GSTRING_LEN
;
1005 for (i
= 0; i
< bnad
->num_tx
; i
++) {
1006 if (!bnad
->tx_info
[i
].tx
)
1008 for (j
= 0; j
< bnad
->num_txq_per_tx
; j
++) {
1009 sprintf(string
, "txq%d_packets", q_num
);
1010 string
+= ETH_GSTRING_LEN
;
1011 sprintf(string
, "txq%d_bytes", q_num
);
1012 string
+= ETH_GSTRING_LEN
;
1013 sprintf(string
, "txq%d_producer_index", q_num
);
1014 string
+= ETH_GSTRING_LEN
;
1015 sprintf(string
, "txq%d_consumer_index", q_num
);
1016 string
+= ETH_GSTRING_LEN
;
1017 sprintf(string
, "txq%d_hw_consumer_index",
1019 string
+= ETH_GSTRING_LEN
;
1030 mutex_unlock(&bnad
->conf_mutex
);
1034 bnad_get_stats_count_locked(struct net_device
*netdev
)
1036 struct bnad
*bnad
= netdev_priv(netdev
);
1037 int i
, j
, count
, rxf_active_num
= 0, txf_active_num
= 0;
1040 bmap
= (u64
)bnad
->bna
.tx_mod
.txf_bmap
[0] |
1041 ((u64
)bnad
->bna
.tx_mod
.txf_bmap
[1] << 32);
1042 for (i
= 0; bmap
&& (i
< BFI_LL_TXF_ID_MAX
); i
++) {
1047 bmap
= (u64
)bnad
->bna
.rx_mod
.rxf_bmap
[0] |
1048 ((u64
)bnad
->bna
.rx_mod
.rxf_bmap
[1] << 32);
1049 for (i
= 0; bmap
&& (i
< BFI_LL_RXF_ID_MAX
); i
++) {
1054 count
= BNAD_ETHTOOL_STATS_NUM
+
1055 txf_active_num
* BNAD_NUM_TXF_COUNTERS
+
1056 rxf_active_num
* BNAD_NUM_RXF_COUNTERS
;
1058 for (i
= 0; i
< bnad
->num_rx
; i
++) {
1059 if (!bnad
->rx_info
[i
].rx
)
1061 count
+= bnad
->num_rxp_per_rx
* BNAD_NUM_CQ_COUNTERS
;
1062 count
+= bnad
->num_rxp_per_rx
* BNAD_NUM_RXQ_COUNTERS
;
1063 for (j
= 0; j
< bnad
->num_rxp_per_rx
; j
++)
1064 if (bnad
->rx_info
[i
].rx_ctrl
[j
].ccb
&&
1065 bnad
->rx_info
[i
].rx_ctrl
[j
].ccb
->rcb
[1] &&
1066 bnad
->rx_info
[i
].rx_ctrl
[j
].ccb
->rcb
[1]->rxq
)
1067 count
+= BNAD_NUM_RXQ_COUNTERS
;
1070 for (i
= 0; i
< bnad
->num_tx
; i
++) {
1071 if (!bnad
->tx_info
[i
].tx
)
1073 count
+= bnad
->num_txq_per_tx
* BNAD_NUM_TXQ_COUNTERS
;
1079 bnad_per_q_stats_fill(struct bnad
*bnad
, u64
*buf
, int bi
)
1082 struct bna_rcb
*rcb
= NULL
;
1083 struct bna_tcb
*tcb
= NULL
;
1085 for (i
= 0; i
< bnad
->num_rx
; i
++) {
1086 if (!bnad
->rx_info
[i
].rx
)
1088 for (j
= 0; j
< bnad
->num_rxp_per_rx
; j
++)
1089 if (bnad
->rx_info
[i
].rx_ctrl
[j
].ccb
&&
1090 bnad
->rx_info
[i
].rx_ctrl
[j
].ccb
->rcb
[0] &&
1091 bnad
->rx_info
[i
].rx_ctrl
[j
].ccb
->rcb
[0]->rxq
) {
1092 buf
[bi
++] = bnad
->rx_info
[i
].rx_ctrl
[j
].
1093 ccb
->producer_index
;
1094 buf
[bi
++] = 0; /* ccb->consumer_index */
1095 buf
[bi
++] = *(bnad
->rx_info
[i
].rx_ctrl
[j
].
1096 ccb
->hw_producer_index
);
1099 for (i
= 0; i
< bnad
->num_rx
; i
++) {
1100 if (!bnad
->rx_info
[i
].rx
)
1102 for (j
= 0; j
< bnad
->num_rxp_per_rx
; j
++)
1103 if (bnad
->rx_info
[i
].rx_ctrl
[j
].ccb
) {
1104 if (bnad
->rx_info
[i
].rx_ctrl
[j
].ccb
->rcb
[0] &&
1105 bnad
->rx_info
[i
].rx_ctrl
[j
].ccb
->
1107 rcb
= bnad
->rx_info
[i
].rx_ctrl
[j
].
1109 buf
[bi
++] = rcb
->rxq
->rx_packets
;
1110 buf
[bi
++] = rcb
->rxq
->rx_bytes
;
1111 buf
[bi
++] = rcb
->rxq
->
1112 rx_packets_with_error
;
1113 buf
[bi
++] = rcb
->rxq
->
1115 buf
[bi
++] = rcb
->producer_index
;
1116 buf
[bi
++] = rcb
->consumer_index
;
1118 if (bnad
->rx_info
[i
].rx_ctrl
[j
].ccb
->rcb
[1] &&
1119 bnad
->rx_info
[i
].rx_ctrl
[j
].ccb
->
1121 rcb
= bnad
->rx_info
[i
].rx_ctrl
[j
].
1123 buf
[bi
++] = rcb
->rxq
->rx_packets
;
1124 buf
[bi
++] = rcb
->rxq
->rx_bytes
;
1125 buf
[bi
++] = rcb
->rxq
->
1126 rx_packets_with_error
;
1127 buf
[bi
++] = rcb
->rxq
->
1129 buf
[bi
++] = rcb
->producer_index
;
1130 buf
[bi
++] = rcb
->consumer_index
;
1135 for (i
= 0; i
< bnad
->num_tx
; i
++) {
1136 if (!bnad
->tx_info
[i
].tx
)
1138 for (j
= 0; j
< bnad
->num_txq_per_tx
; j
++)
1139 if (bnad
->tx_info
[i
].tcb
[j
] &&
1140 bnad
->tx_info
[i
].tcb
[j
]->txq
) {
1141 tcb
= bnad
->tx_info
[i
].tcb
[j
];
1142 buf
[bi
++] = tcb
->txq
->tx_packets
;
1143 buf
[bi
++] = tcb
->txq
->tx_bytes
;
1144 buf
[bi
++] = tcb
->producer_index
;
1145 buf
[bi
++] = tcb
->consumer_index
;
1146 buf
[bi
++] = *(tcb
->hw_consumer_index
);
1154 bnad_get_ethtool_stats(struct net_device
*netdev
, struct ethtool_stats
*stats
,
1157 struct bnad
*bnad
= netdev_priv(netdev
);
1159 unsigned long flags
;
1160 struct rtnl_link_stats64
*net_stats64
;
1164 mutex_lock(&bnad
->conf_mutex
);
1165 if (bnad_get_stats_count_locked(netdev
) != stats
->n_stats
) {
1166 mutex_unlock(&bnad
->conf_mutex
);
1171 * Used bna_lock to sync reads from bna_stats, which is written
1172 * under the same lock
1174 spin_lock_irqsave(&bnad
->bna_lock
, flags
);
1176 memset(buf
, 0, stats
->n_stats
* sizeof(u64
));
1178 net_stats64
= (struct rtnl_link_stats64
*)buf
;
1179 bnad_netdev_qstats_fill(bnad
, net_stats64
);
1180 bnad_netdev_hwstats_fill(bnad
, net_stats64
);
1182 bi
= sizeof(*net_stats64
) / sizeof(u64
);
1184 /* Get netif_queue_stopped from stack */
1185 bnad
->stats
.drv_stats
.netif_queue_stopped
= netif_queue_stopped(netdev
);
1187 /* Fill driver stats into ethtool buffers */
1188 stats64
= (u64
*)&bnad
->stats
.drv_stats
;
1189 for (i
= 0; i
< sizeof(struct bnad_drv_stats
) / sizeof(u64
); i
++)
1190 buf
[bi
++] = stats64
[i
];
1192 /* Fill hardware stats excluding the rxf/txf into ethtool bufs */
1193 stats64
= (u64
*) bnad
->stats
.bna_stats
->hw_stats
;
1195 i
< offsetof(struct bfi_ll_stats
, rxf_stats
[0]) / sizeof(u64
);
1197 buf
[bi
++] = stats64
[i
];
1199 /* Fill txf stats into ethtool buffers */
1200 bmap
= (u64
)bnad
->bna
.tx_mod
.txf_bmap
[0] |
1201 ((u64
)bnad
->bna
.tx_mod
.txf_bmap
[1] << 32);
1202 for (i
= 0; bmap
&& (i
< BFI_LL_TXF_ID_MAX
); i
++) {
1204 stats64
= (u64
*)&bnad
->stats
.bna_stats
->
1205 hw_stats
->txf_stats
[i
];
1206 for (j
= 0; j
< sizeof(struct bfi_ll_stats_txf
) /
1208 buf
[bi
++] = stats64
[j
];
1213 /* Fill rxf stats into ethtool buffers */
1214 bmap
= (u64
)bnad
->bna
.rx_mod
.rxf_bmap
[0] |
1215 ((u64
)bnad
->bna
.rx_mod
.rxf_bmap
[1] << 32);
1216 for (i
= 0; bmap
&& (i
< BFI_LL_RXF_ID_MAX
); i
++) {
1218 stats64
= (u64
*)&bnad
->stats
.bna_stats
->
1219 hw_stats
->rxf_stats
[i
];
1220 for (j
= 0; j
< sizeof(struct bfi_ll_stats_rxf
) /
1222 buf
[bi
++] = stats64
[j
];
1227 /* Fill per Q stats into ethtool buffers */
1228 bi
= bnad_per_q_stats_fill(bnad
, buf
, bi
);
1230 spin_unlock_irqrestore(&bnad
->bna_lock
, flags
);
1232 mutex_unlock(&bnad
->conf_mutex
);
1236 bnad_get_sset_count(struct net_device
*netdev
, int sset
)
1240 return bnad_get_stats_count_locked(netdev
);
1246 static struct ethtool_ops bnad_ethtool_ops
= {
1247 .get_settings
= bnad_get_settings
,
1248 .set_settings
= bnad_set_settings
,
1249 .get_drvinfo
= bnad_get_drvinfo
,
1250 .get_regs_len
= bnad_get_regs_len
,
1251 .get_regs
= bnad_get_regs
,
1252 .get_wol
= bnad_get_wol
,
1253 .get_link
= ethtool_op_get_link
,
1254 .get_coalesce
= bnad_get_coalesce
,
1255 .set_coalesce
= bnad_set_coalesce
,
1256 .get_ringparam
= bnad_get_ringparam
,
1257 .set_ringparam
= bnad_set_ringparam
,
1258 .get_pauseparam
= bnad_get_pauseparam
,
1259 .set_pauseparam
= bnad_set_pauseparam
,
1260 .get_rx_csum
= bnad_get_rx_csum
,
1261 .set_rx_csum
= bnad_set_rx_csum
,
1262 .get_tx_csum
= ethtool_op_get_tx_csum
,
1263 .set_tx_csum
= bnad_set_tx_csum
,
1264 .get_sg
= ethtool_op_get_sg
,
1265 .set_sg
= ethtool_op_set_sg
,
1266 .get_tso
= ethtool_op_get_tso
,
1267 .set_tso
= bnad_set_tso
,
1268 .get_strings
= bnad_get_strings
,
1269 .get_ethtool_stats
= bnad_get_ethtool_stats
,
1270 .get_sset_count
= bnad_get_sset_count
1274 bnad_set_ethtool_ops(struct net_device
*netdev
)
1276 SET_ETHTOOL_OPS(netdev
, &bnad_ethtool_ops
);