Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1115787pxv; Thu, 22 Jul 2021 23:22:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiLBz8dn77QohT3kSc4ymjZPj4FFtXv0LG5KDuu1WlZTddwNVO2Wms6nCDcbFgIOoILD6i X-Received: by 2002:a5d:9b14:: with SMTP id y20mr2803805ion.8.1627021360073; Thu, 22 Jul 2021 23:22:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627021360; cv=none; d=google.com; s=arc-20160816; b=FkU+Qy/le8VY9qWy0g1+FLOp4nHIUqFX3qC5WarWzsnxmI71pthxGtB4gSO8tt2dm3 0zolSy6+xR+oIM6cEAPRh22ODYsGV5OKKKcwNoR7XCmBR8ug0hgSIoPmKBsnUGJsUBV3 pLNU8dq5KERJZ23PWJE2zREakKlzK/R4QjN2SxHOE39g01Cw6VISxCZwDGV+f7hWL3B5 RTGzs+Xz1A4Uvwl4/1H1Rnwrt/vDM8IrQichBaDaP6P1eUGZb2AehmAkhjzgC2Sk5dD5 53mOiulPCkoHTnP1Pq7MpM7m4Ny9red9YWh9woW6Uj4Gzy74evM3lN+RkURz53p1+cUm up9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=eOpCOTTjmtB7X4BbQVcEfdlwlZskpHDiC+BN2wrxkwI=; b=QrlmP1vi/flnsuX+h22DGIk/DtbBtOOWAa+b6fUwqP/bfkhjp+mJO6C4Y7d/9HMvGn aHr2Q0B0+VBZWq0nh7ABDB6QxAyCVE9voUKdmEbdYfYxJD8XHD4QGsUNREUwPal5Jax1 fpWL7KXGqBEc+96nvCEyGrAnLfWbuUdCss4OzxSOPFacA7w93xnYQqO5dFXzjarwswJf Y+BIDqq1SQZFJmPSWoY83oCUEmoqz+ZC4PNcTAYsz+DhK0RF19onaGzvYNYYHhXZzkxW RgHEUjtp0xzFwv7jYWdCH0COG8+BnfHPk0eNAKWlcZPca0HovleT6/6FqaKJpAQ/adKv bHhA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v10si14210475ilh.117.2021.07.22.23.22.28; Thu, 22 Jul 2021 23:22:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234074AbhGWFjV (ORCPT + 99 others); Fri, 23 Jul 2021 01:39:21 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:12288 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233846AbhGWFjL (ORCPT ); Fri, 23 Jul 2021 01:39:11 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4GWJvX6tWNz7xBb; Fri, 23 Jul 2021 14:15:04 +0800 (CST) Received: from dggemi759-chm.china.huawei.com (10.1.198.145) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Fri, 23 Jul 2021 14:19:43 +0800 Received: from localhost.localdomain (10.67.165.24) by dggemi759-chm.china.huawei.com (10.1.198.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Fri, 23 Jul 2021 14:19:42 +0800 From: Guangbin Huang To: , , , , , , , CC: , , , , Subject: [RFC PATCH net-next 4/4] net: hns3: add ethtool priv-flag for TX push Date: Fri, 23 Jul 2021 14:16:09 +0800 Message-ID: <1627020969-32945-5-git-send-email-huangguangbin2@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1627020969-32945-1-git-send-email-huangguangbin2@huawei.com> References: <1627020969-32945-1-git-send-email-huangguangbin2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggemi759-chm.china.huawei.com (10.1.198.145) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Huazhong Tan Add a control private flag in ethtool for enable/disable TX push feature. Signed-off-by: Huazhong Tan Signed-off-by: Yufeng Mo --- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 1 + drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 5 ++++- drivers/net/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 f19336bbd88a..48d1f369f00e 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h @@ -807,6 +807,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 3fe4d9a165fa..a6434416006c 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -5128,8 +5128,11 @@ static int hns3_client_init(struct hnae3_handle *handle) if (hnae3_ae_dev_rxd_adv_layout_supported(ae_dev)) set_bit(HNS3_NIC_STATE_RXD_ADV_LAYOUT_ENABLE, &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); + } set_bit(HNS3_NIC_STATE_INITED, &priv->state); diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c index 155a58e11089..0b2557d4441d 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -423,8 +423,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.8.1