Download raw body.
more ifmedia types for ice(4)
On Tue, Dec 10, 2024 at 06:10:01PM +0100, Stefan Sperling wrote:
> This patch adds more ifmedia sub-types from FreeBSD, required to
> map ice(4) device media types reported by firmware to ifmedia types.
"required" is a bit strong. you can use IFM_ETHER without a subtype
as a default or catch all value for media types we don't currently
handle. eg, figuring out the media type on myx(4) was too hard, so
it just reports IFM_ETHER. i think that was true for a long time on
em(4) too.
> I don't believe the exact mapping is important, as this is mostly
> about presenting a useful name of detected media in ifconfig.
> And I am uneasy about adding almost 50 new ethernet media sub-types
> (we have space for 255).
agreed.
i dont really care about the different versions of AOC or backplane
connectivity, so i'd be happy with some generic media types for the
speed of connection. for commonly used external connectivity (eg, 10G SR
and LR), that makes sense too.
for really fine grained info, the ifconfig sff is probably the best
solution.
>
> But I lack the high-speed Ethernet expertise to judge whether mapping
> any of these firmware types to some of the already existing ifmedia
> definition makes sense.
> I've left out a few types that seemed liked redundant definitions to
> me, hoping this is correct.
>
> Perhaps all this cruft is needed to sync our ifmedia with reality?
> If the list of types I'm adding here could be trimmed down, please
> let me know.
>
> M sys/dev/pci/if_ice.c | 6+ 32-
> M sys/net/if_media.h | 77+ 0-
>
> 2 files changed, 83 insertions(+), 32 deletions(-)
>
> commit - 78626f41ac1d0c748d9b006ffbdf32e6c41aaa88
> commit + f6b6613489d4f374ff1f2935fb8bbd2e839ab5ab
> blob - 540c33a3c4000c4149e07db724145f8ba1fda67e
> blob + 976204c0ec899a64ec0bcbccfd35b9e5a790c83a
> --- sys/dev/pci/if_ice.c
> +++ sys/dev/pci/if_ice.c
> @@ -13694,10 +13694,8 @@ ice_get_phy_type_low(struct ice_softc *sc, uint64_t ph
> switch (phy_type_low) {
> case ICE_PHY_TYPE_LOW_100BASE_TX:
> return IFM_100_TX;
> -#if 0
> case ICE_PHY_TYPE_LOW_100M_SGMII:
> return IFM_100_SGMII;
> -#endif
> case ICE_PHY_TYPE_LOW_1000BASE_T:
> return IFM_1000_T;
> case ICE_PHY_TYPE_LOW_1000BASE_SX:
> @@ -13706,24 +13704,18 @@ ice_get_phy_type_low(struct ice_softc *sc, uint64_t ph
> return IFM_1000_LX;
> case ICE_PHY_TYPE_LOW_1000BASE_KX:
> return IFM_1000_KX;
> -#if 0
> case ICE_PHY_TYPE_LOW_1G_SGMII:
> return IFM_1000_SGMII;
> -#endif
> case ICE_PHY_TYPE_LOW_2500BASE_T:
> return IFM_2500_T;
> -#if 0
> case ICE_PHY_TYPE_LOW_2500BASE_X:
> return IFM_2500_X;
> -#endif
> case ICE_PHY_TYPE_LOW_2500BASE_KX:
> return IFM_2500_KX;
> case ICE_PHY_TYPE_LOW_5GBASE_T:
> return IFM_5000_T;
> -#if 0
> case ICE_PHY_TYPE_LOW_5GBASE_KR:
> - return IFM_5000_KR;
> -#endif
> + return IFM_50G_KR2;
> case ICE_PHY_TYPE_LOW_10GBASE_T:
> return IFM_10G_T;
> case ICE_PHY_TYPE_LOW_10G_SFI_DA:
> @@ -13738,36 +13730,28 @@ ice_get_phy_type_low(struct ice_softc *sc, uint64_t ph
> return IFM_10G_AOC;
> case ICE_PHY_TYPE_LOW_10G_SFI_C2C:
> return IFM_10G_SFI;
> -#if 0
> case ICE_PHY_TYPE_LOW_25GBASE_T:
> return IFM_25G_T;
> -#endif
> case ICE_PHY_TYPE_LOW_25GBASE_CR:
> return IFM_25G_CR;
> -#if 0
> case ICE_PHY_TYPE_LOW_25GBASE_CR_S:
> - return IFM_25G_CR_S;
> + return IFM_25G_CR;
> case ICE_PHY_TYPE_LOW_25GBASE_CR1:
> - return IFM_25G_CR1;
> -#endif
> + return IFM_25G_CR;
> case ICE_PHY_TYPE_LOW_25GBASE_SR:
> return IFM_25G_SR;
> case ICE_PHY_TYPE_LOW_25GBASE_LR:
> return IFM_25G_LR;
> case ICE_PHY_TYPE_LOW_25GBASE_KR:
> return IFM_25G_KR;
> -#if 0
> case ICE_PHY_TYPE_LOW_25GBASE_KR_S:
> - return IFM_25G_KR_S;
> + return IFM_25G_KR;
> case ICE_PHY_TYPE_LOW_25GBASE_KR1:
> - return IFM_25G_KR1;
> -#endif
> + return IFM_25G_KR;
> case ICE_PHY_TYPE_LOW_25G_AUI_AOC_ACC:
> return IFM_25G_AOC;
> -#if 0
> case ICE_PHY_TYPE_LOW_25G_AUI_C2C:
> return IFM_25G_AUI;
> -#endif
> case ICE_PHY_TYPE_LOW_40GBASE_CR4:
> return IFM_40G_CR4;
> case ICE_PHY_TYPE_LOW_40GBASE_SR4:
> @@ -13776,23 +13760,18 @@ ice_get_phy_type_low(struct ice_softc *sc, uint64_t ph
> return IFM_40G_LR4;
> case ICE_PHY_TYPE_LOW_40GBASE_KR4:
> return IFM_40G_KR4;
> -#if 0
> case ICE_PHY_TYPE_LOW_40G_XLAUI_AOC_ACC:
> return IFM_40G_XLAUI_AC;
> case ICE_PHY_TYPE_LOW_40G_XLAUI:
> return IFM_40G_XLAUI;
> -#endif
> case ICE_PHY_TYPE_LOW_50GBASE_CR2:
> return IFM_50G_CR2;
> -#if 0
> case ICE_PHY_TYPE_LOW_50GBASE_SR2:
> return IFM_50G_SR2;
> case ICE_PHY_TYPE_LOW_50GBASE_LR2:
> return IFM_50G_LR2;
> -#endif
> case ICE_PHY_TYPE_LOW_50GBASE_KR2:
> return IFM_50G_KR2;
> -#if 0
> case ICE_PHY_TYPE_LOW_50G_LAUI2_AOC_ACC:
> return IFM_50G_LAUI2_AC;
> case ICE_PHY_TYPE_LOW_50G_LAUI2:
> @@ -13815,7 +13794,6 @@ ice_get_phy_type_low(struct ice_softc *sc, uint64_t ph
> return IFM_50G_AUI1_AC;
> case ICE_PHY_TYPE_LOW_50G_AUI1:
> return IFM_50G_AUI1;
> -#endif
> case ICE_PHY_TYPE_LOW_100GBASE_CR4:
> return IFM_100G_CR4;
> case ICE_PHY_TYPE_LOW_100GBASE_SR4:
> @@ -13824,7 +13802,6 @@ ice_get_phy_type_low(struct ice_softc *sc, uint64_t ph
> return IFM_100G_LR4;
> case ICE_PHY_TYPE_LOW_100GBASE_KR4:
> return IFM_100G_KR4;
> -#if 0
> case ICE_PHY_TYPE_LOW_100G_CAUI4_AOC_ACC:
> return IFM_100G_CAUI4_AC;
> case ICE_PHY_TYPE_LOW_100G_CAUI4:
> @@ -13843,7 +13820,6 @@ ice_get_phy_type_low(struct ice_softc *sc, uint64_t ph
> return IFM_100G_SR2;
> case ICE_PHY_TYPE_LOW_100GBASE_DR:
> return IFM_100G_DR;
> -#endif
> default:
> printf("%s: unhandled low PHY type 0x%llx\n",
> sc->sc_dev.dv_xname, phy_type_low);
> @@ -13864,9 +13840,8 @@ uint64_t
> ice_get_phy_type_high(struct ice_softc *sc, uint64_t phy_type_high)
> {
> switch (phy_type_high) {
> -#if 0
> case ICE_PHY_TYPE_HIGH_100GBASE_KR2_PAM4:
> - return IFM_100G_KR2_PAM4;
> + return IFM_100G_KR2;
> case ICE_PHY_TYPE_HIGH_100G_CAUI2_AOC_ACC:
> return IFM_100G_CAUI2_AC;
> case ICE_PHY_TYPE_HIGH_100G_CAUI2:
> @@ -13875,7 +13850,6 @@ ice_get_phy_type_high(struct ice_softc *sc, uint64_t p
> return IFM_100G_AUI2_AC;
> case ICE_PHY_TYPE_HIGH_100G_AUI2:
> return IFM_100G_AUI2;
> -#endif
> default:
> printf("%s: unhandled high PHY type 0x%llx\n",
> sc->sc_dev.dv_xname, phy_type_high);
> blob - df5103ccc58375bef4fba37705ace7db32d1f076
> blob + 2c2fac08983fa68c06bc39f6c3429fab450432a6
> --- sys/net/if_media.h
> +++ sys/net/if_media.h
> @@ -210,6 +210,39 @@ uint64_t ifmedia_baudrate(uint64_t);
> #define IFM_25G_AOC 55 /* 25G Active Optical Cable */
> #define IFM_40G_AOC 56 /* 40G Active Optical Cable */
> #define IFM_100G_AOC 57 /* 100G Active Optical Cable */
> +#define IFM_100G_KR2 58 /* 100GBase-KR2 */
> +#define IFM_100G_CAUI2_AC 59 /* 100G-CAUI2 active copper/optical */
> +#define IFM_100G_CAUI2 60 /* 100G-CAUI2 */
> +#define IFM_100G_AUI2_AC 61 /* 100G-AUI2 active copper/optical */
> +#define IFM_100G_AUI2 62 /* 100G-AUI2 */
> +#define IFM_100_SGMII 63 /* 100M media interface */
> +#define IFM_2500_X 64 /* 2500BaseX */
> +#define IFM_25G_T 65 /* 25GBase-T */
> +#define IFM_25G_AUI 66 /* 25G-AUI-C2C (chip to chip) */
> +#define IFM_40G_XLAUI 67 /* 40G-XLAUI */
> +#define IFM_40G_XLAUI_AC 68 /* 40G active copper/optical */
> +#define IFM_50G_SR2 69 /* 50GBase-SR2 */
> +#define IFM_50G_LR2 79 /* 50GBase-LR2 */
> +#define IFM_50G_LAUI2_AC 80 /* 50G active copper/optical */
> +#define IFM_50G_LAUI2 81 /* 50G-LAUI2 */
> +#define IFM_50G_AUI2_AC 82 /* 50G active copper/optical */
> +#define IFM_50G_AUI2 83 /* 50G-AUI2 */
> +#define IFM_50G_CP 84 /* 50GBase-CP */
> +#define IFM_50G_SR 85 /* 50GBase-SR */
> +#define IFM_50G_LR 86 /* 50GBase-LR */
> +#define IFM_50G_FR 87 /* 50GBase-FR */
> +#define IFM_50G_KR_PAM4 88 /* 50GBase-KR PAM4 */
> +#define IFM_50G_AUI1_AC 89 /* 50G active copper/optical */
> +#define IFM_50G_AUI1 90 /* 50G-AUI1 */
> +#define IFM_100G_CAUI4_AC 91 /* 100G-CAUI4 active copper/optical */
> +#define IFM_100G_CAUI4 92 /* 100G-CAUI4 */
> +#define IFM_100G_AUI4_AC 93 /* 100G-AUI4 active copper/optical */
> +#define IFM_100G_AUI4 94 /* 100G-AUI4 */
> +#define IFM_100G_CR_PAM4 95 /* 100GBase-CR PAM4 */
> +#define IFM_100G_KR_PAM4 96 /* 100GBase-CR PAM4 */
> +#define IFM_100G_CP2 97 /* 100GBase-CP2 */
> +#define IFM_100G_SR2 98 /* 100GBase-SR2 */
> +#define IFM_100G_DR 99 /* 100GBase-DR */
>
> #define IFM_ETH_MASTER 0x0000000000010000ULL /* master mode (1000baseT) */
> #define IFM_ETH_RXPAUSE 0x0000000000020000ULL /* receive PAUSE frames */
> @@ -614,6 +647,50 @@ struct ifmedia_description {
> { IFM_ETHER|IFM_50G_CR2, "50GBASE-CR2" }, \
> { IFM_ETHER|IFM_50G_KR2, "50GbaseKR2" }, \
> { IFM_ETHER|IFM_50G_KR2, "50GBASE-KR2" }, \
> + { IFM_ETHER|IFM_100G_KR2, "100GBase-KR2" }, \
> + { IFM_ETHER|IFM_100G_KR2, "100GBASE-KR2" }, \
> + { IFM_ETHER|IFM_100G_CAUI2_AC, "100G-CAUI2-AC" }, \
> + { IFM_ETHER|IFM_100G_CAUI2, "100G-CAUI2" }, \
> + { IFM_ETHER|IFM_100G_AUI2_AC, "100G-AUI2-AC" }, \
> + { IFM_ETHER|IFM_100G_AUI2, "100G-AUI2" }, \
> + { IFM_ETHER|IFM_100_SGMII, "100base-SGMII" }, \
> + { IFM_ETHER|IFM_100_SGMII, "100BASE-SGMII" }, \
> + { IFM_ETHER|IFM_2500_X, "2500Base-X" }, \
> + { IFM_ETHER|IFM_2500_X, "2500BASE-X" }, \
> + { IFM_ETHER|IFM_25G_T, "25GBase-T" }, \
> + { IFM_ETHER|IFM_25G_T, "25GBASE-T" }, \
> + { IFM_ETHER|IFM_25G_AUI "25G-AUI" }, \
> + { IFM_ETHER|IFM_40G_XLAUI, "40G-XLAUI" }, \
> + { IFM_ETHER|IFM_40G_XLAUI_AC, "40G-XLAUI-AC" }, \
> + { IFM_ETHER|IFM_50G_SR2, "50GBase-SR2" }, \
> + { IFM_ETHER|IFM_50G_SR2, "50GBASE-SR2" }, \
> + { IFM_ETHER|IFM_50G_LR2, "50GBase-LR2" }, \
> + { IFM_ETHER|IFM_50G_LR2, "50GBASE-LR2" }, \
> + { IFM_ETHER|IFM_50G_LAUI2_AC, "50G-LAUI2-AC" }, \
> + { IFM_ETHER|IFM_50G_LAUI2, "50G-LAUI2" }, \
> + { IFM_ETHER|IFM_50G_AUI2_AC, "50G-AUI2-AC" }, \
> + { IFM_ETHER|IFM_50G_AUI2, "50G-AUI2" }, \
> + { IFM_ETHER|IFM_50G_CP, "50GBase-CP" }, \
> + { IFM_ETHER|IFM_50G_CP, "50GBASE-CP" }, \
> + { IFM_ETHER|IFM_50G_SR, "50GBase-SR" }, \
> + { IFM_ETHER|IFM_50G_SR, "50GBASE-SR" }, \
> + { IFM_ETHER|IFM_50G_LR, "50GBase-LR" }, \
> + { IFM_ETHER|IFM_50G_LR, "50GBASE-LR" }, \
> + { IFM_ETHER|IFM_50G_FR, "50GBase-FR" }, \
> + { IFM_ETHER|IFM_50G_FR, "50GBASE-FR" }, \
> + { IFM_ETHER|IFM_50G_KR_PAM4, "50GBase-KR-PAM4" }, \
> + { IFM_ETHER|IFM_50G_KR_PAM4, "50GBASE-KR-PAM4" }, \
> + { IFM_ETHER|IFM_50G_AUI1_AC, "50G-AUI1-AC" }, \
> + { IFM_ETHER|IFM_50G_AUI1, "50G-AUI1" }, \
> + { IFM_ETHER|IFM_100G_CAUI4_AC, "100G-CAUI4-AC" }, \
> + { IFM_ETHER|IFM_100G_CAUI4, "100G-CAUI4" }, \
> + { IFM_ETHER|IFM_100G_AUI4_AC, "100G-AUI4-AC" }, \
> + { IFM_ETHER|IFM_100G_AUI4, "100G-AUI4" }, \
> + { IFM_ETHER|IFM_100G_CR_PAM4, "100GBase-CR-PAM4" }, \
> + { IFM_ETHER|IFM_100G_KR_PAM4, "100GBase-KR-PAM4" }, \
> + { IFM_ETHER|IFM_100G_CP2, "100GBase-CP2" }, \
> + { IFM_ETHER|IFM_100G_SR2, "100GBase-SR2" }, \
> + { IFM_ETHER|IFM_100G_DR, "100GBase-DR" }, \
> \
> { IFM_FDDI|IFM_FDDI_SMF, "Single-mode" }, \
> { IFM_FDDI|IFM_FDDI_SMF, "SMF" }, \
>
more ifmedia types for ice(4)