All of lore.kernel.org
 help / color / mirror / Atom feed
From: Huazhong Tan <tanhuazhong@huawei.com>
To: <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<salil.mehta@huawei.com>, <yisen.zhuang@huawei.com>,
	<linuxarm@huawei.com>, <kuba@kernel.org>,
	Huazhong Tan <tanhuazhong@huawei.com>
Subject: [PATCH V3 net-next 07/10] net: hns3: add hns3_state_init() to do state initialization
Date: Thu, 12 Nov 2020 11:33:15 +0800	[thread overview]
Message-ID: <1605151998-12633-8-git-send-email-tanhuazhong@huawei.com> (raw)
In-Reply-To: <1605151998-12633-1-git-send-email-tanhuazhong@huawei.com>

To improve the readability and maintainability, add hns3_state_init()
to initialize the state.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index a567557..f686723 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -4144,6 +4144,16 @@ static void hns3_info_show(struct hns3_nic_priv *priv)
 	dev_info(priv->dev, "Max mtu size: %u\n", priv->netdev->max_mtu);
 }
 
+static void hns3_state_init(struct hnae3_handle *handle)
+{
+	struct net_device *netdev = handle->kinfo.netdev;
+	struct hns3_nic_priv *priv = netdev_priv(netdev);
+
+	set_bit(HNS3_NIC_STATE_INITED, &priv->state);
+	set_bit(HNS3_NIC_STATE_DIM_ENABLE, &priv->state);
+	handle->priv_flags |= BIT(HNAE3_PFLAG_DIM_ENABLE);
+}
+
 static int hns3_client_init(struct hnae3_handle *handle)
 {
 	struct pci_dev *pdev = handle->pdev;
@@ -4244,9 +4254,7 @@ static int hns3_client_init(struct hnae3_handle *handle)
 	/* MTU range: (ETH_MIN_MTU(kernel default) - 9702) */
 	netdev->max_mtu = HNS3_MAX_MTU;
 
-	set_bit(HNS3_NIC_STATE_INITED, &priv->state);
-	set_bit(HNS3_NIC_STATE_DIM_ENABLE, &priv->state);
-	handle->priv_flags |= BIT(HNAE3_PFLAG_DIM_ENABLE);
+	hns3_state_init(handle);
 
 	if (netif_msg_drv(handle))
 		hns3_info_show(priv);
-- 
2.7.4


  parent reply	other threads:[~2020-11-12  5:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-12  3:33 [PATCH V3 net-next 00/10] net: hns3: updates for -next Huazhong Tan
2020-11-12  3:33 ` [PATCH V3 net-next 01/10] net: hns3: add support for configuring interrupt quantity limiting Huazhong Tan
2020-11-12  3:33 ` [PATCH V3 net-next 02/10] net: hns3: add support for querying maximum value of GL Huazhong Tan
2020-11-12  3:33 ` [PATCH V3 net-next 03/10] net: hns3: add support for 1us unit GL configuration Huazhong Tan
2020-11-12  3:33 ` [PATCH V3 net-next 04/10] net: hns3: rename gl_adapt_enable in struct hns3_enet_coalesce Huazhong Tan
2020-11-12  3:33 ` [PATCH V3 net-next 05/10] net: hns3: add support for dynamic interrupt moderation Huazhong Tan
2020-11-12  3:33 ` [PATCH V3 net-next 06/10] net: hns3: add ethtool priv-flag for DIM Huazhong Tan
2020-11-14 18:54   ` Jakub Kicinski
2020-11-16  8:41     ` tanhuazhong
2020-11-16 18:12       ` Jakub Kicinski
2020-11-12  3:33 ` Huazhong Tan [this message]
2020-11-12  3:33 ` [PATCH V3 net-next 08/10] net: hns3: add a check for ethtool priv-flag interface Huazhong Tan
2020-11-12  3:33 ` [PATCH V3 net-next 09/10] net: hns3: add support for EQ/CQ mode configuration Huazhong Tan
2020-11-12  3:33 ` [PATCH V3 net-next 10/10] net: hns3: add ethtool priv-flag for EQ/CQ 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=1605151998-12633-8-git-send-email-tanhuazhong@huawei.com \
    --to=tanhuazhong@huawei.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --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.