From: Guangbin Huang <huangguangbin2@huawei.com>
To: <davem@davemloft.net>, <kuba@kernel.org>, <wangjie125@huawei.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<lipeng321@huawei.com>, <huangguangbin2@huawei.com>,
<chenhao288@hisilicon.com>
Subject: [RESEND PATCH net-next 2/2] net: hns3: add ethtool priv-flag for TX push
Date: Tue, 25 Jan 2022 15:21:49 +0800 [thread overview]
Message-ID: <20220125072149.56604-3-huangguangbin2@huawei.com> (raw)
In-Reply-To: <20220125072149.56604-1-huangguangbin2@huawei.com>
From: Yufeng Mo <moyufeng@huawei.com>
Add a control private flag in ethtool for enable/disable
TX push feature.
Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
drivers/net/ethernet/hisilicon/hns3/hnae3.h | 1 +
.../net/ethernet/hisilicon/hns3/hns3_enet.c | 5 ++++-
.../ethernet/hisilicon/hns3/hns3_ethtool.c | 19 ++++++++++++++++++-
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
index 6f18c9a03231..c40c45b75065 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
@@ -818,6 +818,7 @@ struct hnae3_roce_private_info {
enum hnae3_pflag {
HNAE3_PFLAG_LIMIT_PROMISC,
+ HNAE3_PFLAG_PUSH_ENABLE,
HNAE3_PFLAG_MAX
};
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index 0b8a73c40b12..97222192d68c 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -5162,8 +5162,11 @@ static void hns3_state_init(struct hnae3_handle *handle)
set_bit(HNS3_NIC_STATE_INITED, &priv->state);
- if (test_bit(HNAE3_DEV_SUPPORT_TX_PUSH_B, ae_dev->caps))
+ if (test_bit(HNAE3_DEV_SUPPORT_TX_PUSH_B, ae_dev->caps)) {
set_bit(HNS3_NIC_STATE_TX_PUSH_ENABLE, &priv->state);
+ handle->priv_flags |= BIT(HNAE3_PFLAG_PUSH_ENABLE);
+ set_bit(HNAE3_PFLAG_PUSH_ENABLE, &handle->supported_pflags);
+ }
if (ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V3)
set_bit(HNAE3_PFLAG_LIMIT_PROMISC, &handle->supported_pflags);
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
index 6469238ae090..a7cf5fee9f48 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
@@ -440,8 +440,25 @@ static void hns3_update_limit_promisc_mode(struct net_device *netdev,
hns3_request_update_promisc_mode(handle);
}
+static void hns3_update_state(struct net_device *netdev,
+ enum hns3_nic_state state, bool enable)
+{
+ struct hns3_nic_priv *priv = netdev_priv(netdev);
+
+ if (enable)
+ set_bit(state, &priv->state);
+ else
+ clear_bit(state, &priv->state);
+}
+
+static void hns3_update_push_state(struct net_device *netdev, bool enable)
+{
+ hns3_update_state(netdev, HNS3_NIC_STATE_TX_PUSH_ENABLE, enable);
+}
+
static const struct hns3_pflag_desc hns3_priv_flags[HNAE3_PFLAG_MAX] = {
- { "limit_promisc", hns3_update_limit_promisc_mode }
+ { "limit_promisc", hns3_update_limit_promisc_mode },
+ { "tx_push_enable", hns3_update_push_state }
};
static int hns3_get_sset_count(struct net_device *netdev, int stringset)
--
2.33.0
next prev parent reply other threads:[~2022-01-25 7:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-25 7:21 [RESEND PATCH net-next 0/2] net: hns3: add support " Guangbin Huang
2022-01-25 7:21 ` [RESEND PATCH net-next 1/2] net: hns3: add support for TX push mode Guangbin Huang
2022-01-26 3:50 ` Jakub Kicinski
2022-01-26 6:48 ` huangguangbin (A)
2022-01-26 15:55 ` Jakub Kicinski
2022-01-25 7:21 ` Guangbin Huang [this message]
2022-01-26 3:55 ` [RESEND PATCH net-next 2/2] net: hns3: add ethtool priv-flag for TX push Jakub Kicinski
2022-01-29 1:14 ` huangguangbin (A)
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=20220125072149.56604-3-huangguangbin2@huawei.com \
--to=huangguangbin2@huawei.com \
--cc=chenhao288@hisilicon.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lipeng321@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=wangjie125@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®