Merge branch '10GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue

Tony Nguyen says:

====================
Intel Wired LAN Driver Updates 2025-09-03 (ixgbe, igbvf, e1000, e1000e, igb, igbvf, igc)

Piotr allows for 2.5Gb and 5Gb autoneg for ixgbe E610 devices.

Jedrzej refactors reading of OROM data to be more efficient on ixgbe.

Kohei Enju adds reporting of loopback Tx packets and bytes on igbvf. He
also removes redundant reporting of Rx bytes.

Jacek Kowalski remove unnecessary u16 casts in e1000, e1000e, igb, igc,
and ixgbe drivers.

* '10GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue:
  ixgbe: drop unnecessary casts to u16 / int
  igc: drop unnecessary constant casts to u16
  igb: drop unnecessary constant casts to u16
  e1000e: drop unnecessary constant casts to u16
  e1000: drop unnecessary constant casts to u16
  igbvf: remove redundant counter rx_long_byte_count from ethtool statistics
  igbvf: add lbtx_packets and lbtx_bytes to ethtool statistics
  ixgbe: reduce number of reads when getting OROM data
  ixgbe: add the 2.5G and 5G speeds in auto-negotiation for E610
====================

Link: https://patch.msgid.link/20250903202536.3696620-1-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski 2025-09-04 19:01:35 -07:00
commit 3132f0e8ef
20 changed files with 82 additions and 73 deletions

View File

@ -116,7 +116,7 @@ struct e1000_adapter;
#define E1000_MASTER_SLAVE e1000_ms_hw_default
#endif
#define E1000_MNG_VLAN_NONE (-1)
#define E1000_MNG_VLAN_NONE 0xFFFF
/* wrapper around a pointer to a socket buffer,
* so a DMA handle can be stored along with the buffer

View File

@ -806,7 +806,7 @@ static int e1000_eeprom_test(struct e1000_adapter *adapter, u64 *data)
}
/* If Checksum is not Correct return error else test passed */
if ((checksum != (u16)EEPROM_SUM) && !(*data))
if (checksum != EEPROM_SUM && !(*data))
*data = 2;
return *data;

View File

@ -3970,7 +3970,7 @@ s32 e1000_validate_eeprom_checksum(struct e1000_hw *hw)
return E1000_SUCCESS;
#endif
if (checksum == (u16)EEPROM_SUM)
if (checksum == EEPROM_SUM)
return E1000_SUCCESS;
else {
e_dbg("EEPROM Checksum Invalid\n");
@ -3997,7 +3997,7 @@ s32 e1000_update_eeprom_checksum(struct e1000_hw *hw)
}
checksum += eeprom_data;
}
checksum = (u16)EEPROM_SUM - checksum;
checksum = EEPROM_SUM - checksum;
if (e1000_write_eeprom(hw, EEPROM_CHECKSUM_REG, 1, &checksum) < 0) {
e_dbg("EEPROM Write Error\n");
return -E1000_ERR_EEPROM;

View File

@ -313,8 +313,7 @@ static void e1000_update_mng_vlan(struct e1000_adapter *adapter)
} else {
adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
}
if ((old_vid != (u16)E1000_MNG_VLAN_NONE) &&
(vid != old_vid) &&
if (old_vid != E1000_MNG_VLAN_NONE && vid != old_vid &&
!test_bit(old_vid, adapter->active_vlans))
e1000_vlan_rx_kill_vid(netdev, htons(ETH_P_8021Q),
old_vid);

View File

@ -64,7 +64,7 @@ struct e1000_info;
#define AUTO_ALL_MODES 0
#define E1000_EEPROM_APME 0x0400
#define E1000_MNG_VLAN_NONE (-1)
#define E1000_MNG_VLAN_NONE 0xFFFF
#define DEFAULT_JUMBO 9234

View File

@ -963,7 +963,7 @@ static int e1000_eeprom_test(struct e1000_adapter *adapter, u64 *data)
}
/* If Checksum is not Correct return error else test passed */
if ((checksum != (u16)NVM_SUM) && !(*data))
if (checksum != NVM_SUM && !(*data))
*data = 2;
return *data;

View File

@ -2761,7 +2761,7 @@ static void e1000e_vlan_filter_disable(struct e1000_adapter *adapter)
rctl &= ~(E1000_RCTL_VFE | E1000_RCTL_CFIEN);
ew32(RCTL, rctl);
if (adapter->mng_vlan_id != (u16)E1000_MNG_VLAN_NONE) {
if (adapter->mng_vlan_id != E1000_MNG_VLAN_NONE) {
e1000_vlan_rx_kill_vid(netdev, htons(ETH_P_8021Q),
adapter->mng_vlan_id);
adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
@ -2828,7 +2828,7 @@ static void e1000_update_mng_vlan(struct e1000_adapter *adapter)
adapter->mng_vlan_id = vid;
}
if ((old_vid != (u16)E1000_MNG_VLAN_NONE) && (vid != old_vid))
if (old_vid != E1000_MNG_VLAN_NONE && vid != old_vid)
e1000_vlan_rx_kill_vid(netdev, htons(ETH_P_8021Q), old_vid);
}

