MCPcopy Create free account
hub / github.com/F-Stack/f-stack / dpaa2_dev_recycle_config

Function dpaa2_dev_recycle_config

dpdk/drivers/net/dpaa2/dpaa2_recycle.c:609–675  ·  view source on GitHub ↗

Configure dpaa2 port as recycle port */

Source from the content-addressed store, hash-verified

607
608/* Configure dpaa2 port as recycle port */
609int
610dpaa2_dev_recycle_config(struct rte_eth_dev *eth_dev)
611{
612 struct rte_device *dev = eth_dev->device;
613 struct dpaa2_dev_priv *priv = eth_dev->data->dev_private;
614 struct rte_dpaa2_device *dpaa2_dev =
615 container_of(dev, struct rte_dpaa2_device, device);
616 struct fsl_mc_io *dpni_dev = eth_dev->process_private;
617 struct dpni_port_cfg port_cfg;
618 int ret;
619
620 if (priv->flags & DPAA2_TX_LOOPBACK_MODE) {
621 DPAA2_PMD_INFO("%s has been configured recycle device.",
622 eth_dev->data->name);
623
624 return 0;
625 }
626
627 if (dpaa2_dev->ep_dev_type == DPAA2_MAC) {
628 /** For dpmac-dpni connection,
629 * try setting serdes loopback as recycle device at first.
630 */
631 if (dpaa2_svr_family == SVR_LS2088A) {
632 ret = ls_serdes_eth_lpbk(dpaa2_dev->ep_object_id, 1);
633 if (!ret) {
634 priv->flags |= DPAA2_TX_SERDES_LOOPBACK_MODE;
635 return 0;
636 }
637 } else if (dpaa2_svr_family == SVR_LX2160A) {
638 ret = lx_serdes_eth_lpbk(dpaa2_dev->ep_object_id, 1);
639 if (!ret) {
640 priv->flags |= DPAA2_TX_SERDES_LOOPBACK_MODE;
641 return 0;
642 }
643 } else {
644 DPAA2_PMD_DEBUG("Serdes loopback not support SoC(0x%08x)",
645 dpaa2_svr_family);
646 }
647
648 /** If serdes loopback is not supported for this mac,
649 * trying set mac loopback.
650 */
651
652 port_cfg.loopback_en = 1;
653 ret = dpni_set_port_cfg(dpni_dev, CMD_PRI_LOW,
654 priv->token,
655 DPNI_PORT_CFG_LOOPBACK,
656 &port_cfg);
657 if (ret) {
658 DPAA2_PMD_ERR("Error(%d) to enable loopback", ret);
659 return -ENOTSUP;
660 }
661
662 priv->flags |= DPAA2_TX_MAC_LOOPBACK_MODE;
663
664 return 0;
665 }
666

Callers 1

dpaa2_eth_dev_configureFunction · 0.85

Calls 3

ls_serdes_eth_lpbkFunction · 0.85
lx_serdes_eth_lpbkFunction · 0.85
dpni_set_port_cfgFunction · 0.85

Tested by

no test coverage detected