summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/freescale/gianfar_sysfs.c
diff options
context:
space:
mode:
authorClaudiu Manoil <claudiu.manoil@freescale.com>2013-04-11 06:26:52 (GMT)
committerFleming Andrew-AFLEMING <AFLEMING@freescale.com>2013-05-17 00:35:08 (GMT)
commit97a9d931933576db075bdac292c853ec744d50dd (patch)
tree7c1015eef4a136ae0da181711990aa76f27fe0c4 /drivers/net/ethernet/freescale/gianfar_sysfs.c
parentedda2010a134a2e09d52d17f0185add7a1897e3e (diff)
downloadlinux-fsl-qoriq-97a9d931933576db075bdac292c853ec744d50dd.tar.xz
gianfar: Add percpu skb recycle queues
Improve skb recycling efficiency by adding per CPU recycle queues. This allows lockless access to the local recycle queues and improves cache locality for the recycled buffers. On the other hand it may increase memory usage as each device will have one local recycle queue for each CPU in addition to the "shared" recycle queue. The optimization targets packet forwarding scenarios where each flow is assigned to a single CPU. If the local percpu recycle queue cannot service the dequeue or enqueue requests (i.e. queue either empty or resp. full), then the request falls back to the shared recycle queue. Local per CPU queue accesses are lockless. The sysfs recycle stub has been augmented to print the percpu statistics as well. The gfar_init_recycle() has been updated to alloc the percpu local queue structures and moved after device registration, to be able to log warning messages should the allocation fail. MAX_RECYCLE is set to the default Tx ring size (which is now equal to the default Rx ring size). Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Change-Id: Ibae54d6dcd83581ca7a5f2d409b3b2b412e52f0d Reviewed-on: http://git.am.freescale.net:8181/2550 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com> Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Diffstat (limited to 'drivers/net/ethernet/freescale/gianfar_sysfs.c')
-rw-r--r--drivers/net/ethernet/freescale/gianfar_sysfs.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/net/ethernet/freescale/gianfar_sysfs.c b/drivers/net/ethernet/freescale/gianfar_sysfs.c
index 15973ca..4445c89 100644
--- a/drivers/net/ethernet/freescale/gianfar_sysfs.c
+++ b/drivers/net/ethernet/freescale/gianfar_sysfs.c
@@ -325,8 +325,17 @@ static ssize_t gfar_show_recycle(struct device *dev,
{
struct gfar_private *priv = netdev_priv(to_net_dev(dev));
struct gfar_priv_recycle *rec = &priv->recycle;
+ int cpu;
- pr_info("recycled skbs: %d\nreused skbs: %d\n",
+ for_each_possible_cpu(cpu) {
+ struct gfar_priv_recycle_local *local;
+
+ local = per_cpu_ptr(rec->local, cpu);
+ pr_info("local: CPU#%d: recycled skbs %d, reused skbs %d\n",
+ cpu, local->recycle_cnt, local->reuse_cnt);
+ }
+
+ pr_info("shared: recycled skbs %d, reused skbs %d\n",
atomic_read(&rec->recycle_cnt),
atomic_read(&rec->reuse_cnt));