Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp625050pxv; Thu, 15 Jul 2021 11:51:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoNh6+KJk4DXJr9wQFXAq2G81DXvSCBkP71cyepn0PvYBEionQ9TFuyXi0YNEvwRO94LVs X-Received: by 2002:a05:6638:264e:: with SMTP id n14mr5261732jat.71.1626375072599; Thu, 15 Jul 2021 11:51:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626375072; cv=none; d=google.com; s=arc-20160816; b=tmP4pHdmFR4zLIe1QBhuX6XnXYXJD91lclWLN3BbfTv1Rhz77X0f9O4DxJXiLI8CzW /kaJvaZXO0Ak1W+s7Uf+D3lkKWTb9LkyEllvW7pkHJLSTxYm9bN7IBs0wwUeoGXnpuH1 TshirFWujwbsppWIiM5FxR9PyU7S+dKH4KvwQEMuw0JHzLrp4dPmr5sMhOS8VmYpGkBy u4fqgCwYF+AV0LsZaGh6+qlJOGmWYwFxvbm/11kpxtinceRTYfqDkdwvqJtxNTfMzTWZ YAK51Hnb2BP77Z51c3vY5s8jYoK5hQ0NxNSahoijpsdsNSyR3G8sjT8G4QqUPZvdbY0d HM6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tC1veyD9qkVUBAz28Ftbqy/peNcEcUNirvnogfnmytg=; b=YEtaIZ8Koz5Hc5exDqrcJlm6qU4m7PUagkHL1R+vyH9veE+oJuOqrTN8Bbr6fLhE8P bTJzaX8eOOqXDykjJwG0XJRB3WZMNV1CCTSKBeFPdnjHWyUSR9OcXP8Gm2rFkG1rf4fV 3dI1lnyut689b57/NzB+u133wLrsb/x9M7ZNwnak0JxuPoZuhTLncN64ukjXfgZ4DD4m GYYfVqZH6Dk6snza3wBSHpZnt+RCxeEar0iVjaRDPAg0QqSj6P4T0ZF/XgDXjhQogRh8 zXqtaOPfcAwYP+Z7QPyfEO49D41WChaWQ14AQ3INv4yX75rQg8ymKIrZYAc7hW87ehNo 4ruA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=13f3iTKB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w9si7536067jad.35.2021.07.15.11.51.00; Thu, 15 Jul 2021 11:51:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=13f3iTKB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240405AbhGOSwL (ORCPT + 99 others); Thu, 15 Jul 2021 14:52:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:51896 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240521AbhGOSta (ORCPT ); Thu, 15 Jul 2021 14:49:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AE7C3613CF; Thu, 15 Jul 2021 18:46:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626374796; bh=KIbEhNWMydI6SQGBDF9LHhWBX6rUno1XaXp/Wg9nNw0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=13f3iTKBajBvRo8lj6m1d2V6iA4KcQFxixY+KUsdJp5zJQAh3kdad7HULNOUK8p51 JMpZg/CEXiOR52PmLI/FEkBiu1U9qX5FCgSHTmln15YwN2TXSpifoT1h4zJAlffnZv 3qaPnx17BkCB+e21Ji+CCuJNmsnYYf9xYKAAFJsU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jesse Brandeburg , Dave Switzer , Tony Nguyen , Sasha Levin Subject: [PATCH 5.10 030/215] igb: handle vlan types with checker enabled Date: Thu, 15 Jul 2021 20:36:42 +0200 Message-Id: <20210715182604.289886452@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182558.381078833@linuxfoundation.org> References: <20210715182558.381078833@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jesse Brandeburg [ Upstream commit c7cbfb028b95360403d579c47aaaeef1ff140964 ] 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 Tested-by: Dave Switzer Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- 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 5c87c0a7ce3d..157683fbf61c 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; } } @@ -8617,7 +8618,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 ee9f8c1dca83..07c9e9e0546f 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.30.2