All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 00/11][pull request] 1GbE Intel Wired LAN Driver Updates 2021-05-26
@ 2021-05-26 17:23 Tony Nguyen
  2021-05-26 17:23 ` [PATCH net-next 01/11] e100: handle eeprom as little endian Tony Nguyen
                   ` (11 more replies)
  0 siblings, 12 replies; 14+ messages in thread
From: Tony Nguyen @ 2021-05-26 17:23 UTC (permalink / raw)
  To: davem, kuba; +Cc: Tony Nguyen, netdev, sassmann, jesse.brandeburg

Jesse Brandeburg says:

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().

The following are changes since commit e4e92ee78702b13ad55118d8b66f06e1aef62586:
  net: wwan: core: Add WWAN device index sysfs attribute
and are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue 1GbE

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(-)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH net-next 01/11] e100: handle eeprom as little endian
  2021-05-26 17:23 [PATCH net-next 00/11][pull request] 1GbE Intel Wired LAN Driver Updates 2021-05-26 Tony Nguyen
@ 2021-05-26 17:23 ` Tony Nguyen
  2021-05-26 17:23 ` [PATCH net-next 02/11] intel: remove checker warning Tony Nguyen
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Tony Nguyen @ 2021-05-26 17:23 UTC (permalink / raw)
  To: davem, kuba; +Cc: Jesse Brandeburg, netdev, sassmann, anthony.l.nguyen

From: Jesse Brandeburg <jesse.brandeburg@intel.com>

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().

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
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(-)

diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c
index f8d78af76d7d..1b0958bd24f6 100644
--- a/drivers/net/ethernet/intel/e100.c
+++ b/drivers/net/ethernet/intel/e100.c
@@ -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);
 	}
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH net-next 02/11] intel: remove checker warning
  2021-05-26 17:23 [PATCH net-next 00/11][pull request] 1GbE Intel Wired LAN Driver Updates 2021-05-26 Tony Nguyen
  2021-05-26 17:23 ` [PATCH net-next 01/11] e100: handle eeprom as little endian Tony Nguyen
@ 2021-05-26 17:23 ` Tony Nguyen
  2021-05-26 17:23 ` [PATCH net-next 03/11] fm10k: move error check Tony Nguyen
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Tony Nguyen @ 2021-05-26 17:23 UTC (permalink / raw)
  To: davem, kuba
  Cc: Jesse Brandeburg, netdev, sassmann, anthony.l.nguyen, Dave Switzer

From: Jesse Brandeburg <jesse.brandeburg@intel.com>

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 <jesse.brandeburg@intel.com>
Tested-by: Dave Switzer <david.switzer@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
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(-)

diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
index f976e9daa3d8..3c51ee94fa00 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
@@ -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);
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index 7545da216d8b..636a1b1fb7e1 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -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);
diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c
index 9722449d7633..2cb12431c371 100644
--- a/drivers/net/ethernet/intel/igc/igc_ethtool.c
+++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c
@@ -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);
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH net-next 03/11] fm10k: move error check
  2021-05-26 17:23 [PATCH net-next 00/11][pull request] 1GbE Intel Wired LAN Driver Updates 2021-05-26 Tony Nguyen
  2021-05-26 17:23 ` [PATCH net-next 01/11] e100: handle eeprom as little endian Tony Nguyen
  2021-05-26 17:23 ` [PATCH net-next 02/11] intel: remove checker warning Tony Nguyen
@ 2021-05-26 17:23 ` Tony Nguyen
  2021-05-26 17:23 ` [PATCH net-next 04/11] igb/igc: use strongly typed pointer Tony Nguyen
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Tony Nguyen @ 2021-05-26 17:23 UTC (permalink / raw)
  To: davem, kuba; +Cc: Jesse Brandeburg, netdev, sassmann, anthony.l.nguyen

From: Jesse Brandeburg <jesse.brandeburg@intel.com>

The 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.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
index 9e3103fae723..dbcae92bb18d 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
@@ -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 */
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH net-next 04/11] igb/igc: use strongly typed pointer
  2021-05-26 17:23 [PATCH net-next 00/11][pull request] 1GbE Intel Wired LAN Driver Updates 2021-05-26 Tony Nguyen
                   ` (2 preceding siblings ...)
  2021-05-26 17:23 ` [PATCH net-next 03/11] fm10k: move error check Tony Nguyen
@ 2021-05-26 17:23 ` Tony Nguyen
  2021-05-26 17:23 ` [PATCH net-next 05/11] igb: handle vlan types with checker enabled Tony Nguyen
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Tony Nguyen @ 2021-05-26 17:23 UTC (permalink / raw)
  To: davem, kuba
  Cc: Jesse Brandeburg, netdev, sassmann, anthony.l.nguyen,
	Dvora Fuxbrumer, Dave Switzer

From: Jesse Brandeburg <jesse.brandeburg@intel.com>

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 __le64 instead of u64.

No functional change.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Dvora Fuxbrumer <dvorax.fuxbrumer@linux.intel.com>
Tested-by: Dave Switzer <david.switzer@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
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(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 038a9fd1af44..cf91e3624a89 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -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;
diff --git a/drivers/net/ethernet/intel/igc/igc_dump.c b/drivers/net/ethernet/intel/igc/igc_dump.c
index 495bed47ed0a..c09c95cc5f70 100644
--- a/drivers/net/ethernet/intel/igc/igc_dump.c
+++ b/drivers/net/ethernet/intel/igc/igc_dump.c
@@ -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;
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH net-next 05/11] igb: handle vlan types with checker enabled
  2021-05-26 17:23 [PATCH net-next 00/11][pull request] 1GbE Intel Wired LAN Driver Updates 2021-05-26 Tony Nguyen
                   ` (3 preceding siblings ...)
  2021-05-26 17:23 ` [PATCH net-next 04/11] igb/igc: use strongly typed pointer Tony Nguyen
@ 2021-05-26 17:23 ` Tony Nguyen
  2021-05-26 17:23 ` [PATCH net-next 06/11] igb: fix assignment on big endian machines Tony Nguyen
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Tony Nguyen @ 2021-05-26 17:23 UTC (permalink / raw)
  To: davem, kuba
  Cc: Jesse Brandeburg, netdev, sassmann, anthony.l.nguyen, Dave Switzer

From: Jesse Brandeburg <jesse.brandeburg@intel.com>

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 __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.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Dave Switzer <david.switzer@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
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(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index cf91e3624a89..3a96b61a7229 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -2643,7 +2643,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;
 		}
 	}
 
@@ -8597,7 +8598,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);
 
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c
index fb3fbcb13331..630c1155f196 100644
--- a/drivers/net/ethernet/intel/igbvf/netdev.c
+++ b/drivers/net/ethernet/intel/igbvf/netdev.c
@@ -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))
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH net-next 06/11] igb: fix assignment on big endian machines
  2021-05-26 17:23 [PATCH net-next 00/11][pull request] 1GbE Intel Wired LAN Driver Updates 2021-05-26 Tony Nguyen
                   ` (4 preceding siblings ...)
  2021-05-26 17:23 ` [PATCH net-next 05/11] igb: handle vlan types with checker enabled Tony Nguyen
@ 2021-05-26 17:23 ` Tony Nguyen
  2021-05-26 17:23 ` [PATCH net-next 07/11] igb: override two checker warnings Tony Nguyen
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Tony Nguyen @ 2021-05-26 17:23 UTC (permalink / raw)
  To: davem, kuba
  Cc: Jesse Brandeburg, netdev, sassmann, anthony.l.nguyen, Dave Switzer

From: Jesse Brandeburg <jesse.brandeburg@intel.com>

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 <jesse.brandeburg@intel.com>
Tested-by: Dave Switzer <david.switzer@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
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(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 3a96b61a7229..f555670e9271 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -6276,12 +6276,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);
 
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH net-next 07/11] igb: override two checker warnings
  2021-05-26 17:23 [PATCH net-next 00/11][pull request] 1GbE Intel Wired LAN Driver Updates 2021-05-26 Tony Nguyen
                   ` (5 preceding siblings ...)
  2021-05-26 17:23 ` [PATCH net-next 06/11] igb: fix assignment on big endian machines Tony Nguyen
@ 2021-05-26 17:23 ` Tony Nguyen
  2021-05-26 17:23 ` [PATCH net-next 08/11] intel: call csum functions with well formatted arguments Tony Nguyen
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Tony Nguyen @ 2021-05-26 17:23 UTC (permalink / raw)
  To: davem, kuba
  Cc: Jesse Brandeburg, netdev, sassmann, anthony.l.nguyen, Dave Switzer

From: Jesse Brandeburg <jesse.brandeburg@intel.com>

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 __swab16 in this case because big endian systems
would then write the wrong value.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Dave Switzer <david.switzer@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
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(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
index ba61fe9bfaf4..de08ae8db4d5 100644
--- a/drivers/net/ethernet/intel/igb/igb_ptp.c
+++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
@@ -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);
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH net-next 08/11] intel: call csum functions with well formatted arguments
  2021-05-26 17:23 [PATCH net-next 00/11][pull request] 1GbE Intel Wired LAN Driver Updates 2021-05-26 Tony Nguyen
                   ` (6 preceding siblings ...)
  2021-05-26 17:23 ` [PATCH net-next 07/11] igb: override two checker warnings Tony Nguyen
@ 2021-05-26 17:23 ` Tony Nguyen
  2021-05-26 17:23 ` [PATCH net-next 09/11] igbvf: convert to strongly typed descriptors Tony Nguyen
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Tony Nguyen @ 2021-05-26 17:23 UTC (permalink / raw)
  To: davem, kuba; +Cc: Jesse Brandeburg, netdev, sassmann, anthony.l.nguyen

From: Jesse Brandeburg <jesse.brandeburg@intel.com>

The 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.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
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(-)

diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c
index 630c1155f196..1bbe9862a758 100644
--- a/drivers/net/ethernet/intel/igbvf/netdev.c
+++ b/drivers/net/ethernet/intel/igbvf/netdev.c
@@ -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;
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index ba2ed8a43d2d..588c3aa50d94 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -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;
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH net-next 09/11] igbvf: convert to strongly typed descriptors
  2021-05-26 17:23 [PATCH net-next 00/11][pull request] 1GbE Intel Wired LAN Driver Updates 2021-05-26 Tony Nguyen
                   ` (7 preceding siblings ...)
  2021-05-26 17:23 ` [PATCH net-next 08/11] intel: call csum functions with well formatted arguments Tony Nguyen
@ 2021-05-26 17:23 ` Tony Nguyen
  2021-05-26 17:23 ` [PATCH net-next 10/11] ixgbe: use checker safe conversions Tony Nguyen
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Tony Nguyen @ 2021-05-26 17:23 UTC (permalink / raw)
  To: davem, kuba; +Cc: Jesse Brandeburg, netdev, sassmann, anthony.l.nguyen

From: Jesse Brandeburg <jesse.brandeburg@intel.com>

The 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.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
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
---
 drivers/net/ethernet/intel/igbvf/vf.h | 42 +++++++++++++--------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/net/ethernet/intel/igbvf/vf.h b/drivers/net/ethernet/intel/igbvf/vf.h
index c71b0d7dbcee..ba9bb3132d5d 100644
--- a/drivers/net/ethernet/intel/igbvf/vf.h
+++ b/drivers/net/ethernet/intel/igbvf/vf.h
@@ -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 */
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH net-next 10/11] ixgbe: use checker safe conversions
  2021-05-26 17:23 [PATCH net-next 00/11][pull request] 1GbE Intel Wired LAN Driver Updates 2021-05-26 Tony Nguyen
                   ` (8 preceding siblings ...)
  2021-05-26 17:23 ` [PATCH net-next 09/11] igbvf: convert to strongly typed descriptors Tony Nguyen
@ 2021-05-26 17:23 ` Tony Nguyen
  2021-05-26 17:23 ` [PATCH net-next 11/11] ixgbe: reduce checker warnings Tony Nguyen
  2021-05-27  1:40 ` [PATCH net-next 00/11][pull request] 1GbE Intel Wired LAN Driver Updates 2021-05-26 patchwork-bot+netdevbpf
  11 siblings, 0 replies; 14+ messages in thread
