[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250804094156.1690216-1-jedrzej.jagielski@intel.com>
Date: Mon, 4 Aug 2025 11:41:56 +0200
From: Jedrzej Jagielski <jedrzej.jagielski@...el.com>
To: intel-wired-lan@...ts.osuosl.org
Cc: anthony.l.nguyen@...el.com,
netdev@...r.kernel.org,
Jedrzej Jagielski <jedrzej.jagielski@...el.com>,
Aleksandr Loktionov <aleksandr.loktionov@...el.com>,
Jacob Keller <jacob.e.keller@...el.com>,
Simon Horman <horms@...nel.org>,
Paul Menzel <pmenzel@...gen.mpg.de>
Subject: [PATCH iwl-next v2] ixgbe: reduce number of reads when getting OROM data
Currently, during locating the CIVD section, the ixgbe driver loops
over the OROM area and at each iteration reads only OROM-datastruct-size
amount of data. This results in many small reads and is inefficient.
Optimize this by reading the entire OROM bank into memory once before
entering the loop. This significantly reduces the probing time.
Without this patch probing time may exceed over 25s, whereas with this
patch applied avrege time of probe is not greter than 5s.
without the patch:
[14:12:22] ixgbe: Copyright (c) 1999-2016 Intel Corporation.
[14:12:25] ixgbe 0000:21:00.0: Multiqueue Enabled: Rx Queue count = 63, Tx Queue count = 63 XDP Queue count = 0
[14:12:25] ixgbe 0000:21:00.0: 63.012 Gb/s available PCIe bandwidth (16.0 GT/s PCIe x4 link)
[14:12:26] ixgbe 0000:21:00.0: MAC: 7, PHY: 27, PBA No: N55484-001
[14:12:26] ixgbe 0000:21:00.0: 20:3a:43:09:3a:12
[14:12:26] ixgbe 0000:21:00.0: Intel(R) 10 Gigabit Network Connection
[14:12:50] ixgbe 0000:21:00.0 ens2f0np0: renamed from eth0
with the patch:
[14:18:18] ixgbe: Copyright (c) 1999-2016 Intel Corporation.
[14:18:19] ixgbe 0000:21:00.0: Multiqueue Enabled: Rx Queue count = 63, Tx Queue count = 63 XDP Queue count = 0
[14:18:19] ixgbe 0000:21:00.0: 63.012 Gb/s available PCIe bandwidth (16.0 GT/s PCIe x4 link)
[14:18:19] ixgbe 0000:21:00.0: MAC: 7, PHY: 27, PBA No: N55484-001
[14:18:19] ixgbe 0000:21:00.0: 20:3a:43:09:3a:12
[14:18:19] ixgbe 0000:21:00.0: Intel(R) 10 Gigabit Network Connection
[14:18:22] ixgbe 0000:21:00.0 ens2f0np0: renamed from eth0
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@...el.com>
Reviewed-by: Jacob Keller <jacob.e.keller@...el.com>
Reviewed-by: Simon Horman <horms@...nel.org>
Reviewed-by: Paul Menzel <pmenzel@...gen.mpg.de>
Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@...el.com>
---
v2: extend the commit msg; minor code tweaks
---
drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c | 59 +++++++++++++------
1 file changed, 40 insertions(+), 19 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
index 87b03c1992a8..db01b088e4a1 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
@@ -3006,50 +3006,71 @@ static int ixgbe_get_nvm_srev(struct ixgbe_hw *hw,
* Searches through the Option ROM flash contents to locate the CIVD data for
* the image.
*
- * Return: the exit code of the operation.
+ * Return: -ENOMEM when cannot allocate memory, -EDOM for checksum violation,
+ * -ENODATA when cannot find proper data, -EIO for faulty read or
+ * 0 on success.
+ *
+ * On success @civd stores collected data.
*/
static int
ixgbe_get_orom_civd_data(struct ixgbe_hw *hw, enum ixgbe_bank_select bank,
struct ixgbe_orom_civd_info *civd)
{
- struct ixgbe_orom_civd_info tmp;
+ u32 orom_size = hw->flash.banks.orom_size;
+ u8 *orom_data;
u32 offset;
int err;
+ orom_data = kzalloc(orom_size, GFP_KERNEL);
+ if (!orom_data)
+ return -ENOMEM;
+
+ err = ixgbe_read_flash_module(hw, bank,
+ IXGBE_E610_SR_1ST_OROM_BANK_PTR, 0,
+ orom_data, orom_size);
+ if (err) {
+ err = -EIO;
+ goto cleanup;
+ }
+
/* The CIVD section is located in the Option ROM aligned to 512 bytes.
* The first 4 bytes must contain the ASCII characters "$CIV".
* A simple modulo 256 sum of all of the bytes of the structure must
* equal 0.
*/
- for (offset = 0; (offset + SZ_512) <= hw->flash.banks.orom_size;
- offset += SZ_512) {
+ for (offset = 0; offset + SZ_512 <= orom_size; offset += SZ_512) {
+ struct ixgbe_orom_civd_info *tmp;
u8 sum = 0;
u32 i;
- err = ixgbe_read_flash_module(hw, bank,
- IXGBE_E610_SR_1ST_OROM_BANK_PTR,
- offset,
- (u8 *)&tmp, sizeof(tmp));
- if (err)
- return err;
+ BUILD_BUG_ON(sizeof(*tmp) > SZ_512);
+
+ tmp = (struct ixgbe_orom_civd_info *)&orom_data[offset];
/* Skip forward until we find a matching signature */
- if (memcmp(IXGBE_OROM_CIV_SIGNATURE, tmp.signature,
- sizeof(tmp.signature)))
+ if (memcmp(IXGBE_OROM_CIV_SIGNATURE, tmp->signature,
+ sizeof(tmp->signature)))
continue;
/* Verify that the simple checksum is zero */
- for (i = 0; i < sizeof(tmp); i++)
- sum += ((u8 *)&tmp)[i];
+ for (i = 0; i < sizeof(*tmp); i++)
+ sum += ((u8 *)tmp)[i];
+
+ if (sum) {
+ err = -EDOM;
+ goto cleanup;
+ }
- if (sum)
- return -EDOM;
+ *civd = *tmp;
+ err = 0;
- *civd = tmp;
- return 0;
+ goto cleanup;
}
- return -ENODATA;
+ err = -ENODATA;
+cleanup:
+ kfree(orom_data);
+ return err;
}
/**
--
2.31.1
Powered by blists - more mailing lists