[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1546840985-114205-1-git-send-email-jinyuqi@huawei.com>
Date: Mon, 7 Jan 2019 14:03:05 +0800
From: yuqi jin <jinyuqi@...wei.com>
To: <netdev@...r.kernel.org>
CC: yuqi jin <jinyuqi@...wei.com>,
Yisen Zhuang <yisen.zhuang@...wei.com>,
Salil Mehta <salil.mehta@...wei.com>,
"David S. Miller" <davem@...emloft.net>
Subject: [PATCH] net:hns3:add xps init support
XPS settings based on CPU(s) map . we can use __netdev_pick_tx
to select the transmit queue,then we can improve performance
Cc: Yisen Zhuang <yisen.zhuang@...wei.com>
Cc: Salil Mehta <salil.mehta@...wei.com>
Cc: "David S. Miller" <davem@...emloft.net>
Signed-off-by: yuqi jin <jinyuqi@...wei.com>
---
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 30 +++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index d3b9aaf..29e2225 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -377,6 +377,30 @@ static int hns3_nic_net_up(struct net_device *netdev)
return ret;
}
+static int hns3_config_xps(struct hns3_nic_priv *priv)
+{
+ struct hnae3_handle *h = priv->ae_handle;
+ struct hnae3_knic_private_info *kinfo = &h->kinfo;
+ unsigned int queue_size = kinfo->rss_size * kinfo->num_tc;
+ struct hns3_enet_tqp_vector *tqp_vector;
+ struct hns3_nic_ring_data ring_data;
+ int ret = 0, i;
+
+ for (i = 0; i < queue_size; i++) {
+ ring_data = priv->ring_data[i];
+ tqp_vector = ring_data.ring->tqp_vector;
+ ret = netif_set_xps_queue(kinfo->netdev,
+ &tqp_vector->affinity_mask,
+ ring_data.queue_index);
+ if (ret) {
+ netdev_err(kinfo->netdev, "ret %d xps %d\n", ret,
+ tqp_vector->idx);
+ return ret;
+ }
+ }
+ return ret;
+}
+
static int hns3_nic_net_open(struct net_device *netdev)
{
struct hns3_nic_priv *priv = netdev_priv(netdev);
@@ -409,6 +433,12 @@ static int hns3_nic_net_open(struct net_device *netdev)
if (h->ae_algo->ops->set_timer_task)
h->ae_algo->ops->set_timer_task(priv->ae_handle, true);
+ ret = hns3_config_xps(priv);
+ if (ret) {
+ netdev_err(netdev,
+ "hns xps init fail, ret=%d!\n", ret);
+ return ret;
+ }
return 0;
}
--
1.8.3.1
Powered by blists - more mailing lists