From patchwork Tue Nov 20 12:20:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= X-Patchwork-Id: 10690335 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9DD6913BB for ; Tue, 20 Nov 2018 12:20:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 904B02A57F for ; Tue, 20 Nov 2018 12:20:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 849F72A5A2; Tue, 20 Nov 2018 12:20:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 39AEB2A57F for ; Tue, 20 Nov 2018 12:20:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729562AbeKTWt0 (ORCPT ); Tue, 20 Nov 2018 17:49:26 -0500 Received: from rere.qmqm.pl ([91.227.64.183]:45768 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728601AbeKTWt0 (ORCPT ); Tue, 20 Nov 2018 17:49:26 -0500 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 42zlBP48CWzSL; Tue, 20 Nov 2018 13:19:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1542716365; bh=nqstBcI6tID66TX8WpxXdVNk9BYwcQFLKLdTiHh3dJs=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=qCCIpUpxkI8dhnm17g/ZTJ6ZVpSNgzimmWg3ldFK2WqCz5Pul9JjrtABtTrZhkKBx gtgZAsBvVjTsuFHYmEhx0rBcq9wsQoFm4sJ4gTr4wIz2tjxzBs3Z+rma7EswAX/vjw zYRih9CRpDOm4wCgH8lWgz2owG2ke6xT6sFZl8DchpZfgEyIaH34el8r6w8iHFLQjZ SrMOBFZV/vlhx2LNLXh//QbpDQ19ETuD8ERwswIcDTst97RBodcam0ylTwdVZ+V7X/ qlA4kE4Se237frdwaloaizn1jN6Jt1E35/+BP6bXboH3wowxwcG85/zXk2hIvgJTa2 iobitz7ETrpmg== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.100.2 at mail Date: Tue, 20 Nov 2018 13:20:32 +0100 Message-Id: <61f737ec45c9905d5c86fbe8492eaa604bf6549f.1542716156.git.mirq-linux@rere.qmqm.pl> In-Reply-To: References: From: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Subject: [PATCH net-next 2/4] net/hyperv: use skb_vlan_tag_*() helpers MIME-Version: 1.0 To: netdev@vger.kernel.org Cc: "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , devel@linuxdriverproject.org, Ajit Khaparde , Leon Romanovsky , linux-rdma@vger.kernel.org, Saeed Mahameed , Sathya Perla , Somnath Kotur , Sriharsha Basavapatna Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Replace open-coded bitfield manipulation with skb_vlan_tag_*() helpers. This also enables correctly passing of VLAN.CFI bit. Signed-off-by: Michał Mirosław Reviewed-by: Haiyang Zhang --- drivers/net/hyperv/netvsc_drv.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index cf36e7ff3191..85936ed9e952 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -605,9 +605,9 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) IEEE_8021Q_INFO); vlan->value = 0; - vlan->vlanid = skb->vlan_tci & VLAN_VID_MASK; - vlan->pri = (skb->vlan_tci & VLAN_PRIO_MASK) >> - VLAN_PRIO_SHIFT; + vlan->vlanid = skb_vlan_tag_get_id(skb); + vlan->cfi = skb_vlan_tag_get_cfi(skb); + vlan->pri = skb_vlan_tag_get_prio(skb); } if (skb_is_gso(skb)) { @@ -781,7 +781,8 @@ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net, } if (vlan) { - u16 vlan_tci = vlan->vlanid | (vlan->pri << VLAN_PRIO_SHIFT); + u16 vlan_tci = vlan->vlanid | (vlan->pri << VLAN_PRIO_SHIFT) | + (vlan->cfi ? VLAN_CFI_MASK : 0); __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tci);