net/dpaa2: handle secondary process for DPNI

This change uses 'dev->process_private' instead of 'priv->hw'
to get dpmcp per process while setting flow distribution,
as priv->hw is only valid for primary process.
It also initialize rte_dpaa2_bpid_info in secondary process.

Signed-off-by: Jun Yang <jun.yang@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
This commit is contained in:
Jun Yang 2022-01-03 15:31:22 +05:30 committed by Ferruh Yigit
parent 72100f0dee
commit 6ac5a55b33
6 changed files with 51 additions and 6 deletions

View File

@ -263,6 +263,29 @@ rte_dpaa2_mbuf_release(struct rte_mempool *pool __rte_unused,
}
}
int rte_dpaa2_bpid_info_init(struct rte_mempool *mp)
{
struct dpaa2_bp_info *bp_info = mempool_to_bpinfo(mp);
uint32_t bpid = bp_info->bpid;
if (!rte_dpaa2_bpid_info) {
rte_dpaa2_bpid_info = (struct dpaa2_bp_info *)rte_malloc(NULL,
sizeof(struct dpaa2_bp_info) * MAX_BPID,
RTE_CACHE_LINE_SIZE);
if (rte_dpaa2_bpid_info == NULL)
return -ENOMEM;
memset(rte_dpaa2_bpid_info, 0,
sizeof(struct dpaa2_bp_info) * MAX_BPID);
}
rte_dpaa2_bpid_info[bpid].meta_data_size = sizeof(struct rte_mbuf)
+ rte_pktmbuf_priv_size(mp);
rte_dpaa2_bpid_info[bpid].bp_list = bp_info->bp_list;
rte_dpaa2_bpid_info[bpid].bpid = bpid;
return 0;
}
uint16_t
rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp)
{

View File

@ -46,6 +46,21 @@ rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp);
struct rte_mbuf *
rte_dpaa2_mbuf_from_buf_addr(struct rte_mempool *mp, void *buf_addr);
/**
* Initialize the rte_dpaa2_bpid_info
* In generial, it is called in the secondary process and
* mp has been created in the primary process.
*
* @param mp
* memory pool
*
* @return
* - 0 on success.
* - (<0) on failure.
*/
__rte_internal
int rte_dpaa2_bpid_info_init(struct rte_mempool *mp);
#ifdef __cplusplus
}
#endif

View File

@ -11,5 +11,6 @@ INTERNAL {
global:
rte_dpaa2_bpid_info;
rte_dpaa2_bpid_info_init;
rte_dpaa2_mbuf_alloc_bulk;
};

View File

@ -95,7 +95,7 @@ dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev,
uint64_t req_dist_set, int tc_index)
{
struct dpaa2_dev_priv *priv = eth_dev->data->dev_private;
struct fsl_mc_io *dpni = priv->hw;
struct fsl_mc_io *dpni = eth_dev->process_private;
struct dpni_rx_dist_cfg tc_cfg;
struct dpkg_profile_cfg kg_cfg;
void *p_params;
@ -457,13 +457,12 @@ dpaa2_distset_to_dpkg_profile_cfg(
int
dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv,
void *blist)
struct fsl_mc_io *dpni, void *blist)
{
/* Function to attach a DPNI with a buffer pool list. Buffer pool list
* handle is passed in blist.
*/
int32_t retcode;
struct fsl_mc_io *dpni = priv->hw;
struct dpni_pools_cfg bpool_cfg;
struct dpaa2_bp_list *bp_list = (struct dpaa2_bp_list *)blist;
struct dpni_buffer_layout layout;

View File

@ -18,6 +18,7 @@
#include <rte_dev.h>
#include <rte_fslmc.h>
#include <rte_flow_driver.h>
#include "rte_dpaa2_mempool.h"
#include "dpaa2_pmd_logs.h"
#include <fslmc_vfio.h>
@ -712,9 +713,14 @@ dpaa2_dev_rx_queue_setup(struct rte_eth_dev *dev,
}
if (!priv->bp_list || priv->bp_list->mp != mb_pool) {
if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
ret = rte_dpaa2_bpid_info_init(mb_pool);
if (ret)
return ret;
}
bpid = mempool_to_bpid(mb_pool);
ret = dpaa2_attach_bp_list(priv,
rte_dpaa2_bpid_info[bpid].bp_list);
ret = dpaa2_attach_bp_list(priv, dpni,
rte_dpaa2_bpid_info[bpid].bp_list);
if (ret)
return ret;
}

View File

@ -208,7 +208,8 @@ int dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev,
int dpaa2_remove_flow_dist(struct rte_eth_dev *eth_dev,
uint8_t tc_index);
int dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv, void *blist);
int dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv,
struct fsl_mc_io *dpni, void *blist);
__rte_internal
int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,