Lines Matching +full:supported +full:- +full:hw

1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 1999 - 2024 Intel Corporation. */
31 sizeof(((struct ixgbe_adapter *)0)->m), \
34 sizeof(((struct rtnl_link_stats64 *)0)->m), \
111 #define IXGBE_NUM_RX_QUEUES netdev->num_tx_queues
114 (netdev->num_tx_queues + IXGBE_NUM_RX_QUEUES) * \
118 (sizeof(((struct ixgbe_adapter *)0)->stats.pxonrxc) + \
119 sizeof(((struct ixgbe_adapter *)0)->stats.pxontxc) + \
120 sizeof(((struct ixgbe_adapter *)0)->stats.pxoffrxc) + \
121 sizeof(((struct ixgbe_adapter *)0)->stats.pxofftxc)) \
136 "legacy-rx",
138 "vf-ipsec",
140 "mdd-disable-vf",
147 static void ixgbe_set_supported_10gtypes(struct ixgbe_hw *hw, in ixgbe_set_supported_10gtypes() argument
150 if (!ixgbe_isbackplane(hw->phy.media_type)) { in ixgbe_set_supported_10gtypes()
151 ethtool_link_ksettings_add_link_mode(cmd, supported, in ixgbe_set_supported_10gtypes()
156 switch (hw->device_id) { in ixgbe_set_supported_10gtypes()
162 (cmd, supported, 10000baseKX4_Full); in ixgbe_set_supported_10gtypes()
169 (cmd, supported, 10000baseKR_Full); in ixgbe_set_supported_10gtypes()
173 (cmd, supported, 10000baseKX4_Full); in ixgbe_set_supported_10gtypes()
175 (cmd, supported, 10000baseKR_Full); in ixgbe_set_supported_10gtypes()
180 static void ixgbe_set_advertising_10gtypes(struct ixgbe_hw *hw, in ixgbe_set_advertising_10gtypes() argument
183 if (!ixgbe_isbackplane(hw->phy.media_type)) { in ixgbe_set_advertising_10gtypes()
189 switch (hw->device_id) { in ixgbe_set_advertising_10gtypes()
217 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_link_ksettings() local
221 ethtool_link_ksettings_zero_link_mode(cmd, supported); in ixgbe_get_link_ksettings()
224 hw->mac.ops.get_link_capabilities(hw, &supported_link, &autoneg); in ixgbe_get_link_ksettings()
226 /* set the supported link speeds */ in ixgbe_get_link_ksettings()
228 ixgbe_set_supported_10gtypes(hw, cmd); in ixgbe_get_link_ksettings()
229 ixgbe_set_advertising_10gtypes(hw, cmd); in ixgbe_get_link_ksettings()
232 ethtool_link_ksettings_add_link_mode(cmd, supported, in ixgbe_get_link_ksettings()
236 ethtool_link_ksettings_add_link_mode(cmd, supported, in ixgbe_get_link_ksettings()
240 if (ixgbe_isbackplane(hw->phy.media_type)) { in ixgbe_get_link_ksettings()
241 ethtool_link_ksettings_add_link_mode(cmd, supported, in ixgbe_get_link_ksettings()
246 ethtool_link_ksettings_add_link_mode(cmd, supported, in ixgbe_get_link_ksettings()
253 ethtool_link_ksettings_add_link_mode(cmd, supported, in ixgbe_get_link_ksettings()
259 ethtool_link_ksettings_add_link_mode(cmd, supported, in ixgbe_get_link_ksettings()
266 if (hw->phy.autoneg_advertised) { in ixgbe_get_link_ksettings()
268 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_10_FULL) in ixgbe_get_link_ksettings()
271 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_100_FULL) in ixgbe_get_link_ksettings()
274 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_10GB_FULL) in ixgbe_get_link_ksettings()
275 ixgbe_set_advertising_10gtypes(hw, cmd); in ixgbe_get_link_ksettings()
276 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_1GB_FULL) { in ixgbe_get_link_ksettings()
278 (cmd, supported, 1000baseKX_Full)) in ixgbe_get_link_ksettings()
285 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_5GB_FULL) in ixgbe_get_link_ksettings()
288 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_2_5GB_FULL) in ixgbe_get_link_ksettings()
292 if (hw->phy.multispeed_fiber && !autoneg) { in ixgbe_get_link_ksettings()
300 ethtool_link_ksettings_add_link_mode(cmd, supported, Autoneg); in ixgbe_get_link_ksettings()
302 cmd->base.autoneg = AUTONEG_ENABLE; in ixgbe_get_link_ksettings()
304 cmd->base.autoneg = AUTONEG_DISABLE; in ixgbe_get_link_ksettings()
307 switch (adapter->hw.phy.type) { in ixgbe_get_link_ksettings()
313 ethtool_link_ksettings_add_link_mode(cmd, supported, TP); in ixgbe_get_link_ksettings()
315 cmd->base.port = PORT_TP; in ixgbe_get_link_ksettings()
318 ethtool_link_ksettings_add_link_mode(cmd, supported, FIBRE); in ixgbe_get_link_ksettings()
320 cmd->base.port = PORT_FIBRE; in ixgbe_get_link_ksettings()
334 switch (adapter->hw.phy.sfp_type) { in ixgbe_get_link_ksettings()
338 ethtool_link_ksettings_add_link_mode(cmd, supported, in ixgbe_get_link_ksettings()
342 cmd->base.port = PORT_DA; in ixgbe_get_link_ksettings()
354 ethtool_link_ksettings_add_link_mode(cmd, supported, in ixgbe_get_link_ksettings()
358 cmd->base.port = PORT_FIBRE; in ixgbe_get_link_ksettings()
361 ethtool_link_ksettings_add_link_mode(cmd, supported, in ixgbe_get_link_ksettings()
365 cmd->base.port = PORT_NONE; in ixgbe_get_link_ksettings()
369 ethtool_link_ksettings_add_link_mode(cmd, supported, in ixgbe_get_link_ksettings()
373 cmd->base.port = PORT_TP; in ixgbe_get_link_ksettings()
377 ethtool_link_ksettings_add_link_mode(cmd, supported, in ixgbe_get_link_ksettings()
381 cmd->base.port = PORT_OTHER; in ixgbe_get_link_ksettings()
386 ethtool_link_ksettings_add_link_mode(cmd, supported, in ixgbe_get_link_ksettings()
390 cmd->base.port = PORT_NONE; in ixgbe_get_link_ksettings()
396 ethtool_link_ksettings_add_link_mode(cmd, supported, in ixgbe_get_link_ksettings()
400 cmd->base.port = PORT_OTHER; in ixgbe_get_link_ksettings()
405 ethtool_link_ksettings_add_link_mode(cmd, supported, Pause); in ixgbe_get_link_ksettings()
407 switch (hw->fc.requested_mode) { in ixgbe_get_link_ksettings()
427 switch (adapter->link_speed) { in ixgbe_get_link_ksettings()
429 cmd->base.speed = SPEED_10000; in ixgbe_get_link_ksettings()
432 cmd->base.speed = SPEED_5000; in ixgbe_get_link_ksettings()
435 cmd->base.speed = SPEED_2500; in ixgbe_get_link_ksettings()
438 cmd->base.speed = SPEED_1000; in ixgbe_get_link_ksettings()
441 cmd->base.speed = SPEED_100; in ixgbe_get_link_ksettings()
444 cmd->base.speed = SPEED_10; in ixgbe_get_link_ksettings()
449 cmd->base.duplex = DUPLEX_FULL; in ixgbe_get_link_ksettings()
451 cmd->base.speed = SPEED_UNKNOWN; in ixgbe_get_link_ksettings()
452 cmd->base.duplex = DUPLEX_UNKNOWN; in ixgbe_get_link_ksettings()
462 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_link_ksettings() local
466 if ((hw->phy.media_type == ixgbe_media_type_copper) || in ixgbe_set_link_ksettings()
467 (hw->phy.multispeed_fiber)) { in ixgbe_set_link_ksettings()
472 if (!linkmode_subset(cmd->link_modes.advertising, in ixgbe_set_link_ksettings()
473 cmd->link_modes.supported)) in ixgbe_set_link_ksettings()
474 return -EINVAL; in ixgbe_set_link_ksettings()
477 if (!cmd->base.autoneg && hw->phy.multispeed_fiber) { in ixgbe_set_link_ksettings()
482 return -EINVAL; in ixgbe_set_link_ksettings()
485 old = hw->phy.autoneg_advertised; in ixgbe_set_link_ksettings()
510 /* this sets the link speed and restarts auto-neg */ in ixgbe_set_link_ksettings()
511 while (test_and_set_bit(__IXGBE_IN_SFP_INIT, &adapter->state)) in ixgbe_set_link_ksettings()
514 hw->mac.autotry_restart = true; in ixgbe_set_link_ksettings()
515 err = hw->mac.ops.setup_link(hw, advertised, true); in ixgbe_set_link_ksettings()
518 hw->mac.ops.setup_link(hw, old, true); in ixgbe_set_link_ksettings()
520 clear_bit(__IXGBE_IN_SFP_INIT, &adapter->state); in ixgbe_set_link_ksettings()
523 u32 speed = cmd->base.speed; in ixgbe_set_link_ksettings()
525 if ((cmd->base.autoneg == AUTONEG_ENABLE) || in ixgbe_set_link_ksettings()
528 (speed + cmd->base.duplex != SPEED_10000 + DUPLEX_FULL)) in ixgbe_set_link_ksettings()
529 return -EINVAL; in ixgbe_set_link_ksettings()
539 struct ixgbe_hw_stats *hwstats = &adapter->stats; in ixgbe_get_pause_stats()
541 stats->tx_pause_frames = hwstats->lxontxc + hwstats->lxofftxc; in ixgbe_get_pause_stats()
542 stats->rx_pause_frames = hwstats->lxonrxc + hwstats->lxoffrxc; in ixgbe_get_pause_stats()
549 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_pauseparam() local
551 if (ixgbe_device_supports_autoneg_fc(hw) && in ixgbe_get_pauseparam()
552 !hw->fc.disable_fc_autoneg) in ixgbe_get_pauseparam()
553 pause->autoneg = 1; in ixgbe_get_pauseparam()
555 pause->autoneg = 0; in ixgbe_get_pauseparam()
557 if (hw->fc.current_mode == ixgbe_fc_rx_pause) { in ixgbe_get_pauseparam()
558 pause->rx_pause = 1; in ixgbe_get_pauseparam()
559 } else if (hw->fc.current_mode == ixgbe_fc_tx_pause) { in ixgbe_get_pauseparam()
560 pause->tx_pause = 1; in ixgbe_get_pauseparam()
561 } else if (hw->fc.current_mode == ixgbe_fc_full) { in ixgbe_get_pauseparam()
562 pause->rx_pause = 1; in ixgbe_get_pauseparam()
563 pause->tx_pause = 1; in ixgbe_get_pauseparam()
571 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_pauseparam() local
572 struct ixgbe_fc_info fc = hw->fc; in ixgbe_set_pauseparam()
575 if ((hw->mac.type == ixgbe_mac_82598EB) && in ixgbe_set_pauseparam()
576 (adapter->flags & IXGBE_FLAG_DCB_ENABLED)) in ixgbe_set_pauseparam()
577 return -EINVAL; in ixgbe_set_pauseparam()
580 if ((pause->autoneg == AUTONEG_ENABLE) && in ixgbe_set_pauseparam()
581 !ixgbe_device_supports_autoneg_fc(hw)) in ixgbe_set_pauseparam()
582 return -EINVAL; in ixgbe_set_pauseparam()
584 fc.disable_fc_autoneg = (pause->autoneg != AUTONEG_ENABLE); in ixgbe_set_pauseparam()
586 if ((pause->rx_pause && pause->tx_pause) || pause->autoneg) in ixgbe_set_pauseparam()
588 else if (pause->rx_pause && !pause->tx_pause) in ixgbe_set_pauseparam()
590 else if (!pause->rx_pause && pause->tx_pause) in ixgbe_set_pauseparam()
596 if (memcmp(&fc, &hw->fc, sizeof(struct ixgbe_fc_info))) { in ixgbe_set_pauseparam()
597 hw->fc = fc; in ixgbe_set_pauseparam()
610 return adapter->msg_enable; in ixgbe_get_msglevel()
616 adapter->msg_enable = data; in ixgbe_set_msglevel()
625 #define IXGBE_GET_STAT(_A_, _R_) _A_->stats._R_
631 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_regs() local
637 regs->version = hw->mac.type << 24 | hw->revision_id << 16 | in ixgbe_get_regs()
638 hw->device_id; in ixgbe_get_regs()
641 regs_buff[0] = IXGBE_READ_REG(hw, IXGBE_CTRL); in ixgbe_get_regs()
642 regs_buff[1] = IXGBE_READ_REG(hw, IXGBE_STATUS); in ixgbe_get_regs()
643 regs_buff[2] = IXGBE_READ_REG(hw, IXGBE_CTRL_EXT); in ixgbe_get_regs()
644 regs_buff[3] = IXGBE_READ_REG(hw, IXGBE_ESDP); in ixgbe_get_regs()
645 regs_buff[4] = IXGBE_READ_REG(hw, IXGBE_EODSDP); in ixgbe_get_regs()
646 regs_buff[5] = IXGBE_READ_REG(hw, IXGBE_LEDCTL); in ixgbe_get_regs()
647 regs_buff[6] = IXGBE_READ_REG(hw, IXGBE_FRTIMER); in ixgbe_get_regs()
648 regs_buff[7] = IXGBE_READ_REG(hw, IXGBE_TCPTIMER); in ixgbe_get_regs()
651 regs_buff[8] = IXGBE_READ_REG(hw, IXGBE_EEC(hw)); in ixgbe_get_regs()
652 regs_buff[9] = IXGBE_READ_REG(hw, IXGBE_EERD); in ixgbe_get_regs()
653 regs_buff[10] = IXGBE_READ_REG(hw, IXGBE_FLA(hw)); in ixgbe_get_regs()
654 regs_buff[11] = IXGBE_READ_REG(hw, IXGBE_EEMNGCTL); in ixgbe_get_regs()
655 regs_buff[12] = IXGBE_READ_REG(hw, IXGBE_EEMNGDATA); in ixgbe_get_regs()
656 regs_buff[13] = IXGBE_READ_REG(hw, IXGBE_FLMNGCTL); in ixgbe_get_regs()
657 regs_buff[14] = IXGBE_READ_REG(hw, IXGBE_FLMNGDATA); in ixgbe_get_regs()
658 regs_buff[15] = IXGBE_READ_REG(hw, IXGBE_FLMNGCNT); in ixgbe_get_regs()
659 regs_buff[16] = IXGBE_READ_REG(hw, IXGBE_FLOP); in ixgbe_get_regs()
660 regs_buff[17] = IXGBE_READ_REG(hw, IXGBE_GRC(hw)); in ixgbe_get_regs()
665 regs_buff[18] = IXGBE_READ_REG(hw, IXGBE_EICS); in ixgbe_get_regs()
666 regs_buff[19] = IXGBE_READ_REG(hw, IXGBE_EICS); in ixgbe_get_regs()
667 regs_buff[20] = IXGBE_READ_REG(hw, IXGBE_EIMS); in ixgbe_get_regs()
668 regs_buff[21] = IXGBE_READ_REG(hw, IXGBE_EIMC); in ixgbe_get_regs()
669 regs_buff[22] = IXGBE_READ_REG(hw, IXGBE_EIAC); in ixgbe_get_regs()
670 regs_buff[23] = IXGBE_READ_REG(hw, IXGBE_EIAM); in ixgbe_get_regs()
671 regs_buff[24] = IXGBE_READ_REG(hw, IXGBE_EITR(0)); in ixgbe_get_regs()
672 regs_buff[25] = IXGBE_READ_REG(hw, IXGBE_IVAR(0)); in ixgbe_get_regs()
673 regs_buff[26] = IXGBE_READ_REG(hw, IXGBE_MSIXT); in ixgbe_get_regs()
674 regs_buff[27] = IXGBE_READ_REG(hw, IXGBE_MSIXPBA); in ixgbe_get_regs()
675 regs_buff[28] = IXGBE_READ_REG(hw, IXGBE_PBACL(0)); in ixgbe_get_regs()
676 regs_buff[29] = IXGBE_READ_REG(hw, IXGBE_GPIE); in ixgbe_get_regs()
679 regs_buff[30] = IXGBE_READ_REG(hw, IXGBE_PFCTOP); in ixgbe_get_regs()
681 regs_buff[31 + i] = IXGBE_READ_REG(hw, IXGBE_FCTTV(i)); in ixgbe_get_regs()
683 switch (hw->mac.type) { in ixgbe_get_regs()
685 regs_buff[35 + i] = IXGBE_READ_REG(hw, IXGBE_FCRTL(i)); in ixgbe_get_regs()
686 regs_buff[43 + i] = IXGBE_READ_REG(hw, IXGBE_FCRTH(i)); in ixgbe_get_regs()
694 regs_buff[35 + i] = IXGBE_READ_REG(hw, IXGBE_FCRTL_82599(i)); in ixgbe_get_regs()
695 regs_buff[43 + i] = IXGBE_READ_REG(hw, IXGBE_FCRTH_82599(i)); in ixgbe_get_regs()
701 regs_buff[51] = IXGBE_READ_REG(hw, IXGBE_FCRTV); in ixgbe_get_regs()
702 regs_buff[52] = IXGBE_READ_REG(hw, IXGBE_TFCS); in ixgbe_get_regs()
706 regs_buff[53 + i] = IXGBE_READ_REG(hw, IXGBE_RDBAL(i)); in ixgbe_get_regs()
708 regs_buff[117 + i] = IXGBE_READ_REG(hw, IXGBE_RDBAH(i)); in ixgbe_get_regs()
710 regs_buff[181 + i] = IXGBE_READ_REG(hw, IXGBE_RDLEN(i)); in ixgbe_get_regs()
712 regs_buff[245 + i] = IXGBE_READ_REG(hw, IXGBE_RDH(i)); in ixgbe_get_regs()
714 regs_buff[309 + i] = IXGBE_READ_REG(hw, IXGBE_RDT(i)); in ixgbe_get_regs()
716 regs_buff[373 + i] = IXGBE_READ_REG(hw, IXGBE_RXDCTL(i)); in ixgbe_get_regs()
718 regs_buff[437 + i] = IXGBE_READ_REG(hw, IXGBE_SRRCTL(i)); in ixgbe_get_regs()
720 regs_buff[453 + i] = IXGBE_READ_REG(hw, IXGBE_DCA_RXCTRL(i)); in ixgbe_get_regs()
721 regs_buff[469] = IXGBE_READ_REG(hw, IXGBE_RDRXCTL); in ixgbe_get_regs()
723 regs_buff[470 + i] = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(i)); in ixgbe_get_regs()
724 regs_buff[478] = IXGBE_READ_REG(hw, IXGBE_RXCTRL); in ixgbe_get_regs()
725 regs_buff[479] = IXGBE_READ_REG(hw, IXGBE_DROPEN); in ixgbe_get_regs()
728 regs_buff[480] = IXGBE_READ_REG(hw, IXGBE_RXCSUM); in ixgbe_get_regs()
729 regs_buff[481] = IXGBE_READ_REG(hw, IXGBE_RFCTL); in ixgbe_get_regs()
731 regs_buff[482 + i] = IXGBE_READ_REG(hw, IXGBE_RAL(i)); in ixgbe_get_regs()
733 regs_buff[498 + i] = IXGBE_READ_REG(hw, IXGBE_RAH(i)); in ixgbe_get_regs()
734 regs_buff[514] = IXGBE_READ_REG(hw, IXGBE_PSRTYPE(0)); in ixgbe_get_regs()
735 regs_buff[515] = IXGBE_READ_REG(hw, IXGBE_FCTRL); in ixgbe_get_regs()
736 regs_buff[516] = IXGBE_READ_REG(hw, IXGBE_VLNCTRL); in ixgbe_get_regs()
737 regs_buff[517] = IXGBE_READ_REG(hw, IXGBE_MCSTCTRL); in ixgbe_get_regs()
738 regs_buff[518] = IXGBE_READ_REG(hw, IXGBE_MRQC); in ixgbe_get_regs()
739 regs_buff[519] = IXGBE_READ_REG(hw, IXGBE_VMD_CTL); in ixgbe_get_regs()
741 regs_buff[520 + i] = IXGBE_READ_REG(hw, IXGBE_IMIR(i)); in ixgbe_get_regs()
743 regs_buff[528 + i] = IXGBE_READ_REG(hw, IXGBE_IMIREXT(i)); in ixgbe_get_regs()
744 regs_buff[536] = IXGBE_READ_REG(hw, IXGBE_IMIRVP); in ixgbe_get_regs()
748 regs_buff[537 + i] = IXGBE_READ_REG(hw, IXGBE_TDBAL(i)); in ixgbe_get_regs()
750 regs_buff[569 + i] = IXGBE_READ_REG(hw, IXGBE_TDBAH(i)); in ixgbe_get_regs()
752 regs_buff[601 + i] = IXGBE_READ_REG(hw, IXGBE_TDLEN(i)); in ixgbe_get_regs()
754 regs_buff[633 + i] = IXGBE_READ_REG(hw, IXGBE_TDH(i)); in ixgbe_get_regs()
756 regs_buff[665 + i] = IXGBE_READ_REG(hw, IXGBE_TDT(i)); in ixgbe_get_regs()
758 regs_buff[697 + i] = IXGBE_READ_REG(hw, IXGBE_TXDCTL(i)); in ixgbe_get_regs()
760 regs_buff[729 + i] = IXGBE_READ_REG(hw, IXGBE_TDWBAL(i)); in ixgbe_get_regs()
762 regs_buff[761 + i] = IXGBE_READ_REG(hw, IXGBE_TDWBAH(i)); in ixgbe_get_regs()
763 regs_buff[793] = IXGBE_READ_REG(hw, IXGBE_DTXCTL); in ixgbe_get_regs()
765 regs_buff[794 + i] = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL(i)); in ixgbe_get_regs()
766 regs_buff[810] = IXGBE_READ_REG(hw, IXGBE_TIPG); in ixgbe_get_regs()
768 regs_buff[811 + i] = IXGBE_READ_REG(hw, IXGBE_TXPBSIZE(i)); in ixgbe_get_regs()
769 regs_buff[819] = IXGBE_READ_REG(hw, IXGBE_MNGTXMAP); in ixgbe_get_regs()
772 regs_buff[820] = IXGBE_READ_REG(hw, IXGBE_WUC); in ixgbe_get_regs()
773 regs_buff[821] = IXGBE_READ_REG(hw, IXGBE_WUFC); in ixgbe_get_regs()
774 regs_buff[822] = IXGBE_READ_REG(hw, IXGBE_WUS); in ixgbe_get_regs()
775 regs_buff[823] = IXGBE_READ_REG(hw, IXGBE_IPAV); in ixgbe_get_regs()
776 regs_buff[824] = IXGBE_READ_REG(hw, IXGBE_IP4AT); in ixgbe_get_regs()
777 regs_buff[825] = IXGBE_READ_REG(hw, IXGBE_IP6AT); in ixgbe_get_regs()
778 regs_buff[826] = IXGBE_READ_REG(hw, IXGBE_WUPL); in ixgbe_get_regs()
779 regs_buff[827] = IXGBE_READ_REG(hw, IXGBE_WUPM); in ixgbe_get_regs()
780 regs_buff[828] = IXGBE_READ_REG(hw, IXGBE_FHFT(0)); in ixgbe_get_regs()
783 regs_buff[829] = IXGBE_READ_REG(hw, IXGBE_RMCS); /* same as FCCFG */ in ixgbe_get_regs()
784 regs_buff[831] = IXGBE_READ_REG(hw, IXGBE_PDPMCS); /* same as RTTPCS */ in ixgbe_get_regs()
786 switch (hw->mac.type) { in ixgbe_get_regs()
788 regs_buff[830] = IXGBE_READ_REG(hw, IXGBE_DPMCS); in ixgbe_get_regs()
789 regs_buff[832] = IXGBE_READ_REG(hw, IXGBE_RUPPBMR); in ixgbe_get_regs()
792 IXGBE_READ_REG(hw, IXGBE_RT2CR(i)); in ixgbe_get_regs()
795 IXGBE_READ_REG(hw, IXGBE_RT2SR(i)); in ixgbe_get_regs()
798 IXGBE_READ_REG(hw, IXGBE_TDTQ2TCCR(i)); in ixgbe_get_regs()
801 IXGBE_READ_REG(hw, IXGBE_TDTQ2TCSR(i)); in ixgbe_get_regs()
808 regs_buff[830] = IXGBE_READ_REG(hw, IXGBE_RTTDCS); in ixgbe_get_regs()
809 regs_buff[832] = IXGBE_READ_REG(hw, IXGBE_RTRPCS); in ixgbe_get_regs()
812 IXGBE_READ_REG(hw, IXGBE_RTRPT4C(i)); in ixgbe_get_regs()
815 IXGBE_READ_REG(hw, IXGBE_RTRPT4S(i)); in ixgbe_get_regs()
818 IXGBE_READ_REG(hw, IXGBE_RTTDT2C(i)); in ixgbe_get_regs()
821 IXGBE_READ_REG(hw, IXGBE_RTTDT2S(i)); in ixgbe_get_regs()
829 IXGBE_READ_REG(hw, IXGBE_TDPT2TCCR(i)); /* same as RTTPT2C */ in ixgbe_get_regs()
832 IXGBE_READ_REG(hw, IXGBE_TDPT2TCSR(i)); /* same as RTTPT2S */ in ixgbe_get_regs()
902 regs_buff[1038] = IXGBE_READ_REG(hw, IXGBE_PCS1GCFIG); in ixgbe_get_regs()
903 regs_buff[1039] = IXGBE_READ_REG(hw, IXGBE_PCS1GLCTL); in ixgbe_get_regs()
904 regs_buff[1040] = IXGBE_READ_REG(hw, IXGBE_PCS1GLSTA); in ixgbe_get_regs()
905 regs_buff[1041] = IXGBE_READ_REG(hw, IXGBE_PCS1GDBG0); in ixgbe_get_regs()
906 regs_buff[1042] = IXGBE_READ_REG(hw, IXGBE_PCS1GDBG1); in ixgbe_get_regs()
907 regs_buff[1043] = IXGBE_READ_REG(hw, IXGBE_PCS1GANA); in ixgbe_get_regs()
908 regs_buff[1044] = IXGBE_READ_REG(hw, IXGBE_PCS1GANLP); in ixgbe_get_regs()
909 regs_buff[1045] = IXGBE_READ_REG(hw, IXGBE_PCS1GANNP); in ixgbe_get_regs()
910 regs_buff[1046] = IXGBE_READ_REG(hw, IXGBE_PCS1GANLPNP); in ixgbe_get_regs()
911 regs_buff[1047] = IXGBE_READ_REG(hw, IXGBE_HLREG0); in ixgbe_get_regs()
912 regs_buff[1048] = IXGBE_READ_REG(hw, IXGBE_HLREG1); in ixgbe_get_regs()
913 regs_buff[1049] = IXGBE_READ_REG(hw, IXGBE_PAP); in ixgbe_get_regs()
914 regs_buff[1050] = IXGBE_READ_REG(hw, IXGBE_MACA); in ixgbe_get_regs()
915 regs_buff[1051] = IXGBE_READ_REG(hw, IXGBE_APAE); in ixgbe_get_regs()
916 regs_buff[1052] = IXGBE_READ_REG(hw, IXGBE_ARD); in ixgbe_get_regs()
917 regs_buff[1053] = IXGBE_READ_REG(hw, IXGBE_AIS); in ixgbe_get_regs()
918 regs_buff[1054] = IXGBE_READ_REG(hw, IXGBE_MSCA); in ixgbe_get_regs()
919 regs_buff[1055] = IXGBE_READ_REG(hw, IXGBE_MSRWD); in ixgbe_get_regs()
920 regs_buff[1056] = IXGBE_READ_REG(hw, IXGBE_MLADD); in ixgbe_get_regs()
921 regs_buff[1057] = IXGBE_READ_REG(hw, IXGBE_MHADD); in ixgbe_get_regs()
922 regs_buff[1058] = IXGBE_READ_REG(hw, IXGBE_TREG); in ixgbe_get_regs()
923 regs_buff[1059] = IXGBE_READ_REG(hw, IXGBE_PCSS1); in ixgbe_get_regs()
924 regs_buff[1060] = IXGBE_READ_REG(hw, IXGBE_PCSS2); in ixgbe_get_regs()
925 regs_buff[1061] = IXGBE_READ_REG(hw, IXGBE_XPCSS); in ixgbe_get_regs()
926 regs_buff[1062] = IXGBE_READ_REG(hw, IXGBE_SERDESC); in ixgbe_get_regs()
927 regs_buff[1063] = IXGBE_READ_REG(hw, IXGBE_MACS); in ixgbe_get_regs()
928 regs_buff[1064] = IXGBE_READ_REG(hw, IXGBE_AUTOC); in ixgbe_get_regs()
929 regs_buff[1065] = IXGBE_READ_REG(hw, IXGBE_LINKS); in ixgbe_get_regs()
930 regs_buff[1066] = IXGBE_READ_REG(hw, IXGBE_AUTOC2); in ixgbe_get_regs()
931 regs_buff[1067] = IXGBE_READ_REG(hw, IXGBE_AUTOC3); in ixgbe_get_regs()
932 regs_buff[1068] = IXGBE_READ_REG(hw, IXGBE_ANLP1); in ixgbe_get_regs()
933 regs_buff[1069] = IXGBE_READ_REG(hw, IXGBE_ANLP2); in ixgbe_get_regs()
934 regs_buff[1070] = IXGBE_READ_REG(hw, IXGBE_ATLASCTL); in ixgbe_get_regs()
937 regs_buff[1071] = IXGBE_READ_REG(hw, IXGBE_RDSTATCTL); in ixgbe_get_regs()
939 regs_buff[1072 + i] = IXGBE_READ_REG(hw, IXGBE_RDSTAT(i)); in ixgbe_get_regs()
940 regs_buff[1080] = IXGBE_READ_REG(hw, IXGBE_RDHMPN); in ixgbe_get_regs()
942 regs_buff[1081 + i] = IXGBE_READ_REG(hw, IXGBE_RIC_DW(i)); in ixgbe_get_regs()
943 regs_buff[1085] = IXGBE_READ_REG(hw, IXGBE_RDPROBE); in ixgbe_get_regs()
944 regs_buff[1086] = IXGBE_READ_REG(hw, IXGBE_TDSTATCTL); in ixgbe_get_regs()
946 regs_buff[1087 + i] = IXGBE_READ_REG(hw, IXGBE_TDSTAT(i)); in ixgbe_get_regs()
947 regs_buff[1095] = IXGBE_READ_REG(hw, IXGBE_TDHMPN); in ixgbe_get_regs()
949 regs_buff[1096 + i] = IXGBE_READ_REG(hw, IXGBE_TIC_DW(i)); in ixgbe_get_regs()
950 regs_buff[1100] = IXGBE_READ_REG(hw, IXGBE_TDPROBE); in ixgbe_get_regs()
951 regs_buff[1101] = IXGBE_READ_REG(hw, IXGBE_TXBUFCTRL); in ixgbe_get_regs()
953 regs_buff[1102 + i] = IXGBE_READ_REG(hw, IXGBE_TXBUFDATA(i)); in ixgbe_get_regs()
954 regs_buff[1106] = IXGBE_READ_REG(hw, IXGBE_RXBUFCTRL); in ixgbe_get_regs()
956 regs_buff[1107 + i] = IXGBE_READ_REG(hw, IXGBE_RXBUFDATA(i)); in ixgbe_get_regs()
958 regs_buff[1111 + i] = IXGBE_READ_REG(hw, IXGBE_PCIE_DIAG(i)); in ixgbe_get_regs()
959 regs_buff[1119] = IXGBE_READ_REG(hw, IXGBE_RFVAL); in ixgbe_get_regs()
960 regs_buff[1120] = IXGBE_READ_REG(hw, IXGBE_MDFTC1); in ixgbe_get_regs()
961 regs_buff[1121] = IXGBE_READ_REG(hw, IXGBE_MDFTC2); in ixgbe_get_regs()
962 regs_buff[1122] = IXGBE_READ_REG(hw, IXGBE_MDFTFIFO1); in ixgbe_get_regs()
963 regs_buff[1123] = IXGBE_READ_REG(hw, IXGBE_MDFTFIFO2); in ixgbe_get_regs()
964 regs_buff[1124] = IXGBE_READ_REG(hw, IXGBE_MDFTS); in ixgbe_get_regs()
965 regs_buff[1125] = IXGBE_READ_REG(hw, IXGBE_PCIEECCCTL); in ixgbe_get_regs()
966 regs_buff[1126] = IXGBE_READ_REG(hw, IXGBE_PBTXECC); in ixgbe_get_regs()
967 regs_buff[1127] = IXGBE_READ_REG(hw, IXGBE_PBRXECC); in ixgbe_get_regs()
970 regs_buff[1128] = IXGBE_READ_REG(hw, IXGBE_MFLCN); in ixgbe_get_regs()
973 regs_buff[1129] = IXGBE_READ_REG(hw, IXGBE_RTRUP2TC); in ixgbe_get_regs()
974 regs_buff[1130] = IXGBE_READ_REG(hw, IXGBE_RTTUP2TC); in ixgbe_get_regs()
976 regs_buff[1131 + i] = IXGBE_READ_REG(hw, IXGBE_TXLLQ(i)); in ixgbe_get_regs()
977 regs_buff[1135] = IXGBE_READ_REG(hw, IXGBE_RTTBCNRM); in ixgbe_get_regs()
979 regs_buff[1136] = IXGBE_READ_REG(hw, IXGBE_RTTBCNRD); in ixgbe_get_regs()
983 regs_buff[1137] = IXGBE_READ_REG(hw, IXGBE_RTTQCNCR); in ixgbe_get_regs()
984 regs_buff[1138] = IXGBE_READ_REG(hw, IXGBE_RTTQCNTG); in ixgbe_get_regs()
987 regs_buff[1139] = IXGBE_READ_REG(hw, IXGBE_SECTXCTRL); in ixgbe_get_regs()
988 regs_buff[1140] = IXGBE_READ_REG(hw, IXGBE_SECTXSTAT); in ixgbe_get_regs()
989 regs_buff[1141] = IXGBE_READ_REG(hw, IXGBE_SECTXBUFFAF); in ixgbe_get_regs()
990 regs_buff[1142] = IXGBE_READ_REG(hw, IXGBE_SECTXMINIFG); in ixgbe_get_regs()
991 regs_buff[1143] = IXGBE_READ_REG(hw, IXGBE_SECRXCTRL); in ixgbe_get_regs()
992 regs_buff[1144] = IXGBE_READ_REG(hw, IXGBE_SECRXSTAT); in ixgbe_get_regs()
998 return adapter->hw.eeprom.word_size * 2; in ixgbe_get_eeprom_len()
1005 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_eeprom() local
1011 if (eeprom->len == 0) in ixgbe_get_eeprom()
1012 return -EINVAL; in ixgbe_get_eeprom()
1014 eeprom->magic = hw->vendor_id | (hw->device_id << 16); in ixgbe_get_eeprom()
1016 first_word = eeprom->offset >> 1; in ixgbe_get_eeprom()
1017 last_word = (eeprom->offset + eeprom->len - 1) >> 1; in ixgbe_get_eeprom()
1018 eeprom_len = last_word - first_word + 1; in ixgbe_get_eeprom()
1022 return -ENOMEM; in ixgbe_get_eeprom()
1024 ret_val = hw->eeprom.ops.read_buffer(hw, first_word, eeprom_len, in ixgbe_get_eeprom()
1027 /* Device's eeprom is always little-endian, word addressable */ in ixgbe_get_eeprom()
1031 memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 1), eeprom->len); in ixgbe_get_eeprom()
1041 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_eeprom() local
1047 if (eeprom->len == 0) in ixgbe_set_eeprom()
1048 return -EINVAL; in ixgbe_set_eeprom()
1050 if (eeprom->magic != (hw->vendor_id | (hw->device_id << 16))) in ixgbe_set_eeprom()
1051 return -EINVAL; in ixgbe_set_eeprom()
1053 max_len = hw->eeprom.word_size * 2; in ixgbe_set_eeprom()
1055 first_word = eeprom->offset >> 1; in ixgbe_set_eeprom()
1056 last_word = (eeprom->offset + eeprom->len - 1) >> 1; in ixgbe_set_eeprom()
1059 return -ENOMEM; in ixgbe_set_eeprom()
1063 if (eeprom->offset & 1) { in ixgbe_set_eeprom()
1068 ret_val = hw->eeprom.ops.read(hw, first_word, &eeprom_buff[0]); in ixgbe_set_eeprom()
1074 if ((eeprom->offset + eeprom->len) & 1) { in ixgbe_set_eeprom()
1079 ret_val = hw->eeprom.ops.read(hw, last_word, in ixgbe_set_eeprom()
1080 &eeprom_buff[last_word - first_word]); in ixgbe_set_eeprom()
1085 /* Device's eeprom is always little-endian, word addressable */ in ixgbe_set_eeprom()
1086 for (i = 0; i < last_word - first_word + 1; i++) in ixgbe_set_eeprom()
1089 memcpy(ptr, bytes, eeprom->len); in ixgbe_set_eeprom()
1091 for (i = 0; i < last_word - first_word + 1; i++) in ixgbe_set_eeprom()
1094 ret_val = hw->eeprom.ops.write_buffer(hw, first_word, in ixgbe_set_eeprom()
1095 last_word - first_word + 1, in ixgbe_set_eeprom()
1100 hw->eeprom.ops.update_checksum(hw); in ixgbe_set_eeprom()
1112 strscpy(drvinfo->driver, ixgbe_driver_name, sizeof(drvinfo->driver)); in ixgbe_get_drvinfo()
1114 strscpy(drvinfo->fw_version, adapter->eeprom_id, in ixgbe_get_drvinfo()
1115 sizeof(drvinfo->fw_version)); in ixgbe_get_drvinfo()
1117 strscpy(drvinfo->bus_info, pci_name(adapter->pdev), in ixgbe_get_drvinfo()
1118 sizeof(drvinfo->bus_info)); in ixgbe_get_drvinfo()
1120 drvinfo->n_priv_flags = IXGBE_PRIV_FLAGS_STR_LEN; in ixgbe_get_drvinfo()
1125 switch (adapter->hw.mac.type) { in ixgbe_get_max_rxd()
1143 switch (adapter->hw.mac.type) { in ixgbe_get_max_txd()
1165 struct ixgbe_ring *tx_ring = adapter->tx_ring[0]; in ixgbe_get_ringparam()
1166 struct ixgbe_ring *rx_ring = adapter->rx_ring[0]; in ixgbe_get_ringparam()
1168 ring->rx_max_pending = ixgbe_get_max_rxd(adapter); in ixgbe_get_ringparam()
1169 ring->tx_max_pending = ixgbe_get_max_txd(adapter); in ixgbe_get_ringparam()
1170 ring->rx_pending = rx_ring->count; in ixgbe_get_ringparam()
1171 ring->tx_pending = tx_ring->count; in ixgbe_get_ringparam()
1184 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) in ixgbe_set_ringparam()
1185 return -EINVAL; in ixgbe_set_ringparam()
1187 new_tx_count = clamp_t(u32, ring->tx_pending, in ixgbe_set_ringparam()
1191 new_rx_count = clamp_t(u32, ring->rx_pending, in ixgbe_set_ringparam()
1195 if ((new_tx_count == adapter->tx_ring_count) && in ixgbe_set_ringparam()
1196 (new_rx_count == adapter->rx_ring_count)) { in ixgbe_set_ringparam()
1201 while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state)) in ixgbe_set_ringparam()
1204 if (!netif_running(adapter->netdev)) { in ixgbe_set_ringparam()
1205 for (i = 0; i < adapter->num_tx_queues; i++) in ixgbe_set_ringparam()
1206 adapter->tx_ring[i]->count = new_tx_count; in ixgbe_set_ringparam()
1207 for (i = 0; i < adapter->num_xdp_queues; i++) in ixgbe_set_ringparam()
1208 adapter->xdp_ring[i]->count = new_tx_count; in ixgbe_set_ringparam()
1209 for (i = 0; i < adapter->num_rx_queues; i++) in ixgbe_set_ringparam()
1210 adapter->rx_ring[i]->count = new_rx_count; in ixgbe_set_ringparam()
1211 adapter->tx_ring_count = new_tx_count; in ixgbe_set_ringparam()
1212 adapter->xdp_ring_count = new_tx_count; in ixgbe_set_ringparam()
1213 adapter->rx_ring_count = new_rx_count; in ixgbe_set_ringparam()
1218 i = max_t(int, adapter->num_tx_queues + adapter->num_xdp_queues, in ixgbe_set_ringparam()
1219 adapter->num_rx_queues); in ixgbe_set_ringparam()
1223 err = -ENOMEM; in ixgbe_set_ringparam()
1235 if (new_tx_count != adapter->tx_ring_count) { in ixgbe_set_ringparam()
1236 for (i = 0; i < adapter->num_tx_queues; i++) { in ixgbe_set_ringparam()
1237 memcpy(&temp_ring[i], adapter->tx_ring[i], in ixgbe_set_ringparam()
1244 i--; in ixgbe_set_ringparam()
1251 for (j = 0; j < adapter->num_xdp_queues; j++, i++) { in ixgbe_set_ringparam()
1252 memcpy(&temp_ring[i], adapter->xdp_ring[j], in ixgbe_set_ringparam()
1259 i--; in ixgbe_set_ringparam()
1266 for (i = 0; i < adapter->num_tx_queues; i++) { in ixgbe_set_ringparam()
1267 ixgbe_free_tx_resources(adapter->tx_ring[i]); in ixgbe_set_ringparam()
1269 memcpy(adapter->tx_ring[i], &temp_ring[i], in ixgbe_set_ringparam()
1272 for (j = 0; j < adapter->num_xdp_queues; j++, i++) { in ixgbe_set_ringparam()
1273 ixgbe_free_tx_resources(adapter->xdp_ring[j]); in ixgbe_set_ringparam()
1275 memcpy(adapter->xdp_ring[j], &temp_ring[i], in ixgbe_set_ringparam()
1279 adapter->tx_ring_count = new_tx_count; in ixgbe_set_ringparam()
1283 if (new_rx_count != adapter->rx_ring_count) { in ixgbe_set_ringparam()
1284 for (i = 0; i < adapter->num_rx_queues; i++) { in ixgbe_set_ringparam()
1285 memcpy(&temp_ring[i], adapter->rx_ring[i], in ixgbe_set_ringparam()
1288 /* Clear copied XDP RX-queue info */ in ixgbe_set_ringparam()
1296 i--; in ixgbe_set_ringparam()
1304 for (i = 0; i < adapter->num_rx_queues; i++) { in ixgbe_set_ringparam()
1305 ixgbe_free_rx_resources(adapter->rx_ring[i]); in ixgbe_set_ringparam()
1307 memcpy(adapter->rx_ring[i], &temp_ring[i], in ixgbe_set_ringparam()
1311 adapter->rx_ring_count = new_rx_count; in ixgbe_set_ringparam()
1318 clear_bit(__IXGBE_RESETTING, &adapter->state); in ixgbe_set_ringparam()
1332 return -EOPNOTSUPP; in ixgbe_get_sset_count()
1367 for (j = 0; j < netdev->num_tx_queues; j++) { in ixgbe_get_ethtool_stats()
1368 ring = adapter->tx_ring[j]; in ixgbe_get_ethtool_stats()
1377 start = u64_stats_fetch_begin(&ring->syncp); in ixgbe_get_ethtool_stats()
1378 data[i] = ring->stats.packets; in ixgbe_get_ethtool_stats()
1379 data[i+1] = ring->stats.bytes; in ixgbe_get_ethtool_stats()
1380 } while (u64_stats_fetch_retry(&ring->syncp, start)); in ixgbe_get_ethtool_stats()
1384 ring = adapter->rx_ring[j]; in ixgbe_get_ethtool_stats()
1393 start = u64_stats_fetch_begin(&ring->syncp); in ixgbe_get_ethtool_stats()
1394 data[i] = ring->stats.packets; in ixgbe_get_ethtool_stats()
1395 data[i+1] = ring->stats.bytes; in ixgbe_get_ethtool_stats()
1396 } while (u64_stats_fetch_retry(&ring->syncp, start)); in ixgbe_get_ethtool_stats()
1401 data[i++] = adapter->stats.pxontxc[j]; in ixgbe_get_ethtool_stats()
1402 data[i++] = adapter->stats.pxofftxc[j]; in ixgbe_get_ethtool_stats()
1405 data[i++] = adapter->stats.pxonrxc[j]; in ixgbe_get_ethtool_stats()
1406 data[i++] = adapter->stats.pxoffrxc[j]; in ixgbe_get_ethtool_stats()
1424 for (i = 0; i < netdev->num_tx_queues; i++) { in ixgbe_get_strings()
1440 /* BUG_ON(p - data != IXGBE_STATS_LEN * ETH_GSTRING_LEN); */ in ixgbe_get_strings()
1450 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_link_test() local
1454 if (ixgbe_removed(hw->hw_addr)) { in ixgbe_link_test()
1460 hw->mac.ops.check_link(hw, &link_speed, &link_up, true); in ixgbe_link_test()
1480 * as a single-element array) and special-case the tables.
1484 * registers to be written without any read-back testing.
1529 /* RDH is read-only for 82598, only test RDT. */
1553 if (ixgbe_removed(adapter->hw.hw_addr)) { in reg_pattern_test()
1558 before = ixgbe_read_reg(&adapter->hw, reg); in reg_pattern_test()
1559 ixgbe_write_reg(&adapter->hw, reg, test_pattern[pat] & write); in reg_pattern_test()
1560 val = ixgbe_read_reg(&adapter->hw, reg); in reg_pattern_test()
1565 ixgbe_write_reg(&adapter->hw, reg, before); in reg_pattern_test()
1568 ixgbe_write_reg(&adapter->hw, reg, before); in reg_pattern_test()
1578 if (ixgbe_removed(adapter->hw.hw_addr)) { in reg_set_and_check()
1582 before = ixgbe_read_reg(&adapter->hw, reg); in reg_set_and_check()
1583 ixgbe_write_reg(&adapter->hw, reg, write & mask); in reg_set_and_check()
1584 val = ixgbe_read_reg(&adapter->hw, reg); in reg_set_and_check()
1589 ixgbe_write_reg(&adapter->hw, reg, before); in reg_set_and_check()
1592 ixgbe_write_reg(&adapter->hw, reg, before); in reg_set_and_check()
1602 if (ixgbe_removed(adapter->hw.hw_addr)) { in ixgbe_reg_test()
1603 e_err(drv, "Adapter removed - register test blocked\n"); in ixgbe_reg_test()
1607 switch (adapter->hw.mac.type) { in ixgbe_reg_test()
1629 * tests. Some bits are read-only, some toggle, and some in ixgbe_reg_test()
1632 before = ixgbe_read_reg(&adapter->hw, IXGBE_STATUS); in ixgbe_reg_test()
1633 value = (ixgbe_read_reg(&adapter->hw, IXGBE_STATUS) & toggle); in ixgbe_reg_test()
1634 ixgbe_write_reg(&adapter->hw, IXGBE_STATUS, toggle); in ixgbe_reg_test()
1635 after = ixgbe_read_reg(&adapter->hw, IXGBE_STATUS) & toggle; in ixgbe_reg_test()
1643 ixgbe_write_reg(&adapter->hw, IXGBE_STATUS, before); in ixgbe_reg_test()
1649 while (test->reg) { in ixgbe_reg_test()
1650 for (i = 0; i < test->array_len; i++) { in ixgbe_reg_test()
1653 switch (test->test_type) { in ixgbe_reg_test()
1656 test->reg + (i * 0x40), in ixgbe_reg_test()
1657 test->mask, in ixgbe_reg_test()
1658 test->write); in ixgbe_reg_test()
1662 test->reg + (i * 0x40), in ixgbe_reg_test()
1663 test->mask, in ixgbe_reg_test()
1664 test->write); in ixgbe_reg_test()
1667 ixgbe_write_reg(&adapter->hw, in ixgbe_reg_test()
1668 test->reg + (i * 0x40), in ixgbe_reg_test()
1669 test->write); in ixgbe_reg_test()
1673 test->reg + (i * 4), in ixgbe_reg_test()
1674 test->mask, in ixgbe_reg_test()
1675 test->write); in ixgbe_reg_test()
1679 test->reg + (i * 8), in ixgbe_reg_test()
1680 test->mask, in ixgbe_reg_test()
1681 test->write); in ixgbe_reg_test()
1685 (test->reg + 4) + (i * 8), in ixgbe_reg_test()
1686 test->mask, in ixgbe_reg_test()
1687 test->write); in ixgbe_reg_test()
1702 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_eeprom_test() local
1703 if (hw->eeprom.ops.validate_checksum(hw, NULL)) in ixgbe_eeprom_test()
1715 adapter->test_icr |= IXGBE_READ_REG(&adapter->hw, IXGBE_EICR); in ixgbe_test_intr()
1722 struct net_device *netdev = adapter->netdev; in ixgbe_intr_test()
1724 u32 irq = adapter->pdev->irq; in ixgbe_intr_test()
1729 if (adapter->msix_entries) { in ixgbe_intr_test()
1730 /* NOTE: we don't test MSI-X interrupts here, yet */ in ixgbe_intr_test()
1732 } else if (adapter->flags & IXGBE_FLAG_MSI_ENABLED) { in ixgbe_intr_test()
1734 if (request_irq(irq, ixgbe_test_intr, 0, netdev->name, in ixgbe_intr_test()
1737 return -1; in ixgbe_intr_test()
1740 netdev->name, netdev)) { in ixgbe_intr_test()
1743 netdev->name, netdev)) { in ixgbe_intr_test()
1745 return -1; in ixgbe_intr_test()
1747 e_info(hw, "testing %s interrupt\n", shared_int ? in ixgbe_intr_test()
1751 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, 0xFFFFFFFF); in ixgbe_intr_test()
1752 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_intr_test()
1768 adapter->test_icr = 0; in ixgbe_intr_test()
1769 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, in ixgbe_intr_test()
1771 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, in ixgbe_intr_test()
1773 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_intr_test()
1776 if (adapter->test_icr & mask) { in ixgbe_intr_test()
1788 adapter->test_icr = 0; in ixgbe_intr_test()
1789 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, mask); in ixgbe_intr_test()
1790 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, mask); in ixgbe_intr_test()
1791 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_intr_test()
1794 if (!(adapter->test_icr & mask)) { in ixgbe_intr_test()
1807 adapter->test_icr = 0; in ixgbe_intr_test()
1808 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, in ixgbe_intr_test()
1810 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, in ixgbe_intr_test()
1812 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_intr_test()
1815 if (adapter->test_icr) { in ixgbe_intr_test()
1823 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, 0xFFFFFFFF); in ixgbe_intr_test()
1824 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_intr_test()
1849 ixgbe_free_tx_resources(&adapter->test_tx_ring); in ixgbe_free_desc_rings()
1850 ixgbe_free_rx_resources(&adapter->test_rx_ring); in ixgbe_free_desc_rings()
1855 struct ixgbe_ring *tx_ring = &adapter->test_tx_ring; in ixgbe_setup_desc_rings()
1856 struct ixgbe_ring *rx_ring = &adapter->test_rx_ring; in ixgbe_setup_desc_rings()
1857 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_setup_desc_rings() local
1863 tx_ring->count = IXGBE_DEFAULT_TXD; in ixgbe_setup_desc_rings()
1864 tx_ring->queue_index = 0; in ixgbe_setup_desc_rings()
1865 tx_ring->dev = &adapter->pdev->dev; in ixgbe_setup_desc_rings()
1866 tx_ring->netdev = adapter->netdev; in ixgbe_setup_desc_rings()
1867 tx_ring->reg_idx = adapter->tx_ring[0]->reg_idx; in ixgbe_setup_desc_rings()
1873 switch (adapter->hw.mac.type) { in ixgbe_setup_desc_rings()
1880 reg_data = IXGBE_READ_REG(&adapter->hw, IXGBE_DMATXCTL); in ixgbe_setup_desc_rings()
1882 IXGBE_WRITE_REG(&adapter->hw, IXGBE_DMATXCTL, reg_data); in ixgbe_setup_desc_rings()
1891 rx_ring->count = IXGBE_DEFAULT_RXD; in ixgbe_setup_desc_rings()
1892 rx_ring->queue_index = 0; in ixgbe_setup_desc_rings()
1893 rx_ring->dev = &adapter->pdev->dev; in ixgbe_setup_desc_rings()
1894 rx_ring->netdev = adapter->netdev; in ixgbe_setup_desc_rings()
1895 rx_ring->reg_idx = adapter->rx_ring[0]->reg_idx; in ixgbe_setup_desc_rings()
1903 hw->mac.ops.disable_rx(hw); in ixgbe_setup_desc_rings()
1907 rctl = IXGBE_READ_REG(&adapter->hw, IXGBE_RXCTRL); in ixgbe_setup_desc_rings()
1909 IXGBE_WRITE_REG(&adapter->hw, IXGBE_RXCTRL, rctl); in ixgbe_setup_desc_rings()
1911 hw->mac.ops.enable_rx(hw); in ixgbe_setup_desc_rings()
1922 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_setup_loopback_test() local
1927 reg_data = IXGBE_READ_REG(hw, IXGBE_HLREG0); in ixgbe_setup_loopback_test()
1929 IXGBE_WRITE_REG(hw, IXGBE_HLREG0, reg_data); in ixgbe_setup_loopback_test()
1931 reg_data = IXGBE_READ_REG(hw, IXGBE_FCTRL); in ixgbe_setup_loopback_test()
1933 IXGBE_WRITE_REG(hw, IXGBE_FCTRL, reg_data); in ixgbe_setup_loopback_test()
1936 switch (adapter->hw.mac.type) { in ixgbe_setup_loopback_test()
1942 reg_data = IXGBE_READ_REG(hw, IXGBE_MACC); in ixgbe_setup_loopback_test()
1944 IXGBE_WRITE_REG(hw, IXGBE_MACC, reg_data); in ixgbe_setup_loopback_test()
1947 if (hw->mac.orig_autoc) { in ixgbe_setup_loopback_test()
1948 reg_data = hw->mac.orig_autoc | IXGBE_AUTOC_FLU; in ixgbe_setup_loopback_test()
1949 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, reg_data); in ixgbe_setup_loopback_test()
1954 IXGBE_WRITE_FLUSH(hw); in ixgbe_setup_loopback_test()
1957 /* Disable Atlas Tx lanes; re-enabled in reset path */ in ixgbe_setup_loopback_test()
1958 if (hw->mac.type == ixgbe_mac_82598EB) { in ixgbe_setup_loopback_test()
1961 hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_LPBK, &atlas); in ixgbe_setup_loopback_test()
1963 hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_LPBK, atlas); in ixgbe_setup_loopback_test()
1965 hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_10G, &atlas); in ixgbe_setup_loopback_test()
1967 hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_10G, atlas); in ixgbe_setup_loopback_test()
1969 hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_1G, &atlas); in ixgbe_setup_loopback_test()
1971 hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_1G, atlas); in ixgbe_setup_loopback_test()
1973 hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_AN, &atlas); in ixgbe_setup_loopback_test()
1975 hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_AN, atlas); in ixgbe_setup_loopback_test()
1985 reg_data = IXGBE_READ_REG(&adapter->hw, IXGBE_HLREG0); in ixgbe_loopback_cleanup()
1987 IXGBE_WRITE_REG(&adapter->hw, IXGBE_HLREG0, reg_data); in ixgbe_loopback_cleanup()
1993 memset(skb->data, 0xFF, frame_size); in ixgbe_create_lbtest_frame()
1995 memset(&skb->data[frame_size], 0xAA, frame_size / 2 - 1); in ixgbe_create_lbtest_frame()
1996 skb->data[frame_size + 10] = 0xBE; in ixgbe_create_lbtest_frame()
1997 skb->data[frame_size + 12] = 0xAF; in ixgbe_create_lbtest_frame()
2007 data = page_address(rx_buffer->page) + rx_buffer->page_offset; in ixgbe_check_lbtest_frame()
2021 rx_ntc = rx_ring->next_to_clean; in ixgbe_clean_test_rings()
2022 tx_ntc = tx_ring->next_to_clean; in ixgbe_clean_test_rings()
2025 while (tx_ntc != tx_ring->next_to_use) { in ixgbe_clean_test_rings()
2032 if (!(tx_desc->wb.status & cpu_to_le32(IXGBE_TXD_STAT_DD))) in ixgbe_clean_test_rings()
2036 tx_buffer = &tx_ring->tx_buffer_info[tx_ntc]; in ixgbe_clean_test_rings()
2039 dev_kfree_skb_any(tx_buffer->skb); in ixgbe_clean_test_rings()
2042 dma_unmap_single(tx_ring->dev, in ixgbe_clean_test_rings()
2050 if (tx_ntc == tx_ring->count) in ixgbe_clean_test_rings()
2054 while (rx_desc->wb.upper.length) { in ixgbe_clean_test_rings()
2058 rx_buffer = &rx_ring->rx_buffer_info[rx_ntc]; in ixgbe_clean_test_rings()
2061 dma_sync_single_for_cpu(rx_ring->dev, in ixgbe_clean_test_rings()
2062 rx_buffer->dma, in ixgbe_clean_test_rings()
2073 dma_sync_single_for_device(rx_ring->dev, in ixgbe_clean_test_rings()
2074 rx_buffer->dma, in ixgbe_clean_test_rings()
2080 if (rx_ntc == rx_ring->count) in ixgbe_clean_test_rings()
2089 /* re-map buffers to ring, store next to clean values */ in ixgbe_clean_test_rings()
2091 rx_ring->next_to_clean = rx_ntc; in ixgbe_clean_test_rings()
2092 tx_ring->next_to_clean = tx_ntc; in ixgbe_clean_test_rings()
2099 struct ixgbe_ring *tx_ring = &adapter->test_tx_ring; in ixgbe_run_loopback_test()
2100 struct ixgbe_ring *rx_ring = &adapter->test_rx_ring; in ixgbe_run_loopback_test()
2105 u32 flags_orig = adapter->flags; in ixgbe_run_loopback_test()
2108 adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED; in ixgbe_run_loopback_test()
2125 if (rx_ring->count <= tx_ring->count) in ixgbe_run_loopback_test()
2126 lc = ((tx_ring->count / 64) * 2) + 1; in ixgbe_run_loopback_test()
2128 lc = ((rx_ring->count / 64) * 2) + 1; in ixgbe_run_loopback_test()
2161 adapter->flags = flags_orig; in ixgbe_run_loopback_test()
2189 if (ixgbe_removed(adapter->hw.hw_addr)) { in ixgbe_diag_test()
2190 e_err(hw, "Adapter removed - test blocked\n"); in ixgbe_diag_test()
2196 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2199 set_bit(__IXGBE_TESTING, &adapter->state); in ixgbe_diag_test()
2200 if (eth_test->flags == ETH_TEST_FL_OFFLINE) { in ixgbe_diag_test()
2201 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_diag_test() local
2203 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) { in ixgbe_diag_test()
2205 for (i = 0; i < adapter->num_vfs; i++) { in ixgbe_diag_test()
2206 if (adapter->vfinfo[i].clear_to_send) { in ixgbe_diag_test()
2207 netdev_warn(netdev, "offline diagnostic is not supported when VFs are present\n"); in ixgbe_diag_test()
2213 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2215 &adapter->state); in ixgbe_diag_test()
2222 e_info(hw, "offline testing starting\n"); in ixgbe_diag_test()
2228 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2236 e_info(hw, "register testing starting\n"); in ixgbe_diag_test()
2238 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2241 e_info(hw, "eeprom testing starting\n"); in ixgbe_diag_test()
2243 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2246 e_info(hw, "interrupt testing starting\n"); in ixgbe_diag_test()
2248 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2252 if (adapter->flags & (IXGBE_FLAG_SRIOV_ENABLED | in ixgbe_diag_test()
2254 e_info(hw, "Skip MAC loopback diagnostic in VT mode\n"); in ixgbe_diag_test()
2260 e_info(hw, "loopback testing starting\n"); in ixgbe_diag_test()
2262 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2268 clear_bit(__IXGBE_TESTING, &adapter->state); in ixgbe_diag_test()
2271 else if (hw->mac.ops.disable_tx_laser) in ixgbe_diag_test()
2272 hw->mac.ops.disable_tx_laser(hw); in ixgbe_diag_test()
2274 e_info(hw, "online testing starting\n"); in ixgbe_diag_test()
2278 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2286 clear_bit(__IXGBE_TESTING, &adapter->state); in ixgbe_diag_test()
2293 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_wol_exclusion() local
2296 /* WOL not supported for all devices */ in ixgbe_wol_exclusion()
2297 if (!ixgbe_wol_supported(adapter, hw->device_id, in ixgbe_wol_exclusion()
2298 hw->subsystem_device_id)) { in ixgbe_wol_exclusion()
2300 wol->supported = 0; in ixgbe_wol_exclusion()
2311 wol->supported = WAKE_UCAST | WAKE_MCAST | in ixgbe_get_wol()
2313 wol->wolopts = 0; in ixgbe_get_wol()
2316 !device_can_wakeup(&adapter->pdev->dev)) in ixgbe_get_wol()
2319 if (adapter->wol & IXGBE_WUFC_EX) in ixgbe_get_wol()
2320 wol->wolopts |= WAKE_UCAST; in ixgbe_get_wol()
2321 if (adapter->wol & IXGBE_WUFC_MC) in ixgbe_get_wol()
2322 wol->wolopts |= WAKE_MCAST; in ixgbe_get_wol()
2323 if (adapter->wol & IXGBE_WUFC_BC) in ixgbe_get_wol()
2324 wol->wolopts |= WAKE_BCAST; in ixgbe_get_wol()
2325 if (adapter->wol & IXGBE_WUFC_MAG) in ixgbe_get_wol()
2326 wol->wolopts |= WAKE_MAGIC; in ixgbe_get_wol()
2333 if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE | in ixgbe_set_wol()
2335 return -EOPNOTSUPP; in ixgbe_set_wol()
2338 return wol->wolopts ? -EOPNOTSUPP : 0; in ixgbe_set_wol()
2340 adapter->wol = 0; in ixgbe_set_wol()
2342 if (wol->wolopts & WAKE_UCAST) in ixgbe_set_wol()
2343 adapter->wol |= IXGBE_WUFC_EX; in ixgbe_set_wol()
2344 if (wol->wolopts & WAKE_MCAST) in ixgbe_set_wol()
2345 adapter->wol |= IXGBE_WUFC_MC; in ixgbe_set_wol()
2346 if (wol->wolopts & WAKE_BCAST) in ixgbe_set_wol()
2347 adapter->wol |= IXGBE_WUFC_BC; in ixgbe_set_wol()
2348 if (wol->wolopts & WAKE_MAGIC) in ixgbe_set_wol()
2349 adapter->wol |= IXGBE_WUFC_MAG; in ixgbe_set_wol()
2351 device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); in ixgbe_set_wol()
2370 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_phys_id() local
2372 if (!hw->mac.ops.led_on || !hw->mac.ops.led_off) in ixgbe_set_phys_id()
2373 return -EOPNOTSUPP; in ixgbe_set_phys_id()
2377 adapter->led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); in ixgbe_set_phys_id()
2381 hw->mac.ops.led_on(hw, hw->mac.led_link_act); in ixgbe_set_phys_id()
2385 hw->mac.ops.led_off(hw, hw->mac.led_link_act); in ixgbe_set_phys_id()
2390 IXGBE_WRITE_REG(&adapter->hw, IXGBE_LEDCTL, adapter->led_reg); in ixgbe_set_phys_id()
2405 if (adapter->rx_itr_setting <= 1) in ixgbe_get_coalesce()
2406 ec->rx_coalesce_usecs = adapter->rx_itr_setting; in ixgbe_get_coalesce()
2408 ec->rx_coalesce_usecs = adapter->rx_itr_setting >> 2; in ixgbe_get_coalesce()
2411 if (adapter->q_vector[0]->tx.count && adapter->q_vector[0]->rx.count) in ixgbe_get_coalesce()
2415 if (adapter->tx_itr_setting <= 1) in ixgbe_get_coalesce()
2416 ec->tx_coalesce_usecs = adapter->tx_itr_setting; in ixgbe_get_coalesce()
2418 ec->tx_coalesce_usecs = adapter->tx_itr_setting >> 2; in ixgbe_get_coalesce()
2429 struct net_device *netdev = adapter->netdev; in ixgbe_update_rsc()
2432 if (!(adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE) || in ixgbe_update_rsc()
2433 !(netdev->features & NETIF_F_LRO)) in ixgbe_update_rsc()
2437 if (adapter->rx_itr_setting == 1 || in ixgbe_update_rsc()
2438 adapter->rx_itr_setting > IXGBE_MIN_RSC_ITR) { in ixgbe_update_rsc()
2439 if (!(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED)) { in ixgbe_update_rsc()
2440 adapter->flags2 |= IXGBE_FLAG2_RSC_ENABLED; in ixgbe_update_rsc()
2441 e_info(probe, "rx-usecs value high enough to re-enable RSC\n"); in ixgbe_update_rsc()
2445 } else if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { in ixgbe_update_rsc()
2446 adapter->flags2 &= ~IXGBE_FLAG2_RSC_ENABLED; in ixgbe_update_rsc()
2447 e_info(probe, "rx-usecs set too low, disabling RSC\n"); in ixgbe_update_rsc()
2464 if (adapter->q_vector[0]->tx.count && adapter->q_vector[0]->rx.count) { in ixgbe_set_coalesce()
2466 if (ec->tx_coalesce_usecs) in ixgbe_set_coalesce()
2467 return -EINVAL; in ixgbe_set_coalesce()
2468 tx_itr_prev = adapter->rx_itr_setting; in ixgbe_set_coalesce()
2470 tx_itr_prev = adapter->tx_itr_setting; in ixgbe_set_coalesce()
2473 if ((ec->rx_coalesce_usecs > (IXGBE_MAX_EITR >> 2)) || in ixgbe_set_coalesce()
2474 (ec->tx_coalesce_usecs > (IXGBE_MAX_EITR >> 2))) in ixgbe_set_coalesce()
2475 return -EINVAL; in ixgbe_set_coalesce()
2477 if (ec->rx_coalesce_usecs > 1) in ixgbe_set_coalesce()
2478 adapter->rx_itr_setting = ec->rx_coalesce_usecs << 2; in ixgbe_set_coalesce()
2480 adapter->rx_itr_setting = ec->rx_coalesce_usecs; in ixgbe_set_coalesce()
2482 if (adapter->rx_itr_setting == 1) in ixgbe_set_coalesce()
2485 rx_itr_param = adapter->rx_itr_setting; in ixgbe_set_coalesce()
2487 if (ec->tx_coalesce_usecs > 1) in ixgbe_set_coalesce()
2488 adapter->tx_itr_setting = ec->tx_coalesce_usecs << 2; in ixgbe_set_coalesce()
2490 adapter->tx_itr_setting = ec->tx_coalesce_usecs; in ixgbe_set_coalesce()
2492 if (adapter->tx_itr_setting == 1) in ixgbe_set_coalesce()
2495 tx_itr_param = adapter->tx_itr_setting; in ixgbe_set_coalesce()
2498 if (adapter->q_vector[0]->tx.count && adapter->q_vector[0]->rx.count) in ixgbe_set_coalesce()
2499 adapter->tx_itr_setting = adapter->rx_itr_setting; in ixgbe_set_coalesce()
2502 if ((adapter->tx_itr_setting != 1) && in ixgbe_set_coalesce()
2503 (adapter->tx_itr_setting < IXGBE_100K_ITR)) { in ixgbe_set_coalesce()
2516 for (i = 0; i < adapter->num_q_vectors; i++) { in ixgbe_set_coalesce()
2517 q_vector = adapter->q_vector[i]; in ixgbe_set_coalesce()
2518 if (q_vector->tx.count && !q_vector->rx.count) in ixgbe_set_coalesce()
2520 q_vector->itr = tx_itr_param; in ixgbe_set_coalesce()
2523 q_vector->itr = rx_itr_param; in ixgbe_set_coalesce()
2541 union ixgbe_atr_input *mask = &adapter->fdir_mask; in ixgbe_get_ethtool_fdir_entry()
2543 (struct ethtool_rx_flow_spec *)&cmd->fs; in ixgbe_get_ethtool_fdir_entry()
2548 cmd->data = (1024 << adapter->fdir_pballoc) - 2; in ixgbe_get_ethtool_fdir_entry()
2551 &adapter->fdir_filter_list, fdir_node) { in ixgbe_get_ethtool_fdir_entry()
2552 if (fsp->location <= rule->sw_idx) in ixgbe_get_ethtool_fdir_entry()
2556 if (!rule || fsp->location != rule->sw_idx) in ixgbe_get_ethtool_fdir_entry()
2557 return -EINVAL; in ixgbe_get_ethtool_fdir_entry()
2562 switch (rule->filter.formatted.flow_type) { in ixgbe_get_ethtool_fdir_entry()
2564 fsp->flow_type = TCP_V4_FLOW; in ixgbe_get_ethtool_fdir_entry()
2567 fsp->flow_type = UDP_V4_FLOW; in ixgbe_get_ethtool_fdir_entry()
2570 fsp->flow_type = SCTP_V4_FLOW; in ixgbe_get_ethtool_fdir_entry()
2573 fsp->flow_type = IP_USER_FLOW; in ixgbe_get_ethtool_fdir_entry()
2574 fsp->h_u.usr_ip4_spec.ip_ver = ETH_RX_NFC_IP4; in ixgbe_get_ethtool_fdir_entry()
2575 fsp->h_u.usr_ip4_spec.proto = 0; in ixgbe_get_ethtool_fdir_entry()
2576 fsp->m_u.usr_ip4_spec.proto = 0; in ixgbe_get_ethtool_fdir_entry()
2579 return -EINVAL; in ixgbe_get_ethtool_fdir_entry()
2582 fsp->h_u.tcp_ip4_spec.psrc = rule->filter.formatted.src_port; in ixgbe_get_ethtool_fdir_entry()
2583 fsp->m_u.tcp_ip4_spec.psrc = mask->formatted.src_port; in ixgbe_get_ethtool_fdir_entry()
2584 fsp->h_u.tcp_ip4_spec.pdst = rule->filter.formatted.dst_port; in ixgbe_get_ethtool_fdir_entry()
2585 fsp->m_u.tcp_ip4_spec.pdst = mask->formatted.dst_port; in ixgbe_get_ethtool_fdir_entry()
2586 fsp->h_u.tcp_ip4_spec.ip4src = rule->filter.formatted.src_ip[0]; in ixgbe_get_ethtool_fdir_entry()
2587 fsp->m_u.tcp_ip4_spec.ip4src = mask->formatted.src_ip[0]; in ixgbe_get_ethtool_fdir_entry()
2588 fsp->h_u.tcp_ip4_spec.ip4dst = rule->filter.formatted.dst_ip[0]; in ixgbe_get_ethtool_fdir_entry()
2589 fsp->m_u.tcp_ip4_spec.ip4dst = mask->formatted.dst_ip[0]; in ixgbe_get_ethtool_fdir_entry()
2590 fsp->h_ext.vlan_tci = rule->filter.formatted.vlan_id; in ixgbe_get_ethtool_fdir_entry()
2591 fsp->m_ext.vlan_tci = mask->formatted.vlan_id; in ixgbe_get_ethtool_fdir_entry()
2592 fsp->h_ext.vlan_etype = rule->filter.formatted.flex_bytes; in ixgbe_get_ethtool_fdir_entry()
2593 fsp->m_ext.vlan_etype = mask->formatted.flex_bytes; in ixgbe_get_ethtool_fdir_entry()
2594 fsp->h_ext.data[1] = htonl(rule->filter.formatted.vm_pool); in ixgbe_get_ethtool_fdir_entry()
2595 fsp->m_ext.data[1] = htonl(mask->formatted.vm_pool); in ixgbe_get_ethtool_fdir_entry()
2596 fsp->flow_type |= FLOW_EXT; in ixgbe_get_ethtool_fdir_entry()
2599 if (rule->action == IXGBE_FDIR_DROP_QUEUE) in ixgbe_get_ethtool_fdir_entry()
2600 fsp->ring_cookie = RX_CLS_FLOW_DISC; in ixgbe_get_ethtool_fdir_entry()
2602 fsp->ring_cookie = rule->action; in ixgbe_get_ethtool_fdir_entry()
2616 cmd->data = (1024 << adapter->fdir_pballoc) - 2; in ixgbe_get_ethtool_fdir_all()
2619 &adapter->fdir_filter_list, fdir_node) { in ixgbe_get_ethtool_fdir_all()
2620 if (cnt == cmd->rule_cnt) in ixgbe_get_ethtool_fdir_all()
2621 return -EMSGSIZE; in ixgbe_get_ethtool_fdir_all()
2622 rule_locs[cnt] = rule->sw_idx; in ixgbe_get_ethtool_fdir_all()
2626 cmd->rule_cnt = cnt; in ixgbe_get_ethtool_fdir_all()
2634 cmd->data = 0; in ixgbe_get_rss_hash_opts()
2637 switch (cmd->flow_type) { in ixgbe_get_rss_hash_opts()
2639 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in ixgbe_get_rss_hash_opts()
2642 if (adapter->flags2 & IXGBE_FLAG2_RSS_FIELD_IPV4_UDP) in ixgbe_get_rss_hash_opts()
2643 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in ixgbe_get_rss_hash_opts()
2650 cmd->data |= RXH_IP_SRC | RXH_IP_DST; in ixgbe_get_rss_hash_opts()
2653 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in ixgbe_get_rss_hash_opts()
2656 if (adapter->flags2 & IXGBE_FLAG2_RSS_FIELD_IPV6_UDP) in ixgbe_get_rss_hash_opts()
2657 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in ixgbe_get_rss_hash_opts()
2664 cmd->data |= RXH_IP_SRC | RXH_IP_DST; in ixgbe_get_rss_hash_opts()
2667 return -EINVAL; in ixgbe_get_rss_hash_opts()
2675 if (adapter->hw.mac.type < ixgbe_mac_X550) in ixgbe_rss_indir_tbl_max()
2685 int ret = -EOPNOTSUPP; in ixgbe_get_rxnfc()
2687 switch (cmd->cmd) { in ixgbe_get_rxnfc()
2689 cmd->data = min_t(int, adapter->num_rx_queues, in ixgbe_get_rxnfc()
2694 cmd->rule_cnt = adapter->fdir_filter_count; in ixgbe_get_rxnfc()
2717 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_update_ethtool_fdir_entry() local
2720 int err = -EINVAL; in ixgbe_update_ethtool_fdir_entry()
2726 &adapter->fdir_filter_list, fdir_node) { in ixgbe_update_ethtool_fdir_entry()
2728 if (rule->sw_idx >= sw_idx) in ixgbe_update_ethtool_fdir_entry()
2734 if (rule && (rule->sw_idx == sw_idx)) { in ixgbe_update_ethtool_fdir_entry()
2735 if (!input || (rule->filter.formatted.bkt_hash != in ixgbe_update_ethtool_fdir_entry()
2736 input->filter.formatted.bkt_hash)) { in ixgbe_update_ethtool_fdir_entry()
2737 err = ixgbe_fdir_erase_perfect_filter_82599(hw, in ixgbe_update_ethtool_fdir_entry()
2738 &rule->filter, in ixgbe_update_ethtool_fdir_entry()
2742 hlist_del(&rule->fdir_node); in ixgbe_update_ethtool_fdir_entry()
2744 adapter->fdir_filter_count--; in ixgbe_update_ethtool_fdir_entry()
2749 * successfully found and removed from the list else -EINVAL in ixgbe_update_ethtool_fdir_entry()
2755 INIT_HLIST_NODE(&input->fdir_node); in ixgbe_update_ethtool_fdir_entry()
2759 hlist_add_behind(&input->fdir_node, &parent->fdir_node); in ixgbe_update_ethtool_fdir_entry()
2761 hlist_add_head(&input->fdir_node, in ixgbe_update_ethtool_fdir_entry()
2762 &adapter->fdir_filter_list); in ixgbe_update_ethtool_fdir_entry()
2765 adapter->fdir_filter_count++; in ixgbe_update_ethtool_fdir_entry()
2773 switch (fsp->flow_type & ~FLOW_EXT) { in ixgbe_flowspec_to_flow_type()
2784 switch (fsp->h_u.usr_ip4_spec.proto) { in ixgbe_flowspec_to_flow_type()
2795 if (!fsp->m_u.usr_ip4_spec.proto) { in ixgbe_flowspec_to_flow_type()
2815 (struct ethtool_rx_flow_spec *)&cmd->fs; in ixgbe_add_ethtool_fdir_entry()
2816 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_add_ethtool_fdir_entry() local
2822 if (!(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) in ixgbe_add_ethtool_fdir_entry()
2823 return -EOPNOTSUPP; in ixgbe_add_ethtool_fdir_entry()
2828 if (fsp->ring_cookie == RX_CLS_FLOW_DISC) { in ixgbe_add_ethtool_fdir_entry()
2831 u32 ring = ethtool_get_flow_spec_ring(fsp->ring_cookie); in ixgbe_add_ethtool_fdir_entry()
2832 u8 vf = ethtool_get_flow_spec_ring_vf(fsp->ring_cookie); in ixgbe_add_ethtool_fdir_entry()
2834 if (!vf && (ring >= adapter->num_rx_queues)) in ixgbe_add_ethtool_fdir_entry()
2835 return -EINVAL; in ixgbe_add_ethtool_fdir_entry()
2837 ((vf > adapter->num_vfs) || in ixgbe_add_ethtool_fdir_entry()
2838 ring >= adapter->num_rx_queues_per_pool)) in ixgbe_add_ethtool_fdir_entry()
2839 return -EINVAL; in ixgbe_add_ethtool_fdir_entry()
2843 queue = adapter->rx_ring[ring]->reg_idx; in ixgbe_add_ethtool_fdir_entry()
2845 queue = ((vf - 1) * in ixgbe_add_ethtool_fdir_entry()
2846 adapter->num_rx_queues_per_pool) + ring; in ixgbe_add_ethtool_fdir_entry()
2850 if (fsp->location >= ((1024 << adapter->fdir_pballoc) - 2)) { in ixgbe_add_ethtool_fdir_entry()
2852 return -EINVAL; in ixgbe_add_ethtool_fdir_entry()
2857 return -ENOMEM; in ixgbe_add_ethtool_fdir_entry()
2862 input->sw_idx = fsp->location; in ixgbe_add_ethtool_fdir_entry()
2866 &input->filter.formatted.flow_type)) { in ixgbe_add_ethtool_fdir_entry()
2874 if (input->filter.formatted.flow_type == IXGBE_ATR_FLOW_TYPE_IPV4) in ixgbe_add_ethtool_fdir_entry()
2878 input->filter.formatted.src_ip[0] = fsp->h_u.tcp_ip4_spec.ip4src; in ixgbe_add_ethtool_fdir_entry()
2879 mask.formatted.src_ip[0] = fsp->m_u.tcp_ip4_spec.ip4src; in ixgbe_add_ethtool_fdir_entry()
2880 input->filter.formatted.dst_ip[0] = fsp->h_u.tcp_ip4_spec.ip4dst; in ixgbe_add_ethtool_fdir_entry()
2881 mask.formatted.dst_ip[0] = fsp->m_u.tcp_ip4_spec.ip4dst; in ixgbe_add_ethtool_fdir_entry()
2882 input->filter.formatted.src_port = fsp->h_u.tcp_ip4_spec.psrc; in ixgbe_add_ethtool_fdir_entry()
2883 mask.formatted.src_port = fsp->m_u.tcp_ip4_spec.psrc; in ixgbe_add_ethtool_fdir_entry()
2884 input->filter.formatted.dst_port = fsp->h_u.tcp_ip4_spec.pdst; in ixgbe_add_ethtool_fdir_entry()
2885 mask.formatted.dst_port = fsp->m_u.tcp_ip4_spec.pdst; in ixgbe_add_ethtool_fdir_entry()
2887 if (fsp->flow_type & FLOW_EXT) { in ixgbe_add_ethtool_fdir_entry()
2888 input->filter.formatted.vm_pool = in ixgbe_add_ethtool_fdir_entry()
2889 (unsigned char)ntohl(fsp->h_ext.data[1]); in ixgbe_add_ethtool_fdir_entry()
2891 (unsigned char)ntohl(fsp->m_ext.data[1]); in ixgbe_add_ethtool_fdir_entry()
2892 input->filter.formatted.vlan_id = fsp->h_ext.vlan_tci; in ixgbe_add_ethtool_fdir_entry()
2893 mask.formatted.vlan_id = fsp->m_ext.vlan_tci; in ixgbe_add_ethtool_fdir_entry()
2894 input->filter.formatted.flex_bytes = in ixgbe_add_ethtool_fdir_entry()
2895 fsp->h_ext.vlan_etype; in ixgbe_add_ethtool_fdir_entry()
2896 mask.formatted.flex_bytes = fsp->m_ext.vlan_etype; in ixgbe_add_ethtool_fdir_entry()
2900 if (fsp->ring_cookie == RX_CLS_FLOW_DISC) in ixgbe_add_ethtool_fdir_entry()
2901 input->action = IXGBE_FDIR_DROP_QUEUE; in ixgbe_add_ethtool_fdir_entry()
2903 input->action = fsp->ring_cookie; in ixgbe_add_ethtool_fdir_entry()
2905 spin_lock(&adapter->fdir_perfect_lock); in ixgbe_add_ethtool_fdir_entry()
2907 if (hlist_empty(&adapter->fdir_filter_list)) { in ixgbe_add_ethtool_fdir_entry()
2908 /* save mask and program input mask into HW */ in ixgbe_add_ethtool_fdir_entry()
2909 memcpy(&adapter->fdir_mask, &mask, sizeof(mask)); in ixgbe_add_ethtool_fdir_entry()
2910 err = ixgbe_fdir_set_input_mask_82599(hw, &mask); in ixgbe_add_ethtool_fdir_entry()
2915 } else if (memcmp(&adapter->fdir_mask, &mask, sizeof(mask))) { in ixgbe_add_ethtool_fdir_entry()
2916 e_err(drv, "Only one mask supported per port\n"); in ixgbe_add_ethtool_fdir_entry()
2921 ixgbe_atr_compute_perfect_hash_82599(&input->filter, &mask); in ixgbe_add_ethtool_fdir_entry()
2924 err = ixgbe_fdir_write_perfect_filter_82599(hw, in ixgbe_add_ethtool_fdir_entry()
2925 &input->filter, input->sw_idx, queue); in ixgbe_add_ethtool_fdir_entry()
2929 ixgbe_update_ethtool_fdir_entry(adapter, input, input->sw_idx); in ixgbe_add_ethtool_fdir_entry()
2931 spin_unlock(&adapter->fdir_perfect_lock); in ixgbe_add_ethtool_fdir_entry()
2935 spin_unlock(&adapter->fdir_perfect_lock); in ixgbe_add_ethtool_fdir_entry()
2938 return -EINVAL; in ixgbe_add_ethtool_fdir_entry()
2945 (struct ethtool_rx_flow_spec *)&cmd->fs; in ixgbe_del_ethtool_fdir_entry()
2948 spin_lock(&adapter->fdir_perfect_lock); in ixgbe_del_ethtool_fdir_entry()
2949 err = ixgbe_update_ethtool_fdir_entry(adapter, NULL, fsp->location); in ixgbe_del_ethtool_fdir_entry()
2950 spin_unlock(&adapter->fdir_perfect_lock); in ixgbe_del_ethtool_fdir_entry()
2960 u32 flags2 = adapter->flags2; in ixgbe_set_rss_hash_opt()
2966 if (nfc->data & ~(RXH_IP_SRC | RXH_IP_DST | in ixgbe_set_rss_hash_opt()
2968 return -EINVAL; in ixgbe_set_rss_hash_opt()
2970 switch (nfc->flow_type) { in ixgbe_set_rss_hash_opt()
2973 if (!(nfc->data & RXH_IP_SRC) || in ixgbe_set_rss_hash_opt()
2974 !(nfc->data & RXH_IP_DST) || in ixgbe_set_rss_hash_opt()
2975 !(nfc->data & RXH_L4_B_0_1) || in ixgbe_set_rss_hash_opt()
2976 !(nfc->data & RXH_L4_B_2_3)) in ixgbe_set_rss_hash_opt()
2977 return -EINVAL; in ixgbe_set_rss_hash_opt()
2980 if (!(nfc->data & RXH_IP_SRC) || in ixgbe_set_rss_hash_opt()
2981 !(nfc->data & RXH_IP_DST)) in ixgbe_set_rss_hash_opt()
2982 return -EINVAL; in ixgbe_set_rss_hash_opt()
2983 switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { in ixgbe_set_rss_hash_opt()
2991 return -EINVAL; in ixgbe_set_rss_hash_opt()
2995 if (!(nfc->data & RXH_IP_SRC) || in ixgbe_set_rss_hash_opt()
2996 !(nfc->data & RXH_IP_DST)) in ixgbe_set_rss_hash_opt()
2997 return -EINVAL; in ixgbe_set_rss_hash_opt()
2998 switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { in ixgbe_set_rss_hash_opt()
3006 return -EINVAL; in ixgbe_set_rss_hash_opt()
3017 if (!(nfc->data & RXH_IP_SRC) || in ixgbe_set_rss_hash_opt()
3018 !(nfc->data & RXH_IP_DST) || in ixgbe_set_rss_hash_opt()
3019 (nfc->data & RXH_L4_B_0_1) || in ixgbe_set_rss_hash_opt()
3020 (nfc->data & RXH_L4_B_2_3)) in ixgbe_set_rss_hash_opt()
3021 return -EINVAL; in ixgbe_set_rss_hash_opt()
3024 return -EINVAL; in ixgbe_set_rss_hash_opt()
3028 if (flags2 != adapter->flags2) { in ixgbe_set_rss_hash_opt()
3029 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_rss_hash_opt() local
3031 unsigned int pf_pool = adapter->num_vfs; in ixgbe_set_rss_hash_opt()
3033 if ((hw->mac.type >= ixgbe_mac_X550) && in ixgbe_set_rss_hash_opt()
3034 (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) in ixgbe_set_rss_hash_opt()
3035 mrqc = IXGBE_READ_REG(hw, IXGBE_PFVFMRQC(pf_pool)); in ixgbe_set_rss_hash_opt()
3037 mrqc = IXGBE_READ_REG(hw, IXGBE_MRQC); in ixgbe_set_rss_hash_opt()
3040 !(adapter->flags2 & UDP_RSS_FLAGS)) in ixgbe_set_rss_hash_opt()
3043 adapter->flags2 = flags2; in ixgbe_set_rss_hash_opt()
3060 if ((hw->mac.type >= ixgbe_mac_X550) && in ixgbe_set_rss_hash_opt()
3061 (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) in ixgbe_set_rss_hash_opt()
3062 IXGBE_WRITE_REG(hw, IXGBE_PFVFMRQC(pf_pool), mrqc); in ixgbe_set_rss_hash_opt()
3064 IXGBE_WRITE_REG(hw, IXGBE_MRQC, mrqc); in ixgbe_set_rss_hash_opt()
3073 int ret = -EOPNOTSUPP; in ixgbe_set_rxnfc()
3075 switch (cmd->cmd) { in ixgbe_set_rxnfc()
3107 u16 rss_m = adapter->ring_feature[RING_F_RSS].mask; in ixgbe_get_reta()
3109 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) in ixgbe_get_reta()
3110 rss_m = adapter->ring_feature[RING_F_RSS].indices - 1; in ixgbe_get_reta()
3113 indir[i] = adapter->rss_indir_tbl[i] & rss_m; in ixgbe_get_reta()
3121 rxfh->hfunc = ETH_RSS_HASH_TOP; in ixgbe_get_rxfh()
3123 if (rxfh->indir) in ixgbe_get_rxfh()
3124 ixgbe_get_reta(adapter, rxfh->indir); in ixgbe_get_rxfh()
3126 if (rxfh->key) in ixgbe_get_rxfh()
3127 memcpy(rxfh->key, adapter->rss_key, in ixgbe_get_rxfh()
3141 if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE && in ixgbe_set_rxfh()
3142 rxfh->hfunc != ETH_RSS_HASH_TOP) in ixgbe_set_rxfh()
3143 return -EOPNOTSUPP; in ixgbe_set_rxfh()
3146 if (rxfh->indir) { in ixgbe_set_rxfh()
3147 int max_queues = min_t(int, adapter->num_rx_queues, in ixgbe_set_rxfh()
3150 /*Allow at least 2 queues w/ SR-IOV.*/ in ixgbe_set_rxfh()
3151 if ((adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) && in ixgbe_set_rxfh()
3157 if (rxfh->indir[i] >= max_queues) in ixgbe_set_rxfh()
3158 return -EINVAL; in ixgbe_set_rxfh()
3161 adapter->rss_indir_tbl[i] = rxfh->indir[i]; in ixgbe_set_rxfh()
3167 if (rxfh->key) { in ixgbe_set_rxfh()
3168 memcpy(adapter->rss_key, rxfh->key, in ixgbe_set_rxfh()
3182 info->rx_filters = BIT(HWTSTAMP_FILTER_NONE); in ixgbe_get_ts_info()
3184 switch (adapter->hw.mac.type) { in ixgbe_get_ts_info()
3188 info->rx_filters |= BIT(HWTSTAMP_FILTER_ALL); in ixgbe_get_ts_info()
3192 info->rx_filters |= in ixgbe_get_ts_info()
3201 info->so_timestamping = in ixgbe_get_ts_info()
3207 if (adapter->ptp_clock) in ixgbe_get_ts_info()
3208 info->phc_index = ptp_clock_index(adapter->ptp_clock); in ixgbe_get_ts_info()
3210 info->tx_types = in ixgbe_get_ts_info()
3220 u8 tcs = adapter->hw_tcs; in ixgbe_max_channels()
3222 if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) { in ixgbe_max_channels()
3223 /* We only support one q_vector without MSI-X */ in ixgbe_max_channels()
3225 } else if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) { in ixgbe_max_channels()
3227 max_combined = adapter->ring_feature[RING_F_RSS].mask + 1; in ixgbe_max_channels()
3230 if (adapter->hw.mac.type == ixgbe_mac_82598EB) { in ixgbe_max_channels()
3240 } else if (adapter->atr_sample_rate) { in ixgbe_max_channels()
3257 ch->max_combined = ixgbe_max_channels(adapter); in ixgbe_get_channels()
3260 if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) { in ixgbe_get_channels()
3261 ch->max_other = NON_Q_VECTORS; in ixgbe_get_channels()
3262 ch->other_count = NON_Q_VECTORS; in ixgbe_get_channels()
3266 ch->combined_count = adapter->ring_feature[RING_F_RSS].indices; in ixgbe_get_channels()
3269 if (ch->combined_count == 1) in ixgbe_get_channels()
3272 /* we do not support ATR queueing if SR-IOV is enabled */ in ixgbe_get_channels()
3273 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) in ixgbe_get_channels()
3277 if (adapter->hw_tcs > 1) in ixgbe_get_channels()
3281 if (!adapter->atr_sample_rate) in ixgbe_get_channels()
3285 ch->combined_count = adapter->ring_feature[RING_F_FDIR].indices; in ixgbe_get_channels()
3292 unsigned int count = ch->combined_count; in ixgbe_set_channels()
3296 if (!count || ch->rx_count || ch->tx_count) in ixgbe_set_channels()
3297 return -EINVAL; in ixgbe_set_channels()
3300 if (ch->other_count != NON_Q_VECTORS) in ixgbe_set_channels()
3301 return -EINVAL; in ixgbe_set_channels()
3305 return -EINVAL; in ixgbe_set_channels()
3307 /* update feature limits from largest to smallest supported values */ in ixgbe_set_channels()
3308 adapter->ring_feature[RING_F_FDIR].limit = count; in ixgbe_set_channels()
3313 adapter->ring_feature[RING_F_RSS].limit = count; in ixgbe_set_channels()
3319 adapter->ring_feature[RING_F_FCOE].limit = count; in ixgbe_set_channels()
3323 return ixgbe_setup_tc(dev, adapter->hw_tcs); in ixgbe_set_channels()
3330 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_module_info() local
3335 if (hw->phy.type == ixgbe_phy_fw) in ixgbe_get_module_info()
3336 return -ENXIO; in ixgbe_get_module_info()
3338 /* Check whether we support SFF-8472 or not */ in ixgbe_get_module_info()
3339 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_get_module_info()
3343 return -EIO; in ixgbe_get_module_info()
3345 /* addressing mode is not supported */ in ixgbe_get_module_info()
3346 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_get_module_info()
3350 return -EIO; in ixgbe_get_module_info()
3353 …e_err(drv, "Address change required to access page 0xA2, but not supported. Please report the modu… in ixgbe_get_module_info()
3359 /* We have a SFP, but it does not support SFF-8472 */ in ixgbe_get_module_info()
3360 modinfo->type = ETH_MODULE_SFF_8079; in ixgbe_get_module_info()
3361 modinfo->eeprom_len = ETH_MODULE_SFF_8079_LEN; in ixgbe_get_module_info()
3363 /* We have a SFP which supports a revision of SFF-8472. */ in ixgbe_get_module_info()
3364 modinfo->type = ETH_MODULE_SFF_8472; in ixgbe_get_module_info()
3365 modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN; in ixgbe_get_module_info()
3376 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_module_eeprom() local
3377 int status = -EFAULT; in ixgbe_get_module_eeprom()
3381 if (ee->len == 0) in ixgbe_get_module_eeprom()
3382 return -EINVAL; in ixgbe_get_module_eeprom()
3384 if (hw->phy.type == ixgbe_phy_fw) in ixgbe_get_module_eeprom()
3385 return -ENXIO; in ixgbe_get_module_eeprom()
3387 for (i = ee->offset; i < ee->offset + ee->len; i++) { in ixgbe_get_module_eeprom()
3389 if (test_bit(__IXGBE_IN_SFP_INIT, &adapter->state)) in ixgbe_get_module_eeprom()
3390 return -EBUSY; in ixgbe_get_module_eeprom()
3393 status = hw->phy.ops.read_i2c_eeprom(hw, i, &databyte); in ixgbe_get_module_eeprom()
3395 status = hw->phy.ops.read_i2c_sff8472(hw, i, &databyte); in ixgbe_get_module_eeprom()
3398 return -EIO; in ixgbe_get_module_eeprom()
3400 data[i - ee->offset] = databyte; in ixgbe_get_module_eeprom()
3434 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_eee_fw() local
3438 rc = ixgbe_fw_phy_activity(hw, FW_PHY_ACT_UD_2, &info); in ixgbe_get_eee_fw()
3445 edata->lp_advertised); in ixgbe_get_eee_fw()
3449 if (hw->phy.eee_speeds_supported & ixgbe_ls_map[i].mac_speed) in ixgbe_get_eee_fw()
3451 edata->supported); in ixgbe_get_eee_fw()
3455 if (hw->phy.eee_speeds_advertised & ixgbe_ls_map[i].mac_speed) in ixgbe_get_eee_fw()
3457 edata->advertised); in ixgbe_get_eee_fw()
3460 edata->eee_enabled = !linkmode_empty(edata->advertised); in ixgbe_get_eee_fw()
3461 edata->tx_lpi_enabled = edata->eee_enabled; in ixgbe_get_eee_fw()
3463 linkmode_and(common, edata->advertised, edata->lp_advertised); in ixgbe_get_eee_fw()
3464 edata->eee_active = !linkmode_empty(common); in ixgbe_get_eee_fw()
3472 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_eee() local
3474 if (!(adapter->flags2 & IXGBE_FLAG2_EEE_CAPABLE)) in ixgbe_get_eee()
3475 return -EOPNOTSUPP; in ixgbe_get_eee()
3477 if (hw->phy.eee_speeds_supported && hw->phy.type == ixgbe_phy_fw) in ixgbe_get_eee()
3480 return -EOPNOTSUPP; in ixgbe_get_eee()
3486 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_eee() local
3490 if (!(adapter->flags2 & IXGBE_FLAG2_EEE_CAPABLE)) in ixgbe_set_eee()
3491 return -EOPNOTSUPP; in ixgbe_set_eee()
3499 if (eee_data.eee_enabled && !edata->eee_enabled) { in ixgbe_set_eee()
3500 if (eee_data.tx_lpi_enabled != edata->tx_lpi_enabled) { in ixgbe_set_eee()
3501 e_err(drv, "Setting EEE tx-lpi is not supported\n"); in ixgbe_set_eee()
3502 return -EINVAL; in ixgbe_set_eee()
3505 if (eee_data.tx_lpi_timer != edata->tx_lpi_timer) { in ixgbe_set_eee()
3507 "Setting EEE Tx LPI timer is not supported\n"); in ixgbe_set_eee()
3508 return -EINVAL; in ixgbe_set_eee()
3511 if (!linkmode_equal(eee_data.advertised, edata->advertised)) { in ixgbe_set_eee()
3513 "Setting EEE advertised speeds is not supported\n"); in ixgbe_set_eee()
3514 return -EINVAL; in ixgbe_set_eee()
3518 if (eee_data.eee_enabled != edata->eee_enabled) { in ixgbe_set_eee()
3519 if (edata->eee_enabled) { in ixgbe_set_eee()
3520 adapter->flags2 |= IXGBE_FLAG2_EEE_ENABLED; in ixgbe_set_eee()
3521 hw->phy.eee_speeds_advertised = in ixgbe_set_eee()
3522 hw->phy.eee_speeds_supported; in ixgbe_set_eee()
3524 adapter->flags2 &= ~IXGBE_FLAG2_EEE_ENABLED; in ixgbe_set_eee()
3525 hw->phy.eee_speeds_advertised = 0; in ixgbe_set_eee()
3543 if (adapter->flags2 & IXGBE_FLAG2_RX_LEGACY) in ixgbe_get_priv_flags()
3546 if (adapter->flags2 & IXGBE_FLAG2_VF_IPSEC_ENABLED) in ixgbe_get_priv_flags()
3549 if (adapter->flags2 & IXGBE_FLAG2_AUTO_DISABLE_VF) in ixgbe_get_priv_flags()
3558 unsigned int flags2 = adapter->flags2; in ixgbe_set_priv_flags()
3571 if (adapter->hw.mac.type == ixgbe_mac_82599EB) { in ixgbe_set_priv_flags()
3573 for (i = 0; i < adapter->num_vfs; i++) in ixgbe_set_priv_flags()
3574 adapter->vfinfo[i].primary_abort_count = 0; in ixgbe_set_priv_flags()
3579 "Cannot set private flags: Operation not supported\n"); in ixgbe_set_priv_flags()
3580 return -EOPNOTSUPP; in ixgbe_set_priv_flags()
3584 if (flags2 != adapter->flags2) { in ixgbe_set_priv_flags()
3585 adapter->flags2 = flags2; in ixgbe_set_priv_flags()
3642 netdev->ethtool_ops = &ixgbe_ethtool_ops; in ixgbe_set_ethtool_ops()