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

Function sfc_fec_capa_to_efx

dpdk/drivers/net/sfc/sfc_ethdev.c:2619–2672  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2617}
2618
2619static int
2620sfc_fec_capa_to_efx(uint32_t supported_caps, uint32_t fec_capa,
2621 uint32_t *efx_fec_caps)
2622{
2623 bool fec_is_set = false;
2624 bool auto_fec = false;
2625 bool nofec = false;
2626 uint32_t ret = 0;
2627
2628 if (efx_fec_caps == NULL)
2629 return EINVAL;
2630
2631 if (fec_capa & RTE_ETH_FEC_MODE_TO_CAPA(RTE_ETH_FEC_AUTO))
2632 auto_fec = true;
2633
2634 if (fec_capa & RTE_ETH_FEC_MODE_TO_CAPA(RTE_ETH_FEC_NOFEC))
2635 nofec = true;
2636
2637 if (fec_capa == RTE_ETH_FEC_MODE_TO_CAPA(RTE_ETH_FEC_AUTO)) {
2638 ret |= (EFX_PHY_CAP_FEC_BIT(BASER_FEC) |
2639 EFX_PHY_CAP_FEC_BIT(25G_BASER_FEC) |
2640 EFX_PHY_CAP_FEC_BIT(RS_FEC)) & supported_caps;
2641 goto done;
2642 }
2643
2644 if (fec_capa & RTE_ETH_FEC_MODE_TO_CAPA(RTE_ETH_FEC_RS)) {
2645 fec_is_set = true;
2646
2647 if (supported_caps & EFX_PHY_CAP_FEC_BIT(RS_FEC)) {
2648 ret |= EFX_PHY_CAP_FEC_BIT(RS_FEC) |
2649 EFX_PHY_CAP_FEC_BIT(RS_FEC_REQUESTED);
2650 }
2651 }
2652 if (fec_capa & RTE_ETH_FEC_MODE_TO_CAPA(RTE_ETH_FEC_BASER)) {
2653 if (!auto_fec && fec_is_set)
2654 return EINVAL;
2655
2656 if (supported_caps & EFX_PHY_CAP_FEC_BIT(BASER_FEC)) {
2657 ret |= EFX_PHY_CAP_FEC_BIT(BASER_FEC) |
2658 EFX_PHY_CAP_FEC_BIT(BASER_FEC_REQUESTED);
2659 }
2660 if (supported_caps & EFX_PHY_CAP_FEC_BIT(25G_BASER_FEC)) {
2661 ret |= EFX_PHY_CAP_FEC_BIT(25G_BASER_FEC) |
2662 EFX_PHY_CAP_FEC_BIT(25G_BASER_FEC_REQUESTED);
2663 }
2664 }
2665
2666 if (ret == 0 && !nofec)
2667 return ENOTSUP;
2668
2669done:
2670 *efx_fec_caps = ret;
2671 return 0;
2672}
2673
2674static int
2675sfc_fec_set(struct rte_eth_dev *dev, uint32_t fec_capa)

Callers 1

sfc_fec_setFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected