diff options
author | Ioana Radulescu <ruxandra.radulescu@freescale.com> | 2013-07-29 13:03:50 (GMT) |
---|---|---|
committer | Fleming Andrew-AFLEMING <AFLEMING@freescale.com> | 2013-07-31 21:49:50 (GMT) |
commit | a3a292cd90c05ead376bdaa460629e7da5ee8552 (patch) | |
tree | b6db3445d832341fdb1b945e3ae76d561c33632d /drivers/net/ethernet/freescale/dpa | |
parent | afebf20c2a5616f00c3a8160e2c23a2868954813 (diff) | |
download | linux-fsl-qoriq-a3a292cd90c05ead376bdaa460629e7da5ee8552.tar.xz |
dpaa_eth: Move bpool seeding back to probe for SG driver
Only the non-SG ("optimized for forwarding") flavour of the driver
needs to have the buffer pool seeding done after all interfaces are
probed, as in this case the buffer size may vary between interfaces.
For the termination optimized flavour, we have a fixed buffer size on Rx,
so there's no need to wait for the pool seeding.
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@freescale.com>
Change-Id: I101ffa38e9f83f90a432620898a2a24ede6c0895
Reviewed-on: http://git.am.freescale.net:8181/3656
Reviewed-by: Hamciuc Bogdan-BHAMCIU1 <bogdan.hamciuc@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/dpa')
4 files changed, 12 insertions, 25 deletions
diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth.c index d175cdc..e9d3575 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth.c @@ -512,12 +512,12 @@ static void dpaa_eth_napi_disable(struct dpa_priv_s *priv) static int __cold dpa_eth_priv_start(struct net_device *net_dev) { - int i, err; + int err; struct dpa_priv_s *priv; - struct dpa_percpu_priv_s *percpu_priv; priv = netdev_priv(net_dev); +#ifndef CONFIG_FSL_DPAA_ETH_SG_SUPPORT /* Seed the global buffer pool at the first ifconfig up * of a private port. Update the percpu buffer counters * of each private interface. @@ -527,11 +527,7 @@ static int __cold dpa_eth_priv_start(struct net_device *net_dev) dpa_make_private_pool(default_pool); default_pool_seeded = true; } - for_each_online_cpu(i) { - percpu_priv = per_cpu_ptr(priv->percpu_priv, i); - if (!percpu_priv->dpa_bp) - percpu_priv->dpa_bp = priv->dpa_bp; - } +#endif dpaa_eth_napi_enable(priv); @@ -649,6 +645,7 @@ dpa_priv_bp_probe(struct device *dev) return ERR_PTR(-ENOMEM); } + dpa_bp->percpu_count = alloc_percpu(*dpa_bp->percpu_count); dpa_bp->target_count = CONFIG_FSL_DPAA_ETH_MAX_BUF_COUNT; dpa_bp->requires_draining = true; @@ -698,6 +695,9 @@ dpa_priv_bp_alloc(struct dpa_bp *dpa_bp) dpa_bp->dev = &pdev->dev; +#ifdef CONFIG_FSL_DPAA_ETH_SG_SUPPORT + dpa_make_private_pool(dpa_bp); +#endif default_pool = dpa_bp; dpa_bpid2pool_map(dpa_bp->bpid, dpa_bp); @@ -815,8 +815,10 @@ dpaa_eth_priv_probe(struct platform_device *_of_dev) * the maximum buffer size for private ports if necessary */ dpa_bp->size = dpa_bp_size(&buf_layout[RX]); +#ifndef CONFIG_FSL_DPAA_ETH_SG_SUPPORT if (dpa_bp->size > default_buf_size) default_buf_size = dpa_bp->size; +#endif INIT_LIST_HEAD(&priv->dpa_fq_list); @@ -896,6 +898,7 @@ dpaa_eth_priv_probe(struct platform_device *_of_dev) for_each_online_cpu(i) { percpu_priv = per_cpu_ptr(priv->percpu_priv, i); memset(percpu_priv, 0, sizeof(*percpu_priv)); + percpu_priv->dpa_bp = priv->dpa_bp; } err = dpa_private_netdev_init(dpa_node, net_dev); diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_non_sg.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_non_sg.c index f2c8ced..9927918 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_non_sg.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_non_sg.c @@ -124,8 +124,6 @@ void dpa_make_private_pool(struct dpa_bp *dpa_bp) { int i; - dpa_bp->percpu_count = alloc_percpu(*dpa_bp->percpu_count); - /* Give each cpu an allotment of "count" buffers */ for_each_online_cpu(i) { int j; diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c index cffc970..588c2d7 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c @@ -136,8 +136,6 @@ void dpa_make_private_pool(struct dpa_bp *dpa_bp) { int i; - dpa_bp->percpu_count = alloc_percpu(*dpa_bp->percpu_count); - /* Give each CPU an allotment of "config_count" buffers */ for_each_online_cpu(i) { int j; diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_unit_test.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_unit_test.c index 5df53a5..7c820d9 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_unit_test.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_unit_test.c @@ -346,7 +346,6 @@ void dpa_unit_test_drain_default_pool(struct net_device *net_dev) int i; int num; struct dpa_priv_s *priv; - struct dpa_percpu_priv_s *percpu_priv; priv = netdev_priv(net_dev); @@ -367,31 +366,20 @@ void dpa_unit_test_drain_default_pool(struct net_device *net_dev) } while (num == 8); /* restore counters to their previous state */ - free_percpu(default_pool->percpu_count); - for_each_online_cpu(i) { - percpu_priv = per_cpu_ptr(priv->percpu_priv, i); - percpu_priv->dpa_bp = NULL; + int *countptr = per_cpu_ptr(default_pool->percpu_count, i); + *countptr = 0; } } void dpa_unit_test_seed_default_pool(struct net_device *net_dev) { - int i; struct dpa_priv_s *priv; - struct dpa_percpu_priv_s *percpu_priv; priv = netdev_priv(net_dev); default_pool->size = default_buf_size; dpa_make_private_pool(default_pool); - - for_each_online_cpu(i) { - percpu_priv = per_cpu_ptr(priv->percpu_priv, i); - if (!percpu_priv->dpa_bp) { - percpu_priv->dpa_bp = priv->dpa_bp; - } - } } void dpa_unit_tests(struct net_device *net_dev) |