From: Peng Li <lipeng321@huawei.com>
To: <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linuxarm@huawei.com>, <salil.mehta@huawei.com>,
<lipeng321@huawei.com>
Subject: [PATCH net-next 01/11] net: hns3: add ethtool_ops.get_channels support for VF
Date: Thu, 11 Jan 2018 19:45:56 +0800 [thread overview]
Message-ID: <1515671166-48006-2-git-send-email-lipeng321@huawei.com> (raw)
In-Reply-To: <1515671166-48006-1-git-send-email-lipeng321@huawei.com>
This patch supports the ethtool's get_channels() for VF.
Signed-off-by: Peng Li <lipeng321@huawei.com>
---
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 1 +
.../ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 30 ++++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
index d3cb3ec..f44336c 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
@@ -900,6 +900,7 @@ static void hns3_get_channels(struct net_device *netdev,
.get_rxfh = hns3_get_rss,
.set_rxfh = hns3_set_rss,
.get_link_ksettings = hns3_get_link_ksettings,
+ .get_channels = hns3_get_channels,
};
static const struct ethtool_ops hns3_ethtool_ops = {
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
index 655f522..5f9afa6 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
@@ -1433,6 +1433,35 @@ static void hclgevf_uninit_ae_dev(struct hnae3_ae_dev *ae_dev)
ae_dev->priv = NULL;
}
+static u32 hclgevf_get_max_channels(struct hclgevf_dev *hdev)
+{
+ struct hnae3_handle *nic = &hdev->nic;
+ struct hnae3_knic_private_info *kinfo = &nic->kinfo;
+
+ return min_t(u32, hdev->rss_size_max * kinfo->num_tc, hdev->num_tqps);
+}
+
+/**
+ * hclgevf_get_channels - Get the current channels enabled and max supported.
+ * @handle: hardware information for network interface
+ * @ch: ethtool channels structure
+ *
+ * We don't support separate tx and rx queues as channels. The other count
+ * represents how many queues are being used for control. max_combined counts
+ * how many queue pairs we can support. They may not be mapped 1 to 1 with
+ * q_vectors since we support a lot more queue pairs than q_vectors.
+ **/
+static void hclgevf_get_channels(struct hnae3_handle *handle,
+ struct ethtool_channels *ch)
+{
+ struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
+
+ ch->max_combined = hclgevf_get_max_channels(hdev);
+ ch->other_count = 0;
+ ch->max_other = 0;
+ ch->combined_count = hdev->num_tqps;
+}
+
static const struct hnae3_ae_ops hclgevf_ops = {
.init_ae_dev = hclgevf_init_ae_dev,
.uninit_ae_dev = hclgevf_uninit_ae_dev,
@@ -1462,6 +1491,7 @@ static void hclgevf_uninit_ae_dev(struct hnae3_ae_dev *ae_dev)
.get_tc_size = hclgevf_get_tc_size,
.get_fw_version = hclgevf_get_fw_version,
.set_vlan_filter = hclgevf_set_vlan_filter,
+ .get_channels = hclgevf_get_channels,
};
static struct hnae3_ae_algo ae_algovf = {
--
1.9.1
next prev parent reply other threads:[~2018-01-11 11:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-11 11:45 [PATCH net-next 00/11] add some new features and fix some bugs Peng Li
2018-01-11 11:45 ` Peng Li [this message]
2018-01-11 11:45 ` [PATCH net-next 02/11] net: hns3: remove TSO config command from VF driver Peng Li
2018-01-11 11:45 ` [PATCH net-next 03/11] net: hns3: add ethtool_ops.get_coalesce support to PF Peng Li
2018-01-11 11:45 ` [PATCH net-next 04/11] net: hns3: add ethtool_ops.set_coalesce " Peng Li
2018-01-11 11:46 ` [PATCH net-next 05/11] net: hns3: refactor interrupt coalescing init function Peng Li
2018-01-11 11:46 ` [PATCH net-next 06/11] net: hns3: refactor GL update function Peng Li
2018-01-11 11:46 ` [PATCH net-next 07/11] net: hns3: remove unused GL setup function Peng Li
2018-01-11 11:46 ` [PATCH net-next 08/11] net: hns3: change the unit of GL value macro Peng Li
2018-01-11 11:46 ` [PATCH net-next 09/11] net: hns3: add int_gl_idx setup for TX and RX queues Peng Li
2018-01-11 11:46 ` [PATCH net-next 10/11] net: hns3: add feature check when feature changed Peng Li
2018-01-11 11:46 ` [PATCH net-next 11/11] net: hns3: check for NULL function pointer in hns3_nic_set_features Peng Li
2018-01-11 17:07 ` [PATCH net-next 00/11] add some new features and fix some bugs David Miller
2018-01-12 3:26 ` lipeng (Y)
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=1515671166-48006-2-git-send-email-lipeng321@huawei.com \
--to=lipeng321@huawei.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=salil.mehta@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;
as well as URLs for NNTP newsgroup(s).