Lines Matching +full:cap +full:- +full:get
1 // SPDX-License-Identifier: GPL-2.0-or-later
7 #include "phy-caps.h"
34 return -EINVAL; in speed_duplex_to_capa()
57 return -EINVAL; in speed_duplex_to_capa()
60 #define for_each_link_caps_asc_speed(cap) \ argument
61 for (cap = link_caps; cap < &link_caps[__LINK_CAPA_MAX]; cap++)
63 #define for_each_link_caps_desc_speed(cap) \ argument
64 for (cap = &link_caps[__LINK_CAPA_MAX - 1]; cap >= link_caps; cap--)
67 * phy_caps_init() - Initializes the link_caps array from the link_mode_params.
69 * Returns: 0 if phy caps init was successful, -EINVAL if we found an
81 capa = speed_duplex_to_capa(linkmode->speed, linkmode->duplex); in phy_caps_init()
84 if (linkmode->speed != SPEED_UNKNOWN) { in phy_caps_init()
86 linkmode->speed); in phy_caps_init()
87 return -EINVAL; in phy_caps_init()
99 * phy_caps_speeds() - Fill an array of supported SPEED_* values for given modes
102 * @linkmodes: Linkmodes to get the speeds from
117 if (linkmode_intersects(lcap->linkmodes, linkmodes) && in phy_caps_speeds()
118 (count == 0 || speeds[count - 1] != lcap->speed)) { in phy_caps_speeds()
119 speeds[count++] = lcap->speed; in phy_caps_speeds()
129 * phy_caps_lookup_by_linkmode() - Lookup the fastest matching link_capabilities
132 * Returns: The highest-speed link_capabilities that intersects the given
142 if (linkmode_intersects(lcap->linkmodes, linkmodes)) in phy_caps_lookup_by_linkmode()
149 * phy_caps_lookup_by_linkmode_rev() - Lookup the slowest matching link_capabilities
153 * Returns: The lowest-speed link_capabilities that intersects the given
154 * linkmodes. When set, fdx_only will ignore half-duplex matches.
163 if (fdx_only && lcap->duplex != DUPLEX_FULL) in phy_caps_lookup_by_linkmode_rev()
166 if (linkmode_intersects(lcap->linkmodes, linkmodes)) in phy_caps_lookup_by_linkmode_rev()
174 * phy_caps_lookup() - Lookup capabilities by speed/duplex that matches a mask
201 if (linkmode_intersects(lcap->linkmodes, supported)) { in phy_caps_lookup()
204 if (lcap->speed == speed && lcap->duplex == duplex) { in phy_caps_lookup()
207 if (lcap->speed <= speed) in phy_caps_lookup()
221 * phy_caps_linkmode_max_speed() - Clamp a linkmodes set to a max speed
230 if (lcap->speed > max_speed) in phy_caps_linkmode_max_speed()
231 linkmode_andnot(linkmodes, linkmodes, lcap->linkmodes); in phy_caps_linkmode_max_speed()
237 * phy_caps_valid() - Validate a linkmodes set agains given speed and duplex
256 * phy_caps_linkmodes() - Convert a bitfield of capabilities into linkmodes
270 * phy_caps_from_interface() - Get the link capa from a given PHY interface
271 * @interface: The PHY interface we want to get the possible Speed/Duplex from