mempool/dpaa2: add functions for CMDIF

There are two API's which are required by NXP specific Command Interface
Application (AIOP CMDIF). This patch exposes these two API's.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
This commit is contained in:
Nipun Gupta 2018-05-04 15:41:23 +05:30 committed by Thomas Monjalon
parent e2077a158e
commit 7ed3599095
6 changed files with 95 additions and 0 deletions

View File

@ -38,6 +38,7 @@ The public API headers are grouped by topics:
[i40e] (@ref rte_pmd_i40e.h),
[bnxt] (@ref rte_pmd_bnxt.h),
[dpaa] (@ref rte_pmd_dpaa.h),
[dpaa2_mempool] (@ref rte_dpaa2_mempool.h),
[dpaa2_qdma] (@ref rte_pmd_dpaa2_qdma.h),
[crypto_scheduler] (@ref rte_cryptodev_scheduler.h)

View File

@ -31,6 +31,7 @@
PROJECT_NAME = DPDK
INPUT = doc/api/doxy-api-index.md \
drivers/crypto/scheduler \
drivers/mempool/dpaa2 \
drivers/net/bnxt \
drivers/net/bonding \
drivers/net/dpaa \

View File

@ -31,4 +31,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL) += dpaa2_hw_mempool.c
LDLIBS += -lrte_bus_fslmc
LDLIBS += -lrte_eal -lrte_mempool -lrte_ring
SYMLINK-$(CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL)-include := rte_dpaa2_mempool.h
include $(RTE_SDK)/mk/rte.lib.mk

View File

@ -21,6 +21,7 @@
#include <rte_cycles.h>
#include <rte_kvargs.h>
#include <rte_dev.h>
#include "rte_dpaa2_mempool.h"
#include <fslmc_logs.h>
#include <mc/fsl_dpbp.h>
@ -244,6 +245,35 @@ rte_dpaa2_mbuf_release(struct rte_mempool *pool __rte_unused,
}
}
uint16_t
rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp)
{
struct dpaa2_bp_info *bp_info;
bp_info = mempool_to_bpinfo(mp);
if (!(bp_info->bp_list)) {
RTE_LOG(ERR, PMD, "DPAA2 buffer pool not configured\n");
return -ENOMEM;
}
return bp_info->bpid;
}
struct rte_mbuf *
rte_dpaa2_mbuf_from_buf_addr(struct rte_mempool *mp, void *buf_addr)
{
struct dpaa2_bp_info *bp_info;
bp_info = mempool_to_bpinfo(mp);
if (!(bp_info->bp_list)) {
RTE_LOG(ERR, PMD, "DPAA2 buffer pool not configured\n");
return NULL;
}
return (struct rte_mbuf *)((uint8_t *)buf_addr -
bp_info->meta_data_size);
}
int
rte_dpaa2_mbuf_alloc_bulk(struct rte_mempool *pool,
void **obj_table, unsigned int count)

View File

@ -0,0 +1,53 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright 2018 NXP
*/
#ifndef __RTE_DPAA2_MEMPOOL_H__
#define __RTE_DPAA2_MEMPOOL_H__
/**
* @file
*
* NXP specific mempool related functions.
*
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <rte_mempool.h>
/**
* Get BPID corresponding to the packet pool
*
* @param mp
* memory pool
*
* @return
* BPID of the buffer pool
*/
uint16_t
rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp);
/**
* Get MBUF from the corresponding 'buf_addr'
*
* @param mp
* memory pool
* @param buf_addr
* The 'buf_addr' of the mbuf. This is the start buffer address
* of the packet buffer (mbuf).
*
* @return
* - MBUF pointer for success
* - NULL in case of error
*/
struct rte_mbuf *
rte_dpaa2_mbuf_from_buf_addr(struct rte_mempool *mp, void *buf_addr);
#ifdef __cplusplus
}
#endif
#endif /* __RTE_DPAA2_MEMPOOL_H__ */

View File

@ -7,3 +7,11 @@ DPDK_17.05 {
local: *;
};
DPDK_18.05 {
global:
rte_dpaa2_mbuf_from_buf_addr;
rte_dpaa2_mbuf_pool_bpid;
} DPDK_17.05;