All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/2][pull request] 40GbE Intel Wired LAN Driver Updates 2022-03-17
@ 2022-03-17 16:02 Tony Nguyen
  2022-03-17 16:02 ` [PATCH net-next 1/2] i40e: little endian only valid checksums Tony Nguyen
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tony Nguyen @ 2022-03-17 16:02 UTC (permalink / raw)
  To: davem, kuba, pabeni; +Cc: Tony Nguyen, netdev

This series contains updates to i40e and igb drivers.

Tom Rix moves a conversion to little endian to occur only when the
value is used for i40e. He also zeros out a structure to resolve
possible use of garbage value for igb as reported by clang.

The following are changes since commit 1abea24af42c35c6eb537e4402836e2cde2a5b13:
  selftests: net: fix array_size.cocci warning
and are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue 40GbE

Tom Rix (2):
  i40e: little endian only valid checksums
  igb: zero hwtstamp by default

 drivers/net/ethernet/intel/i40e/i40e_nvm.c | 5 +++--
 drivers/net/ethernet/intel/igb/igb_ptp.c   | 6 ++----
 2 files changed, 5 insertions(+), 6 deletions(-)

-- 
2.31.1


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

* [PATCH net-next 1/2] i40e: little endian only valid checksums
  2022-03-17 16:02 [PATCH net-next 0/2][pull request] 40GbE Intel Wired LAN Driver Updates 2022-03-17 Tony Nguyen
@ 2022-03-17 16:02 ` Tony Nguyen
  2022-03-17 16:02 ` [PATCH net-next 2/2] igb: zero hwtstamp by default Tony Nguyen
  2022-03-19  4:50 ` [PATCH net-next 0/2][pull request] 40GbE Intel Wired LAN Driver Updates 2022-03-17 patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Tony Nguyen @ 2022-03-17 16:02 UTC (permalink / raw)
  To: davem, kuba, pabeni; +Cc: Tom Rix, netdev, anthony.l.nguyen, Gurucharan G

From: Tom Rix <trix@redhat.com>

The calculation of the checksum can fail.
So move converting the checksum to little endian
to inside the return status check.

Signed-off-by: Tom Rix <trix@redhat.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_nvm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_nvm.c b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
index fe6dca846028..3a38bf8bcde7 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_nvm.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
@@ -682,10 +682,11 @@ i40e_status i40e_update_nvm_checksum(struct i40e_hw *hw)
 	__le16 le_sum;
 
 	ret_code = i40e_calc_nvm_checksum(hw, &checksum);
-	le_sum = cpu_to_le16(checksum);
-	if (!ret_code)
+	if (!ret_code) {
+		le_sum = cpu_to_le16(checksum);
 		ret_code = i40e_write_nvm_aq(hw, 0x00, I40E_SR_SW_CHECKSUM_WORD,
 					     1, &le_sum, true);
+	}
 
 	return ret_code;
 }
-- 
2.31.1


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

