mirror of
https://github.com/torvalds/linux.git
synced 2024-12-04 01:51:34 +00:00
Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue
Jeff Kirsher says: ==================== 1GbE Intel Wired LAN Driver Updates 2016-05-13 This series contains updates to e1000e, igb and igbvf. Steve Shih fixes an issue for disabling auto-negotiation and forcing speed and duplex settings for non-copper media. Brian Walsh cleanups some inconsistency in the use of return variables names to avoid confusion. Jake cleans up the drivers to use the BIT() macro when it can, which will future proof the drivers for GCC 6 when it gets released. Cleaned up dead code which was never being used. Also fixed e1000e, where it was incorrectly restting the SYSTIM registers every time the ioctl was being run. Denys Vlasenko fixes an oversight where incvalue variable holds a 32 bit value so we should declare it as such, instead of 64 bits. Also fixed an overflow check, where two reads are the same, then it is not an overflow. Nathan Sullivan fixes the PTP timestamps for transmit and receive latency based on the current link speed. Alexander Duyck adds support for partial GSO segmentation in the case of tunnels for igb and igbvf. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
8ea658cea4
@ -121,7 +121,7 @@ static s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw)
|
||||
/* EEPROM access above 16k is unsupported */
|
||||
if (size > 14)
|
||||
size = 14;
|
||||
nvm->word_size = 1 << size;
|
||||
nvm->word_size = BIT(size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -845,27 +845,27 @@ static void e1000_initialize_hw_bits_80003es2lan(struct e1000_hw *hw)
|
||||
|
||||
/* Transmit Descriptor Control 0 */
|
||||
reg = er32(TXDCTL(0));
|
||||
reg |= (1 << 22);
|
||||
reg |= BIT(22);
|
||||
ew32(TXDCTL(0), reg);
|
||||
|
||||
/* Transmit Descriptor Control 1 */
|
||||
reg = er32(TXDCTL(1));
|
||||
reg |= (1 << 22);
|
||||
reg |= BIT(22);
|
||||
ew32(TXDCTL(1), reg);
|
||||
|
||||
/* Transmit Arbitration Control 0 */
|
||||
reg = er32(TARC(0));
|
||||
reg &= ~(0xF << 27); /* 30:27 */
|
||||
if (hw->phy.media_type != e1000_media_type_copper)
|
||||
reg &= ~(1 << 20);
|
||||
reg &= ~BIT(20);
|
||||
ew32(TARC(0), reg);
|
||||
|
||||
/* Transmit Arbitration Control 1 */
|
||||
reg = er32(TARC(1));
|
||||
if (er32(TCTL) & E1000_TCTL_MULR)
|
||||
reg &= ~(1 << 28);
|
||||
reg &= ~BIT(28);
|
||||
else
|
||||
reg |= (1 << 28);
|
||||
reg |= BIT(28);
|
||||
ew32(TARC(1), reg);
|
||||
|
||||
/* Disable IPv6 extension header parsing because some malformed
|
||||
|
@ -185,7 +185,7 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw)
|
||||
/* EEPROM access above 16k is unsupported */
|
||||
if (size > 14)
|
||||
size = 14;
|
||||
nvm->word_size = 1 << size;
|
||||
nvm->word_size = BIT(size);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1163,12 +1163,12 @@ static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw)
|
||||
|
||||
/* Transmit Descriptor Control 0 */
|
||||
reg = er32(TXDCTL(0));
|
||||
reg |= (1 << 22);
|
||||
reg |= BIT(22);
|
||||
ew32(TXDCTL(0), reg);
|
||||
|
||||
/* Transmit Descriptor Control 1 */
|
||||
reg = er32(TXDCTL(1));
|
||||
reg |= (1 << 22);
|
||||
reg |= BIT(22);
|
||||
ew32(TXDCTL(1), reg);
|
||||
|
||||
/* Transmit Arbitration Control 0 */
|
||||
@ -1177,11 +1177,11 @@ static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw)
|
||||
switch (hw->mac.type) {
|
||||
case e1000_82571:
|
||||
case e1000_82572:
|
||||
reg |= (1 << 23) | (1 << 24) | (1 << 25) | (1 << 26);
|
||||
reg |= BIT(23) | BIT(24) | BIT(25) | BIT(26);
|
||||
break;
|
||||
case e1000_82574:
|
||||
case e1000_82583:
|
||||
reg |= (1 << 26);
|
||||
reg |= BIT(26);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -1193,12 +1193,12 @@ static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw)
|
||||
switch (hw->mac.type) {
|
||||
case e1000_82571:
|
||||
case e1000_82572:
|
||||
reg &= ~((1 << 29) | (1 << 30));
|
||||
reg |= (1 << 22) | (1 << 24) | (1 << 25) | (1 << 26);
|
||||
reg &= ~(BIT(29) | BIT(30));
|
||||
reg |= BIT(22) | BIT(24) | BIT(25) | BIT(26);
|
||||
if (er32(TCTL) & E1000_TCTL_MULR)
|
||||
reg &= ~(1 << 28);
|
||||
reg &= ~BIT(28);
|
||||
else
|
||||
reg |= (1 << 28);
|
||||
reg |= BIT(28);
|
||||
ew32(TARC(1), reg);
|
||||
break;
|
||||
default:
|
||||
@ -1211,7 +1211,7 @@ static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw)
|
||||
case e1000_82574:
|
||||
case e1000_82583:
|
||||
reg = er32(CTRL);
|
||||
reg &= ~(1 << 29);
|
||||
reg &= ~BIT(29);
|
||||
ew32(CTRL, reg);
|
||||
break;
|
||||
default:
|
||||
@ -1224,8 +1224,8 @@ static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw)
|
||||
case e1000_82574:
|
||||
case e1000_82583:
|
||||
reg = er32(CTRL_EXT);
|
||||
reg &= ~(1 << 23);
|
||||
reg |= (1 << 22);
|
||||
reg &= ~BIT(23);
|
||||
reg |= BIT(22);
|
||||
ew32(CTRL_EXT, reg);
|
||||
break;
|
||||
default:
|
||||
@ -1261,7 +1261,7 @@ static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw)
|
||||
case e1000_82574:
|
||||
case e1000_82583:
|
||||
reg = er32(GCR);
|
||||
reg |= (1 << 22);
|
||||
reg |= BIT(22);
|
||||
ew32(GCR, reg);
|
||||
|
||||
/* Workaround for hardware errata.
|
||||
@ -1308,8 +1308,8 @@ static void e1000_clear_vfta_82571(struct e1000_hw *hw)
|
||||
E1000_VFTA_ENTRY_SHIFT) &
|
||||
E1000_VFTA_ENTRY_MASK;
|
||||
vfta_bit_in_reg =
|
||||
1 << (hw->mng_cookie.vlan_id &
|
||||
E1000_VFTA_ENTRY_BIT_SHIFT_MASK);
|
||||
BIT(hw->mng_cookie.vlan_id &
|
||||
E1000_VFTA_ENTRY_BIT_SHIFT_MASK);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -109,18 +109,18 @@ struct e1000_info;
|
||||
#define E1000_TXDCTL_DMA_BURST_ENABLE \
|
||||
(E1000_TXDCTL_GRAN | /* set descriptor granularity */ \
|
||||
E1000_TXDCTL_COUNT_DESC | \
|
||||
(1 << 16) | /* wthresh must be +1 more than desired */\
|
||||
(1 << 8) | /* hthresh */ \
|
||||
0x1f) /* pthresh */
|
||||
(1u << 16) | /* wthresh must be +1 more than desired */\
|
||||
(1u << 8) | /* hthresh */ \
|
||||
0x1f) /* pthresh */
|
||||
|
||||
#define E1000_RXDCTL_DMA_BURST_ENABLE \
|
||||
(0x01000000 | /* set descriptor granularity */ \
|
||||
(4 << 16) | /* set writeback threshold */ \
|
||||
(4 << 8) | /* set prefetch threshold */ \
|
||||
(4u << 16) | /* set writeback threshold */ \
|
||||
(4u << 8) | /* set prefetch threshold */ \
|
||||
0x20) /* set hthresh */
|
||||
|
||||
#define E1000_TIDV_FPD (1 << 31)
|
||||
#define E1000_RDTR_FPD (1 << 31)
|
||||
#define E1000_TIDV_FPD BIT(31)
|
||||
#define E1000_RDTR_FPD BIT(31)
|
||||
|
||||
enum e1000_boards {
|
||||
board_82571,
|
||||
@ -347,6 +347,7 @@ struct e1000_adapter {
|
||||
struct ptp_clock *ptp_clock;
|
||||
struct ptp_clock_info ptp_clock_info;
|
||||
struct pm_qos_request pm_qos_req;
|
||||
s32 ptp_delta;
|
||||
|
||||
u16 eee_advert;
|
||||
};
|
||||
@ -404,53 +405,53 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca);
|
||||
#define E1000_82574_SYSTIM_EPSILON (1ULL << 35ULL)
|
||||
|
||||
/* hardware capability, feature, and workaround flags */
|
||||
#define FLAG_HAS_AMT (1 << 0)
|
||||
#define FLAG_HAS_FLASH (1 << 1)
|
||||
#define FLAG_HAS_HW_VLAN_FILTER (1 << 2)
|
||||
#define FLAG_HAS_WOL (1 << 3)
|
||||
/* reserved bit4 */
|
||||
#define FLAG_HAS_CTRLEXT_ON_LOAD (1 << 5)
|
||||
#define FLAG_HAS_SWSM_ON_LOAD (1 << 6)
|
||||
#define FLAG_HAS_JUMBO_FRAMES (1 << 7)
|
||||
#define FLAG_READ_ONLY_NVM (1 << 8)
|
||||
#define FLAG_IS_ICH (1 << 9)
|
||||
#define FLAG_HAS_MSIX (1 << 10)
|
||||
#define FLAG_HAS_SMART_POWER_DOWN (1 << 11)
|
||||
#define FLAG_IS_QUAD_PORT_A (1 << 12)
|
||||
#define FLAG_IS_QUAD_PORT (1 << 13)
|
||||
#define FLAG_HAS_HW_TIMESTAMP (1 << 14)
|
||||
#define FLAG_APME_IN_WUC (1 << 15)
|
||||
#define FLAG_APME_IN_CTRL3 (1 << 16)
|
||||
#define FLAG_APME_CHECK_PORT_B (1 << 17)
|
||||
#define FLAG_DISABLE_FC_PAUSE_TIME (1 << 18)
|
||||
#define FLAG_NO_WAKE_UCAST (1 << 19)
|
||||
#define FLAG_MNG_PT_ENABLED (1 << 20)
|
||||
#define FLAG_RESET_OVERWRITES_LAA (1 << 21)
|
||||
#define FLAG_TARC_SPEED_MODE_BIT (1 << 22)
|
||||
#define FLAG_TARC_SET_BIT_ZERO (1 << 23)
|
||||
#define FLAG_RX_NEEDS_RESTART (1 << 24)
|
||||
#define FLAG_LSC_GIG_SPEED_DROP (1 << 25)
|
||||
#define FLAG_SMART_POWER_DOWN (1 << 26)
|
||||
#define FLAG_MSI_ENABLED (1 << 27)
|
||||
/* reserved (1 << 28) */
|
||||
#define FLAG_TSO_FORCE (1 << 29)
|
||||
#define FLAG_RESTART_NOW (1 << 30)
|
||||
#define FLAG_MSI_TEST_FAILED (1 << 31)
|
||||
#define FLAG_HAS_AMT BIT(0)
|
||||
#define FLAG_HAS_FLASH BIT(1)
|
||||
#define FLAG_HAS_HW_VLAN_FILTER BIT(2)
|
||||
#define FLAG_HAS_WOL BIT(3)
|
||||
/* reserved BIT(4) */
|
||||
#define FLAG_HAS_CTRLEXT_ON_LOAD BIT(5)
|
||||
#define FLAG_HAS_SWSM_ON_LOAD BIT(6)
|
||||
#define FLAG_HAS_JUMBO_FRAMES BIT(7)
|
||||
#define FLAG_READ_ONLY_NVM BIT(8)
|
||||
#define FLAG_IS_ICH BIT(9)
|
||||
#define FLAG_HAS_MSIX BIT(10)
|
||||
#define FLAG_HAS_SMART_POWER_DOWN BIT(11)
|
||||
#define FLAG_IS_QUAD_PORT_A BIT(12)
|
||||
#define FLAG_IS_QUAD_PORT BIT(13)
|
||||
#define FLAG_HAS_HW_TIMESTAMP BIT(14)
|
||||
#define FLAG_APME_IN_WUC BIT(15)
|
||||
#define FLAG_APME_IN_CTRL3 BIT(16)
|
||||
#define FLAG_APME_CHECK_PORT_B BIT(17)
|
||||
#define FLAG_DISABLE_FC_PAUSE_TIME BIT(18)
|
||||
#define FLAG_NO_WAKE_UCAST BIT(19)
|
||||
#define FLAG_MNG_PT_ENABLED BIT(20)
|
||||
#define FLAG_RESET_OVERWRITES_LAA BIT(21)
|
||||
#define FLAG_TARC_SPEED_MODE_BIT BIT(22)
|
||||
#define FLAG_TARC_SET_BIT_ZERO BIT(23)
|
||||
#define FLAG_RX_NEEDS_RESTART BIT(24)
|
||||
#define FLAG_LSC_GIG_SPEED_DROP BIT(25)
|
||||
#define FLAG_SMART_POWER_DOWN BIT(26)
|
||||
#define FLAG_MSI_ENABLED BIT(27)
|
||||
/* reserved BIT(28) */
|
||||
#define FLAG_TSO_FORCE BIT(29)
|
||||
#define FLAG_RESTART_NOW BIT(30)
|
||||
#define FLAG_MSI_TEST_FAILED BIT(31)
|
||||
|
||||
#define FLAG2_CRC_STRIPPING (1 << 0)
|
||||
#define FLAG2_HAS_PHY_WAKEUP (1 << 1)
|
||||
#define FLAG2_IS_DISCARDING (1 << 2)
|
||||
#define FLAG2_DISABLE_ASPM_L1 (1 << 3)
|
||||
#define FLAG2_HAS_PHY_STATS (1 << 4)
|
||||
#define FLAG2_HAS_EEE (1 << 5)
|
||||
#define FLAG2_DMA_BURST (1 << 6)
|
||||
#define FLAG2_DISABLE_ASPM_L0S (1 << 7)
|
||||
#define FLAG2_DISABLE_AIM (1 << 8)
|
||||
#define FLAG2_CHECK_PHY_HANG (1 << 9)
|
||||
#define FLAG2_NO_DISABLE_RX (1 << 10)
|
||||
#define FLAG2_PCIM2PCI_ARBITER_WA (1 << 11)
|
||||
#define FLAG2_DFLT_CRC_STRIPPING (1 << 12)
|
||||
#define FLAG2_CHECK_RX_HWTSTAMP (1 << 13)
|
||||
#define FLAG2_CRC_STRIPPING BIT(0)
|
||||
#define FLAG2_HAS_PHY_WAKEUP BIT(1)
|
||||
#define FLAG2_IS_DISCARDING BIT(2)
|
||||
#define FLAG2_DISABLE_ASPM_L1 BIT(3)
|
||||
#define FLAG2_HAS_PHY_STATS BIT(4)
|
||||
#define FLAG2_HAS_EEE BIT(5)
|
||||
#define FLAG2_DMA_BURST BIT(6)
|
||||
#define FLAG2_DISABLE_ASPM_L0S BIT(7)
|
||||
#define FLAG2_DISABLE_AIM BIT(8)
|
||||
#define FLAG2_CHECK_PHY_HANG BIT(9)
|
||||
#define FLAG2_NO_DISABLE_RX BIT(10)
|
||||
#define FLAG2_PCIM2PCI_ARBITER_WA BIT(11)
|
||||
#define FLAG2_DFLT_CRC_STRIPPING BIT(12)
|
||||
#define FLAG2_CHECK_RX_HWTSTAMP BIT(13)
|
||||
|
||||
#define E1000_RX_DESC_PS(R, i) \
|
||||
(&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))
|
||||
|
@ -201,6 +201,9 @@ static int e1000_get_settings(struct net_device *netdev,
|
||||
else
|
||||
ecmd->eth_tp_mdix_ctrl = hw->phy.mdix;
|
||||
|
||||
if (hw->phy.media_type != e1000_media_type_copper)
|
||||
ecmd->eth_tp_mdix_ctrl = ETH_TP_MDI_INVALID;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -236,8 +239,13 @@ static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u32 spd, u8 dplx)
|
||||
mac->forced_speed_duplex = ADVERTISE_100_FULL;
|
||||
break;
|
||||
case SPEED_1000 + DUPLEX_FULL:
|
||||
mac->autoneg = 1;
|
||||
adapter->hw.phy.autoneg_advertised = ADVERTISE_1000_FULL;
|
||||
if (adapter->hw.phy.media_type == e1000_media_type_copper) {
|
||||
mac->autoneg = 1;
|
||||
adapter->hw.phy.autoneg_advertised =
|
||||
ADVERTISE_1000_FULL;
|
||||
} else {
|
||||
mac->forced_speed_duplex = ADVERTISE_1000_FULL;
|
||||
}
|
||||
break;
|
||||
case SPEED_1000 + DUPLEX_HALF: /* not supported */
|
||||
default:
|
||||
@ -439,8 +447,9 @@ static void e1000_get_regs(struct net_device *netdev,
|
||||
|
||||
memset(p, 0, E1000_REGS_LEN * sizeof(u32));
|
||||
|
||||
regs->version = (1 << 24) | (adapter->pdev->revision << 16) |
|
||||
adapter->pdev->device;
|
||||
regs->version = (1u << 24) |
|
||||
(adapter->pdev->revision << 16) |
|
||||
adapter->pdev->device;
|
||||
|
||||
regs_buff[0] = er32(CTRL);
|
||||
regs_buff[1] = er32(STATUS);
|
||||
@ -895,7 +904,7 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data)
|
||||
case e1000_pch2lan:
|
||||
case e1000_pch_lpt:
|
||||
case e1000_pch_spt:
|
||||
mask |= (1 << 18);
|
||||
mask |= BIT(18);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -914,9 +923,9 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data)
|
||||
|
||||
/* SHRAH[9] different than the others */
|
||||
if (i == 10)
|
||||
mask |= (1 << 30);
|
||||
mask |= BIT(30);
|
||||
else
|
||||
mask &= ~(1 << 30);
|
||||
mask &= ~BIT(30);
|
||||
}
|
||||
if (mac->type == e1000_pch2lan) {
|
||||
/* SHRAH[0,1,2] different than previous */
|
||||
@ -924,7 +933,7 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data)
|
||||
mask &= 0xFFF4FFFF;
|
||||
/* SHRAH[3] different than SHRAH[0,1,2] */
|
||||
if (i == 4)
|
||||
mask |= (1 << 30);
|
||||
mask |= BIT(30);
|
||||
/* RAR[1-6] owned by management engine - skipping */
|
||||
if (i > 0)
|
||||
i += 6;
|
||||
@ -1019,7 +1028,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
|
||||
/* Test each interrupt */
|
||||
for (i = 0; i < 10; i++) {
|
||||
/* Interrupt to test */
|
||||
mask = 1 << i;
|
||||
mask = BIT(i);
|
||||
|
||||
if (adapter->flags & FLAG_IS_ICH) {
|
||||
switch (mask) {
|
||||
@ -1387,7 +1396,7 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
|
||||
case e1000_phy_82579:
|
||||
/* Disable PHY energy detect power down */
|
||||
e1e_rphy(hw, PHY_REG(0, 21), &phy_reg);
|
||||
e1e_wphy(hw, PHY_REG(0, 21), phy_reg & ~(1 << 3));
|
||||
e1e_wphy(hw, PHY_REG(0, 21), phy_reg & ~BIT(3));
|
||||
/* Disable full chip energy detect */
|
||||
e1e_rphy(hw, PHY_REG(776, 18), &phy_reg);
|
||||
e1e_wphy(hw, PHY_REG(776, 18), phy_reg | 1);
|
||||
@ -1453,7 +1462,7 @@ static int e1000_set_82571_fiber_loopback(struct e1000_adapter *adapter)
|
||||
|
||||
/* disable autoneg */
|
||||
ctrl = er32(TXCW);
|
||||
ctrl &= ~(1 << 31);
|
||||
ctrl &= ~BIT(31);
|
||||
ew32(TXCW, ctrl);
|
||||
|
||||
link = (er32(STATUS) & E1000_STATUS_LU);
|
||||
@ -2283,19 +2292,19 @@ static int e1000e_get_ts_info(struct net_device *netdev,
|
||||
SOF_TIMESTAMPING_RX_HARDWARE |
|
||||
SOF_TIMESTAMPING_RAW_HARDWARE);
|
||||
|
||||
info->tx_types = (1 << HWTSTAMP_TX_OFF) | (1 << HWTSTAMP_TX_ON);
|
||||
info->tx_types = BIT(HWTSTAMP_TX_OFF) | BIT(HWTSTAMP_TX_ON);
|
||||
|
||||
info->rx_filters = ((1 << HWTSTAMP_FILTER_NONE) |
|
||||
(1 << HWTSTAMP_FILTER_PTP_V1_L4_SYNC) |
|
||||
(1 << HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ) |
|
||||
(1 << HWTSTAMP_FILTER_PTP_V2_L4_SYNC) |
|
||||
(1 << HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ) |
|
||||
(1 << HWTSTAMP_FILTER_PTP_V2_L2_SYNC) |
|
||||
(1 << HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ) |
|
||||
(1 << HWTSTAMP_FILTER_PTP_V2_EVENT) |
|
||||
(1 << HWTSTAMP_FILTER_PTP_V2_SYNC) |
|
||||
(1 << HWTSTAMP_FILTER_PTP_V2_DELAY_REQ) |
|
||||
(1 << HWTSTAMP_FILTER_ALL));
|
||||
info->rx_filters = (BIT(HWTSTAMP_FILTER_NONE) |
|
||||
BIT(HWTSTAMP_FILTER_PTP_V1_L4_SYNC) |
|
||||
BIT(HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ) |
|
||||
BIT(HWTSTAMP_FILTER_PTP_V2_L4_SYNC) |
|
||||
BIT(HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ) |
|
||||
BIT(HWTSTAMP_FILTER_PTP_V2_L2_SYNC) |
|
||||
BIT(HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ) |
|
||||
BIT(HWTSTAMP_FILTER_PTP_V2_EVENT) |
|
||||
BIT(HWTSTAMP_FILTER_PTP_V2_SYNC) |
|
||||
BIT(HWTSTAMP_FILTER_PTP_V2_DELAY_REQ) |
|
||||
BIT(HWTSTAMP_FILTER_ALL));
|
||||
|
||||
if (adapter->ptp_clock)
|
||||
info->phc_index = ptp_clock_index(adapter->ptp_clock);
|
||||
|
@ -1048,7 +1048,7 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link)
|
||||
|
||||
while (value > PCI_LTR_VALUE_MASK) {
|
||||
scale++;
|
||||
value = DIV_ROUND_UP(value, (1 << 5));
|
||||
value = DIV_ROUND_UP(value, BIT(5));
|
||||
}
|
||||
if (scale > E1000_LTRV_SCALE_MAX) {
|
||||
e_dbg("Invalid LTR latency scale %d\n", scale);
|
||||
@ -1573,7 +1573,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
|
||||
phy_reg &= ~HV_KMRN_FIFO_CTRLSTA_PREAMBLE_MASK;
|
||||
|
||||
if ((er32(STATUS) & E1000_STATUS_FD) != E1000_STATUS_FD)
|
||||
phy_reg |= (1 << HV_KMRN_FIFO_CTRLSTA_PREAMBLE_SHIFT);
|
||||
phy_reg |= BIT(HV_KMRN_FIFO_CTRLSTA_PREAMBLE_SHIFT);
|
||||
|
||||
e1e_wphy(hw, HV_KMRN_FIFO_CTRLSTA, phy_reg);
|
||||
break;
|
||||
@ -2044,9 +2044,9 @@ static s32 e1000_write_smbus_addr(struct e1000_hw *hw)
|
||||
/* Restore SMBus frequency */
|
||||
if (freq--) {
|
||||
phy_data &= ~HV_SMB_ADDR_FREQ_MASK;
|
||||
phy_data |= (freq & (1 << 0)) <<
|
||||
phy_data |= (freq & BIT(0)) <<
|
||||
HV_SMB_ADDR_FREQ_LOW_SHIFT;
|
||||
phy_data |= (freq & (1 << 1)) <<
|
||||
phy_data |= (freq & BIT(1)) <<
|
||||
(HV_SMB_ADDR_FREQ_HIGH_SHIFT - 1);
|
||||
} else {
|
||||
e_dbg("Unsupported SMB frequency in PHY\n");
|
||||
@ -2530,7 +2530,7 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable)
|
||||
|
||||
/* disable Rx path while enabling/disabling workaround */
|
||||
e1e_rphy(hw, PHY_REG(769, 20), &phy_reg);
|
||||
ret_val = e1e_wphy(hw, PHY_REG(769, 20), phy_reg | (1 << 14));
|
||||
ret_val = e1e_wphy(hw, PHY_REG(769, 20), phy_reg | BIT(14));
|
||||
if (ret_val)
|
||||
return ret_val;
|
||||
|
||||
@ -2561,7 +2561,7 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable)
|
||||
|
||||
/* Enable jumbo frame workaround in the MAC */
|
||||
mac_reg = er32(FFLT_DBG);
|
||||
mac_reg &= ~(1 << 14);
|
||||
mac_reg &= ~BIT(14);
|
||||
mac_reg |= (7 << 15);
|
||||
ew32(FFLT_DBG, mac_reg);
|
||||
|
||||
@ -2576,7 +2576,7 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable)
|
||||
return ret_val;
|
||||
ret_val = e1000e_write_kmrn_reg(hw,
|
||||
E1000_KMRNCTRLSTA_CTRL_OFFSET,
|
||||
data | (1 << 0));
|
||||
data | BIT(0));
|
||||
if (ret_val)
|
||||
return ret_val;
|
||||
ret_val = e1000e_read_kmrn_reg(hw,
|
||||
@ -2600,7 +2600,7 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable)
|
||||
if (ret_val)
|
||||
return ret_val;
|
||||
e1e_rphy(hw, PHY_REG(769, 16), &data);
|
||||
data &= ~(1 << 13);
|
||||
data &= ~BIT(13);
|
||||
ret_val = e1e_wphy(hw, PHY_REG(769, 16), data);
|
||||
if (ret_val)
|
||||
return ret_val;
|
||||
@ -2614,7 +2614,7 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable)
|
||||
if (ret_val)
|
||||
return ret_val;
|
||||
e1e_rphy(hw, HV_PM_CTRL, &data);
|
||||
ret_val = e1e_wphy(hw, HV_PM_CTRL, data | (1 << 10));
|
||||
ret_val = e1e_wphy(hw, HV_PM_CTRL, data | BIT(10));
|
||||
if (ret_val)
|
||||
return ret_val;
|
||||
} else {
|
||||
@ -2634,7 +2634,7 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable)
|
||||
return ret_val;
|
||||
ret_val = e1000e_write_kmrn_reg(hw,
|
||||
E1000_KMRNCTRLSTA_CTRL_OFFSET,
|
||||
data & ~(1 << 0));
|
||||
data & ~BIT(0));
|
||||
if (ret_val)
|
||||
return ret_val;
|
||||
ret_val = e1000e_read_kmrn_reg(hw,
|
||||
@ -2657,7 +2657,7 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable)
|
||||
if (ret_val)
|
||||
return ret_val;
|
||||
e1e_rphy(hw, PHY_REG(769, 16), &data);
|
||||
data |= (1 << 13);
|
||||
data |= BIT(13);
|
||||
ret_val = e1e_wphy(hw, PHY_REG(769, 16), data);
|
||||
if (ret_val)
|
||||
return ret_val;
|
||||
@ -2671,13 +2671,13 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable)
|
||||
if (ret_val)
|
||||
return ret_val;
|
||||
e1e_rphy(hw, HV_PM_CTRL, &data);
|
||||
ret_val = e1e_wphy(hw, HV_PM_CTRL, data & ~(1 << 10));
|
||||
ret_val = e1e_wphy(hw, HV_PM_CTRL, data & ~BIT(10));
|
||||
if (ret_val)
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/* re-enable Rx path after enabling/disabling workaround */
|
||||
return e1e_wphy(hw, PHY_REG(769, 20), phy_reg & ~(1 << 14));
|
||||
return e1e_wphy(hw, PHY_REG(769, 20), phy_reg & ~BIT(14));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4841,7 +4841,7 @@ static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw)
|
||||
|
||||
/* Extended Device Control */
|
||||
reg = er32(CTRL_EXT);
|
||||
reg |= (1 << 22);
|
||||
reg |= BIT(22);
|
||||
/* Enable PHY low-power state when MAC is at D3 w/o WoL */
|
||||
if (hw->mac.type >= e1000_pchlan)
|
||||
reg |= E1000_CTRL_EXT_PHYPDEN;
|
||||
@ -4849,34 +4849,34 @@ static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw)
|
||||
|
||||
/* Transmit Descriptor Control 0 */
|
||||
reg = er32(TXDCTL(0));
|
||||
reg |= (1 << 22);
|
||||
reg |= BIT(22);
|
||||
ew32(TXDCTL(0), reg);
|
||||
|
||||
/* Transmit Descriptor Control 1 */
|
||||
reg = er32(TXDCTL(1));
|
||||
reg |= (1 << 22);
|
||||
reg |= BIT(22);
|
||||
ew32(TXDCTL(1), reg);
|
||||
|
||||
/* Transmit Arbitration Control 0 */
|
||||
reg = er32(TARC(0));
|
||||
if (hw->mac.type == e1000_ich8lan)
|
||||
reg |= (1 << 28) | (1 << 29);
|
||||
reg |= (1 << 23) | (1 << 24) | (1 << 26) | (1 << 27);
|
||||
reg |= BIT(28) | BIT(29);
|
||||
reg |= BIT(23) | BIT(24) | BIT(26) | BIT(27);
|
||||
ew32(TARC(0), reg);
|
||||
|
||||
/* Transmit Arbitration Control 1 */
|
||||
reg = er32(TARC(1));
|
||||
if (er32(TCTL) & E1000_TCTL_MULR)
|
||||
reg &= ~(1 << 28);
|
||||
reg &= ~BIT(28);
|
||||
else
|
||||
reg |= (1 << 28);
|
||||
reg |= (1 << 24) | (1 << 26) | (1 << 30);
|
||||
reg |= BIT(28);
|
||||
reg |= BIT(24) | BIT(26) | BIT(30);
|
||||
ew32(TARC(1), reg);
|
||||
|
||||
/* Device Status */
|
||||
if (hw->mac.type == e1000_ich8lan) {
|
||||
reg = er32(STATUS);
|
||||
reg &= ~(1 << 31);
|
||||
reg &= ~BIT(31);
|
||||
ew32(STATUS, reg);
|
||||
}
|
||||
|
||||
|
@ -73,10 +73,10 @@
|
||||
(ID_LED_OFF1_ON2 << 4) | \
|
||||
(ID_LED_DEF1_DEF2))
|
||||
|
||||
#define E1000_ICH_NVM_SIG_WORD 0x13
|
||||
#define E1000_ICH_NVM_SIG_MASK 0xC000
|
||||
#define E1000_ICH_NVM_VALID_SIG_MASK 0xC0
|
||||
#define E1000_ICH_NVM_SIG_VALUE 0x80
|
||||
#define E1000_ICH_NVM_SIG_WORD 0x13u
|
||||
#define E1000_ICH_NVM_SIG_MASK 0xC000u
|
||||
#define E1000_ICH_NVM_VALID_SIG_MASK 0xC0u
|
||||
#define E1000_ICH_NVM_SIG_VALUE 0x80u
|
||||
|
||||
#define E1000_ICH8_LAN_INIT_TIMEOUT 1500
|
||||
|
||||
|
@ -346,7 +346,7 @@ void e1000e_update_mc_addr_list_generic(struct e1000_hw *hw,
|
||||
hash_reg = (hash_value >> 5) & (hw->mac.mta_reg_count - 1);
|
||||
hash_bit = hash_value & 0x1F;
|
||||
|
||||
hw->mac.mta_shadow[hash_reg] |= (1 << hash_bit);
|
||||
hw->mac.mta_shadow[hash_reg] |= BIT(hash_bit);
|
||||
mc_addr_list += (ETH_ALEN);
|
||||
}
|
||||
|
||||
|
@ -317,8 +317,8 @@ static void e1000e_dump(struct e1000_adapter *adapter)
|
||||
else
|
||||
next_desc = "";
|
||||
pr_info("T%c[0x%03X] %016llX %016llX %016llX %04X %3X %016llX %p%s\n",
|
||||
(!(le64_to_cpu(u0->b) & (1 << 29)) ? 'l' :
|
||||
((le64_to_cpu(u0->b) & (1 << 20)) ? 'd' : 'c')),
|
||||
(!(le64_to_cpu(u0->b) & BIT(29)) ? 'l' :
|
||||
((le64_to_cpu(u0->b) & BIT(20)) ? 'd' : 'c')),
|
||||
i,
|
||||
(unsigned long long)le64_to_cpu(u0->a),
|
||||
(unsigned long long)le64_to_cpu(u0->b),
|
||||
@ -2018,7 +2018,7 @@ static void e1000_configure_msix(struct e1000_adapter *adapter)
|
||||
adapter->eiac_mask |= E1000_IMS_OTHER;
|
||||
|
||||
/* Cause Tx interrupts on every write back */
|
||||
ivar |= (1 << 31);
|
||||
ivar |= BIT(31);
|
||||
|
||||
ew32(IVAR, ivar);
|
||||
|
||||
@ -2709,7 +2709,7 @@ static int e1000_vlan_rx_add_vid(struct net_device *netdev,
|
||||
if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) {
|
||||
index = (vid >> 5) & 0x7F;
|
||||
vfta = E1000_READ_REG_ARRAY(hw, E1000_VFTA, index);
|
||||
vfta |= (1 << (vid & 0x1F));
|
||||
vfta |= BIT((vid & 0x1F));
|
||||
hw->mac.ops.write_vfta(hw, index, vfta);
|
||||
}
|
||||
|
||||
@ -2737,7 +2737,7 @@ static int e1000_vlan_rx_kill_vid(struct net_device *netdev,
|
||||
if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) {
|
||||
index = (vid >> 5) & 0x7F;
|
||||
vfta = E1000_READ_REG_ARRAY(hw, E1000_VFTA, index);
|
||||
vfta &= ~(1 << (vid & 0x1F));
|
||||
vfta &= ~BIT((vid & 0x1F));
|
||||
hw->mac.ops.write_vfta(hw, index, vfta);
|
||||
}
|
||||
|
||||
@ -2878,7 +2878,7 @@ static void e1000_init_manageability_pt(struct e1000_adapter *adapter)
|
||||
|
||||
/* Enable this decision filter in MANC2H */
|
||||
if (mdef)
|
||||
manc2h |= (1 << i);
|
||||
manc2h |= BIT(i);
|
||||
|
||||
j |= mdef;
|
||||
}
|
||||
@ -2891,7 +2891,7 @@ static void e1000_init_manageability_pt(struct e1000_adapter *adapter)
|
||||
if (er32(MDEF(i)) == 0) {
|
||||
ew32(MDEF(i), (E1000_MDEF_PORT_623 |
|
||||
E1000_MDEF_PORT_664));
|
||||
manc2h |= (1 << 1);
|
||||
manc2h |= BIT(1);
|
||||
j++;
|
||||
break;
|
||||
}
|
||||
@ -2971,7 +2971,7 @@ static void e1000_configure_tx(struct e1000_adapter *adapter)
|
||||
/* set the speed mode bit, we'll clear it if we're not at
|
||||
* gigabit link later
|
||||
*/
|
||||
#define SPEED_MODE_BIT (1 << 21)
|
||||
#define SPEED_MODE_BIT BIT(21)
|
||||
tarc |= SPEED_MODE_BIT;
|
||||
ew32(TARC(0), tarc);
|
||||
}
|
||||
@ -3071,12 +3071,12 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
|
||||
|
||||
e1e_rphy(hw, PHY_REG(770, 26), &phy_data);
|
||||
phy_data &= 0xfff8;
|
||||
phy_data |= (1 << 2);
|
||||
phy_data |= BIT(2);
|
||||
e1e_wphy(hw, PHY_REG(770, 26), phy_data);
|
||||
|
||||
e1e_rphy(hw, 22, &phy_data);
|
||||
phy_data &= 0x0fff;
|
||||
phy_data |= (1 << 14);
|
||||
phy_data |= BIT(14);
|
||||
e1e_wphy(hw, 0x10, 0x2823);
|
||||
e1e_wphy(hw, 0x11, 0x0003);
|
||||
e1e_wphy(hw, 22, phy_data);
|
||||
@ -3368,12 +3368,12 @@ static int e1000e_write_uc_addr_list(struct net_device *netdev)
|
||||
* combining
|
||||
*/
|
||||
netdev_for_each_uc_addr(ha, netdev) {
|
||||
int rval;
|
||||
int ret_val;
|
||||
|
||||
if (!rar_entries)
|
||||
break;
|
||||
rval = hw->mac.ops.rar_set(hw, ha->addr, rar_entries--);
|
||||
if (rval < 0)
|
||||
ret_val = hw->mac.ops.rar_set(hw, ha->addr, rar_entries--);
|
||||
if (ret_val < 0)
|
||||
return -ENOMEM;
|
||||
count++;
|
||||
}
|
||||
@ -3503,8 +3503,8 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca)
|
||||
!(er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_ENABLED)) {
|
||||
u32 fextnvm7 = er32(FEXTNVM7);
|
||||
|
||||
if (!(fextnvm7 & (1 << 0))) {
|
||||
ew32(FEXTNVM7, fextnvm7 | (1 << 0));
|
||||
if (!(fextnvm7 & BIT(0))) {
|
||||
ew32(FEXTNVM7, fextnvm7 | BIT(0));
|
||||
e1e_flush();
|
||||
}
|
||||
}
|
||||
@ -3580,7 +3580,6 @@ static int e1000e_config_hwtstamp(struct e1000_adapter *adapter,
|
||||
bool is_l4 = false;
|
||||
bool is_l2 = false;
|
||||
u32 regval;
|
||||
s32 ret_val;
|
||||
|
||||
if (!(adapter->flags & FLAG_HAS_HW_TIMESTAMP))
|
||||
return -EINVAL;
|
||||
@ -3719,16 +3718,6 @@ static int e1000e_config_hwtstamp(struct e1000_adapter *adapter,
|
||||
er32(RXSTMPH);
|
||||
er32(TXSTMPH);
|
||||
|
||||
/* Get and set the System Time Register SYSTIM base frequency */
|
||||
ret_val = e1000e_get_base_timinca(adapter, ®val);
|
||||
if (ret_val)
|
||||
return ret_val;
|
||||
ew32(TIMINCA, regval);
|
||||
|
||||
/* reset the ns time counter */
|
||||
timecounter_init(&adapter->tc, &adapter->cc,
|
||||
ktime_to_ns(ktime_get_real()));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3839,7 +3828,7 @@ static void e1000_flush_rx_ring(struct e1000_adapter *adapter)
|
||||
/* update thresholds: prefetch threshold to 31, host threshold to 1
|
||||
* and make sure the granularity is "descriptors" and not "cache lines"
|
||||
*/
|
||||
rxdctl |= (0x1F | (1 << 8) | E1000_RXDCTL_THRESH_UNIT_DESC);
|
||||
rxdctl |= (0x1F | BIT(8) | E1000_RXDCTL_THRESH_UNIT_DESC);
|
||||
|
||||
ew32(RXDCTL(0), rxdctl);
|
||||
/* momentarily enable the RX ring for the changes to take effect */
|
||||
@ -3884,6 +3873,53 @@ static void e1000_flush_desc_rings(struct e1000_adapter *adapter)
|
||||
e1000_flush_rx_ring(adapter);
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000e_systim_reset - reset the timesync registers after a hardware reset
|
||||
* @adapter: board private structure
|
||||
*
|
||||
* When the MAC is reset, all hardware bits for timesync will be reset to the
|
||||
* default values. This function will restore the settings last in place.
|
||||
* Since the clock SYSTIME registers are reset, we will simply restore the
|
||||
* cyclecounter to the kernel real clock time.
|
||||
**/
|
||||
static void e1000e_systim_reset(struct e1000_adapter *adapter)
|
||||
{
|
||||
struct ptp_clock_info *info = &adapter->ptp_clock_info;
|
||||
struct e1000_hw *hw = &adapter->hw;
|
||||
unsigned long flags;
|
||||
u32 timinca;
|
||||
s32 ret_val;
|
||||
|
||||
if (!(adapter->flags & FLAG_HAS_HW_TIMESTAMP))
|
||||
return;
|
||||
|
||||
if (info->adjfreq) {
|
||||
/* restore the previous ptp frequency delta */
|
||||
ret_val = info->adjfreq(info, adapter->ptp_delta);
|
||||
} else {
|
||||
/* set the default base frequency if no adjustment possible */
|
||||
ret_val = e1000e_get_base_timinca(adapter, &timinca);
|
||||
if (!ret_val)
|
||||
ew32(TIMINCA, timinca);
|
||||
}
|
||||
|
||||
if (ret_val) {
|
||||
dev_warn(&adapter->pdev->dev,
|
||||
"Failed to restore TIMINCA clock rate delta: %d\n",
|
||||
ret_val);
|
||||
return;
|
||||
}
|
||||
|
||||
/* reset the systim ns time counter */
|
||||
spin_lock_irqsave(&adapter->systim_lock, flags);
|
||||
timecounter_init(&adapter->tc, &adapter->cc,
|
||||
ktime_to_ns(ktime_get_real()));
|
||||
spin_unlock_irqrestore(&adapter->systim_lock, flags);
|
||||
|
||||
/* restore the previous hwtstamp configuration settings */
|
||||
e1000e_config_hwtstamp(adapter, &adapter->hwtstamp_config);
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000e_reset - bring the hardware into a known good state
|
||||
*
|
||||
@ -4063,8 +4099,8 @@ void e1000e_reset(struct e1000_adapter *adapter)
|
||||
|
||||
e1000e_reset_adaptive(hw);
|
||||
|
||||
/* initialize systim and reset the ns time counter */
|
||||
e1000e_config_hwtstamp(adapter, &adapter->hwtstamp_config);
|
||||
/* restore systim and hwtstamp settings */
|
||||
e1000e_systim_reset(adapter);
|
||||
|
||||
/* Set EEE advertisement as appropriate */
|
||||
if (adapter->flags2 & FLAG2_HAS_EEE) {
|
||||
@ -4275,7 +4311,7 @@ static cycle_t e1000e_cyclecounter_read(const struct cyclecounter *cc)
|
||||
struct e1000_adapter *adapter = container_of(cc, struct e1000_adapter,
|
||||
cc);
|
||||
struct e1000_hw *hw = &adapter->hw;
|
||||
u32 systimel_1, systimel_2, systimeh;
|
||||
u32 systimel, systimeh;
|
||||
cycle_t systim, systim_next;
|
||||
/* SYSTIMH latching upon SYSTIML read does not work well.
|
||||
* This means that if SYSTIML overflows after we read it but before
|
||||
@ -4283,24 +4319,25 @@ static cycle_t e1000e_cyclecounter_read(const struct cyclecounter *cc)
|
||||
* will experience a huge non linear increment in the systime value
|
||||
* to fix that we test for overflow and if true, we re-read systime.
|
||||
*/
|
||||
systimel_1 = er32(SYSTIML);
|
||||
systimel = er32(SYSTIML);
|
||||
systimeh = er32(SYSTIMH);
|
||||
systimel_2 = er32(SYSTIML);
|
||||
/* Check for overflow. If there was no overflow, use the values */
|
||||
if (systimel_1 < systimel_2) {
|
||||
systim = (cycle_t)systimel_1;
|
||||
systim |= (cycle_t)systimeh << 32;
|
||||
} else {
|
||||
/* There was an overflow, read again SYSTIMH, and use
|
||||
* systimel_2
|
||||
*/
|
||||
systimeh = er32(SYSTIMH);
|
||||
systim = (cycle_t)systimel_2;
|
||||
systim |= (cycle_t)systimeh << 32;
|
||||
/* Is systimel is so large that overflow is possible? */
|
||||
if (systimel >= (u32)0xffffffff - E1000_TIMINCA_INCVALUE_MASK) {
|
||||
u32 systimel_2 = er32(SYSTIML);
|
||||
if (systimel > systimel_2) {
|
||||
/* There was an overflow, read again SYSTIMH, and use
|
||||
* systimel_2
|
||||
*/
|
||||
systimeh = er32(SYSTIMH);
|
||||
systimel = systimel_2;
|
||||
}
|
||||
}
|
||||
systim = (cycle_t)systimel;
|
||||
systim |= (cycle_t)systimeh << 32;
|
||||
|
||||
if ((hw->mac.type == e1000_82574) || (hw->mac.type == e1000_82583)) {
|
||||
u64 incvalue, time_delta, rem, temp;
|
||||
u64 time_delta, rem, temp;
|
||||
u32 incvalue;
|
||||
int i;
|
||||
|
||||
/* errata for 82574/82583 possible bad bits read from SYSTIMH/L
|
||||
@ -6861,7 +6898,7 @@ static void e1000_eeprom_checks(struct e1000_adapter *adapter)
|
||||
|
||||
ret_val = e1000_read_nvm(hw, NVM_INIT_CONTROL2_REG, 1, &buf);
|
||||
le16_to_cpus(&buf);
|
||||
if (!ret_val && (!(buf & (1 << 0)))) {
|
||||
if (!ret_val && (!(buf & BIT(0)))) {
|
||||
/* Deep Smart Power Down (DSPD) */
|
||||
dev_warn(&adapter->pdev->dev,
|
||||
"Warning: detected DSPD enabled in EEPROM\n");
|
||||
@ -6965,7 +7002,7 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
int bars, i, err, pci_using_dac;
|
||||
u16 eeprom_data = 0;
|
||||
u16 eeprom_apme_mask = E1000_EEPROM_APME;
|
||||
s32 rval = 0;
|
||||
s32 ret_val = 0;
|
||||
|
||||
if (ei->flags2 & FLAG2_DISABLE_ASPM_L0S)
|
||||
aspm_disable_flag = PCIE_LINK_STATE_L0S;
|
||||
@ -7200,18 +7237,18 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
} else if (adapter->flags & FLAG_APME_IN_CTRL3) {
|
||||
if (adapter->flags & FLAG_APME_CHECK_PORT_B &&
|
||||
(adapter->hw.bus.func == 1))
|
||||
rval = e1000_read_nvm(&adapter->hw,
|
||||
ret_val = e1000_read_nvm(&adapter->hw,
|
||||
NVM_INIT_CONTROL3_PORT_B,
|
||||
1, &eeprom_data);
|
||||
else
|
||||
rval = e1000_read_nvm(&adapter->hw,
|
||||
ret_val = e1000_read_nvm(&adapter->hw,
|
||||
NVM_INIT_CONTROL3_PORT_A,
|
||||
1, &eeprom_data);
|
||||
}
|
||||
|
||||
/* fetch WoL from EEPROM */
|
||||
if (rval)
|
||||
e_dbg("NVM read error getting WoL initial values: %d\n", rval);
|
||||
if (ret_val)
|
||||
e_dbg("NVM read error getting WoL initial values: %d\n", ret_val);
|
||||
else if (eeprom_data & eeprom_apme_mask)
|
||||
adapter->eeprom_wol |= E1000_WUFC_MAG;
|
||||
|
||||
@ -7231,13 +7268,16 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
device_wakeup_enable(&pdev->dev);
|
||||
|
||||
/* save off EEPROM version number */
|
||||
rval = e1000_read_nvm(&adapter->hw, 5, 1, &adapter->eeprom_vers);
|
||||
ret_val = e1000_read_nvm(&adapter->hw, 5, 1, &adapter->eeprom_vers);
|
||||
|
||||
if (rval) {
|
||||
e_dbg("NVM read error getting EEPROM version: %d\n", rval);
|
||||
if (ret_val) {
|
||||
e_dbg("NVM read error getting EEPROM version: %d\n", ret_val);
|
||||
adapter->eeprom_vers = 0;
|
||||
}
|
||||
|
||||
/* init PTP hardware clock */
|
||||
e1000e_ptp_init(adapter);
|
||||
|
||||
/* reset the hardware with the new settings */
|
||||
e1000e_reset(adapter);
|
||||
|
||||
@ -7256,9 +7296,6 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
/* carrier off reporting is important to ethtool even BEFORE open */
|
||||
netif_carrier_off(netdev);
|
||||
|
||||
/* init PTP hardware clock */
|
||||
e1000e_ptp_init(adapter);
|
||||
|
||||
e1000_print_device_info(adapter);
|
||||
|
||||
if (pci_dev_run_wake(pdev))
|
||||
|
@ -67,7 +67,7 @@ static void e1000_shift_out_eec_bits(struct e1000_hw *hw, u16 data, u16 count)
|
||||
u32 eecd = er32(EECD);
|
||||
u32 mask;
|
||||
|
||||
mask = 0x01 << (count - 1);
|
||||
mask = BIT(count - 1);
|
||||
if (nvm->type == e1000_nvm_eeprom_spi)
|
||||
eecd |= E1000_EECD_DO;
|
||||
|
||||
|
@ -2894,11 +2894,11 @@ static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data,
|
||||
if ((hw->phy.type == e1000_phy_82578) &&
|
||||
(hw->phy.revision >= 1) &&
|
||||
(hw->phy.addr == 2) &&
|
||||
!(MAX_PHY_REG_ADDRESS & reg) && (data & (1 << 11))) {
|
||||
!(MAX_PHY_REG_ADDRESS & reg) && (data & BIT(11))) {
|
||||
u16 data2 = 0x7EFF;
|
||||
|
||||
ret_val = e1000_access_phy_debug_regs_hv(hw,
|
||||
(1 << 6) | 0x3,
|
||||
BIT(6) | 0x3,
|
||||
&data2, false);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
@ -104,9 +104,9 @@ s32 e1000_get_cable_length_82577(struct e1000_hw *hw);
|
||||
#define BM_WUC_DATA_OPCODE 0x12
|
||||
#define BM_WUC_ENABLE_PAGE BM_PORT_CTRL_PAGE
|
||||
#define BM_WUC_ENABLE_REG 17
|
||||
#define BM_WUC_ENABLE_BIT (1 << 2)
|
||||
#define BM_WUC_HOST_WU_BIT (1 << 4)
|
||||
#define BM_WUC_ME_WU_BIT (1 << 5)
|
||||
#define BM_WUC_ENABLE_BIT BIT(2)
|
||||
#define BM_WUC_HOST_WU_BIT BIT(4)
|
||||
#define BM_WUC_ME_WU_BIT BIT(5)
|
||||
|
||||
#define PHY_UPPER_SHIFT 21
|
||||
#define BM_PHY_REG(page, reg) \
|
||||
@ -124,8 +124,8 @@ s32 e1000_get_cable_length_82577(struct e1000_hw *hw);
|
||||
#define I82578_ADDR_REG 29
|
||||
#define I82577_ADDR_REG 16
|
||||
#define I82577_CFG_REG 22
|
||||
#define I82577_CFG_ASSERT_CRS_ON_TX (1 << 15)
|
||||
#define I82577_CFG_ENABLE_DOWNSHIFT (3 << 10) /* auto downshift */
|
||||
#define I82577_CFG_ASSERT_CRS_ON_TX BIT(15)
|
||||
#define I82577_CFG_ENABLE_DOWNSHIFT (3u << 10) /* auto downshift */
|
||||
#define I82577_CTRL_REG 23
|
||||
|
||||
/* 82577 specific PHY registers */
|
||||
|
@ -79,6 +79,8 @@ static int e1000e_phc_adjfreq(struct ptp_clock_info *ptp, s32 delta)
|
||||
|
||||
ew32(TIMINCA, timinca);
|
||||
|
||||
adapter->ptp_delta = delta;
|
||||
|
||||
spin_unlock_irqrestore(&adapter->systim_lock, flags);
|
||||
|
||||
return 0;
|
||||
|
@ -361,7 +361,7 @@ static s32 igb_init_nvm_params_82575(struct e1000_hw *hw)
|
||||
if (size > 15)
|
||||
size = 15;
|
||||
|
||||
nvm->word_size = 1 << size;
|
||||
nvm->word_size = BIT(size);
|
||||
nvm->opcode_bits = 8;
|
||||
nvm->delay_usec = 1;
|
||||
|
||||
@ -380,7 +380,7 @@ static s32 igb_init_nvm_params_82575(struct e1000_hw *hw)
|
||||
16 : 8;
|
||||
break;
|
||||
}
|
||||
if (nvm->word_size == (1 << 15))
|
||||
if (nvm->word_size == BIT(15))
|
||||
nvm->page_size = 128;
|
||||
|
||||
nvm->type = e1000_nvm_eeprom_spi;
|
||||
@ -391,7 +391,7 @@ static s32 igb_init_nvm_params_82575(struct e1000_hw *hw)
|
||||
nvm->ops.write = igb_write_nvm_spi;
|
||||
nvm->ops.validate = igb_validate_nvm_checksum;
|
||||
nvm->ops.update = igb_update_nvm_checksum;
|
||||
if (nvm->word_size < (1 << 15))
|
||||
if (nvm->word_size < BIT(15))
|
||||
nvm->ops.read = igb_read_nvm_eerd;
|
||||
else
|
||||
nvm->ops.read = igb_read_nvm_spi;
|
||||
@ -2107,7 +2107,7 @@ void igb_vmdq_set_anti_spoofing_pf(struct e1000_hw *hw, bool enable, int pf)
|
||||
/* The PF can spoof - it has to in order to
|
||||
* support emulation mode NICs
|
||||
*/
|
||||
reg_val ^= (1 << pf | 1 << (pf + MAX_NUM_VFS));
|
||||
reg_val ^= (BIT(pf) | BIT(pf + MAX_NUM_VFS));
|
||||
} else {
|
||||
reg_val &= ~(E1000_DTXSWC_MAC_SPOOF_MASK |
|
||||
E1000_DTXSWC_VLAN_SPOOF_MASK);
|
||||
|
@ -168,16 +168,16 @@ struct e1000_adv_tx_context_desc {
|
||||
#define E1000_DCA_CTRL_DCA_MODE_CB2 0x02 /* DCA Mode CB2 */
|
||||
|
||||
#define E1000_DCA_RXCTRL_CPUID_MASK 0x0000001F /* Rx CPUID Mask */
|
||||
#define E1000_DCA_RXCTRL_DESC_DCA_EN (1 << 5) /* DCA Rx Desc enable */
|
||||
#define E1000_DCA_RXCTRL_HEAD_DCA_EN (1 << 6) /* DCA Rx Desc header enable */
|
||||
#define E1000_DCA_RXCTRL_DATA_DCA_EN (1 << 7) /* DCA Rx Desc payload enable */
|
||||
#define E1000_DCA_RXCTRL_DESC_RRO_EN (1 << 9) /* DCA Rx rd Desc Relax Order */
|
||||
#define E1000_DCA_RXCTRL_DESC_DCA_EN BIT(5) /* DCA Rx Desc enable */
|
||||
#define E1000_DCA_RXCTRL_HEAD_DCA_EN BIT(6) /* DCA Rx Desc header enable */
|
||||
#define E1000_DCA_RXCTRL_DATA_DCA_EN BIT(7) /* DCA Rx Desc payload enable */
|
||||
#define E1000_DCA_RXCTRL_DESC_RRO_EN BIT(9) /* DCA Rx rd Desc Relax Order */
|
||||
|
||||
#define E1000_DCA_TXCTRL_CPUID_MASK 0x0000001F /* Tx CPUID Mask */
|
||||
#define E1000_DCA_TXCTRL_DESC_DCA_EN (1 << 5) /* DCA Tx Desc enable */
|
||||
#define E1000_DCA_TXCTRL_DESC_RRO_EN (1 << 9) /* Tx rd Desc Relax Order */
|
||||
#define E1000_DCA_TXCTRL_TX_WB_RO_EN (1 << 11) /* Tx Desc writeback RO bit */
|
||||
#define E1000_DCA_TXCTRL_DATA_RRO_EN (1 << 13) /* Tx rd data Relax Order */
|
||||
#define E1000_DCA_TXCTRL_DESC_DCA_EN BIT(5) /* DCA Tx Desc enable */
|
||||
#define E1000_DCA_TXCTRL_DESC_RRO_EN BIT(9) /* Tx rd Desc Relax Order */
|
||||
#define E1000_DCA_TXCTRL_TX_WB_RO_EN BIT(11) /* Tx Desc writeback RO bit */
|
||||
#define E1000_DCA_TXCTRL_DATA_RRO_EN BIT(13) /* Tx rd data Relax Order */
|
||||
|
||||
/* Additional DCA related definitions, note change in position of CPUID */
|
||||
#define E1000_DCA_TXCTRL_CPUID_MASK_82576 0xFF000000 /* Tx CPUID Mask */
|
||||
@ -186,8 +186,8 @@ struct e1000_adv_tx_context_desc {
|
||||
#define E1000_DCA_RXCTRL_CPUID_SHIFT 24 /* Rx CPUID now in the last byte */
|
||||
|
||||
/* ETQF register bit definitions */
|
||||
#define E1000_ETQF_FILTER_ENABLE (1 << 26)
|
||||
#define E1000_ETQF_1588 (1 << 30)
|
||||
#define E1000_ETQF_FILTER_ENABLE BIT(26)
|
||||
#define E1000_ETQF_1588 BIT(30)
|
||||
|
||||
/* FTQF register bit definitions */
|
||||
#define E1000_FTQF_VF_BP 0x00008000
|
||||
@ -203,16 +203,16 @@ struct e1000_adv_tx_context_desc {
|
||||
#define E1000_DTXSWC_VLAN_SPOOF_MASK 0x0000FF00 /* Per VF VLAN spoof control */
|
||||
#define E1000_DTXSWC_LLE_MASK 0x00FF0000 /* Per VF Local LB enables */
|
||||
#define E1000_DTXSWC_VLAN_SPOOF_SHIFT 8
|
||||
#define E1000_DTXSWC_VMDQ_LOOPBACK_EN (1 << 31) /* global VF LB enable */
|
||||
#define E1000_DTXSWC_VMDQ_LOOPBACK_EN BIT(31) /* global VF LB enable */
|
||||
|
||||
/* Easy defines for setting default pool, would normally be left a zero */
|
||||
#define E1000_VT_CTL_DEFAULT_POOL_SHIFT 7
|
||||
#define E1000_VT_CTL_DEFAULT_POOL_MASK (0x7 << E1000_VT_CTL_DEFAULT_POOL_SHIFT)
|
||||
|
||||
/* Other useful VMD_CTL register defines */
|
||||
#define E1000_VT_CTL_IGNORE_MAC (1 << 28)
|
||||
#define E1000_VT_CTL_DISABLE_DEF_POOL (1 << 29)
|
||||
#define E1000_VT_CTL_VM_REPL_EN (1 << 30)
|
||||
#define E1000_VT_CTL_IGNORE_MAC BIT(28)
|
||||
#define E1000_VT_CTL_DISABLE_DEF_POOL BIT(29)
|
||||
#define E1000_VT_CTL_VM_REPL_EN BIT(30)
|
||||
|
||||
/* Per VM Offload register setup */
|
||||
#define E1000_VMOLR_RLPML_MASK 0x00003FFF /* Long Packet Maximum Length mask */
|
||||
@ -252,7 +252,7 @@ struct e1000_adv_tx_context_desc {
|
||||
#define E1000_DTXCTL_MDP_EN 0x0020
|
||||
#define E1000_DTXCTL_SPOOF_INT 0x0040
|
||||
|
||||
#define E1000_EEPROM_PCS_AUTONEG_DISABLE_BIT (1 << 14)
|
||||
#define E1000_EEPROM_PCS_AUTONEG_DISABLE_BIT BIT(14)
|
||||
|
||||
#define ALL_QUEUES 0xFFFF
|
||||
|
||||
|
@ -530,65 +530,65 @@
|
||||
|
||||
/* Time Sync Interrupt Cause/Mask Register Bits */
|
||||
|
||||
#define TSINTR_SYS_WRAP (1 << 0) /* SYSTIM Wrap around. */
|
||||
#define TSINTR_TXTS (1 << 1) /* Transmit Timestamp. */
|
||||
#define TSINTR_RXTS (1 << 2) /* Receive Timestamp. */
|
||||
#define TSINTR_TT0 (1 << 3) /* Target Time 0 Trigger. */
|
||||
#define TSINTR_TT1 (1 << 4) /* Target Time 1 Trigger. */
|
||||
#define TSINTR_AUTT0 (1 << 5) /* Auxiliary Timestamp 0 Taken. */
|
||||
#define TSINTR_AUTT1 (1 << 6) /* Auxiliary Timestamp 1 Taken. */
|
||||
#define TSINTR_TADJ (1 << 7) /* Time Adjust Done. */
|
||||
#define TSINTR_SYS_WRAP BIT(0) /* SYSTIM Wrap around. */
|
||||
#define TSINTR_TXTS BIT(1) /* Transmit Timestamp. */
|
||||
#define TSINTR_RXTS BIT(2) /* Receive Timestamp. */
|
||||
#define TSINTR_TT0 BIT(3) /* Target Time 0 Trigger. */
|
||||
#define TSINTR_TT1 BIT(4) /* Target Time 1 Trigger. */
|
||||
#define TSINTR_AUTT0 BIT(5) /* Auxiliary Timestamp 0 Taken. */
|
||||
#define TSINTR_AUTT1 BIT(6) /* Auxiliary Timestamp 1 Taken. */
|
||||
#define TSINTR_TADJ BIT(7) /* Time Adjust Done. */
|
||||
|
||||
#define TSYNC_INTERRUPTS TSINTR_TXTS
|
||||
#define E1000_TSICR_TXTS TSINTR_TXTS
|
||||
|
||||
/* TSAUXC Configuration Bits */
|
||||
#define TSAUXC_EN_TT0 (1 << 0) /* Enable target time 0. */
|
||||
#define TSAUXC_EN_TT1 (1 << 1) /* Enable target time 1. */
|
||||
#define TSAUXC_EN_CLK0 (1 << 2) /* Enable Configurable Frequency Clock 0. */
|
||||
#define TSAUXC_SAMP_AUT0 (1 << 3) /* Latch SYSTIML/H into AUXSTMPL/0. */
|
||||
#define TSAUXC_ST0 (1 << 4) /* Start Clock 0 Toggle on Target Time 0. */
|
||||
#define TSAUXC_EN_CLK1 (1 << 5) /* Enable Configurable Frequency Clock 1. */
|
||||
#define TSAUXC_SAMP_AUT1 (1 << 6) /* Latch SYSTIML/H into AUXSTMPL/1. */
|
||||
#define TSAUXC_ST1 (1 << 7) /* Start Clock 1 Toggle on Target Time 1. */
|
||||
#define TSAUXC_EN_TS0 (1 << 8) /* Enable hardware timestamp 0. */
|
||||
#define TSAUXC_AUTT0 (1 << 9) /* Auxiliary Timestamp Taken. */
|
||||
#define TSAUXC_EN_TS1 (1 << 10) /* Enable hardware timestamp 0. */
|
||||
#define TSAUXC_AUTT1 (1 << 11) /* Auxiliary Timestamp Taken. */
|
||||
#define TSAUXC_PLSG (1 << 17) /* Generate a pulse. */
|
||||
#define TSAUXC_DISABLE (1 << 31) /* Disable SYSTIM Count Operation. */
|
||||
#define TSAUXC_EN_TT0 BIT(0) /* Enable target time 0. */
|
||||
#define TSAUXC_EN_TT1 BIT(1) /* Enable target time 1. */
|
||||
#define TSAUXC_EN_CLK0 BIT(2) /* Enable Configurable Frequency Clock 0. */
|
||||
#define TSAUXC_SAMP_AUT0 BIT(3) /* Latch SYSTIML/H into AUXSTMPL/0. */
|
||||
#define TSAUXC_ST0 BIT(4) /* Start Clock 0 Toggle on Target Time 0. */
|
||||
#define TSAUXC_EN_CLK1 BIT(5) /* Enable Configurable Frequency Clock 1. */
|
||||
#define TSAUXC_SAMP_AUT1 BIT(6) /* Latch SYSTIML/H into AUXSTMPL/1. */
|
||||
#define TSAUXC_ST1 BIT(7) /* Start Clock 1 Toggle on Target Time 1. */
|
||||
#define TSAUXC_EN_TS0 BIT(8) /* Enable hardware timestamp 0. */
|
||||
#define TSAUXC_AUTT0 BIT(9) /* Auxiliary Timestamp Taken. */
|
||||
#define TSAUXC_EN_TS1 BIT(10) /* Enable hardware timestamp 0. */
|
||||
#define TSAUXC_AUTT1 BIT(11) /* Auxiliary Timestamp Taken. */
|
||||
#define TSAUXC_PLSG BIT(17) /* Generate a pulse. */
|
||||
#define TSAUXC_DISABLE BIT(31) /* Disable SYSTIM Count Operation. */
|
||||
|
||||
/* SDP Configuration Bits */
|
||||
#define AUX0_SEL_SDP0 (0 << 0) /* Assign SDP0 to auxiliary time stamp 0. */
|
||||
#define AUX0_SEL_SDP1 (1 << 0) /* Assign SDP1 to auxiliary time stamp 0. */
|
||||
#define AUX0_SEL_SDP2 (2 << 0) /* Assign SDP2 to auxiliary time stamp 0. */
|
||||
#define AUX0_SEL_SDP3 (3 << 0) /* Assign SDP3 to auxiliary time stamp 0. */
|
||||
#define AUX0_TS_SDP_EN (1 << 2) /* Enable auxiliary time stamp trigger 0. */
|
||||
#define AUX1_SEL_SDP0 (0 << 3) /* Assign SDP0 to auxiliary time stamp 1. */
|
||||
#define AUX1_SEL_SDP1 (1 << 3) /* Assign SDP1 to auxiliary time stamp 1. */
|
||||
#define AUX1_SEL_SDP2 (2 << 3) /* Assign SDP2 to auxiliary time stamp 1. */
|
||||
#define AUX1_SEL_SDP3 (3 << 3) /* Assign SDP3 to auxiliary time stamp 1. */
|
||||
#define AUX1_TS_SDP_EN (1 << 5) /* Enable auxiliary time stamp trigger 1. */
|
||||
#define TS_SDP0_SEL_TT0 (0 << 6) /* Target time 0 is output on SDP0. */
|
||||
#define TS_SDP0_SEL_TT1 (1 << 6) /* Target time 1 is output on SDP0. */
|
||||
#define TS_SDP0_SEL_FC0 (2 << 6) /* Freq clock 0 is output on SDP0. */
|
||||
#define TS_SDP0_SEL_FC1 (3 << 6) /* Freq clock 1 is output on SDP0. */
|
||||
#define TS_SDP0_EN (1 << 8) /* SDP0 is assigned to Tsync. */
|
||||
#define TS_SDP1_SEL_TT0 (0 << 9) /* Target time 0 is output on SDP1. */
|
||||
#define TS_SDP1_SEL_TT1 (1 << 9) /* Target time 1 is output on SDP1. */
|
||||
#define TS_SDP1_SEL_FC0 (2 << 9) /* Freq clock 0 is output on SDP1. */
|
||||
#define TS_SDP1_SEL_FC1 (3 << 9) /* Freq clock 1 is output on SDP1. */
|
||||
#define TS_SDP1_EN (1 << 11) /* SDP1 is assigned to Tsync. */
|
||||
#define TS_SDP2_SEL_TT0 (0 << 12) /* Target time 0 is output on SDP2. */
|
||||
#define TS_SDP2_SEL_TT1 (1 << 12) /* Target time 1 is output on SDP2. */
|
||||
#define TS_SDP2_SEL_FC0 (2 << 12) /* Freq clock 0 is output on SDP2. */
|
||||
#define TS_SDP2_SEL_FC1 (3 << 12) /* Freq clock 1 is output on SDP2. */
|
||||
#define TS_SDP2_EN (1 << 14) /* SDP2 is assigned to Tsync. */
|
||||
#define TS_SDP3_SEL_TT0 (0 << 15) /* Target time 0 is output on SDP3. */
|
||||
#define TS_SDP3_SEL_TT1 (1 << 15) /* Target time 1 is output on SDP3. */
|
||||
#define TS_SDP3_SEL_FC0 (2 << 15) /* Freq clock 0 is output on SDP3. */
|
||||
#define TS_SDP3_SEL_FC1 (3 << 15) /* Freq clock 1 is output on SDP3. */
|
||||
#define TS_SDP3_EN (1 << 17) /* SDP3 is assigned to Tsync. */
|
||||
#define AUX0_SEL_SDP0 (0u << 0) /* Assign SDP0 to auxiliary time stamp 0. */
|
||||
#define AUX0_SEL_SDP1 (1u << 0) /* Assign SDP1 to auxiliary time stamp 0. */
|
||||
#define AUX0_SEL_SDP2 (2u << 0) /* Assign SDP2 to auxiliary time stamp 0. */
|
||||
#define AUX0_SEL_SDP3 (3u << 0) /* Assign SDP3 to auxiliary time stamp 0. */
|
||||
#define AUX0_TS_SDP_EN (1u << 2) /* Enable auxiliary time stamp trigger 0. */
|
||||
#define AUX1_SEL_SDP0 (0u << 3) /* Assign SDP0 to auxiliary time stamp 1. */
|
||||
#define AUX1_SEL_SDP1 (1u << 3) /* Assign SDP1 to auxiliary time stamp 1. */
|
||||
#define AUX1_SEL_SDP2 (2u << 3) /* Assign SDP2 to auxiliary time stamp 1. */
|
||||
#define AUX1_SEL_SDP3 (3u << 3) /* Assign SDP3 to auxiliary time stamp 1. */
|
||||
#define AUX1_TS_SDP_EN (1u << 5) /* Enable auxiliary time stamp trigger 1. */
|
||||
#define TS_SDP0_SEL_TT0 (0u << 6) /* Target time 0 is output on SDP0. */
|
||||
#define TS_SDP0_SEL_TT1 (1u << 6) /* Target time 1 is output on SDP0. */
|
||||
#define TS_SDP0_SEL_FC0 (2u << 6) /* Freq clock 0 is output on SDP0. */
|
||||
#define TS_SDP0_SEL_FC1 (3u << 6) /* Freq clock 1 is output on SDP0. */
|
||||
#define TS_SDP0_EN (1u << 8) /* SDP0 is assigned to Tsync. */
|
||||
#define TS_SDP1_SEL_TT0 (0u << 9) /* Target time 0 is output on SDP1. */
|
||||
#define TS_SDP1_SEL_TT1 (1u << 9) /* Target time 1 is output on SDP1. */
|
||||
#define TS_SDP1_SEL_FC0 (2u << 9) /* Freq clock 0 is output on SDP1. */
|
||||
#define TS_SDP1_SEL_FC1 (3u << 9) /* Freq clock 1 is output on SDP1. */
|
||||
#define TS_SDP1_EN (1u << 11) /* SDP1 is assigned to Tsync. */
|
||||
#define TS_SDP2_SEL_TT0 (0u << 12) /* Target time 0 is output on SDP2. */
|
||||
#define TS_SDP2_SEL_TT1 (1u << 12) /* Target time 1 is output on SDP2. */
|
||||
#define TS_SDP2_SEL_FC0 (2u << 12) /* Freq clock 0 is output on SDP2. */
|
||||
#define TS_SDP2_SEL_FC1 (3u << 12) /* Freq clock 1 is output on SDP2. */
|
||||
#define TS_SDP2_EN (1u << 14) /* SDP2 is assigned to Tsync. */
|
||||
#define TS_SDP3_SEL_TT0 (0u << 15) /* Target time 0 is output on SDP3. */
|
||||
#define TS_SDP3_SEL_TT1 (1u << 15) /* Target time 1 is output on SDP3. */
|
||||
#define TS_SDP3_SEL_FC0 (2u << 15) /* Freq clock 0 is output on SDP3. */
|
||||
#define TS_SDP3_SEL_FC1 (3u << 15) /* Freq clock 1 is output on SDP3. */
|
||||
#define TS_SDP3_EN (1u << 17) /* SDP3 is assigned to Tsync. */
|
||||
|
||||
#define E1000_MDICNFG_EXT_MDIO 0x80000000 /* MDI ext/int destination */
|
||||
#define E1000_MDICNFG_COM_MDIO 0x40000000 /* MDI shared w/ lan 0 */
|
||||
@ -997,8 +997,8 @@
|
||||
#define E1000_M88E1543_FIBER_CTRL 0x0
|
||||
#define E1000_EEE_ADV_DEV_I354 7
|
||||
#define E1000_EEE_ADV_ADDR_I354 60
|
||||
#define E1000_EEE_ADV_100_SUPPORTED (1 << 1) /* 100BaseTx EEE Supported */
|
||||
#define E1000_EEE_ADV_1000_SUPPORTED (1 << 2) /* 1000BaseT EEE Supported */
|
||||
#define E1000_EEE_ADV_100_SUPPORTED BIT(1) /* 100BaseTx EEE Supported */
|
||||
#define E1000_EEE_ADV_1000_SUPPORTED BIT(2) /* 1000BaseT EEE Supported */
|
||||
#define E1000_PCS_STATUS_DEV_I354 3
|
||||
#define E1000_PCS_STATUS_ADDR_I354 1
|
||||
#define E1000_PCS_STATUS_TX_LPI_IND 0x0200 /* Tx in LPI state */
|
||||
|
@ -212,7 +212,7 @@ s32 igb_vfta_set(struct e1000_hw *hw, u32 vlan, u32 vind,
|
||||
* bits[4-0]: which bit in the register
|
||||
*/
|
||||
regidx = vlan / 32;
|
||||
vfta_delta = 1 << (vlan % 32);
|
||||
vfta_delta = BIT(vlan % 32);
|
||||
vfta = adapter->shadow_vfta[regidx];
|
||||
|
||||
/* vfta_delta represents the difference between the current value
|
||||
@ -243,12 +243,12 @@ s32 igb_vfta_set(struct e1000_hw *hw, u32 vlan, u32 vind,
|
||||
bits = rd32(E1000_VLVF(vlvf_index));
|
||||
|
||||
/* set the pool bit */
|
||||
bits |= 1 << (E1000_VLVF_POOLSEL_SHIFT + vind);
|
||||
bits |= BIT(E1000_VLVF_POOLSEL_SHIFT + vind);
|
||||
if (vlan_on)
|
||||
goto vlvf_update;
|
||||
|
||||
/* clear the pool bit */
|
||||
bits ^= 1 << (E1000_VLVF_POOLSEL_SHIFT + vind);
|
||||
bits ^= BIT(E1000_VLVF_POOLSEL_SHIFT + vind);
|
||||
|
||||
if (!(bits & E1000_VLVF_POOLSEL_MASK)) {
|
||||
/* Clear VFTA first, then disable VLVF. Otherwise
|
||||
@ -427,7 +427,7 @@ void igb_mta_set(struct e1000_hw *hw, u32 hash_value)
|
||||
|
||||
mta = array_rd32(E1000_MTA, hash_reg);
|
||||
|
||||
mta |= (1 << hash_bit);
|
||||
mta |= BIT(hash_bit);
|
||||
|
||||
array_wr32(E1000_MTA, hash_reg, mta);
|
||||
wrfl();
|
||||
@ -527,7 +527,7 @@ void igb_update_mc_addr_list(struct e1000_hw *hw,
|
||||
hash_reg = (hash_value >> 5) & (hw->mac.mta_reg_count - 1);
|
||||
hash_bit = hash_value & 0x1F;
|
||||
|
||||
hw->mac.mta_shadow[hash_reg] |= (1 << hash_bit);
|
||||
hw->mac.mta_shadow[hash_reg] |= BIT(hash_bit);
|
||||
mc_addr_list += (ETH_ALEN);
|
||||
}
|
||||
|
||||
|
@ -302,9 +302,9 @@ static s32 igb_check_for_rst_pf(struct e1000_hw *hw, u16 vf_number)
|
||||
u32 vflre = rd32(E1000_VFLRE);
|
||||
s32 ret_val = -E1000_ERR_MBX;
|
||||
|
||||
if (vflre & (1 << vf_number)) {
|
||||
if (vflre & BIT(vf_number)) {
|
||||
ret_val = 0;
|
||||
wr32(E1000_VFLRE, (1 << vf_number));
|
||||
wr32(E1000_VFLRE, BIT(vf_number));
|
||||
hw->mbx.stats.rsts++;
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ static void igb_shift_out_eec_bits(struct e1000_hw *hw, u16 data, u16 count)
|
||||
u32 eecd = rd32(E1000_EECD);
|
||||
u32 mask;
|
||||
|
||||
mask = 0x01 << (count - 1);
|
||||
mask = 1u << (count - 1);
|
||||
if (nvm->type == e1000_nvm_eeprom_spi)
|
||||
eecd |= E1000_EECD_DO;
|
||||
|
||||
|
@ -91,10 +91,10 @@ s32 igb_check_polarity_m88(struct e1000_hw *hw);
|
||||
|
||||
#define I82580_ADDR_REG 16
|
||||
#define I82580_CFG_REG 22
|
||||
#define I82580_CFG_ASSERT_CRS_ON_TX (1 << 15)
|
||||
#define I82580_CFG_ENABLE_DOWNSHIFT (3 << 10) /* auto downshift 100/10 */
|
||||
#define I82580_CFG_ASSERT_CRS_ON_TX BIT(15)
|
||||
#define I82580_CFG_ENABLE_DOWNSHIFT (3u << 10) /* auto downshift 100/10 */
|
||||
#define I82580_CTRL_REG 23
|
||||
#define I82580_CTRL_DOWNSHIFT_MASK (7 << 10)
|
||||
#define I82580_CTRL_DOWNSHIFT_MASK (7u << 10)
|
||||
|
||||
/* 82580 specific PHY registers */
|
||||
#define I82580_PHY_CTRL_2 18
|
||||
|
@ -91,6 +91,14 @@ struct igb_adapter;
|
||||
#define NVM_COMB_VER_OFF 0x0083
|
||||
#define NVM_COMB_VER_PTR 0x003d
|
||||
|
||||
/* Transmit and receive latency (for PTP timestamps) */
|
||||
#define IGB_I210_TX_LATENCY_10 9542
|
||||
#define IGB_I210_TX_LATENCY_100 1024
|
||||
#define IGB_I210_TX_LATENCY_1000 178
|
||||
#define IGB_I210_RX_LATENCY_10 20662
|
||||
#define IGB_I210_RX_LATENCY_100 2213
|
||||
#define IGB_I210_RX_LATENCY_1000 448
|
||||
|
||||
struct vf_data_storage {
|
||||
unsigned char vf_mac_addresses[ETH_ALEN];
|
||||
u16 vf_mc_hashes[IGB_MAX_VF_MC_ENTRIES];
|
||||
@ -169,7 +177,7 @@ enum igb_tx_flags {
|
||||
* maintain a power of two alignment we have to limit ourselves to 32K.
|
||||
*/
|
||||
#define IGB_MAX_TXD_PWR 15
|
||||
#define IGB_MAX_DATA_PER_TXD (1 << IGB_MAX_TXD_PWR)
|
||||
#define IGB_MAX_DATA_PER_TXD (1u << IGB_MAX_TXD_PWR)
|
||||
|
||||
/* Tx Descriptors needed, worst case */
|
||||
#define TXD_USE_COUNT(S) DIV_ROUND_UP((S), IGB_MAX_DATA_PER_TXD)
|
||||
@ -466,21 +474,21 @@ struct igb_adapter {
|
||||
u16 eee_advert;
|
||||
};
|
||||
|
||||
#define IGB_FLAG_HAS_MSI (1 << 0)
|
||||
#define IGB_FLAG_DCA_ENABLED (1 << 1)
|
||||
#define IGB_FLAG_QUAD_PORT_A (1 << 2)
|
||||
#define IGB_FLAG_QUEUE_PAIRS (1 << 3)
|
||||
#define IGB_FLAG_DMAC (1 << 4)
|
||||
#define IGB_FLAG_PTP (1 << 5)
|
||||
#define IGB_FLAG_RSS_FIELD_IPV4_UDP (1 << 6)
|
||||
#define IGB_FLAG_RSS_FIELD_IPV6_UDP (1 << 7)
|
||||
#define IGB_FLAG_WOL_SUPPORTED (1 << 8)
|
||||
#define IGB_FLAG_NEED_LINK_UPDATE (1 << 9)
|
||||
#define IGB_FLAG_MEDIA_RESET (1 << 10)
|
||||
#define IGB_FLAG_MAS_CAPABLE (1 << 11)
|
||||
#define IGB_FLAG_MAS_ENABLE (1 << 12)
|
||||
#define IGB_FLAG_HAS_MSIX (1 << 13)
|
||||
#define IGB_FLAG_EEE (1 << 14)
|
||||
#define IGB_FLAG_HAS_MSI BIT(0)
|
||||
#define IGB_FLAG_DCA_ENABLED BIT(1)
|
||||
#define IGB_FLAG_QUAD_PORT_A BIT(2)
|
||||
#define IGB_FLAG_QUEUE_PAIRS BIT(3)
|
||||
#define IGB_FLAG_DMAC BIT(4)
|
||||
#define IGB_FLAG_PTP BIT(5)
|
||||
#define IGB_FLAG_RSS_FIELD_IPV4_UDP BIT(6)
|
||||
#define IGB_FLAG_RSS_FIELD_IPV6_UDP BIT(7)
|
||||
#define IGB_FLAG_WOL_SUPPORTED BIT(8)
|
||||
#define IGB_FLAG_NEED_LINK_UPDATE BIT(9)
|
||||
#define IGB_FLAG_MEDIA_RESET BIT(10)
|
||||
#define IGB_FLAG_MAS_CAPABLE BIT(11)
|
||||
#define IGB_FLAG_MAS_ENABLE BIT(12)
|
||||
#define IGB_FLAG_HAS_MSIX BIT(13)
|
||||
#define IGB_FLAG_EEE BIT(14)
|
||||
#define IGB_FLAG_VLAN_PROMISC BIT(15)
|
||||
|
||||
/* Media Auto Sense */
|
||||
|
@ -466,7 +466,7 @@ static void igb_get_regs(struct net_device *netdev,
|
||||
|
||||
memset(p, 0, IGB_REGS_LEN * sizeof(u32));
|
||||
|
||||
regs->version = (1 << 24) | (hw->revision_id << 16) | hw->device_id;
|
||||
regs->version = (1u << 24) | (hw->revision_id << 16) | hw->device_id;
|
||||
|
||||
/* General Registers */
|
||||
regs_buff[0] = rd32(E1000_CTRL);
|
||||
@ -1448,7 +1448,7 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data)
|
||||
/* Test each interrupt */
|
||||
for (; i < 31; i++) {
|
||||
/* Interrupt to test */
|
||||
mask = 1 << i;
|
||||
mask = BIT(i);
|
||||
|
||||
if (!(mask & ics_mask))
|
||||
continue;
|
||||
@ -2411,19 +2411,19 @@ static int igb_get_ts_info(struct net_device *dev,
|
||||
SOF_TIMESTAMPING_RAW_HARDWARE;
|
||||
|
||||
info->tx_types =
|
||||
(1 << HWTSTAMP_TX_OFF) |
|
||||
(1 << HWTSTAMP_TX_ON);
|
||||
BIT(HWTSTAMP_TX_OFF) |
|
||||
BIT(HWTSTAMP_TX_ON);
|
||||
|
||||
info->rx_filters = 1 << HWTSTAMP_FILTER_NONE;
|
||||
info->rx_filters = BIT(HWTSTAMP_FILTER_NONE);
|
||||
|
||||
/* 82576 does not support timestamping all packets. */
|
||||
if (adapter->hw.mac.type >= e1000_82580)
|
||||
info->rx_filters |= 1 << HWTSTAMP_FILTER_ALL;
|
||||
info->rx_filters |= BIT(HWTSTAMP_FILTER_ALL);
|
||||
else
|
||||
info->rx_filters |=
|
||||
(1 << HWTSTAMP_FILTER_PTP_V1_L4_SYNC) |
|
||||
(1 << HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ) |
|
||||
(1 << HWTSTAMP_FILTER_PTP_V2_EVENT);
|
||||
BIT(HWTSTAMP_FILTER_PTP_V1_L4_SYNC) |
|
||||
BIT(HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ) |
|
||||
BIT(HWTSTAMP_FILTER_PTP_V2_EVENT);
|
||||
|
||||
return 0;
|
||||
default:
|
||||
|
@ -836,7 +836,7 @@ static void igb_assign_vector(struct igb_q_vector *q_vector, int msix_vector)
|
||||
igb_write_ivar(hw, msix_vector,
|
||||
tx_queue & 0x7,
|
||||
((tx_queue & 0x8) << 1) + 8);
|
||||
q_vector->eims_value = 1 << msix_vector;
|
||||
q_vector->eims_value = BIT(msix_vector);
|
||||
break;
|
||||
case e1000_82580:
|
||||
case e1000_i350:
|
||||
@ -857,7 +857,7 @@ static void igb_assign_vector(struct igb_q_vector *q_vector, int msix_vector)
|
||||
igb_write_ivar(hw, msix_vector,
|
||||
tx_queue >> 1,
|
||||
((tx_queue & 0x1) << 4) + 8);
|
||||
q_vector->eims_value = 1 << msix_vector;
|
||||
q_vector->eims_value = BIT(msix_vector);
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
@ -919,7 +919,7 @@ static void igb_configure_msix(struct igb_adapter *adapter)
|
||||
E1000_GPIE_NSICR);
|
||||
|
||||
/* enable msix_other interrupt */
|
||||
adapter->eims_other = 1 << vector;
|
||||
adapter->eims_other = BIT(vector);
|
||||
tmp = (vector++ | E1000_IVAR_VALID) << 8;
|
||||
|
||||
wr32(E1000_IVAR_MISC, tmp);
|
||||
@ -2087,6 +2087,40 @@ static int igb_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
|
||||
return ndo_dflt_fdb_add(ndm, tb, dev, addr, vid, flags);
|
||||
}
|
||||
|
||||
#define IGB_MAX_MAC_HDR_LEN 127
|
||||
#define IGB_MAX_NETWORK_HDR_LEN 511
|
||||
|
||||
static netdev_features_t
|
||||
igb_features_check(struct sk_buff *skb, struct net_device *dev,
|
||||
netdev_features_t features)
|
||||
{
|
||||
unsigned int network_hdr_len, mac_hdr_len;
|
||||
|
||||
/* Make certain the headers can be described by a context descriptor */
|
||||
mac_hdr_len = skb_network_header(skb) - skb->data;
|
||||
if (unlikely(mac_hdr_len > IGB_MAX_MAC_HDR_LEN))
|
||||
return features & ~(NETIF_F_HW_CSUM |
|
||||
NETIF_F_SCTP_CRC |
|
||||
NETIF_F_HW_VLAN_CTAG_TX |
|
||||
NETIF_F_TSO |
|
||||
NETIF_F_TSO6);
|
||||
|
||||
network_hdr_len = skb_checksum_start(skb) - skb_network_header(skb);
|
||||
if (unlikely(network_hdr_len > IGB_MAX_NETWORK_HDR_LEN))
|
||||
return features & ~(NETIF_F_HW_CSUM |
|
||||
NETIF_F_SCTP_CRC |
|
||||
NETIF_F_TSO |
|
||||
NETIF_F_TSO6);
|
||||
|
||||
/* We can only support IPV4 TSO in tunnels if we can mangle the
|
||||
* inner IP ID field, so strip TSO if MANGLEID is not supported.
|
||||
*/
|
||||
if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID))
|
||||
features &= ~NETIF_F_TSO;
|
||||
|
||||
return features;
|
||||
}
|
||||
|
||||
static const struct net_device_ops igb_netdev_ops = {
|
||||
.ndo_open = igb_open,
|
||||
.ndo_stop = igb_close,
|
||||
@ -2111,7 +2145,7 @@ static const struct net_device_ops igb_netdev_ops = {
|
||||
.ndo_fix_features = igb_fix_features,
|
||||
.ndo_set_features = igb_set_features,
|
||||
.ndo_fdb_add = igb_ndo_fdb_add,
|
||||
.ndo_features_check = passthru_features_check,
|
||||
.ndo_features_check = igb_features_check,
|
||||
};
|
||||
|
||||
/**
|
||||
@ -2377,39 +2411,44 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
NETIF_F_TSO6 |
|
||||
NETIF_F_RXHASH |
|
||||
NETIF_F_RXCSUM |
|
||||
NETIF_F_HW_CSUM |
|
||||
NETIF_F_HW_VLAN_CTAG_RX |
|
||||
NETIF_F_HW_VLAN_CTAG_TX;
|
||||
NETIF_F_HW_CSUM;
|
||||
|
||||
if (hw->mac.type >= e1000_82576)
|
||||
netdev->features |= NETIF_F_SCTP_CRC;
|
||||
|
||||
#define IGB_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \
|
||||
NETIF_F_GSO_GRE_CSUM | \
|
||||
NETIF_F_GSO_IPIP | \
|
||||
NETIF_F_GSO_SIT | \
|
||||
NETIF_F_GSO_UDP_TUNNEL | \
|
||||
NETIF_F_GSO_UDP_TUNNEL_CSUM)
|
||||
|
||||
netdev->gso_partial_features = IGB_GSO_PARTIAL_FEATURES;
|
||||
netdev->features |= NETIF_F_GSO_PARTIAL | IGB_GSO_PARTIAL_FEATURES;
|
||||
|
||||
/* copy netdev features into list of user selectable features */
|
||||
netdev->hw_features |= netdev->features;
|
||||
netdev->hw_features |= NETIF_F_RXALL;
|
||||
netdev->hw_features |= netdev->features |
|
||||
NETIF_F_HW_VLAN_CTAG_RX |
|
||||
NETIF_F_HW_VLAN_CTAG_TX |
|
||||
NETIF_F_RXALL;
|
||||
|
||||
if (hw->mac.type >= e1000_i350)
|
||||
netdev->hw_features |= NETIF_F_NTUPLE;
|
||||
|
||||
/* set this bit last since it cannot be part of hw_features */
|
||||
netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
|
||||
|
||||
netdev->vlan_features |= NETIF_F_SG |
|
||||
NETIF_F_TSO |
|
||||
NETIF_F_TSO6 |
|
||||
NETIF_F_HW_CSUM |
|
||||
NETIF_F_SCTP_CRC;
|
||||
if (pci_using_dac)
|
||||
netdev->features |= NETIF_F_HIGHDMA;
|
||||
|
||||
netdev->vlan_features |= netdev->features | NETIF_F_TSO_MANGLEID;
|
||||
netdev->mpls_features |= NETIF_F_HW_CSUM;
|
||||
netdev->hw_enc_features |= NETIF_F_HW_CSUM;
|
||||
netdev->hw_enc_features |= netdev->vlan_features;
|
||||
|
||||
/* set this bit last since it cannot be part of vlan_features */
|
||||
netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER |
|
||||
NETIF_F_HW_VLAN_CTAG_RX |
|
||||
NETIF_F_HW_VLAN_CTAG_TX;
|
||||
|
||||
netdev->priv_flags |= IFF_SUPP_NOFCS;
|
||||
|
||||
if (pci_using_dac) {
|
||||
netdev->features |= NETIF_F_HIGHDMA;
|
||||
netdev->vlan_features |= NETIF_F_HIGHDMA;
|
||||
}
|
||||
|
||||
netdev->priv_flags |= IFF_UNICAST_FLT;
|
||||
|
||||
adapter->en_mng_pt = igb_enable_mng_pass_thru(hw);
|
||||
@ -4064,7 +4103,7 @@ static int igb_vlan_promisc_enable(struct igb_adapter *adapter)
|
||||
for (i = E1000_VLVF_ARRAY_SIZE; --i;) {
|
||||
u32 vlvf = rd32(E1000_VLVF(i));
|
||||
|
||||
vlvf |= 1 << pf_id;
|
||||
vlvf |= BIT(pf_id);
|
||||
wr32(E1000_VLVF(i), vlvf);
|
||||
}
|
||||
|
||||
@ -4091,7 +4130,7 @@ static void igb_scrub_vfta(struct igb_adapter *adapter, u32 vfta_offset)
|
||||
/* guarantee that we don't scrub out management VLAN */
|
||||
vid = adapter->mng_vlan_id;
|
||||
if (vid >= vid_start && vid < vid_end)
|
||||
vfta[(vid - vid_start) / 32] |= 1 << (vid % 32);
|
||||
vfta[(vid - vid_start) / 32] |= BIT(vid % 32);
|
||||
|
||||
if (!adapter->vfs_allocated_count)
|
||||
goto set_vfta;
|
||||
@ -4110,7 +4149,7 @@ static void igb_scrub_vfta(struct igb_adapter *adapter, u32 vfta_offset)
|
||||
|
||||
if (vlvf & E1000_VLVF_VLANID_ENABLE) {
|
||||
/* record VLAN ID in VFTA */
|
||||
vfta[(vid - vid_start) / 32] |= 1 << (vid % 32);
|
||||
vfta[(vid - vid_start) / 32] |= BIT(vid % 32);
|
||||
|
||||
/* if PF is part of this then continue */
|
||||
if (test_bit(vid, adapter->active_vlans))
|
||||
@ -4118,7 +4157,7 @@ static void igb_scrub_vfta(struct igb_adapter *adapter, u32 vfta_offset)
|
||||
}
|
||||
|
||||
/* remove PF from the pool */
|
||||
bits = ~(1 << pf_id);
|
||||
bits = ~BIT(pf_id);
|
||||
bits &= rd32(E1000_VLVF(i));
|
||||
wr32(E1000_VLVF(i), bits);
|
||||
}
|
||||
@ -4276,13 +4315,13 @@ static void igb_spoof_check(struct igb_adapter *adapter)
|
||||
return;
|
||||
|
||||
for (j = 0; j < adapter->vfs_allocated_count; j++) {
|
||||
if (adapter->wvbr & (1 << j) ||
|
||||
adapter->wvbr & (1 << (j + IGB_STAGGERED_QUEUE_OFFSET))) {
|
||||
if (adapter->wvbr & BIT(j) ||
|
||||
adapter->wvbr & BIT(j + IGB_STAGGERED_QUEUE_OFFSET)) {
|
||||
dev_warn(&adapter->pdev->dev,
|
||||
"Spoof event(s) detected on VF %d\n", j);
|
||||
adapter->wvbr &=
|
||||
~((1 << j) |
|
||||
(1 << (j + IGB_STAGGERED_QUEUE_OFFSET)));
|
||||
~(BIT(j) |
|
||||
BIT(j + IGB_STAGGERED_QUEUE_OFFSET));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4842,9 +4881,18 @@ static int igb_tso(struct igb_ring *tx_ring,
|
||||
struct igb_tx_buffer *first,
|
||||
u8 *hdr_len)
|
||||
{
|
||||
u32 vlan_macip_lens, type_tucmd, mss_l4len_idx;
|
||||
struct sk_buff *skb = first->skb;
|
||||
u32 vlan_macip_lens, type_tucmd;
|
||||
u32 mss_l4len_idx, l4len;
|
||||
union {
|
||||
struct iphdr *v4;
|
||||
struct ipv6hdr *v6;
|
||||
unsigned char *hdr;
|
||||
} ip;
|
||||
union {
|
||||
struct tcphdr *tcp;
|
||||
unsigned char *hdr;
|
||||
} l4;
|
||||
u32 paylen, l4_offset;
|
||||
int err;
|
||||
|
||||
if (skb->ip_summed != CHECKSUM_PARTIAL)
|
||||
@ -4857,45 +4905,52 @@ static int igb_tso(struct igb_ring *tx_ring,
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
ip.hdr = skb_network_header(skb);
|
||||
l4.hdr = skb_checksum_start(skb);
|
||||
|
||||
/* ADV DTYP TUCMD MKRLOC/ISCSIHEDLEN */
|
||||
type_tucmd = E1000_ADVTXD_TUCMD_L4T_TCP;
|
||||
|
||||
if (first->protocol == htons(ETH_P_IP)) {
|
||||
struct iphdr *iph = ip_hdr(skb);
|
||||
iph->tot_len = 0;
|
||||
iph->check = 0;
|
||||
tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr,
|
||||
iph->daddr, 0,
|
||||
IPPROTO_TCP,
|
||||
0);
|
||||
/* initialize outer IP header fields */
|
||||
if (ip.v4->version == 4) {
|
||||
/* IP header will have to cancel out any data that
|
||||
* is not a part of the outer IP header
|
||||
*/
|
||||
ip.v4->check = csum_fold(csum_add(lco_csum(skb),
|
||||
csum_unfold(l4.tcp->check)));
|
||||
type_tucmd |= E1000_ADVTXD_TUCMD_IPV4;
|
||||
|
||||
ip.v4->tot_len = 0;
|
||||
first->tx_flags |= IGB_TX_FLAGS_TSO |
|
||||
IGB_TX_FLAGS_CSUM |
|
||||
IGB_TX_FLAGS_IPV4;
|
||||
} else if (skb_is_gso_v6(skb)) {
|
||||
ipv6_hdr(skb)->payload_len = 0;
|
||||
tcp_hdr(skb)->check = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
|
||||
&ipv6_hdr(skb)->daddr,
|
||||
0, IPPROTO_TCP, 0);
|
||||
} else {
|
||||
ip.v6->payload_len = 0;
|
||||
first->tx_flags |= IGB_TX_FLAGS_TSO |
|
||||
IGB_TX_FLAGS_CSUM;
|
||||
}
|
||||
|
||||
/* compute header lengths */
|
||||
l4len = tcp_hdrlen(skb);
|
||||
*hdr_len = skb_transport_offset(skb) + l4len;
|
||||
/* determine offset of inner transport header */
|
||||
l4_offset = l4.hdr - skb->data;
|
||||
|
||||
/* compute length of segmentation header */
|
||||
*hdr_len = (l4.tcp->doff * 4) + l4_offset;
|
||||
|
||||
/* remove payload length from inner checksum */
|
||||
paylen = skb->len - l4_offset;
|
||||
csum_replace_by_diff(&l4.tcp->check, htonl(paylen));
|
||||
|
||||
/* update gso size and bytecount with header size */
|
||||
first->gso_segs = skb_shinfo(skb)->gso_segs;
|
||||
first->bytecount += (first->gso_segs - 1) * *hdr_len;
|
||||
|
||||
/* MSS L4LEN IDX */
|
||||
mss_l4len_idx = l4len << E1000_ADVTXD_L4LEN_SHIFT;
|
||||
mss_l4len_idx = (*hdr_len - l4_offset) << E1000_ADVTXD_L4LEN_SHIFT;
|
||||
mss_l4len_idx |= skb_shinfo(skb)->gso_size << E1000_ADVTXD_MSS_SHIFT;
|
||||
|
||||
/* VLAN MACLEN IPLEN */
|
||||
vlan_macip_lens = skb_network_header_len(skb);
|
||||
vlan_macip_lens |= skb_network_offset(skb) << E1000_ADVTXD_MACLEN_SHIFT;
|
||||
vlan_macip_lens = l4.hdr - ip.hdr;
|
||||
vlan_macip_lens |= (ip.hdr - skb->data) << E1000_ADVTXD_MACLEN_SHIFT;
|
||||
vlan_macip_lens |= first->tx_flags & IGB_TX_FLAGS_VLAN_MASK;
|
||||
|
||||
igb_tx_ctxtdesc(tx_ring, vlan_macip_lens, type_tucmd, mss_l4len_idx);
|
||||
@ -5963,11 +6018,11 @@ static void igb_clear_vf_vfta(struct igb_adapter *adapter, u32 vf)
|
||||
|
||||
/* create mask for VF and other pools */
|
||||
pool_mask = E1000_VLVF_POOLSEL_MASK;
|
||||
vlvf_mask = 1 << (E1000_VLVF_POOLSEL_SHIFT + vf);
|
||||
vlvf_mask = BIT(E1000_VLVF_POOLSEL_SHIFT + vf);
|
||||
|
||||
/* drop PF from pool bits */
|
||||
pool_mask &= ~(1 << (E1000_VLVF_POOLSEL_SHIFT +
|
||||
adapter->vfs_allocated_count));
|
||||
pool_mask &= ~BIT(E1000_VLVF_POOLSEL_SHIFT +
|
||||
adapter->vfs_allocated_count);
|
||||
|
||||
/* Find the vlan filter for this id */
|
||||
for (i = E1000_VLVF_ARRAY_SIZE; i--;) {
|
||||
@ -5990,7 +6045,7 @@ static void igb_clear_vf_vfta(struct igb_adapter *adapter, u32 vf)
|
||||
goto update_vlvf;
|
||||
|
||||
vid = vlvf & E1000_VLVF_VLANID_MASK;
|
||||
vfta_mask = 1 << (vid % 32);
|
||||
vfta_mask = BIT(vid % 32);
|
||||
|
||||
/* clear bit from VFTA */
|
||||
vfta = adapter->shadow_vfta[vid / 32];
|
||||
@ -6027,7 +6082,7 @@ static int igb_find_vlvf_entry(struct e1000_hw *hw, u32 vlan)
|
||||
return idx;
|
||||
}
|
||||
|
||||
void igb_update_pf_vlvf(struct igb_adapter *adapter, u32 vid)
|
||||
static void igb_update_pf_vlvf(struct igb_adapter *adapter, u32 vid)
|
||||
{
|
||||
struct e1000_hw *hw = &adapter->hw;
|
||||
u32 bits, pf_id;
|
||||
@ -6041,13 +6096,13 @@ void igb_update_pf_vlvf(struct igb_adapter *adapter, u32 vid)
|
||||
* entry other than the PF.
|
||||
*/
|
||||
pf_id = adapter->vfs_allocated_count + E1000_VLVF_POOLSEL_SHIFT;
|
||||
bits = ~(1 << pf_id) & E1000_VLVF_POOLSEL_MASK;
|
||||
bits = ~BIT(pf_id) & E1000_VLVF_POOLSEL_MASK;
|
||||
bits &= rd32(E1000_VLVF(idx));
|
||||
|
||||
/* Disable the filter so this falls into the default pool. */
|
||||
if (!bits) {
|
||||
if (adapter->flags & IGB_FLAG_VLAN_PROMISC)
|
||||
wr32(E1000_VLVF(idx), 1 << pf_id);
|
||||
wr32(E1000_VLVF(idx), BIT(pf_id));
|
||||
else
|
||||
wr32(E1000_VLVF(idx), 0);
|
||||
}
|
||||
@ -6231,9 +6286,9 @@ static void igb_vf_reset_msg(struct igb_adapter *adapter, u32 vf)
|
||||
|
||||
/* enable transmit and receive for vf */
|
||||
reg = rd32(E1000_VFTE);
|
||||
wr32(E1000_VFTE, reg | (1 << vf));
|
||||
wr32(E1000_VFTE, reg | BIT(vf));
|
||||
reg = rd32(E1000_VFRE);
|
||||
wr32(E1000_VFRE, reg | (1 << vf));
|
||||
wr32(E1000_VFRE, reg | BIT(vf));
|
||||
|
||||
adapter->vf_data[vf].flags |= IGB_VF_FLAG_CTS;
|
||||
|
||||
@ -7927,7 +7982,7 @@ static void igb_set_vf_rate_limit(struct e1000_hw *hw, int vf, int tx_rate,
|
||||
/* Calculate the rate factor values to set */
|
||||
rf_int = link_speed / tx_rate;
|
||||
rf_dec = (link_speed - (rf_int * tx_rate));
|
||||
rf_dec = (rf_dec * (1 << E1000_RTTBCNRC_RF_INT_SHIFT)) /
|
||||
rf_dec = (rf_dec * BIT(E1000_RTTBCNRC_RF_INT_SHIFT)) /
|
||||
tx_rate;
|
||||
|
||||
bcnrc_val = E1000_RTTBCNRC_RS_ENA;
|
||||
@ -8017,11 +8072,11 @@ static int igb_ndo_set_vf_spoofchk(struct net_device *netdev, int vf,
|
||||
reg_offset = (hw->mac.type == e1000_82576) ? E1000_DTXSWC : E1000_TXSWC;
|
||||
reg_val = rd32(reg_offset);
|
||||
if (setting)
|
||||
reg_val |= ((1 << vf) |
|
||||
(1 << (vf + E1000_DTXSWC_VLAN_SPOOF_SHIFT)));
|
||||
reg_val |= (BIT(vf) |
|
||||
BIT(vf + E1000_DTXSWC_VLAN_SPOOF_SHIFT));
|
||||
else
|
||||
reg_val &= ~((1 << vf) |
|
||||
(1 << (vf + E1000_DTXSWC_VLAN_SPOOF_SHIFT)));
|
||||
reg_val &= ~(BIT(vf) |
|
||||
BIT(vf + E1000_DTXSWC_VLAN_SPOOF_SHIFT));
|
||||
wr32(reg_offset, reg_val);
|
||||
|
||||
adapter->vf_data[vf].spoofchk_enabled = setting;
|
||||
|
@ -69,9 +69,9 @@
|
||||
|
||||
#define IGB_SYSTIM_OVERFLOW_PERIOD (HZ * 60 * 9)
|
||||
#define IGB_PTP_TX_TIMEOUT (HZ * 15)
|
||||
#define INCPERIOD_82576 (1 << E1000_TIMINCA_16NS_SHIFT)
|
||||
#define INCVALUE_82576_MASK ((1 << E1000_TIMINCA_16NS_SHIFT) - 1)
|
||||
#define INCVALUE_82576 (16 << IGB_82576_TSYNC_SHIFT)
|
||||
#define INCPERIOD_82576 BIT(E1000_TIMINCA_16NS_SHIFT)
|
||||
#define INCVALUE_82576_MASK GENMASK(E1000_TIMINCA_16NS_SHIFT - 1, 0)
|
||||
#define INCVALUE_82576 (16u << IGB_82576_TSYNC_SHIFT)
|
||||
#define IGB_NBITS_82580 40
|
||||
|
||||
static void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter);
|
||||
@ -722,11 +722,29 @@ static void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter)
|
||||
struct e1000_hw *hw = &adapter->hw;
|
||||
struct skb_shared_hwtstamps shhwtstamps;
|
||||
u64 regval;
|
||||
int adjust = 0;
|
||||
|
||||
regval = rd32(E1000_TXSTMPL);
|
||||
regval |= (u64)rd32(E1000_TXSTMPH) << 32;
|
||||
|
||||
igb_ptp_systim_to_hwtstamp(adapter, &shhwtstamps, regval);
|
||||
/* adjust timestamp for the TX latency based on link speed */
|
||||
if (adapter->hw.mac.type == e1000_i210) {
|
||||
switch (adapter->link_speed) {
|
||||
case SPEED_10:
|
||||
adjust = IGB_I210_TX_LATENCY_10;
|
||||
break;
|
||||
case SPEED_100:
|
||||
adjust = IGB_I210_TX_LATENCY_100;
|
||||
break;
|
||||
case SPEED_1000:
|
||||
adjust = IGB_I210_TX_LATENCY_1000;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
shhwtstamps.hwtstamp = ktime_sub_ns(shhwtstamps.hwtstamp, adjust);
|
||||
|
||||
skb_tstamp_tx(adapter->ptp_tx_skb, &shhwtstamps);
|
||||
dev_kfree_skb_any(adapter->ptp_tx_skb);
|
||||
adapter->ptp_tx_skb = NULL;
|
||||
@ -771,6 +789,7 @@ void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector,
|
||||
struct igb_adapter *adapter = q_vector->adapter;
|
||||
struct e1000_hw *hw = &adapter->hw;
|
||||
u64 regval;
|
||||
int adjust = 0;
|
||||
|
||||
/* If this bit is set, then the RX registers contain the time stamp. No
|
||||
* other packet will be time stamped until we read these registers, so
|
||||
@ -790,6 +809,23 @@ void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector,
|
||||
|
||||
igb_ptp_systim_to_hwtstamp(adapter, skb_hwtstamps(skb), regval);
|
||||
|
||||
/* adjust timestamp for the RX latency based on link speed */
|
||||
if (adapter->hw.mac.type == e1000_i210) {
|
||||
switch (adapter->link_speed) {
|
||||
case SPEED_10:
|
||||
adjust = IGB_I210_RX_LATENCY_10;
|
||||
break;
|
||||
case SPEED_100:
|
||||
adjust = IGB_I210_RX_LATENCY_100;
|
||||
break;
|
||||
case SPEED_1000:
|
||||
adjust = IGB_I210_RX_LATENCY_1000;
|
||||
break;
|
||||
}
|
||||
}
|
||||
skb_hwtstamps(skb)->hwtstamp =
|
||||
ktime_add_ns(skb_hwtstamps(skb)->hwtstamp, adjust);
|
||||
|
||||
/* Update the last_rx_timestamp timer in order to enable watchdog check
|
||||
* for error case of latched timestamp on a dropped packet.
|
||||
*/
|
||||
|
@ -113,7 +113,7 @@
|
||||
#define E1000_RXDCTL_QUEUE_ENABLE 0x02000000 /* Enable specific Rx Que */
|
||||
|
||||
/* Direct Cache Access (DCA) definitions */
|
||||
#define E1000_DCA_TXCTRL_TX_WB_RO_EN (1 << 11) /* Tx Desc writeback RO bit */
|
||||
#define E1000_DCA_TXCTRL_TX_WB_RO_EN BIT(11) /* Tx Desc writeback RO bit */
|
||||
|
||||
#define E1000_VF_INIT_TIMEOUT 200 /* Number of retries to clear RSTI */
|
||||
|
||||
|
@ -154,7 +154,8 @@ static void igbvf_get_regs(struct net_device *netdev,
|
||||
|
||||
memset(p, 0, IGBVF_REGS_LEN * sizeof(u32));
|
||||
|
||||
regs->version = (1 << 24) | (adapter->pdev->revision << 16) |
|
||||
regs->version = (1u << 24) |
|
||||
(adapter->pdev->revision << 16) |
|
||||
adapter->pdev->device;
|
||||
|
||||
regs_buff[0] = er32(CTRL);
|
||||
|
@ -287,8 +287,8 @@ struct igbvf_info {
|
||||
};
|
||||
|
||||
/* hardware capability, feature, and workaround flags */
|
||||
#define IGBVF_FLAG_RX_CSUM_DISABLED (1 << 0)
|
||||
#define IGBVF_FLAG_RX_LB_VLAN_BSWAP (1 << 1)
|
||||
#define IGBVF_FLAG_RX_CSUM_DISABLED BIT(0)
|
||||
#define IGBVF_FLAG_RX_LB_VLAN_BSWAP BIT(1)
|
||||
#define IGBVF_RX_DESC_ADV(R, i) \
|
||||
(&((((R).desc))[i].rx_desc))
|
||||
#define IGBVF_TX_DESC_ADV(R, i) \
|
||||
|
@ -964,7 +964,7 @@ static void igbvf_assign_vector(struct igbvf_adapter *adapter, int rx_queue,
|
||||
ivar = ivar & 0xFFFFFF00;
|
||||
ivar |= msix_vector | E1000_IVAR_VALID;
|
||||
}
|
||||
adapter->rx_ring[rx_queue].eims_value = 1 << msix_vector;
|
||||
adapter->rx_ring[rx_queue].eims_value = BIT(msix_vector);
|
||||
array_ew32(IVAR0, index, ivar);
|
||||
}
|
||||
if (tx_queue > IGBVF_NO_QUEUE) {
|
||||
@ -979,7 +979,7 @@ static void igbvf_assign_vector(struct igbvf_adapter *adapter, int rx_queue,
|
||||
ivar = ivar & 0xFFFF00FF;
|
||||
ivar |= (msix_vector | E1000_IVAR_VALID) << 8;
|
||||
}
|
||||
adapter->tx_ring[tx_queue].eims_value = 1 << msix_vector;
|
||||
adapter->tx_ring[tx_queue].eims_value = BIT(msix_vector);
|
||||
array_ew32(IVAR0, index, ivar);
|
||||
}
|
||||
}
|
||||
@ -1014,8 +1014,8 @@ static void igbvf_configure_msix(struct igbvf_adapter *adapter)
|
||||
|
||||
ew32(IVAR_MISC, tmp);
|
||||
|
||||
adapter->eims_enable_mask = (1 << (vector)) - 1;
|
||||
adapter->eims_other = 1 << (vector - 1);
|
||||
adapter->eims_enable_mask = GENMASK(vector - 1, 0);
|
||||
adapter->eims_other = BIT(vector - 1);
|
||||
e1e_flush();
|
||||
}
|
||||
|
||||
@ -1367,7 +1367,7 @@ static void igbvf_configure_rx(struct igbvf_adapter *adapter)
|
||||
struct e1000_hw *hw = &adapter->hw;
|
||||
struct igbvf_ring *rx_ring = adapter->rx_ring;
|
||||
u64 rdba;
|
||||
u32 rdlen, rxdctl;
|
||||
u32 rxdctl;
|
||||
|
||||
/* disable receives */
|
||||
rxdctl = er32(RXDCTL(0));
|
||||
@ -1375,8 +1375,6 @@ static void igbvf_configure_rx(struct igbvf_adapter *adapter)
|
||||
e1e_flush();
|
||||
msleep(10);
|
||||
|
||||
rdlen = rx_ring->count * sizeof(union e1000_adv_rx_desc);
|
||||
|
||||
/* Setup the HW Rx Head and Tail Descriptor Pointers and
|
||||
* the Base and Length of the Rx Descriptor Ring
|
||||
*/
|
||||
@ -1933,83 +1931,74 @@ static void igbvf_tx_ctxtdesc(struct igbvf_ring *tx_ring, u32 vlan_macip_lens,
|
||||
buffer_info->dma = 0;
|
||||
}
|
||||
|
||||
static int igbvf_tso(struct igbvf_adapter *adapter,
|
||||
struct igbvf_ring *tx_ring,
|
||||
struct sk_buff *skb, u32 tx_flags, u8 *hdr_len,
|
||||
__be16 protocol)
|
||||
static int igbvf_tso(struct igbvf_ring *tx_ring,
|
||||
struct sk_buff *skb, u32 tx_flags, u8 *hdr_len)
|
||||
{
|
||||
struct e1000_adv_tx_context_desc *context_desc;
|
||||
struct igbvf_buffer *buffer_info;
|
||||
u32 info = 0, tu_cmd = 0;
|
||||
u32 mss_l4len_idx, l4len;
|
||||
unsigned int i;
|
||||
u32 vlan_macip_lens, type_tucmd, mss_l4len_idx;
|
||||
union {
|
||||
struct iphdr *v4;
|
||||
struct ipv6hdr *v6;
|
||||
unsigned char *hdr;
|
||||
} ip;
|
||||
union {
|
||||
struct tcphdr *tcp;
|
||||
unsigned char *hdr;
|
||||
} l4;
|
||||
u32 paylen, l4_offset;
|
||||
int err;
|
||||
|
||||
*hdr_len = 0;
|
||||
if (skb->ip_summed != CHECKSUM_PARTIAL)
|
||||
return 0;
|
||||
|
||||
if (!skb_is_gso(skb))
|
||||
return 0;
|
||||
|
||||
err = skb_cow_head(skb, 0);
|
||||
if (err < 0) {
|
||||
dev_err(&adapter->pdev->dev, "igbvf_tso returning an error\n");
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
|
||||
l4len = tcp_hdrlen(skb);
|
||||
*hdr_len += l4len;
|
||||
|
||||
if (protocol == htons(ETH_P_IP)) {
|
||||
struct iphdr *iph = ip_hdr(skb);
|
||||
|
||||
iph->tot_len = 0;
|
||||
iph->check = 0;
|
||||
tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr,
|
||||
iph->daddr, 0,
|
||||
IPPROTO_TCP,
|
||||
0);
|
||||
} else if (skb_is_gso_v6(skb)) {
|
||||
ipv6_hdr(skb)->payload_len = 0;
|
||||
tcp_hdr(skb)->check = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
|
||||
&ipv6_hdr(skb)->daddr,
|
||||
0, IPPROTO_TCP, 0);
|
||||
}
|
||||
|
||||
i = tx_ring->next_to_use;
|
||||
|
||||
buffer_info = &tx_ring->buffer_info[i];
|
||||
context_desc = IGBVF_TX_CTXTDESC_ADV(*tx_ring, i);
|
||||
/* VLAN MACLEN IPLEN */
|
||||
if (tx_flags & IGBVF_TX_FLAGS_VLAN)
|
||||
info |= (tx_flags & IGBVF_TX_FLAGS_VLAN_MASK);
|
||||
info |= (skb_network_offset(skb) << E1000_ADVTXD_MACLEN_SHIFT);
|
||||
*hdr_len += skb_network_offset(skb);
|
||||
info |= (skb_transport_header(skb) - skb_network_header(skb));
|
||||
*hdr_len += (skb_transport_header(skb) - skb_network_header(skb));
|
||||
context_desc->vlan_macip_lens = cpu_to_le32(info);
|
||||
ip.hdr = skb_network_header(skb);
|
||||
l4.hdr = skb_checksum_start(skb);
|
||||
|
||||
/* ADV DTYP TUCMD MKRLOC/ISCSIHEDLEN */
|
||||
tu_cmd |= (E1000_TXD_CMD_DEXT | E1000_ADVTXD_DTYP_CTXT);
|
||||
type_tucmd = E1000_ADVTXD_TUCMD_L4T_TCP;
|
||||
|
||||
if (protocol == htons(ETH_P_IP))
|
||||
tu_cmd |= E1000_ADVTXD_TUCMD_IPV4;
|
||||
tu_cmd |= E1000_ADVTXD_TUCMD_L4T_TCP;
|
||||
/* initialize outer IP header fields */
|
||||
if (ip.v4->version == 4) {
|
||||
/* IP header will have to cancel out any data that
|
||||
* is not a part of the outer IP header
|
||||
*/
|
||||
ip.v4->check = csum_fold(csum_add(lco_csum(skb),
|
||||
csum_unfold(l4.tcp->check)));
|
||||
type_tucmd |= E1000_ADVTXD_TUCMD_IPV4;
|
||||
|
||||
context_desc->type_tucmd_mlhl = cpu_to_le32(tu_cmd);
|
||||
ip.v4->tot_len = 0;
|
||||
} else {
|
||||
ip.v6->payload_len = 0;
|
||||
}
|
||||
|
||||
/* determine offset of inner transport header */
|
||||
l4_offset = l4.hdr - skb->data;
|
||||
|
||||
/* compute length of segmentation header */
|
||||
*hdr_len = (l4.tcp->doff * 4) + l4_offset;
|
||||
|
||||
/* remove payload length from inner checksum */
|
||||
paylen = skb->len - l4_offset;
|
||||
csum_replace_by_diff(&l4.tcp->check, htonl(paylen));
|
||||
|
||||
/* MSS L4LEN IDX */
|
||||
mss_l4len_idx = (skb_shinfo(skb)->gso_size << E1000_ADVTXD_MSS_SHIFT);
|
||||
mss_l4len_idx |= (l4len << E1000_ADVTXD_L4LEN_SHIFT);
|
||||
mss_l4len_idx = (*hdr_len - l4_offset) << E1000_ADVTXD_L4LEN_SHIFT;
|
||||
mss_l4len_idx |= skb_shinfo(skb)->gso_size << E1000_ADVTXD_MSS_SHIFT;
|
||||
|
||||
context_desc->mss_l4len_idx = cpu_to_le32(mss_l4len_idx);
|
||||
context_desc->seqnum_seed = 0;
|
||||
/* VLAN MACLEN IPLEN */
|
||||
vlan_macip_lens = l4.hdr - ip.hdr;
|
||||
vlan_macip_lens |= (ip.hdr - skb->data) << E1000_ADVTXD_MACLEN_SHIFT;
|
||||
vlan_macip_lens |= tx_flags & IGBVF_TX_FLAGS_VLAN_MASK;
|
||||
|
||||
buffer_info->time_stamp = jiffies;
|
||||
buffer_info->dma = 0;
|
||||
i++;
|
||||
if (i == tx_ring->count)
|
||||
i = 0;
|
||||
igbvf_tx_ctxtdesc(tx_ring, vlan_macip_lens, type_tucmd, mss_l4len_idx);
|
||||
|
||||
tx_ring->next_to_use = i;
|
||||
|
||||
return true;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline bool igbvf_ipv6_csum_is_sctp(struct sk_buff *skb)
|
||||
@ -2091,7 +2080,7 @@ static int igbvf_maybe_stop_tx(struct net_device *netdev, int size)
|
||||
}
|
||||
|
||||
#define IGBVF_MAX_TXD_PWR 16
|
||||
#define IGBVF_MAX_DATA_PER_TXD (1 << IGBVF_MAX_TXD_PWR)
|
||||
#define IGBVF_MAX_DATA_PER_TXD (1u << IGBVF_MAX_TXD_PWR)
|
||||
|
||||
static inline int igbvf_tx_map_adv(struct igbvf_adapter *adapter,
|
||||
struct igbvf_ring *tx_ring,
|
||||
@ -2271,8 +2260,7 @@ static netdev_tx_t igbvf_xmit_frame_ring_adv(struct sk_buff *skb,
|
||||
|
||||
first = tx_ring->next_to_use;
|
||||
|
||||
tso = skb_is_gso(skb) ?
|
||||
igbvf_tso(adapter, tx_ring, skb, tx_flags, &hdr_len, protocol) : 0;
|
||||
tso = igbvf_tso(tx_ring, skb, tx_flags, &hdr_len);
|
||||
if (unlikely(tso < 0)) {
|
||||
dev_kfree_skb_any(skb);
|
||||
return NETDEV_TX_OK;
|
||||
@ -2615,6 +2603,40 @@ static int igbvf_set_features(struct net_device *netdev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define IGBVF_MAX_MAC_HDR_LEN 127
|
||||
#define IGBVF_MAX_NETWORK_HDR_LEN 511
|
||||
|
||||
static netdev_features_t
|
||||
igbvf_features_check(struct sk_buff *skb, struct net_device *dev,
|
||||
netdev_features_t features)
|
||||
{
|
||||
unsigned int network_hdr_len, mac_hdr_len;
|
||||
|
||||
/* Make certain the headers can be described by a context descriptor */
|
||||
mac_hdr_len = skb_network_header(skb) - skb->data;
|
||||
if (unlikely(mac_hdr_len > IGBVF_MAX_MAC_HDR_LEN))
|
||||
return features & ~(NETIF_F_HW_CSUM |
|
||||
NETIF_F_SCTP_CRC |
|
||||
NETIF_F_HW_VLAN_CTAG_TX |
|
||||
NETIF_F_TSO |
|
||||
NETIF_F_TSO6);
|
||||
|
||||
network_hdr_len = skb_checksum_start(skb) - skb_network_header(skb);
|
||||
if (unlikely(network_hdr_len > IGBVF_MAX_NETWORK_HDR_LEN))
|
||||
return features & ~(NETIF_F_HW_CSUM |
|
||||
NETIF_F_SCTP_CRC |
|
||||
NETIF_F_TSO |
|
||||
NETIF_F_TSO6);
|
||||
|
||||
/* We can only support IPV4 TSO in tunnels if we can mangle the
|
||||
* inner IP ID field, so strip TSO if MANGLEID is not supported.
|
||||
*/
|
||||
if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID))
|
||||
features &= ~NETIF_F_TSO;
|
||||
|
||||
return features;
|
||||
}
|
||||
|
||||
static const struct net_device_ops igbvf_netdev_ops = {
|
||||
.ndo_open = igbvf_open,
|
||||
.ndo_stop = igbvf_close,
|
||||
@ -2631,7 +2653,7 @@ static const struct net_device_ops igbvf_netdev_ops = {
|
||||
.ndo_poll_controller = igbvf_netpoll,
|
||||
#endif
|
||||
.ndo_set_features = igbvf_set_features,
|
||||
.ndo_features_check = passthru_features_check,
|
||||
.ndo_features_check = igbvf_features_check,
|
||||
};
|
||||
|
||||
/**
|
||||
@ -2739,22 +2761,30 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
NETIF_F_HW_CSUM |
|
||||
NETIF_F_SCTP_CRC;
|
||||
|
||||
netdev->features = netdev->hw_features |
|
||||
NETIF_F_HW_VLAN_CTAG_TX |
|
||||
NETIF_F_HW_VLAN_CTAG_RX |
|
||||
NETIF_F_HW_VLAN_CTAG_FILTER;
|
||||
#define IGBVF_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \
|
||||
NETIF_F_GSO_GRE_CSUM | \
|
||||
NETIF_F_GSO_IPIP | \
|
||||
NETIF_F_GSO_SIT | \
|
||||
NETIF_F_GSO_UDP_TUNNEL | \
|
||||
NETIF_F_GSO_UDP_TUNNEL_CSUM)
|
||||
|
||||
netdev->gso_partial_features = IGBVF_GSO_PARTIAL_FEATURES;
|
||||
netdev->hw_features |= NETIF_F_GSO_PARTIAL |
|
||||
IGBVF_GSO_PARTIAL_FEATURES;
|
||||
|
||||
netdev->features = netdev->hw_features;
|
||||
|
||||
if (pci_using_dac)
|
||||
netdev->features |= NETIF_F_HIGHDMA;
|
||||
|
||||
netdev->vlan_features |= NETIF_F_SG |
|
||||
NETIF_F_TSO |
|
||||
NETIF_F_TSO6 |
|
||||
NETIF_F_HW_CSUM |
|
||||
NETIF_F_SCTP_CRC;
|
||||
|
||||
netdev->vlan_features |= netdev->features | NETIF_F_TSO_MANGLEID;
|
||||
netdev->mpls_features |= NETIF_F_HW_CSUM;
|
||||
netdev->hw_enc_features |= NETIF_F_HW_CSUM;
|
||||
netdev->hw_enc_features |= netdev->vlan_features;
|
||||
|
||||
/* set this bit last since it cannot be part of vlan_features */
|
||||
netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER |
|
||||
NETIF_F_HW_VLAN_CTAG_RX |
|
||||
NETIF_F_HW_VLAN_CTAG_TX;
|
||||
|
||||
/*reset the controller to put the device in a known good state */
|
||||
err = hw->mac.ops.reset_hw(hw);
|
||||
|
@ -266,7 +266,7 @@ static s32 e1000_set_vfta_vf(struct e1000_hw *hw, u16 vid, bool set)
|
||||
msgbuf[1] = vid;
|
||||
/* Setting the 8 bit field MSG INFO to true indicates "add" */
|
||||
if (set)
|
||||
msgbuf[0] |= 1 << E1000_VT_MSGINFO_SHIFT;
|
||||
msgbuf[0] |= BIT(E1000_VT_MSGINFO_SHIFT);
|
||||
|
||||
mbx->ops.write_posted(hw, msgbuf, 2);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user