[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211223123013.29367-3-huangguangbin2@huawei.com>
Date: Thu, 23 Dec 2021 20:30:13 +0800
From: Guangbin Huang <huangguangbin2@...wei.com>
To: <davem@...emloft.net>, <kuba@...nel.org>, <wangjie125@...wei.com>
CC: <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<lipeng321@...wei.com>, <huangguangbin2@...wei.com>,
<chenhao288@...ilicon.com>
Subject: [PATCH net-next 2/2] net: hns3: add ethtool priv-flag for TX push
From: Yufeng Mo <moyufeng@...wei.com>
Add a control private flag in ethtool for enable/disable
TX push feature.
Signed-off-by: Yufeng Mo <moyufeng@...wei.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
Powered by blists - more mailing lists