Lines Matching defs:state
157 struct phylink_link_state *state)
159 pl->mac_ops->validate(pl->config, supported, state);
383 struct phylink_link_state *state)
386 if (!state->an_enabled)
387 state->pause &= ~MLO_PAUSE_AN;
391 state->pause = pl->link_config.pause;
394 static void phylink_resolve_flow(struct phylink_link_state *state)
398 state->pause = MLO_PAUSE_NONE;
399 if (state->duplex == DUPLEX_FULL) {
400 linkmode_resolve_pause(state->advertising,
401 state->lp_advertising,
404 state->pause |= MLO_PAUSE_TX;
406 state->pause |= MLO_PAUSE_RX;
411 const struct phylink_link_state *state)
416 phy_modes(state->interface),
417 phy_speed_to_str(state->speed),
418 phy_duplex_to_str(state->duplex),
419 __ETHTOOL_LINK_MODE_MASK_NBITS, state->advertising,
420 state->pause, state->link, state->an_enabled);
422 pl->mac_ops->mac_config(pl->config, pl->cur_link_an_mode, state);
438 const struct phylink_link_state *state)
442 phylink_dbg(pl, "major config %s\n", phy_modes(state->interface));
446 state->interface);
454 phylink_mac_config(pl, state);
458 state->interface,
459 state->advertising,
473 state->interface);
524 struct phylink_link_state *state)
526 linkmode_copy(state->advertising, pl->link_config.advertising);
527 linkmode_zero(state->lp_advertising);
528 state->interface = pl->link_config.interface;
529 state->an_enabled = pl->link_config.an_enabled;
530 state->speed = SPEED_UNKNOWN;
531 state->duplex = DUPLEX_UNKNOWN;
532 state->pause = MLO_PAUSE_NONE;
533 state->an_complete = 0;
534 state->link = 1;
537 pl->pcs_ops->pcs_get_state(pl->pcs, state);
539 pl->mac_ops->mac_pcs_get_state(pl->config, state);
541 state->link = 0;
544 /* The fixed state is... fixed except for the link state,
548 struct phylink_link_state *state)
550 *state = pl->link_config;
552 pl->config->get_fixed_state(pl->config, state);
554 state->link = !!gpiod_get_value_cansleep(pl->link_gpio);
556 phylink_resolve_flow(state);
681 * PCS state to get the current status of the link.
691 /* If we have a phy, the "up" state is the union of
763 unsigned long state = pl->phylink_disable_state;
766 if (state == 0) {
1062 * capabilities, start the PHYLIB state machine and enable any interrupts
1176 * phylink_mac_change() - notify phylink of a change in MAC state
1180 * The MAC driver should call this driver when the state of its link
1277 * network device's carrier state should not be changed prior to calling this
1354 static void phylink_get_ksettings(const struct phylink_link_state *state,
1357 phylink_merge_link_mode(kset->link_modes.advertising, state->advertising);
1358 linkmode_copy(kset->link_modes.lp_advertising, state->lp_advertising);
1359 kset->base.speed = state->speed;
1360 kset->base.duplex = state->duplex;
1361 kset->base.autoneg = state->an_enabled ? AUTONEG_ENABLE :
1442 * last phy state updated via phylink_phy_change().
1683 * we can't hold our state mutex while calling phy_set_asym_pause().
1690 * resolve to update their state; we can not guarantee that the
1780 * passed in state. "aneg" defines if we report negotiation is possible.
1782 * FIXME: should deal with negotiation state too.
1785 struct phylink_link_state *state)
1788 unsigned long *lpa = state->lp_advertising;
1791 fs.link = state->link;
1792 fs.speed = state->speed;
1793 fs.duplex = state->duplex;
1799 if (!state->an_complete)
1889 struct phylink_link_state state;
1895 phylink_get_fixed_state(pl, &state);
1896 val = phylink_mii_emul_read(reg, &state);
1905 phylink_mac_pcs_get_state(pl, &state);
1906 val = phylink_mii_emul_read(reg, &state);
2291 * @state: a pointer to a &struct phylink_link_state
2295 * the interface mode to suit. @state->interface is appropriately
2299 void phylink_helper_basex_speed(struct phylink_link_state *state)
2301 if (phy_interface_mode_is_8023z(state->interface)) {
2302 bool want_2500 = state->an_enabled ?
2303 phylink_test(state->advertising, 2500baseX_Full) :
2304 state->speed == SPEED_2500;
2307 phylink_clear(state->advertising, 1000baseX_Full);
2308 state->interface = PHY_INTERFACE_MODE_2500BASEX;
2310 phylink_clear(state->advertising, 2500baseX_Full);
2311 state->interface = PHY_INTERFACE_MODE_1000BASEX;
2317 static void phylink_decode_c37_word(struct phylink_link_state *state,
2328 mii_lpa_mod_linkmode_x(state->lp_advertising, config_reg, fd_bit);
2330 if (linkmode_test_bit(fd_bit, state->advertising) &&
2331 linkmode_test_bit(fd_bit, state->lp_advertising)) {
2332 state->speed = speed;
2333 state->duplex = DUPLEX_FULL;
2336 state->link = false;
2339 linkmode_resolve_pause(state->advertising, state->lp_advertising,
2343 state->pause |= MLO_PAUSE_TX;
2345 state->pause |= MLO_PAUSE_RX;
2348 static void phylink_decode_sgmii_word(struct phylink_link_state *state,
2352 state->link = false;
2358 state->speed = SPEED_10;
2361 state->speed = SPEED_100;
2364 state->speed = SPEED_1000;
2367 state->link = false;
2371 state->duplex = DUPLEX_FULL;
2373 state->duplex = DUPLEX_HALF;
2378 * @state: a pointer to a struct phylink_link_state.
2385 void phylink_decode_usxgmii_word(struct phylink_link_state *state,
2390 state->speed = SPEED_10;
2393 state->speed = SPEED_100;
2396 state->speed = SPEED_1000;
2399 state->speed = SPEED_2500;
2402 state->speed = SPEED_5000;
2405 state->speed = SPEED_10000;
2408 state->link = false;
2413 state->duplex = DUPLEX_FULL;
2415 state->duplex = DUPLEX_HALF;
2420 * phylink_mii_c22_pcs_get_state() - read the MAC PCS state
2422 * @state: a pointer to a &struct phylink_link_state.
2427 * Read the MAC PCS state from the MII device configured in @config and
2429 * the phylink @state structure. This is suitable to be directly plugged
2434 struct phylink_link_state *state)
2443 state->link = false;
2447 state->link = !!(bmsr & BMSR_LSTATUS);
2448 state->an_complete = !!(bmsr & BMSR_ANEGCOMPLETE);
2449 if (!state->link)
2452 switch (state->interface) {
2454 phylink_decode_c37_word(state, lpa, SPEED_1000);
2458 phylink_decode_c37_word(state, lpa, SPEED_2500);
2463 phylink_decode_sgmii_word(state, lpa);
2467 state->link = false;
2483 * Configure the clause 37 PCS advertisement as specified by @state. This
2607 struct phylink_link_state *state)
2615 state->link = false;
2619 state->link = !!(stat & MDIO_STAT1_LSTATUS);
2620 if (!state->link)
2623 switch (state->interface) {
2625 state->speed = SPEED_10000;
2626 state->duplex = DUPLEX_FULL;