@@ -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;
}
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(+)