| 2672 | } |
| 2673 | |
| 2674 | static int |
| 2675 | sfc_fec_set(struct rte_eth_dev *dev, uint32_t fec_capa) |
| 2676 | { |
| 2677 | struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); |
| 2678 | struct sfc_port *port = &sa->port; |
| 2679 | uint32_t supported_caps; |
| 2680 | uint32_t efx_fec_caps; |
| 2681 | uint32_t updated_caps; |
| 2682 | int rc = 0; |
| 2683 | |
| 2684 | sfc_adapter_lock(sa); |
| 2685 | |
| 2686 | efx_phy_adv_cap_get(sa->nic, EFX_PHY_CAP_PERM, &supported_caps); |
| 2687 | |
| 2688 | rc = sfc_fec_capa_check(dev, fec_capa, supported_caps); |
| 2689 | if (rc != 0) |
| 2690 | goto adapter_unlock; |
| 2691 | |
| 2692 | rc = sfc_fec_capa_to_efx(supported_caps, fec_capa, &efx_fec_caps); |
| 2693 | if (rc != 0) |
| 2694 | goto adapter_unlock; |
| 2695 | |
| 2696 | if (sa->state == SFC_ETHDEV_STARTED) { |
| 2697 | efx_phy_adv_cap_get(sa->nic, EFX_PHY_CAP_CURRENT, |
| 2698 | &updated_caps); |
| 2699 | updated_caps = updated_caps & ~EFX_PHY_CAP_FEC_MASK; |
| 2700 | updated_caps |= efx_fec_caps; |
| 2701 | |
| 2702 | rc = efx_phy_adv_cap_set(sa->nic, updated_caps); |
| 2703 | if (rc != 0) |
| 2704 | goto adapter_unlock; |
| 2705 | } |
| 2706 | |
| 2707 | port->fec_cfg = efx_fec_caps; |
| 2708 | /* |
| 2709 | * There is no chance to recognize AUTO mode from the |
| 2710 | * saved FEC capabilities as AUTO mode can have the same |
| 2711 | * set of bits as any other mode from the EFX point of view. |
| 2712 | * Save it in the proper variable. |
| 2713 | */ |
| 2714 | if (fec_capa & RTE_ETH_FEC_MODE_TO_CAPA(RTE_ETH_FEC_AUTO)) |
| 2715 | port->fec_auto = true; |
| 2716 | else |
| 2717 | port->fec_auto = false; |
| 2718 | |
| 2719 | adapter_unlock: |
| 2720 | sfc_adapter_unlock(sa); |
| 2721 | |
| 2722 | SFC_ASSERT(rc >= 0); |
| 2723 | return -rc; |
| 2724 | } |
| 2725 | |
| 2726 | static const struct eth_dev_ops sfc_eth_dev_ops = { |
| 2727 | .dev_configure = sfc_dev_configure, |
nothing calls this directly
no test coverage detected