static int ldpaa_dpni_bind(struct ldpaa_eth_priv *priv) { struct dpni_pools_cfg pools_params; struct dpni_tx_flow_cfg dflt_tx_flow; int err = 0; pools_params.num_dpbp = 1; pools_params.pools[0].dpbp_id = (uint16_t)dflt_dpbp->dpbp_attr.id; pools_params.pools[0].buffer_size = LDPAA_ETH_RX_BUFFER_SIZE; err = dpni_set_pools(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpni->dpni_handle, &pools_params); if (err) { printf("dpni_set_pools() failed\n"); return err; } priv->tx_flow_id = DPNI_NEW_FLOW_ID; memset(&dflt_tx_flow, 0, sizeof(dflt_tx_flow)); dflt_tx_flow.options = DPNI_TX_FLOW_OPT_ONLY_TX_ERROR; dflt_tx_flow.conf_err_cfg.use_default_queue = 0; dflt_tx_flow.conf_err_cfg.errors_only = 1; err = dpni_set_tx_flow(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpni->dpni_handle, &priv->tx_flow_id, &dflt_tx_flow); if (err) { printf("dpni_set_tx_flow() failed\n"); return err; } return 0; }
int dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv, 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; int tot_size; /* ... rx buffer layout . * Check alignment for buffer layouts first */ /* ... rx buffer layout ... */ tot_size = DPAA2_HW_BUF_RESERVE + RTE_PKTMBUF_HEADROOM; tot_size = RTE_ALIGN_CEIL(tot_size, DPAA2_PACKET_LAYOUT_ALIGN); memset(&layout, 0, sizeof(struct dpni_buffer_layout)); layout.options = DPNI_BUF_LAYOUT_OPT_DATA_HEAD_ROOM; layout.data_head_room = tot_size - DPAA2_FD_PTA_SIZE - DPAA2_MBUF_HW_ANNOTATION; retcode = dpni_set_buffer_layout(dpni, CMD_PRI_LOW, priv->token, DPNI_QUEUE_RX, &layout); if (retcode) { PMD_INIT_LOG(ERR, "Err(%d) in setting rx buffer layout\n", retcode); return retcode; } /*Attach buffer pool to the network interface as described by the user*/ bpool_cfg.num_dpbp = 1; bpool_cfg.pools[0].dpbp_id = bp_list->buf_pool.dpbp_node->dpbp_id; bpool_cfg.pools[0].backup_pool = 0; bpool_cfg.pools[0].buffer_size = RTE_ALIGN_CEIL(bp_list->buf_pool.size, 256 /*DPAA2_PACKET_LAYOUT_ALIGN*/); retcode = dpni_set_pools(dpni, CMD_PRI_LOW, priv->token, &bpool_cfg); if (retcode != 0) { PMD_INIT_LOG(ERR, "Error in attaching the buffer pool list" " bpid = %d Error code = %d\n", bpool_cfg.pools[0].dpbp_id, retcode); return retcode; } priv->bp_list = bp_list; return 0; }
static int ldpaa_dpni_bind(struct ldpaa_eth_priv *priv) { struct dpni_pools_cfg pools_params; struct dpni_tx_flow_cfg dflt_tx_flow; struct dpni_tx_conf_cfg tx_conf_cfg; int err = 0; pools_params.num_dpbp = 1; pools_params.pools[0].dpbp_id = (uint16_t)dflt_dpbp->dpbp_attr.id; pools_params.pools[0].buffer_size = LDPAA_ETH_RX_BUFFER_SIZE; err = dpni_set_pools(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpni->dpni_handle, &pools_params); if (err) { printf("dpni_set_pools() failed\n"); return err; } priv->tx_flow_id = DPNI_NEW_FLOW_ID; memset(&dflt_tx_flow, 0, sizeof(dflt_tx_flow)); dflt_tx_flow.use_common_tx_conf_queue = 0; err = dpni_set_tx_flow(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpni->dpni_handle, &priv->tx_flow_id, &dflt_tx_flow); if (err) { printf("dpni_set_tx_flow() failed\n"); return err; } memset(&tx_conf_cfg, 0, sizeof(struct dpni_tx_conf_cfg)); tx_conf_cfg.errors_only = true; /*Set tx-conf and error configuration*/ err = dpni_set_tx_conf(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpni->dpni_handle, priv->tx_flow_id, &tx_conf_cfg); if (err) { printf("dpni_set_tx_conf() failed\n"); return err; } return 0; }