From patchwork Wed Oct 10 19:05:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 148579 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1228268lji; Wed, 10 Oct 2018 12:06:30 -0700 (PDT) X-Google-Smtp-Source: ACcGV63BrQSg5UU1A2O4A4ZI2a1NquNqEV4L5ohVhDUymYPyEENCSwhSvTUswtIrN43iipCUaiXv X-Received: by 2002:a62:f58a:: with SMTP id b10-v6mr36433023pfm.253.1539198389974; Wed, 10 Oct 2018 12:06:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539198389; cv=none; d=google.com; s=arc-20160816; b=E4D7h08wk6SDyeLELW4leIm6CTpZXlmtKYPL8aj3ieF3JGwf9s+mmTw1fDX9X7r9cq x1XYHK/yWyUpVN4pcNTfwIlOSoN2qJalIi/Qxf+PL58iFDyq3NisJdG2o/Di1dU7p0cE omQrQAHG+m9p/64jnZUkCcHgb9CaSLk1THdDpLYEIlyimgXRbCcgtbfvivYm2l9ADami txjumQlp0W0lCN9vcX+XapHNEXkZV/vICpVqGi3r9J+vMP81jhJUO9jWczoKyWhMZNPK PQPwYBOSBomRmgE+/7J6X4hLrHKt94cV1HMBN0LcSoAzIsn2u8ym5HrxJleYr+LrK8wH L92w== 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; bh=kx5a0nvAYwmGaKke9PDMM8RwedrZ4mI+UuqQQdtkQ10=; b=wcc9cyzpzTB+zDUTuHMIBUvRW1BDGNUAR/oP3u7uJOoZNOGe9ZGu8M+FC1H4C9ButV 2l+j4QdSncDuMeWb3iB2c08oJ6TnmNr3agcdqnjkw0fzI89Bq4kwBgEQBWlbBY6BX25k 7RIpJILalZ70jmERr4+IOqyvDPM7FyhTHDw+QhYtQ4cROtNCLLX1p5ntfVmmSBjGh29o gfxQ71E5LbAmdDZkOSaixA2VN7XaW5TPY3sZ0ieaNSDdAgoSLIoy7pf44+PxsSNsvmzG +19KP4SoartorF2zATtHlHgtNgFJkibuN3X5qDEcfoj1AKoDcZ4R44pAPRb69LaSrlVO F0jw== 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 f2-v6si28576122pln.270.2018.10.10.12.06.29; Wed, 10 Oct 2018 12:06:29 -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 S1727652AbeJKC34 (ORCPT + 32 others); Wed, 10 Oct 2018 22:29:56 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:13615 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727536AbeJKC34 (ORCPT ); Wed, 10 Oct 2018 22:29:56 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id AE2AE99128540; Thu, 11 Oct 2018 03:06:22 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.399.0; Thu, 11 Oct 2018 03:06:17 +0800 From: Salil Mehta To: CC: , , , , , , Subject: [PATCH net-next 4/4] net: hns3: Add HW RSS hash information to RX skb Date: Wed, 10 Oct 2018 20:05:37 +0100 Message-ID: <20181010190537.20972-5-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20181010190537.20972-1-salil.mehta@huawei.com> References: <20181010190537.20972-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] 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 Drivers should call skb_set_hash to set the hash and its type in an skbuff. Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 1 + drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 17 +++++++++++++++++ .../net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 18 ++++++++++++++++++ 3 files changed, 36 insertions(+) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h index 1b49c5d..3df62a5 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h @@ -479,6 +479,7 @@ struct hnae3_knic_private_info { const struct hnae3_dcb_ops *dcb_ops; u16 int_rl_setting; + enum pkt_hash_types rss_type; }; struct hnae3_roce_private_info { diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index e9d4564..9bbb53c 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -2230,6 +2230,21 @@ static bool hns3_parse_vlan_tag(struct hns3_enet_ring *ring, } } +static void hns3_set_rx_skb_rss_type(struct hns3_enet_ring *ring, + struct sk_buff *skb) +{ + struct hns3_desc *desc = &ring->desc[ring->next_to_clean]; + struct hnae3_handle *handle = ring->tqp->handle; + enum pkt_hash_types rss_type; + + if (le32_to_cpu(desc->rx.rss_hash)) + rss_type = handle->kinfo.rss_type; + else + rss_type = PKT_HASH_TYPE_NONE; + + skb_set_hash(skb, le32_to_cpu(desc->rx.rss_hash), rss_type); +} + static int hns3_handle_rx_bd(struct hns3_enet_ring *ring, struct sk_buff **out_skb, int *out_bnum) { @@ -2371,6 +2386,8 @@ static int hns3_handle_rx_bd(struct hns3_enet_ring *ring, ring->tqp_vector->rx_group.total_bytes += skb->len; hns3_rx_checksum(ring, skb, desc); + hns3_set_rx_skb_rss_type(ring, skb); + return 0; } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 0c5a053..db97f6a 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -2773,6 +2773,22 @@ static int hclge_set_rss_tc_mode(struct hclge_dev *hdev, u16 *tc_valid, return ret; } +static void hclge_get_rss_type(struct hclge_vport *vport) +{ + if (vport->rss_tuple_sets.ipv4_tcp_en || + vport->rss_tuple_sets.ipv4_udp_en || + vport->rss_tuple_sets.ipv4_sctp_en || + vport->rss_tuple_sets.ipv6_tcp_en || + vport->rss_tuple_sets.ipv6_udp_en || + vport->rss_tuple_sets.ipv6_sctp_en) + vport->nic.kinfo.rss_type = PKT_HASH_TYPE_L4; + else if (vport->rss_tuple_sets.ipv4_fragment_en || + vport->rss_tuple_sets.ipv6_fragment_en) + vport->nic.kinfo.rss_type = PKT_HASH_TYPE_L3; + else + vport->nic.kinfo.rss_type = PKT_HASH_TYPE_NONE; +} + static int hclge_set_rss_input_tuple(struct hclge_dev *hdev) { struct hclge_rss_input_tuple_cmd *req; @@ -2792,6 +2808,7 @@ static int hclge_set_rss_input_tuple(struct hclge_dev *hdev) req->ipv6_udp_en = hdev->vport[0].rss_tuple_sets.ipv6_udp_en; req->ipv6_sctp_en = hdev->vport[0].rss_tuple_sets.ipv6_sctp_en; req->ipv6_fragment_en = hdev->vport[0].rss_tuple_sets.ipv6_fragment_en; + hclge_get_rss_type(&hdev->vport[0]); ret = hclge_cmd_send(&hdev->hw, &desc, 1); if (ret) dev_err(&hdev->pdev->dev, @@ -2973,6 +2990,7 @@ static int hclge_set_rss_tuple(struct hnae3_handle *handle, vport->rss_tuple_sets.ipv6_udp_en = req->ipv6_udp_en; vport->rss_tuple_sets.ipv6_sctp_en = req->ipv6_sctp_en; vport->rss_tuple_sets.ipv6_fragment_en = req->ipv6_fragment_en; + hclge_get_rss_type(vport); return 0; }