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

Function efx_port_init

dpdk/drivers/common/sfc_efx/base/efx_port.c:10–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8#include "efx_impl.h"
9
10 __checkReturn efx_rc_t
11efx_port_init(
12 __in efx_nic_t *enp)
13{
14 efx_port_t *epp = &(enp->en_port);
15 const efx_phy_ops_t *epop = epp->ep_epop;
16 efx_rc_t rc;
17
18 EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
19 EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
20 EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NIC);
21
22 if (enp->en_mod_flags & EFX_MOD_PORT) {
23 rc = EINVAL;
24 goto fail1;
25 }
26
27 enp->en_mod_flags |= EFX_MOD_PORT;
28
29 epp->ep_mac_type = EFX_MAC_INVALID;
30 epp->ep_link_mode = EFX_LINK_UNKNOWN;
31 epp->ep_mac_drain = B_TRUE;
32
33 /* Configure the MAC */
34 if ((rc = efx_mac_select(enp)) != 0)
35 goto fail1;
36
37 epp->ep_emop->emo_reconfigure(enp);
38
39 /* Pick up current phy capababilities */
40 (void) efx_port_poll(enp, NULL);
41
42 /*
43 * Turn on the PHY if available, otherwise reset it, and
44 * reconfigure it with the current configuration.
45 */
46 if (epop->epo_power != NULL) {
47 if ((rc = epop->epo_power(enp, B_TRUE)) != 0)
48 goto fail2;
49 } else {
50 if ((rc = epop->epo_reset(enp)) != 0)
51 goto fail2;
52 }
53
54 EFSYS_ASSERT(enp->en_reset_flags & EFX_RESET_PHY);
55 enp->en_reset_flags &= ~EFX_RESET_PHY;
56
57 if ((rc = epop->epo_reconfigure(enp)) != 0)
58 goto fail3;
59
60 return (0);
61
62fail3:
63 EFSYS_PROBE(fail3);
64fail2:
65 EFSYS_PROBE(fail2);
66fail1:
67 EFSYS_PROBE1(fail1, efx_rc_t, rc);

Callers 1

sfc_port_startFunction · 0.85

Calls 2

efx_mac_selectFunction · 0.85
efx_port_pollFunction · 0.85

Tested by

no test coverage detected