Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp713457pxv; Thu, 15 Jul 2021 14:12:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3iTC09/RcSuS2hXJiIffNScwnYHaIK5VQyZr6Ex6T/ILn9kcjadyaq/PJQ4kKpmZRvZlE X-Received: by 2002:a17:907:7ba7:: with SMTP id ne39mr7595444ejc.467.1626383552905; Thu, 15 Jul 2021 14:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626383552; cv=none; d=google.com; s=arc-20160816; b=gjrs+RYlBHFPSU/Nlf1OCIjvz+2o0Swm+3MTLYKYsQr6hkDJnU4tkZSTijwpeSZyTO g+wfDPNDhoW+Lx209TMRQOJIa/M5ACvI04DgWsyV/y16YZUJ4CBfOvq97A/jbZ6kRmlh eXi6uyWSRf6OdmDJPM2P+KHhuKO8I77+SJtFWsYFBxdBoKbmyFAqbmIoHeWGU+aL92Ux OfXHA/qtvsXW5bkKOQ9WzRAcSnvVbymNCuQMpA1ryfCzr1GeZyFs1yyOu8lObsCZcjxs RqPsn1zfhuLTNGF21bpWX6x8c7tIAS5V5MToZy8ZgqH/VedgLIEUx5geYJpZODFrAp4f 7SSQ== 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=Sat0HtUohzpb3BfYr4Y8jVOyNFgEA4Hv8S6XMQKM8x4=; b=VmALhWKEkxanl0IDPcTEOoSeARxgfNZre2gbtyX4qyt7RIa+hycm/XKEYKVfv9PwtO 2FRJB9mqwF83BekbiDM9z8A18GbGhmd001d6YakteERABEFgzX7bKcqywjXL/8UWowNE J6wAAJXejdqQPmZZy9HFqXw3tckDAZ1C7pxjug2nhV28alT9+poaobb2UmnzFwGxgVHV Xvq+m3LjbR6Sc97/BcmBAY+18pe+dRznTfi2bMrni1wxUQuF7O3UEndg4ZfbGz/Qzjwd IK6pUn7VrSahdczQsQiVD890e6LbWi/hrihGPBYUv8reFSQo5GCGWDVcqA5eqcrx2bpy 7LFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qMyb4SkK; 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 sb1si7558334ejb.309.2021.07.15.14.12.09; Thu, 15 Jul 2021 14:12:32 -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=qMyb4SkK; 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 S1345203AbhGOTaw (ORCPT + 99 others); Thu, 15 Jul 2021 15:30:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:45622 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243119AbhGOTJ1 (ORCPT ); Thu, 15 Jul 2021 15:09:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AE0DE61407; Thu, 15 Jul 2021 19:04:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375895; bh=x/TGLfcvFQTK05DH7cz8+oSwvSEKDiS4YVKlfxRErkI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qMyb4SkKPC+SLQa8S58oewVPXthwyzTAVyQ7n+rwlt2G4gvUlCi34z+WBd5Tn80J3 mDXk3IVohJRuEnwgZkdCa055kh1eq63HFfwPyamYrU4SAQsYqadJkj3X2zrl2rmGD7 7UAppMVPphFZoFN9f1pg6JVg2bLyG4uMAoGNG1b4= 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.13 040/266] igb: handle vlan types with checker enabled Date: Thu, 15 Jul 2021 20:36:35 +0200 Message-Id: <20210715182621.339001432@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182613.933608881@linuxfoundation.org> References: <20210715182613.933608881@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 b2a042f825ff..b0232a8de343 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; } } @@ -8592,7 +8593,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.30.2