Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1#ifndef NETDEV_PCS_H
2#define NETDEV_PCS_H
3
4#include <linux/phy.h>
5#include <linux/spinlock.h>
6#include <linux/workqueue.h>
7
8struct device_node;
9struct ethtool_cmd;
10struct fwnode_handle;
11struct net_device;
12
13enum {
14 MLO_PAUSE_NONE,
15 MLO_PAUSE_RX = BIT(0),
16 MLO_PAUSE_TX = BIT(1),
17 MLO_PAUSE_TXRX_MASK = MLO_PAUSE_TX | MLO_PAUSE_RX,
18 MLO_PAUSE_AN = BIT(2),
19
20 MLO_AN_PHY = 0, /* Conventional PHY */
21 MLO_AN_FIXED, /* Fixed-link mode */
22 MLO_AN_INBAND, /* In-band protocol */
23
24 MAC_SYM_PAUSE = BIT(0),
25 MAC_ASYM_PAUSE = BIT(1),
26 MAC_10HD = BIT(2),
27 MAC_10FD = BIT(3),
28 MAC_10 = MAC_10HD | MAC_10FD,
29 MAC_100HD = BIT(4),
30 MAC_100FD = BIT(5),
31 MAC_100 = MAC_100HD | MAC_100FD,
32 MAC_1000HD = BIT(6),
33 MAC_1000FD = BIT(7),
34 MAC_1000 = MAC_1000HD | MAC_1000FD,
35 MAC_2500FD = BIT(8),
36 MAC_5000FD = BIT(9),
37 MAC_10000FD = BIT(10),
38 MAC_20000FD = BIT(11),
39 MAC_25000FD = BIT(12),
40 MAC_40000FD = BIT(13),
41 MAC_50000FD = BIT(14),
42 MAC_56000FD = BIT(15),
43 MAC_100000FD = BIT(16),
44 MAC_200000FD = BIT(17),
45 MAC_400000FD = BIT(18),
46};
47
48static inline bool phylink_autoneg_inband(unsigned int mode)
49{
50 return mode == MLO_AN_INBAND;
51}
52
53/**
54 * struct phylink_link_state - link state structure
55 * @advertising: ethtool bitmask containing advertised link modes
56 * @lp_advertising: ethtool bitmask containing link partner advertised link
57 * modes
58 * @interface: link &typedef phy_interface_t mode
59 * @speed: link speed, one of the SPEED_* constants.
60 * @duplex: link duplex mode, one of DUPLEX_* constants.
61 * @pause: link pause state, described by MLO_PAUSE_* constants.
62 * @link: true if the link is up.
63 * @an_enabled: true if autonegotiation is enabled/desired.
64 * @an_complete: true if autonegotiation has completed.
65 */
66struct phylink_link_state {
67 __ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);
68 __ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising);
69 phy_interface_t interface;
70 int speed;
71 int duplex;
72 int pause;
73 unsigned int link:1;
74 unsigned int an_enabled:1;
75 unsigned int an_complete:1;
76};
77
78enum phylink_op_type {
79 PHYLINK_NETDEV = 0,
80 PHYLINK_DEV,
81};
82
83/**
84 * struct phylink_config - PHYLINK configuration structure
85 * @dev: a pointer to a struct device associated with the MAC
86 * @type: operation type of PHYLINK instance
87 * @legacy_pre_march2020: driver has not been updated for March 2020 updates
88 * (See commit 7cceb599d15d ("net: phylink: avoid mac_config calls")
89 * @poll_fixed_state: if true, starts link_poll,
90 * if MAC link is at %MLO_AN_FIXED mode.
91 * @ovr_an_inband: if true, override PCS to MLO_AN_INBAND
92 * @get_fixed_state: callback to execute to determine the fixed link state,
93 * if MAC link is at %MLO_AN_FIXED mode.
94 * @supported_interfaces: bitmap describing which PHY_INTERFACE_MODE_xxx
95 * are supported by the MAC/PCS.
96 * @mac_capabilities: MAC pause/speed/duplex capabilities.
97 */
98struct phylink_config {
99 struct device *dev;
100 enum phylink_op_type type;
101 bool legacy_pre_march2020;
102 bool poll_fixed_state;
103 bool ovr_an_inband;
104 void (*get_fixed_state)(struct phylink_config *config,
105 struct phylink_link_state *state);
106 DECLARE_PHY_INTERFACE_MASK(supported_interfaces);
107 unsigned long mac_capabilities;
108};
109
110/**
111 * struct phylink_mac_ops - MAC operations structure.
112 * @validate: Validate and update the link configuration.
113 * @mac_select_pcs: Select a PCS for the interface mode.
114 * @mac_pcs_get_state: Read the current link state from the hardware.
115 * @mac_prepare: prepare for a major reconfiguration of the interface.
116 * @mac_config: configure the MAC for the selected mode and state.
117 * @mac_finish: finish a major reconfiguration of the interface.
118 * @mac_an_restart: restart 802.3z BaseX autonegotiation.
119 * @mac_link_down: take the link down.
120 * @mac_link_up: allow the link to come up.
121 *
122 * The individual methods are described more fully below.
123 */
124struct phylink_mac_ops {
125 void (*validate)(struct phylink_config *config,
126 unsigned long *supported,
127 struct phylink_link_state *state);
128 struct phylink_pcs *(*mac_select_pcs)(struct phylink_config *config,
129 phy_interface_t interface);
130 void (*mac_pcs_get_state)(struct phylink_config *config,
131 struct phylink_link_state *state);
132 int (*mac_prepare)(struct phylink_config *config, unsigned int mode,
133 phy_interface_t iface);
134 void (*mac_config)(struct phylink_config *config, unsigned int mode,
135 const struct phylink_link_state *state);
136 int (*mac_finish)(struct phylink_config *config, unsigned int mode,
137 phy_interface_t iface);
138 void (*mac_an_restart)(struct phylink_config *config);
139 void (*mac_link_down)(struct phylink_config *config, unsigned int mode,
140 phy_interface_t interface);
141 void (*mac_link_up)(struct phylink_config *config,
142 struct phy_device *phy, unsigned int mode,
143 phy_interface_t interface, int speed, int duplex,
144 bool tx_pause, bool rx_pause);
145};
146
147#if 0 /* For kernel-doc purposes only. */
148/**
149 * validate - Validate and update the link configuration
150 * @config: a pointer to a &struct phylink_config.
151 * @supported: ethtool bitmask for supported link modes.
152 * @state: a pointer to a &struct phylink_link_state.
153 *
154 * Clear bits in the @supported and @state->advertising masks that
155 * are not supportable by the MAC.
156 *
157 * Note that the PHY may be able to transform from one connection
158 * technology to another, so, eg, don't clear 1000BaseX just
159 * because the MAC is unable to BaseX mode. This is more about
160 * clearing unsupported speeds and duplex settings. The port modes
161 * should not be cleared; phylink_set_port_modes() will help with this.
162 *
163 * If the @state->interface mode is %PHY_INTERFACE_MODE_1000BASEX
164 * or %PHY_INTERFACE_MODE_2500BASEX, select the appropriate mode
165 * based on @state->advertising and/or @state->speed and update
166 * @state->interface accordingly. See phylink_helper_basex_speed().
167 *
168 * When @config->supported_interfaces has been set, phylink will iterate
169 * over the supported interfaces to determine the full capability of the
170 * MAC. The validation function must not print errors if @state->interface
171 * is set to an unexpected value.
172 *
173 * When @config->supported_interfaces is empty, phylink will call this
174 * function with @state->interface set to %PHY_INTERFACE_MODE_NA, and
175 * expects the MAC driver to return all supported link modes.
176 *
177 * If the @state->interface mode is not supported, then the @supported
178 * mask must be cleared.
179 */
180void validate(struct phylink_config *config, unsigned long *supported,
181 struct phylink_link_state *state);
182/**
183 * mac_select_pcs: Select a PCS for the interface mode.
184 * @config: a pointer to a &struct phylink_config.
185 * @interface: PHY interface mode for PCS
186 *
187 * Return the &struct phylink_pcs for the specified interface mode, or
188 * NULL if none is required, or an error pointer on error.
189 *
190 * This must not modify any state. It is used to query which PCS should
191 * be used. Phylink will use this during validation to ensure that the
192 * configuration is valid, and when setting a configuration to internally
193 * set the PCS that will be used.
194 */
195struct phylink_pcs *mac_select_pcs(struct phylink_config *config,
196 phy_interface_t interface);
197
198/**
199 * mac_pcs_get_state() - Read the current inband link state from the hardware
200 * @config: a pointer to a &struct phylink_config.
201 * @state: a pointer to a &struct phylink_link_state.
202 *
203 * Read the current inband link state from the MAC PCS, reporting the
204 * current speed in @state->speed, duplex mode in @state->duplex, pause
205 * mode in @state->pause using the %MLO_PAUSE_RX and %MLO_PAUSE_TX bits,
206 * negotiation completion state in @state->an_complete, and link up state
207 * in @state->link. If possible, @state->lp_advertising should also be
208 * populated.
209 *
210 * Note: This is a legacy method. This function will not be called unless
211 * legacy_pre_march2020 is set in &struct phylink_config and there is no
212 * PCS attached.
213 */
214void mac_pcs_get_state(struct phylink_config *config,
215 struct phylink_link_state *state);
216
217/**
218 * mac_prepare() - prepare to change the PHY interface mode
219 * @config: a pointer to a &struct phylink_config.
220 * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
221 * @iface: interface mode to switch to
222 *
223 * phylink will call this method at the beginning of a full initialisation
224 * of the link, which includes changing the interface mode or at initial
225 * startup time. It may be called for the current mode. The MAC driver
226 * should perform whatever actions are required, e.g. disabling the
227 * Serdes PHY.
228 *
229 * This will be the first call in the sequence:
230 * - mac_prepare()
231 * - mac_config()
232 * - pcs_config()
233 * - possible pcs_an_restart()
234 * - mac_finish()
235 *
236 * Returns zero on success, or negative errno on failure which will be
237 * reported to the kernel log.
238 */
239int mac_prepare(struct phylink_config *config, unsigned int mode,
240 phy_interface_t iface);
241
242/**
243 * mac_config() - configure the MAC for the selected mode and state
244 * @config: a pointer to a &struct phylink_config.
245 * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
246 * @state: a pointer to a &struct phylink_link_state.
247 *
248 * Note - not all members of @state are valid. In particular,
249 * @state->lp_advertising, @state->link, @state->an_complete are never
250 * guaranteed to be correct, and so any mac_config() implementation must
251 * never reference these fields.
252 *
253 * Note: For legacy March 2020 drivers (drivers with legacy_pre_march2020 set
254 * in their &phylnk_config and which don't have a PCS), this function will be
255 * called on each link up event, and to also change the in-band advert. For
256 * non-legacy drivers, it will only be called to reconfigure the MAC for a
257 * "major" change in e.g. interface mode. It will not be called for changes
258 * in speed, duplex or pause modes or to change the in-band advertisement.
259 * In any case, it is strongly preferred that speed, duplex and pause settings
260 * are handled in the mac_link_up() method and not in this method.
261 *
262 * (this requires a rewrite - please refer to mac_link_up() for situations
263 * where the PCS and MAC are not tightly integrated.)
264 *
265 * In all negotiation modes, as defined by @mode, @state->pause indicates the
266 * pause settings which should be applied as follows. If %MLO_PAUSE_AN is not
267 * set, %MLO_PAUSE_TX and %MLO_PAUSE_RX indicate whether the MAC should send
268 * pause frames and/or act on received pause frames respectively. Otherwise,
269 * the results of in-band negotiation/status from the MAC PCS should be used
270 * to control the MAC pause mode settings.
271 *
272 * The action performed depends on the currently selected mode:
273 *
274 * %MLO_AN_FIXED, %MLO_AN_PHY:
275 * Configure for non-inband negotiation mode, where the link settings
276 * are completely communicated via mac_link_up(). The physical link
277 * protocol from the MAC is specified by @state->interface.
278 *
279 * @state->advertising may be used, but is not required.
280 *
281 * Older drivers (prior to the mac_link_up() change) may use @state->speed,
282 * @state->duplex and @state->pause to configure the MAC, but this is
283 * deprecated; such drivers should be converted to use mac_link_up().
284 *
285 * Other members of @state must be ignored.
286 *
287 * Valid state members: interface, advertising.
288 * Deprecated state members: speed, duplex, pause.
289 *
290 * %MLO_AN_INBAND:
291 * place the link in an inband negotiation mode (such as 802.3z
292 * 1000base-X or Cisco SGMII mode depending on the @state->interface
293 * mode). In both cases, link state management (whether the link
294 * is up or not) is performed by the MAC, and reported via the
295 * mac_pcs_get_state() callback. Changes in link state must be made
296 * by calling phylink_mac_change().
297 *
298 * Interface mode specific details are mentioned below.
299 *
300 * If in 802.3z mode, the link speed is fixed, dependent on the
301 * @state->interface. Duplex and pause modes are negotiated via
302 * the in-band configuration word. Advertised pause modes are set
303 * according to the @state->an_enabled and @state->advertising
304 * flags. Beware of MACs which only support full duplex at gigabit
305 * and higher speeds.
306 *
307 * If in Cisco SGMII mode, the link speed and duplex mode are passed
308 * in the serial bitstream 16-bit configuration word, and the MAC
309 * should be configured to read these bits and acknowledge the
310 * configuration word. Nothing is advertised by the MAC. The MAC is
311 * responsible for reading the configuration word and configuring
312 * itself accordingly.
313 *
314 * Valid state members: interface, an_enabled, pause, advertising.
315 *
316 * Implementations are expected to update the MAC to reflect the
317 * requested settings - i.o.w., if nothing has changed between two
318 * calls, no action is expected. If only flow control settings have
319 * changed, flow control should be updated *without* taking the link
320 * down. This "update" behaviour is critical to avoid bouncing the
321 * link up status.
322 */
323void mac_config(struct phylink_config *config, unsigned int mode,
324 const struct phylink_link_state *state);
325
326/**
327 * mac_finish() - finish a to change the PHY interface mode
328 * @config: a pointer to a &struct phylink_config.
329 * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
330 * @iface: interface mode to switch to
331 *
332 * phylink will call this if it called mac_prepare() to allow the MAC to
333 * complete any necessary steps after the MAC and PCS have been configured
334 * for the @mode and @iface. E.g. a MAC driver may wish to re-enable the
335 * Serdes PHY here if it was previously disabled by mac_prepare().
336 *
337 * Returns zero on success, or negative errno on failure which will be
338 * reported to the kernel log.
339 */
340int mac_finish(struct phylink_config *config, unsigned int mode,
341 phy_interface_t iface);
342
343/**
344 * mac_an_restart() - restart 802.3z BaseX autonegotiation
345 * @config: a pointer to a &struct phylink_config.
346 *
347 * Note: This is a legacy method. This function will not be called unless
348 * legacy_pre_march2020 is set in &struct phylink_config and there is no
349 * PCS attached.
350 */
351void mac_an_restart(struct phylink_config *config);
352
353/**
354 * mac_link_down() - take the link down
355 * @config: a pointer to a &struct phylink_config.
356 * @mode: link autonegotiation mode
357 * @interface: link &typedef phy_interface_t mode
358 *
359 * If @mode is not an in-band negotiation mode (as defined by
360 * phylink_autoneg_inband()), force the link down and disable any
361 * Energy Efficient Ethernet MAC configuration. Interface type
362 * selection must be done in mac_config().
363 */
364void mac_link_down(struct phylink_config *config, unsigned int mode,
365 phy_interface_t interface);
366
367/**
368 * mac_link_up() - allow the link to come up
369 * @config: a pointer to a &struct phylink_config.
370 * @phy: any attached phy
371 * @mode: link autonegotiation mode
372 * @interface: link &typedef phy_interface_t mode
373 * @speed: link speed
374 * @duplex: link duplex
375 * @tx_pause: link transmit pause enablement status
376 * @rx_pause: link receive pause enablement status
377 *
378 * Configure the MAC for an established link.
379 *
380 * @speed, @duplex, @tx_pause and @rx_pause indicate the finalised link
381 * settings, and should be used to configure the MAC block appropriately
382 * where these settings are not automatically conveyed from the PCS block,
383 * or if in-band negotiation (as defined by phylink_autoneg_inband(@mode))
384 * is disabled.
385 *
386 * Note that when 802.3z in-band negotiation is in use, it is possible
387 * that the user wishes to override the pause settings, and this should
388 * be allowed when considering the implementation of this method.
389 *
390 * If in-band negotiation mode is disabled, allow the link to come up. If
391 * @phy is non-%NULL, configure Energy Efficient Ethernet by calling
392 * phy_init_eee() and perform appropriate MAC configuration for EEE.
393 * Interface type selection must be done in mac_config().
394 */
395void mac_link_up(struct phylink_config *config, struct phy_device *phy,
396 unsigned int mode, phy_interface_t interface,
397 int speed, int duplex, bool tx_pause, bool rx_pause);
398#endif
399
400struct phylink_pcs_ops;
401
402/**
403 * struct phylink_pcs - PHYLINK PCS instance
404 * @ops: a pointer to the &struct phylink_pcs_ops structure
405 * @poll: poll the PCS for link changes
406 *
407 * This structure is designed to be embedded within the PCS private data,
408 * and will be passed between phylink and the PCS.
409 */
410struct phylink_pcs {
411 const struct phylink_pcs_ops *ops;
412 bool poll;
413};
414
415/**
416 * struct phylink_pcs_ops - MAC PCS operations structure.
417 * @pcs_validate: validate the link configuration.
418 * @pcs_get_state: read the current MAC PCS link state from the hardware.
419 * @pcs_config: configure the MAC PCS for the selected mode and state.
420 * @pcs_an_restart: restart 802.3z BaseX autonegotiation.
421 * @pcs_link_up: program the PCS for the resolved link configuration
422 * (where necessary).
423 */
424struct phylink_pcs_ops {
425 int (*pcs_validate)(struct phylink_pcs *pcs, unsigned long *supported,
426 const struct phylink_link_state *state);
427 void (*pcs_get_state)(struct phylink_pcs *pcs,
428 struct phylink_link_state *state);
429 int (*pcs_config)(struct phylink_pcs *pcs, unsigned int mode,
430 phy_interface_t interface,
431 const unsigned long *advertising,
432 bool permit_pause_to_mac);
433 void (*pcs_an_restart)(struct phylink_pcs *pcs);
434 void (*pcs_link_up)(struct phylink_pcs *pcs, unsigned int mode,
435 phy_interface_t interface, int speed, int duplex);
436};
437
438#if 0 /* For kernel-doc purposes only. */
439/**
440 * pcs_validate() - validate the link configuration.
441 * @pcs: a pointer to a &struct phylink_pcs.
442 * @supported: ethtool bitmask for supported link modes.
443 * @state: a const pointer to a &struct phylink_link_state.
444 *
445 * Validate the interface mode, and advertising's autoneg bit, removing any
446 * media ethtool link modes that would not be supportable from the supported
447 * mask. Phylink will propagate the changes to the advertising mask. See the
448 * &struct phylink_mac_ops validate() method.
449 *
450 * Returns -EINVAL if the interface mode/autoneg mode is not supported.
451 * Returns non-zero positive if the link state can be supported.
452 */
453int pcs_validate(struct phylink_pcs *pcs, unsigned long *supported,
454 const struct phylink_link_state *state);
455
456/**
457 * pcs_get_state() - Read the current inband link state from the hardware
458 * @pcs: a pointer to a &struct phylink_pcs.
459 * @state: a pointer to a &struct phylink_link_state.
460 *
461 * Read the current inband link state from the MAC PCS, reporting the
462 * current speed in @state->speed, duplex mode in @state->duplex, pause
463 * mode in @state->pause using the %MLO_PAUSE_RX and %MLO_PAUSE_TX bits,
464 * negotiation completion state in @state->an_complete, and link up state
465 * in @state->link. If possible, @state->lp_advertising should also be
466 * populated.
467 *
468 * When present, this overrides mac_pcs_get_state() in &struct
469 * phylink_mac_ops.
470 */
471void pcs_get_state(struct phylink_pcs *pcs,
472 struct phylink_link_state *state);
473
474/**
475 * pcs_config() - Configure the PCS mode and advertisement
476 * @pcs: a pointer to a &struct phylink_pcs.
477 * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
478 * @interface: interface mode to be used
479 * @advertising: adertisement ethtool link mode mask
480 * @permit_pause_to_mac: permit forwarding pause resolution to MAC
481 *
482 * Configure the PCS for the operating mode, the interface mode, and set
483 * the advertisement mask. @permit_pause_to_mac indicates whether the
484 * hardware may forward the pause mode resolution to the MAC.
485 *
486 * When operating in %MLO_AN_INBAND, inband should always be enabled,
487 * otherwise inband should be disabled.
488 *
489 * For SGMII, there is no advertisement from the MAC side, the PCS should
490 * be programmed to acknowledge the inband word from the PHY.
491 *
492 * For 1000BASE-X, the advertisement should be programmed into the PCS.
493 *
494 * For most 10GBASE-R, there is no advertisement.
495 */
496int pcs_config(struct phylink_pcs *pcs, unsigned int mode,
497 phy_interface_t interface, const unsigned long *advertising,
498 bool permit_pause_to_mac);
499
500/**
501 * pcs_an_restart() - restart 802.3z BaseX autonegotiation
502 * @pcs: a pointer to a &struct phylink_pcs.
503 *
504 * When PCS ops are present, this overrides mac_an_restart() in &struct
505 * phylink_mac_ops.
506 */
507void pcs_an_restart(struct phylink_pcs *pcs);
508
509/**
510 * pcs_link_up() - program the PCS for the resolved link configuration
511 * @pcs: a pointer to a &struct phylink_pcs.
512 * @mode: link autonegotiation mode
513 * @interface: link &typedef phy_interface_t mode
514 * @speed: link speed
515 * @duplex: link duplex
516 *
517 * This call will be made just before mac_link_up() to inform the PCS of
518 * the resolved link parameters. For example, a PCS operating in SGMII
519 * mode without in-band AN needs to be manually configured for the link
520 * and duplex setting. Otherwise, this should be a no-op.
521 */
522void pcs_link_up(struct phylink_pcs *pcs, unsigned int mode,
523 phy_interface_t interface, int speed, int duplex);
524#endif
525
526void phylink_get_linkmodes(unsigned long *linkmodes, phy_interface_t interface,
527 unsigned long mac_capabilities);
528void phylink_generic_validate(struct phylink_config *config,
529 unsigned long *supported,
530 struct phylink_link_state *state);
531
532struct phylink *phylink_create(struct phylink_config *, struct fwnode_handle *,
533 phy_interface_t iface,
534 const struct phylink_mac_ops *mac_ops);
535void phylink_destroy(struct phylink *);
536
537int phylink_connect_phy(struct phylink *, struct phy_device *);
538int phylink_of_phy_connect(struct phylink *, struct device_node *, u32 flags);
539int phylink_fwnode_phy_connect(struct phylink *pl,
540 struct fwnode_handle *fwnode,
541 u32 flags);
542void phylink_disconnect_phy(struct phylink *);
543
544void phylink_mac_change(struct phylink *, bool up);
545
546void phylink_start(struct phylink *);
547void phylink_stop(struct phylink *);
548
549void phylink_suspend(struct phylink *pl, bool mac_wol);
550void phylink_resume(struct phylink *pl);
551
552void phylink_ethtool_get_wol(struct phylink *, struct ethtool_wolinfo *);
553int phylink_ethtool_set_wol(struct phylink *, struct ethtool_wolinfo *);
554
555int phylink_ethtool_ksettings_get(struct phylink *,
556 struct ethtool_link_ksettings *);
557int phylink_ethtool_ksettings_set(struct phylink *,
558 const struct ethtool_link_ksettings *);
559int phylink_ethtool_nway_reset(struct phylink *);
560void phylink_ethtool_get_pauseparam(struct phylink *,
561 struct ethtool_pauseparam *);
562int phylink_ethtool_set_pauseparam(struct phylink *,
563 struct ethtool_pauseparam *);
564int phylink_get_eee_err(struct phylink *);
565int phylink_init_eee(struct phylink *, bool);
566int phylink_ethtool_get_eee(struct phylink *, struct ethtool_eee *);
567int phylink_ethtool_set_eee(struct phylink *, struct ethtool_eee *);
568int phylink_mii_ioctl(struct phylink *, struct ifreq *, int);
569int phylink_speed_down(struct phylink *pl, bool sync);
570int phylink_speed_up(struct phylink *pl);
571
572#define phylink_zero(bm) \
573 bitmap_zero(bm, __ETHTOOL_LINK_MODE_MASK_NBITS)
574#define __phylink_do_bit(op, bm, mode) \
575 op(ETHTOOL_LINK_MODE_ ## mode ## _BIT, bm)
576
577#define phylink_set(bm, mode) __phylink_do_bit(__set_bit, bm, mode)
578#define phylink_clear(bm, mode) __phylink_do_bit(__clear_bit, bm, mode)
579#define phylink_test(bm, mode) __phylink_do_bit(test_bit, bm, mode)
580
581void phylink_set_port_modes(unsigned long *bits);
582void phylink_helper_basex_speed(struct phylink_link_state *state);
583
584void phylink_mii_c22_pcs_decode_state(struct phylink_link_state *state,
585 u16 bmsr, u16 lpa);
586void phylink_mii_c22_pcs_get_state(struct mdio_device *pcs,
587 struct phylink_link_state *state);
588int phylink_mii_c22_pcs_encode_advertisement(phy_interface_t interface,
589 const unsigned long *advertising);
590int phylink_mii_c22_pcs_config(struct mdio_device *pcs, unsigned int mode,
591 phy_interface_t interface,
592 const unsigned long *advertising);
593void phylink_mii_c22_pcs_an_restart(struct mdio_device *pcs);
594
595void phylink_mii_c45_pcs_get_state(struct mdio_device *pcs,
596 struct phylink_link_state *state);
597
598void phylink_decode_usxgmii_word(struct phylink_link_state *state,
599 uint16_t lpa);
600#endif