Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: zhaoxiao <zhaoxiao@uniontech.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH] igb: handle vlan types with checker enabled
Date: Fri, 13 Aug 2021 15:45:36 +0800	[thread overview]
Message-ID: <20210813074536.15624-1-zhaoxiao@uniontech.com> (raw)

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.

drivers/net/ethernet/intel/igb/igb_main.c:2676:48: warning: incorrect type in assignment (different base types)
drivers/net/ethernet/intel/igb/igb_main.c:2676:48:    expected restricted __be16 [usertype] vlan_tci
drivers/net/ethernet/intel/igb/igb_main.c:2676:48:    got unsigned short [usertype] vlan_priority:3

Signed-off-by: zhaoxiao <zhaoxiao@uniontech.com>
---
 drivers/net/ethernet/intel/igb/igb_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 6221dafc76b9..a42eb9b1fa3e 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -2673,7 +2673,8 @@ static int igb_parse_cls_flower(struct igb_adapter *adapter,
 			}
 
 			input->filter.match_flags |= IGB_FILTER_FLAG_VLAN_TCI;
-			input->filter.vlan_tci = key->vlan_priority;
+			input->filter.vlan_tci =
+				(__force __be16)key->vlan_priority;
 		}
 	}
 
-- 
2.20.1




             reply	other threads:[~2021-08-13  7:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-13  7:45 zhaoxiao [this message]
2021-08-13 16:32 ` [Intel-wired-lan] [PATCH] igb: handle vlan types with checker enabled Nguyen, Anthony L

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=20210813074536.15624-1-zhaoxiao@uniontech.com \
    --to=zhaoxiao@uniontech.com \
    --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