Lines Matching refs:state

614  * @state: pointer to a &struct phylink_link_state.
618 * @supported and @state based on that. Use this function if your capabiliies
622 struct phylink_link_state *state,
630 caps = phylink_get_capabilities(state->interface, mac_capabilities,
631 state->rate_matching);
635 linkmode_and(state->advertising, state->advertising, mask);
643 * @state: a pointer to a &struct phylink_link_state.
650 struct phylink_link_state *state)
652 phylink_validate_mask_caps(supported, state, config->mac_capabilities);
658 struct phylink_link_state *state)
665 pcs = pl->mac_ops->mac_select_pcs(pl->config, state->interface);
679 phy_modes(state->interface));
686 ret = pcs->ops->pcs_validate(pcs, supported, state);
693 linkmode_and(state->advertising, state->advertising,
700 pl->mac_ops->validate(pl->config, supported, state);
702 phylink_generic_validate(pl->config, supported, state);
708 struct phylink_link_state *state,
721 t = *state;
731 linkmode_copy(state->advertising, all_adv);
737 struct phylink_link_state *state)
741 if (state->interface == PHY_INTERFACE_MODE_NA)
742 return phylink_validate_mask(pl, supported, state, interfaces);
744 if (!test_bit(state->interface, interfaces))
747 return phylink_validate_mac_and_pcs(pl, supported, state);
995 struct phylink_link_state *state)
999 state->advertising))
1000 state->pause &= ~MLO_PAUSE_AN;
1004 state->pause = pl->link_config.pause;
1007 static void phylink_resolve_an_pause(struct phylink_link_state *state)
1011 if (state->duplex == DUPLEX_FULL) {
1012 linkmode_resolve_pause(state->advertising,
1013 state->lp_advertising,
1016 state->pause |= MLO_PAUSE_TX;
1018 state->pause |= MLO_PAUSE_RX;
1057 const struct phylink_link_state *state,
1063 return pcs->ops->pcs_config(pcs, neg_mode, state->interface,
1064 state->advertising, permit_pause_to_mac);
1088 const struct phylink_link_state *state)
1090 struct phylink_link_state st = *state;
1120 const struct phylink_link_state *state)
1128 phylink_dbg(pl, "major config %s\n", phy_modes(state->interface));
1131 state->interface,
1132 state->advertising);
1135 pcs = pl->mac_ops->mac_select_pcs(pl->config, state->interface);
1150 state->interface);
1173 phylink_pcs_pre_config(pl->pcs, state->interface);
1175 phylink_mac_config(pl, state);
1178 phylink_pcs_post_config(pl->pcs, state->interface);
1187 err = phylink_pcs_config(pl->pcs, neg_mode, state,
1200 state->interface);
1207 rate_kbd = phylink_interface_signal_rate(state->interface);
1260 struct phylink_link_state *state)
1262 linkmode_copy(state->advertising, pl->link_config.advertising);
1263 linkmode_zero(state->lp_advertising);
1264 state->interface = pl->link_config.interface;
1265 state->rate_matching = pl->link_config.rate_matching;
1267 state->advertising)) {
1268 state->speed = SPEED_UNKNOWN;
1269 state->duplex = DUPLEX_UNKNOWN;
1270 state->pause = MLO_PAUSE_NONE;
1272 state->speed = pl->link_config.speed;
1273 state->duplex = pl->link_config.duplex;
1274 state->pause = pl->link_config.pause;
1276 state->an_complete = 0;
1277 state->link = 1;
1280 pl->pcs->ops->pcs_get_state(pl->pcs, state);
1282 state->link = 0;
1285 /* The fixed state is... fixed except for the link state,
1289 struct phylink_link_state *state)
1291 *state = pl->link_config;
1293 pl->config->get_fixed_state(pl->config, state);
1295 state->link = !!gpiod_get_value_cansleep(pl->link_gpio);
1297 state->pause = MLO_PAUSE_NONE;
1298 phylink_resolve_an_pause(state);
1451 * PCS state to get the current status of the link.
1461 /* If we have a phy, the "up" state is the union of
1538 unsigned long state = pl->phylink_disable_state;
1541 if (state == 0) {
1873 * capabilities, start the PHYLIB state machine and enable any interrupts
2016 * phylink_mac_change() - notify phylink of a change in MAC state
2020 * The MAC driver should call this driver when the state of its link
2030 * phylink_pcs_change() - notify phylink of a change to PCS link state
2034 * The PCS driver should call this when the state of its link changes
2037 * state at interrupt time, then pass true if pcs_get_state() returns
2038 * the latched link-down state, otherwise pass false.
2130 * network device's carrier state should not be changed prior to calling this
2207 * operational state.
2216 /* Call mac_link_down() so we keep the overall state balanced.
2219 * resume, which is harmless - the true link state will be
2295 static void phylink_get_ksettings(const struct phylink_link_state *state,
2298 phylink_merge_link_mode(kset->link_modes.advertising, state->advertising);
2299 linkmode_copy(kset->link_modes.lp_advertising, state->lp_advertising);
2301 kset->base.speed = state->speed;
2302 kset->base.duplex = state->duplex;
2305 state->advertising) ?
2391 * last phy state updated via phylink_phy_change().
2633 * we can't hold our state mutex while calling phy_set_asym_pause().
2640 * resolve to update their state; we can not guarantee that the
2730 * passed in state. "aneg" defines if we report negotiation is possible.
2732 * FIXME: should deal with negotiation state too.
2735 struct phylink_link_state *state)
2738 unsigned long *lpa = state->lp_advertising;
2741 fs.link = state->link;
2742 fs.speed = state->speed;
2743 fs.duplex = state->duplex;
2749 if (!state->an_complete)
2841 struct phylink_link_state state;
2847 phylink_get_fixed_state(pl, &state);
2848 val = phylink_mii_emul_read(reg, &state);
2857 phylink_mac_pcs_get_state(pl, &state);
2858 val = phylink_mii_emul_read(reg, &state);
3054 struct phylink_link_state *state)
3059 phylink_an_mode_str(mode), phy_modes(state->interface),
3067 if (!linkmode_equal(pl->link_config.advertising, state->advertising)) {
3068 linkmode_copy(pl->link_config.advertising, state->advertising);
3073 pl->link_config.interface != state->interface) {
3075 pl->link_config.interface = state->interface;
3081 phy_modes(state->interface));
3364 void phylink_resolve_c73(struct phylink_link_state *state)
3370 if (linkmode_test_bit(bit, state->advertising) &&
3371 linkmode_test_bit(bit, state->lp_advertising))
3376 state->speed = phylink_c73_priority_resolution[i].speed;
3377 state->duplex = DUPLEX_FULL;
3380 state->link = false;
3383 phylink_resolve_an_pause(state);
3387 static void phylink_decode_c37_word(struct phylink_link_state *state,
3397 mii_lpa_mod_linkmode_x(state->lp_advertising, config_reg, fd_bit);
3399 if (linkmode_test_bit(fd_bit, state->advertising) &&
3400 linkmode_test_bit(fd_bit, state->lp_advertising)) {
3401 state->speed = speed;
3402 state->duplex = DUPLEX_FULL;
3405 state->link = false;
3408 phylink_resolve_an_pause(state);
3411 static void phylink_decode_sgmii_word(struct phylink_link_state *state,
3415 state->link = false;
3421 state->speed = SPEED_10;
3424 state->speed = SPEED_100;
3427 state->speed = SPEED_1000;
3430 state->link = false;
3434 state->duplex = DUPLEX_FULL;
3436 state->duplex = DUPLEX_HALF;
3441 * @state: a pointer to a struct phylink_link_state.
3448 void phylink_decode_usxgmii_word(struct phylink_link_state *state,
3453 state->speed = SPEED_10;
3456 state->speed = SPEED_100;
3459 state->speed = SPEED_1000;
3462 state->speed = SPEED_2500;
3465 state->speed = SPEED_5000;
3468 state->speed = SPEED_10000;
3471 state->link = false;
3476 state->duplex = DUPLEX_FULL;
3478 state->duplex = DUPLEX_HALF;
3484 * @state: a pointer to a struct phylink_link_state.
3493 static void phylink_decode_usgmii_word(struct phylink_link_state *state,
3498 state->speed = SPEED_10;
3501 state->speed = SPEED_100;
3504 state->speed = SPEED_1000;
3507 state->link = false;
3512 state->duplex = DUPLEX_FULL;
3514 state->duplex = DUPLEX_HALF;
3518 * phylink_mii_c22_pcs_decode_state() - Decode MAC PCS state from MII registers
3519 * @state: a pointer to a &struct phylink_link_state.
3527 * the phylink @state structure. This is suitable to be used for implementing
3531 void phylink_mii_c22_pcs_decode_state(struct phylink_link_state *state,
3534 state->link = !!(bmsr & BMSR_LSTATUS);
3535 state->an_complete = !!(bmsr & BMSR_ANEGCOMPLETE);
3539 if (!state->link || !linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
3540 state->advertising))
3543 switch (state->interface) {
3545 phylink_decode_c37_word(state, lpa, SPEED_1000);
3549 phylink_decode_c37_word(state, lpa, SPEED_2500);
3554 phylink_decode_sgmii_word(state, lpa);
3557 phylink_decode_usgmii_word(state, lpa);
3561 state->link = false;
3568 * phylink_mii_c22_pcs_get_state() - read the MAC PCS state
3570 * @state: a pointer to a &struct phylink_link_state.
3575 * Read the MAC PCS state from the MII device configured in @config and
3577 * the phylink @state structure. This is suitable to be directly plugged
3582 struct phylink_link_state *state)
3589 state->link = false;
3593 phylink_mii_c22_pcs_decode_state(state, bmsr, lpa);
3672 /* Configure the inband state. Ensure ISOLATE bit is disabled */
3705 struct phylink_link_state *state)
3713 state->link = false;
3717 state->link = !!(stat & MDIO_STAT1_LSTATUS);
3718 if (!state->link)
3721 switch (state->interface) {
3723 state->speed = SPEED_10000;
3724 state->duplex = DUPLEX_FULL;