Skip to content

Commit

Permalink
net: hns3: add xps setting support for hns3 driver
Browse files Browse the repository at this point in the history
This patch adds xps setting support for hns3 driver based on
the interrupt affinity info.

Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Yunsheng Lin authored and David S. Miller committed Feb 25, 2019
1 parent 834f9b0 commit 2a73ac3
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,29 @@ static int hns3_nic_net_up(struct net_device *netdev)
return ret;
}

static void hns3_config_xps(struct hns3_nic_priv *priv)
{
int i;

for (i = 0; i < priv->vector_num; i++) {
struct hns3_enet_tqp_vector *tqp_vector = &priv->tqp_vector[i];
struct hns3_enet_ring *ring = tqp_vector->tx_group.ring;

while (ring) {
int ret;

ret = netif_set_xps_queue(priv->netdev,
&tqp_vector->affinity_mask,
ring->tqp->tqp_index);
if (ret)
netdev_warn(priv->netdev,
"set xps queue failed: %d", ret);

ring = ring->next;
}
}
}

static int hns3_nic_net_open(struct net_device *netdev)
{
struct hns3_nic_priv *priv = netdev_priv(netdev);
Expand Down Expand Up @@ -410,6 +433,7 @@ 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);

hns3_config_xps(priv);
return 0;
}

Expand Down

0 comments on commit 2a73ac3

Please sign in to comment.