Commit 352f58b0 authored by Aviad Krawczyk's avatar Aviad Krawczyk Committed by David S. Miller

net-next/hinic: Set Rxq irq to specific cpu for NUMA

Set Rxq irq to specific cpu for allocating and receiving the skb from
the same node.
Signed-off-by: default avatarAviad Krawczyk <aviad.krawczyk@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 93771b01
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/prefetch.h> #include <linux/prefetch.h>
#include <linux/cpumask.h>
#include <asm/barrier.h> #include <asm/barrier.h>
#include "hinic_common.h" #include "hinic_common.h"
...@@ -171,11 +172,10 @@ static int rx_alloc_pkts(struct hinic_rxq *rxq) ...@@ -171,11 +172,10 @@ static int rx_alloc_pkts(struct hinic_rxq *rxq)
struct hinic_sge sge; struct hinic_sge sge;
dma_addr_t dma_addr; dma_addr_t dma_addr;
struct sk_buff *skb; struct sk_buff *skb;
int i, alloc_more;
u16 prod_idx; u16 prod_idx;
int i;
free_wqebbs = hinic_get_rq_free_wqebbs(rxq->rq); free_wqebbs = hinic_get_rq_free_wqebbs(rxq->rq);
alloc_more = 0;
/* Limit the allocation chunks */ /* Limit the allocation chunks */
if (free_wqebbs > nic_dev->rx_weight) if (free_wqebbs > nic_dev->rx_weight)
...@@ -185,7 +185,6 @@ static int rx_alloc_pkts(struct hinic_rxq *rxq) ...@@ -185,7 +185,6 @@ static int rx_alloc_pkts(struct hinic_rxq *rxq)
skb = rx_alloc_skb(rxq, &dma_addr); skb = rx_alloc_skb(rxq, &dma_addr);
if (!skb) { if (!skb) {
netdev_err(rxq->netdev, "Failed to alloc Rx skb\n"); netdev_err(rxq->netdev, "Failed to alloc Rx skb\n");
alloc_more = 1;
goto skb_out; goto skb_out;
} }
...@@ -195,7 +194,6 @@ static int rx_alloc_pkts(struct hinic_rxq *rxq) ...@@ -195,7 +194,6 @@ static int rx_alloc_pkts(struct hinic_rxq *rxq)
&prod_idx); &prod_idx);
if (!rq_wqe) { if (!rq_wqe) {
rx_free_skb(rxq, skb, dma_addr); rx_free_skb(rxq, skb, dma_addr);
alloc_more = 1;
goto skb_out; goto skb_out;
} }
...@@ -211,9 +209,7 @@ static int rx_alloc_pkts(struct hinic_rxq *rxq) ...@@ -211,9 +209,7 @@ static int rx_alloc_pkts(struct hinic_rxq *rxq)
hinic_rq_update(rxq->rq, prod_idx); hinic_rq_update(rxq->rq, prod_idx);
} }
if (alloc_more)
tasklet_schedule(&rxq->rx_task); tasklet_schedule(&rxq->rx_task);
return i; return i;
} }
...@@ -357,7 +353,7 @@ static int rxq_recv(struct hinic_rxq *rxq, int budget) ...@@ -357,7 +353,7 @@ static int rxq_recv(struct hinic_rxq *rxq, int budget)
} }
if (pkts) if (pkts)
tasklet_schedule(&rxq->rx_task); /* hinic_rx_alloc_pkts */ tasklet_schedule(&rxq->rx_task); /* rx_alloc_pkts */
u64_stats_update_begin(&rxq->rxq_stats.syncp); u64_stats_update_begin(&rxq->rxq_stats.syncp);
rxq->rxq_stats.pkts += pkts; rxq->rxq_stats.pkts += pkts;
...@@ -417,6 +413,8 @@ static int rx_request_irq(struct hinic_rxq *rxq) ...@@ -417,6 +413,8 @@ static int rx_request_irq(struct hinic_rxq *rxq)
struct hinic_dev *nic_dev = netdev_priv(rxq->netdev); struct hinic_dev *nic_dev = netdev_priv(rxq->netdev);
struct hinic_hwdev *hwdev = nic_dev->hwdev; struct hinic_hwdev *hwdev = nic_dev->hwdev;
struct hinic_rq *rq = rxq->rq; struct hinic_rq *rq = rxq->rq;
struct hinic_qp *qp;
struct cpumask mask;
int err; int err;
rx_add_napi(rxq); rx_add_napi(rxq);
...@@ -432,7 +430,9 @@ static int rx_request_irq(struct hinic_rxq *rxq) ...@@ -432,7 +430,9 @@ static int rx_request_irq(struct hinic_rxq *rxq)
return err; return err;
} }
return 0; qp = container_of(rq, struct hinic_qp, rq);
cpumask_set_cpu(qp->q_id % num_online_cpus(), &mask);
return irq_set_affinity_hint(rq->irq, &mask);
} }
static void rx_free_irq(struct hinic_rxq *rxq) static void rx_free_irq(struct hinic_rxq *rxq)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment