include/linux/phylink.h

Source file repositories/reference/linux-study-clean/include/linux/phylink.h

File Facts

System
Linux kernel
Corpus path
include/linux/phylink.h
Extension
.h
Size
33467 bytes
Lines
846
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

struct phylink_link_state {
	__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);
	__ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising);
	phy_interface_t interface;
	int speed;
	int duplex;
	int pause;
	int rate_matching;
	unsigned int link:1;
	unsigned int an_complete:1;
};

enum phylink_op_type {
	PHYLINK_NETDEV = 0,
	PHYLINK_DEV,
};

/**
 * struct phylink_config - PHYLINK configuration structure
 * @dev: a pointer to a struct device associated with the MAC
 * @type: operation type of PHYLINK instance
 * @poll_fixed_state: if true, starts link_poll,
 *		      if MAC link is at %MLO_AN_FIXED mode.
 * @mac_managed_pm: if true, indicate the MAC driver is responsible for PHY PM.
 * @mac_requires_rxc: if true, the MAC always requires a receive clock from PHY.
 *                    The PHY driver should start the clock signal as soon as
 *                    possible and avoid stopping it during suspend events.
 * @default_an_inband: if true, defaults to MLO_AN_INBAND rather than
 *		       MLO_AN_PHY. A fixed-link specification will override.
 * @eee_rx_clk_stop_enable: if true, PHY can stop the receive clock during LPI
 * @get_fixed_state: callback to execute to determine the fixed link state,
 *		     if MAC link is at %MLO_AN_FIXED mode.
 * @supported_interfaces: bitmap describing which PHY_INTERFACE_MODE_xxx
 *                        are supported by the MAC/PCS.
 * @lpi_interfaces: bitmap describing which PHY interface modes can support
 *		    LPI signalling.
 * @mac_capabilities: MAC pause/speed/duplex capabilities.
 * @lpi_capabilities: MAC speeds which can support LPI signalling
 * @lpi_timer_default: Default EEE LPI timer setting.
 * @eee_enabled_default: If set, EEE will be enabled by phylink at creation time
 * @wol_phy_legacy: Use Wake-on-Lan with PHY even if phy_can_wakeup() is false
 * @wol_phy_speed_ctrl: Use phy speed control on suspend/resume
 * @wol_mac_support: Bitmask of MAC supported %WAKE_* options
 */
struct phylink_config {
	struct device *dev;
	enum phylink_op_type type;
	bool poll_fixed_state;
	bool mac_managed_pm;
	bool mac_requires_rxc;
	bool default_an_inband;
	bool eee_rx_clk_stop_enable;
	void (*get_fixed_state)(struct phylink_config *config,
				struct phylink_link_state *state);
	DECLARE_PHY_INTERFACE_MASK(supported_interfaces);
	DECLARE_PHY_INTERFACE_MASK(lpi_interfaces);
	unsigned long mac_capabilities;
	unsigned long lpi_capabilities;
	u32 lpi_timer_default;
	bool eee_enabled_default;

	/* Wake-on-Lan support */
	bool wol_phy_legacy;
	bool wol_phy_speed_ctrl;
	u32 wol_mac_support;
};

void phylink_limit_mac_speed(struct phylink_config *config, u32 max_speed);

/**
 * struct phylink_mac_ops - MAC operations structure.
 * @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.
 * @mac_config: configure the MAC for the selected mode and state.
 * @mac_finish: finish a major reconfiguration of the interface.
 * @mac_link_down: take the link down.
 * @mac_link_up: allow the link to come up.
 * @mac_disable_tx_lpi: disable LPI.
 * @mac_enable_tx_lpi: enable and configure LPI.
 * @mac_wol_set: configure Wake-on-Lan settings at the MAC.
 *
 * The individual methods are described more fully below.
 */
struct phylink_mac_ops {
	unsigned long (*mac_get_caps)(struct phylink_config *config,
				      phy_interface_t interface);
	struct phylink_pcs *(*mac_select_pcs)(struct phylink_config *config,
					      phy_interface_t interface);
	int (*mac_prepare)(struct phylink_config *config, unsigned int mode,

Annotation

Implementation Notes