Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH AUTOSEL 5.12 038/160] igb: fix assignment on big endian machines
Date: Tue,  6 Jul 2021 07:16:24 -0400	[thread overview]
Message-ID: <20210706111827.2060499-38-sashal@kernel.org> (raw)
In-Reply-To: <20210706111827.2060499-1-sashal@kernel.org>

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

[ Upstream commit b514958dd1a3bd57638b0e63b8e5152b1960e6aa ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 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 894b9b87dba1..434220a342df 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -6277,12 +6277,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.30.2


  parent reply	other threads:[~2021-07-06 11:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210706111827.2060499-1-sashal@kernel.org>
2021-07-06 11:16 ` [Intel-wired-lan] [PATCH AUTOSEL 5.12 036/160] e100: handle eeprom as little endian Sasha Levin
2021-07-06 11:16 ` [Intel-wired-lan] [PATCH AUTOSEL 5.12 037/160] igb: handle vlan types with checker enabled Sasha Levin
2021-07-06 11:16 ` Sasha Levin [this message]
2021-07-06 11:16 ` [Intel-wired-lan] [PATCH AUTOSEL 5.12 067/160] ice: set the value of global config lock timeout longer Sasha Levin
2021-07-06 11:16 ` [Intel-wired-lan] [PATCH AUTOSEL 5.12 068/160] ice: fix clang warning regarding deadcode.DeadStores Sasha Levin
2021-07-06 11:17 ` [Intel-wired-lan] [PATCH AUTOSEL 5.12 099/160] ice: fix incorrect payload indicator on PTYPE Sasha Levin
2021-07-06 11:17 ` [Intel-wired-lan] [PATCH AUTOSEL 5.12 100/160] ice: mark PTYPE 2 as reserved Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210706111827.2060499-38-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=intel-wired-lan@osuosl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox