mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 14:24:11 +08:00
net: phylink: add phylink_limit_mac_speed()
Add a function which can be used to limit the phylink MAC capabilities to an upper speed limit. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Link: https://lore.kernel.org/r/E1qZAX3-005pTi-K1@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
215eb9f962
commit
70934c7c99
@ -426,6 +426,24 @@ static struct {
|
||||
{ MAC_10HD, SPEED_10, DUPLEX_HALF },
|
||||
};
|
||||
|
||||
/**
|
||||
* phylink_limit_mac_speed - limit the phylink_config to a maximum speed
|
||||
* @config: pointer to a &struct phylink_config
|
||||
* @max_speed: maximum speed
|
||||
*
|
||||
* Mask off MAC capabilities for speeds higher than the @max_speed parameter.
|
||||
* Any further motifications of config.mac_capabilities will override this.
|
||||
*/
|
||||
void phylink_limit_mac_speed(struct phylink_config *config, u32 max_speed)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(phylink_caps_params) &&
|
||||
phylink_caps_params[i].speed > max_speed; i++)
|
||||
config->mac_capabilities &= ~phylink_caps_params[i].mask;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(phylink_limit_mac_speed);
|
||||
|
||||
/**
|
||||
* phylink_cap_from_speed_duplex - Get mac capability from speed/duplex
|
||||
* @speed: the speed to search for
|
||||
|
@ -223,6 +223,8 @@ struct phylink_config {
|
||||
unsigned long mac_capabilities;
|
||||
};
|
||||
|
||||
void phylink_limit_mac_speed(struct phylink_config *config, u32 max_speed);
|
||||
|
||||
/**
|
||||
* struct phylink_mac_ops - MAC operations structure.
|
||||
* @validate: Validate and update the link configuration.
|
||||
|
Loading…
Reference in New Issue
Block a user