From: Tony Nguyen @ 2021-05-26 17:23 UTC (permalink / raw)
  To: davem, kuba
  Cc: Jesse Brandeburg, netdev, sassmann, anthony.l.nguyen, Dave Switzer

From: Jesse Brandeburg <jesse.brandeburg@intel.com>

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 <jesse.brandeburg@intel.com>
Tested-by: Dave Switzer <david.switzer@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
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(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
index e324e42fab2d..58ea959a4482 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
@@ -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);
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH net-next 11/11] ixgbe: reduce checker warnings
  2021-05-26 17:23 [PATCH net-next 00/11][pull request] 1GbE Intel Wired LAN Driver Updates 2021-05-26 Tony Nguyen
                   ` (9 preceding siblings ...)
  2021-05-26 17:23 ` [PATCH net-next 10/11] ixgbe: use checker safe conversions Tony Nguyen
@ 2021-05-26 17:23 ` Tony Nguyen
  2021-05-26 17:42   ` Shannon Nelson
  2021-05-27  1:40 ` [PATCH net-next 00/11][pull request] 1GbE Intel Wired LAN Driver Updates 2021-05-26 patchwork-bot+netdevbpf
  11 siblings, 1 reply; 14+ messages in thread
From: Tony Nguyen @ 2021-05-26 17:23 UTC (permalink / raw)
  To: davem, kuba
  Cc: Jesse Brandeburg, netdev, sassmann, anthony.l.nguyen,
	Shannon Nelson, Dave Switzer

From: Jesse Brandeburg <jesse.brandeburg@intel.com>

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.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Cc: Shannon Nelson <snelson@pensando.io>
Tested-by: Dave Switzer <david.switzer@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
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(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
index 54d47265a7ac..e596e1a9fc75 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
@@ -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? */
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH net-next 11/11] ixgbe: reduce checker warnings
  2021-05-26 17:23 ` [PATCH net-next 11/11] ixgbe: reduce checker warnings Tony Nguyen
