Skip to content

Commit

Permalink
Merge branch 'be2net-next'
Browse files Browse the repository at this point in the history
Sathya Perla says:

====================
be2net: patch set

Hi David, this patch set includes 2 feature additions to the be2net driver:

Patch 1 sets up cpu affinity hints for be2net irqs using the
cpumask_set_cpu_local_first() API that first picks the near numa cores
and when they are exhausted, selects the far numa cores.

Patch 2 setups up xps queue mapping for be2net's TXQs to avoid,
by default, TX lock contention.

Patch 3 just bumps up the driver version.

Pls consider applying this patch set to the net-next queue. Thanks!
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Mar 29, 2015
2 parents 41d25fe + 265ec92 commit 3556eaa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
4 changes: 3 additions & 1 deletion drivers/net/ethernet/emulex/benet/be.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@
#include <linux/firmware.h>
#include <linux/slab.h>
#include <linux/u64_stats_sync.h>
#include <linux/cpumask.h>

#include "be_hw.h"
#include "be_roce.h"

#define DRV_VER "10.4u"
#define DRV_VER "10.6.0.1"
#define DRV_NAME "be2net"
#define BE_NAME "Emulex BladeEngine2"
#define BE3_NAME "Emulex BladeEngine3"
Expand Down Expand Up @@ -183,6 +184,7 @@ struct be_eq_obj {
u16 spurious_intr;
struct napi_struct napi;
struct be_adapter *adapter;
cpumask_var_t affinity_mask;

#ifdef CONFIG_NET_RX_BUSY_POLL
#define BE_EQ_IDLE 0
Expand Down
27 changes: 21 additions & 6 deletions drivers/net/ethernet/emulex/benet/be_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2342,6 +2342,7 @@ static void be_evt_queues_destroy(struct be_adapter *adapter)
napi_hash_del(&eqo->napi);
netif_napi_del(&eqo->napi);
}
free_cpumask_var(eqo->affinity_mask);
be_queue_free(adapter, &eqo->q);
}
}
Expand All @@ -2357,6 +2358,11 @@ static int be_evt_queues_create(struct be_adapter *adapter)
adapter->cfg_num_qs);

for_all_evt_queues(adapter, eqo, i) {
if (!zalloc_cpumask_var(&eqo->affinity_mask, GFP_KERNEL))
return -ENOMEM;
cpumask_set_cpu_local_first(i, dev_to_node(&adapter->pdev->dev),
eqo->affinity_mask);

netif_napi_add(adapter->netdev, &eqo->napi, be_poll,
BE_NAPI_WEIGHT);
napi_hash_add(&eqo->napi);
Expand Down Expand Up @@ -2448,8 +2454,9 @@ static void be_tx_queues_destroy(struct be_adapter *adapter)

static int be_tx_qs_create(struct be_adapter *adapter)
{
struct be_queue_info *cq, *eq;
struct be_queue_info *cq;
struct be_tx_obj *txo;
struct be_eq_obj *eqo;
int status, i;

adapter->num_tx_qs = min(adapter->num_evt_qs, be_max_txqs(adapter));
Expand All @@ -2467,8 +2474,8 @@ static int be_tx_qs_create(struct be_adapter *adapter)
/* If num_evt_qs is less than num_tx_qs, then more than
* one txq share an eq
*/
eq = &adapter->eq_obj[i % adapter->num_evt_qs].q;
status = be_cmd_cq_create(adapter, cq, eq, false, 3);
eqo = &adapter->eq_obj[i % adapter->num_evt_qs];
status = be_cmd_cq_create(adapter, cq, &eqo->q, false, 3);
if (status)
return status;

Expand All @@ -2480,6 +2487,9 @@ static int be_tx_qs_create(struct be_adapter *adapter)
status = be_cmd_txq_create(adapter, txo);
if (status)
return status;

netif_set_xps_queue(adapter->netdev, eqo->affinity_mask,
eqo->idx);
}

dev_info(&adapter->pdev->dev, "created %d TX queue(s)\n",
Expand Down Expand Up @@ -3028,6 +3038,8 @@ static int be_msix_register(struct be_adapter *adapter)
status = request_irq(vec, be_msix, 0, eqo->desc, eqo);
if (status)
goto err_msix;

irq_set_affinity_hint(vec, eqo->affinity_mask);
}

return 0;
Expand Down Expand Up @@ -3072,7 +3084,7 @@ static void be_irq_unregister(struct be_adapter *adapter)
{
struct net_device *netdev = adapter->netdev;
struct be_eq_obj *eqo;
int i;
int i, vec;

if (!adapter->isr_registered)
return;
Expand All @@ -3084,8 +3096,11 @@ static void be_irq_unregister(struct be_adapter *adapter)
}

/* MSIx */
for_all_evt_queues(adapter, eqo, i)
free_irq(be_msix_vec_get(adapter, eqo), eqo);
for_all_evt_queues(adapter, eqo, i) {
vec = be_msix_vec_get(adapter, eqo);
irq_set_affinity_hint(vec, NULL);
free_irq(vec, eqo);
}

done:
adapter->isr_registered = false;
Expand Down

0 comments on commit 3556eaa

Please sign in to comment.