Lines Matching +full:mode +full:-

22 	MLO_AN_FIXED,	/* Fixed-link mode */
23 MLO_AN_INBAND, /* In-band protocol */
25 /* PCS "negotiation" mode.
26 * PHYLINK_PCS_NEG_NONE - protocol has no inband capability
27 * PHYLINK_PCS_NEG_OUTBAND - some out of band or fixed link setting
28 * PHYLINK_PCS_NEG_INBAND_DISABLED - inband mode disabled, e.g.
29 * 1000base-X with autoneg off
30 * PHYLINK_PCS_NEG_INBAND_ENABLED - inband mode enabled
32 * PHYLINK_PCS_NEG_INBAND - inband mode selected
33 * PHYLINK_PCS_NEG_ENABLED - negotiation mode enabled
96 static inline bool phylink_autoneg_inband(unsigned int mode) in phylink_autoneg_inband() argument
98 return mode == MLO_AN_INBAND; in phylink_autoneg_inband()
102 * phylink_pcs_neg_mode() - helper to determine PCS inband mode
103 * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
104 * @interface: interface mode to be used
105 * @advertising: adertisement ethtool link mode mask
107 * Determines the negotiation mode to be used by the PCS, and returns
110 * - %PHYLINK_PCS_NEG_NONE: interface mode does not support inband
111 * - %PHYLINK_PCS_NEG_OUTBAND: an out of band mode (e.g. reading the PHY)
113 * - %PHYLINK_PCS_NEG_INBAND_DISABLED: inband mode selected but autoneg
115 * - %PHYLINK_PCS_NEG_INBAND_ENABLED: inband mode selected and autoneg enabled
120 static inline unsigned int phylink_pcs_neg_mode(unsigned int mode, in phylink_pcs_neg_mode() argument
136 if (!phylink_autoneg_inband(mode)) in phylink_pcs_neg_mode()
144 /* 1000base-X is designed for use media-side for Fibre in phylink_pcs_neg_mode()
146 * taken into account. We also do this for 2500base-X in phylink_pcs_neg_mode()
150 if (!phylink_autoneg_inband(mode)) in phylink_pcs_neg_mode()
168 * struct phylink_link_state - link state structure
172 * @interface: link &typedef phy_interface_t mode
174 * @duplex: link duplex mode, one of DUPLEX_* constants.
178 * the medium link mode (@speed and @duplex) and the speed/duplex of the phy
179 * interface mode (@interface) are different.
201 * struct phylink_config - PHYLINK configuration structure
205 * if MAC link is at %MLO_AN_FIXED mode.
209 * if MAC link is at %MLO_AN_FIXED mode.
229 * struct phylink_mac_ops - MAC operations structure.
231 * @mac_select_pcs: Select a PCS for the interface mode.
233 * @mac_config: configure the MAC for the selected mode and state.
246 int (*mac_prepare)(struct phylink_config *config, unsigned int mode,
248 void (*mac_config)(struct phylink_config *config, unsigned int mode,
250 int (*mac_finish)(struct phylink_config *config, unsigned int mode,
252 void (*mac_link_down)(struct phylink_config *config, unsigned int mode,
255 struct phy_device *phy, unsigned int mode,
260 #if 0 /* For kernel-doc purposes only. */
262 * validate - Validate and update the link configuration
267 * Clear bits in the @supported and @state->advertising masks that
272 * because the MAC is unable to BaseX mode. This is more about
276 * When @config->supported_interfaces has been set, phylink will iterate
278 * MAC. The validation function must not print errors if @state->interface
281 * When @config->supported_interfaces is empty, phylink will call this
282 * function with @state->interface set to %PHY_INTERFACE_MODE_NA, and
285 * If the @state->interface mode is not supported, then the @supported
289 * used making use of @config->mac_capabilities and
290 * @config->supported_interfaces to determine which link modes are
296 * mac_select_pcs: Select a PCS for the interface mode.
298 * @interface: PHY interface mode for PCS
300 * Return the &struct phylink_pcs for the specified interface mode, or
312 * mac_prepare() - prepare to change the PHY interface mode
314 * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
315 * @iface: interface mode to switch to
318 * of the link, which includes changing the interface mode or at initial
319 * startup time. It may be called for the current mode. The MAC driver
324 * - mac_prepare()
325 * - mac_config()
326 * - pcs_config()
327 * - possible pcs_an_restart()
328 * - mac_finish()
333 int mac_prepare(struct phylink_config *config, unsigned int mode,
337 * mac_config() - configure the MAC for the selected mode and state
339 * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
342 * Note - not all members of @state are valid. In particular,
343 * @state->lp_advertising, @state->link, @state->an_complete are never
348 * e.g. interface mode. It will not be called for changes in speed, duplex
349 * or pause modes or to change the in-band advertisement.
351 * In all negotiation modes, as defined by @mode, @state->pause indicates the
355 * the results of in-band negotiation/status from the MAC PCS should be used
356 * to control the MAC pause mode settings.
358 * The action performed depends on the currently selected mode:
361 * Configure for non-inband negotiation mode, where the link settings
363 * protocol from the MAC is specified by @state->interface.
365 * @state->advertising may be used, but is not required.
367 * Older drivers (prior to the mac_link_up() change) may use @state->speed,
368 * @state->duplex and @state->pause to configure the MAC, but this is
377 * place the link in an inband negotiation mode (such as 802.3z
378 * 1000base-X or Cisco SGMII mode depending on the @state->interface
379 * mode). In both cases, link state management (whether the link
384 * Interface mode specific details are mentioned below.
386 * If in 802.3z mode, the link speed is fixed, dependent on the
387 * @state->interface. Duplex and pause modes are negotiated via
388 * the in-band configuration word. Advertised pause modes are set
389 * according to the @state->an_enabled and @state->advertising
393 * If in Cisco SGMII mode, the link speed and duplex mode are passed
394 * in the serial bitstream 16-bit configuration word, and the MAC
403 * requested settings - i.o.w., if nothing has changed between two
409 void mac_config(struct phylink_config *config, unsigned int mode,
413 * mac_finish() - finish a to change the PHY interface mode
415 * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
416 * @iface: interface mode to switch to
420 * for the @mode and @iface. E.g. a MAC driver may wish to re-enable the
426 int mac_finish(struct phylink_config *config, unsigned int mode,
430 * mac_link_down() - take the link down
432 * @mode: link autonegotiation mode
433 * @interface: link &typedef phy_interface_t mode
435 * If @mode is not an in-band negotiation mode (as defined by
440 void mac_link_down(struct phylink_config *config, unsigned int mode,
444 * mac_link_up() - allow the link to come up
447 * @mode: link autonegotiation mode
448 * @interface: link &typedef phy_interface_t mode
459 * or if in-band negotiation (as defined by phylink_autoneg_inband(@mode))
462 * Note that when 802.3z in-band negotiation is in use, it is possible
466 * If in-band negotiation mode is disabled, allow the link to come up. If
467 * @phy is non-%NULL, configure Energy Efficient Ethernet by calling
472 unsigned int mode, phy_interface_t interface,
479 * struct phylink_pcs - PHYLINK PCS instance
482 * @neg_mode: provide PCS neg mode via "mode" argument
499 * struct phylink_pcs_ops - MAC PCS operations structure.
503 * @pcs_pre_config: pre-mac_config method (for errata)
504 * @pcs_post_config: post-mac_config method (for arrata)
506 * @pcs_config: configure the MAC PCS for the selected mode and state.
531 #if 0 /* For kernel-doc purposes only. */
533 * pcs_validate() - validate the link configuration.
538 * Validate the interface mode, and advertising's autoneg bit, removing any
543 * Returns -EINVAL if the interface mode/autoneg mode is not supported.
544 * Returns non-zero positive if the link state can be supported.
550 * pcs_enable() - enable the PCS.
556 * pcs_disable() - disable the PCS.
562 * pcs_get_state() - Read the current inband link state from the hardware
567 * current speed in @state->speed, duplex mode in @state->duplex, pause
568 * mode in @state->pause using the %MLO_PAUSE_RX and %MLO_PAUSE_TX bits,
569 * negotiation completion state in @state->an_complete, and link up state
570 * in @state->link. If possible, @state->lp_advertising should also be
580 * pcs_config() - Configure the PCS mode and advertisement
582 * @neg_mode: link negotiation mode (see below)
583 * @interface: interface mode to be used
584 * @advertising: adertisement ethtool link mode mask
587 * Configure the PCS for the operating mode, the interface mode, and set
589 * hardware may forward the pause mode resolution to the MAC.
597 * For 1000BASE-X, the advertisement should be programmed into the PCS.
599 * For most 10GBASE-R, there is no advertisement.
602 * functions, or for PCS that set pcs->neg_mode true, should be tested
610 * pcs_an_restart() - restart 802.3z BaseX autonegotiation
619 * pcs_link_up() - program the PCS for the resolved link configuration
621 * @neg_mode: link negotiation mode (see below)
622 * @interface: link &typedef phy_interface_t mode
628 * mode without in-band AN needs to be manually configured for the link
629 * and duplex setting. Otherwise, this should be a no-op.
631 * The %mode argument should be tested via the phylink_mode_*() family of
632 * functions, or for PCS that set pcs->neg_mode true, should be tested
695 #define __phylink_do_bit(op, bm, mode) \ argument
696 op(ETHTOOL_LINK_MODE_ ## mode ## _BIT, bm)
698 #define phylink_set(bm, mode) __phylink_do_bit(__set_bit, bm, mode) argument
699 #define phylink_clear(bm, mode) __phylink_do_bit(__clear_bit, bm, mode) argument
700 #define phylink_test(bm, mode) __phylink_do_bit(test_bit, bm, mode) argument
705 * phylink_get_link_timer_ns - return the PCS link timer value
706 * @interface: link &typedef phy_interface_t mode
709 * mode, or -EINVAL if not appropriate.
724 return -EINVAL; in phylink_get_link_timer_ns()