History

net: phylink: add pcs_validate() method

Add a hook for PCS to validate the link parameters. This avoids MAC drivers having to have knowledge of their PCS in their validate() method, thereby allowing several MAC drivers to be simplfied.

Russell King (Oracle) committed 4 years ago

Commit 0d22d4b1 parent d1e86322 files · +51 −0Browse files

Showing the changes to include (1 of 2 files). Show all

Unified · Split

include/linux/phylink.h+20−0
@@ -416,6 +416,7 @@ struct phylink_pcs { · 415 unmodified lines
416416
417417 /**
418418 * struct phylink_pcs_ops - MAC PCS operations structure.
419+ * @pcs_validate: validate the link configuration.
419420 * @pcs_get_state: read the current MAC PCS link state from the hardware.
420421 * @pcs_config: configure the MAC PCS for the selected mode and state.
421422 * @pcs_an_restart: restart 802.3z BaseX autonegotiation.
@@ -423,6 +424,8 @@ struct phylink_pcs { · 1 unmodified line
423424 * (where necessary).
424425 */
425426 struct phylink_pcs_ops {
427+ int (*pcs_validate)(struct phylink_pcs *pcs, unsigned long *supported,
428+ const struct phylink_link_state *state);
426429 void (*pcs_get_state)(struct phylink_pcs *pcs,
427430 struct phylink_link_state *state);
428431 int (*pcs_config)(struct phylink_pcs *pcs, unsigned int mode,
@@ -435,6 +438,23 @@ struct phylink_pcs_ops { · 6 unmodified lines
435438 };
436439
437440 #if 0 /* For kernel-doc purposes only. */
441+/**
442+ * pcs_validate() - validate the link configuration.
443+ * @pcs: a pointer to a &struct phylink_pcs.
444+ * @supported: ethtool bitmask for supported link modes.
445+ * @state: a const pointer to a &struct phylink_link_state.
446+ *
447+ * Validate the interface mode, and advertising's autoneg bit, removing any
448+ * media ethtool link modes that would not be supportable from the supported
449+ * mask. Phylink will propagate the changes to the advertising mask. See the
450+ * &struct phylink_mac_ops validate() method.
451+ *
452+ * Returns -EINVAL if the interface mode/autoneg mode is not supported.
453+ * Returns non-zero positive if the link state can be supported.
454+ */
455+int pcs_validate(struct phylink_pcs *pcs, unsigned long *supported,
456+ const struct phylink_link_state *state);
457+
438458 /**
439459 * pcs_get_state() - Read the current inband link state from the hardware
440460 * @pcs: a pointer to a &struct phylink_pcs.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t