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

1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 1999 - 2018 Intel Corporation. */
33 sizeof(((struct ixgbe_adapter *)0)->m), \
36 sizeof(((struct rtnl_link_stats64 *)0)->m), \
113 #define IXGBE_NUM_RX_QUEUES netdev->num_tx_queues
116 (netdev->num_tx_queues + IXGBE_NUM_RX_QUEUES) * \
120 (sizeof(((struct ixgbe_adapter *)0)->stats.pxonrxc) + \
121 sizeof(((struct ixgbe_adapter *)0)->stats.pxontxc) + \
122 sizeof(((struct ixgbe_adapter *)0)->stats.pxoffrxc) + \
123 sizeof(((struct ixgbe_adapter *)0)->stats.pxofftxc)) \
138 "legacy-rx",
140 "vf-ipsec",
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()
352 ethtool_link_ksettings_add_link_mode(cmd, supported, in ixgbe_get_link_ksettings()
356 cmd->base.port = PORT_FIBRE; in ixgbe_get_link_ksettings()
359 ethtool_link_ksettings_add_link_mode(cmd, supported, in ixgbe_get_link_ksettings()
363 cmd->base.port = PORT_NONE; in ixgbe_get_link_ksettings()
367 ethtool_link_ksettings_add_link_mode(cmd, supported, in ixgbe_get_link_ksettings()
371 cmd->base.port = PORT_TP; in ixgbe_get_link_ksettings()
375 ethtool_link_ksettings_add_link_mode(cmd, supported, in ixgbe_get_link_ksettings()
379 cmd->base.port = PORT_OTHER; in ixgbe_get_link_ksettings()
384 ethtool_link_ksettings_add_link_mode(cmd, supported, in ixgbe_get_link_ksettings()
388 cmd->base.port = PORT_NONE; in ixgbe_get_link_ksettings()
394 ethtool_link_ksettings_add_link_mode(cmd, supported, in ixgbe_get_link_ksettings()
398 cmd->base.port = PORT_OTHER; in ixgbe_get_link_ksettings()
403 ethtool_link_ksettings_add_link_mode(cmd, supported, Pause); in ixgbe_get_link_ksettings()
405 switch (hw->fc.requested_mode) { in ixgbe_get_link_ksettings()
425 switch (adapter->link_speed) { in ixgbe_get_link_ksettings()
427 cmd->base.speed = SPEED_10000; in ixgbe_get_link_ksettings()
430 cmd->base.speed = SPEED_5000; in ixgbe_get_link_ksettings()
433 cmd->base.speed = SPEED_2500; in ixgbe_get_link_ksettings()
436 cmd->base.speed = SPEED_1000; in ixgbe_get_link_ksettings()
439 cmd->base.speed = SPEED_100; in ixgbe_get_link_ksettings()
442 cmd->base.speed = SPEED_10; in ixgbe_get_link_ksettings()
447 cmd->base.duplex = DUPLEX_FULL; in ixgbe_get_link_ksettings()
449 cmd->base.speed = SPEED_UNKNOWN; in ixgbe_get_link_ksettings()
450 cmd->base.duplex = DUPLEX_UNKNOWN; in ixgbe_get_link_ksettings()
460 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_link_ksettings() local
464 if ((hw->phy.media_type == ixgbe_media_type_copper) || in ixgbe_set_link_ksettings()
465 (hw->phy.multispeed_fiber)) { in ixgbe_set_link_ksettings()
470 if (!bitmap_subset(cmd->link_modes.advertising, in ixgbe_set_link_ksettings()
471 cmd->link_modes.supported, in ixgbe_set_link_ksettings()
473 return -EINVAL; in ixgbe_set_link_ksettings()
476 if (!cmd->base.autoneg && hw->phy.multispeed_fiber) { in ixgbe_set_link_ksettings()
481 return -EINVAL; in ixgbe_set_link_ksettings()
484 old = hw->phy.autoneg_advertised; in ixgbe_set_link_ksettings()
509 /* this sets the link speed and restarts auto-neg */ in ixgbe_set_link_ksettings()
510 while (test_and_set_bit(__IXGBE_IN_SFP_INIT, &adapter->state)) in ixgbe_set_link_ksettings()
513 hw->mac.autotry_restart = true; in ixgbe_set_link_ksettings()
514 err = hw->mac.ops.setup_link(hw, advertised, true); in ixgbe_set_link_ksettings()
517 hw->mac.ops.setup_link(hw, old, true); in ixgbe_set_link_ksettings()
519 clear_bit(__IXGBE_IN_SFP_INIT, &adapter->state); in ixgbe_set_link_ksettings()
522 u32 speed = cmd->base.speed; in ixgbe_set_link_ksettings()
524 if ((cmd->base.autoneg == AUTONEG_ENABLE) || in ixgbe_set_link_ksettings()
527 (speed + cmd->base.duplex != SPEED_10000 + DUPLEX_FULL)) in ixgbe_set_link_ksettings()
528 return -EINVAL; in ixgbe_set_link_ksettings()
538 struct ixgbe_hw_stats *hwstats = &adapter->stats; in ixgbe_get_pause_stats()
540 stats->tx_pause_frames = hwstats->lxontxc + hwstats->lxofftxc; in ixgbe_get_pause_stats()
541 stats->rx_pause_frames = hwstats->lxonrxc + hwstats->lxoffrxc; in ixgbe_get_pause_stats()
548 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_pauseparam() local
550 if (ixgbe_device_supports_autoneg_fc(hw) && in ixgbe_get_pauseparam()
551 !hw->fc.disable_fc_autoneg) in ixgbe_get_pauseparam()
552 pause->autoneg = 1; in ixgbe_get_pauseparam()
554 pause->autoneg = 0; in ixgbe_get_pauseparam()
556 if (hw->fc.current_mode == ixgbe_fc_rx_pause) { in ixgbe_get_pauseparam()
557 pause->rx_pause = 1; in ixgbe_get_pauseparam()
558 } else if (hw->fc.current_mode == ixgbe_fc_tx_pause) { in ixgbe_get_pauseparam()
559 pause->tx_pause = 1; in ixgbe_get_pauseparam()
560 } else if (hw->fc.current_mode == ixgbe_fc_full) { in ixgbe_get_pauseparam()
561 pause->rx_pause = 1; in ixgbe_get_pauseparam()
562 pause->tx_pause = 1; in ixgbe_get_pauseparam()
570 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_pauseparam() local
571 struct ixgbe_fc_info fc = hw->fc; in ixgbe_set_pauseparam()
574 if ((hw->mac.type == ixgbe_mac_82598EB) && in ixgbe_set_pauseparam()
575 (adapter->flags & IXGBE_FLAG_DCB_ENABLED)) in ixgbe_set_pauseparam()
576 return -EINVAL; in ixgbe_set_pauseparam()
579 if ((pause->autoneg == AUTONEG_ENABLE) && in ixgbe_set_pauseparam()
580 !ixgbe_device_supports_autoneg_fc(hw)) in ixgbe_set_pauseparam()
581 return -EINVAL; in ixgbe_set_pauseparam()
583 fc.disable_fc_autoneg = (pause->autoneg != AUTONEG_ENABLE); in ixgbe_set_pauseparam()
585 if ((pause->rx_pause && pause->tx_pause) || pause->autoneg) in ixgbe_set_pauseparam()
587 else if (pause->rx_pause && !pause->tx_pause) in ixgbe_set_pauseparam()
589 else if (!pause->rx_pause && pause->tx_pause) in ixgbe_set_pauseparam()
595 if (memcmp(&fc, &hw->fc, sizeof(struct ixgbe_fc_info))) { in ixgbe_set_pauseparam()
596 hw->fc = fc; in ixgbe_set_pauseparam()
609 return adapter->msg_enable; in ixgbe_get_msglevel()
615 adapter->msg_enable = data; in ixgbe_set_msglevel()
624 #define IXGBE_GET_STAT(_A_, _R_) _A_->stats._R_
630 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_regs() local
636 regs->version = hw->mac.type << 24 | hw->revision_id << 16 | in ixgbe_get_regs()
637 hw->device_id; in ixgbe_get_regs()
640 regs_buff[0] = IXGBE_READ_REG(hw, IXGBE_CTRL); in ixgbe_get_regs()
641 regs_buff[1] = IXGBE_READ_REG(hw, IXGBE_STATUS); in ixgbe_get_regs()
642 regs_buff[2] = IXGBE_READ_REG(hw, IXGBE_CTRL_EXT); in ixgbe_get_regs()
643 regs_buff[3] = IXGBE_READ_REG(hw, IXGBE_ESDP); in ixgbe_get_regs()
644 regs_buff[4] = IXGBE_READ_REG(hw, IXGBE_EODSDP); in ixgbe_get_regs()
645 regs_buff[5] = IXGBE_READ_REG(hw, IXGBE_LEDCTL); in ixgbe_get_regs()
646 regs_buff[6] = IXGBE_READ_REG(hw, IXGBE_FRTIMER); in ixgbe_get_regs()
647 regs_buff[7] = IXGBE_READ_REG(hw, IXGBE_TCPTIMER); in ixgbe_get_regs()
650 regs_buff[8] = IXGBE_READ_REG(hw, IXGBE_EEC(hw)); in ixgbe_get_regs()
651 regs_buff[9] = IXGBE_READ_REG(hw, IXGBE_EERD); in ixgbe_get_regs()
652 regs_buff[10] = IXGBE_READ_REG(hw, IXGBE_FLA(hw)); in ixgbe_get_regs()
653 regs_buff[11] = IXGBE_READ_REG(hw, IXGBE_EEMNGCTL); in ixgbe_get_regs()
654 regs_buff[12] = IXGBE_READ_REG(hw, IXGBE_EEMNGDATA); in ixgbe_get_regs()
655 regs_buff[13] = IXGBE_READ_REG(hw, IXGBE_FLMNGCTL); in ixgbe_get_regs()
656 regs_buff[14] = IXGBE_READ_REG(hw, IXGBE_FLMNGDATA); in ixgbe_get_regs()
657 regs_buff[15] = IXGBE_READ_REG(hw, IXGBE_FLMNGCNT); in ixgbe_get_regs()
658 regs_buff[16] = IXGBE_READ_REG(hw, IXGBE_FLOP); in ixgbe_get_regs()
659 regs_buff[17] = IXGBE_READ_REG(hw, IXGBE_GRC(hw)); in ixgbe_get_regs()
664 regs_buff[18] = IXGBE_READ_REG(hw, IXGBE_EICS); in ixgbe_get_regs()
665 regs_buff[19] = IXGBE_READ_REG(hw, IXGBE_EICS); in ixgbe_get_regs()
666 regs_buff[20] = IXGBE_READ_REG(hw, IXGBE_EIMS); in ixgbe_get_regs()
667 regs_buff[21] = IXGBE_READ_REG(hw, IXGBE_EIMC); in ixgbe_get_regs()
668 regs_buff[22] = IXGBE_READ_REG(hw, IXGBE_EIAC); in ixgbe_get_regs()
669 regs_buff[23] = IXGBE_READ_REG(hw, IXGBE_EIAM); in ixgbe_get_regs()
670 regs_buff[24] = IXGBE_READ_REG(hw, IXGBE_EITR(0)); in ixgbe_get_regs()
671 regs_buff[25] = IXGBE_READ_REG(hw, IXGBE_IVAR(0)); in ixgbe_get_regs()
672 regs_buff[26] = IXGBE_READ_REG(hw, IXGBE_MSIXT); in ixgbe_get_regs()
673 regs_buff[27] = IXGBE_READ_REG(hw, IXGBE_MSIXPBA); in ixgbe_get_regs()
674 regs_buff[28] = IXGBE_READ_REG(hw, IXGBE_PBACL(0)); in ixgbe_get_regs()
675 regs_buff[29] = IXGBE_READ_REG(hw, IXGBE_GPIE); in ixgbe_get_regs()
678 regs_buff[30] = IXGBE_READ_REG(hw, IXGBE_PFCTOP); in ixgbe_get_regs()
680 regs_buff[31 + i] = IXGBE_READ_REG(hw, IXGBE_FCTTV(i)); in ixgbe_get_regs()
682 switch (hw->mac.type) { in ixgbe_get_regs()
684 regs_buff[35 + i] = IXGBE_READ_REG(hw, IXGBE_FCRTL(i)); in ixgbe_get_regs()
685 regs_buff[43 + i] = IXGBE_READ_REG(hw, IXGBE_FCRTH(i)); in ixgbe_get_regs()
692 regs_buff[35 + i] = IXGBE_READ_REG(hw, IXGBE_FCRTL_82599(i)); in ixgbe_get_regs()
693 regs_buff[43 + i] = IXGBE_READ_REG(hw, IXGBE_FCRTH_82599(i)); in ixgbe_get_regs()
699 regs_buff[51] = IXGBE_READ_REG(hw, IXGBE_FCRTV); in ixgbe_get_regs()
700 regs_buff[52] = IXGBE_READ_REG(hw, IXGBE_TFCS); in ixgbe_get_regs()
704 regs_buff[53 + i] = IXGBE_READ_REG(hw, IXGBE_RDBAL(i)); in ixgbe_get_regs()
706 regs_buff[117 + i] = IXGBE_READ_REG(hw, IXGBE_RDBAH(i)); in ixgbe_get_regs()
708 regs_buff[181 + i] = IXGBE_READ_REG(hw, IXGBE_RDLEN(i)); in ixgbe_get_regs()
710 regs_buff[245 + i] = IXGBE_READ_REG(hw, IXGBE_RDH(i)); in ixgbe_get_regs()
712 regs_buff[309 + i] = IXGBE_READ_REG(hw, IXGBE_RDT(i)); in ixgbe_get_regs()
714 regs_buff[373 + i] = IXGBE_READ_REG(hw, IXGBE_RXDCTL(i)); in ixgbe_get_regs()
716 regs_buff[437 + i] = IXGBE_READ_REG(hw, IXGBE_SRRCTL(i)); in ixgbe_get_regs()
718 regs_buff[453 + i] = IXGBE_READ_REG(hw, IXGBE_DCA_RXCTRL(i)); in ixgbe_get_regs()
719 regs_buff[469] = IXGBE_READ_REG(hw, IXGBE_RDRXCTL); in ixgbe_get_regs()
721 regs_buff[470 + i] = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(i)); in ixgbe_get_regs()
722 regs_buff[478] = IXGBE_READ_REG(hw, IXGBE_RXCTRL); in ixgbe_get_regs()
723 regs_buff[479] = IXGBE_READ_REG(hw, IXGBE_DROPEN); in ixgbe_get_regs()
726 regs_buff[480] = IXGBE_READ_REG(hw, IXGBE_RXCSUM); in ixgbe_get_regs()
727 regs_buff[481] = IXGBE_READ_REG(hw, IXGBE_RFCTL); in ixgbe_get_regs()
729 regs_buff[482 + i] = IXGBE_READ_REG(hw, IXGBE_RAL(i)); in ixgbe_get_regs()
731 regs_buff[498 + i] = IXGBE_READ_REG(hw, IXGBE_RAH(i)); in ixgbe_get_regs()
732 regs_buff[514] = IXGBE_READ_REG(hw, IXGBE_PSRTYPE(0)); in ixgbe_get_regs()
733 regs_buff[515] = IXGBE_READ_REG(hw, IXGBE_FCTRL); in ixgbe_get_regs()
734 regs_buff[516] = IXGBE_READ_REG(hw, IXGBE_VLNCTRL); in ixgbe_get_regs()
735 regs_buff[517] = IXGBE_READ_REG(hw, IXGBE_MCSTCTRL); in ixgbe_get_regs()
736 regs_buff[518] = IXGBE_READ_REG(hw, IXGBE_MRQC); in ixgbe_get_regs()
737 regs_buff[519] = IXGBE_READ_REG(hw, IXGBE_VMD_CTL); in ixgbe_get_regs()
739 regs_buff[520 + i] = IXGBE_READ_REG(hw, IXGBE_IMIR(i)); in ixgbe_get_regs()
741 regs_buff[528 + i] = IXGBE_READ_REG(hw, IXGBE_IMIREXT(i)); in ixgbe_get_regs()
742 regs_buff[536] = IXGBE_READ_REG(hw, IXGBE_IMIRVP); in ixgbe_get_regs()
746 regs_buff[537 + i] = IXGBE_READ_REG(hw, IXGBE_TDBAL(i)); in ixgbe_get_regs()
748 regs_buff[569 + i] = IXGBE_READ_REG(hw, IXGBE_TDBAH(i)); in ixgbe_get_regs()
750 regs_buff[601 + i] = IXGBE_READ_REG(hw, IXGBE_TDLEN(i)); in ixgbe_get_regs()
752 regs_buff[633 + i] = IXGBE_READ_REG(hw, IXGBE_TDH(i)); in ixgbe_get_regs()
754 regs_buff[665 + i] = IXGBE_READ_REG(hw, IXGBE_TDT(i)); in ixgbe_get_regs()
756 regs_buff[697 + i] = IXGBE_READ_REG(hw, IXGBE_TXDCTL(i)); in ixgbe_get_regs()
758 regs_buff[729 + i] = IXGBE_READ_REG(hw, IXGBE_TDWBAL(i)); in ixgbe_get_regs()
760 regs_buff[761 + i] = IXGBE_READ_REG(hw, IXGBE_TDWBAH(i)); in ixgbe_get_regs()
761 regs_buff[793] = IXGBE_READ_REG(hw, IXGBE_DTXCTL); in ixgbe_get_regs()
763 regs_buff[794 + i] = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL(i)); in ixgbe_get_regs()
764 regs_buff[810] = IXGBE_READ_REG(hw, IXGBE_TIPG); in ixgbe_get_regs()
766 regs_buff[811 + i] = IXGBE_READ_REG(hw, IXGBE_TXPBSIZE(i)); in ixgbe_get_regs()
767 regs_buff[819] = IXGBE_READ_REG(hw, IXGBE_MNGTXMAP); in ixgbe_get_regs()
770 regs_buff[820] = IXGBE_READ_REG(hw, IXGBE_WUC); in ixgbe_get_regs()
771 regs_buff[821] = IXGBE_READ_REG(hw, IXGBE_WUFC); in ixgbe_get_regs()
772 regs_buff[822] = IXGBE_READ_REG(hw, IXGBE_WUS); in ixgbe_get_regs()
773 regs_buff[823] = IXGBE_READ_REG(hw, IXGBE_IPAV); in ixgbe_get_regs()
774 regs_buff[824] = IXGBE_READ_REG(hw, IXGBE_IP4AT); in ixgbe_get_regs()
775 regs_buff[825] = IXGBE_READ_REG(hw, IXGBE_IP6AT); in ixgbe_get_regs()
776 regs_buff[826] = IXGBE_READ_REG(hw, IXGBE_WUPL); in ixgbe_get_regs()
777 regs_buff[827] = IXGBE_READ_REG(hw, IXGBE_WUPM); in ixgbe_get_regs()
778 regs_buff[828] = IXGBE_READ_REG(hw, IXGBE_FHFT(0)); in ixgbe_get_regs()
781 regs_buff[829] = IXGBE_READ_REG(hw, IXGBE_RMCS); /* same as FCCFG */ in ixgbe_get_regs()
782 regs_buff[831] = IXGBE_READ_REG(hw, IXGBE_PDPMCS); /* same as RTTPCS */ in ixgbe_get_regs()
784 switch (hw->mac.type) { in ixgbe_get_regs()
786 regs_buff[830] = IXGBE_READ_REG(hw, IXGBE_DPMCS); in ixgbe_get_regs()
787 regs_buff[832] = IXGBE_READ_REG(hw, IXGBE_RUPPBMR); in ixgbe_get_regs()
790 IXGBE_READ_REG(hw, IXGBE_RT2CR(i)); in ixgbe_get_regs()
793 IXGBE_READ_REG(hw, IXGBE_RT2SR(i)); in ixgbe_get_regs()
796 IXGBE_READ_REG(hw, IXGBE_TDTQ2TCCR(i)); in ixgbe_get_regs()
799 IXGBE_READ_REG(hw, IXGBE_TDTQ2TCSR(i)); in ixgbe_get_regs()
806 regs_buff[830] = IXGBE_READ_REG(hw, IXGBE_RTTDCS); in ixgbe_get_regs()
807 regs_buff[832] = IXGBE_READ_REG(hw, IXGBE_RTRPCS); in ixgbe_get_regs()
810 IXGBE_READ_REG(hw, IXGBE_RTRPT4C(i)); in ixgbe_get_regs()
813 IXGBE_READ_REG(hw, IXGBE_RTRPT4S(i)); in ixgbe_get_regs()
816 IXGBE_READ_REG(hw, IXGBE_RTTDT2C(i)); in ixgbe_get_regs()
819 IXGBE_READ_REG(hw, IXGBE_RTTDT2S(i)); in ixgbe_get_regs()
827 IXGBE_READ_REG(hw, IXGBE_TDPT2TCCR(i)); /* same as RTTPT2C */ in ixgbe_get_regs()
830 IXGBE_READ_REG(hw, IXGBE_TDPT2TCSR(i)); /* same as RTTPT2S */ in ixgbe_get_regs()
900 regs_buff[1038] = IXGBE_READ_REG(hw, IXGBE_PCS1GCFIG); in ixgbe_get_regs()
901 regs_buff[1039] = IXGBE_READ_REG(hw, IXGBE_PCS1GLCTL); in ixgbe_get_regs()
902 regs_buff[1040] = IXGBE_READ_REG(hw, IXGBE_PCS1GLSTA); in ixgbe_get_regs()
903 regs_buff[1041] = IXGBE_READ_REG(hw, IXGBE_PCS1GDBG0); in ixgbe_get_regs()
904 regs_buff[1042] = IXGBE_READ_REG(hw, IXGBE_PCS1GDBG1); in ixgbe_get_regs()
905 regs_buff[1043] = IXGBE_READ_REG(hw, IXGBE_PCS1GANA); in ixgbe_get_regs()
906 regs_buff[1044] = IXGBE_READ_REG(hw, IXGBE_PCS1GANLP); in ixgbe_get_regs()
907 regs_buff[1045] = IXGBE_READ_REG(hw, IXGBE_PCS1GANNP); in ixgbe_get_regs()
908 regs_buff[1046] = IXGBE_READ_REG(hw, IXGBE_PCS1GANLPNP); in ixgbe_get_regs()
909 regs_buff[1047] = IXGBE_READ_REG(hw, IXGBE_HLREG0); in ixgbe_get_regs()
910 regs_buff[1048] = IXGBE_READ_REG(hw, IXGBE_HLREG1); in ixgbe_get_regs()
911 regs_buff[1049] = IXGBE_READ_REG(hw, IXGBE_PAP); in ixgbe_get_regs()
912 regs_buff[1050] = IXGBE_READ_REG(hw, IXGBE_MACA); in ixgbe_get_regs()
913 regs_buff[1051] = IXGBE_READ_REG(hw, IXGBE_APAE); in ixgbe_get_regs()
914 regs_buff[1052] = IXGBE_READ_REG(hw, IXGBE_ARD); in ixgbe_get_regs()
915 regs_buff[1053] = IXGBE_READ_REG(hw, IXGBE_AIS); in ixgbe_get_regs()
916 regs_buff[1054] = IXGBE_READ_REG(hw, IXGBE_MSCA); in ixgbe_get_regs()
917 regs_buff[1055] = IXGBE_READ_REG(hw, IXGBE_MSRWD); in ixgbe_get_regs()
918 regs_buff[1056] = IXGBE_READ_REG(hw, IXGBE_MLADD); in ixgbe_get_regs()
919 regs_buff[1057] = IXGBE_READ_REG(hw, IXGBE_MHADD); in ixgbe_get_regs()
920 regs_buff[1058] = IXGBE_READ_REG(hw, IXGBE_TREG); in ixgbe_get_regs()
921 regs_buff[1059] = IXGBE_READ_REG(hw, IXGBE_PCSS1); in ixgbe_get_regs()
922 regs_buff[1060] = IXGBE_READ_REG(hw, IXGBE_PCSS2); in ixgbe_get_regs()
923 regs_buff[1061] = IXGBE_READ_REG(hw, IXGBE_XPCSS); in ixgbe_get_regs()
924 regs_buff[1062] = IXGBE_READ_REG(hw, IXGBE_SERDESC); in ixgbe_get_regs()
925 regs_buff[1063] = IXGBE_READ_REG(hw, IXGBE_MACS); in ixgbe_get_regs()
926 regs_buff[1064] = IXGBE_READ_REG(hw, IXGBE_AUTOC); in ixgbe_get_regs()
927 regs_buff[1065] = IXGBE_READ_REG(hw, IXGBE_LINKS); in ixgbe_get_regs()
928 regs_buff[1066] = IXGBE_READ_REG(hw, IXGBE_AUTOC2); in ixgbe_get_regs()
929 regs_buff[1067] = IXGBE_READ_REG(hw, IXGBE_AUTOC3); in ixgbe_get_regs()
930 regs_buff[1068] = IXGBE_READ_REG(hw, IXGBE_ANLP1); in ixgbe_get_regs()
931 regs_buff[1069] = IXGBE_READ_REG(hw, IXGBE_ANLP2); in ixgbe_get_regs()
932 regs_buff[1070] = IXGBE_READ_REG(hw, IXGBE_ATLASCTL); in ixgbe_get_regs()
935 regs_buff[1071] = IXGBE_READ_REG(hw, IXGBE_RDSTATCTL); in ixgbe_get_regs()
937 regs_buff[1072 + i] = IXGBE_READ_REG(hw, IXGBE_RDSTAT(i)); in ixgbe_get_regs()
938 regs_buff[1080] = IXGBE_READ_REG(hw, IXGBE_RDHMPN); in ixgbe_get_regs()
940 regs_buff[1081 + i] = IXGBE_READ_REG(hw, IXGBE_RIC_DW(i)); in ixgbe_get_regs()
941 regs_buff[1085] = IXGBE_READ_REG(hw, IXGBE_RDPROBE); in ixgbe_get_regs()
942 regs_buff[1086] = IXGBE_READ_REG(hw, IXGBE_TDSTATCTL); in ixgbe_get_regs()
944 regs_buff[1087 + i] = IXGBE_READ_REG(hw, IXGBE_TDSTAT(i)); in ixgbe_get_regs()
945 regs_buff[1095] = IXGBE_READ_REG(hw, IXGBE_TDHMPN); in ixgbe_get_regs()
947 regs_buff[1096 + i] = IXGBE_READ_REG(hw, IXGBE_TIC_DW(i)); in ixgbe_get_regs()
948 regs_buff[1100] = IXGBE_READ_REG(hw, IXGBE_TDPROBE); in ixgbe_get_regs()
949 regs_buff[1101] = IXGBE_READ_REG(hw, IXGBE_TXBUFCTRL); in ixgbe_get_regs()
951 regs_buff[1102 + i] = IXGBE_READ_REG(hw, IXGBE_TXBUFDATA(i)); in ixgbe_get_regs()
952 regs_buff[1106] = IXGBE_READ_REG(hw, IXGBE_RXBUFCTRL); in ixgbe_get_regs()
954 regs_buff[1107 + i] = IXGBE_READ_REG(hw, IXGBE_RXBUFDATA(i)); in ixgbe_get_regs()
956 regs_buff[1111 + i] = IXGBE_READ_REG(hw, IXGBE_PCIE_DIAG(i)); in ixgbe_get_regs()
957 regs_buff[1119] = IXGBE_READ_REG(hw, IXGBE_RFVAL); in ixgbe_get_regs()
958 regs_buff[1120] = IXGBE_READ_REG(hw, IXGBE_MDFTC1); in ixgbe_get_regs()
959 regs_buff[1121] = IXGBE_READ_REG(hw, IXGBE_MDFTC2); in ixgbe_get_regs()
960 regs_buff[1122] = IXGBE_READ_REG(hw, IXGBE_MDFTFIFO1); in ixgbe_get_regs()
961 regs_buff[1123] = IXGBE_READ_REG(hw, IXGBE_MDFTFIFO2); in ixgbe_get_regs()
962 regs_buff[1124] = IXGBE_READ_REG(hw, IXGBE_MDFTS); in ixgbe_get_regs()
963 regs_buff[1125] = IXGBE_READ_REG(hw, IXGBE_PCIEECCCTL); in ixgbe_get_regs()
964 regs_buff[1126] = IXGBE_READ_REG(hw, IXGBE_PBTXECC); in ixgbe_get_regs()
965 regs_buff[1127] = IXGBE_READ_REG(hw, IXGBE_PBRXECC); in ixgbe_get_regs()
968 regs_buff[1128] = IXGBE_READ_REG(hw, IXGBE_MFLCN); in ixgbe_get_regs()
971 regs_buff[1129] = IXGBE_READ_REG(hw, IXGBE_RTRUP2TC); in ixgbe_get_regs()
972 regs_buff[1130] = IXGBE_READ_REG(hw, IXGBE_RTTUP2TC); in ixgbe_get_regs()
974 regs_buff[1131 + i] = IXGBE_READ_REG(hw, IXGBE_TXLLQ(i)); in ixgbe_get_regs()
975 regs_buff[1135] = IXGBE_READ_REG(hw, IXGBE_RTTBCNRM); in ixgbe_get_regs()
977 regs_buff[1136] = IXGBE_READ_REG(hw, IXGBE_RTTBCNRD); in ixgbe_get_regs()
981 regs_buff[1137] = IXGBE_READ_REG(hw, IXGBE_RTTQCNCR); in ixgbe_get_regs()
982 regs_buff[1138] = IXGBE_READ_REG(hw, IXGBE_RTTQCNTG); in ixgbe_get_regs()
985 regs_buff[1139] = IXGBE_READ_REG(hw, IXGBE_SECTXCTRL); in ixgbe_get_regs()
986 regs_buff[1140] = IXGBE_READ_REG(hw, IXGBE_SECTXSTAT); in ixgbe_get_regs()
987 regs_buff[1141] = IXGBE_READ_REG(hw, IXGBE_SECTXBUFFAF); in ixgbe_get_regs()
988 regs_buff[1142] = IXGBE_READ_REG(hw, IXGBE_SECTXMINIFG); in ixgbe_get_regs()
989 regs_buff[1143] = IXGBE_READ_REG(hw, IXGBE_SECRXCTRL); in ixgbe_get_regs()
990 regs_buff[1144] = IXGBE_READ_REG(hw, IXGBE_SECRXSTAT); in ixgbe_get_regs()
996 return adapter->hw.eeprom.word_size * 2; in ixgbe_get_eeprom_len()
1003 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_eeprom() local
1009 if (eeprom->len == 0) in ixgbe_get_eeprom()
1010 return -EINVAL; in ixgbe_get_eeprom()
1012 eeprom->magic = hw->vendor_id | (hw->device_id << 16); in ixgbe_get_eeprom()
1014 first_word = eeprom->offset >> 1; in ixgbe_get_eeprom()
1015 last_word = (eeprom->offset + eeprom->len - 1) >> 1; in ixgbe_get_eeprom()
1016 eeprom_len = last_word - first_word + 1; in ixgbe_get_eeprom()
1020 return -ENOMEM; in ixgbe_get_eeprom()
1022 ret_val = hw->eeprom.ops.read_buffer(hw, first_word, eeprom_len, in ixgbe_get_eeprom()
1025 /* Device's eeprom is always little-endian, word addressable */ in ixgbe_get_eeprom()
1029 memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 1), eeprom->len); in ixgbe_get_eeprom()
1039 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_eeprom() local
1045 if (eeprom->len == 0) in ixgbe_set_eeprom()
1046 return -EINVAL; in ixgbe_set_eeprom()
1048 if (eeprom->magic != (hw->vendor_id | (hw->device_id << 16))) in ixgbe_set_eeprom()
1049 return -EINVAL; in ixgbe_set_eeprom()
1051 max_len = hw->eeprom.word_size * 2; in ixgbe_set_eeprom()
1053 first_word = eeprom->offset >> 1; in ixgbe_set_eeprom()
1054 last_word = (eeprom->offset + eeprom->len - 1) >> 1; in ixgbe_set_eeprom()
1057 return -ENOMEM; in ixgbe_set_eeprom()
1061 if (eeprom->offset & 1) { in ixgbe_set_eeprom()
1066 ret_val = hw->eeprom.ops.read(hw, first_word, &eeprom_buff[0]); in ixgbe_set_eeprom()
1072 if ((eeprom->offset + eeprom->len) & 1) { in ixgbe_set_eeprom()
1077 ret_val = hw->eeprom.ops.read(hw, last_word, in ixgbe_set_eeprom()
1078 &eeprom_buff[last_word - first_word]); in ixgbe_set_eeprom()
1083 /* Device's eeprom is always little-endian, word addressable */ in ixgbe_set_eeprom()
1084 for (i = 0; i < last_word - first_word + 1; i++) in ixgbe_set_eeprom()
1087 memcpy(ptr, bytes, eeprom->len); in ixgbe_set_eeprom()
1089 for (i = 0; i < last_word - first_word + 1; i++) in ixgbe_set_eeprom()
1092 ret_val = hw->eeprom.ops.write_buffer(hw, first_word, in ixgbe_set_eeprom()
1093 last_word - first_word + 1, in ixgbe_set_eeprom()
1098 hw->eeprom.ops.update_checksum(hw); in ixgbe_set_eeprom()
1110 strlcpy(drvinfo->driver, ixgbe_driver_name, sizeof(drvinfo->driver)); in ixgbe_get_drvinfo()
1112 strlcpy(drvinfo->fw_version, adapter->eeprom_id, in ixgbe_get_drvinfo()
1113 sizeof(drvinfo->fw_version)); in ixgbe_get_drvinfo()
1115 strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), in ixgbe_get_drvinfo()
1116 sizeof(drvinfo->bus_info)); in ixgbe_get_drvinfo()
1118 drvinfo->n_priv_flags = IXGBE_PRIV_FLAGS_STR_LEN; in ixgbe_get_drvinfo()
1125 struct ixgbe_ring *tx_ring = adapter->tx_ring[0]; in ixgbe_get_ringparam()
1126 struct ixgbe_ring *rx_ring = adapter->rx_ring[0]; in ixgbe_get_ringparam()
1128 ring->rx_max_pending = IXGBE_MAX_RXD; in ixgbe_get_ringparam()
1129 ring->tx_max_pending = IXGBE_MAX_TXD; in ixgbe_get_ringparam()
1130 ring->rx_pending = rx_ring->count; in ixgbe_get_ringparam()
1131 ring->tx_pending = tx_ring->count; in ixgbe_get_ringparam()
1142 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) in ixgbe_set_ringparam()
1143 return -EINVAL; in ixgbe_set_ringparam()
1145 new_tx_count = clamp_t(u32, ring->tx_pending, in ixgbe_set_ringparam()
1149 new_rx_count = clamp_t(u32, ring->rx_pending, in ixgbe_set_ringparam()
1153 if ((new_tx_count == adapter->tx_ring_count) && in ixgbe_set_ringparam()
1154 (new_rx_count == adapter->rx_ring_count)) { in ixgbe_set_ringparam()
1159 while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state)) in ixgbe_set_ringparam()
1162 if (!netif_running(adapter->netdev)) { in ixgbe_set_ringparam()
1163 for (i = 0; i < adapter->num_tx_queues; i++) in ixgbe_set_ringparam()
1164 adapter->tx_ring[i]->count = new_tx_count; in ixgbe_set_ringparam()
1165 for (i = 0; i < adapter->num_xdp_queues; i++) in ixgbe_set_ringparam()
1166 adapter->xdp_ring[i]->count = new_tx_count; in ixgbe_set_ringparam()
1167 for (i = 0; i < adapter->num_rx_queues; i++) in ixgbe_set_ringparam()
1168 adapter->rx_ring[i]->count = new_rx_count; in ixgbe_set_ringparam()
1169 adapter->tx_ring_count = new_tx_count; in ixgbe_set_ringparam()
1170 adapter->xdp_ring_count = new_tx_count; in ixgbe_set_ringparam()
1171 adapter->rx_ring_count = new_rx_count; in ixgbe_set_ringparam()
1176 i = max_t(int, adapter->num_tx_queues + adapter->num_xdp_queues, in ixgbe_set_ringparam()
1177 adapter->num_rx_queues); in ixgbe_set_ringparam()
1181 err = -ENOMEM; in ixgbe_set_ringparam()
1193 if (new_tx_count != adapter->tx_ring_count) { in ixgbe_set_ringparam()
1194 for (i = 0; i < adapter->num_tx_queues; i++) { in ixgbe_set_ringparam()
1195 memcpy(&temp_ring[i], adapter->tx_ring[i], in ixgbe_set_ringparam()
1202 i--; in ixgbe_set_ringparam()
1209 for (j = 0; j < adapter->num_xdp_queues; j++, i++) { in ixgbe_set_ringparam()
1210 memcpy(&temp_ring[i], adapter->xdp_ring[j], in ixgbe_set_ringparam()
1217 i--; in ixgbe_set_ringparam()
1224 for (i = 0; i < adapter->num_tx_queues; i++) { in ixgbe_set_ringparam()
1225 ixgbe_free_tx_resources(adapter->tx_ring[i]); in ixgbe_set_ringparam()
1227 memcpy(adapter->tx_ring[i], &temp_ring[i], in ixgbe_set_ringparam()
1230 for (j = 0; j < adapter->num_xdp_queues; j++, i++) { in ixgbe_set_ringparam()
1231 ixgbe_free_tx_resources(adapter->xdp_ring[j]); in ixgbe_set_ringparam()
1233 memcpy(adapter->xdp_ring[j], &temp_ring[i], in ixgbe_set_ringparam()
1237 adapter->tx_ring_count = new_tx_count; in ixgbe_set_ringparam()
1241 if (new_rx_count != adapter->rx_ring_count) { in ixgbe_set_ringparam()
1242 for (i = 0; i < adapter->num_rx_queues; i++) { in ixgbe_set_ringparam()
1243 memcpy(&temp_ring[i], adapter->rx_ring[i], in ixgbe_set_ringparam()
1246 /* Clear copied XDP RX-queue info */ in ixgbe_set_ringparam()
1254 i--; in ixgbe_set_ringparam()
1262 for (i = 0; i < adapter->num_rx_queues; i++) { in ixgbe_set_ringparam()
1263 ixgbe_free_rx_resources(adapter->rx_ring[i]); in ixgbe_set_ringparam()
1265 memcpy(adapter->rx_ring[i], &temp_ring[i], in ixgbe_set_ringparam()
1269 adapter->rx_ring_count = new_rx_count; in ixgbe_set_ringparam()
1276 clear_bit(__IXGBE_RESETTING, &adapter->state); in ixgbe_set_ringparam()
1290 return -EOPNOTSUPP; in ixgbe_get_sset_count()
1325 for (j = 0; j < netdev->num_tx_queues; j++) { in ixgbe_get_ethtool_stats()
1326 ring = adapter->tx_ring[j]; in ixgbe_get_ethtool_stats()
1335 start = u64_stats_fetch_begin_irq(&ring->syncp); in ixgbe_get_ethtool_stats()
1336 data[i] = ring->stats.packets; in ixgbe_get_ethtool_stats()
1337 data[i+1] = ring->stats.bytes; in ixgbe_get_ethtool_stats()
1338 } while (u64_stats_fetch_retry_irq(&ring->syncp, start)); in ixgbe_get_ethtool_stats()
1342 ring = adapter->rx_ring[j]; in ixgbe_get_ethtool_stats()
1351 start = u64_stats_fetch_begin_irq(&ring->syncp); in ixgbe_get_ethtool_stats()
1352 data[i] = ring->stats.packets; in ixgbe_get_ethtool_stats()
1353 data[i+1] = ring->stats.bytes; in ixgbe_get_ethtool_stats()
1354 } while (u64_stats_fetch_retry_irq(&ring->syncp, start)); in ixgbe_get_ethtool_stats()
1359 data[i++] = adapter->stats.pxontxc[j]; in ixgbe_get_ethtool_stats()
1360 data[i++] = adapter->stats.pxofftxc[j]; in ixgbe_get_ethtool_stats()
1363 data[i++] = adapter->stats.pxonrxc[j]; in ixgbe_get_ethtool_stats()
1364 data[i++] = adapter->stats.pxoffrxc[j]; in ixgbe_get_ethtool_stats()
1383 for (i = 0; i < netdev->num_tx_queues; i++) { in ixgbe_get_strings()
1399 /* BUG_ON(p - data != IXGBE_STATS_LEN * ETH_GSTRING_LEN); */ in ixgbe_get_strings()
1409 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_link_test() local
1413 if (ixgbe_removed(hw->hw_addr)) { in ixgbe_link_test()
1419 hw->mac.ops.check_link(hw, &link_speed, &link_up, true); in ixgbe_link_test()
1439 * as a single-element array) and special-case the tables.
1443 * registers to be written without any read-back testing.
1488 /* RDH is read-only for 82598, only test RDT. */
1512 if (ixgbe_removed(adapter->hw.hw_addr)) { in reg_pattern_test()
1517 before = ixgbe_read_reg(&adapter->hw, reg); in reg_pattern_test()
1518 ixgbe_write_reg(&adapter->hw, reg, test_pattern[pat] & write); in reg_pattern_test()
1519 val = ixgbe_read_reg(&adapter->hw, reg); in reg_pattern_test()
1524 ixgbe_write_reg(&adapter->hw, reg, before); in reg_pattern_test()
1527 ixgbe_write_reg(&adapter->hw, reg, before); in reg_pattern_test()
1537 if (ixgbe_removed(adapter->hw.hw_addr)) { in reg_set_and_check()
1541 before = ixgbe_read_reg(&adapter->hw, reg); in reg_set_and_check()
1542 ixgbe_write_reg(&adapter->hw, reg, write & mask); in reg_set_and_check()
1543 val = ixgbe_read_reg(&adapter->hw, reg); in reg_set_and_check()
1548 ixgbe_write_reg(&adapter->hw, reg, before); in reg_set_and_check()
1551 ixgbe_write_reg(&adapter->hw, reg, before); in reg_set_and_check()
1561 if (ixgbe_removed(adapter->hw.hw_addr)) { in ixgbe_reg_test()
1562 e_err(drv, "Adapter removed - register test blocked\n"); in ixgbe_reg_test()
1566 switch (adapter->hw.mac.type) { in ixgbe_reg_test()
1587 * tests. Some bits are read-only, some toggle, and some in ixgbe_reg_test()
1590 before = ixgbe_read_reg(&adapter->hw, IXGBE_STATUS); in ixgbe_reg_test()
1591 value = (ixgbe_read_reg(&adapter->hw, IXGBE_STATUS) & toggle); in ixgbe_reg_test()
1592 ixgbe_write_reg(&adapter->hw, IXGBE_STATUS, toggle); in ixgbe_reg_test()
1593 after = ixgbe_read_reg(&adapter->hw, IXGBE_STATUS) & toggle; in ixgbe_reg_test()
1601 ixgbe_write_reg(&adapter->hw, IXGBE_STATUS, before); in ixgbe_reg_test()
1607 while (test->reg) { in ixgbe_reg_test()
1608 for (i = 0; i < test->array_len; i++) { in ixgbe_reg_test()
1611 switch (test->test_type) { in ixgbe_reg_test()
1614 test->reg + (i * 0x40), in ixgbe_reg_test()
1615 test->mask, in ixgbe_reg_test()
1616 test->write); in ixgbe_reg_test()
1620 test->reg + (i * 0x40), in ixgbe_reg_test()
1621 test->mask, in ixgbe_reg_test()
1622 test->write); in ixgbe_reg_test()
1625 ixgbe_write_reg(&adapter->hw, in ixgbe_reg_test()
1626 test->reg + (i * 0x40), in ixgbe_reg_test()
1627 test->write); in ixgbe_reg_test()
1631 test->reg + (i * 4), in ixgbe_reg_test()
1632 test->mask, in ixgbe_reg_test()
1633 test->write); in ixgbe_reg_test()
1637 test->reg + (i * 8), in ixgbe_reg_test()
1638 test->mask, in ixgbe_reg_test()
1639 test->write); in ixgbe_reg_test()
1643 (test->reg + 4) + (i * 8), in ixgbe_reg_test()
1644 test->mask, in ixgbe_reg_test()
1645 test->write); in ixgbe_reg_test()
1660 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_eeprom_test() local
1661 if (hw->eeprom.ops.validate_checksum(hw, NULL)) in ixgbe_eeprom_test()
1673 adapter->test_icr |= IXGBE_READ_REG(&adapter->hw, IXGBE_EICR); in ixgbe_test_intr()
1680 struct net_device *netdev = adapter->netdev; in ixgbe_intr_test()
1682 u32 irq = adapter->pdev->irq; in ixgbe_intr_test()
1687 if (adapter->msix_entries) { in ixgbe_intr_test()
1688 /* NOTE: we don't test MSI-X interrupts here, yet */ in ixgbe_intr_test()
1690 } else if (adapter->flags & IXGBE_FLAG_MSI_ENABLED) { in ixgbe_intr_test()
1692 if (request_irq(irq, ixgbe_test_intr, 0, netdev->name, in ixgbe_intr_test()
1695 return -1; in ixgbe_intr_test()
1698 netdev->name, netdev)) { in ixgbe_intr_test()
1701 netdev->name, netdev)) { in ixgbe_intr_test()
1703 return -1; in ixgbe_intr_test()
1705 e_info(hw, "testing %s interrupt\n", shared_int ? in ixgbe_intr_test()
1709 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, 0xFFFFFFFF); in ixgbe_intr_test()
1710 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_intr_test()
1726 adapter->test_icr = 0; in ixgbe_intr_test()
1727 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, in ixgbe_intr_test()
1729 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, in ixgbe_intr_test()
1731 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_intr_test()
1734 if (adapter->test_icr & mask) { in ixgbe_intr_test()
1746 adapter->test_icr = 0; in ixgbe_intr_test()
1747 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, mask); in ixgbe_intr_test()
1748 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, mask); in ixgbe_intr_test()
1749 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_intr_test()
1752 if (!(adapter->test_icr & mask)) { in ixgbe_intr_test()
1765 adapter->test_icr = 0; in ixgbe_intr_test()
1766 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, in ixgbe_intr_test()
1768 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, in ixgbe_intr_test()
1770 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_intr_test()
1773 if (adapter->test_icr) { in ixgbe_intr_test()
1781 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, 0xFFFFFFFF); in ixgbe_intr_test()
1782 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_intr_test()
1807 ixgbe_free_tx_resources(&adapter->test_tx_ring); in ixgbe_free_desc_rings()
1808 ixgbe_free_rx_resources(&adapter->test_rx_ring); in ixgbe_free_desc_rings()
1813 struct ixgbe_ring *tx_ring = &adapter->test_tx_ring; in ixgbe_setup_desc_rings()
1814 struct ixgbe_ring *rx_ring = &adapter->test_rx_ring; in ixgbe_setup_desc_rings()
1815 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_setup_desc_rings() local
1821 tx_ring->count = IXGBE_DEFAULT_TXD; in ixgbe_setup_desc_rings()
1822 tx_ring->queue_index = 0; in ixgbe_setup_desc_rings()
1823 tx_ring->dev = &adapter->pdev->dev; in ixgbe_setup_desc_rings()
1824 tx_ring->netdev = adapter->netdev; in ixgbe_setup_desc_rings()
1825 tx_ring->reg_idx = adapter->tx_ring[0]->reg_idx; in ixgbe_setup_desc_rings()
1831 switch (adapter->hw.mac.type) { in ixgbe_setup_desc_rings()
1837 reg_data = IXGBE_READ_REG(&adapter->hw, IXGBE_DMATXCTL); in ixgbe_setup_desc_rings()
1839 IXGBE_WRITE_REG(&adapter->hw, IXGBE_DMATXCTL, reg_data); in ixgbe_setup_desc_rings()
1848 rx_ring->count = IXGBE_DEFAULT_RXD; in ixgbe_setup_desc_rings()
1849 rx_ring->queue_index = 0; in ixgbe_setup_desc_rings()
1850 rx_ring->dev = &adapter->pdev->dev; in ixgbe_setup_desc_rings()
1851 rx_ring->netdev = adapter->netdev; in ixgbe_setup_desc_rings()
1852 rx_ring->reg_idx = adapter->rx_ring[0]->reg_idx; in ixgbe_setup_desc_rings()
1860 hw->mac.ops.disable_rx(hw); in ixgbe_setup_desc_rings()
1864 rctl = IXGBE_READ_REG(&adapter->hw, IXGBE_RXCTRL); in ixgbe_setup_desc_rings()
1866 IXGBE_WRITE_REG(&adapter->hw, IXGBE_RXCTRL, rctl); in ixgbe_setup_desc_rings()
1868 hw->mac.ops.enable_rx(hw); in ixgbe_setup_desc_rings()
1879 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_setup_loopback_test() local
1884 reg_data = IXGBE_READ_REG(hw, IXGBE_HLREG0); in ixgbe_setup_loopback_test()
1886 IXGBE_WRITE_REG(hw, IXGBE_HLREG0, reg_data); in ixgbe_setup_loopback_test()
1888 reg_data = IXGBE_READ_REG(hw, IXGBE_FCTRL); in ixgbe_setup_loopback_test()
1890 IXGBE_WRITE_REG(hw, IXGBE_FCTRL, reg_data); in ixgbe_setup_loopback_test()
1893 switch (adapter->hw.mac.type) { in ixgbe_setup_loopback_test()
1898 reg_data = IXGBE_READ_REG(hw, IXGBE_MACC); in ixgbe_setup_loopback_test()
1900 IXGBE_WRITE_REG(hw, IXGBE_MACC, reg_data); in ixgbe_setup_loopback_test()
1903 if (hw->mac.orig_autoc) { in ixgbe_setup_loopback_test()
1904 reg_data = hw->mac.orig_autoc | IXGBE_AUTOC_FLU; in ixgbe_setup_loopback_test()
1905 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, reg_data); in ixgbe_setup_loopback_test()
1910 IXGBE_WRITE_FLUSH(hw); in ixgbe_setup_loopback_test()
1913 /* Disable Atlas Tx lanes; re-enabled in reset path */ in ixgbe_setup_loopback_test()
1914 if (hw->mac.type == ixgbe_mac_82598EB) { in ixgbe_setup_loopback_test()
1917 hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_LPBK, &atlas); in ixgbe_setup_loopback_test()
1919 hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_LPBK, atlas); in ixgbe_setup_loopback_test()
1921 hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_10G, &atlas); in ixgbe_setup_loopback_test()
1923 hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_10G, atlas); in ixgbe_setup_loopback_test()
1925 hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_1G, &atlas); in ixgbe_setup_loopback_test()
1927 hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_1G, atlas); in ixgbe_setup_loopback_test()
1929 hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_AN, &atlas); in ixgbe_setup_loopback_test()
1931 hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_AN, atlas); in ixgbe_setup_loopback_test()
1941 reg_data = IXGBE_READ_REG(&adapter->hw, IXGBE_HLREG0); in ixgbe_loopback_cleanup()
1943 IXGBE_WRITE_REG(&adapter->hw, IXGBE_HLREG0, reg_data); in ixgbe_loopback_cleanup()
1949 memset(skb->data, 0xFF, frame_size); in ixgbe_create_lbtest_frame()
1951 memset(&skb->data[frame_size], 0xAA, frame_size / 2 - 1); in ixgbe_create_lbtest_frame()
1952 skb->data[frame_size + 10] = 0xBE; in ixgbe_create_lbtest_frame()
1953 skb->data[frame_size + 12] = 0xAF; in ixgbe_create_lbtest_frame()
1964 data = kmap(rx_buffer->page) + rx_buffer->page_offset; in ixgbe_check_lbtest_frame()
1971 kunmap(rx_buffer->page); in ixgbe_check_lbtest_frame()
1984 rx_ntc = rx_ring->next_to_clean; in ixgbe_clean_test_rings()
1985 tx_ntc = tx_ring->next_to_clean; in ixgbe_clean_test_rings()
1988 while (tx_ntc != tx_ring->next_to_use) { in ixgbe_clean_test_rings()
1995 if (!(tx_desc->wb.status & cpu_to_le32(IXGBE_TXD_STAT_DD))) in ixgbe_clean_test_rings()
1999 tx_buffer = &tx_ring->tx_buffer_info[tx_ntc]; in ixgbe_clean_test_rings()
2002 dev_kfree_skb_any(tx_buffer->skb); in ixgbe_clean_test_rings()
2005 dma_unmap_single(tx_ring->dev, in ixgbe_clean_test_rings()
2013 if (tx_ntc == tx_ring->count) in ixgbe_clean_test_rings()
2017 while (rx_desc->wb.upper.length) { in ixgbe_clean_test_rings()
2021 rx_buffer = &rx_ring->rx_buffer_info[rx_ntc]; in ixgbe_clean_test_rings()
2024 dma_sync_single_for_cpu(rx_ring->dev, in ixgbe_clean_test_rings()
2025 rx_buffer->dma, in ixgbe_clean_test_rings()
2036 dma_sync_single_for_device(rx_ring->dev, in ixgbe_clean_test_rings()
2037 rx_buffer->dma, in ixgbe_clean_test_rings()
2043 if (rx_ntc == rx_ring->count) in ixgbe_clean_test_rings()
2052 /* re-map buffers to ring, store next to clean values */ in ixgbe_clean_test_rings()
2054 rx_ring->next_to_clean = rx_ntc; in ixgbe_clean_test_rings()
2055 tx_ring->next_to_clean = tx_ntc; in ixgbe_clean_test_rings()
2062 struct ixgbe_ring *tx_ring = &adapter->test_tx_ring; in ixgbe_run_loopback_test()
2063 struct ixgbe_ring *rx_ring = &adapter->test_rx_ring; in ixgbe_run_loopback_test()
2068 u32 flags_orig = adapter->flags; in ixgbe_run_loopback_test()
2071 adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED; in ixgbe_run_loopback_test()
2088 if (rx_ring->count <= tx_ring->count) in ixgbe_run_loopback_test()
2089 lc = ((tx_ring->count / 64) * 2) + 1; in ixgbe_run_loopback_test()
2091 lc = ((rx_ring->count / 64) * 2) + 1; in ixgbe_run_loopback_test()
2124 adapter->flags = flags_orig; in ixgbe_run_loopback_test()
2152 if (ixgbe_removed(adapter->hw.hw_addr)) { in ixgbe_diag_test()
2153 e_err(hw, "Adapter removed - test blocked\n"); in ixgbe_diag_test()
2159 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2162 set_bit(__IXGBE_TESTING, &adapter->state); in ixgbe_diag_test()
2163 if (eth_test->flags == ETH_TEST_FL_OFFLINE) { in ixgbe_diag_test()
2164 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_diag_test() local
2166 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) { in ixgbe_diag_test()
2168 for (i = 0; i < adapter->num_vfs; i++) { in ixgbe_diag_test()
2169 if (adapter->vfinfo[i].clear_to_send) { in ixgbe_diag_test()
2170 netdev_warn(netdev, "offline diagnostic is not supported when VFs are present\n"); in ixgbe_diag_test()
2176 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2178 &adapter->state); in ixgbe_diag_test()
2185 e_info(hw, "offline testing starting\n"); in ixgbe_diag_test()
2191 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2199 e_info(hw, "register testing starting\n"); in ixgbe_diag_test()
2201 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2204 e_info(hw, "eeprom testing starting\n"); in ixgbe_diag_test()
2206 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2209 e_info(hw, "interrupt testing starting\n"); in ixgbe_diag_test()
2211 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2215 if (adapter->flags & (IXGBE_FLAG_SRIOV_ENABLED | in ixgbe_diag_test()
2217 e_info(hw, "Skip MAC loopback diagnostic in VT mode\n"); in ixgbe_diag_test()
2223 e_info(hw, "loopback testing starting\n"); in ixgbe_diag_test()
2225 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2231 clear_bit(__IXGBE_TESTING, &adapter->state); in ixgbe_diag_test()
2234 else if (hw->mac.ops.disable_tx_laser) in ixgbe_diag_test()
2235 hw->mac.ops.disable_tx_laser(hw); in ixgbe_diag_test()
2237 e_info(hw, "online testing starting\n"); in ixgbe_diag_test()
2241 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2249 clear_bit(__IXGBE_TESTING, &adapter->state); in ixgbe_diag_test()
2256 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_wol_exclusion() local
2259 /* WOL not supported for all devices */ in ixgbe_wol_exclusion()
2260 if (!ixgbe_wol_supported(adapter, hw->device_id, in ixgbe_wol_exclusion()
2261 hw->subsystem_device_id)) { in ixgbe_wol_exclusion()
2263 wol->supported = 0; in ixgbe_wol_exclusion()
2274 wol->supported = WAKE_UCAST | WAKE_MCAST | in ixgbe_get_wol()
2276 wol->wolopts = 0; in ixgbe_get_wol()
2279 !device_can_wakeup(&adapter->pdev->dev)) in ixgbe_get_wol()
2282 if (adapter->wol & IXGBE_WUFC_EX) in ixgbe_get_wol()
2283 wol->wolopts |= WAKE_UCAST; in ixgbe_get_wol()
2284 if (adapter->wol & IXGBE_WUFC_MC) in ixgbe_get_wol()
2285 wol->wolopts |= WAKE_MCAST; in ixgbe_get_wol()
2286 if (adapter->wol & IXGBE_WUFC_BC) in ixgbe_get_wol()
2287 wol->wolopts |= WAKE_BCAST; in ixgbe_get_wol()
2288 if (adapter->wol & IXGBE_WUFC_MAG) in ixgbe_get_wol()
2289 wol->wolopts |= WAKE_MAGIC; in ixgbe_get_wol()
2296 if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE | in ixgbe_set_wol()
2298 return -EOPNOTSUPP; in ixgbe_set_wol()
2301 return wol->wolopts ? -EOPNOTSUPP : 0; in ixgbe_set_wol()
2303 adapter->wol = 0; in ixgbe_set_wol()
2305 if (wol->wolopts & WAKE_UCAST) in ixgbe_set_wol()
2306 adapter->wol |= IXGBE_WUFC_EX; in ixgbe_set_wol()
2307 if (wol->wolopts & WAKE_MCAST) in ixgbe_set_wol()
2308 adapter->wol |= IXGBE_WUFC_MC; in ixgbe_set_wol()
2309 if (wol->wolopts & WAKE_BCAST) in ixgbe_set_wol()
2310 adapter->wol |= IXGBE_WUFC_BC; in ixgbe_set_wol()
2311 if (wol->wolopts & WAKE_MAGIC) in ixgbe_set_wol()
2312 adapter->wol |= IXGBE_WUFC_MAG; in ixgbe_set_wol()
2314 device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); in ixgbe_set_wol()
2333 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_phys_id() local
2335 if (!hw->mac.ops.led_on || !hw->mac.ops.led_off) in ixgbe_set_phys_id()
2336 return -EOPNOTSUPP; in ixgbe_set_phys_id()
2340 adapter->led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); in ixgbe_set_phys_id()
2344 hw->mac.ops.led_on(hw, hw->mac.led_link_act); in ixgbe_set_phys_id()
2348 hw->mac.ops.led_off(hw, hw->mac.led_link_act); in ixgbe_set_phys_id()
2353 IXGBE_WRITE_REG(&adapter->hw, IXGBE_LEDCTL, adapter->led_reg); in ixgbe_set_phys_id()
2368 if (adapter->rx_itr_setting <= 1) in ixgbe_get_coalesce()
2369 ec->rx_coalesce_usecs = adapter->rx_itr_setting; in ixgbe_get_coalesce()
2371 ec->rx_coalesce_usecs = adapter->rx_itr_setting >> 2; in ixgbe_get_coalesce()
2374 if (adapter->q_vector[0]->tx.count && adapter->q_vector[0]->rx.count) in ixgbe_get_coalesce()
2378 if (adapter->tx_itr_setting <= 1) in ixgbe_get_coalesce()
2379 ec->tx_coalesce_usecs = adapter->tx_itr_setting; in ixgbe_get_coalesce()
2381 ec->tx_coalesce_usecs = adapter->tx_itr_setting >> 2; in ixgbe_get_coalesce()
2392 struct net_device *netdev = adapter->netdev; in ixgbe_update_rsc()
2395 if (!(adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE) || in ixgbe_update_rsc()
2396 !(netdev->features & NETIF_F_LRO)) in ixgbe_update_rsc()
2400 if (adapter->rx_itr_setting == 1 || in ixgbe_update_rsc()
2401 adapter->rx_itr_setting > IXGBE_MIN_RSC_ITR) { in ixgbe_update_rsc()
2402 if (!(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED)) { in ixgbe_update_rsc()
2403 adapter->flags2 |= IXGBE_FLAG2_RSC_ENABLED; in ixgbe_update_rsc()
2404 e_info(probe, "rx-usecs value high enough to re-enable RSC\n"); in ixgbe_update_rsc()
2408 } else if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { in ixgbe_update_rsc()
2409 adapter->flags2 &= ~IXGBE_FLAG2_RSC_ENABLED; in ixgbe_update_rsc()
2410 e_info(probe, "rx-usecs set too low, disabling RSC\n"); in ixgbe_update_rsc()
2427 if (adapter->q_vector[0]->tx.count && adapter->q_vector[0]->rx.count) { in ixgbe_set_coalesce()
2429 if (ec->tx_coalesce_usecs) in ixgbe_set_coalesce()
2430 return -EINVAL; in ixgbe_set_coalesce()
2431 tx_itr_prev = adapter->rx_itr_setting; in ixgbe_set_coalesce()
2433 tx_itr_prev = adapter->tx_itr_setting; in ixgbe_set_coalesce()
2436 if ((ec->rx_coalesce_usecs > (IXGBE_MAX_EITR >> 2)) || in ixgbe_set_coalesce()
2437 (ec->tx_coalesce_usecs > (IXGBE_MAX_EITR >> 2))) in ixgbe_set_coalesce()
2438 return -EINVAL; in ixgbe_set_coalesce()
2440 if (ec->rx_coalesce_usecs > 1) in ixgbe_set_coalesce()
2441 adapter->rx_itr_setting = ec->rx_coalesce_usecs << 2; in ixgbe_set_coalesce()
2443 adapter->rx_itr_setting = ec->rx_coalesce_usecs; in ixgbe_set_coalesce()
2445 if (adapter->rx_itr_setting == 1) in ixgbe_set_coalesce()
2448 rx_itr_param = adapter->rx_itr_setting; in ixgbe_set_coalesce()
2450 if (ec->tx_coalesce_usecs > 1) in ixgbe_set_coalesce()
2451 adapter->tx_itr_setting = ec->tx_coalesce_usecs << 2; in ixgbe_set_coalesce()
2453 adapter->tx_itr_setting = ec->tx_coalesce_usecs; in ixgbe_set_coalesce()
2455 if (adapter->tx_itr_setting == 1) in ixgbe_set_coalesce()
2458 tx_itr_param = adapter->tx_itr_setting; in ixgbe_set_coalesce()
2461 if (adapter->q_vector[0]->tx.count && adapter->q_vector[0]->rx.count) in ixgbe_set_coalesce()
2462 adapter->tx_itr_setting = adapter->rx_itr_setting; in ixgbe_set_coalesce()
2465 if ((adapter->tx_itr_setting != 1) && in ixgbe_set_coalesce()
2466 (adapter->tx_itr_setting < IXGBE_100K_ITR)) { in ixgbe_set_coalesce()
2479 for (i = 0; i < adapter->num_q_vectors; i++) { in ixgbe_set_coalesce()
2480 q_vector = adapter->q_vector[i]; in ixgbe_set_coalesce()
2481 if (q_vector->tx.count && !q_vector->rx.count) in ixgbe_set_coalesce()
2483 q_vector->itr = tx_itr_param; in ixgbe_set_coalesce()
2486 q_vector->itr = rx_itr_param; in ixgbe_set_coalesce()
2504 union ixgbe_atr_input *mask = &adapter->fdir_mask; in ixgbe_get_ethtool_fdir_entry()
2506 (struct ethtool_rx_flow_spec *)&cmd->fs; in ixgbe_get_ethtool_fdir_entry()
2511 cmd->data = (1024 << adapter->fdir_pballoc) - 2; in ixgbe_get_ethtool_fdir_entry()
2514 &adapter->fdir_filter_list, fdir_node) { in ixgbe_get_ethtool_fdir_entry()
2515 if (fsp->location <= rule->sw_idx) in ixgbe_get_ethtool_fdir_entry()
2519 if (!rule || fsp->location != rule->sw_idx) in ixgbe_get_ethtool_fdir_entry()
2520 return -EINVAL; in ixgbe_get_ethtool_fdir_entry()
2525 switch (rule->filter.formatted.flow_type) { in ixgbe_get_ethtool_fdir_entry()
2527 fsp->flow_type = TCP_V4_FLOW; in ixgbe_get_ethtool_fdir_entry()
2530 fsp->flow_type = UDP_V4_FLOW; in ixgbe_get_ethtool_fdir_entry()
2533 fsp->flow_type = SCTP_V4_FLOW; in ixgbe_get_ethtool_fdir_entry()
2536 fsp->flow_type = IP_USER_FLOW; in ixgbe_get_ethtool_fdir_entry()
2537 fsp->h_u.usr_ip4_spec.ip_ver = ETH_RX_NFC_IP4; in ixgbe_get_ethtool_fdir_entry()
2538 fsp->h_u.usr_ip4_spec.proto = 0; in ixgbe_get_ethtool_fdir_entry()
2539 fsp->m_u.usr_ip4_spec.proto = 0; in ixgbe_get_ethtool_fdir_entry()
2542 return -EINVAL; in ixgbe_get_ethtool_fdir_entry()
2545 fsp->h_u.tcp_ip4_spec.psrc = rule->filter.formatted.src_port; in ixgbe_get_ethtool_fdir_entry()
2546 fsp->m_u.tcp_ip4_spec.psrc = mask->formatted.src_port; in ixgbe_get_ethtool_fdir_entry()
2547 fsp->h_u.tcp_ip4_spec.pdst = rule->filter.formatted.dst_port; in ixgbe_get_ethtool_fdir_entry()
2548 fsp->m_u.tcp_ip4_spec.pdst = mask->formatted.dst_port; in ixgbe_get_ethtool_fdir_entry()
2549 fsp->h_u.tcp_ip4_spec.ip4src = rule->filter.formatted.src_ip[0]; in ixgbe_get_ethtool_fdir_entry()
2550 fsp->m_u.tcp_ip4_spec.ip4src = mask->formatted.src_ip[0]; in ixgbe_get_ethtool_fdir_entry()
2551 fsp->h_u.tcp_ip4_spec.ip4dst = rule->filter.formatted.dst_ip[0]; in ixgbe_get_ethtool_fdir_entry()
2552 fsp->m_u.tcp_ip4_spec.ip4dst = mask->formatted.dst_ip[0]; in ixgbe_get_ethtool_fdir_entry()
2553 fsp->h_ext.vlan_tci = rule->filter.formatted.vlan_id; in ixgbe_get_ethtool_fdir_entry()
2554 fsp->m_ext.vlan_tci = mask->formatted.vlan_id; in ixgbe_get_ethtool_fdir_entry()
2555 fsp->h_ext.vlan_etype = rule->filter.formatted.flex_bytes; in ixgbe_get_ethtool_fdir_entry()
2556 fsp->m_ext.vlan_etype = mask->formatted.flex_bytes; in ixgbe_get_ethtool_fdir_entry()
2557 fsp->h_ext.data[1] = htonl(rule->filter.formatted.vm_pool); in ixgbe_get_ethtool_fdir_entry()
2558 fsp->m_ext.data[1] = htonl(mask->formatted.vm_pool); in ixgbe_get_ethtool_fdir_entry()
2559 fsp->flow_type |= FLOW_EXT; in ixgbe_get_ethtool_fdir_entry()
2562 if (rule->action == IXGBE_FDIR_DROP_QUEUE) in ixgbe_get_ethtool_fdir_entry()
2563 fsp->ring_cookie = RX_CLS_FLOW_DISC; in ixgbe_get_ethtool_fdir_entry()
2565 fsp->ring_cookie = rule->action; in ixgbe_get_ethtool_fdir_entry()
2579 cmd->data = (1024 << adapter->fdir_pballoc) - 2; in ixgbe_get_ethtool_fdir_all()
2582 &adapter->fdir_filter_list, fdir_node) { in ixgbe_get_ethtool_fdir_all()
2583 if (cnt == cmd->rule_cnt) in ixgbe_get_ethtool_fdir_all()
2584 return -EMSGSIZE; in ixgbe_get_ethtool_fdir_all()
2585 rule_locs[cnt] = rule->sw_idx; in ixgbe_get_ethtool_fdir_all()
2589 cmd->rule_cnt = cnt; in ixgbe_get_ethtool_fdir_all()
2597 cmd->data = 0; in ixgbe_get_rss_hash_opts()
2600 switch (cmd->flow_type) { in ixgbe_get_rss_hash_opts()
2602 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in ixgbe_get_rss_hash_opts()
2605 if (adapter->flags2 & IXGBE_FLAG2_RSS_FIELD_IPV4_UDP) in ixgbe_get_rss_hash_opts()
2606 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in ixgbe_get_rss_hash_opts()
2613 cmd->data |= RXH_IP_SRC | RXH_IP_DST; in ixgbe_get_rss_hash_opts()
2616 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in ixgbe_get_rss_hash_opts()
2619 if (adapter->flags2 & IXGBE_FLAG2_RSS_FIELD_IPV6_UDP) in ixgbe_get_rss_hash_opts()
2620 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in ixgbe_get_rss_hash_opts()
2627 cmd->data |= RXH_IP_SRC | RXH_IP_DST; in ixgbe_get_rss_hash_opts()
2630 return -EINVAL; in ixgbe_get_rss_hash_opts()
2640 int ret = -EOPNOTSUPP; in ixgbe_get_rxnfc()
2642 switch (cmd->cmd) { in ixgbe_get_rxnfc()
2644 cmd->data = adapter->num_rx_queues; in ixgbe_get_rxnfc()
2648 cmd->rule_cnt = adapter->fdir_filter_count; in ixgbe_get_rxnfc()
2671 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_update_ethtool_fdir_entry() local
2674 int err = -EINVAL; in ixgbe_update_ethtool_fdir_entry()
2680 &adapter->fdir_filter_list, fdir_node) { in ixgbe_update_ethtool_fdir_entry()
2682 if (rule->sw_idx >= sw_idx) in ixgbe_update_ethtool_fdir_entry()
2688 if (rule && (rule->sw_idx == sw_idx)) { in ixgbe_update_ethtool_fdir_entry()
2689 if (!input || (rule->filter.formatted.bkt_hash != in ixgbe_update_ethtool_fdir_entry()
2690 input->filter.formatted.bkt_hash)) { in ixgbe_update_ethtool_fdir_entry()
2691 err = ixgbe_fdir_erase_perfect_filter_82599(hw, in ixgbe_update_ethtool_fdir_entry()
2692 &rule->filter, in ixgbe_update_ethtool_fdir_entry()
2696 hlist_del(&rule->fdir_node); in ixgbe_update_ethtool_fdir_entry()
2698 adapter->fdir_filter_count--; in ixgbe_update_ethtool_fdir_entry()
2703 * successfully found and removed from the list else -EINVAL in ixgbe_update_ethtool_fdir_entry()
2709 INIT_HLIST_NODE(&input->fdir_node); in ixgbe_update_ethtool_fdir_entry()
2713 hlist_add_behind(&input->fdir_node, &parent->fdir_node); in ixgbe_update_ethtool_fdir_entry()
2715 hlist_add_head(&input->fdir_node, in ixgbe_update_ethtool_fdir_entry()
2716 &adapter->fdir_filter_list); in ixgbe_update_ethtool_fdir_entry()
2719 adapter->fdir_filter_count++; in ixgbe_update_ethtool_fdir_entry()
2727 switch (fsp->flow_type & ~FLOW_EXT) { in ixgbe_flowspec_to_flow_type()
2738 switch (fsp->h_u.usr_ip4_spec.proto) { in ixgbe_flowspec_to_flow_type()
2749 if (!fsp->m_u.usr_ip4_spec.proto) { in ixgbe_flowspec_to_flow_type()
2769 (struct ethtool_rx_flow_spec *)&cmd->fs; in ixgbe_add_ethtool_fdir_entry()
2770 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_add_ethtool_fdir_entry() local
2776 if (!(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) in ixgbe_add_ethtool_fdir_entry()
2777 return -EOPNOTSUPP; in ixgbe_add_ethtool_fdir_entry()
2782 if (fsp->ring_cookie == RX_CLS_FLOW_DISC) { in ixgbe_add_ethtool_fdir_entry()
2785 u32 ring = ethtool_get_flow_spec_ring(fsp->ring_cookie); in ixgbe_add_ethtool_fdir_entry()
2786 u8 vf = ethtool_get_flow_spec_ring_vf(fsp->ring_cookie); in ixgbe_add_ethtool_fdir_entry()
2788 if (!vf && (ring >= adapter->num_rx_queues)) in ixgbe_add_ethtool_fdir_entry()
2789 return -EINVAL; in ixgbe_add_ethtool_fdir_entry()
2791 ((vf > adapter->num_vfs) || in ixgbe_add_ethtool_fdir_entry()
2792 ring >= adapter->num_rx_queues_per_pool)) in ixgbe_add_ethtool_fdir_entry()
2793 return -EINVAL; in ixgbe_add_ethtool_fdir_entry()
2797 queue = adapter->rx_ring[ring]->reg_idx; in ixgbe_add_ethtool_fdir_entry()
2799 queue = ((vf - 1) * in ixgbe_add_ethtool_fdir_entry()
2800 adapter->num_rx_queues_per_pool) + ring; in ixgbe_add_ethtool_fdir_entry()
2804 if (fsp->location >= ((1024 << adapter->fdir_pballoc) - 2)) { in ixgbe_add_ethtool_fdir_entry()
2806 return -EINVAL; in ixgbe_add_ethtool_fdir_entry()
2811 return -ENOMEM; in ixgbe_add_ethtool_fdir_entry()
2816 input->sw_idx = fsp->location; in ixgbe_add_ethtool_fdir_entry()
2820 &input->filter.formatted.flow_type)) { in ixgbe_add_ethtool_fdir_entry()
2828 if (input->filter.formatted.flow_type == IXGBE_ATR_FLOW_TYPE_IPV4) in ixgbe_add_ethtool_fdir_entry()
2832 input->filter.formatted.src_ip[0] = fsp->h_u.tcp_ip4_spec.ip4src; in ixgbe_add_ethtool_fdir_entry()
2833 mask.formatted.src_ip[0] = fsp->m_u.tcp_ip4_spec.ip4src; in ixgbe_add_ethtool_fdir_entry()
2834 input->filter.formatted.dst_ip[0] = fsp->h_u.tcp_ip4_spec.ip4dst; in ixgbe_add_ethtool_fdir_entry()
2835 mask.formatted.dst_ip[0] = fsp->m_u.tcp_ip4_spec.ip4dst; in ixgbe_add_ethtool_fdir_entry()
2836 input->filter.formatted.src_port = fsp->h_u.tcp_ip4_spec.psrc; in ixgbe_add_ethtool_fdir_entry()
2837 mask.formatted.src_port = fsp->m_u.tcp_ip4_spec.psrc; in ixgbe_add_ethtool_fdir_entry()
2838 input->filter.formatted.dst_port = fsp->h_u.tcp_ip4_spec.pdst; in ixgbe_add_ethtool_fdir_entry()
2839 mask.formatted.dst_port = fsp->m_u.tcp_ip4_spec.pdst; in ixgbe_add_ethtool_fdir_entry()
2841 if (fsp->flow_type & FLOW_EXT) { in ixgbe_add_ethtool_fdir_entry()
2842 input->filter.formatted.vm_pool = in ixgbe_add_ethtool_fdir_entry()
2843 (unsigned char)ntohl(fsp->h_ext.data[1]); in ixgbe_add_ethtool_fdir_entry()
2845 (unsigned char)ntohl(fsp->m_ext.data[1]); in ixgbe_add_ethtool_fdir_entry()
2846 input->filter.formatted.vlan_id = fsp->h_ext.vlan_tci; in ixgbe_add_ethtool_fdir_entry()
2847 mask.formatted.vlan_id = fsp->m_ext.vlan_tci; in ixgbe_add_ethtool_fdir_entry()
2848 input->filter.formatted.flex_bytes = in ixgbe_add_ethtool_fdir_entry()
2849 fsp->h_ext.vlan_etype; in ixgbe_add_ethtool_fdir_entry()
2850 mask.formatted.flex_bytes = fsp->m_ext.vlan_etype; in ixgbe_add_ethtool_fdir_entry()
2854 if (fsp->ring_cookie == RX_CLS_FLOW_DISC) in ixgbe_add_ethtool_fdir_entry()
2855 input->action = IXGBE_FDIR_DROP_QUEUE; in ixgbe_add_ethtool_fdir_entry()
2857 input->action = fsp->ring_cookie; in ixgbe_add_ethtool_fdir_entry()
2859 spin_lock(&adapter->fdir_perfect_lock); in ixgbe_add_ethtool_fdir_entry()
2861 if (hlist_empty(&adapter->fdir_filter_list)) { in ixgbe_add_ethtool_fdir_entry()
2862 /* save mask and program input mask into HW */ in ixgbe_add_ethtool_fdir_entry()
2863 memcpy(&adapter->fdir_mask, &mask, sizeof(mask)); in ixgbe_add_ethtool_fdir_entry()
2864 err = ixgbe_fdir_set_input_mask_82599(hw, &mask); in ixgbe_add_ethtool_fdir_entry()
2869 } else if (memcmp(&adapter->fdir_mask, &mask, sizeof(mask))) { in ixgbe_add_ethtool_fdir_entry()
2870 e_err(drv, "Only one mask supported per port\n"); in ixgbe_add_ethtool_fdir_entry()
2875 ixgbe_atr_compute_perfect_hash_82599(&input->filter, &mask); in ixgbe_add_ethtool_fdir_entry()
2878 err = ixgbe_fdir_write_perfect_filter_82599(hw, in ixgbe_add_ethtool_fdir_entry()
2879 &input->filter, input->sw_idx, queue); in ixgbe_add_ethtool_fdir_entry()
2883 ixgbe_update_ethtool_fdir_entry(adapter, input, input->sw_idx); in ixgbe_add_ethtool_fdir_entry()
2885 spin_unlock(&adapter->fdir_perfect_lock); in ixgbe_add_ethtool_fdir_entry()
2889 spin_unlock(&adapter->fdir_perfect_lock); in ixgbe_add_ethtool_fdir_entry()
2892 return -EINVAL; in ixgbe_add_ethtool_fdir_entry()
2899 (struct ethtool_rx_flow_spec *)&cmd->fs; in ixgbe_del_ethtool_fdir_entry()
2902 spin_lock(&adapter->fdir_perfect_lock); in ixgbe_del_ethtool_fdir_entry()
2903 err = ixgbe_update_ethtool_fdir_entry(adapter, NULL, fsp->location); in ixgbe_del_ethtool_fdir_entry()
2904 spin_unlock(&adapter->fdir_perfect_lock); in ixgbe_del_ethtool_fdir_entry()
2914 u32 flags2 = adapter->flags2; in ixgbe_set_rss_hash_opt()
2920 if (nfc->data & ~(RXH_IP_SRC | RXH_IP_DST | in ixgbe_set_rss_hash_opt()
2922 return -EINVAL; in ixgbe_set_rss_hash_opt()
2924 switch (nfc->flow_type) { in ixgbe_set_rss_hash_opt()
2927 if (!(nfc->data & RXH_IP_SRC) || in ixgbe_set_rss_hash_opt()
2928 !(nfc->data & RXH_IP_DST) || in ixgbe_set_rss_hash_opt()
2929 !(nfc->data & RXH_L4_B_0_1) || in ixgbe_set_rss_hash_opt()
2930 !(nfc->data & RXH_L4_B_2_3)) in ixgbe_set_rss_hash_opt()
2931 return -EINVAL; in ixgbe_set_rss_hash_opt()
2934 if (!(nfc->data & RXH_IP_SRC) || in ixgbe_set_rss_hash_opt()
2935 !(nfc->data & RXH_IP_DST)) in ixgbe_set_rss_hash_opt()
2936 return -EINVAL; in ixgbe_set_rss_hash_opt()
2937 switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { in ixgbe_set_rss_hash_opt()
2945 return -EINVAL; in ixgbe_set_rss_hash_opt()
2949 if (!(nfc->data & RXH_IP_SRC) || in ixgbe_set_rss_hash_opt()
2950 !(nfc->data & RXH_IP_DST)) in ixgbe_set_rss_hash_opt()
2951 return -EINVAL; in ixgbe_set_rss_hash_opt()
2952 switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { in ixgbe_set_rss_hash_opt()
2960 return -EINVAL; in ixgbe_set_rss_hash_opt()
2971 if (!(nfc->data & RXH_IP_SRC) || in ixgbe_set_rss_hash_opt()
2972 !(nfc->data & RXH_IP_DST) || in ixgbe_set_rss_hash_opt()
2973 (nfc->data & RXH_L4_B_0_1) || in ixgbe_set_rss_hash_opt()
2974 (nfc->data & RXH_L4_B_2_3)) in ixgbe_set_rss_hash_opt()
2975 return -EINVAL; in ixgbe_set_rss_hash_opt()
2978 return -EINVAL; in ixgbe_set_rss_hash_opt()
2982 if (flags2 != adapter->flags2) { in ixgbe_set_rss_hash_opt()
2983 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_rss_hash_opt() local
2985 unsigned int pf_pool = adapter->num_vfs; in ixgbe_set_rss_hash_opt()
2987 if ((hw->mac.type >= ixgbe_mac_X550) && in ixgbe_set_rss_hash_opt()
2988 (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) in ixgbe_set_rss_hash_opt()
2989 mrqc = IXGBE_READ_REG(hw, IXGBE_PFVFMRQC(pf_pool)); in ixgbe_set_rss_hash_opt()
2991 mrqc = IXGBE_READ_REG(hw, IXGBE_MRQC); in ixgbe_set_rss_hash_opt()
2994 !(adapter->flags2 & UDP_RSS_FLAGS)) in ixgbe_set_rss_hash_opt()
2997 adapter->flags2 = flags2; in ixgbe_set_rss_hash_opt()
3014 if ((hw->mac.type >= ixgbe_mac_X550) && in ixgbe_set_rss_hash_opt()
3015 (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) in ixgbe_set_rss_hash_opt()
3016 IXGBE_WRITE_REG(hw, IXGBE_PFVFMRQC(pf_pool), mrqc); in ixgbe_set_rss_hash_opt()
3018 IXGBE_WRITE_REG(hw, IXGBE_MRQC, mrqc); in ixgbe_set_rss_hash_opt()
3027 int ret = -EOPNOTSUPP; in ixgbe_set_rxnfc()
3029 switch (cmd->cmd) { in ixgbe_set_rxnfc()
3048 if (adapter->hw.mac.type < ixgbe_mac_X550) in ixgbe_rss_indir_tbl_max()
3069 u16 rss_m = adapter->ring_feature[RING_F_RSS].mask; in ixgbe_get_reta()
3071 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) in ixgbe_get_reta()
3072 rss_m = adapter->ring_feature[RING_F_RSS].indices - 1; in ixgbe_get_reta()
3075 indir[i] = adapter->rss_indir_tbl[i] & rss_m; in ixgbe_get_reta()
3090 memcpy(key, adapter->rss_key, ixgbe_get_rxfh_key_size(netdev)); in ixgbe_get_rxfh()
3103 return -EINVAL; in ixgbe_set_rxfh()
3107 int max_queues = min_t(int, adapter->num_rx_queues, in ixgbe_set_rxfh()
3110 /*Allow at least 2 queues w/ SR-IOV.*/ in ixgbe_set_rxfh()
3111 if ((adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) && in ixgbe_set_rxfh()
3118 return -EINVAL; in ixgbe_set_rxfh()
3121 adapter->rss_indir_tbl[i] = indir[i]; in ixgbe_set_rxfh()
3128 memcpy(adapter->rss_key, key, ixgbe_get_rxfh_key_size(netdev)); in ixgbe_set_rxfh()
3141 info->rx_filters = BIT(HWTSTAMP_FILTER_NONE); in ixgbe_get_ts_info()
3143 switch (adapter->hw.mac.type) { in ixgbe_get_ts_info()
3147 info->rx_filters |= BIT(HWTSTAMP_FILTER_ALL); in ixgbe_get_ts_info()
3151 info->rx_filters |= in ixgbe_get_ts_info()
3160 info->so_timestamping = in ixgbe_get_ts_info()
3168 if (adapter->ptp_clock) in ixgbe_get_ts_info()
3169 info->phc_index = ptp_clock_index(adapter->ptp_clock); in ixgbe_get_ts_info()
3171 info->phc_index = -1; in ixgbe_get_ts_info()
3173 info->tx_types = in ixgbe_get_ts_info()
3183 u8 tcs = adapter->hw_tcs; in ixgbe_max_channels()
3185 if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) { in ixgbe_max_channels()
3186 /* We only support one q_vector without MSI-X */ in ixgbe_max_channels()
3188 } else if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) { in ixgbe_max_channels()
3190 max_combined = adapter->ring_feature[RING_F_RSS].mask + 1; in ixgbe_max_channels()
3193 if (adapter->hw.mac.type == ixgbe_mac_82598EB) { in ixgbe_max_channels()
3203 } else if (adapter->atr_sample_rate) { in ixgbe_max_channels()
3220 ch->max_combined = ixgbe_max_channels(adapter); in ixgbe_get_channels()
3223 if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) { in ixgbe_get_channels()
3224 ch->max_other = NON_Q_VECTORS; in ixgbe_get_channels()
3225 ch->other_count = NON_Q_VECTORS; in ixgbe_get_channels()
3229 ch->combined_count = adapter->ring_feature[RING_F_RSS].indices; in ixgbe_get_channels()
3232 if (ch->combined_count == 1) in ixgbe_get_channels()
3235 /* we do not support ATR queueing if SR-IOV is enabled */ in ixgbe_get_channels()
3236 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) in ixgbe_get_channels()
3240 if (adapter->hw_tcs > 1) in ixgbe_get_channels()
3244 if (!adapter->atr_sample_rate) in ixgbe_get_channels()
3248 ch->combined_count = adapter->ring_feature[RING_F_FDIR].indices; in ixgbe_get_channels()
3255 unsigned int count = ch->combined_count; in ixgbe_set_channels()
3259 if (!count || ch->rx_count || ch->tx_count) in ixgbe_set_channels()
3260 return -EINVAL; in ixgbe_set_channels()
3263 if (ch->other_count != NON_Q_VECTORS) in ixgbe_set_channels()
3264 return -EINVAL; in ixgbe_set_channels()
3268 return -EINVAL; in ixgbe_set_channels()
3270 /* update feature limits from largest to smallest supported values */ in ixgbe_set_channels()
3271 adapter->ring_feature[RING_F_FDIR].limit = count; in ixgbe_set_channels()
3276 adapter->ring_feature[RING_F_RSS].limit = count; in ixgbe_set_channels()
3282 adapter->ring_feature[RING_F_FCOE].limit = count; in ixgbe_set_channels()
3286 return ixgbe_setup_tc(dev, adapter->hw_tcs); in ixgbe_set_channels()
3293 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_module_info() local
3298 if (hw->phy.type == ixgbe_phy_fw) in ixgbe_get_module_info()
3299 return -ENXIO; in ixgbe_get_module_info()
3301 /* Check whether we support SFF-8472 or not */ in ixgbe_get_module_info()
3302 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_get_module_info()
3306 return -EIO; in ixgbe_get_module_info()
3308 /* addressing mode is not supported */ in ixgbe_get_module_info()
3309 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_get_module_info()
3313 return -EIO; in ixgbe_get_module_info()
3316 …e_err(drv, "Address change required to access page 0xA2, but not supported. Please report the modu… in ixgbe_get_module_info()
3322 /* We have a SFP, but it does not support SFF-8472 */ in ixgbe_get_module_info()
3323 modinfo->type = ETH_MODULE_SFF_8079; in ixgbe_get_module_info()
3324 modinfo->eeprom_len = ETH_MODULE_SFF_8079_LEN; in ixgbe_get_module_info()
3326 /* We have a SFP which supports a revision of SFF-8472. */ in ixgbe_get_module_info()
3327 modinfo->type = ETH_MODULE_SFF_8472; in ixgbe_get_module_info()
3328 modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN; in ixgbe_get_module_info()
3339 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_module_eeprom() local
3344 if (ee->len == 0) in ixgbe_get_module_eeprom()
3345 return -EINVAL; in ixgbe_get_module_eeprom()
3347 if (hw->phy.type == ixgbe_phy_fw) in ixgbe_get_module_eeprom()
3348 return -ENXIO; in ixgbe_get_module_eeprom()
3350 for (i = ee->offset; i < ee->offset + ee->len; i++) { in ixgbe_get_module_eeprom()
3352 if (test_bit(__IXGBE_IN_SFP_INIT, &adapter->state)) in ixgbe_get_module_eeprom()
3353 return -EBUSY; in ixgbe_get_module_eeprom()
3356 status = hw->phy.ops.read_i2c_eeprom(hw, i, &databyte); in ixgbe_get_module_eeprom()
3358 status = hw->phy.ops.read_i2c_sff8472(hw, i, &databyte); in ixgbe_get_module_eeprom()
3361 return -EIO; in ixgbe_get_module_eeprom()
3363 data[i - ee->offset] = databyte; in ixgbe_get_module_eeprom()
3371 u32 supported; member
3396 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_eee_fw() local
3400 rc = ixgbe_fw_phy_activity(hw, FW_PHY_ACT_UD_2, &info); in ixgbe_get_eee_fw()
3404 edata->lp_advertised = 0; in ixgbe_get_eee_fw()
3407 edata->lp_advertised |= ixgbe_lp_map[i].mac_speed; in ixgbe_get_eee_fw()
3410 edata->supported = 0; in ixgbe_get_eee_fw()
3412 if (hw->phy.eee_speeds_supported & ixgbe_ls_map[i].mac_speed) in ixgbe_get_eee_fw()
3413 edata->supported |= ixgbe_ls_map[i].supported; in ixgbe_get_eee_fw()
3416 edata->advertised = 0; in ixgbe_get_eee_fw()
3418 if (hw->phy.eee_speeds_advertised & ixgbe_ls_map[i].mac_speed) in ixgbe_get_eee_fw()
3419 edata->advertised |= ixgbe_ls_map[i].supported; in ixgbe_get_eee_fw()
3422 edata->eee_enabled = !!edata->advertised; in ixgbe_get_eee_fw()
3423 edata->tx_lpi_enabled = edata->eee_enabled; in ixgbe_get_eee_fw()
3424 if (edata->advertised & edata->lp_advertised) in ixgbe_get_eee_fw()
3425 edata->eee_active = true; in ixgbe_get_eee_fw()
3433 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_eee() local
3435 if (!(adapter->flags2 & IXGBE_FLAG2_EEE_CAPABLE)) in ixgbe_get_eee()
3436 return -EOPNOTSUPP; in ixgbe_get_eee()
3438 if (hw->phy.eee_speeds_supported && hw->phy.type == ixgbe_phy_fw) in ixgbe_get_eee()
3441 return -EOPNOTSUPP; in ixgbe_get_eee()
3447 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_eee() local
3451 if (!(adapter->flags2 & IXGBE_FLAG2_EEE_CAPABLE)) in ixgbe_set_eee()
3452 return -EOPNOTSUPP; in ixgbe_set_eee()
3460 if (eee_data.eee_enabled && !edata->eee_enabled) { in ixgbe_set_eee()
3461 if (eee_data.tx_lpi_enabled != edata->tx_lpi_enabled) { in ixgbe_set_eee()
3462 e_err(drv, "Setting EEE tx-lpi is not supported\n"); in ixgbe_set_eee()
3463 return -EINVAL; in ixgbe_set_eee()
3466 if (eee_data.tx_lpi_timer != edata->tx_lpi_timer) { in ixgbe_set_eee()
3468 "Setting EEE Tx LPI timer is not supported\n"); in ixgbe_set_eee()
3469 return -EINVAL; in ixgbe_set_eee()
3472 if (eee_data.advertised != edata->advertised) { in ixgbe_set_eee()
3474 "Setting EEE advertised speeds is not supported\n"); in ixgbe_set_eee()
3475 return -EINVAL; in ixgbe_set_eee()
3479 if (eee_data.eee_enabled != edata->eee_enabled) { in ixgbe_set_eee()
3480 if (edata->eee_enabled) { in ixgbe_set_eee()
3481 adapter->flags2 |= IXGBE_FLAG2_EEE_ENABLED; in ixgbe_set_eee()
3482 hw->phy.eee_speeds_advertised = in ixgbe_set_eee()
3483 hw->phy.eee_speeds_supported; in ixgbe_set_eee()
3485 adapter->flags2 &= ~IXGBE_FLAG2_EEE_ENABLED; in ixgbe_set_eee()
3486 hw->phy.eee_speeds_advertised = 0; in ixgbe_set_eee()
3504 if (adapter->flags2 & IXGBE_FLAG2_RX_LEGACY) in ixgbe_get_priv_flags()
3507 if (adapter->flags2 & IXGBE_FLAG2_VF_IPSEC_ENABLED) in ixgbe_get_priv_flags()
3516 unsigned int flags2 = adapter->flags2; in ixgbe_set_priv_flags()
3526 if (flags2 != adapter->flags2) { in ixgbe_set_priv_flags()
3527 adapter->flags2 = flags2; in ixgbe_set_priv_flags()
3584 netdev->ethtool_ops = &ixgbe_ethtool_ops; in ixgbe_set_ethtool_ops()