From patchwork Fri May 25 18:42:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 136978 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp3943266lji; Fri, 25 May 2018 11:44:58 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqL+XbRCf10wRbyUsWrn4bOGig0b5vd2tOo1XVJBm//cEsuyWSUfaReZLUP6BUwwQk6+iT2 X-Received: by 2002:a63:be01:: with SMTP id l1-v6mr2908322pgf.382.1527273897966; Fri, 25 May 2018 11:44:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527273897; cv=none; d=google.com; s=arc-20160816; b=YUokhTgtAkaqjxCuYIZKLJApGwsCsIurzlXCkgV/R0R1hjkC2xKPVhv9zTnzoXg+B1 X3KAv72t4fIT3sOsZSQpI6/l28VN9qeUPCvFhcP9Yx/yy5hzlMgs2kHZhBsYfAWQNeYR jQjzSUaxLjKIqZRK2xeo5CKoQixSKBPB1I/oBHt45Bqx5NCTqDft/ChPwcGZq7zaHQVW hTuCldoHnwkl4tZcAcmEo13miIJEIUS7BxYncCEnQq3WkH676Z236cludgXSv0yMglXs g0QkqsXdUXsPx4i8qI6JCP6PMVndoV4Mtydh6T5x24SMP3eAPmXkjO4Gk5SQXwR92pHT WGJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=AdL++1gM5emjmAcwGDAMYU6BHWtab2Kb7JAWOzEVWLY=; b=zWngPj6nqnWi6Io9xvuKIC+2nzNgDNMkwY4t1hIcWS6PbTJko7qoGtlOkdQuSEBrAP Fvla35VwJEmfhqeFTgMCJEKXoXIG+J/UdZFkUnmuOYtm8zoSdP0r5ncUcYoM2Au/RVts UdZAwgd32ZOhdab1aJIvbWuYMbhLDaIBTdC8Y0LBWZ9McXo32MB4JiH6/ERx4yJg+Auq XZbOH2MaW7mO5nRwMRWMkIe4Y4ugU2X0LCGX4E1PM/oLdBRH5No0Qk3x0CjkEmirViu4 G+yOiPiuW5DOWR9pQoJ6e86pT3NMJPmc8iSt0k40JZzo8u5spPPGSSEdzj9LTxRfzwbl 4AAw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 5-v6si24142171pfi.285.2018.05.25.11.44.57; Fri, 25 May 2018 11:44:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968006AbeEYSoy (ORCPT + 30 others); Fri, 25 May 2018 14:44:54 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:8141 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S967820AbeEYSoo (ORCPT ); Fri, 25 May 2018 14:44:44 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id DAA906759C475; Sat, 26 May 2018 02:44:30 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.227.234) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.382.0; Sat, 26 May 2018 02:44:25 +0800 From: Salil Mehta To: CC: , , , , , , Subject: [PATCH net-next 01/12] net: hns3: Updates RX packet info fetch in case of multi BD Date: Fri, 25 May 2018 19:42:56 +0100 Message-ID: <20180525184307.36288-2-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180525184307.36288-1-salil.mehta@huawei.com> References: <20180525184307.36288-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.227.234] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peng Li In the latest revision of the hardware, if a packet is spanning across multiple BDs then only VLD bit and current data size info is valid in each BD, and rest of the information is only valid in the last BD of the packet. In such case we should make sure we are fetching RX packet size from the first descriptor and information like VLAN should be fetched from last BD. Signed-off-by: Peng Li Reviewed-by: Yisen Zhuang Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 36 ++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index cac5195..ae8d749 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -2085,9 +2085,8 @@ static int hns3_handle_rx_bd(struct hns3_enet_ring *ring, prefetch(desc); - length = le16_to_cpu(desc->rx.pkt_len); + length = le16_to_cpu(desc->rx.size); bd_base_info = le32_to_cpu(desc->rx.bd_base_info); - l234info = le32_to_cpu(desc->rx.l234_info); /* Check valid BD */ if (!hnae_get_bit(bd_base_info, HNS3_RXD_VLD_B)) @@ -2121,22 +2120,6 @@ static int hns3_handle_rx_bd(struct hns3_enet_ring *ring, prefetchw(skb->data); - /* Based on hw strategy, the tag offloaded will be stored at - * ot_vlan_tag in two layer tag case, and stored at vlan_tag - * in one layer tag case. - */ - if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX) { - u16 vlan_tag; - - vlan_tag = le16_to_cpu(desc->rx.ot_vlan_tag); - if (!(vlan_tag & VLAN_VID_MASK)) - vlan_tag = le16_to_cpu(desc->rx.vlan_tag); - if (vlan_tag & VLAN_VID_MASK) - __vlan_hwaccel_put_tag(skb, - htons(ETH_P_8021Q), - vlan_tag); - } - bnum = 1; if (length <= HNS3_RX_HEAD_SIZE) { memcpy(__skb_put(skb, length), va, ALIGN(length, sizeof(long))); @@ -2172,6 +2155,23 @@ static int hns3_handle_rx_bd(struct hns3_enet_ring *ring, } *out_bnum = bnum; + /* Based on hw strategy, the tag offloaded will be stored at + * ot_vlan_tag in two layer tag case, and stored at vlan_tag + * in one layer tag case. + */ + if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX) { + u16 vlan_tag; + + vlan_tag = le16_to_cpu(desc->rx.ot_vlan_tag); + if (!(vlan_tag & VLAN_VID_MASK)) + vlan_tag = le16_to_cpu(desc->rx.vlan_tag); + if (vlan_tag & VLAN_VID_MASK) + __vlan_hwaccel_put_tag(skb, + htons(ETH_P_8021Q), + vlan_tag); + } + + l234info = le32_to_cpu(desc->rx.l234_info); if (unlikely(!hnae_get_bit(bd_base_info, HNS3_RXD_VLD_B))) { netdev_err(netdev, "no valid bd,%016llx,%016llx\n",