capabilities for ``interface`` to determine the allowable ethtool link
modes.
- The :c:func:`validate` method should mask the supplied supported mask,
- and ``state->advertising`` with the supported ethtool link modes.
- These are the new ethtool link modes, so bitmask operations must be
- used. For an example, see ``drivers/net/ethernet/marvell/mvneta.c``.
-
The :c:func:`mac_link_state` method is used to read the link state
from the MAC, and report back the settings that the MAC is currently
using. This is particularly important for in-band negotiation
}
/* Then validate the link parameters with the MAC */
- if (pl->mac_ops->validate) {
- pl->mac_ops->validate(pl->config, supported, state);
- } else {
- if (pl->mac_ops->mac_get_caps)
- capabilities = pl->mac_ops->mac_get_caps(pl->config,
- state->interface);
- else
- capabilities = pl->config->mac_capabilities;
+ if (pl->mac_ops->mac_get_caps)
+ capabilities = pl->mac_ops->mac_get_caps(pl->config,
+ state->interface);
+ else
+ capabilities = pl->config->mac_capabilities;
- phylink_validate_mask_caps(supported, state, capabilities);
- }
+ phylink_validate_mask_caps(supported, state, capabilities);
return phylink_is_empty_linkmode(supported) ? -EINVAL : 0;
}
/**
* struct phylink_mac_ops - MAC operations structure.
- * @validate: Validate and update the link configuration.
* @mac_get_caps: Get MAC capabilities for interface mode.
* @mac_select_pcs: Select a PCS for the interface mode.
* @mac_prepare: prepare for a major reconfiguration of the interface.
* The individual methods are described more fully below.
*/
struct phylink_mac_ops {
- void (*validate)(struct phylink_config *config,
- unsigned long *supported,
- struct phylink_link_state *state);
unsigned long (*mac_get_caps)(struct phylink_config *config,
phy_interface_t interface);
struct phylink_pcs *(*mac_select_pcs)(struct phylink_config *config,
};
#if 0 /* For kernel-doc purposes only. */
-/**
- * validate - Validate and update the link configuration
- * @config: a pointer to a &struct phylink_config.
- * @supported: ethtool bitmask for supported link modes.
- * @state: a pointer to a &struct phylink_link_state.
- *
- * Clear bits in the @supported and @state->advertising masks that
- * are not supportable by the MAC.
- *
- * Note that the PHY may be able to transform from one connection
- * technology to another, so, eg, don't clear 1000BaseX just
- * because the MAC is unable to BaseX mode. This is more about
- * clearing unsupported speeds and duplex settings. The port modes
- * should not be cleared; phylink_set_port_modes() will help with this.
- *
- * When @config->supported_interfaces has been set, phylink will iterate
- * over the supported interfaces to determine the full capability of the
- * MAC. The validation function must not print errors if @state->interface
- * is set to an unexpected value.
- *
- * When @config->supported_interfaces is empty, phylink will call this
- * function with @state->interface set to %PHY_INTERFACE_MODE_NA, and
- * expects the MAC driver to return all supported link modes.
- *
- * If the @state->interface mode is not supported, then the @supported
- * mask must be cleared.
- *
- * This member is optional; if not set, the generic validator will be
- * used making use of @config->mac_capabilities and
- * @config->supported_interfaces to determine which link modes are
- * supported.
- */
-void validate(struct phylink_config *config, unsigned long *supported,
- struct phylink_link_state *state);
/**
* mac_get_caps: Get MAC capabilities for interface mode.
* @config: a pointer to a &struct phylink_config.