Skip to content

Commit

Permalink
Add support for 2.5G, 5G, 25G, and 50G based Ethernet (#475)
Browse files Browse the repository at this point in the history
* add support for 2.5G, 5G, 25G, and 50G speeds

* Added 10GBASE-T and changed 100GBASE-CR10 to 100GBASE-CR4

* changed 10GigBaseCX4 to 10GbaseT in tests

Co-authored-by: quwer2 <quwer2@users.noreply.github.com>
  • Loading branch information
erhauser and quwer2 committed Aug 30, 2021
1 parent b78587a commit d5b5adb
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 11 deletions.
41 changes: 34 additions & 7 deletions src/daemon/interfaces-linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,23 +619,50 @@ iflinux_macphy(struct lldpd *cfg, struct lldpd_hardware *hardware)
port->p_macphy.mau_type = (uset.base.duplex == DUPLEX_FULL) ? \
LLDP_DOT3_MAU_1000BASEXFD : LLDP_DOT3_MAU_1000BASEXHD;
break;
case SPEED_2500:
port->p_macphy.mau_type = LLDP_DOT3_MAU_2P5GIGT;
break;
case SPEED_5000:
port->p_macphy.mau_type = LLDP_DOT3_MAU_5GIGT;
break;
case SPEED_10000:
// For fiber, we tell 10GIGBASEX and for others,
// 10GIGBASER. It's not unusual to have 10GIGBASER on
// fiber either but we don't have 10GIGBASET for
// copper. No good solution.
port->p_macphy.mau_type = (uset.base.port == PORT_FIBRE) ? \
LLDP_DOT3_MAU_10GIGBASELR : LLDP_DOT3_MAU_10GIGBASECX4;
// Distinguish between RJ45 BaseT, DAC BaseCX4, or Fibre BaseLR
if (uset.base.port == PORT_TP) {
port->p_macphy.mau_type = LLDP_DOT3_MAU_10GBASET;
}
else if (uset.base.port == PORT_FIBRE) {
port->p_macphy.mau_type = LLDP_DOT3_MAU_10GIGBASELR;
}
else if (uset.base.port == PORT_DA) {
port->p_macphy.mau_type = LLDP_DOT3_MAU_10GIGBASECX4;
}
break;
case SPEED_25000:
// Distinguish between RJ45 BaseT, DAC BaseCR, or Fibre BaseLR
if (uset.base.port == PORT_TP) {
port->p_macphy.mau_type = LLDP_DOT3_MAU_25GBASET;
}
else if (uset.base.port == PORT_FIBRE) {
port->p_macphy.mau_type = LLDP_DOT3_MAU_25GBASELR;
}
else if (uset.base.port == PORT_DA) {
port->p_macphy.mau_type = LLDP_DOT3_MAU_25GBASECR;
}
break;
case SPEED_40000:
// Same kind of approximation.
port->p_macphy.mau_type = (uset.base.port == PORT_FIBRE) ? \
LLDP_DOT3_MAU_40GBASELR4 : LLDP_DOT3_MAU_40GBASECR4;
break;
case SPEED_50000:
// Same kind of approximation.
port->p_macphy.mau_type = (uset.base.port == PORT_FIBRE) ? \
LLDP_DOT3_MAU_50GBASELR : LLDP_DOT3_MAU_50GBASECR;
break;
case SPEED_100000:
// Ditto
port->p_macphy.mau_type = (uset.base.port == PORT_FIBRE) ? \
LLDP_DOT3_MAU_100GBASELR4 : LLDP_DOT3_MAU_100GBASECR10;
LLDP_DOT3_MAU_100GBASELR4 : LLDP_DOT3_MAU_100GBASECR4;
break;
}
if (uset.base.port == PORT_AUI) port->p_macphy.mau_type = LLDP_DOT3_MAU_AUI;
Expand Down
66 changes: 66 additions & 0 deletions src/lib/atoms/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,72 @@ static lldpctl_map_t operational_mau_type_values[] = {
{ LLDP_DOT3_MAU_100GBASESR10, "100GbaseSR10 - 100GBASE-R PCS/PMA over 10 lane multimode fiber" },
{ LLDP_DOT3_MAU_100GBASELR4, "100GbaseLR4 - 100GBASE-R PCS/PMA over 4 WDM lane single mode fiber, long reach" },
{ LLDP_DOT3_MAU_100GBASEER4, "100GbaseER4 - 100GBASE-R PCS/PMA over 4 WDM lane single mode fiber PMD, extended reach" },
{ LLDP_DOT3_MAU_1000BASET1, "1000baseT1 - 1000BASE-T1 single balanced twisted-pair copper cabling PHY" },
{ LLDP_DOT3_MAU_1000BASEPX30D, "1000basePX30D - One single-mode fiber EPON OLT, 20km, 1:32 split ratio" },
{ LLDP_DOT3_MAU_1000BASEPX30U, "1000basePX30U - One single-mode fiber EPON ONU, 20km, 1:32 split ratio" },
{ LLDP_DOT3_MAU_1000BASEPX40D, "1000basePX40D - One single-mode fiber EPON OLT, 20km, 1:64 split ratio" },
{ LLDP_DOT3_MAU_1000BASEPX40U, "1000basePX40U - One single-mode fiber EPON ONU, 20km, 1:64 split ratio" },
{ LLDP_DOT3_MAU_10G1GBASEPRXD4, "10G1GbasePRXD4 - One single-mode fiber asymmetric-rate EPON OLT, supporting extended power budget (PRX40)" },
{ LLDP_DOT3_MAU_10G1GBASEPRXU4, "10G1GbasePRXU4 - One single-mode fiber asymmetric-rate EPON ONU, supporting extended power budget (PRX40)" },
{ LLDP_DOT3_MAU_10GBASEPRD4, "10GbasePRD4 - One single-mode fiber symmetric-rate EPON OLT, supporting extended power budget (PR40)" },
{ LLDP_DOT3_MAU_10GBASEPRU4, "10GbasePRU4 - One single-mode fiber symmetric-rate EPON ONU, supporting extended power budget (PR40)" },
{ LLDP_DOT3_MAU_25GBASECR, "25GbaseCR - 25GBASE-R PCS/PMA over shielded balanced copper cable" },
{ LLDP_DOT3_MAU_25GBASECRS, "25GbaseCRS - 25GBASE-R PCS/PMA over shielded balanced copper cable without RS-FEC" },
{ LLDP_DOT3_MAU_25GBASEKR, "25GbaseKR - 25GBASE-R PCS/PMA over an electrical backplane" },
{ LLDP_DOT3_MAU_25GBASEKRS, "25GbaseKRS - 25GBASE-R PCS/PMA over an electrical backplane without RS-FEC" },
{ LLDP_DOT3_MAU_25GBASER, "25GbaseR - 25GBASE-R PCS/PMA over undefined PMD" },
{ LLDP_DOT3_MAU_25GBASESR, "25GbaseSR - 25GBASE-R PCS/PMA over multimode fiber" },
{ LLDP_DOT3_MAU_25GBASET, "25GbaseT - Four-pair twisted-pair balanced copper cabling" },
{ LLDP_DOT3_MAU_40GBASEER4, "40GbaseER4 - 40GBASE-R PCS/PMA over 4 WDM lane single mode fiber" },
{ LLDP_DOT3_MAU_40GBASER, "40GbaseR - 40GBASE-R PCS as over undefined PMA/PMD" },
{ LLDP_DOT3_MAU_40GBASET, "40GbaseT - Four-pair twisted-pair balanced copper cabling" },
{ LLDP_DOT3_MAU_100GBASECR4, "100GbaseCR4 - 100GBASE-R PCS/PMA over 4 lane shielded copper balanced cable" },
{ LLDP_DOT3_MAU_100GBASEKR4, "100GbaseKR4 - 100GBASE-R PCS/PMA over an electrical backplane" },
{ LLDP_DOT3_MAU_100GBASEKP4, "100GbaseKP4 - 100GBASE-P PCS/PMA over an electrical backplane PMD" },
{ LLDP_DOT3_MAU_100GBASER, "100GbaseR - 100GBASE-R Multi-lane PCS over undefined PMA/PMD" },
{ LLDP_DOT3_MAU_100GBASESR4, "100GbaseSR4 - 100GBASE-R PCS/PMA over 4 lane multimode fiber" },
{ LLDP_DOT3_MAU_2P5GIGT, "2p5GigT - 2.5GBASE-T Four-pair twisted-pair balanced copper cabling PHY" },
{ LLDP_DOT3_MAU_5GIGT, "5GigT - 5GBASE-T Four-pair twisted-pair balanced copper cabling PHY" },
{ LLDP_DOT3_MAU_100BASET1, "100baseT1 - 100BASE-T1 Single balanced twisted-pair copper cabling PHY" },
{ LLDP_DOT3_MAU_1000BASERHA, "1000baseRHA - 1000BASE-RHA Plastic optical fiber PHY" },
{ LLDP_DOT3_MAU_1000BASERHB, "1000baseRHB - 1000BASE-RHB Plastic optical fiber PHY" },
{ LLDP_DOT3_MAU_1000BASERHC, "1000baseRHC - 1000BASE-RHC Plastic optical fiber PHY" },
{ LLDP_DOT3_MAU_2P5GBASEKX, "2p5GbaseKX - 2.5GBASE-X PMD over an electrical backplane" },
{ LLDP_DOT3_MAU_2P5GBASEX, "2p5GbaseX - 2.5GBASE-X PCS/PMA over undefined PMD" },
{ LLDP_DOT3_MAU_5GBASEKR, "5GbaseKR - 5GBASE-KR PMD over an electrical backplane" },
{ LLDP_DOT3_MAU_5GBASER, "5GbaseR - 5GBASE-R PCS/PMA over undefined PMD" },
{ LLDP_DOT3_MAU_10GPASSXR, "10GpassXR - Coax cable distribution network PHY continuous downstream/burst mode upstream PHY" },
{ LLDP_DOT3_MAU_25GBASELR, "25GbaseLR - 25GBASE-R PCS/PMA over single-mode fiber PMD, with long reach" },
{ LLDP_DOT3_MAU_25GBASEER, "25GbaseER - 25GBASE-R PCS/PMA over single-mode fiber PMD, with extended reach" },
{ LLDP_DOT3_MAU_50GBASER, "50GbaseR - 50GBASE-R Multi-lane PCS over undefined PMA/PMD" },
{ LLDP_DOT3_MAU_50GBASECR, "50GbaseCR - 50GBASE-R PCS/PMA over shielded copper balanced cable PMD" },
{ LLDP_DOT3_MAU_50GBASEKR, "50GbaseKR - 50GBASE-R PCS/PMA over an electrical backplane PMD" },
{ LLDP_DOT3_MAU_50GBASESR, "50GbaseSR - 50GBASE-R PCS/PMA over multimode fiber PMD" },
{ LLDP_DOT3_MAU_50GBASEFR, "50GbaseFR - 50GBASE-R PCS/PMA over single mode fiber PMD with reach up to at least 2 km" },
{ LLDP_DOT3_MAU_50GBASELR, "50GbaseLR - 50GBASE-R PCS/PMA over single mode fiber PMD with reach up to at least 10 km" },
{ LLDP_DOT3_MAU_50GBASEER, "50GbaseER - 50GBASE-R PCS/PMA over single-mode fiber PMD with reach up to at least 40 km" },
{ LLDP_DOT3_MAU_100GBASECR2, "100GbaseCR2 - 100GBASE-R PCS/PMA over 2 lane shielded copper balanced cable PMD" },
{ LLDP_DOT3_MAU_100GBASEKR2, "100GbaseKR2 - 100GBASE-R PCS/PMA over an electrical backplane PMD" },
{ LLDP_DOT3_MAU_100GBASESR2, "100GbaseSR2 - 100GBASE-R PCS/PMA over 2 lane multimode fiber PMD" },
{ LLDP_DOT3_MAU_100GBASEDR, "100GbaseDR - 100GBASE-R PCS/PMA over single mode fiber PMD" },
{ LLDP_DOT3_MAU_200GBASER, "200GbaseR - 200GBASE-R Multi-lane PCS over undefined PMA/PMD" },
{ LLDP_DOT3_MAU_200GBASEDR4, "200GbaseDR4 - 200GBASE-R PCS/PMA over 4-lane single-mode fiber PMD" },
{ LLDP_DOT3_MAU_200GBASEFR4, "200GbaseFR4 - 200GBASE-R PCS/PMA over 4 WDM lane single-mode fiber PMD with reach up to at least 2 km" },
{ LLDP_DOT3_MAU_200GBASELR4, "200GbaseLR4 - 200GBASE-R PCS/PMA over 4 WDM lane single-mode fiber PMD with reach up to at least 10 km" },
{ LLDP_DOT3_MAU_200GBASECR4, "200GbaseCR4 - 200GBASE-R PCS/PMA over 4 lane shielded copper balanced cable PMD" },
{ LLDP_DOT3_MAU_200GBASEKR4, "200GbaseKR4 - 200GBASE-R PCS/PMA over an electrical backplane PMD" },
{ LLDP_DOT3_MAU_200GBASESR4, "200GbaseSR4 - 200GBASE-R PCS/PMA over 4 lane multimode fiber PMD" },
{ LLDP_DOT3_MAU_200GBASEER4, "200GbaseER4 - 200GBASE-R PCS/PMA over 4 WDM lane single-mode fiber PMD with reach up to at least 40 km" },
{ LLDP_DOT3_MAU_400GBASER, "400GbaseR - 400GBASE-R Multi-lane PCS over undefined PMA/PMD" },
{ LLDP_DOT3_MAU_400GBASESR16, "400GbaseSR16 - 400GBASE-R PCS/PMA over 16-lane multimode fiber PMD" },
{ LLDP_DOT3_MAU_400GBASEDR4, "400GbaseDR4 - 400GBASE-R PCS/PMA over 4-lane single-mode fiber PMD" },
{ LLDP_DOT3_MAU_400GBASEFR8, "400GbaseFR8 - 400GBASE-R PCS/PMA over 8 WDM lane single-mode fiber PMD with reach up to at least 2 km" },
{ LLDP_DOT3_MAU_400GBASELR8, "400GbaseLR8 - 400GBASE-R PCS/PMA over 8 WDM lane single-mode fiber PMD with reach up to at least 10 km" },
{ LLDP_DOT3_MAU_400GBASEER8, "400GbaseER8 - 400GBASE-R PCS/PMA over 8 WDM lane single-mode fiber PMD with reach up to at least 40 km" },
{ LLDP_DOT3_MAU_10BASET1L, "10baseT1L - 10BASE-T1L Single balanced pair PHY" },
{ LLDP_DOT3_MAU_10BASET1SHD, "10baseT1SHD - 10BASE-T1S Single balanced pair PHY, half duplex mode" },
{ LLDP_DOT3_MAU_10BASET1SMD, "10baseT1SMD - 10BASE-T1S Single balanced pair PHY, multidrop mode" },
{ LLDP_DOT3_MAU_10BASET1SFD, "10baseT1SFD - 10BASE-T1S Single balanced pair PHY, full duplex mode" },
{ 0, NULL }
};
#endif
Expand Down
66 changes: 66 additions & 0 deletions src/lldp-const.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,72 @@
#define LLDP_DOT3_MAU_100GBASESR10 76
#define LLDP_DOT3_MAU_100GBASELR4 77
#define LLDP_DOT3_MAU_100GBASEER4 78
#define LLDP_DOT3_MAU_1000BASET1 79
#define LLDP_DOT3_MAU_1000BASEPX30D 80
#define LLDP_DOT3_MAU_1000BASEPX30U 81
#define LLDP_DOT3_MAU_1000BASEPX40D 82
#define LLDP_DOT3_MAU_1000BASEPX40U 83
#define LLDP_DOT3_MAU_10G1GBASEPRXD4 84
#define LLDP_DOT3_MAU_10G1GBASEPRXU4 85
#define LLDP_DOT3_MAU_10GBASEPRD4 86
#define LLDP_DOT3_MAU_10GBASEPRU4 87
#define LLDP_DOT3_MAU_25GBASECR 88
#define LLDP_DOT3_MAU_25GBASECRS 89
#define LLDP_DOT3_MAU_25GBASEKR 90
#define LLDP_DOT3_MAU_25GBASEKRS 91
#define LLDP_DOT3_MAU_25GBASER 92
#define LLDP_DOT3_MAU_25GBASESR 93
#define LLDP_DOT3_MAU_25GBASET 94
#define LLDP_DOT3_MAU_40GBASEER4 95
#define LLDP_DOT3_MAU_40GBASER 96
#define LLDP_DOT3_MAU_40GBASET 97
#define LLDP_DOT3_MAU_100GBASECR4 98
#define LLDP_DOT3_MAU_100GBASEKR4 99
#define LLDP_DOT3_MAU_100GBASEKP4 100
#define LLDP_DOT3_MAU_100GBASER 101
#define LLDP_DOT3_MAU_100GBASESR4 102
#define LLDP_DOT3_MAU_2P5GIGT 103
#define LLDP_DOT3_MAU_5GIGT 104
#define LLDP_DOT3_MAU_100BASET1 105
#define LLDP_DOT3_MAU_1000BASERHA 106
#define LLDP_DOT3_MAU_1000BASERHB 107
#define LLDP_DOT3_MAU_1000BASERHC 108
#define LLDP_DOT3_MAU_2P5GBASEKX 109
#define LLDP_DOT3_MAU_2P5GBASEX 110
#define LLDP_DOT3_MAU_5GBASEKR 111
#define LLDP_DOT3_MAU_5GBASER 112
#define LLDP_DOT3_MAU_10GPASSXR 113
#define LLDP_DOT3_MAU_25GBASELR 114
#define LLDP_DOT3_MAU_25GBASEER 115
#define LLDP_DOT3_MAU_50GBASER 116
#define LLDP_DOT3_MAU_50GBASECR 117
#define LLDP_DOT3_MAU_50GBASEKR 118
#define LLDP_DOT3_MAU_50GBASESR 119
#define LLDP_DOT3_MAU_50GBASEFR 120
#define LLDP_DOT3_MAU_50GBASELR 121
#define LLDP_DOT3_MAU_50GBASEER 122
#define LLDP_DOT3_MAU_100GBASECR2 123
#define LLDP_DOT3_MAU_100GBASEKR2 124
#define LLDP_DOT3_MAU_100GBASESR2 125
#define LLDP_DOT3_MAU_100GBASEDR 126
#define LLDP_DOT3_MAU_200GBASER 127
#define LLDP_DOT3_MAU_200GBASEDR4 128
#define LLDP_DOT3_MAU_200GBASEFR4 129
#define LLDP_DOT3_MAU_200GBASELR4 130
#define LLDP_DOT3_MAU_200GBASECR4 131
#define LLDP_DOT3_MAU_200GBASEKR4 132
#define LLDP_DOT3_MAU_200GBASESR4 133
#define LLDP_DOT3_MAU_200GBASEER4 134
#define LLDP_DOT3_MAU_400GBASER 135
#define LLDP_DOT3_MAU_400GBASESR16 136
#define LLDP_DOT3_MAU_400GBASEDR4 137
#define LLDP_DOT3_MAU_400GBASEFR8 138
#define LLDP_DOT3_MAU_400GBASELR8 139
#define LLDP_DOT3_MAU_400GBASEER8 140
#define LLDP_DOT3_MAU_10BASET1L 141
#define LLDP_DOT3_MAU_10BASET1SHD 142
#define LLDP_DOT3_MAU_10BASET1SMD 143
#define LLDP_DOT3_MAU_10BASET1SFD 144

/* Dot3 Power Devicetype */
#define LLDP_DOT3_POWER_PSE 1
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/test_lldpcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def test_text_output(request, lldpd1, lldpd, lldpcli, namespaces, uname,
if 'Dot3' in request.config.lldpd.features:
dot3 = """
PMD autoneg: supported: no, enabled: no
MAU oper type: 10GigBaseCX4 - X copper over 8 pair 100-Ohm balanced cable"""
MAU oper type: 10GbaseT - Four-pair Category 6A or better, full duplex mode only"""
else:
dot3 = ""

Expand Down Expand Up @@ -181,7 +181,7 @@ def test_json_output(request, lldpd1, lldpd, lldpcli, namespaces, uname,
expected['lldp']['interface']['eth0']['port']['auto-negotiation'] = {
"enabled": False,
"supported": False,
"current": "10GigBaseCX4 - X copper over 8 pair 100-Ohm balanced cable"
"current": "10GbaseT - Four-pair Category 6A or better, full duplex mode only"
}

assert j == expected
Expand Down Expand Up @@ -275,7 +275,7 @@ def test_json0_output(request, lldpd1, lldpd, lldpcli, namespaces, uname,
"enabled": False,
"supported": False,
"current": [{"value":
"10GigBaseCX4 - X copper over 8 pair 100-Ohm balanced cable"}]
"10GbaseT - Four-pair Category 6A or better, full duplex mode only"}]
}]
assert j == expected

Expand Down Expand Up @@ -352,7 +352,7 @@ def test_xml_output(request, lldpd1, lldpd, lldpcli, namespaces, uname,
if 'Dot3' in request.config.lldpd.features:
dot3 = """
<auto-negotiation enabled="no" label="PMD autoneg" supported="no">
<current label="MAU oper type">10GigBaseCX4 - X copper over 8 pair 100-Ohm balanced cable</current>
<current label="MAU oper type">10GbaseT - Four-pair Category 6A or better, full duplex mode only</current>
</auto-negotiation>"""
else:
dot3 = ""
Expand Down

0 comments on commit d5b5adb

Please sign in to comment.