diff options
author | Marian Rotariu <marian.rotariu@freescale.com> | 2014-03-18 15:30:39 (GMT) |
---|---|---|
committer | Madalin-Cristian Bucur <madalin.bucur@freescale.com> | 2014-03-24 16:48:03 (GMT) |
commit | 5c0760552ac05ba032d2acdb4be64c184de633f5 (patch) | |
tree | 0b13eed8a8af402e99ffbfa33c1f5f92578ec879 /drivers/net/ethernet/freescale/dpa | |
parent | 269106c968def82560ce5443f46eb5db0742b6db (diff) | |
download | linux-fsl-qoriq-5c0760552ac05ba032d2acdb4be64c184de633f5.tar.xz |
dpaa_eth: fix bp initialization
Currently, if macless or shared Ethernet drivers have several buffer pools only
the first buffer pool will be initialized with a seeding procedure. With this
patch all configured buffer pools will have a seeding procedure.
Also, this patch removes unnecessary BUG_ON() from the bp initialization
function and fixes the release of bp structures.
Change-Id: Ie1fe6689867e921ccc75afbf50dfd5560c9216e9
Signed-off-by: Marian Rotariu <marian.rotariu@freescale.com>
Reviewed-on: http://git.am.freescale.net:8181/9873
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Madalin-Cristian Bucur <madalin.bucur@freescale.com>
Reviewed-by: Ruxandra Ioana Radulescu <ruxandra.radulescu@freescale.com>
(cherry picked from commit fda11c93afa1bdb71e34d07509305ff0df4a62a0)
Reviewed-on: http://git.am.freescale.net:8181/10176
Diffstat (limited to 'drivers/net/ethernet/freescale/dpa')
-rw-r--r-- | drivers/net/ethernet/freescale/dpa/dpaa_eth_common.c | 13 | ||||
-rw-r--r-- | drivers/net/ethernet/freescale/dpa/dpaa_eth_macless.c | 7 | ||||
-rw-r--r-- | drivers/net/ethernet/freescale/dpa/dpaa_eth_shared.c | 6 |
3 files changed, 18 insertions, 8 deletions
diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.c index a31b705..d2fc5e2 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.c @@ -686,8 +686,10 @@ dpa_bp_alloc(struct dpa_bp *dpa_bp) struct bman_pool_params bp_params; struct platform_device *pdev; - BUG_ON(dpa_bp->size == 0); - BUG_ON(dpa_bp->config_count == 0); + if (dpa_bp->size == 0 || dpa_bp->config_count == 0) { + pr_err("Buffer pool is not properly initialized! Missing size or initial number of buffers"); + return -EINVAL; + } bp_params.flags = 0; @@ -778,6 +780,13 @@ _dpa_bp_free(struct dpa_bp *dpa_bp) { struct dpa_bp *bp = dpa_bpid2pool(dpa_bp->bpid); + /* the mapping between bpid and dpa_bp is done very late in the + * allocation procedure; if something failed before the mapping, the bp + * was not configured, therefore we don't need the below instructions + */ + if (!bp) + return; + if (!atomic_dec_and_test(&bp->refs)) return; diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_macless.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_macless.c index 705a26f..56bf16b 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_macless.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_macless.c @@ -336,9 +336,11 @@ static int dpaa_eth_macless_probe(struct platform_device *_of_dev) if (IS_ERR(dpa_bp)) return PTR_ERR(dpa_bp); + for (i = 0; i < count; i++) + dpa_bp[i].seed_cb = dpa_bp_shared_port_seed; + proxy_dev = dpa_macless_proxy_probe(_of_dev); - dpa_bp->seed_cb = dpa_bp_shared_port_seed; /* Allocate this early, so we can store relevant information in * the private area (needed by 1588 code in dpa_mac_probe) @@ -389,9 +391,8 @@ static int dpaa_eth_macless_probe(struct platform_device *_of_dev) goto fq_probe_failed; /* bp init */ - + priv->bp_count = count; err = dpa_bp_create(net_dev, dpa_bp, count); - if (err < 0) goto bp_create_failed; diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_shared.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_shared.c index 8a99f65..2e10e33 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_shared.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_shared.c @@ -675,7 +675,8 @@ dpaa_eth_shared_probe(struct platform_device *_of_dev) if (IS_ERR(dpa_bp)) return PTR_ERR(dpa_bp); - dpa_bp->seed_cb = dpa_bp_shared_port_seed; + for (i = 0; i < count; i++) + dpa_bp[i].seed_cb = dpa_bp_shared_port_seed; /* Allocate this early, so we can store relevant information in * the private area (needed by 1588 code in dpa_mac_probe) @@ -726,9 +727,8 @@ dpaa_eth_shared_probe(struct platform_device *_of_dev) goto fq_probe_failed; /* bp init */ - + priv->bp_count = count; err = dpa_bp_create(net_dev, dpa_bp, count); - if (err < 0) goto bp_create_failed; |