| 311 | } |
| 312 | |
| 313 | __checkReturn efx_rc_t |
| 314 | efx_mac_fcntl_set( |
| 315 | __in efx_nic_t *enp, |
| 316 | __in unsigned int fcntl, |
| 317 | __in boolean_t autoneg) |
| 318 | { |
| 319 | efx_port_t *epp = &(enp->en_port); |
| 320 | const efx_mac_ops_t *emop = epp->ep_emop; |
| 321 | const efx_phy_ops_t *epop = epp->ep_epop; |
| 322 | unsigned int old_fcntl; |
| 323 | boolean_t old_autoneg; |
| 324 | unsigned int old_adv_cap; |
| 325 | efx_rc_t rc; |
| 326 | |
| 327 | EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); |
| 328 | EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT); |
| 329 | |
| 330 | if ((fcntl & ~(EFX_FCNTL_RESPOND | EFX_FCNTL_GENERATE)) != 0) { |
| 331 | rc = EINVAL; |
| 332 | goto fail1; |
| 333 | } |
| 334 | |
| 335 | /* |
| 336 | * Ignore a request to set flow control auto-negotiation |
| 337 | * if the PHY doesn't support it. |
| 338 | */ |
| 339 | if (~epp->ep_phy_cap_mask & (1 << EFX_PHY_CAP_AN)) |
| 340 | autoneg = B_FALSE; |
| 341 | |
| 342 | old_fcntl = epp->ep_fcntl; |
| 343 | old_autoneg = epp->ep_fcntl_autoneg; |
| 344 | old_adv_cap = epp->ep_adv_cap_mask; |
| 345 | |
| 346 | epp->ep_fcntl = fcntl; |
| 347 | epp->ep_fcntl_autoneg = autoneg; |
| 348 | |
| 349 | /* |
| 350 | * Always encode the flow control settings in the advertised |
| 351 | * capabilities even if we are not trying to auto-negotiate |
| 352 | * them and reconfigure both the PHY and the MAC. |
| 353 | */ |
| 354 | if (fcntl & EFX_FCNTL_RESPOND) |
| 355 | epp->ep_adv_cap_mask |= (1 << EFX_PHY_CAP_PAUSE | |
| 356 | 1 << EFX_PHY_CAP_ASYM); |
| 357 | else |
| 358 | epp->ep_adv_cap_mask &= ~(1 << EFX_PHY_CAP_PAUSE | |
| 359 | 1 << EFX_PHY_CAP_ASYM); |
| 360 | |
| 361 | if (fcntl & EFX_FCNTL_GENERATE) |
| 362 | epp->ep_adv_cap_mask ^= (1 << EFX_PHY_CAP_ASYM); |
| 363 | |
| 364 | if ((rc = epop->epo_reconfigure(enp)) != 0) |
| 365 | goto fail2; |
| 366 | |
| 367 | if ((rc = emop->emo_reconfigure(enp)) != 0) |
| 368 | goto fail3; |
| 369 | |
| 370 | return (0); |
no outgoing calls
no test coverage detected