@ 2021-05-26 17:42   ` Shannon Nelson
  0 siblings, 0 replies; 14+ messages in thread
From: Shannon Nelson @ 2021-05-26 17:42 UTC (permalink / raw)
  To: Tony Nguyen, davem, kuba; +Cc: Jesse Brandeburg, netdev, sassmann, Dave Switzer

On 5/26/21 10:23 AM, Tony Nguyen wrote:
> From: Jesse Brandeburg <jesse.brandeburg@intel.com>
>
> 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.
>
> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> Cc: Shannon Nelson <snelson@pensando.io>
> Tested-by: Dave Switzer <david.switzer@intel.com>
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>

Acked-by: Shannon Nelson <snelson@pensando.io>

> ---
> 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(-)
>
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
> index 54d47265a7ac..e596e1a9fc75 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
> @@ -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? */


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH net-next 00/11][pull request] 1GbE Intel Wired LAN Driver Updates 2021-05-26
  2021-05-26 17:23 [PATCH net-next 00/11][pull request] 1GbE Intel Wired LAN Driver Updates 2021-05-26 Tony Nguyen
                   ` (10 preceding siblings ...)
  2021-05-26 17:23 ` [PATCH net-next 11/11] ixgbe: reduce checker warnings Tony Nguyen
@ 2021-05-27  1:40 ` patchwork-bot+netdevbpf
  11 siblings, 0 replies; 14+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-05-27  1:40 UTC (permalink / raw)
  To: Tony Nguyen; +Cc: davem, kuba, netdev, sassmann, jesse.brandeburg

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

