diff mbox series

[RESEND,net-next,2/2] net: hns3: add ethtool priv-flag for TX push

Message ID 20220125072149.56604-3-huangguangbin2@huawei.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series net: hns3: add support for TX push | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 4 this patch: 4
netdev/cc_maintainers success CCed 3 of 3 maintainers
netdev/build_clang fail Errors and warnings before: 10 this patch: 10
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 12 this patch: 12
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 45 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Guangbin Huang Jan. 25, 2022, 7:21 a.m. UTC
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(-)

Comments

Jakub Kicinski Jan. 26, 2022, 3:55 a.m. UTC | #1
On Tue, 25 Jan 2022 15:21:49 +0800 Guangbin Huang wrote:
> From: Yufeng Mo <moyufeng@huawei.com>
> 
> Add a control private flag in ethtool for enable/disable
> TX push feature.

I think it's a pretty standard feature for NICs which also support RDMA.
Mellanox/nVidia has it (or at least it the previous gen HW did),
Broadcom's bnxt driver does it as well.

Can we make this a standard knob via ethtool? Not entirely sure under
which switch, maybe it's okay to add it under -g? Perhaps we need a new
command similar to -k but for features contained entirely to the driver?
Guangbin Huang Jan. 29, 2022, 1:14 a.m. UTC | #2
On 2022/1/26 11:55, Jakub Kicinski wrote:
> On Tue, 25 Jan 2022 15:21:49 +0800 Guangbin Huang wrote:
>> From: Yufeng Mo <moyufeng@huawei.com>
>>
>> Add a control private flag in ethtool for enable/disable
>> TX push feature.
> 
> I think it's a pretty standard feature for NICs which also support RDMA.
> Mellanox/nVidia has it (or at least it the previous gen HW did),
> Broadcom's bnxt driver does it as well.
> 
> Can we make this a standard knob via ethtool? Not entirely sure under
> which switch, maybe it's okay to add it under -g? Perhaps we need a new
> command similar to -k but for features contained entirely to the driver?
> .
> 
Hi Jakub,
We consider adding a new command for this feature. We will send RFC after we finish it.
diff mbox series

Patch

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)