linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net:hns3:add xps init support
@ 2019-01-07  5:50 yuqi jin
  0 siblings, 0 replies; only message in thread
From: yuqi jin @ 2019-01-07  5:50 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: yuqi jin, Salil Mehta, Yisen Zhuang, David S. Miller

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@huawei.com>
Cc: Salil Mehta <salil.mehta@huawei.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: yuqi jin <jinyuqi@huawei.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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-01-07  6:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-07  5:50 [PATCH] net:hns3:add xps init support yuqi jin

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).