Lines Matching +full:supported +full:- +full:hw
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 1999 - 2018 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()
693 regs_buff[35 + i] = IXGBE_READ_REG(hw, IXGBE_FCRTL_82599(i)); in ixgbe_get_regs()
694 regs_buff[43 + i] = IXGBE_READ_REG(hw, IXGBE_FCRTH_82599(i)); in ixgbe_get_regs()
700 regs_buff[51] = IXGBE_READ_REG(hw, IXGBE_FCRTV); in ixgbe_get_regs()
701 regs_buff[52] = IXGBE_READ_REG(hw, IXGBE_TFCS); in ixgbe_get_regs()
705 regs_buff[53 + i] = IXGBE_READ_REG(hw, IXGBE_RDBAL(i)); in ixgbe_get_regs()
707 regs_buff[117 + i] = IXGBE_READ_REG(hw, IXGBE_RDBAH(i)); in ixgbe_get_regs()
709 regs_buff[181 + i] = IXGBE_READ_REG(hw, IXGBE_RDLEN(i)); in ixgbe_get_regs()
711 regs_buff[245 + i] = IXGBE_READ_REG(hw, IXGBE_RDH(i)); in ixgbe_get_regs()
713 regs_buff[309 + i] = IXGBE_READ_REG(hw, IXGBE_RDT(i)); in ixgbe_get_regs()
715 regs_buff[373 + i] = IXGBE_READ_REG(hw, IXGBE_RXDCTL(i)); in ixgbe_get_regs()
717 regs_buff[437 + i] = IXGBE_READ_REG(hw, IXGBE_SRRCTL(i)); in ixgbe_get_regs()
719 regs_buff[453 + i] = IXGBE_READ_REG(hw, IXGBE_DCA_RXCTRL(i)); in ixgbe_get_regs()
720 regs_buff[469] = IXGBE_READ_REG(hw, IXGBE_RDRXCTL); in ixgbe_get_regs()
722 regs_buff[470 + i] = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(i)); in ixgbe_get_regs()
723 regs_buff[478] = IXGBE_READ_REG(hw, IXGBE_RXCTRL); in ixgbe_get_regs()
724 regs_buff[479] = IXGBE_READ_REG(hw, IXGBE_DROPEN); in ixgbe_get_regs()
727 regs_buff[480] = IXGBE_READ_REG(hw, IXGBE_RXCSUM); in ixgbe_get_regs()
728 regs_buff[481] = IXGBE_READ_REG(hw, IXGBE_RFCTL); in ixgbe_get_regs()
730 regs_buff[482 + i] = IXGBE_READ_REG(hw, IXGBE_RAL(i)); in ixgbe_get_regs()
732 regs_buff[498 + i] = IXGBE_READ_REG(hw, IXGBE_RAH(i)); in ixgbe_get_regs()
733 regs_buff[514] = IXGBE_READ_REG(hw, IXGBE_PSRTYPE(0)); in ixgbe_get_regs()
734 regs_buff[515] = IXGBE_READ_REG(hw, IXGBE_FCTRL); in ixgbe_get_regs()
735 regs_buff[516] = IXGBE_READ_REG(hw, IXGBE_VLNCTRL); in ixgbe_get_regs()
736 regs_buff[517] = IXGBE_READ_REG(hw, IXGBE_MCSTCTRL); in ixgbe_get_regs()
737 regs_buff[518] = IXGBE_READ_REG(hw, IXGBE_MRQC); in ixgbe_get_regs()
738 regs_buff[519] = IXGBE_READ_REG(hw, IXGBE_VMD_CTL); in ixgbe_get_regs()
740 regs_buff[520 + i] = IXGBE_READ_REG(hw, IXGBE_IMIR(i)); in ixgbe_get_regs()
742 regs_buff[528 + i] = IXGBE_READ_REG(hw, IXGBE_IMIREXT(i)); in ixgbe_get_regs()
743 regs_buff[536] = IXGBE_READ_REG(hw, IXGBE_IMIRVP); in ixgbe_get_regs()
747 regs_buff[537 + i] = IXGBE_READ_REG(hw, IXGBE_TDBAL(i)); in ixgbe_get_regs()
749 regs_buff[569 + i] = IXGBE_READ_REG(hw, IXGBE_TDBAH(i)); in ixgbe_get_regs()
751 regs_buff[601 + i] = IXGBE_READ_REG(hw, IXGBE_TDLEN(i)); in ixgbe_get_regs()
753 regs_buff[633 + i] = IXGBE_READ_REG(hw, IXGBE_TDH(i)); in ixgbe_get_regs()
755 regs_buff[665 + i] = IXGBE_READ_REG(hw, IXGBE_TDT(i)); in ixgbe_get_regs()
757 regs_buff[697 + i] = IXGBE_READ_REG(hw, IXGBE_TXDCTL(i)); in ixgbe_get_regs()
759 regs_buff[729 + i] = IXGBE_READ_REG(hw, IXGBE_TDWBAL(i)); in ixgbe_get_regs()
761 regs_buff[761 + i] = IXGBE_READ_REG(hw, IXGBE_TDWBAH(i)); in ixgbe_get_regs()
762 regs_buff[793] = IXGBE_READ_REG(hw, IXGBE_DTXCTL); in ixgbe_get_regs()
764 regs_buff[794 + i] = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL(i)); in ixgbe_get_regs()
765 regs_buff[810] = IXGBE_READ_REG(hw, IXGBE_TIPG); in ixgbe_get_regs()
767 regs_buff[811 + i] = IXGBE_READ_REG(hw, IXGBE_TXPBSIZE(i)); in ixgbe_get_regs()
768 regs_buff[819] = IXGBE_READ_REG(hw, IXGBE_MNGTXMAP); in ixgbe_get_regs()
771 regs_buff[820] = IXGBE_READ_REG(hw, IXGBE_WUC); in ixgbe_get_regs()
772 regs_buff[821] = IXGBE_READ_REG(hw, IXGBE_WUFC); in ixgbe_get_regs()
773 regs_buff[822] = IXGBE_READ_REG(hw, IXGBE_WUS); in ixgbe_get_regs()
774 regs_buff[823] = IXGBE_READ_REG(hw, IXGBE_IPAV); in ixgbe_get_regs()
775 regs_buff[824] = IXGBE_READ_REG(hw, IXGBE_IP4AT); in ixgbe_get_regs()
776 regs_buff[825] = IXGBE_READ_REG(hw, IXGBE_IP6AT); in ixgbe_get_regs()
777 regs_buff[826] = IXGBE_READ_REG(hw, IXGBE_WUPL); in ixgbe_get_regs()
778 regs_buff[827] = IXGBE_READ_REG(hw, IXGBE_WUPM); in ixgbe_get_regs()
779 regs_buff[828] = IXGBE_READ_REG(hw, IXGBE_FHFT(0)); in ixgbe_get_regs()
782 regs_buff[829] = IXGBE_READ_REG(hw, IXGBE_RMCS); /* same as FCCFG */ in ixgbe_get_regs()
783 regs_buff[831] = IXGBE_READ_REG(hw, IXGBE_PDPMCS); /* same as RTTPCS */ in ixgbe_get_regs()
785 switch (hw->mac.type) { in ixgbe_get_regs()
787 regs_buff[830] = IXGBE_READ_REG(hw, IXGBE_DPMCS); in ixgbe_get_regs()
788 regs_buff[832] = IXGBE_READ_REG(hw, IXGBE_RUPPBMR); in ixgbe_get_regs()
791 IXGBE_READ_REG(hw, IXGBE_RT2CR(i)); in ixgbe_get_regs()
794 IXGBE_READ_REG(hw, IXGBE_RT2SR(i)); in ixgbe_get_regs()
797 IXGBE_READ_REG(hw, IXGBE_TDTQ2TCCR(i)); in ixgbe_get_regs()
800 IXGBE_READ_REG(hw, IXGBE_TDTQ2TCSR(i)); in ixgbe_get_regs()
807 regs_buff[830] = IXGBE_READ_REG(hw, IXGBE_RTTDCS); in ixgbe_get_regs()
808 regs_buff[832] = IXGBE_READ_REG(hw, IXGBE_RTRPCS); in ixgbe_get_regs()
811 IXGBE_READ_REG(hw, IXGBE_RTRPT4C(i)); in ixgbe_get_regs()
814 IXGBE_READ_REG(hw, IXGBE_RTRPT4S(i)); in ixgbe_get_regs()
817 IXGBE_READ_REG(hw, IXGBE_RTTDT2C(i)); in ixgbe_get_regs()
820 IXGBE_READ_REG(hw, IXGBE_RTTDT2S(i)); in ixgbe_get_regs()
828 IXGBE_READ_REG(hw, IXGBE_TDPT2TCCR(i)); /* same as RTTPT2C */ in ixgbe_get_regs()
831 IXGBE_READ_REG(hw, IXGBE_TDPT2TCSR(i)); /* same as RTTPT2S */ in ixgbe_get_regs()
901 regs_buff[1038] = IXGBE_READ_REG(hw, IXGBE_PCS1GCFIG); in ixgbe_get_regs()
902 regs_buff[1039] = IXGBE_READ_REG(hw, IXGBE_PCS1GLCTL); in ixgbe_get_regs()
903 regs_buff[1040] = IXGBE_READ_REG(hw, IXGBE_PCS1GLSTA); in ixgbe_get_regs()
904 regs_buff[1041] = IXGBE_READ_REG(hw, IXGBE_PCS1GDBG0); in ixgbe_get_regs()
905 regs_buff[1042] = IXGBE_READ_REG(hw, IXGBE_PCS1GDBG1); in ixgbe_get_regs()
906 regs_buff[1043] = IXGBE_READ_REG(hw, IXGBE_PCS1GANA); in ixgbe_get_regs()
907 regs_buff[1044] = IXGBE_READ_REG(hw, IXGBE_PCS1GANLP); in ixgbe_get_regs()
908 regs_buff[1045] = IXGBE_READ_REG(hw, IXGBE_PCS1GANNP); in ixgbe_get_regs()
909 regs_buff[1046] = IXGBE_READ_REG(hw, IXGBE_PCS1GANLPNP); in ixgbe_get_regs()
910 regs_buff[1047] = IXGBE_READ_REG(hw, IXGBE_HLREG0); in ixgbe_get_regs()
911 regs_buff[1048] = IXGBE_READ_REG(hw, IXGBE_HLREG1); in ixgbe_get_regs()
912 regs_buff[1049] = IXGBE_READ_REG(hw, IXGBE_PAP); in ixgbe_get_regs()
913 regs_buff[1050] = IXGBE_READ_REG(hw, IXGBE_MACA); in ixgbe_get_regs()
914 regs_buff[1051] = IXGBE_READ_REG(hw, IXGBE_APAE); in ixgbe_get_regs()
915 regs_buff[1052] = IXGBE_READ_REG(hw, IXGBE_ARD); in ixgbe_get_regs()
916 regs_buff[1053] = IXGBE_READ_REG(hw, IXGBE_AIS); in ixgbe_get_regs()
917 regs_buff[1054] = IXGBE_READ_REG(hw, IXGBE_MSCA); in ixgbe_get_regs()
918 regs_buff[1055] = IXGBE_READ_REG(hw, IXGBE_MSRWD); in ixgbe_get_regs()
919 regs_buff[1056] = IXGBE_READ_REG(hw, IXGBE_MLADD); in ixgbe_get_regs()
920 regs_buff[1057] = IXGBE_READ_REG(hw, IXGBE_MHADD); in ixgbe_get_regs()
921 regs_buff[1058] = IXGBE_READ_REG(hw, IXGBE_TREG); in ixgbe_get_regs()
922 regs_buff[1059] = IXGBE_READ_REG(hw, IXGBE_PCSS1); in ixgbe_get_regs()
923 regs_buff[1060] = IXGBE_READ_REG(hw, IXGBE_PCSS2); in ixgbe_get_regs()
924 regs_buff[1061] = IXGBE_READ_REG(hw, IXGBE_XPCSS); in ixgbe_get_regs()
925 regs_buff[1062] = IXGBE_READ_REG(hw, IXGBE_SERDESC); in ixgbe_get_regs()
926 regs_buff[1063] = IXGBE_READ_REG(hw, IXGBE_MACS); in ixgbe_get_regs()
927 regs_buff[1064] = IXGBE_READ_REG(hw, IXGBE_AUTOC); in ixgbe_get_regs()
928 regs_buff[1065] = IXGBE_READ_REG(hw, IXGBE_LINKS); in ixgbe_get_regs()
929 regs_buff[1066] = IXGBE_READ_REG(hw, IXGBE_AUTOC2); in ixgbe_get_regs()
930 regs_buff[1067] = IXGBE_READ_REG(hw, IXGBE_AUTOC3); in ixgbe_get_regs()
931 regs_buff[1068] = IXGBE_READ_REG(hw, IXGBE_ANLP1); in ixgbe_get_regs()
932 regs_buff[1069] = IXGBE_READ_REG(hw, IXGBE_ANLP2); in ixgbe_get_regs()
933 regs_buff[1070] = IXGBE_READ_REG(hw, IXGBE_ATLASCTL); in ixgbe_get_regs()
936 regs_buff[1071] = IXGBE_READ_REG(hw, IXGBE_RDSTATCTL); in ixgbe_get_regs()
938 regs_buff[1072 + i] = IXGBE_READ_REG(hw, IXGBE_RDSTAT(i)); in ixgbe_get_regs()
939 regs_buff[1080] = IXGBE_READ_REG(hw, IXGBE_RDHMPN); in ixgbe_get_regs()
941 regs_buff[1081 + i] = IXGBE_READ_REG(hw, IXGBE_RIC_DW(i)); in ixgbe_get_regs()
942 regs_buff[1085] = IXGBE_READ_REG(hw, IXGBE_RDPROBE); in ixgbe_get_regs()
943 regs_buff[1086] = IXGBE_READ_REG(hw, IXGBE_TDSTATCTL); in ixgbe_get_regs()
945 regs_buff[1087 + i] = IXGBE_READ_REG(hw, IXGBE_TDSTAT(i)); in ixgbe_get_regs()
946 regs_buff[1095] = IXGBE_READ_REG(hw, IXGBE_TDHMPN); in ixgbe_get_regs()
948 regs_buff[1096 + i] = IXGBE_READ_REG(hw, IXGBE_TIC_DW(i)); in ixgbe_get_regs()
949 regs_buff[1100] = IXGBE_READ_REG(hw, IXGBE_TDPROBE); in ixgbe_get_regs()
950 regs_buff[1101] = IXGBE_READ_REG(hw, IXGBE_TXBUFCTRL); in ixgbe_get_regs()
952 regs_buff[1102 + i] = IXGBE_READ_REG(hw, IXGBE_TXBUFDATA(i)); in ixgbe_get_regs()
953 regs_buff[1106] = IXGBE_READ_REG(hw, IXGBE_RXBUFCTRL); in ixgbe_get_regs()
955 regs_buff[1107 + i] = IXGBE_READ_REG(hw, IXGBE_RXBUFDATA(i)); in ixgbe_get_regs()
957 regs_buff[1111 + i] = IXGBE_READ_REG(hw, IXGBE_PCIE_DIAG(i)); in ixgbe_get_regs()
958 regs_buff[1119] = IXGBE_READ_REG(hw, IXGBE_RFVAL); in ixgbe_get_regs()
959 regs_buff[1120] = IXGBE_READ_REG(hw, IXGBE_MDFTC1); in ixgbe_get_regs()
960 regs_buff[1121] = IXGBE_READ_REG(hw, IXGBE_MDFTC2); in ixgbe_get_regs()
961 regs_buff[1122] = IXGBE_READ_REG(hw, IXGBE_MDFTFIFO1); in ixgbe_get_regs()
962 regs_buff[1123] = IXGBE_READ_REG(hw, IXGBE_MDFTFIFO2); in ixgbe_get_regs()
963 regs_buff[1124] = IXGBE_READ_REG(hw, IXGBE_MDFTS); in ixgbe_get_regs()
964 regs_buff[1125] = IXGBE_READ_REG(hw, IXGBE_PCIEECCCTL); in ixgbe_get_regs()
965 regs_buff[1126] = IXGBE_READ_REG(hw, IXGBE_PBTXECC); in ixgbe_get_regs()
966 regs_buff[1127] = IXGBE_READ_REG(hw, IXGBE_PBRXECC); in ixgbe_get_regs()
969 regs_buff[1128] = IXGBE_READ_REG(hw, IXGBE_MFLCN); in ixgbe_get_regs()
972 regs_buff[1129] = IXGBE_READ_REG(hw, IXGBE_RTRUP2TC); in ixgbe_get_regs()
973 regs_buff[1130] = IXGBE_READ_REG(hw, IXGBE_RTTUP2TC); in ixgbe_get_regs()
975 regs_buff[1131 + i] = IXGBE_READ_REG(hw, IXGBE_TXLLQ(i)); in ixgbe_get_regs()
976 regs_buff[1135] = IXGBE_READ_REG(hw, IXGBE_RTTBCNRM); in ixgbe_get_regs()
978 regs_buff[1136] = IXGBE_READ_REG(hw, IXGBE_RTTBCNRD); in ixgbe_get_regs()
982 regs_buff[1137] = IXGBE_READ_REG(hw, IXGBE_RTTQCNCR); in ixgbe_get_regs()
983 regs_buff[1138] = IXGBE_READ_REG(hw, IXGBE_RTTQCNTG); in ixgbe_get_regs()
986 regs_buff[1139] = IXGBE_READ_REG(hw, IXGBE_SECTXCTRL); in ixgbe_get_regs()
987 regs_buff[1140] = IXGBE_READ_REG(hw, IXGBE_SECTXSTAT); in ixgbe_get_regs()
988 regs_buff[1141] = IXGBE_READ_REG(hw, IXGBE_SECTXBUFFAF); in ixgbe_get_regs()
989 regs_buff[1142] = IXGBE_READ_REG(hw, IXGBE_SECTXMINIFG); in ixgbe_get_regs()
990 regs_buff[1143] = IXGBE_READ_REG(hw, IXGBE_SECRXCTRL); in ixgbe_get_regs()
991 regs_buff[1144] = IXGBE_READ_REG(hw, IXGBE_SECRXSTAT); in ixgbe_get_regs()
997 return adapter->hw.eeprom.word_size * 2; in ixgbe_get_eeprom_len()
1004 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_eeprom() local
1010 if (eeprom->len == 0) in ixgbe_get_eeprom()
1011 return -EINVAL; in ixgbe_get_eeprom()
1013 eeprom->magic = hw->vendor_id | (hw->device_id << 16); in ixgbe_get_eeprom()
1015 first_word = eeprom->offset >> 1; in ixgbe_get_eeprom()
1016 last_word = (eeprom->offset + eeprom->len - 1) >> 1; in ixgbe_get_eeprom()
1017 eeprom_len = last_word - first_word + 1; in ixgbe_get_eeprom()
1021 return -ENOMEM; in ixgbe_get_eeprom()
1023 ret_val = hw->eeprom.ops.read_buffer(hw, first_word, eeprom_len, in ixgbe_get_eeprom()
1026 /* Device's eeprom is always little-endian, word addressable */ in ixgbe_get_eeprom()
1030 memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 1), eeprom->len); in ixgbe_get_eeprom()
1040 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_eeprom() local
1046 if (eeprom->len == 0) in ixgbe_set_eeprom()
1047 return -EINVAL; in ixgbe_set_eeprom()
1049 if (eeprom->magic != (hw->vendor_id | (hw->device_id << 16))) in ixgbe_set_eeprom()
1050 return -EINVAL; in ixgbe_set_eeprom()
1052 max_len = hw->eeprom.word_size * 2; in ixgbe_set_eeprom()
1054 first_word = eeprom->offset >> 1; in ixgbe_set_eeprom()
1055 last_word = (eeprom->offset + eeprom->len - 1) >> 1; in ixgbe_set_eeprom()
1058 return -ENOMEM; in ixgbe_set_eeprom()
1062 if (eeprom->offset & 1) { in ixgbe_set_eeprom()
1067 ret_val = hw->eeprom.ops.read(hw, first_word, &eeprom_buff[0]); in ixgbe_set_eeprom()
1073 if ((eeprom->offset + eeprom->len) & 1) { in ixgbe_set_eeprom()
1078 ret_val = hw->eeprom.ops.read(hw, last_word, in ixgbe_set_eeprom()
1079 &eeprom_buff[last_word - first_word]); in ixgbe_set_eeprom()
1084 /* Device's eeprom is always little-endian, word addressable */ in ixgbe_set_eeprom()
1085 for (i = 0; i < last_word - first_word + 1; i++) in ixgbe_set_eeprom()
1088 memcpy(ptr, bytes, eeprom->len); in ixgbe_set_eeprom()
1090 for (i = 0; i < last_word - first_word + 1; i++) in ixgbe_set_eeprom()
1093 ret_val = hw->eeprom.ops.write_buffer(hw, first_word, in ixgbe_set_eeprom()
1094 last_word - first_word + 1, in ixgbe_set_eeprom()
1099 hw->eeprom.ops.update_checksum(hw); in ixgbe_set_eeprom()
1111 strscpy(drvinfo->driver, ixgbe_driver_name, sizeof(drvinfo->driver)); in ixgbe_get_drvinfo()
1113 strscpy(drvinfo->fw_version, adapter->eeprom_id, in ixgbe_get_drvinfo()
1114 sizeof(drvinfo->fw_version)); in ixgbe_get_drvinfo()
1116 strscpy(drvinfo->bus_info, pci_name(adapter->pdev), in ixgbe_get_drvinfo()
1117 sizeof(drvinfo->bus_info)); in ixgbe_get_drvinfo()
1119 drvinfo->n_priv_flags = IXGBE_PRIV_FLAGS_STR_LEN; in ixgbe_get_drvinfo()
1124 switch (adapter->hw.mac.type) { in ixgbe_get_max_rxd()
1142 switch (adapter->hw.mac.type) { in ixgbe_get_max_txd()
1164 struct ixgbe_ring *tx_ring = adapter->tx_ring[0]; in ixgbe_get_ringparam()
1165 struct ixgbe_ring *rx_ring = adapter->rx_ring[0]; in ixgbe_get_ringparam()
1167 ring->rx_max_pending = ixgbe_get_max_rxd(adapter); in ixgbe_get_ringparam()
1168 ring->tx_max_pending = ixgbe_get_max_txd(adapter); in ixgbe_get_ringparam()
1169 ring->rx_pending = rx_ring->count; in ixgbe_get_ringparam()
1170 ring->tx_pending = tx_ring->count; in ixgbe_get_ringparam()
1183 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) in ixgbe_set_ringparam()
1184 return -EINVAL; in ixgbe_set_ringparam()
1186 new_tx_count = clamp_t(u32, ring->tx_pending, in ixgbe_set_ringparam()
1190 new_rx_count = clamp_t(u32, ring->rx_pending, in ixgbe_set_ringparam()
1194 if ((new_tx_count == adapter->tx_ring_count) && in ixgbe_set_ringparam()
1195 (new_rx_count == adapter->rx_ring_count)) { in ixgbe_set_ringparam()
1200 while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state)) in ixgbe_set_ringparam()
1203 if (!netif_running(adapter->netdev)) { in ixgbe_set_ringparam()
1204 for (i = 0; i < adapter->num_tx_queues; i++) in ixgbe_set_ringparam()
1205 adapter->tx_ring[i]->count = new_tx_count; in ixgbe_set_ringparam()
1206 for (i = 0; i < adapter->num_xdp_queues; i++) in ixgbe_set_ringparam()
1207 adapter->xdp_ring[i]->count = new_tx_count; in ixgbe_set_ringparam()
1208 for (i = 0; i < adapter->num_rx_queues; i++) in ixgbe_set_ringparam()
1209 adapter->rx_ring[i]->count = new_rx_count; in ixgbe_set_ringparam()
1210 adapter->tx_ring_count = new_tx_count; in ixgbe_set_ringparam()
1211 adapter->xdp_ring_count = new_tx_count; in ixgbe_set_ringparam()
1212 adapter->rx_ring_count = new_rx_count; in ixgbe_set_ringparam()
1217 i = max_t(int, adapter->num_tx_queues + adapter->num_xdp_queues, in ixgbe_set_ringparam()
1218 adapter->num_rx_queues); in ixgbe_set_ringparam()
1222 err = -ENOMEM; in ixgbe_set_ringparam()
1234 if (new_tx_count != adapter->tx_ring_count) { in ixgbe_set_ringparam()
1235 for (i = 0; i < adapter->num_tx_queues; i++) { in ixgbe_set_ringparam()
1236 memcpy(&temp_ring[i], adapter->tx_ring[i], in ixgbe_set_ringparam()
1243 i--; in ixgbe_set_ringparam()
1250 for (j = 0; j < adapter->num_xdp_queues; j++, i++) { in ixgbe_set_ringparam()
1251 memcpy(&temp_ring[i], adapter->xdp_ring[j], in ixgbe_set_ringparam()
1258 i--; in ixgbe_set_ringparam()
1265 for (i = 0; i < adapter->num_tx_queues; i++) { in ixgbe_set_ringparam()
1266 ixgbe_free_tx_resources(adapter->tx_ring[i]); in ixgbe_set_ringparam()
1268 memcpy(adapter->tx_ring[i], &temp_ring[i], in ixgbe_set_ringparam()
1271 for (j = 0; j < adapter->num_xdp_queues; j++, i++) { in ixgbe_set_ringparam()
1272 ixgbe_free_tx_resources(adapter->xdp_ring[j]); in ixgbe_set_ringparam()
1274 memcpy(adapter->xdp_ring[j], &temp_ring[i], in ixgbe_set_ringparam()
1278 adapter->tx_ring_count = new_tx_count; in ixgbe_set_ringparam()
1282 if (new_rx_count != adapter->rx_ring_count) { in ixgbe_set_ringparam()
1283 for (i = 0; i < adapter->num_rx_queues; i++) { in ixgbe_set_ringparam()
1284 memcpy(&temp_ring[i], adapter->rx_ring[i], in ixgbe_set_ringparam()
1287 /* Clear copied XDP RX-queue info */ in ixgbe_set_ringparam()
1295 i--; in ixgbe_set_ringparam()
1303 for (i = 0; i < adapter->num_rx_queues; i++) { in ixgbe_set_ringparam()
1304 ixgbe_free_rx_resources(adapter->rx_ring[i]); in ixgbe_set_ringparam()
1306 memcpy(adapter->rx_ring[i], &temp_ring[i], in ixgbe_set_ringparam()
1310 adapter->rx_ring_count = new_rx_count; in ixgbe_set_ringparam()
1317 clear_bit(__IXGBE_RESETTING, &adapter->state); in ixgbe_set_ringparam()
1331 return -EOPNOTSUPP; in ixgbe_get_sset_count()
1366 for (j = 0; j < netdev->num_tx_queues; j++) { in ixgbe_get_ethtool_stats()
1367 ring = adapter->tx_ring[j]; in ixgbe_get_ethtool_stats()
1376 start = u64_stats_fetch_begin(&ring->syncp); in ixgbe_get_ethtool_stats()
1377 data[i] = ring->stats.packets; in ixgbe_get_ethtool_stats()
1378 data[i+1] = ring->stats.bytes; in ixgbe_get_ethtool_stats()
1379 } while (u64_stats_fetch_retry(&ring->syncp, start)); in ixgbe_get_ethtool_stats()
1383 ring = adapter->rx_ring[j]; in ixgbe_get_ethtool_stats()
1392 start = u64_stats_fetch_begin(&ring->syncp); in ixgbe_get_ethtool_stats()
1393 data[i] = ring->stats.packets; in ixgbe_get_ethtool_stats()
1394 data[i+1] = ring->stats.bytes; in ixgbe_get_ethtool_stats()
1395 } while (u64_stats_fetch_retry(&ring->syncp, start)); in ixgbe_get_ethtool_stats()
1400 data[i++] = adapter->stats.pxontxc[j]; in ixgbe_get_ethtool_stats()
1401 data[i++] = adapter->stats.pxofftxc[j]; in ixgbe_get_ethtool_stats()
1404 data[i++] = adapter->stats.pxonrxc[j]; in ixgbe_get_ethtool_stats()
1405 data[i++] = adapter->stats.pxoffrxc[j]; in ixgbe_get_ethtool_stats()
1423 for (i = 0; i < netdev->num_tx_queues; i++) { in ixgbe_get_strings()
1439 /* BUG_ON(p - data != IXGBE_STATS_LEN * ETH_GSTRING_LEN); */ in ixgbe_get_strings()
1449 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_link_test() local
1453 if (ixgbe_removed(hw->hw_addr)) { in ixgbe_link_test()
1459 hw->mac.ops.check_link(hw, &link_speed, &link_up, true); in ixgbe_link_test()
1479 * as a single-element array) and special-case the tables.
1483 * registers to be written without any read-back testing.
1528 /* RDH is read-only for 82598, only test RDT. */
1552 if (ixgbe_removed(adapter->hw.hw_addr)) { in reg_pattern_test()
1557 before = ixgbe_read_reg(&adapter->hw, reg); in reg_pattern_test()
1558 ixgbe_write_reg(&adapter->hw, reg, test_pattern[pat] & write); in reg_pattern_test()
1559 val = ixgbe_read_reg(&adapter->hw, reg); in reg_pattern_test()
1564 ixgbe_write_reg(&adapter->hw, reg, before); in reg_pattern_test()
1567 ixgbe_write_reg(&adapter->hw, reg, before); in reg_pattern_test()
1577 if (ixgbe_removed(adapter->hw.hw_addr)) { in reg_set_and_check()
1581 before = ixgbe_read_reg(&adapter->hw, reg); in reg_set_and_check()
1582 ixgbe_write_reg(&adapter->hw, reg, write & mask); in reg_set_and_check()
1583 val = ixgbe_read_reg(&adapter->hw, reg); in reg_set_and_check()
1588 ixgbe_write_reg(&adapter->hw, reg, before); in reg_set_and_check()
1591 ixgbe_write_reg(&adapter->hw, reg, before); in reg_set_and_check()
1601 if (ixgbe_removed(adapter->hw.hw_addr)) { in ixgbe_reg_test()
1602 e_err(drv, "Adapter removed - register test blocked\n"); in ixgbe_reg_test()
1606 switch (adapter->hw.mac.type) { in ixgbe_reg_test()
1627 * tests. Some bits are read-only, some toggle, and some in ixgbe_reg_test()
1630 before = ixgbe_read_reg(&adapter->hw, IXGBE_STATUS); in ixgbe_reg_test()
1631 value = (ixgbe_read_reg(&adapter->hw, IXGBE_STATUS) & toggle); in ixgbe_reg_test()
1632 ixgbe_write_reg(&adapter->hw, IXGBE_STATUS, toggle); in ixgbe_reg_test()
1633 after = ixgbe_read_reg(&adapter->hw, IXGBE_STATUS) & toggle; in ixgbe_reg_test()
1641 ixgbe_write_reg(&adapter->hw, IXGBE_STATUS, before); in ixgbe_reg_test()
1647 while (test->reg) { in ixgbe_reg_test()
1648 for (i = 0; i < test->array_len; i++) { in ixgbe_reg_test()
1651 switch (test->test_type) { in ixgbe_reg_test()
1654 test->reg + (i * 0x40), in ixgbe_reg_test()
1655 test->mask, in ixgbe_reg_test()
1656 test->write); in ixgbe_reg_test()
1660 test->reg + (i * 0x40), in ixgbe_reg_test()
1661 test->mask, in ixgbe_reg_test()
1662 test->write); in ixgbe_reg_test()
1665 ixgbe_write_reg(&adapter->hw, in ixgbe_reg_test()
1666 test->reg + (i * 0x40), in ixgbe_reg_test()
1667 test->write); in ixgbe_reg_test()
1671 test->reg + (i * 4), in ixgbe_reg_test()
1672 test->mask, in ixgbe_reg_test()
1673 test->write); in ixgbe_reg_test()
1677 test->reg + (i * 8), in ixgbe_reg_test()
1678 test->mask, in ixgbe_reg_test()
1679 test->write); in ixgbe_reg_test()
1683 (test->reg + 4) + (i * 8), in ixgbe_reg_test()
1684 test->mask, in ixgbe_reg_test()
1685 test->write); in ixgbe_reg_test()
1700 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_eeprom_test() local
1701 if (hw->eeprom.ops.validate_checksum(hw, NULL)) in ixgbe_eeprom_test()
1713 adapter->test_icr |= IXGBE_READ_REG(&adapter->hw, IXGBE_EICR); in ixgbe_test_intr()
1720 struct net_device *netdev = adapter->netdev; in ixgbe_intr_test()
1722 u32 irq = adapter->pdev->irq; in ixgbe_intr_test()
1727 if (adapter->msix_entries) { in ixgbe_intr_test()
1728 /* NOTE: we don't test MSI-X interrupts here, yet */ in ixgbe_intr_test()
1730 } else if (adapter->flags & IXGBE_FLAG_MSI_ENABLED) { in ixgbe_intr_test()
1732 if (request_irq(irq, ixgbe_test_intr, 0, netdev->name, in ixgbe_intr_test()
1735 return -1; in ixgbe_intr_test()
1738 netdev->name, netdev)) { in ixgbe_intr_test()
1741 netdev->name, netdev)) { in ixgbe_intr_test()
1743 return -1; in ixgbe_intr_test()
1745 e_info(hw, "testing %s interrupt\n", shared_int ? in ixgbe_intr_test()
1749 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, 0xFFFFFFFF); in ixgbe_intr_test()
1750 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_intr_test()
1766 adapter->test_icr = 0; in ixgbe_intr_test()
1767 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, in ixgbe_intr_test()
1769 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, in ixgbe_intr_test()
1771 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_intr_test()
1774 if (adapter->test_icr & mask) { in ixgbe_intr_test()
1786 adapter->test_icr = 0; in ixgbe_intr_test()
1787 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, mask); in ixgbe_intr_test()
1788 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, mask); in ixgbe_intr_test()
1789 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_intr_test()
1792 if (!(adapter->test_icr & mask)) { in ixgbe_intr_test()
1805 adapter->test_icr = 0; in ixgbe_intr_test()
1806 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, in ixgbe_intr_test()
1808 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, in ixgbe_intr_test()
1810 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_intr_test()
1813 if (adapter->test_icr) { in ixgbe_intr_test()
1821 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, 0xFFFFFFFF); in ixgbe_intr_test()
1822 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_intr_test()
1847 ixgbe_free_tx_resources(&adapter->test_tx_ring); in ixgbe_free_desc_rings()
1848 ixgbe_free_rx_resources(&adapter->test_rx_ring); in ixgbe_free_desc_rings()
1853 struct ixgbe_ring *tx_ring = &adapter->test_tx_ring; in ixgbe_setup_desc_rings()
1854 struct ixgbe_ring *rx_ring = &adapter->test_rx_ring; in ixgbe_setup_desc_rings()
1855 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_setup_desc_rings() local
1861 tx_ring->count = IXGBE_DEFAULT_TXD; in ixgbe_setup_desc_rings()
1862 tx_ring->queue_index = 0; in ixgbe_setup_desc_rings()
1863 tx_ring->dev = &adapter->pdev->dev; in ixgbe_setup_desc_rings()
1864 tx_ring->netdev = adapter->netdev; in ixgbe_setup_desc_rings()
1865 tx_ring->reg_idx = adapter->tx_ring[0]->reg_idx; in ixgbe_setup_desc_rings()
1871 switch (adapter->hw.mac.type) { in ixgbe_setup_desc_rings()
1877 reg_data = IXGBE_READ_REG(&adapter->hw, IXGBE_DMATXCTL); in ixgbe_setup_desc_rings()
1879 IXGBE_WRITE_REG(&adapter->hw, IXGBE_DMATXCTL, reg_data); in ixgbe_setup_desc_rings()
1888 rx_ring->count = IXGBE_DEFAULT_RXD; in ixgbe_setup_desc_rings()
1889 rx_ring->queue_index = 0; in ixgbe_setup_desc_rings()
1890 rx_ring->dev = &adapter->pdev->dev; in ixgbe_setup_desc_rings()
1891 rx_ring->netdev = adapter->netdev; in ixgbe_setup_desc_rings()
1892 rx_ring->reg_idx = adapter->rx_ring[0]->reg_idx; in ixgbe_setup_desc_rings()
1900 hw->mac.ops.disable_rx(hw); in ixgbe_setup_desc_rings()
1904 rctl = IXGBE_READ_REG(&adapter->hw, IXGBE_RXCTRL); in ixgbe_setup_desc_rings()
1906 IXGBE_WRITE_REG(&adapter->hw, IXGBE_RXCTRL, rctl); in ixgbe_setup_desc_rings()
1908 hw->mac.ops.enable_rx(hw); in ixgbe_setup_desc_rings()
1919 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_setup_loopback_test() local
1924 reg_data = IXGBE_READ_REG(hw, IXGBE_HLREG0); in ixgbe_setup_loopback_test()
1926 IXGBE_WRITE_REG(hw, IXGBE_HLREG0, reg_data); in ixgbe_setup_loopback_test()
1928 reg_data = IXGBE_READ_REG(hw, IXGBE_FCTRL); in ixgbe_setup_loopback_test()
1930 IXGBE_WRITE_REG(hw, IXGBE_FCTRL, reg_data); in ixgbe_setup_loopback_test()
1933 switch (adapter->hw.mac.type) { in ixgbe_setup_loopback_test()
1938 reg_data = IXGBE_READ_REG(hw, IXGBE_MACC); in ixgbe_setup_loopback_test()
1940 IXGBE_WRITE_REG(hw, IXGBE_MACC, reg_data); in ixgbe_setup_loopback_test()
1943 if (hw->mac.orig_autoc) { in ixgbe_setup_loopback_test()
1944 reg_data = hw->mac.orig_autoc | IXGBE_AUTOC_FLU; in ixgbe_setup_loopback_test()
1945 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, reg_data); in ixgbe_setup_loopback_test()
1950 IXGBE_WRITE_FLUSH(hw); in ixgbe_setup_loopback_test()
1953 /* Disable Atlas Tx lanes; re-enabled in reset path */ in ixgbe_setup_loopback_test()
1954 if (hw->mac.type == ixgbe_mac_82598EB) { in ixgbe_setup_loopback_test()
1957 hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_LPBK, &atlas); in ixgbe_setup_loopback_test()
1959 hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_LPBK, atlas); in ixgbe_setup_loopback_test()
1961 hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_10G, &atlas); in ixgbe_setup_loopback_test()
1963 hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_10G, atlas); in ixgbe_setup_loopback_test()
1965 hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_1G, &atlas); in ixgbe_setup_loopback_test()
1967 hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_1G, atlas); in ixgbe_setup_loopback_test()
1969 hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_AN, &atlas); in ixgbe_setup_loopback_test()
1971 hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_AN, atlas); in ixgbe_setup_loopback_test()
1981 reg_data = IXGBE_READ_REG(&adapter->hw, IXGBE_HLREG0); in ixgbe_loopback_cleanup()
1983 IXGBE_WRITE_REG(&adapter->hw, IXGBE_HLREG0, reg_data); in ixgbe_loopback_cleanup()
1989 memset(skb->data, 0xFF, frame_size); in ixgbe_create_lbtest_frame()
1991 memset(&skb->data[frame_size], 0xAA, frame_size / 2 - 1); in ixgbe_create_lbtest_frame()
1992 skb->data[frame_size + 10] = 0xBE; in ixgbe_create_lbtest_frame()
1993 skb->data[frame_size + 12] = 0xAF; in ixgbe_create_lbtest_frame()
2003 data = page_address(rx_buffer->page) + rx_buffer->page_offset; in ixgbe_check_lbtest_frame()
2017 rx_ntc = rx_ring->next_to_clean; in ixgbe_clean_test_rings()
2018 tx_ntc = tx_ring->next_to_clean; in ixgbe_clean_test_rings()
2021 while (tx_ntc != tx_ring->next_to_use) { in ixgbe_clean_test_rings()
2028 if (!(tx_desc->wb.status & cpu_to_le32(IXGBE_TXD_STAT_DD))) in ixgbe_clean_test_rings()
2032 tx_buffer = &tx_ring->tx_buffer_info[tx_ntc]; in ixgbe_clean_test_rings()
2035 dev_kfree_skb_any(tx_buffer->skb); in ixgbe_clean_test_rings()
2038 dma_unmap_single(tx_ring->dev, in ixgbe_clean_test_rings()
2046 if (tx_ntc == tx_ring->count) in ixgbe_clean_test_rings()
2050 while (rx_desc->wb.upper.length) { in ixgbe_clean_test_rings()
2054 rx_buffer = &rx_ring->rx_buffer_info[rx_ntc]; in ixgbe_clean_test_rings()
2057 dma_sync_single_for_cpu(rx_ring->dev, in ixgbe_clean_test_rings()
2058 rx_buffer->dma, in ixgbe_clean_test_rings()
2069 dma_sync_single_for_device(rx_ring->dev, in ixgbe_clean_test_rings()
2070 rx_buffer->dma, in ixgbe_clean_test_rings()
2076 if (rx_ntc == rx_ring->count) in ixgbe_clean_test_rings()
2085 /* re-map buffers to ring, store next to clean values */ in ixgbe_clean_test_rings()
2087 rx_ring->next_to_clean = rx_ntc; in ixgbe_clean_test_rings()
2088 tx_ring->next_to_clean = tx_ntc; in ixgbe_clean_test_rings()
2095 struct ixgbe_ring *tx_ring = &adapter->test_tx_ring; in ixgbe_run_loopback_test()
2096 struct ixgbe_ring *rx_ring = &adapter->test_rx_ring; in ixgbe_run_loopback_test()
2101 u32 flags_orig = adapter->flags; in ixgbe_run_loopback_test()
2104 adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED; in ixgbe_run_loopback_test()
2121 if (rx_ring->count <= tx_ring->count) in ixgbe_run_loopback_test()
2122 lc = ((tx_ring->count / 64) * 2) + 1; in ixgbe_run_loopback_test()
2124 lc = ((rx_ring->count / 64) * 2) + 1; in ixgbe_run_loopback_test()
2157 adapter->flags = flags_orig; in ixgbe_run_loopback_test()
2185 if (ixgbe_removed(adapter->hw.hw_addr)) { in ixgbe_diag_test()
2186 e_err(hw, "Adapter removed - test blocked\n"); in ixgbe_diag_test()
2192 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2195 set_bit(__IXGBE_TESTING, &adapter->state); in ixgbe_diag_test()
2196 if (eth_test->flags == ETH_TEST_FL_OFFLINE) { in ixgbe_diag_test()
2197 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_diag_test() local
2199 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) { in ixgbe_diag_test()
2201 for (i = 0; i < adapter->num_vfs; i++) { in ixgbe_diag_test()
2202 if (adapter->vfinfo[i].clear_to_send) { in ixgbe_diag_test()
2203 netdev_warn(netdev, "offline diagnostic is not supported when VFs are present\n"); in ixgbe_diag_test()
2209 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2211 &adapter->state); in ixgbe_diag_test()
2218 e_info(hw, "offline testing starting\n"); in ixgbe_diag_test()
2224 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2232 e_info(hw, "register testing starting\n"); in ixgbe_diag_test()
2234 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2237 e_info(hw, "eeprom testing starting\n"); in ixgbe_diag_test()
2239 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2242 e_info(hw, "interrupt testing starting\n"); in ixgbe_diag_test()
2244 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2248 if (adapter->flags & (IXGBE_FLAG_SRIOV_ENABLED | in ixgbe_diag_test()
2250 e_info(hw, "Skip MAC loopback diagnostic in VT mode\n"); in ixgbe_diag_test()
2256 e_info(hw, "loopback testing starting\n"); in ixgbe_diag_test()
2258 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2264 clear_bit(__IXGBE_TESTING, &adapter->state); in ixgbe_diag_test()
2267 else if (hw->mac.ops.disable_tx_laser) in ixgbe_diag_test()
2268 hw->mac.ops.disable_tx_laser(hw); in ixgbe_diag_test()
2270 e_info(hw, "online testing starting\n"); in ixgbe_diag_test()
2274 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2282 clear_bit(__IXGBE_TESTING, &adapter->state); in ixgbe_diag_test()
2289 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_wol_exclusion() local
2292 /* WOL not supported for all devices */ in ixgbe_wol_exclusion()
2293 if (!ixgbe_wol_supported(adapter, hw->device_id, in ixgbe_wol_exclusion()
2294 hw->subsystem_device_id)) { in ixgbe_wol_exclusion()
2296 wol->supported = 0; in ixgbe_wol_exclusion()
2307 wol->supported = WAKE_UCAST | WAKE_MCAST | in ixgbe_get_wol()
2309 wol->wolopts = 0; in ixgbe_get_wol()
2312 !device_can_wakeup(&adapter->pdev->dev)) in ixgbe_get_wol()
2315 if (adapter->wol & IXGBE_WUFC_EX) in ixgbe_get_wol()
2316 wol->wolopts |= WAKE_UCAST; in ixgbe_get_wol()
2317 if (adapter->wol & IXGBE_WUFC_MC) in ixgbe_get_wol()
2318 wol->wolopts |= WAKE_MCAST; in ixgbe_get_wol()
2319 if (adapter->wol & IXGBE_WUFC_BC) in ixgbe_get_wol()
2320 wol->wolopts |= WAKE_BCAST; in ixgbe_get_wol()
2321 if (adapter->wol & IXGBE_WUFC_MAG) in ixgbe_get_wol()
2322 wol->wolopts |= WAKE_MAGIC; in ixgbe_get_wol()
2329 if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE | in ixgbe_set_wol()
2331 return -EOPNOTSUPP; in ixgbe_set_wol()
2334 return wol->wolopts ? -EOPNOTSUPP : 0; in ixgbe_set_wol()
2336 adapter->wol = 0; in ixgbe_set_wol()
2338 if (wol->wolopts & WAKE_UCAST) in ixgbe_set_wol()
2339 adapter->wol |= IXGBE_WUFC_EX; in ixgbe_set_wol()
2340 if (wol->wolopts & WAKE_MCAST) in ixgbe_set_wol()
2341 adapter->wol |= IXGBE_WUFC_MC; in ixgbe_set_wol()
2342 if (wol->wolopts & WAKE_BCAST) in ixgbe_set_wol()
2343 adapter->wol |= IXGBE_WUFC_BC; in ixgbe_set_wol()
2344 if (wol->wolopts & WAKE_MAGIC) in ixgbe_set_wol()
2345 adapter->wol |= IXGBE_WUFC_MAG; in ixgbe_set_wol()
2347 device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); in ixgbe_set_wol()
2366 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_phys_id() local
2368 if (!hw->mac.ops.led_on || !hw->mac.ops.led_off) in ixgbe_set_phys_id()
2369 return -EOPNOTSUPP; in ixgbe_set_phys_id()
2373 adapter->led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); in ixgbe_set_phys_id()
2377 hw->mac.ops.led_on(hw, hw->mac.led_link_act); in ixgbe_set_phys_id()
2381 hw->mac.ops.led_off(hw, hw->mac.led_link_act); in ixgbe_set_phys_id()
2386 IXGBE_WRITE_REG(&adapter->hw, IXGBE_LEDCTL, adapter->led_reg); in ixgbe_set_phys_id()
2401 if (adapter->rx_itr_setting <= 1) in ixgbe_get_coalesce()
2402 ec->rx_coalesce_usecs = adapter->rx_itr_setting; in ixgbe_get_coalesce()
2404 ec->rx_coalesce_usecs = adapter->rx_itr_setting >> 2; in ixgbe_get_coalesce()
2407 if (adapter->q_vector[0]->tx.count && adapter->q_vector[0]->rx.count) in ixgbe_get_coalesce()
2411 if (adapter->tx_itr_setting <= 1) in ixgbe_get_coalesce()
2412 ec->tx_coalesce_usecs = adapter->tx_itr_setting; in ixgbe_get_coalesce()
2414 ec->tx_coalesce_usecs = adapter->tx_itr_setting >> 2; in ixgbe_get_coalesce()
2425 struct net_device *netdev = adapter->netdev; in ixgbe_update_rsc()
2428 if (!(adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE) || in ixgbe_update_rsc()
2429 !(netdev->features & NETIF_F_LRO)) in ixgbe_update_rsc()
2433 if (adapter->rx_itr_setting == 1 || in ixgbe_update_rsc()
2434 adapter->rx_itr_setting > IXGBE_MIN_RSC_ITR) { in ixgbe_update_rsc()
2435 if (!(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED)) { in ixgbe_update_rsc()
2436 adapter->flags2 |= IXGBE_FLAG2_RSC_ENABLED; in ixgbe_update_rsc()
2437 e_info(probe, "rx-usecs value high enough to re-enable RSC\n"); in ixgbe_update_rsc()
2441 } else if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { in ixgbe_update_rsc()
2442 adapter->flags2 &= ~IXGBE_FLAG2_RSC_ENABLED; in ixgbe_update_rsc()
2443 e_info(probe, "rx-usecs set too low, disabling RSC\n"); in ixgbe_update_rsc()
2460 if (adapter->q_vector[0]->tx.count && adapter->q_vector[0]->rx.count) { in ixgbe_set_coalesce()
2462 if (ec->tx_coalesce_usecs) in ixgbe_set_coalesce()
2463 return -EINVAL; in ixgbe_set_coalesce()
2464 tx_itr_prev = adapter->rx_itr_setting; in ixgbe_set_coalesce()
2466 tx_itr_prev = adapter->tx_itr_setting; in ixgbe_set_coalesce()
2469 if ((ec->rx_coalesce_usecs > (IXGBE_MAX_EITR >> 2)) || in ixgbe_set_coalesce()
2470 (ec->tx_coalesce_usecs > (IXGBE_MAX_EITR >> 2))) in ixgbe_set_coalesce()
2471 return -EINVAL; in ixgbe_set_coalesce()
2473 if (ec->rx_coalesce_usecs > 1) in ixgbe_set_coalesce()
2474 adapter->rx_itr_setting = ec->rx_coalesce_usecs << 2; in ixgbe_set_coalesce()
2476 adapter->rx_itr_setting = ec->rx_coalesce_usecs; in ixgbe_set_coalesce()
2478 if (adapter->rx_itr_setting == 1) in ixgbe_set_coalesce()
2481 rx_itr_param = adapter->rx_itr_setting; in ixgbe_set_coalesce()
2483 if (ec->tx_coalesce_usecs > 1) in ixgbe_set_coalesce()
2484 adapter->tx_itr_setting = ec->tx_coalesce_usecs << 2; in ixgbe_set_coalesce()
2486 adapter->tx_itr_setting = ec->tx_coalesce_usecs; in ixgbe_set_coalesce()
2488 if (adapter->tx_itr_setting == 1) in ixgbe_set_coalesce()
2491 tx_itr_param = adapter->tx_itr_setting; in ixgbe_set_coalesce()
2494 if (adapter->q_vector[0]->tx.count && adapter->q_vector[0]->rx.count) in ixgbe_set_coalesce()
2495 adapter->tx_itr_setting = adapter->rx_itr_setting; in ixgbe_set_coalesce()
2498 if ((adapter->tx_itr_setting != 1) && in ixgbe_set_coalesce()
2499 (adapter->tx_itr_setting < IXGBE_100K_ITR)) { in ixgbe_set_coalesce()
2512 for (i = 0; i < adapter->num_q_vectors; i++) { in ixgbe_set_coalesce()
2513 q_vector = adapter->q_vector[i]; in ixgbe_set_coalesce()
2514 if (q_vector->tx.count && !q_vector->rx.count) in ixgbe_set_coalesce()
2516 q_vector->itr = tx_itr_param; in ixgbe_set_coalesce()
2519 q_vector->itr = rx_itr_param; in ixgbe_set_coalesce()
2537 union ixgbe_atr_input *mask = &adapter->fdir_mask; in ixgbe_get_ethtool_fdir_entry()
2539 (struct ethtool_rx_flow_spec *)&cmd->fs; in ixgbe_get_ethtool_fdir_entry()
2544 cmd->data = (1024 << adapter->fdir_pballoc) - 2; in ixgbe_get_ethtool_fdir_entry()
2547 &adapter->fdir_filter_list, fdir_node) { in ixgbe_get_ethtool_fdir_entry()
2548 if (fsp->location <= rule->sw_idx) in ixgbe_get_ethtool_fdir_entry()
2552 if (!rule || fsp->location != rule->sw_idx) in ixgbe_get_ethtool_fdir_entry()
2553 return -EINVAL; in ixgbe_get_ethtool_fdir_entry()
2558 switch (rule->filter.formatted.flow_type) { in ixgbe_get_ethtool_fdir_entry()
2560 fsp->flow_type = TCP_V4_FLOW; in ixgbe_get_ethtool_fdir_entry()
2563 fsp->flow_type = UDP_V4_FLOW; in ixgbe_get_ethtool_fdir_entry()
2566 fsp->flow_type = SCTP_V4_FLOW; in ixgbe_get_ethtool_fdir_entry()
2569 fsp->flow_type = IP_USER_FLOW; in ixgbe_get_ethtool_fdir_entry()
2570 fsp->h_u.usr_ip4_spec.ip_ver = ETH_RX_NFC_IP4; in ixgbe_get_ethtool_fdir_entry()
2571 fsp->h_u.usr_ip4_spec.proto = 0; in ixgbe_get_ethtool_fdir_entry()
2572 fsp->m_u.usr_ip4_spec.proto = 0; in ixgbe_get_ethtool_fdir_entry()
2575 return -EINVAL; in ixgbe_get_ethtool_fdir_entry()
2578 fsp->h_u.tcp_ip4_spec.psrc = rule->filter.formatted.src_port; in ixgbe_get_ethtool_fdir_entry()
2579 fsp->m_u.tcp_ip4_spec.psrc = mask->formatted.src_port; in ixgbe_get_ethtool_fdir_entry()
2580 fsp->h_u.tcp_ip4_spec.pdst = rule->filter.formatted.dst_port; in ixgbe_get_ethtool_fdir_entry()
2581 fsp->m_u.tcp_ip4_spec.pdst = mask->formatted.dst_port; in ixgbe_get_ethtool_fdir_entry()
2582 fsp->h_u.tcp_ip4_spec.ip4src = rule->filter.formatted.src_ip[0]; in ixgbe_get_ethtool_fdir_entry()
2583 fsp->m_u.tcp_ip4_spec.ip4src = mask->formatted.src_ip[0]; in ixgbe_get_ethtool_fdir_entry()
2584 fsp->h_u.tcp_ip4_spec.ip4dst = rule->filter.formatted.dst_ip[0]; in ixgbe_get_ethtool_fdir_entry()
2585 fsp->m_u.tcp_ip4_spec.ip4dst = mask->formatted.dst_ip[0]; in ixgbe_get_ethtool_fdir_entry()
2586 fsp->h_ext.vlan_tci = rule->filter.formatted.vlan_id; in ixgbe_get_ethtool_fdir_entry()
2587 fsp->m_ext.vlan_tci = mask->formatted.vlan_id; in ixgbe_get_ethtool_fdir_entry()
2588 fsp->h_ext.vlan_etype = rule->filter.formatted.flex_bytes; in ixgbe_get_ethtool_fdir_entry()
2589 fsp->m_ext.vlan_etype = mask->formatted.flex_bytes; in ixgbe_get_ethtool_fdir_entry()
2590 fsp->h_ext.data[1] = htonl(rule->filter.formatted.vm_pool); in ixgbe_get_ethtool_fdir_entry()
2591 fsp->m_ext.data[1] = htonl(mask->formatted.vm_pool); in ixgbe_get_ethtool_fdir_entry()
2592 fsp->flow_type |= FLOW_EXT; in ixgbe_get_ethtool_fdir_entry()
2595 if (rule->action == IXGBE_FDIR_DROP_QUEUE) in ixgbe_get_ethtool_fdir_entry()
2596 fsp->ring_cookie = RX_CLS_FLOW_DISC; in ixgbe_get_ethtool_fdir_entry()
2598 fsp->ring_cookie = rule->action; in ixgbe_get_ethtool_fdir_entry()
2612 cmd->data = (1024 << adapter->fdir_pballoc) - 2; in ixgbe_get_ethtool_fdir_all()
2615 &adapter->fdir_filter_list, fdir_node) { in ixgbe_get_ethtool_fdir_all()
2616 if (cnt == cmd->rule_cnt) in ixgbe_get_ethtool_fdir_all()
2617 return -EMSGSIZE; in ixgbe_get_ethtool_fdir_all()
2618 rule_locs[cnt] = rule->sw_idx; in ixgbe_get_ethtool_fdir_all()
2622 cmd->rule_cnt = cnt; in ixgbe_get_ethtool_fdir_all()
2630 cmd->data = 0; in ixgbe_get_rss_hash_opts()
2633 switch (cmd->flow_type) { in ixgbe_get_rss_hash_opts()
2635 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in ixgbe_get_rss_hash_opts()
2638 if (adapter->flags2 & IXGBE_FLAG2_RSS_FIELD_IPV4_UDP) 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()
2646 cmd->data |= RXH_IP_SRC | RXH_IP_DST; in ixgbe_get_rss_hash_opts()
2649 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in ixgbe_get_rss_hash_opts()
2652 if (adapter->flags2 & IXGBE_FLAG2_RSS_FIELD_IPV6_UDP) 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()
2660 cmd->data |= RXH_IP_SRC | RXH_IP_DST; in ixgbe_get_rss_hash_opts()
2663 return -EINVAL; in ixgbe_get_rss_hash_opts()
2671 if (adapter->hw.mac.type < ixgbe_mac_X550) in ixgbe_rss_indir_tbl_max()
2681 int ret = -EOPNOTSUPP; in ixgbe_get_rxnfc()
2683 switch (cmd->cmd) { in ixgbe_get_rxnfc()
2685 cmd->data = min_t(int, adapter->num_rx_queues, in ixgbe_get_rxnfc()
2690 cmd->rule_cnt = adapter->fdir_filter_count; in ixgbe_get_rxnfc()
2713 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_update_ethtool_fdir_entry() local
2716 int err = -EINVAL; in ixgbe_update_ethtool_fdir_entry()
2722 &adapter->fdir_filter_list, fdir_node) { in ixgbe_update_ethtool_fdir_entry()
2724 if (rule->sw_idx >= sw_idx) in ixgbe_update_ethtool_fdir_entry()
2730 if (rule && (rule->sw_idx == sw_idx)) { in ixgbe_update_ethtool_fdir_entry()
2731 if (!input || (rule->filter.formatted.bkt_hash != in ixgbe_update_ethtool_fdir_entry()
2732 input->filter.formatted.bkt_hash)) { in ixgbe_update_ethtool_fdir_entry()
2733 err = ixgbe_fdir_erase_perfect_filter_82599(hw, in ixgbe_update_ethtool_fdir_entry()
2734 &rule->filter, in ixgbe_update_ethtool_fdir_entry()
2738 hlist_del(&rule->fdir_node); in ixgbe_update_ethtool_fdir_entry()
2740 adapter->fdir_filter_count--; in ixgbe_update_ethtool_fdir_entry()
2745 * successfully found and removed from the list else -EINVAL in ixgbe_update_ethtool_fdir_entry()
2751 INIT_HLIST_NODE(&input->fdir_node); in ixgbe_update_ethtool_fdir_entry()
2755 hlist_add_behind(&input->fdir_node, &parent->fdir_node); in ixgbe_update_ethtool_fdir_entry()
2757 hlist_add_head(&input->fdir_node, in ixgbe_update_ethtool_fdir_entry()
2758 &adapter->fdir_filter_list); in ixgbe_update_ethtool_fdir_entry()
2761 adapter->fdir_filter_count++; in ixgbe_update_ethtool_fdir_entry()
2769 switch (fsp->flow_type & ~FLOW_EXT) { in ixgbe_flowspec_to_flow_type()
2780 switch (fsp->h_u.usr_ip4_spec.proto) { in ixgbe_flowspec_to_flow_type()
2791 if (!fsp->m_u.usr_ip4_spec.proto) { in ixgbe_flowspec_to_flow_type()
2811 (struct ethtool_rx_flow_spec *)&cmd->fs; in ixgbe_add_ethtool_fdir_entry()
2812 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_add_ethtool_fdir_entry() local
2818 if (!(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) in ixgbe_add_ethtool_fdir_entry()
2819 return -EOPNOTSUPP; in ixgbe_add_ethtool_fdir_entry()
2824 if (fsp->ring_cookie == RX_CLS_FLOW_DISC) { in ixgbe_add_ethtool_fdir_entry()
2827 u32 ring = ethtool_get_flow_spec_ring(fsp->ring_cookie); in ixgbe_add_ethtool_fdir_entry()
2828 u8 vf = ethtool_get_flow_spec_ring_vf(fsp->ring_cookie); in ixgbe_add_ethtool_fdir_entry()
2830 if (!vf && (ring >= adapter->num_rx_queues)) in ixgbe_add_ethtool_fdir_entry()
2831 return -EINVAL; in ixgbe_add_ethtool_fdir_entry()
2833 ((vf > adapter->num_vfs) || in ixgbe_add_ethtool_fdir_entry()
2834 ring >= adapter->num_rx_queues_per_pool)) in ixgbe_add_ethtool_fdir_entry()
2835 return -EINVAL; in ixgbe_add_ethtool_fdir_entry()
2839 queue = adapter->rx_ring[ring]->reg_idx; in ixgbe_add_ethtool_fdir_entry()
2841 queue = ((vf - 1) * in ixgbe_add_ethtool_fdir_entry()
2842 adapter->num_rx_queues_per_pool) + ring; in ixgbe_add_ethtool_fdir_entry()
2846 if (fsp->location >= ((1024 << adapter->fdir_pballoc) - 2)) { in ixgbe_add_ethtool_fdir_entry()
2848 return -EINVAL; in ixgbe_add_ethtool_fdir_entry()
2853 return -ENOMEM; in ixgbe_add_ethtool_fdir_entry()
2858 input->sw_idx = fsp->location; in ixgbe_add_ethtool_fdir_entry()
2862 &input->filter.formatted.flow_type)) { in ixgbe_add_ethtool_fdir_entry()
2870 if (input->filter.formatted.flow_type == IXGBE_ATR_FLOW_TYPE_IPV4) in ixgbe_add_ethtool_fdir_entry()
2874 input->filter.formatted.src_ip[0] = fsp->h_u.tcp_ip4_spec.ip4src; in ixgbe_add_ethtool_fdir_entry()
2875 mask.formatted.src_ip[0] = fsp->m_u.tcp_ip4_spec.ip4src; in ixgbe_add_ethtool_fdir_entry()
2876 input->filter.formatted.dst_ip[0] = fsp->h_u.tcp_ip4_spec.ip4dst; in ixgbe_add_ethtool_fdir_entry()
2877 mask.formatted.dst_ip[0] = fsp->m_u.tcp_ip4_spec.ip4dst; in ixgbe_add_ethtool_fdir_entry()
2878 input->filter.formatted.src_port = fsp->h_u.tcp_ip4_spec.psrc; in ixgbe_add_ethtool_fdir_entry()
2879 mask.formatted.src_port = fsp->m_u.tcp_ip4_spec.psrc; in ixgbe_add_ethtool_fdir_entry()
2880 input->filter.formatted.dst_port = fsp->h_u.tcp_ip4_spec.pdst; in ixgbe_add_ethtool_fdir_entry()
2881 mask.formatted.dst_port = fsp->m_u.tcp_ip4_spec.pdst; in ixgbe_add_ethtool_fdir_entry()
2883 if (fsp->flow_type & FLOW_EXT) { in ixgbe_add_ethtool_fdir_entry()
2884 input->filter.formatted.vm_pool = in ixgbe_add_ethtool_fdir_entry()
2885 (unsigned char)ntohl(fsp->h_ext.data[1]); in ixgbe_add_ethtool_fdir_entry()
2887 (unsigned char)ntohl(fsp->m_ext.data[1]); in ixgbe_add_ethtool_fdir_entry()
2888 input->filter.formatted.vlan_id = fsp->h_ext.vlan_tci; in ixgbe_add_ethtool_fdir_entry()
2889 mask.formatted.vlan_id = fsp->m_ext.vlan_tci; in ixgbe_add_ethtool_fdir_entry()
2890 input->filter.formatted.flex_bytes = in ixgbe_add_ethtool_fdir_entry()
2891 fsp->h_ext.vlan_etype; in ixgbe_add_ethtool_fdir_entry()
2892 mask.formatted.flex_bytes = fsp->m_ext.vlan_etype; in ixgbe_add_ethtool_fdir_entry()
2896 if (fsp->ring_cookie == RX_CLS_FLOW_DISC) in ixgbe_add_ethtool_fdir_entry()
2897 input->action = IXGBE_FDIR_DROP_QUEUE; in ixgbe_add_ethtool_fdir_entry()
2899 input->action = fsp->ring_cookie; in ixgbe_add_ethtool_fdir_entry()
2901 spin_lock(&adapter->fdir_perfect_lock); in ixgbe_add_ethtool_fdir_entry()
2903 if (hlist_empty(&adapter->fdir_filter_list)) { in ixgbe_add_ethtool_fdir_entry()
2904 /* save mask and program input mask into HW */ in ixgbe_add_ethtool_fdir_entry()
2905 memcpy(&adapter->fdir_mask, &mask, sizeof(mask)); in ixgbe_add_ethtool_fdir_entry()
2906 err = ixgbe_fdir_set_input_mask_82599(hw, &mask); in ixgbe_add_ethtool_fdir_entry()
2911 } else if (memcmp(&adapter->fdir_mask, &mask, sizeof(mask))) { in ixgbe_add_ethtool_fdir_entry()
2912 e_err(drv, "Only one mask supported per port\n"); in ixgbe_add_ethtool_fdir_entry()
2917 ixgbe_atr_compute_perfect_hash_82599(&input->filter, &mask); in ixgbe_add_ethtool_fdir_entry()
2920 err = ixgbe_fdir_write_perfect_filter_82599(hw, in ixgbe_add_ethtool_fdir_entry()
2921 &input->filter, input->sw_idx, queue); in ixgbe_add_ethtool_fdir_entry()
2925 ixgbe_update_ethtool_fdir_entry(adapter, input, input->sw_idx); in ixgbe_add_ethtool_fdir_entry()
2927 spin_unlock(&adapter->fdir_perfect_lock); in ixgbe_add_ethtool_fdir_entry()
2931 spin_unlock(&adapter->fdir_perfect_lock); in ixgbe_add_ethtool_fdir_entry()
2934 return -EINVAL; in ixgbe_add_ethtool_fdir_entry()
2941 (struct ethtool_rx_flow_spec *)&cmd->fs; in ixgbe_del_ethtool_fdir_entry()
2944 spin_lock(&adapter->fdir_perfect_lock); in ixgbe_del_ethtool_fdir_entry()
2945 err = ixgbe_update_ethtool_fdir_entry(adapter, NULL, fsp->location); in ixgbe_del_ethtool_fdir_entry()
2946 spin_unlock(&adapter->fdir_perfect_lock); in ixgbe_del_ethtool_fdir_entry()
2956 u32 flags2 = adapter->flags2; in ixgbe_set_rss_hash_opt()
2962 if (nfc->data & ~(RXH_IP_SRC | RXH_IP_DST | in ixgbe_set_rss_hash_opt()
2964 return -EINVAL; in ixgbe_set_rss_hash_opt()
2966 switch (nfc->flow_type) { in ixgbe_set_rss_hash_opt()
2969 if (!(nfc->data & RXH_IP_SRC) || in ixgbe_set_rss_hash_opt()
2970 !(nfc->data & RXH_IP_DST) || in ixgbe_set_rss_hash_opt()
2971 !(nfc->data & RXH_L4_B_0_1) || in ixgbe_set_rss_hash_opt()
2972 !(nfc->data & RXH_L4_B_2_3)) in ixgbe_set_rss_hash_opt()
2973 return -EINVAL; in ixgbe_set_rss_hash_opt()
2976 if (!(nfc->data & RXH_IP_SRC) || in ixgbe_set_rss_hash_opt()
2977 !(nfc->data & RXH_IP_DST)) in ixgbe_set_rss_hash_opt()
2978 return -EINVAL; in ixgbe_set_rss_hash_opt()
2979 switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { in ixgbe_set_rss_hash_opt()
2987 return -EINVAL; in ixgbe_set_rss_hash_opt()
2991 if (!(nfc->data & RXH_IP_SRC) || in ixgbe_set_rss_hash_opt()
2992 !(nfc->data & RXH_IP_DST)) in ixgbe_set_rss_hash_opt()
2993 return -EINVAL; in ixgbe_set_rss_hash_opt()
2994 switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { in ixgbe_set_rss_hash_opt()
3002 return -EINVAL; in ixgbe_set_rss_hash_opt()
3013 if (!(nfc->data & RXH_IP_SRC) || in ixgbe_set_rss_hash_opt()
3014 !(nfc->data & RXH_IP_DST) || in ixgbe_set_rss_hash_opt()
3015 (nfc->data & RXH_L4_B_0_1) || in ixgbe_set_rss_hash_opt()
3016 (nfc->data & RXH_L4_B_2_3)) in ixgbe_set_rss_hash_opt()
3017 return -EINVAL; in ixgbe_set_rss_hash_opt()
3020 return -EINVAL; in ixgbe_set_rss_hash_opt()
3024 if (flags2 != adapter->flags2) { in ixgbe_set_rss_hash_opt()
3025 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_rss_hash_opt() local
3027 unsigned int pf_pool = adapter->num_vfs; in ixgbe_set_rss_hash_opt()
3029 if ((hw->mac.type >= ixgbe_mac_X550) && in ixgbe_set_rss_hash_opt()
3030 (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) in ixgbe_set_rss_hash_opt()
3031 mrqc = IXGBE_READ_REG(hw, IXGBE_PFVFMRQC(pf_pool)); in ixgbe_set_rss_hash_opt()
3033 mrqc = IXGBE_READ_REG(hw, IXGBE_MRQC); in ixgbe_set_rss_hash_opt()
3036 !(adapter->flags2 & UDP_RSS_FLAGS)) in ixgbe_set_rss_hash_opt()
3039 adapter->flags2 = flags2; in ixgbe_set_rss_hash_opt()
3056 if ((hw->mac.type >= ixgbe_mac_X550) && in ixgbe_set_rss_hash_opt()
3057 (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) in ixgbe_set_rss_hash_opt()
3058 IXGBE_WRITE_REG(hw, IXGBE_PFVFMRQC(pf_pool), mrqc); in ixgbe_set_rss_hash_opt()
3060 IXGBE_WRITE_REG(hw, IXGBE_MRQC, mrqc); in ixgbe_set_rss_hash_opt()
3069 int ret = -EOPNOTSUPP; in ixgbe_set_rxnfc()
3071 switch (cmd->cmd) { in ixgbe_set_rxnfc()
3103 u16 rss_m = adapter->ring_feature[RING_F_RSS].mask; in ixgbe_get_reta()
3105 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) in ixgbe_get_reta()
3106 rss_m = adapter->ring_feature[RING_F_RSS].indices - 1; in ixgbe_get_reta()
3109 indir[i] = adapter->rss_indir_tbl[i] & rss_m; in ixgbe_get_reta()
3117 rxfh->hfunc = ETH_RSS_HASH_TOP; in ixgbe_get_rxfh()
3119 if (rxfh->indir) in ixgbe_get_rxfh()
3120 ixgbe_get_reta(adapter, rxfh->indir); in ixgbe_get_rxfh()
3122 if (rxfh->key) in ixgbe_get_rxfh()
3123 memcpy(rxfh->key, adapter->rss_key, in ixgbe_get_rxfh()
3137 if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE && in ixgbe_set_rxfh()
3138 rxfh->hfunc != ETH_RSS_HASH_TOP) in ixgbe_set_rxfh()
3139 return -EOPNOTSUPP; in ixgbe_set_rxfh()
3142 if (rxfh->indir) { in ixgbe_set_rxfh()
3143 int max_queues = min_t(int, adapter->num_rx_queues, in ixgbe_set_rxfh()
3146 /*Allow at least 2 queues w/ SR-IOV.*/ in ixgbe_set_rxfh()
3147 if ((adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) && in ixgbe_set_rxfh()
3153 if (rxfh->indir[i] >= max_queues) in ixgbe_set_rxfh()
3154 return -EINVAL; in ixgbe_set_rxfh()
3157 adapter->rss_indir_tbl[i] = rxfh->indir[i]; in ixgbe_set_rxfh()
3163 if (rxfh->key) { in ixgbe_set_rxfh()
3164 memcpy(adapter->rss_key, rxfh->key, in ixgbe_set_rxfh()
3178 info->rx_filters = BIT(HWTSTAMP_FILTER_NONE); in ixgbe_get_ts_info()
3180 switch (adapter->hw.mac.type) { in ixgbe_get_ts_info()
3184 info->rx_filters |= BIT(HWTSTAMP_FILTER_ALL); in ixgbe_get_ts_info()
3188 info->rx_filters |= in ixgbe_get_ts_info()
3197 info->so_timestamping = in ixgbe_get_ts_info()
3203 if (adapter->ptp_clock) in ixgbe_get_ts_info()
3204 info->phc_index = ptp_clock_index(adapter->ptp_clock); in ixgbe_get_ts_info()
3206 info->tx_types = in ixgbe_get_ts_info()
3216 u8 tcs = adapter->hw_tcs; in ixgbe_max_channels()
3218 if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) { in ixgbe_max_channels()
3219 /* We only support one q_vector without MSI-X */ in ixgbe_max_channels()
3221 } else if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) { in ixgbe_max_channels()
3223 max_combined = adapter->ring_feature[RING_F_RSS].mask + 1; in ixgbe_max_channels()
3226 if (adapter->hw.mac.type == ixgbe_mac_82598EB) { in ixgbe_max_channels()
3236 } else if (adapter->atr_sample_rate) { in ixgbe_max_channels()
3253 ch->max_combined = ixgbe_max_channels(adapter); in ixgbe_get_channels()
3256 if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) { in ixgbe_get_channels()
3257 ch->max_other = NON_Q_VECTORS; in ixgbe_get_channels()
3258 ch->other_count = NON_Q_VECTORS; in ixgbe_get_channels()
3262 ch->combined_count = adapter->ring_feature[RING_F_RSS].indices; in ixgbe_get_channels()
3265 if (ch->combined_count == 1) in ixgbe_get_channels()
3268 /* we do not support ATR queueing if SR-IOV is enabled */ in ixgbe_get_channels()
3269 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) in ixgbe_get_channels()
3273 if (adapter->hw_tcs > 1) in ixgbe_get_channels()
3277 if (!adapter->atr_sample_rate) in ixgbe_get_channels()
3281 ch->combined_count = adapter->ring_feature[RING_F_FDIR].indices; in ixgbe_get_channels()
3288 unsigned int count = ch->combined_count; in ixgbe_set_channels()
3292 if (!count || ch->rx_count || ch->tx_count) in ixgbe_set_channels()
3293 return -EINVAL; in ixgbe_set_channels()
3296 if (ch->other_count != NON_Q_VECTORS) in ixgbe_set_channels()
3297 return -EINVAL; in ixgbe_set_channels()
3301 return -EINVAL; in ixgbe_set_channels()
3303 /* update feature limits from largest to smallest supported values */ in ixgbe_set_channels()
3304 adapter->ring_feature[RING_F_FDIR].limit = count; in ixgbe_set_channels()
3309 adapter->ring_feature[RING_F_RSS].limit = count; in ixgbe_set_channels()
3315 adapter->ring_feature[RING_F_FCOE].limit = count; in ixgbe_set_channels()
3319 return ixgbe_setup_tc(dev, adapter->hw_tcs); in ixgbe_set_channels()
3326 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_module_info() local
3331 if (hw->phy.type == ixgbe_phy_fw) in ixgbe_get_module_info()
3332 return -ENXIO; in ixgbe_get_module_info()
3334 /* Check whether we support SFF-8472 or not */ in ixgbe_get_module_info()
3335 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_get_module_info()
3339 return -EIO; in ixgbe_get_module_info()
3341 /* addressing mode is not supported */ in ixgbe_get_module_info()
3342 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_get_module_info()
3346 return -EIO; in ixgbe_get_module_info()
3349 …e_err(drv, "Address change required to access page 0xA2, but not supported. Please report the modu… in ixgbe_get_module_info()
3355 /* We have a SFP, but it does not support SFF-8472 */ in ixgbe_get_module_info()
3356 modinfo->type = ETH_MODULE_SFF_8079; in ixgbe_get_module_info()
3357 modinfo->eeprom_len = ETH_MODULE_SFF_8079_LEN; in ixgbe_get_module_info()
3359 /* We have a SFP which supports a revision of SFF-8472. */ in ixgbe_get_module_info()
3360 modinfo->type = ETH_MODULE_SFF_8472; in ixgbe_get_module_info()
3361 modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN; in ixgbe_get_module_info()
3372 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_module_eeprom() local
3373 int status = -EFAULT; in ixgbe_get_module_eeprom()
3377 if (ee->len == 0) in ixgbe_get_module_eeprom()
3378 return -EINVAL; in ixgbe_get_module_eeprom()
3380 if (hw->phy.type == ixgbe_phy_fw) in ixgbe_get_module_eeprom()
3381 return -ENXIO; in ixgbe_get_module_eeprom()
3383 for (i = ee->offset; i < ee->offset + ee->len; i++) { in ixgbe_get_module_eeprom()
3385 if (test_bit(__IXGBE_IN_SFP_INIT, &adapter->state)) in ixgbe_get_module_eeprom()
3386 return -EBUSY; in ixgbe_get_module_eeprom()
3389 status = hw->phy.ops.read_i2c_eeprom(hw, i, &databyte); in ixgbe_get_module_eeprom()
3391 status = hw->phy.ops.read_i2c_sff8472(hw, i, &databyte); in ixgbe_get_module_eeprom()
3394 return -EIO; in ixgbe_get_module_eeprom()
3396 data[i - ee->offset] = databyte; in ixgbe_get_module_eeprom()
3430 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_eee_fw() local
3434 rc = ixgbe_fw_phy_activity(hw, FW_PHY_ACT_UD_2, &info); in ixgbe_get_eee_fw()
3441 edata->lp_advertised); in ixgbe_get_eee_fw()
3445 if (hw->phy.eee_speeds_supported & ixgbe_ls_map[i].mac_speed) in ixgbe_get_eee_fw()
3447 edata->supported); in ixgbe_get_eee_fw()
3451 if (hw->phy.eee_speeds_advertised & ixgbe_ls_map[i].mac_speed) in ixgbe_get_eee_fw()
3453 edata->advertised); in ixgbe_get_eee_fw()
3456 edata->eee_enabled = !linkmode_empty(edata->advertised); in ixgbe_get_eee_fw()
3457 edata->tx_lpi_enabled = edata->eee_enabled; in ixgbe_get_eee_fw()
3459 linkmode_and(common, edata->advertised, edata->lp_advertised); in ixgbe_get_eee_fw()
3460 edata->eee_active = !linkmode_empty(common); in ixgbe_get_eee_fw()
3468 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_eee() local
3470 if (!(adapter->flags2 & IXGBE_FLAG2_EEE_CAPABLE)) in ixgbe_get_eee()
3471 return -EOPNOTSUPP; in ixgbe_get_eee()
3473 if (hw->phy.eee_speeds_supported && hw->phy.type == ixgbe_phy_fw) in ixgbe_get_eee()
3476 return -EOPNOTSUPP; in ixgbe_get_eee()
3482 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_eee() local
3486 if (!(adapter->flags2 & IXGBE_FLAG2_EEE_CAPABLE)) in ixgbe_set_eee()
3487 return -EOPNOTSUPP; in ixgbe_set_eee()
3495 if (eee_data.eee_enabled && !edata->eee_enabled) { in ixgbe_set_eee()
3496 if (eee_data.tx_lpi_enabled != edata->tx_lpi_enabled) { in ixgbe_set_eee()
3497 e_err(drv, "Setting EEE tx-lpi is not supported\n"); in ixgbe_set_eee()
3498 return -EINVAL; in ixgbe_set_eee()
3501 if (eee_data.tx_lpi_timer != edata->tx_lpi_timer) { in ixgbe_set_eee()
3503 "Setting EEE Tx LPI timer is not supported\n"); in ixgbe_set_eee()
3504 return -EINVAL; in ixgbe_set_eee()
3507 if (!linkmode_equal(eee_data.advertised, edata->advertised)) { in ixgbe_set_eee()
3509 "Setting EEE advertised speeds is not supported\n"); in ixgbe_set_eee()
3510 return -EINVAL; in ixgbe_set_eee()
3514 if (eee_data.eee_enabled != edata->eee_enabled) { in ixgbe_set_eee()
3515 if (edata->eee_enabled) { in ixgbe_set_eee()
3516 adapter->flags2 |= IXGBE_FLAG2_EEE_ENABLED; in ixgbe_set_eee()
3517 hw->phy.eee_speeds_advertised = in ixgbe_set_eee()
3518 hw->phy.eee_speeds_supported; in ixgbe_set_eee()
3520 adapter->flags2 &= ~IXGBE_FLAG2_EEE_ENABLED; in ixgbe_set_eee()
3521 hw->phy.eee_speeds_advertised = 0; in ixgbe_set_eee()
3539 if (adapter->flags2 & IXGBE_FLAG2_RX_LEGACY) in ixgbe_get_priv_flags()
3542 if (adapter->flags2 & IXGBE_FLAG2_VF_IPSEC_ENABLED) in ixgbe_get_priv_flags()
3545 if (adapter->flags2 & IXGBE_FLAG2_AUTO_DISABLE_VF) in ixgbe_get_priv_flags()
3554 unsigned int flags2 = adapter->flags2; in ixgbe_set_priv_flags()
3567 if (adapter->hw.mac.type == ixgbe_mac_82599EB) { in ixgbe_set_priv_flags()
3569 for (i = 0; i < adapter->num_vfs; i++) in ixgbe_set_priv_flags()
3570 adapter->vfinfo[i].primary_abort_count = 0; in ixgbe_set_priv_flags()
3575 "Cannot set private flags: Operation not supported\n"); in ixgbe_set_priv_flags()
3576 return -EOPNOTSUPP; in ixgbe_set_priv_flags()
3580 if (flags2 != adapter->flags2) { in ixgbe_set_priv_flags()
3581 adapter->flags2 = flags2; in ixgbe_set_priv_flags()
3638 netdev->ethtool_ops = &ixgbe_ethtool_ops; in ixgbe_set_ethtool_ops()