}
}
+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)
{
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
global:
rte_dpaa2_bpid_info;
+ rte_dpaa2_bpid_info_init;
rte_dpaa2_mbuf_alloc_bulk;
};
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;
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;
#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>
}
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;
}
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,