On Wed, 26 May 2021 10:23:35 -0700 you wrote:
> Jesse Brandeburg says:
> 
> 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.
> 
> [...]

Here is the summary with links:
  - [net-next,01/11] e100: handle eeprom as little endian
    https://git.kernel.org/netdev/net-next/c/d4ef55288aa2
  - [net-next,02/11] intel: remove checker warning
    https://git.kernel.org/netdev/net-next/c/c40591cc3d48
  - [net-next,03/11] fm10k: move error check
    https://git.kernel.org/netdev/net-next/c/0a5d8a9d226f
  - [net-next,04/11] igb/igc: use strongly typed pointer
    https://git.kernel.org/netdev/net-next/c/88c228b22e00
  - [net-next,05/11] igb: handle vlan types with checker enabled
    https://git.kernel.org/netdev/net-next/c/c7cbfb028b95
  - [net-next,06/11] igb: fix assignment on big endian machines
    https://git.kernel.org/netdev/net-next/c/b514958dd1a3
  - [net-next,07/11] igb: override two checker warnings
    https://git.kernel.org/netdev/net-next/c/9fb8602e565d
  - [net-next,08/11] intel: call csum functions with well formatted arguments
    https://git.kernel.org/netdev/net-next/c/de8447131d2b
  - [net-next,09/11] igbvf: convert to strongly typed descriptors
    https://git.kernel.org/netdev/net-next/c/b6ce4a1c4ba4
  - [net-next,10/11] ixgbe: use checker safe conversions
    https://git.kernel.org/netdev/net-next/c/b16dc6c2f178
  - [net-next,11/11] ixgbe: reduce checker warnings
    https://git.kernel.org/netdev/net-next/c/205523bc06ce

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-05-27  1:40 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-26 17:23 [PATCH net-next 00/11][pull request] 1GbE Intel Wired LAN Driver Updates 2021-05-26 Tony Nguyen
2021-05-26 17:23 ` [PATCH net-next 01/11] e100: handle eeprom as little endian Tony Nguyen
2021-05-26 17:23 ` [PATCH net-next 02/11] intel: remove checker warning Tony Nguyen
2021-05-26 17:23 ` [PATCH net-next 03/11] fm10k: move error check Tony Nguyen
2021-05-26 17:23 ` [PATCH net-next 04/11] igb/igc: use strongly typed pointer Tony Nguyen
2021-05-26 17:23 ` [PATCH net-next 05/11] igb: handle vlan types with checker enabled Tony Nguyen
2021-05-26 17:23 ` [PATCH net-next 06/11] igb: fix assignment on big endian machines Tony Nguyen
2021-05-26 17:23 ` [PATCH net-next 07/11] igb: override two checker warnings Tony Nguyen
2021-05-26 17:23 ` [PATCH net-next 08/11] intel: call csum functions with well formatted arguments Tony Nguyen
2021-05-26 17:23 ` [PATCH net-next 09/11] igbvf: convert to strongly typed descriptors Tony Nguyen
2021-05-26 17:23 ` [PATCH net-next 10/11] ixgbe: use checker safe conversions Tony Nguyen
2021-05-26 17:23 ` [PATCH net-next 11/11] ixgbe: reduce checker warnings Tony Nguyen
2021-05-26 17:42   ` Shannon Nelson
2021-05-27  1:40 ` [PATCH net-next 00/11][pull request] 1GbE Intel Wired LAN Driver Updates 2021-05-26 patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.