View File

@ -564,7 +564,7 @@ s32 e1000e_validate_nvm_checksum_generic(struct e1000_hw *hw)
return 0;
}
if (checksum != (u16)NVM_SUM) {
if (checksum != NVM_SUM) {
e_dbg("NVM Checksum Invalid\n");
return -E1000_ERR_NVM;
}
@ -594,7 +594,7 @@ s32 e1000e_update_nvm_checksum_generic(struct e1000_hw *hw)
}
checksum += nvm_data;
}
checksum = (u16)NVM_SUM - checksum;
checksum = NVM_SUM - checksum;
ret_val = e1000_write_nvm(hw, NVM_CHECKSUM_REG, 1, &checksum);
if (ret_val)
e_dbg("NVM Write Error while updating checksum.\n");

View File

@ -2372,7 +2372,7 @@ static s32 igb_validate_nvm_checksum_with_offset(struct e1000_hw *hw,
checksum += nvm_data;
}
if (checksum != (u16) NVM_SUM) {
if (checksum != NVM_SUM) {
hw_dbg("NVM Checksum Invalid\n");
ret_val = -E1000_ERR_NVM;
goto out;
@ -2406,7 +2406,7 @@ static s32 igb_update_nvm_checksum_with_offset(struct e1000_hw *hw, u16 offset)
}
checksum += nvm_data;
}
checksum = (u16) NVM_SUM - checksum;
checksum = NVM_SUM - checksum;
ret_val = hw->nvm.ops.write(hw, (NVM_CHECKSUM_REG + offset), 1,
&checksum);
if (ret_val)

View File

@ -602,7 +602,7 @@ static s32 igb_update_nvm_checksum_i210(struct e1000_hw *hw)
}
checksum += nvm_data;
}
checksum = (u16) NVM_SUM - checksum;
checksum = NVM_SUM - checksum;
ret_val = igb_write_nvm_srwr(hw, NVM_CHECKSUM_REG, 1,
&checksum);
if (ret_val) {

View File

@ -636,7 +636,7 @@ s32 igb_validate_nvm_checksum(struct e1000_hw *hw)
checksum += nvm_data;
}
if (checksum != (u16) NVM_SUM) {
if (checksum != NVM_SUM) {
hw_dbg("NVM Checksum Invalid\n");
ret_val = -E1000_ERR_NVM;
goto out;
@ -668,7 +668,7 @@ s32 igb_update_nvm_checksum(struct e1000_hw *hw)
}
checksum += nvm_data;
}
checksum = (u16) NVM_SUM - checksum;
checksum = NVM_SUM - checksum;
ret_val = hw->nvm.ops.write(hw, NVM_CHECKSUM_REG, 1, &checksum);
if (ret_val)
hw_dbg("NVM Write Error while updating checksum.\n");

View File

