diff options
Diffstat (limited to 'drivers/mempool/dpaa2')
-rw-r--r-- | drivers/mempool/dpaa2/Makefile | 3 | ||||
-rw-r--r-- | drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 28 | ||||
-rw-r--r-- | drivers/mempool/dpaa2/dpaa2_hw_mempool.h | 2 |
3 files changed, 19 insertions, 14 deletions
diff --git a/drivers/mempool/dpaa2/Makefile b/drivers/mempool/dpaa2/Makefile index 26ccebde..1a174968 100644 --- a/drivers/mempool/dpaa2/Makefile +++ b/drivers/mempool/dpaa2/Makefile @@ -1,7 +1,6 @@ # BSD LICENSE # -# Copyright(c) 2016 NXP. All rights reserved. -# All rights reserved. +# Copyright 2016 NXP. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c index 5a5d6aaa..6df203fc 100644 --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c @@ -2,7 +2,7 @@ * BSD LICENSE * * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. - * Copyright (c) 2016 NXP. All rights reserved. + * Copyright 2016 NXP. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -47,7 +47,6 @@ #include <rte_cycles.h> #include <rte_kvargs.h> #include <rte_dev.h> -#include <rte_ethdev.h> #include <fslmc_logs.h> #include <mc/fsl_dpbp.h> @@ -63,6 +62,7 @@ rte_hw_mbuf_create_pool(struct rte_mempool *mp) { struct dpaa2_bp_list *bp_list; struct dpaa2_dpbp_dev *avail_dpbp; + struct dpaa2_bp_info *bp_info; struct dpbp_attr dpbp_attr; uint32_t bpid; int ret, p_ret; @@ -127,7 +127,12 @@ rte_hw_mbuf_create_pool(struct rte_mempool *mp) rte_dpaa2_bpid_info[bpid].bp_list = bp_list; rte_dpaa2_bpid_info[bpid].bpid = bpid; - mp->pool_data = (void *)&rte_dpaa2_bpid_info[bpid]; + bp_info = rte_malloc(NULL, + sizeof(struct dpaa2_bp_info), + RTE_CACHE_LINE_SIZE); + rte_memcpy(bp_info, (void *)&rte_dpaa2_bpid_info[bpid], + sizeof(struct dpaa2_bp_info)); + mp->pool_data = (void *)bp_info; PMD_INIT_LOG(DEBUG, "BP List created for bpid =%d", dpbp_attr.bpid); @@ -161,7 +166,7 @@ rte_hw_mbuf_free_pool(struct rte_mempool *mp) while (temp) { if (temp == bp) { prev->next = temp->next; - free(bp); + rte_free(bp); break; } prev = temp; @@ -169,6 +174,7 @@ rte_hw_mbuf_free_pool(struct rte_mempool *mp) } } + rte_free(mp->pool_data); dpaa2_free_dpbp_dev(dpbp_node); } @@ -188,7 +194,7 @@ rte_dpaa2_mbuf_release(struct rte_mempool *pool __rte_unused, if (unlikely(!DPAA2_PER_LCORE_DPIO)) { ret = dpaa2_affine_qbman_swp(); if (ret != 0) { - RTE_LOG(ERR, PMD, "Failed to allocate IO portal"); + RTE_LOG(ERR, PMD, "Failed to allocate IO portal\n"); return; } } @@ -267,7 +273,7 @@ rte_dpaa2_mbuf_alloc_bulk(struct rte_mempool *pool, if (unlikely(!DPAA2_PER_LCORE_DPIO)) { ret = dpaa2_affine_qbman_swp(); if (ret != 0) { - RTE_LOG(ERR, PMD, "Failed to allocate IO portal"); + RTE_LOG(ERR, PMD, "Failed to allocate IO portal\n"); return ret; } } @@ -294,7 +300,7 @@ rte_dpaa2_mbuf_alloc_bulk(struct rte_mempool *pool, /* Releasing all buffers allocated */ rte_dpaa2_mbuf_release(pool, obj_table, bpid, bp_info->meta_data_size, n); - return ret; + return -ENOBUFS; } /* assigning mbuf from the acquired objects */ for (i = 0; (i < ret) && bufs[i]; i++) { @@ -323,7 +329,7 @@ rte_hw_mbuf_free_bulk(struct rte_mempool *pool, bp_info = mempool_to_bpinfo(pool); if (!(bp_info->bp_list)) { - RTE_LOG(ERR, PMD, "DPAA2 buffer pool not configured"); + RTE_LOG(ERR, PMD, "DPAA2 buffer pool not configured\n"); return -ENOENT; } rte_dpaa2_mbuf_release(pool, obj_table, bp_info->bpid, @@ -341,7 +347,7 @@ rte_hw_mbuf_get_count(const struct rte_mempool *mp) struct dpaa2_dpbp_dev *dpbp_node; if (!mp || !mp->pool_data) { - RTE_LOG(ERR, PMD, "Invalid mempool provided"); + RTE_LOG(ERR, PMD, "Invalid mempool provided\n"); return 0; } @@ -351,12 +357,12 @@ rte_hw_mbuf_get_count(const struct rte_mempool *mp) ret = dpbp_get_num_free_bufs(&dpbp_node->dpbp, CMD_PRI_LOW, dpbp_node->token, &num_of_bufs); if (ret) { - RTE_LOG(ERR, PMD, "Unable to obtain free buf count (err=%d)", + RTE_LOG(ERR, PMD, "Unable to obtain free buf count (err=%d)\n", ret); return 0; } - RTE_LOG(DEBUG, PMD, "Free bufs = %u", num_of_bufs); + RTE_LOG(DEBUG, PMD, "Free bufs = %u\n", num_of_bufs); return num_of_bufs; } diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.h b/drivers/mempool/dpaa2/dpaa2_hw_mempool.h index c4d7fc02..56b71bed 100644 --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.h +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.h @@ -2,7 +2,7 @@ * BSD LICENSE * * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. - * Copyright (c) 2016 NXP. All rights reserved. + * Copyright 2016 NXP. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions |