| 1 |
|
| 2 | |
| 3 | * link caps internal header, for link modes <-> capabilities <-> interfaces
|
| 4 | * conversions.
|
| 5 |
|
| 6 |
|
| 7 | #ifndef __PHY_CAPS_H
|
| 8 | #define __PHY_CAPS_H
|
| 9 |
|
| 10 | #include <linux/ethtool.h>
|
| 11 | #include <linux/phy.h>
|
| 12 |
|
| 13 | enum {
|
| 14 | LINK_CAPA_10HD = 0,
|
| 15 | LINK_CAPA_10FD,
|
| 16 | LINK_CAPA_100HD,
|
| 17 | LINK_CAPA_100FD,
|
| 18 | LINK_CAPA_1000HD,
|
| 19 | LINK_CAPA_1000FD,
|
| 20 | LINK_CAPA_2500FD,
|
| 21 | LINK_CAPA_5000FD,
|
| 22 | LINK_CAPA_10000FD,
|
| 23 | LINK_CAPA_20000FD,
|
| 24 | LINK_CAPA_25000FD,
|
| 25 | LINK_CAPA_40000FD,
|
| 26 | LINK_CAPA_50000FD,
|
| 27 | LINK_CAPA_56000FD,
|
| 28 | LINK_CAPA_80000FD,
|
| 29 | LINK_CAPA_100000FD,
|
| 30 | LINK_CAPA_200000FD,
|
| 31 | LINK_CAPA_400000FD,
|
| 32 | LINK_CAPA_800000FD,
|
| 33 | LINK_CAPA_1600000FD,
|
| 34 |
|
| 35 | __LINK_CAPA_MAX,
|
| 36 | };
|
| 37 |
|
| 38 | #define LINK_CAPA_ALL GENMASK((__LINK_CAPA_MAX - 1), 0)
|
| 39 |
|
| 40 | struct link_capabilities {
|
| 41 | int speed;
|
| 42 | unsigned int duplex;
|
| 43 | __ETHTOOL_DECLARE_LINK_MODE_MASK(linkmodes);
|
| 44 | };
|
| 45 |
|
| 46 | int __init phy_caps_init(void);
|
| 47 |
|
| 48 | size_t phy_caps_speeds(unsigned int *speeds, size_t size,
|
| 49 | unsigned long *linkmodes);
|
| 50 | void phy_caps_linkmode_max_speed(u32 max_speed, unsigned long *linkmodes);
|
| 51 | bool phy_caps_valid(int speed, int duplex, const unsigned long *linkmodes);
|
| 52 | void phy_caps_linkmodes(unsigned long caps, unsigned long *linkmodes);
|
| 53 | unsigned long phy_caps_from_interface(phy_interface_t interface);
|
| 54 |
|
| 55 | const struct link_capabilities *
|
| 56 | phy_caps_lookup_by_linkmode(const unsigned long *linkmodes);
|
| 57 |
|
| 58 | const struct link_capabilities *
|
| 59 | phy_caps_lookup_by_linkmode_rev(const unsigned long *linkmodes, bool fdx_only);
|
| 60 |
|
| 61 | const struct link_capabilities *
|
| 62 | phy_caps_lookup(int speed, unsigned int duplex, const unsigned long *supported,
|
| 63 | bool exact);
|
| 64 |
|
| 65 | void phy_caps_medium_get_supported(unsigned long *supported,
|
| 66 | enum ethtool_link_medium medium,
|
| 67 | int lanes);
|
| 68 | u32 phy_caps_mediums_from_linkmodes(unsigned long *linkmodes);
|
| 69 |
|
| 70 | #endif
|