Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v6.16-rc4 63 lines 1.6 kB view raw
1/* SPDX-License-Identifier: GPL-2.0-or-later */ 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 13enum { 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_100000FD, 29 LINK_CAPA_200000FD, 30 LINK_CAPA_400000FD, 31 LINK_CAPA_800000FD, 32 33 __LINK_CAPA_MAX, 34}; 35 36#define LINK_CAPA_ALL GENMASK((__LINK_CAPA_MAX - 1), 0) 37 38struct link_capabilities { 39 int speed; 40 unsigned int duplex; 41 __ETHTOOL_DECLARE_LINK_MODE_MASK(linkmodes); 42}; 43 44int phy_caps_init(void); 45 46size_t phy_caps_speeds(unsigned int *speeds, size_t size, 47 unsigned long *linkmodes); 48void phy_caps_linkmode_max_speed(u32 max_speed, unsigned long *linkmodes); 49bool phy_caps_valid(int speed, int duplex, const unsigned long *linkmodes); 50void phy_caps_linkmodes(unsigned long caps, unsigned long *linkmodes); 51unsigned long phy_caps_from_interface(phy_interface_t interface); 52 53const struct link_capabilities * 54phy_caps_lookup_by_linkmode(const unsigned long *linkmodes); 55 56const struct link_capabilities * 57phy_caps_lookup_by_linkmode_rev(const unsigned long *linkmodes, bool fdx_only); 58 59const struct link_capabilities * 60phy_caps_lookup(int speed, unsigned int duplex, const unsigned long *supported, 61 bool exact); 62 63#endif /* __PHY_CAPS_H */