[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210526172346.3515587-6-anthony.l.nguyen@intel.com>
Date: Wed, 26 May 2021 10:23:40 -0700
From: Tony Nguyen <anthony.l.nguyen@...el.com>
To: davem@...emloft.net, kuba@...nel.org
Cc: Jesse Brandeburg <jesse.brandeburg@...el.com>,
netdev@...r.kernel.org, sassmann@...hat.com,
anthony.l.nguyen@...el.com, Dave Switzer <david.switzer@...el.com>
Subject: [PATCH net-next 05/11] igb: handle vlan types with checker enabled
From: Jesse Brandeburg <jesse.brandeburg@...el.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@...el.com>
Tested-by: Dave Switzer <david.switzer@...el.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@...el.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
Powered by blists - more mailing lists