* [PATCH net-next 2/2] igb: zero hwtstamp by default
  2022-03-17 16:02 [PATCH net-next 0/2][pull request] 40GbE Intel Wired LAN Driver Updates 2022-03-17 Tony Nguyen
  2022-03-17 16:02 ` [PATCH net-next 1/2] i40e: little endian only valid checksums Tony Nguyen
@ 2022-03-17 16:02 ` Tony Nguyen
  2022-03-19  4:50 ` [PATCH net-next 0/2][pull request] 40GbE Intel Wired LAN Driver Updates 2022-03-17 patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Tony Nguyen @ 2022-03-17 16:02 UTC (permalink / raw)
  To: davem, kuba, pabeni; +Cc: Tom Rix, netdev, anthony.l.nguyen, Gurucharan G

From: Tom Rix <trix@redhat.com>

Clang static analysis reports this representative issue
igb_ptp.c:997:3: warning: The left operand of '+' is a
  garbage value
  ktime_add_ns(shhwtstamps.hwtstamp, adjust);
  ^            ~~~~~~~~~~~~~~~~~~~~

shhwtstamps.hwtstamp is set by a call to
igb_ptp_systim_to_hwtstamp().  In the switch-statement
for the hw type, the hwtstamp is zeroed for matches
but not the default case.  Move the memset out of
switch-statement.  This degarbages the default case
and reduces the size.

Some whitespace cleanup of empty lines

Signed-off-by: Tom Rix <trix@redhat.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/igb/igb_ptp.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
index 6580fcddb4be..02fec948ce64 100644
--- a/drivers/net/ethernet/intel/igb/igb_ptp.c
+++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
@@ -165,23 +165,21 @@ static void igb_ptp_systim_to_hwtstamp(struct igb_adapter *adapter,
 	unsigned long flags;
 	u64 ns;
 
+	memset(hwtstamps, 0, sizeof(*hwtstamps));
+
 	switch (adapter->hw.mac.type) {
 	case e1000_82576:
 	case e1000_82580:
 	case e1000_i354:
 	case e1000_i350:
 		spin_lock_irqsave(&adapter->tmreg_lock, flags);
-
 		ns = timecounter_cyc2time(&adapter->tc, systim);
-
 		spin_unlock_irqrestore(&adapter->tmreg_lock, flags);
 
-		memset(hwtstamps, 0, sizeof(*hwtstamps));
 		hwtstamps->hwtstamp = ns_to_ktime(ns);
 		break;
 	case e1000_i210:
 	case e1000_i211:
-		memset(hwtstamps, 0, sizeof(*hwtstamps));
 		/* Upper 32 bits contain s, lower 32 bits contain ns. */
 		hwtstamps->hwtstamp = ktime_set(systim >> 32,
 						systim & 0xFFFFFFFF);
-- 
2.31.1


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

* Re: [PATCH net-next 0/2][pull request] 40GbE Intel Wired LAN Driver Updates 2022-03-17
  2022-03-17 16:02 [PATCH net-next 0/2][pull request] 40GbE Intel Wired LAN Driver Updates 2022-03-17 Tony Nguyen
  2022-03-17 16:02 ` [PATCH net-next 1/2] i40e: little endian only valid checksums Tony Nguyen
  2022-03-17 16:02 ` [PATCH net-next 2/2] igb: zero hwtstamp by default Tony Nguyen
@ 2022-03-19  4:50 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-19  4:50 UTC (permalink / raw)
  To: Tony Nguyen; +Cc: davem, kuba, pabeni, netdev

Hello:

This series was applied to netdev/net-next.git (master)
by Tony Nguyen <anthony.l.nguyen@intel.com>:

On Thu, 17 Mar 2022 09:02:34 -0700 you wrote:
> This series contains updates to i40e and igb drivers.
> 
> Tom Rix moves a conversion to little endian to occur only when the
> value is used for i40e. He also zeros out a structure to resolve
> possible use of garbage value for igb as reported by clang.
> 
> The following are changes since commit 1abea24af42c35c6eb537e4402836e2cde2a5b13:
>   selftests: net: fix array_size.cocci warning
> and are available in the git repository at:
>   git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue 40GbE
> 
> [...]

Here is the summary with links:
  - [net-next,1/2] i40e: little endian only valid checksums
    https://git.kernel.org/netdev/net-next/c/ad739d0889a8
  - [net-next,2/2] igb: zero hwtstamp by default
    https://git.kernel.org/netdev/net-next/c/5d705de0cd34

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] 4+ messages in thread

end of thread, other threads:[~2022-03-19  4:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-17 16:02 [PATCH net-next 0/2][pull request] 40GbE Intel Wired LAN Driver Updates 2022-03-17 Tony Nguyen
2022-03-17 16:02 ` [PATCH net-next 1/2] i40e: little endian only valid checksums Tony Nguyen
2022-03-17 16:02 ` [PATCH net-next 2/2] igb: zero hwtstamp by default Tony Nguyen
2022-03-19  4:50 ` [PATCH net-next 0/2][pull request] 40GbE Intel Wired LAN Driver Updates 2022-03-17 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.