Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp638120pxv; Thu, 15 Jul 2021 12:09:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFCGt+W5IV4uoYqC5QBr/6X9IwmviMPZXh9SbvhM5PEAVK1mfRBqfj5TBxZ2wGCEpDTQCL X-Received: by 2002:a50:aa97:: with SMTP id q23mr9112647edc.154.1626376161410; Thu, 15 Jul 2021 12:09:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626376161; cv=none; d=google.com; s=arc-20160816; b=maHfwj+mzPofXbM9iwcO+OKtcqQuic6CjRypTWsZvz/tT2H7mGspUfbRWnCXVkaX5r pn4qG8ZMehjLzMmBAupEmK0r7Gvvk/X6wcGtmdBPyw0w3WMAlHYa+8Bw1jzlfAGnaACS 1wYyQecXJTtEKvimxyrOhNtNMnjy2b/eExCjj1OsVPWMd7gqSeFjAUb3ZbKuldpZnJs6 yeQ74fYZlR57rpmXCo86ohBfsYde+ns0KcsaXJ5wRvSj4mVFMmVZrYeqRpnSgCiVqqzC LSI4pJLCxmLOY6LpRuF+7Ge4lP0wFs94WZo0Bsq9IXTPRMN6ffQnpQQMC7DbcL7/eCKo 4qYA== 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=GimttNLVWqxas6gyOkP8DrQrWxXe3lZcU1MCXg5Nte8=; b=uF6atsD53O/UQssxPjzgdZ5IKWQsg2g4/9xQkUBPqSR2IlshM/WYOepHsdwOoHDCYq 592Z5qlFmMiNI47vuc4yOh5sygfdAgFlcP573oC5LQgHCoG9a7ff91HnsGtBG4bp/SlO I1kCEvhgVKmRaEcHkU66S8+GGfIMk982edwsICIpWfcIeiR12vH489OLufG1BHvjhkDG e2s5Tltvojo1DTx5EAaGMW/JisBCBlPa02g/QBCQsItjkM1C/dgk5sRHM0PDnkt1BNrZ ubeY+3FuixnzUAP6eG70aPOjKNa+rnaE8oEykruEmSktIuNF6XBhhs/tLvWLv7zS7zl4 0ngA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E7aUbGJT; 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 n1si7450564ejx.353.2021.07.15.12.08.57; Thu, 15 Jul 2021 12:09:21 -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=E7aUbGJT; 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 S242745AbhGOTJF (ORCPT + 99 others); Thu, 15 Jul 2021 15:09:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:34230 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241276AbhGOS6E (ORCPT ); Thu, 15 Jul 2021 14:58:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B045F613E7; Thu, 15 Jul 2021 18:55:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375306; bh=skqswtmKqrqAPY5m7IrXU75ApWqmW8CDHzvsnzp79pw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E7aUbGJTp9WTJCovgTMNQuFjTyE5HzAThT+3q5VYydNATX+X5SJSitkXzMsRjuAI6 tbusOd3Ryf3GYeARiFp0keTkEtbHUAyJTgKkvWMc/NhfWelTpURp2dCW1DFwMD/gxt tSDKNTIqY4y5vjG2bSDmgX8RuQnugJ4DFDqlmGIE= 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.12 032/242] igb: handle vlan types with checker enabled Date: Thu, 15 Jul 2021 20:36:34 +0200 Message-Id: <20210715182557.595976094@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182551.731989182@linuxfoundation.org> References: <20210715182551.731989182@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 caa8929289ae..894b9b87dba1 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; } } @@ -8593,7 +8594,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