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

Function sfc_fec_get

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

Source from the content-addressed store, hash-verified

2500}
2501
2502static int
2503sfc_fec_get(struct rte_eth_dev *dev, uint32_t *fec_capa)
2504{
2505 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
2506 struct sfc_port *port = &sa->port;
2507 struct rte_eth_link current_link;
2508 efx_phy_fec_type_t active_fec;
2509 bool is_25g = false;
2510 int rc = 0;
2511
2512 sfc_adapter_lock(sa);
2513
2514 sfc_dev_get_rte_link(dev, 1, &current_link);
2515
2516 if (current_link.link_status == RTE_ETH_LINK_DOWN) {
2517 uint32_t speed = current_link.link_speed;
2518
2519 if (port->fec_auto) {
2520 *fec_capa = RTE_ETH_FEC_MODE_TO_CAPA(RTE_ETH_FEC_AUTO);
2521 goto adapter_unlock;
2522 }
2523
2524 is_25g = (speed == RTE_ETH_SPEED_NUM_25G ||
2525 speed == RTE_ETH_SPEED_NUM_50G);
2526
2527 *fec_capa = sfc_efx_caps_to_fec(port->fec_cfg, is_25g);
2528 if (*fec_capa == 0)
2529 rc = ENOTSUP;
2530
2531 goto adapter_unlock;
2532 }
2533
2534 rc = efx_phy_fec_type_get(sa->nic, &active_fec);
2535 if (rc != 0)
2536 goto adapter_unlock;
2537
2538 switch (active_fec) {
2539 case EFX_PHY_FEC_NONE:
2540 *fec_capa = RTE_ETH_FEC_MODE_TO_CAPA(RTE_ETH_FEC_NOFEC);
2541 break;
2542 case EFX_PHY_FEC_BASER:
2543 *fec_capa = RTE_ETH_FEC_MODE_TO_CAPA(RTE_ETH_FEC_BASER);
2544 break;
2545 case EFX_PHY_FEC_RS:
2546 *fec_capa = RTE_ETH_FEC_MODE_TO_CAPA(RTE_ETH_FEC_RS);
2547 break;
2548 default:
2549 rc = ENOTSUP;
2550 break;
2551 }
2552
2553adapter_unlock:
2554 sfc_adapter_unlock(sa);
2555
2556 if (rc != 0)
2557 sfc_err(sa, "failed to get FEC mode");
2558
2559 SFC_ASSERT(rc >= 0);

Callers

nothing calls this directly

Calls 4

sfc_adapter_by_eth_devFunction · 0.85
sfc_dev_get_rte_linkFunction · 0.85
sfc_efx_caps_to_fecFunction · 0.85
efx_phy_fec_type_getFunction · 0.85

Tested by

no test coverage detected