All of lore.kernel.org
 help / color / mirror / Atom feed
From: Huazhong Tan <tanhuazhong@huawei.com>
To: <davem@davemloft.net>, <kuba@kernel.org>
Cc: <netdev@vger.kernel.org>, <salil.mehta@huawei.com>,
	<yisen.zhuang@huawei.com>, <huangdaode@huawei.com>,
	<linuxarm@openeuler.org>, Huazhong Tan <tanhuazhong@huawei.com>
Subject: [PATCH net-next 11/13] net: hns3: refactor out hclge_set_rss_tuple()
Date: Wed, 10 Feb 2021 15:43:23 +0800	[thread overview]
Message-ID: <1612943005-59416-12-git-send-email-tanhuazhong@huawei.com> (raw)
In-Reply-To: <1612943005-59416-1-git-send-email-tanhuazhong@huawei.com>

To make it more readable and maintainable, split
hclge_set_rss_tuple() into two parts.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
---
 .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c    | 42 +++++++++++++++-------
 1 file changed, 29 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index f96a800..9156c00 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -4501,22 +4501,12 @@ static u8 hclge_get_rss_hash_bits(struct ethtool_rxnfc *nfc)
 	return hash_sets;
 }
 
-static int hclge_set_rss_tuple(struct hnae3_handle *handle,
-			       struct ethtool_rxnfc *nfc)
+static int hclge_init_rss_tuple_cmd(struct hclge_vport *vport,
+				    struct ethtool_rxnfc *nfc,
+				    struct hclge_rss_input_tuple_cmd *req)
 {
-	struct hclge_vport *vport = hclge_get_vport(handle);
 	struct hclge_dev *hdev = vport->back;
-	struct hclge_rss_input_tuple_cmd *req;
-	struct hclge_desc desc;
 	u8 tuple_sets;
-	int ret;
-
-	if (nfc->data & ~(RXH_IP_SRC | RXH_IP_DST |
-			  RXH_L4_B_0_1 | RXH_L4_B_2_3))
-		return -EINVAL;
-
-	req = (struct hclge_rss_input_tuple_cmd *)desc.data;
-	hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_RSS_INPUT_TUPLE, false);
 
 	req->ipv4_tcp_en = vport->rss_tuple_sets.ipv4_tcp_en;
 	req->ipv4_udp_en = vport->rss_tuple_sets.ipv4_udp_en;
@@ -4561,6 +4551,32 @@ static int hclge_set_rss_tuple(struct hnae3_handle *handle,
 		return -EINVAL;
 	}
 
+	return 0;
+}
+
+static int hclge_set_rss_tuple(struct hnae3_handle *handle,
+			       struct ethtool_rxnfc *nfc)
+{
+	struct hclge_vport *vport = hclge_get_vport(handle);
+	struct hclge_dev *hdev = vport->back;
+	struct hclge_rss_input_tuple_cmd *req;
+	struct hclge_desc desc;
+	int ret;
+
+	if (nfc->data & ~(RXH_IP_SRC | RXH_IP_DST |
+			  RXH_L4_B_0_1 | RXH_L4_B_2_3))
+		return -EINVAL;
+
+	req = (struct hclge_rss_input_tuple_cmd *)desc.data;
+	hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_RSS_INPUT_TUPLE, false);
+
+	ret = hclge_init_rss_tuple_cmd(vport, nfc, req);
+	if (ret) {
+		dev_err(&hdev->pdev->dev,
+			"failed to init rss tuple cmd, ret = %d\n", ret);
+		return ret;
+	}
+
 	ret = hclge_cmd_send(&hdev->hw, &desc, 1);
 	if (ret) {
 		dev_err(&hdev->pdev->dev,
-- 
2.7.4


  parent reply	other threads:[~2021-02-10  7:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-10  7:43 [PATCH net-next 00/13] net: hns3: some cleanups for -next Huazhong Tan
2021-02-10  7:43 ` [PATCH net-next 01/13] net: hns3: refactor out hclge_cmd_convert_err_code() Huazhong Tan
2021-02-10  7:43 ` [PATCH net-next 02/13] net: hns3: refactor out hclgevf_cmd_convert_err_code() Huazhong Tan
2021-02-10  7:43 ` [PATCH net-next 03/13] net: hns3: clean up hns3_dbg_cmd_write() Huazhong Tan
2021-02-10  7:43 ` [PATCH net-next 04/13] net: hns3: use ipv6_addr_any() helper Huazhong Tan
2021-02-10  7:43 ` [PATCH net-next 05/13] net: hns3: refactor out hclge_set_vf_vlan_common() Huazhong Tan
2021-02-10  7:43 ` [PATCH net-next 06/13] net: hns3: refactor out hclge_get_rss_tuple() Huazhong Tan
2021-02-10  7:43 ` [PATCH net-next 07/13] net: hns3: refactor out hclgevf_get_rss_tuple() Huazhong Tan
2021-02-10  7:43 ` [PATCH net-next 08/13] net: hns3: split out hclge_dbg_dump_qos_buf_cfg() Huazhong Tan
2021-02-10  7:43 ` [PATCH net-next 09/13] net: hns3: split out hclge_cmd_send() Huazhong Tan
2021-02-10  7:43 ` [PATCH net-next 10/13] net: hns3: split out hclgevf_cmd_send() Huazhong Tan
2021-02-10  7:43 ` Huazhong Tan [this message]
2021-02-10  7:43 ` [PATCH net-next 12/13] net: hns3: refactor out hclgevf_set_rss_tuple() Huazhong Tan
2021-02-10  7:43 ` [PATCH net-next 13/13] net: hns3: refactor out hclge_rm_vport_all_mac_table() Huazhong Tan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1612943005-59416-12-git-send-email-tanhuazhong@huawei.com \
    --to=tanhuazhong@huawei.com \
    --cc=davem@davemloft.net \
    --cc=huangdaode@huawei.com \
    --cc=kuba@kernel.org \
    --cc=linuxarm@openeuler.org \
    --cc=netdev@vger.kernel.org \
    --cc=salil.mehta@huawei.com \
    --cc=yisen.zhuang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.