@ -217,7 +217,7 @@ static inline int igb_skb_pad(void)
#define IGB_MASTER_SLAVE e1000_ms_hw_default
#endif
#define IGB_MNG_VLAN_NONE -1
#define IGB_MNG_VLAN_NONE 0xFFFF
enum igb_tx_flags {
/* cmd_type flags */

View File

@ -1531,8 +1531,7 @@ static void igb_update_mng_vlan(struct igb_adapter *adapter)
adapter->mng_vlan_id = IGB_MNG_VLAN_NONE;
}
if ((old_vid != (u16)IGB_MNG_VLAN_NONE) &&
(vid != old_vid) &&
if (old_vid != IGB_MNG_VLAN_NONE && vid != old_vid &&
!test_bit(old_vid, adapter->active_vlans)) {
/* remove VID from filter table */
igb_vfta_set(hw, vid, pf_id, false, true);

View File

@ -30,11 +30,12 @@ static const struct igbvf_stats igbvf_gstrings_stats[] = {
{ "rx_bytes", IGBVF_STAT(stats.gorc, stats.base_gorc) },
{ "tx_bytes", IGBVF_STAT(stats.gotc, stats.base_gotc) },
{ "multicast", IGBVF_STAT(stats.mprc, stats.base_mprc) },
{ "lbrx_bytes", IGBVF_STAT(stats.gorlbc, stats.base_gorlbc) },
{ "lbrx_packets", IGBVF_STAT(stats.gprlbc, stats.base_gprlbc) },
{ "lbtx_packets", IGBVF_STAT(stats.gptlbc, stats.base_gptlbc) },
{ "lbrx_bytes", IGBVF_STAT(stats.gorlbc, stats.base_gorlbc) },
{ "lbtx_bytes", IGBVF_STAT(stats.gotlbc, stats.base_gotlbc) },
{ "tx_restart_queue", IGBVF_STAT(restart_queue, zero_base) },
{ "tx_timeout_count", IGBVF_STAT(tx_timeout_count, zero_base) },
{ "rx_long_byte_count", IGBVF_STAT(stats.gorc, stats.base_gorc) },
{ "rx_csum_offload_good", IGBVF_STAT(hw_csum_good, zero_base) },
{ "rx_csum_offload_errors", IGBVF_STAT(hw_csum_err, zero_base) },
{ "rx_header_split", IGBVF_STAT(rx_hdr_split, zero_base) },

View File

@ -435,7 +435,7 @@ static s32 igc_update_nvm_checksum_i225(struct igc_hw *hw)
}
checksum += nvm_data;
}
checksum = (u16)NVM_SUM - checksum;
checksum = NVM_SUM - checksum;
ret_val = igc_write_nvm_srwr(hw, NVM_CHECKSUM_REG, 1,
&checksum);
if (ret_val) {

View File

@ -123,7 +123,7 @@ s32 igc_validate_nvm_checksum(struct igc_hw *hw)
checksum += nvm_data;
}
if (checksum != (u16)NVM_SUM) {
if (checksum != NVM_SUM) {
hw_dbg("NVM Checksum Invalid\n");
ret_val = -IGC_ERR_NVM;
goto out;
@ -155,7 +155,7 @@ s32 igc_update_nvm_checksum(struct igc_hw *hw)
}
checksum += nvm_data;
}
checksum = (u16)NVM_SUM - checksum;
checksum = NVM_SUM - checksum;
ret_val = hw->nvm.ops.write(hw, NVM_CHECKSUM_REG, 1, &checksum);
if (ret_val)
hw_dbg("NVM Write Error while updating checksum.\n");

View File

@ -1739,9 +1739,9 @@ int ixgbe_calc_eeprom_checksum_generic(struct ixgbe_hw *hw)
}
}
checksum = (u16)IXGBE_EEPROM_SUM - checksum;
checksum = IXGBE_EEPROM_SUM - checksum;
return (int)checksum;
return checksum;
}
/**

View File

@ -1953,6 +1953,16 @@ int ixgbe_identify_phy_e610(struct ixgbe_hw *hw)
phy_type_low & IXGBE_PHY_TYPE_LOW_1G_SGMII ||
phy_type_high & IXGBE_PHY_TYPE_HIGH_1G_USXGMII)
hw->phy.speeds_supported |= IXGBE_LINK_SPEED_1GB_FULL;
if (phy_type_low & IXGBE_PHY_TYPE_LOW_2500BASE_T ||
phy_type_low & IXGBE_PHY_TYPE_LOW_2500BASE_X ||
phy_type_low & IXGBE_PHY_TYPE_LOW_2500BASE_KX ||
phy_type_high & IXGBE_PHY_TYPE_HIGH_2500M_SGMII ||
phy_type_high & IXGBE_PHY_TYPE_HIGH_2500M_USXGMII)
hw->phy.speeds_supported |= IXGBE_LINK_SPEED_2_5GB_FULL;
if (phy_type_low & IXGBE_PHY_TYPE_LOW_5GBASE_T ||
phy_type_low & IXGBE_PHY_TYPE_LOW_5GBASE_KR ||
phy_type_high & IXGBE_PHY_TYPE_HIGH_5G_USXGMII)
hw->phy.speeds_supported |= IXGBE_LINK_SPEED_5GB_FULL;
if (phy_type_low & IXGBE_PHY_TYPE_LOW_10GBASE_T ||
phy_type_low & IXGBE_PHY_TYPE_LOW_10G_SFI_DA ||
phy_type_low & IXGBE_PHY_TYPE_LOW_10GBASE_SR ||
@ -1963,31 +1973,10 @@ int ixgbe_identify_phy_e610(struct ixgbe_hw *hw)
phy_type_high & IXGBE_PHY_TYPE_HIGH_10G_USXGMII)
hw->phy.speeds_supported |= IXGBE_LINK_SPEED_10GB_FULL;
/* 2.5 and 5 Gbps link speeds must be excluded from the
* auto-negotiation set used during driver initialization due to
* compatibility issues with certain switches. Those issues do not
* exist in case of E610 2.5G SKU device (0x57b1).
*/
if (!hw->phy.autoneg_advertised &&
hw->device_id != IXGBE_DEV_ID_E610_2_5G_T)
/* Initialize autoneg speeds */
if (!hw->phy.autoneg_advertised)
hw->phy.autoneg_advertised = hw->phy.speeds_supported;
if (phy_type_low & IXGBE_PHY_TYPE_LOW_2500BASE_T ||
phy_type_low & IXGBE_PHY_TYPE_LOW_2500BASE_X ||
phy_type_low & IXGBE_PHY_TYPE_LOW_2500BASE_KX ||
phy_type_high & IXGBE_PHY_TYPE_HIGH_2500M_SGMII ||
phy_type_high & IXGBE_PHY_TYPE_HIGH_2500M_USXGMII)
hw->phy.speeds_supported |= IXGBE_LINK_SPEED_2_5GB_FULL;
if (!hw->phy.autoneg_advertised &&
hw->device_id == IXGBE_DEV_ID_E610_2_5G_T)
hw->phy.autoneg_advertised = hw->phy.speeds_supported;
if (phy_type_low & IXGBE_PHY_TYPE_LOW_5GBASE_T ||
phy_type_low & IXGBE_PHY_TYPE_LOW_5GBASE_KR ||
phy_type_high & IXGBE_PHY_TYPE_HIGH_5G_USXGMII)
hw->phy.speeds_supported |= IXGBE_LINK_SPEED_5GB_FULL;
/* Set PHY ID */
memcpy(&hw->phy.id, pcaps.phy_id_oui, sizeof(u32));
@ -3008,50 +2997,71 @@ static int ixgbe_get_nvm_srev(struct ixgbe_hw *hw,
* Searches through the Option ROM flash contents to locate the CIVD data for
* the image.
*
* Return: the exit code of the operation.
* Return: -ENOMEM when cannot allocate memory, -EDOM for checksum violation,
* -ENODATA when cannot find proper data, -EIO for faulty read or
* 0 on success.
*
* On success @civd stores collected data.
*/
static int
ixgbe_get_orom_civd_data(struct ixgbe_hw *hw, enum ixgbe_bank_select bank,
struct ixgbe_orom_civd_info *civd)
{
struct ixgbe_orom_civd_info tmp;
u32 orom_size = hw->flash.banks.orom_size;
u8 *orom_data;
u32 offset;
int err;
orom_data = kzalloc(orom_size, GFP_KERNEL);
if (!orom_data)
return -ENOMEM;
err = ixgbe_read_flash_module(hw, bank,
IXGBE_E610_SR_1ST_OROM_BANK_PTR, 0,
orom_data, orom_size);
if (err) {
err = -EIO;
goto cleanup;
}
/* The CIVD section is located in the Option ROM aligned to 512 bytes.
* The first 4 bytes must contain the ASCII characters "$CIV".
* A simple modulo 256 sum of all of the bytes of the structure must
* equal 0.
*/
for (offset = 0; (offset + SZ_512) <= hw->flash.banks.orom_size;
offset += SZ_512) {
for (offset = 0; offset + SZ_512 <= orom_size; offset += SZ_512) {
struct ixgbe_orom_civd_info *tmp;
u8 sum = 0;
u32 i;
err = ixgbe_read_flash_module(hw, bank,
IXGBE_E610_SR_1ST_OROM_BANK_PTR,
offset,
(u8 *)&tmp, sizeof(tmp));
if (err)
return err;
BUILD_BUG_ON(sizeof(*tmp) > SZ_512);
tmp = (struct ixgbe_orom_civd_info *)&orom_data[offset];
/* Skip forward until we find a matching signature */
if (memcmp(IXGBE_OROM_CIV_SIGNATURE, tmp.signature,
sizeof(tmp.signature)))
if (memcmp(IXGBE_OROM_CIV_SIGNATURE, tmp->signature,
sizeof(tmp->signature)))
continue;
/* Verify that the simple checksum is zero */
for (i = 0; i < sizeof(tmp); i++)
sum += ((u8 *)&tmp)[i];
for (i = 0; i < sizeof(*tmp); i++)
sum += ((u8 *)tmp)[i];
if (sum)
return -EDOM;
if (sum) {
err = -EDOM;
goto cleanup;
}
*civd = tmp;
return 0;
*civd = *tmp;
err = 0;
goto cleanup;
}
return -ENODATA;
err = -ENODATA;
cleanup:
kfree(orom_data);
return err;
}
/**

View File

@ -373,9 +373,9 @@ static int ixgbe_calc_eeprom_checksum_X540(struct ixgbe_hw *hw)
}
}
checksum = (u16)IXGBE_EEPROM_SUM - checksum;
checksum = IXGBE_EEPROM_SUM - checksum;
return (int)checksum;
return checksum;
}
/**

View File

@ -1060,9 +1060,9 @@ static int ixgbe_calc_checksum_X550(struct ixgbe_hw *hw, u16 *buffer,
return status;
}
checksum = (u16)IXGBE_EEPROM_SUM - checksum;
checksum = IXGBE_EEPROM_SUM - checksum;
return (int)checksum;
return checksum;
}
/** ixgbe_calc_eeprom_checksum_X550 - Calculates and returns the checksum