warning cleanups
Subsystems (2)
v2 cover warning cleanups
In this series I address the C=2 (sparse) warnings. The goal is to be completely sparse clean in the drivers/net/ethernet/intel directory. This can help us run this tool for every patch, and helps the kernel code by reducing technical debt.
NOTE: there is one warning left in ixgbe XDP code using rcu_assign_pointer().
Jesse Brandeburg (11):
e100: handle eeprom as little endian
intel: remove checker warning
fm10k: move error check
igb/igc: use strongly typed pointer
igb: handle vlan types with checker enabled
igb: fix assignment on big endian machines
igb: override two checker warnings
intel: call csum functions with well formatted arguments
igbvf: convert to strongly typed descriptors
ixgbe: use checker safe conversions
ixgbe: reduce checker warnings
drivers/net/ethernet/intel/e100.c | 12 +++--- .../net/ethernet/intel/e1000/e1000_ethtool.c | 2 +- drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 10 ++--- drivers/net/ethernet/intel/igb/igb_ethtool.c | 2 +- drivers/net/ethernet/intel/igb/igb_main.c | 11 ++--- drivers/net/ethernet/intel/igb/igb_ptp.c | 4 +- drivers/net/ethernet/intel/igbvf/netdev.c | 6 +-- drivers/net/ethernet/intel/igbvf/vf.h | 42 +++++++++---------- drivers/net/ethernet/intel/igc/igc_dump.c | 2 +- drivers/net/ethernet/intel/igc/igc_ethtool.c | 2 +- .../net/ethernet/intel/ixgbe/ixgbe_82599.c | 9 ++-- .../net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 8 ++-- .../net/ethernet/intel/ixgbevf/ixgbevf_main.c | 2 +- 13 files changed, 56 insertions(+), 56 deletions(-)
base-commit: 4390eafe5ee738a90ab2ae0e3eb2c81330107d05
Signature · 1 line
2.30.2
PATCH v2 1/11 e100: handle eeprom as little endian
Sparse tool was warning on some implicit conversions from little endian data read from the EEPROM on the e100 cards.
Fix these by being explicit about the conversions using le16_to_cpu().
---
Warning Detail:
CHECK .../intel/e100.c.../intel/e100.c:1398:32: warning: restricted __le16 degrades to integer .../intel/e100.c:1518:29: warning: restricted __le16 degrades to integer .../intel/e100.c:2272:24: warning: restricted __le16 degrades to integer .../intel/e100.c:2273:25: warning: restricted __le16 degrades to integer .../intel/e100.c:2274:25: warning: restricted __le16 degrades to integer .../intel/e100.c:2929:24: warning: restricted __le16 degrades to integer
--- drivers/net/ethernet/intel/e100.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/e100.c +6 -6
@@ -1395,7 +1395,7 @@ static int e100_phy_check_without_mii(struct nic *nic)u8 phy_type;int without_mii; - phy_type = (nic->eeprom[eeprom_phy_iface] >>8 ) &0x0f ; + phy_type = (le16_to_cpu (nic->eeprom[eeprom_phy_iface]) >>8 ) &0x0f ;switch (phy_type) {case NoSuchPhy:/* Non-MII PHY; UNTESTED! */
@@ -1515,7 +1515,7 @@ static int e100_phy_init(struct nic *nic)mdio_write (netdev, nic->mii.phy_id,MII_BMCR , bmcr); }else if ((nic->mac >= mac_82550_D102) || ((nic->flags & ich) && (mdio_read (netdev, nic->mii.phy_id,MII_TPISTATUS ) &0x8000 ) && - (nic->eeprom[eeprom_cnfg_mdix] & eeprom_mdix_enabled))) { + (le16_to_cpu (nic->eeprom[eeprom_cnfg_mdix]) & eeprom_mdix_enabled))) {/* enable/disable MDI/MDI-X auto-switching. */ mdio_write (netdev, nic->mii.phy_id,MII_NCONFIG , nic->mii.force_media ?0 :NCONFIG_AUTO_SWITCH );
@@ -2269,9 +2269,9 @@ static int e100_asf(struct nic *nic) {/* ASF can be enabled from eeprom */ return (nic->pdev->device >=0x1050 ) && (nic->pdev->device <=0x1057 ) && - (nic->eeprom[eeprom_config_asf] & eeprom_asf) && - !(nic->eeprom[eeprom_config_asf] & eeprom_gcl) && - ((nic->eeprom[eeprom_smbus_addr] &0xFF ) !=0xFE ); + (le16_to_cpu (nic->eeprom[eeprom_config_asf]) & eeprom_asf) && + !(le16_to_cpu (nic->eeprom[eeprom_config_asf]) & eeprom_gcl) && + ((le16_to_cpu (nic->eeprom[eeprom_smbus_addr]) &0xFF ) !=0xFE ); }static int e100_up (struct nic *nic)
@@ -2926,7 +2926,7 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent)/* Wol magic packet can be enabled from eeprom */ if ((nic->mac >= mac_82558_D101_A4) && - (nic->eeprom[eeprom_id] & eeprom_id_wol)) { + (le16_to_cpu (nic->eeprom[eeprom_id]) & eeprom_id_wol)) { nic->flags |= wol_magic;device_set_wakeup_enable (&pdev->dev, true); }
base-commit: 4390eafe5ee738a90ab2ae0e3eb2c81330107d05
Signature · 1 line
2.30.2
PATCH v2 2/11 intel: remove checker warning
In reply to Jesse BrandeburgThe sparse checker (C=2) found an assignment where we were mixing types when trying to convert from data read directly from the device NVM, to an array in CPU order in-memory, which unfortunately the driver tries to do in-place.
This is easily solved by using the swap operation instead of an assignment, and is already proven in other Intel drivers to be functionally correct and the same code, just without a sparse warning.
The change is the same in all three drivers.
---
Warning Detail:
CHECK .../e1000/e1000_ethtool.c.../e1000/e1000_ethtool.c:516:32: warning: incorrect type in assignment (different base types).../e1000/e1000_ethtool.c:516:32: expected unsigned short [usertype].../e1000/e1000_ethtool.c:516:32: got restricted __le16 [usertype]
CHECK .../igb/igb_ethtool.c.../igb/igb_ethtool.c:834:32: warning: incorrect type in assignment (different base types).../igb/igb_ethtool.c:834:32: expected unsigned short [usertype].../igb/igb_ethtool.c:834:32: got restricted __le16 [usertype]
CHECK .../igc/igc_ethtool.c.../igc/igc_ethtool.c:555:32: warning: incorrect type in assignment (different base types).../igc/igc_ethtool.c:555:32: expected unsigned short [usertype].../igc/igc_ethtool.c:555:32: got restricted __le16 [usertype]
--- drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 2 +- drivers/net/ethernet/intel/igb/igb_ethtool.c | 2 +- drivers/net/ethernet/intel/igc/igc_ethtool.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/e1000/e1000_ethtool.c +1 -1
@@ -513,7 +513,7 @@ static int e1000_set_eeprom(struct net_device *netdev,memcpy (ptr, bytes, eeprom->len);for (i =0 ; i < last_word - first_word +1 ; i++) - eeprom_buff[i] =cpu_to_le16 (eeprom_buff[i]); +cpu_to_le16s (&eeprom_buff[i]); ret_val =e1000_write_eeprom (hw, first_word, last_word - first_word +1 , eeprom_buff);
drivers/net/ethernet/intel/igb/igb_ethtool.c +1 -1
@@ -831,7 +831,7 @@ static int igb_set_eeprom(struct net_device *netdev,memcpy (ptr, bytes, eeprom->len);for (i =0 ; i < last_word - first_word +1 ; i++) - eeprom_buff[i] =cpu_to_le16 (eeprom_buff[i]); +cpu_to_le16s (&eeprom_buff[i]); ret_val = hw->nvm.ops.write (hw, first_word, last_word - first_word +1 , eeprom_buff);
drivers/net/ethernet/intel/igc/igc_ethtool.c +1 -1
@@ -554,7 +554,7 @@ static int igc_ethtool_set_eeprom(struct net_device *netdev,memcpy (ptr, bytes, eeprom->len);for (i =0 ; i < last_word - first_word +1 ; i++) - eeprom_buff[i] =cpu_to_le16 (eeprom_buff[i]); +cpu_to_le16s (&eeprom_buff[i]); ret_val = hw->nvm.ops.write (hw, first_word, last_word - first_word +1 , eeprom_buff);
Signature · 1 line
2.30.2
Switzer
PATCH v2 2/11 intel: remove checker warning
Quoted 5 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jesse Brandeburg
Sent: Thursday, March 25, 2021 5:38 PM
Quoted 32 lines
Subject: [Intel-wired-lan] [PATCH net-next v2 02/11] intel: remove checker warning
The sparse checker (C=2) found an assignment where we were mixing types when trying to convert from data read directly from the device NVM, to an array in CPU order in-memory, which unfortunately the driver tries to do in-place.
This is easily solved by using the swap operation instead of an assignment, and is already proven in other Intel drivers to be functionally correct and the same code, just without a sparse warning.
The change is the same in all three drivers.
Signed-off-by Jesse Brandeburg <[email protected]>---
Warning Detail:
CHECK.../e1000/e1000_ethtool.c.../e1000/e1000_ethtool.c:516:32: warning: incorrect type in assignment (different base types).../e1000/e1000_ethtool.c:516:32: expected unsigned short [usertype].../e1000/e1000_ethtool.c:516:32: got restricted__le16[usertype]
CHECK.../igb/igb_ethtool.c.../igb/igb_ethtool.c:834:32: warning: incorrect type in assignment (different base types).../igb/igb_ethtool.c:834:32: expected unsigned short [usertype].../igb/igb_ethtool.c:834:32: got restricted__le16[usertype]
CHECK.../igc/igc_ethtool.c.../igc/igc_ethtool.c:555:32: warning: incorrect type in assignment (different base types).../igc/igc_ethtool.c:555:32: expected unsigned short [usertype].../igc/igc_ethtool.c:555:32: got restricted__le16[usertype]
---
Quoted 5 lines
drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 2 +- drivers/net/ethernet/intel/igb/igb_ethtool.c | 2 +- drivers/net/ethernet/intel/igc/igc_ethtool.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
PATCH v2 3/11 fm10k: move error check
In reply to Jesse BrandeburgThe error check and set_bit are placed in such a way that sparse (C=2)
warns:.../fm10k_pci.c:1395:9: warning: context imbalance in 'fm10k_msix_mbx_pf' - different lock contexts for basic block
Which seems a little odd, but the code can obviously be moved to where the variable is being set without changing functionality at all, and it even seems to make a bit more sense with the check closer to the set.
--- drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_pci.c +5 -5
@@ -1370,7 +1370,6 @@ static irqreturn_t fm10k_msix_mbx_pf(int __always_unused irq, void *data)struct fm10k_hw *hw = &interface->hw;struct fm10k_mbx_info *mbx = &hw->mbx;u32 eicr; -s32 err =0 ;/* unmask any set bits related to this interrupt */ eicr =fm10k_read_reg (hw,FM10K_EICR );
@@ -1386,15 +1385,16 @@ static irqreturn_t fm10k_msix_mbx_pf(int __always_unused irq, void *data)/* service mailboxes */ if (fm10k_mbx_trylock (interface)) { - err = mbx->ops.process (hw, mbx); +s32 err = mbx->ops.process (hw, mbx); + +if (err ==FM10K_ERR_RESET_REQUESTED ) +set_bit (FM10K_FLAG_RESET_REQUESTED , interface->flags); +/* handle VFLRE events */ fm10k_iov_event (interface);fm10k_mbx_unlock (interface); } -if (err ==FM10K_ERR_RESET_REQUESTED ) -set_bit (FM10K_FLAG_RESET_REQUESTED , interface->flags); -/* if switch toggled state we should reset GLORTs */ if (eicr &FM10K_EICR_SWITCHNOTREADY ) {/* force link down for at least 4 seconds */
Signature · 1 line
2.30.2
PATCH v2 4/11 igb/igc: use strongly typed pointer
In reply to Jesse BrandeburgThe igb and igc driver both use a trick of creating a local type pointer on the stack to ease dealing with a receive descriptor in 64 bit chunks for printing. Sparse however was not taken into account and receive descriptors are always in little endian order, so just make the unions use __le64 instead of u64.
No functional change.
---
Warning Detail:
CHECK .../igb/igb_main.c.../igb/igb_main.c:442:25: warning: cast to restricted __le64 .../igb/igb_main.c:442:25: warning: cast to restricted __le64 .../igb/igb_main.c:522:33: warning: cast to restricted __le64 .../igb/igb_main.c:522:33: warning: cast to restricted __le64 .../igb/igb_main.c:528:33: warning: cast to restricted __le64 .../igb/igb_main.c:528:33: warning: cast to restricted __le64
CHECK .../igc/igc_dump.c.../igc/igc_dump.c:192:40: warning: cast to restricted __le64 .../igc/igc_dump.c:193:37: warning: cast to restricted __le64 .../igc/igc_dump.c:275:45: warning: cast to restricted __le64 .../igc/igc_dump.c:276:45: warning: cast to restricted __le64 .../igc/igc_dump.c:281:45: warning: cast to restricted __le64 .../igc/igc_dump.c:282:45: warning: cast to restricted __le64
--- drivers/net/ethernet/intel/igb/igb_main.c | 2 +- drivers/net/ethernet/intel/igc/igc_dump.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +1 -1
@@ -356,7 +356,7 @@ static void igb_dump(struct igb_adapter *adapter)struct igb_reg_info *reginfo;struct igb_ring *tx_ring;union e1000_adv_tx_desc *tx_desc; -struct my_u0 {u64 a;u64 b; } *u0; +struct my_u0 {__le64 a;__le64 b; } *u0;struct igb_ring *rx_ring;union e1000_adv_rx_desc *rx_desc;u32 staterr;
drivers/net/ethernet/intel/igc/igc_dump.c +1 -1
@@ -112,7 +112,7 @@ static void igc_regdump(struct igc_hw *hw, struct igc_reg_info *reginfo)void igc_rings_dump (struct igc_adapter *adapter) {struct net_device *netdev = adapter->netdev; -struct my_u0 {u64 a;u64 b; } *u0; +struct my_u0 {__le64 a;__le64 b; } *u0;union igc_adv_tx_desc *tx_desc;union igc_adv_rx_desc *rx_desc;struct igc_ring *tx_ring;
Signature · 1 line
2.30.2
PATCH v2 4/11 igb/igc: use strongly typed pointer
Quoted 25 lines · Jesse Brandeburg
The igb and igc driver both use a trick of creating a local type pointer on the stack to ease dealing with a receive descriptor in 64 bit chunks for printing. Sparse however was not taken into account and receive descriptors are always in little endian order, so just make the unions use
__le64instead of u64.No functional change.
Signed-off-by Jesse Brandeburg <[email protected]>---
Warning Detail:CHECK .../igb/igb_main.c
.../igb/igb_main.c:442:25: warning: cast to restricted__le64.../igb/igb_main.c:442:25: warning: cast to restricted__le64.../igb/igb_main.c:522:33: warning: cast to restricted__le64.../igb/igb_main.c:522:33: warning: cast to restricted__le64.../igb/igb_main.c:528:33: warning: cast to restricted__le64.../igb/igb_main.c:528:33: warning: cast to restricted__le64
CHECK.../igc/igc_dump.c.../igc/igc_dump.c:192:40: warning: cast to restricted__le64.../igc/igc_dump.c:193:37: warning: cast to restricted__le64.../igc/igc_dump.c:275:45: warning: cast to restricted__le64.../igc/igc_dump.c:276:45: warning: cast to restricted__le64.../igc/igc_dump.c:281:45: warning: cast to restricted__le64.../igc/igc_dump.c:282:45: warning: cast to restricted__le64
Quoted 5 lines
--- drivers/net/ethernet/intel/igb/igb_main.c | 2 +- drivers/net/ethernet/intel/igc/igc_dump.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Tested for igc
Switzer
PATCH v2 4/11 igb/igc: use strongly typed pointer
In reply to Jesse BrandeburgQuoted 5 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jesse Brandeburg
Sent: Thursday, March 25, 2021 5:38 PM
Quoted 31 lines
Subject: [Intel-wired-lan] [PATCH net-next v2 04/11] igb/igc: use strongly typed pointer
The igb and igc driver both use a trick of creating a local type pointer on the stack to ease dealing with a receive descriptor in
64 bit chunks for printing. Sparse however was not taken into account and receive descriptors are always in little endian order, so just make the unions use__le64instead of u64.No functional change.
Signed-off-by Jesse Brandeburg <[email protected]>---
Warning Detail:
CHECK.../igb/igb_main.c.../igb/igb_main.c:442:25: warning: cast to restricted__le64.../igb/igb_main.c:442:25: warning: cast to restricted__le64.../igb/igb_main.c:522:33: warning: cast to restricted__le64.../igb/igb_main.c:522:33: warning: cast to restricted__le64.../igb/igb_main.c:528:33: warning: cast to restricted__le64.../igb/igb_main.c:528:33: warning: cast to restricted__le64
CHECK.../igc/igc_dump.c.../igc/igc_dump.c:192:40: warning: cast to restricted__le64.../igc/igc_dump.c:193:37: warning: cast to restricted__le64.../igc/igc_dump.c:275:45: warning: cast to restricted__le64.../igc/igc_dump.c:276:45: warning: cast to restricted__le64.../igc/igc_dump.c:281:45: warning: cast to restricted__le64.../igc/igc_dump.c:282:45: warning: cast to restricted__le64
---drivers/net/ethernet/intel/igb/igb_main.c| 2 +-drivers/net/ethernet/intel/igc/igc_dump.c| 2 +-
Quoted 2 lines
2 files changed, 2 insertions(+), 2 deletions(-)
Switzer
PATCH v2 4/11 igb/igc: use strongly typed pointer
In reply to Jesse BrandeburgQuoted 5 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jesse Brandeburg
Sent: Thursday, March 25, 2021 5:38 PM
Quoted 31 lines
Subject: [Intel-wired-lan] [PATCH net-next v2 04/11] igb/igc: use strongly typed pointer
The igb and igc driver both use a trick of creating a local type pointer on the stack to ease dealing with a receive descriptor in
64 bit chunks for printing. Sparse however was not taken into account and receive descriptors are always in little endian order, so just make the unions use__le64instead of u64.No functional change.
Signed-off-by Jesse Brandeburg <[email protected]>---
Warning Detail:
CHECK.../igb/igb_main.c.../igb/igb_main.c:442:25: warning: cast to restricted__le64.../igb/igb_main.c:442:25: warning: cast to restricted__le64.../igb/igb_main.c:522:33: warning: cast to restricted__le64.../igb/igb_main.c:522:33: warning: cast to restricted__le64.../igb/igb_main.c:528:33: warning: cast to restricted__le64.../igb/igb_main.c:528:33: warning: cast to restricted__le64
CHECK.../igc/igc_dump.c.../igc/igc_dump.c:192:40: warning: cast to restricted__le64.../igc/igc_dump.c:193:37: warning: cast to restricted__le64.../igc/igc_dump.c:275:45: warning: cast to restricted__le64.../igc/igc_dump.c:276:45: warning: cast to restricted__le64.../igc/igc_dump.c:281:45: warning: cast to restricted__le64.../igc/igc_dump.c:282:45: warning: cast to restricted__le64
---drivers/net/ethernet/intel/igb/igb_main.c| 2 +-drivers/net/ethernet/intel/igc/igc_dump.c| 2 +-
Quoted 2 lines
2 files changed, 2 insertions(+), 2 deletions(-)
PATCH v2 5/11 igb: handle vlan types with checker enabled
In reply to Jesse BrandeburgThe sparse build (C=2) finds some issues with how the driver dealt with the (very difficult) hardware that in some generations uses little-endian, and in others uses big endian, for the VLAN field. The code as written picks __le16 as a type and for some hardware revisions we override it to __be16 as done in this patch. This impacted the VF driver as well so fix it there too.
Also change the vlan_tci assignment to override the sparse warning without changing functionality.
---
Warning Detail:.../igb/igb_main.c:2644:48: warning: incorrect type in assignment (different base types).../igb/igb_main.c:2644:48: expected restricted __be16 [usertype] vlan_tci.../igb/igb_main.c:2644:48: got unsigned short [usertype] vlan_priority:3.../igb/igb_main.c:8608:31: warning: cast to restricted __be16 .../igb/igb_main.c:8608:31: warning: cast from restricted __le16 .../igb/igb_main.c:8608:31: warning: cast to restricted __be16 .../igb/igb_main.c:8608:31: warning: cast from restricted __le16 .../igb/igb_main.c:8608:31: warning: cast to restricted __be16 .../igb/igb_main.c:8608:31: warning: cast from restricted __le16 .../igb/igb_main.c:8608:31: warning: cast to restricted __be16 .../igb/igb_main.c:8608:31: warning: cast from restricted __le16 .../igbvf/netdev.c:93:31: warning: cast to restricted __be16 .../igbvf/netdev.c:93:31: warning: cast to restricted __be16 .../igbvf/netdev.c:93:31: warning: cast to restricted __be16 .../igbvf/netdev.c:93:31: warning: cast to restricted __be16 .../igbvf/netdev.c:95:31: warning: cast to restricted __le16
--- drivers/net/ethernet/intel/igb/igb_main.c | 5 +++-- drivers/net/ethernet/intel/igbvf/netdev.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +3 -2
@@ -2641,7 +2641,8 @@ static int igb_parse_cls_flower(struct igb_adapter *adapter, } input->filter.match_flags |=IGB_FILTER_FLAG_VLAN_TCI ; - input->filter.vlan_tci = match.key->vlan_priority; + input->filter.vlan_tci = + (__force __be16 )match.key->vlan_priority; } }
@@ -8604,7 +8605,7 @@ static void igb_process_skb_fields(struct igb_ring *rx_ring,if (igb_test_staterr (rx_desc,E1000_RXDEXT_STATERR_LB ) &&test_bit (IGB_RING_FLAG_RX_LB_VLAN_BSWAP , &rx_ring->flags)) - vid =be16_to_cpu (rx_desc->wb.upper.vlan); + vid =be16_to_cpu ((__force __be16 )rx_desc->wb.upper.vlan);else vid =le16_to_cpu (rx_desc->wb.upper.vlan);
drivers/net/ethernet/intel/igbvf/netdev.c +2 -2
@@ -83,14 +83,14 @@ static int igbvf_desc_unused(struct igbvf_ring *ring)static void igbvf_receive_skb (struct igbvf_adapter *adapter,struct net_device *netdev,struct sk_buff *skb, -u32 status,u16 vlan) +u32 status,__le16 vlan) {u16 vid;if (status &E1000_RXD_STAT_VP ) {if ((adapter->flags &IGBVF_FLAG_RX_LB_VLAN_BSWAP ) && (status &E1000_RXDEXT_STATERR_LB )) - vid =be16_to_cpu (vlan) &E1000_RXD_SPC_VLAN_MASK ; + vid =be16_to_cpu ((__force __be16 )vlan) &E1000_RXD_SPC_VLAN_MASK ;else vid =le16_to_cpu (vlan) &E1000_RXD_SPC_VLAN_MASK ;if (test_bit (vid, adapter->active_vlans))
Signature · 1 line
2.30.2
Switzer
PATCH v2 5/11 igb: handle vlan types with checker enabled
Quoted 6 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jesse Brandeburg
Sent: Thursday, March 25, 2021 5:38 PM
Quoted 35 lines
Subject: [Intel-wired-lan] [PATCH net-next v2 05/11] igb: handle vlan types with checker enabled
The sparse build (C=2) finds some issues with how the driver dealt with the (very difficult) hardware that in some generations uses little-endian, and in others uses big endian, for the VLAN field. The code as written picks
__le16as a type and for some hardware revisions we override it to__be16as done in this patch. This impacted the VF driver as well so fix it there too.Also change the
vlan_tciassignment to override the sparse warning without changing functionality.Signed-off-by Jesse Brandeburg <[email protected]>---
Warning Detail:.../igb/igb_main.c:2644:48: warning: incorrect type in assignment (different base types).../igb/igb_main.c:2644:48: expected restricted__be16[usertype]vlan_tci.../igb/igb_main.c:2644:48: got unsigned short [usertype] vlan_priority:3.../igb/igb_main.c:8608:31: warning: cast to restricted__be16.../igb/igb_main.c:8608:31: warning: cast from restricted__le16.../igb/igb_main.c:8608:31: warning: cast to restricted__be16.../igb/igb_main.c:8608:31: warning: cast from restricted__le16.../igb/igb_main.c:8608:31: warning: cast to restricted__be16.../igb/igb_main.c:8608:31: warning: cast from restricted__le16.../igb/igb_main.c:8608:31: warning: cast to restricted__be16.../igb/igb_main.c:8608:31: warning: cast from restricted__le16.../igbvf/netdev.c:93:31: warning: cast to restricted__be16.../igbvf/netdev.c:93:31: warning: cast to restricted__be16.../igbvf/netdev.c:93:31: warning: cast to restricted__be16.../igbvf/netdev.c:93:31: warning: cast to restricted__be16.../igbvf/netdev.c:95:31: warning: cast to restricted__le16
---drivers/net/ethernet/intel/igb/igb_main.c| 5 +++--drivers/net/ethernet/intel/igbvf/netdev.c| 4 ++--
Quoted 2 lines
2 files changed, 5 insertions(+), 4 deletions(-)
PATCH v2 6/11 igb: fix assignment on big endian machines
In reply to Jesse BrandeburgThe igb driver was trying hard to be sparse correct, but somehow ended up converting a variable into little endian order and then tries to OR something with it.
A much plainer way of doing things is to leave all variables and OR operations in CPU (non-endian) mode, and then convert to little endian only once, which is what this change does.
This probably fixes a bug that might have been seen only on big endian systems.
---
Warning Detail:.../igb/igb_main.c:6286:23: warning: incorrect type in assignment (different base types).../igb/igb_main.c:6286:23: expected unsigned int [usertype] olinfo_status.../igb/igb_main.c:6286:23: got restricted __le32 [usertype].../igb/igb_main.c:6291:37: warning: incorrect type in assignment (different base types).../igb/igb_main.c:6291:37: expected restricted __le32 [usertype] olinfo_status.../igb/igb_main.c:6291:37: got unsigned int [assigned] [usertype] olinfo_status
--- drivers/net/ethernet/intel/igb/igb_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +2 -2
@@ -6283,12 +6283,12 @@ int igb_xmit_xdp_ring(struct igb_adapter *adapter, cmd_type |= len |IGB_TXD_DCMD ; tx_desc->read.cmd_type_len =cpu_to_le32 (cmd_type); - olinfo_status =cpu_to_le32 (len <<E1000_ADVTXD_PAYLEN_SHIFT ); + olinfo_status = len <<E1000_ADVTXD_PAYLEN_SHIFT ;/* 82575 requires a unique index per ring */ if (test_bit (IGB_RING_FLAG_TX_CTX_IDX , &tx_ring->flags)) olinfo_status |= tx_ring->reg_idx <<4 ; - tx_desc->read.olinfo_status = olinfo_status; + tx_desc->read.olinfo_status =cpu_to_le32 (olinfo_status);netdev_tx_sent_queue (txring_txq (tx_ring), tx_buffer->bytecount);
Signature · 1 line
2.30.2
Switzer
PATCH v2 6/11 igb: fix assignment on big endian machines
Quoted 5 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jesse Brandeburg
Sent: Thursday, March 25, 2021 5:38 PM
Quoted 26 lines
Subject: [Intel-wired-lan] [PATCH net-next v2 06/11] igb: fix assignment on big endian machines
The igb driver was trying hard to be sparse correct, but somehow ended up converting a variable into little endian order and then tries to OR something with it.
A much plainer way of doing things is to leave all variables and OR operations in CPU (non-endian) mode, and then convert to little endian only once, which is what this change does.
This probably fixes a bug that might have been seen only on big endian systems.
Signed-off-by Jesse Brandeburg <[email protected]>---
Warning Detail:.../igb/igb_main.c:6286:23: warning: incorrect type in assignment (different base types).../igb/igb_main.c:6286:23: expected unsigned int [usertype]olinfo_status.../igb/igb_main.c:6286:23: got restricted__le32[usertype].../igb/igb_main.c:6291:37: warning: incorrect type in assignment (different base types).../igb/igb_main.c:6291:37: expected restricted__le32[usertype]olinfo_status.../igb/igb_main.c:6291:37: got unsigned int [assigned] [usertype]olinfo_status
---drivers/net/ethernet/intel/igb/igb_main.c| 4 ++--
Quoted 2 lines
1 file changed, 2 insertions(+), 2 deletions(-)
PATCH v2 7/11 igb: override two checker warnings
In reply to Jesse BrandeburgThe igb PTP code was using htons() on a constant to try to byte swap the value before writing it to a register. This byte swap has the consequence of triggering sparse conflicts between the register write which expect cpu ordered input, and the code which generated a big endian constant. Just override the cast to make sure code doesn't change but silence the warning.
Can't do a __swab16 in this case because big endian systems would then write the wrong value.
---
Warning Detail
CHECK .../igb/igb_ptp.c.../igb/igb_ptp.c:1137:17: warning: incorrect type in argument 1 (different base types).../igb/igb_ptp.c:1137:17: expected unsigned int val.../igb/igb_ptp.c:1137:17: got restricted __be16 [usertype].../igb/igb_ptp.c:1142:25: warning: incorrect type in argument 1 (different base types).../igb/igb_ptp.c:1142:25: expected unsigned int val.../igb/igb_ptp.c:1142:25: got restricted __be16 [usertype]
--- drivers/net/ethernet/intel/igb/igb_ptp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/igb/igb_ptp.c +2 -2
@@ -1134,12 +1134,12 @@ static int igb_ptp_set_timestamp_mode(struct igb_adapter *adapter, | E1000_FTQF_MASK); /* mask all inputs */ ftqf &= ~E1000_FTQF_MASK_PROTO_BP ;/* enable protocol check */ -wr32 (E1000_IMIR (3 ),htons (PTP_EV_PORT )); +wr32 (E1000_IMIR (3 ), (__force unsigned int )htons (PTP_EV_PORT ));wr32 (E1000_IMIREXT (3 ), (E1000_IMIREXT_SIZE_BP |E1000_IMIREXT_CTRL_BP ));if (hw->mac.type == e1000_82576) {/* enable source port check */ -wr32 (E1000_SPQF (3 ),htons (PTP_EV_PORT )); +wr32 (E1000_SPQF (3 ), (__force unsigned int )htons (PTP_EV_PORT )); ftqf &= ~E1000_FTQF_MASK_SOURCE_PORT_BP ; }wr32 (E1000_FTQF (3 ), ftqf);
Signature · 1 line
2.30.2
Switzer
PATCH v2 7/11 igb: override two checker warnings
Quoted 5 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jesse Brandeburg
Sent: Thursday, March 25, 2021 5:39 PM
Quoted 26 lines
Subject: [Intel-wired-lan] [PATCH net-next v2 07/11] igb: override two checker warnings
The igb PTP code was using
htons()on a constant to try to byte swap the value before writing it to a register. This byte swap has the consequence of triggering sparse conflicts between the register write which expect cpu ordered input, and the code which generated a big endian constant. Just override the cast to make sure code doesn't change but silence the warning.Can't do a
__swab16in this case because big endian systems would then write the wrong value.Signed-off-by Jesse Brandeburg <[email protected]>---
Warning Detail
CHECK.../igb/igb_ptp.c.../igb/igb_ptp.c:1137:17: warning: incorrect type in argument 1 (different base types).../igb/igb_ptp.c:1137:17: expected unsigned int val.../igb/igb_ptp.c:1137:17: got restricted__be16[usertype].../igb/igb_ptp.c:1142:25: warning: incorrect type in argument 1 (different base types).../igb/igb_ptp.c:1142:25: expected unsigned int val.../igb/igb_ptp.c:1142:25: got restricted__be16[usertype]
---drivers/net/ethernet/intel/igb/igb_ptp.c| 4 ++--
Quoted 2 lines
1 file changed, 2 insertions(+), 2 deletions(-)
PATCH v2 8/11 intel: call csum functions with well formatted arguments
In reply to Jesse BrandeburgThe sparse build (C=2) found that there were two drivers who had not been convered to call the csum_replace_by_diff() function with sparse clean arguments. Most if not all drivers force the cast like this patch does. So these drivers are now joining the party (a bit late), but with no functional change.
---
Warning Detail:.../igbvf/netdev.c:2059:46: warning: incorrect type in argument 2 (different base types).../igbvf/netdev.c:2059:46: expected restricted __wsum [usertype] diff.../igbvf/netdev.c:2059:46: got restricted __be32 [usertype].../ixgbevf/ixgbevf_main.c:3817:46: warning: incorrect type in argument 2 (different base types).../ixgbevf/ixgbevf_main.c:3817:46: expected restricted __wsum [usertype] diff.../ixgbevf/ixgbevf_main.c:3817:46: got restricted __be32 [usertype]
--- drivers/net/ethernet/intel/igbvf/netdev.c | 2 +- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/igbvf/netdev.c +1 -1
@@ -2056,7 +2056,7 @@ static int igbvf_tso(struct igbvf_ring *tx_ring,/* remove payload length from inner checksum */ paylen = skb->len - l4_offset; -csum_replace_by_diff (&l4.tcp->check,htonl (paylen)); +csum_replace_by_diff (&l4.tcp->check, (__force __wsum )htonl (paylen));/* MSS L4LEN IDX */ mss_l4len_idx = (*hdr_len - l4_offset) <<E1000_ADVTXD_L4LEN_SHIFT ;
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +1 -1
@@ -3814,7 +3814,7 @@ static int ixgbevf_tso(struct ixgbevf_ring *tx_ring,/* remove payload length from inner checksum */ paylen = skb->len - l4_offset; -csum_replace_by_diff (&l4.tcp->check,htonl (paylen)); +csum_replace_by_diff (&l4.tcp->check, (__force __wsum )htonl (paylen));/* update gso size and bytecount with header size */ first->gso_segs =skb_shinfo (skb)->gso_segs;
Signature · 1 line
2.30.2
PATCH v2 9/11 igbvf: convert to strongly typed descriptors
In reply to Jesse BrandeburgThe igbvf driver for some reason never strongly typed it's descriptor formats. Make this driver like the rest of the Intel drivers and use __le* for our little endian descriptors.
---
Warning Detail.../igbvf/netdev.c:203:48: warning: incorrect type in assignment (different base types).../igbvf/netdev.c:203:48: expected unsigned long long [usertype] pkt_addr.../igbvf/netdev.c:203:48: got restricted __le64 [usertype].../igbvf/netdev.c:205:48: warning: incorrect type in assignment (different base types).../igbvf/netdev.c:205:48: expected unsigned long long [usertype] hdr_addr.../igbvf/netdev.c:205:48: got restricted __le64 [usertype].../igbvf/netdev.c:207:48: warning: incorrect type in assignment (different base types).../igbvf/netdev.c:207:48: expected unsigned long long [usertype] pkt_addr.../igbvf/netdev.c:207:48: got restricted __le64 [usertype].../igbvf/netdev.c:261:19: warning: cast to restricted __le32 .../igbvf/netdev.c:276:25: warning: cast to restricted __le16 .../igbvf/netdev.c:282:26: warning: cast to restricted __le16 .../igbvf/netdev.c:356:52: warning: incorrect type in argument 5 (different base types).../igbvf/netdev.c:356:52: expected restricted __le16 [usertype] vlan.../igbvf/netdev.c:356:52: got unsigned short [usertype] vlan.../igbvf/netdev.c:371:27: warning: cast to restricted __le32 .../igbvf/netdev.c:797:45: warning: restricted __le32 degrades to integer .../igbvf/netdev.c:1992:41: warning: incorrect type in assignment (different base types).../igbvf/netdev.c:1992:41: expected unsigned int [usertype] vlan_macip_lens.../igbvf/netdev.c:1992:41: got restricted __le32 [usertype].../igbvf/netdev.c:1994:41: warning: incorrect type in assignment (different base types).../igbvf/netdev.c:1994:41: expected unsigned int [usertype] type_tucmd_mlhl.../igbvf/netdev.c:1994:41: got restricted __le32 [usertype].../igbvf/netdev.c:1995:41: warning: incorrect type in assignment (different base types).../igbvf/netdev.c:1995:41: expected unsigned int [usertype] mss_l4len_idx.../igbvf/netdev.c:1995:41: got restricted __le32 [usertype]
--- drivers/net/ethernet/intel/igbvf/vf.h | 42 +++++++++++++-------------- 1 file changed, 21 insertions(+), 21 deletions(-)
drivers/net/ethernet/intel/igbvf/vf.h +21 -21
@@ -35,31 +35,31 @@ struct e1000_hw;/* Receive Descriptor - Advanced */ union e1000_adv_rx_desc {struct { -u64 pkt_addr;/* Packet buffer address */ -u64 hdr_addr;/* Header buffer address */ +__le64 pkt_addr;/* Packet buffer address */ +__le64 hdr_addr;/* Header buffer address */ } read;struct {struct {union { -u32 data; +__le32 data;struct { -u16 pkt_info;/* RSS/Packet type */ +__le16 pkt_info;/* RSS/Packet type */ /* Split Header, hdr buffer length */ -u16 hdr_info; +__le16 hdr_info; } hs_rss; } lo_dword;union { -u32 rss;/* RSS Hash */ +__le32 rss;/* RSS Hash */ struct { -u16 ip_id;/* IP id */ -u16 csum;/* Packet Checksum */ +__le16 ip_id;/* IP id */ +__le16 csum;/* Packet Checksum */ } csum_ip; } hi_dword; } lower;struct { -u32 status_error;/* ext status/error */ -u16 length;/* Packet length */ -u16 vlan;/* VLAN tag */ +__le32 status_error;/* ext status/error */ +__le16 length;/* Packet length */ +__le16 vlan;/* VLAN tag */ } upper; } wb;/* writeback */ };
@@ -70,14 +70,14 @@ union e1000_adv_rx_desc {/* Transmit Descriptor - Advanced */ union e1000_adv_tx_desc {struct { -u64 buffer_addr;/* Address of descriptor's data buf */ -u32 cmd_type_len; -u32 olinfo_status; +__le64 buffer_addr;/* Address of descriptor's data buf */ +__le32 cmd_type_len; +__le32 olinfo_status; } read;struct { -u64 rsvd;/* Reserved */ -u32 nxtseq_seed; -u32 status; +__le64 rsvd;/* Reserved */ +__le32 nxtseq_seed; +__le32 status; } wb; };
@@ -94,10 +94,10 @@ union e1000_adv_tx_desc {/* Context descriptors */ struct e1000_adv_tx_context_desc { -u32 vlan_macip_lens; -u32 seqnum_seed; -u32 type_tucmd_mlhl; -u32 mss_l4len_idx; +__le32 vlan_macip_lens; +__le32 seqnum_seed; +__le32 type_tucmd_mlhl; +__le32 mss_l4len_idx; };#define E1000_ADVTXD_MACLEN_SHIFT 9/* Adv ctxt desc mac len shift */
Signature · 1 line
2.30.2
PATCH v2 10/11 ixgbe: use checker safe conversions
In reply to Jesse BrandeburgThe ixgbe hardware needs some very specific programming for certain registers, which led to some misguided usage of ntohs instead of using be16_to_cpu(), as well as a home grown swap followed by an ntohs. Sparse didn't like this at all, and this fixes the C=2 build, with code that uses native kernel interface.
---
Warning Details:.../ixgbe/ixgbe_82599.c:1660:20: warning: cast to restricted __be16 .../ixgbe/ixgbe_82599.c:1660:20: warning: cast to restricted __be16 .../ixgbe/ixgbe_82599.c:1660:20: warning: cast to restricted __be16 .../ixgbe/ixgbe_82599.c:1660:20: warning: cast to restricted __be16
--- drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c +4 -5
@@ -1514,8 +1514,7 @@ static u32 ixgbe_get_fdirtcpm_82599(union ixgbe_atr_input *input_mask)#define IXGBE_WRITE_REG_BE32 (a, reg, value) \ IXGBE_WRITE_REG((a), (reg), IXGBE_STORE_AS_BE32(ntohl(value))) -#define IXGBE_STORE_AS_BE16 (_value) \ - ntohs(((u16)(_value) >> 8) | ((u16)(_value) << 8)) +#define IXGBE_STORE_AS_BE16 (_value) __swab16(ntohs((_value)))s32 ixgbe_fdir_set_input_mask_82599 (struct ixgbe_hw *hw,union ixgbe_atr_input *input_mask)
@@ -1651,13 +1650,13 @@ s32 ixgbe_fdir_write_perfect_filter_82599(struct ixgbe_hw *hw,IXGBE_WRITE_REG_BE32 (hw,IXGBE_FDIRIPDA , input->formatted.dst_ip[0 ]);/* record source and destination port (little-endian)*/ - fdirport =ntohs (input->formatted.dst_port); + fdirport =be16_to_cpu (input->formatted.dst_port); fdirport <<=IXGBE_FDIRPORT_DESTINATION_SHIFT ; - fdirport |=ntohs (input->formatted.src_port); + fdirport |=be16_to_cpu (input->formatted.src_port);IXGBE_WRITE_REG (hw,IXGBE_FDIRPORT , fdirport);/* record vlan (little-endian) and flex_bytes(big-endian) */ - fdirvlan =IXGBE_STORE_AS_BE16 ((__force u16 )input->formatted.flex_bytes); + fdirvlan =IXGBE_STORE_AS_BE16 (input->formatted.flex_bytes); fdirvlan <<=IXGBE_FDIRVLAN_FLEX_SHIFT ; fdirvlan |=ntohs (input->formatted.vlan_id);IXGBE_WRITE_REG (hw,IXGBE_FDIRVLAN , fdirvlan);
Signature · 1 line
2.30.2
Switzer
PATCH v2 10/11 ixgbe: use checker safe conversions
Quoted 5 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jesse Brandeburg
Sent: Thursday, March 25, 2021 5:39 PM
Quoted 17 lines
Subject: [Intel-wired-lan] [PATCH net-next v2 10/11] ixgbe: use checker safe conversions
The ixgbe hardware needs some very specific programming for certain registers, which led to some misguided usage of ntohs instead of using
be16_to_cpu(), as well as a home grown swap followed by an ntohs. Sparse didn't like this at all, and this fixes the C=2 build, with code that uses native kernel interface.Signed-off-by Jesse Brandeburg <[email protected]>---
Warning Details:.../ixgbe/ixgbe_82599.c:1660:20: warning: cast to restricted__be16.../ixgbe/ixgbe_82599.c:1660:20: warning: cast to restricted__be16.../ixgbe/ixgbe_82599.c:1660:20: warning: cast to restricted__be16.../ixgbe/ixgbe_82599.c:1660:20: warning: cast to restricted__be16
---drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c| 9 ++++-----
Quoted 2 lines
1 file changed, 4 insertions(+), 5 deletions(-)
PATCH v2 11/11 ixgbe: reduce checker warnings
In reply to Jesse BrandeburgFix the sparse warnings in the ixgbe crypto offload code. These changes were made in the most conservative way (force cast) in order to hopefully not break the code. I suspect that the code might still be broken on big-endian architectures, but no one is complaining, so I'm just leaving it functionally the same.
---
Warning Detail:.../ixgbe/ixgbe_ipsec.c:514:56: warning: restricted __be32 degrades to integer .../ixgbe/ixgbe_ipsec.c:521:48: warning: restricted __be32 degrades to integer .../ixgbe/ixgbe_ipsec.c:536:59: warning: restricted __be32 degrades to integer .../ixgbe/ixgbe_ipsec.c:546:59: warning: restricted __be32 degrades to integer
--- drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c +4 -4
@@ -511,14 +511,14 @@ static int ixgbe_ipsec_check_mgmt_ip(struct xfrm_state *xs)continue ; reg =IXGBE_READ_REG (hw,MIPAF_ARR (3 , i)); -if (reg == xs->id.daddr.a4) +if (reg == (__force u32 )xs->id.daddr.a4)return 1 ; } }if ((bmcipval &BMCIP_MASK ) ==BMCIP_V4 ) { reg =IXGBE_READ_REG (hw,IXGBE_BMCIP (3 )); -if (reg == xs->id.daddr.a4) +if (reg == (__force u32 )xs->id.daddr.a4)return 1 ; }
@@ -533,7 +533,7 @@ static int ixgbe_ipsec_check_mgmt_ip(struct xfrm_state *xs)for (j =0 ; j <4 ; j++) { reg =IXGBE_READ_REG (hw,MIPAF_ARR (i, j)); -if (reg != xs->id.daddr.a6[j]) +if (reg != (__force u32 )xs->id.daddr.a6[j])break ; }if (j ==4 )/* did we match all 4 words? */
@@ -543,7 +543,7 @@ static int ixgbe_ipsec_check_mgmt_ip(struct xfrm_state *xs)if ((bmcipval &BMCIP_MASK ) ==BMCIP_V6 ) {for (j =0 ; j <4 ; j++) { reg =IXGBE_READ_REG (hw,IXGBE_BMCIP (j)); -if (reg != xs->id.daddr.a6[j]) +if (reg != (__force u32 )xs->id.daddr.a6[j])break ; }if (j ==4 )/* did we match all 4 words? */
Signature · 1 line
2.30.2
PATCH v2 11/11 ixgbe: reduce checker warnings
Quoted 6 lines · Jesse Brandeburg
Fix the sparse warnings in the ixgbe crypto offload code. These changes were made in the most conservative way (force cast) in order to hopefully not break the code. I suspect that the code might still be broken on big-endian architectures, but no one is complaining, so I'm just leaving it functionally the same.
Thanks for poking at this one.
Yeah, this is a funky one where these specific register contents are in BE order in niantic, as are the address array entries, but IXGBE_READ_REG() is defined as returning u32.? The point is that we want to compare the register contents directly to the array entries with no byteswapping.? I don't think this is broken on BE arch, but I can't remember if I tested it on SPARC things when I wrote this at my previous employer.
It might make more sense in this context to define reg as __be32 and then force the cast on the return from IXGBE_READ_REG().? Maybe even change the name of 'reg' to 'be_reg' or 'bigend' just to be obnoxiously clear that this is a weird register.
sln
Quoted 51 lines
Signed-off-by Jesse Brandeburg <[email protected]>Cc Shannon Nelson <[email protected]>---
Warning Detail:.../ixgbe/ixgbe_ipsec.c:514:56: warning: restricted__be32degrades to integer.../ixgbe/ixgbe_ipsec.c:521:48: warning: restricted__be32degrades to integer.../ixgbe/ixgbe_ipsec.c:536:59: warning: restricted__be32degrades to integer.../ixgbe/ixgbe_ipsec.c:546:59: warning: restricted__be32degrades to integer--- drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c +4
-4@@ -511,14 +511,14 @@ static int ixgbe_ipsec_check_mgmt_ip(struct xfrm_state *xs)continue ; reg =IXGBE_READ_REG (hw,MIPAF_ARR (3 , i)); -if (reg == xs->id.daddr.a4) +if (reg == (__force u32 )xs->id.daddr.a4)return 1 ; } }if ((bmcipval &BMCIP_MASK ) ==BMCIP_V4 ) { reg =IXGBE_READ_REG (hw,IXGBE_BMCIP (3 )); -if (reg == xs->id.daddr.a4) +if (reg == (__force u32 )xs->id.daddr.a4)return 1 ; }@@ -533,7 +533,7 @@ static int ixgbe_ipsec_check_mgmt_ip(struct xfrm_state *xs)for (j =0 ; j <4 ; j++) { reg =IXGBE_READ_REG (hw,MIPAF_ARR (i, j)); -if (reg != xs->id.daddr.a6[j]) +if (reg != (__force u32 )xs->id.daddr.a6[j])break ; }if (j ==4 )/* did we match all 4 words? */ @@ -543,7 +543,7 @@ static int ixgbe_ipsec_check_mgmt_ip(struct xfrm_state *xs)if ((bmcipval &BMCIP_MASK ) ==BMCIP_V6 ) {for (j =0 ; j <4 ; j++) { reg =IXGBE_READ_REG (hw,IXGBE_BMCIP (j)); -if (reg != xs->id.daddr.a6[j]) +if (reg != (__force u32 )xs->id.daddr.a6[j])break ; }if (j ==4 )/* did we match all 4 words? */
Switzer
PATCH v2 11/11 ixgbe: reduce checker warnings
In reply to Jesse BrandeburgQuoted 5 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jesse Brandeburg
Sent: Thursday, March 25, 2021 5:39 PM
Quoted 20 lines
Cc: Shannon Nelson <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next v2 11/11] ixgbe: reduce checker warningsFix the sparse warnings in the ixgbe crypto offload code. These changes were made in the most conservative way (force cast) in order to hopefully not break the code. I suspect that the code might still be broken on big-endian architectures, but no one is complaining, so I'm just leaving it functionally the same.
Signed-off-by Jesse Brandeburg <[email protected]>Cc Shannon Nelson <[email protected]>---
Warning Detail:.../ixgbe/ixgbe_ipsec.c:514:56: warning: restricted__be32degrades to integer.../ixgbe/ixgbe_ipsec.c:521:48: warning: restricted__be32degrades to integer.../ixgbe/ixgbe_ipsec.c:536:59: warning: restricted__be32degrades to integer.../ixgbe/ixgbe_ipsec.c:546:59: warning: restricted__be32degrades to integer
---drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c| 8 ++++----
Quoted 2 lines
1 file changed, 4 insertions(+), 4 deletions(-)