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