Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ixgbe: Add 1000BASE-BX support #1518

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion sys/dev/ixgbe/if_ix.c
Original file line number Diff line number Diff line change
Expand Up @@ -1366,8 +1366,10 @@ ixgbe_add_media_types(if_ctx_t ctx)
ifmedia_add(sc->media, IFM_ETHER | IFM_2500_SX, 0, NULL);
}
#endif
if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_BX)
if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_BX) {
device_printf(dev, "Media supported: 1000baseBX\n");
ifmedia_add(sc->media, IFM_ETHER | IFM_1000_BX, 0, NULL);
}

if (hw->device_id == IXGBE_DEV_ID_82598AT) {
ifmedia_add(sc->media, IFM_ETHER | IFM_1000_T | IFM_FDX,
Expand Down Expand Up @@ -2484,6 +2486,7 @@ ixgbe_if_media_change(if_ctx_t ctx)
#endif
case IFM_1000_LX:
case IFM_1000_SX:
case IFM_1000_BX:
speed |= IXGBE_LINK_SPEED_1GB_FULL;
break;
case IFM_1000_T:
Expand Down
4 changes: 3 additions & 1 deletion sys/dev/ixgbe/ixgbe_82599.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,9 @@ s32 ixgbe_get_link_capabilities_82599(struct ixgbe_hw *hw,
hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1) {
hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1 ||
hw->phy.sfp_type == ixgbe_sfp_type_1g_bx_core0 ||
hw->phy.sfp_type == ixgbe_sfp_type_1g_bx_core1) {
*speed = IXGBE_LINK_SPEED_1GB_FULL;
*autoneg = true;
goto out;
Expand Down
48 changes: 44 additions & 4 deletions sys/dev/ixgbe/ixgbe_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1297,6 +1297,7 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
u8 comp_codes_1g = 0;
u8 comp_codes_10g = 0;
u8 oui_bytes[3] = {0, 0, 0};
u8 bitrate_nominal = 0;
u8 cable_tech = 0;
u8 cable_spec = 0;
u16 enforce_sfp = 0;
Expand Down Expand Up @@ -1341,6 +1342,12 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
IXGBE_SFF_CABLE_TECHNOLOGY,
&cable_tech);

if (status != IXGBE_SUCCESS)
goto err_read_i2c_eeprom;
status = hw->phy.ops.read_i2c_eeprom(hw,
IXGBE_SFF_BITRATE_NOMINAL,
&bitrate_nominal);

if (status != IXGBE_SUCCESS)
goto err_read_i2c_eeprom;

Expand Down Expand Up @@ -1423,6 +1430,20 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
else
hw->phy.sfp_type =
ixgbe_sfp_type_1g_lx_core1;
/*
* Check for compatibility with 1000BASE-BX, which
* operates at a nominal signaling rate of 1.25 Gbaud.
* This rate is rounded up to 13 * 100 MBaud.
*/
} else if ((comp_codes_1g &
IXGBE_SFF_BASEBX10_CAPABLE) &&
(bitrate_nominal == 13)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you ok dropping all this machinery around the bitrate check? If you have the right comp_code for 1g I think it is safe to proceed and SFPs tend too often to be miscoded. We can always add it back if there is unforeseen issue.

if (hw->bus.lan_id == 0)
hw->phy.sfp_type =
ixgbe_sfp_type_1g_bx_core0;
else
hw->phy.sfp_type =
ixgbe_sfp_type_1g_bx_core1;
} else {
hw->phy.sfp_type = ixgbe_sfp_type_unknown;
}
Expand Down Expand Up @@ -1511,7 +1532,9 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1)) {
hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1 ||
hw->phy.sfp_type == ixgbe_sfp_type_1g_bx_core0 ||
hw->phy.sfp_type == ixgbe_sfp_type_1g_bx_core1)) {
hw->phy.type = ixgbe_phy_sfp_unsupported;
status = IXGBE_ERR_SFP_NOT_SUPPORTED;
goto out;
Expand All @@ -1530,7 +1553,9 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1)) {
hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1 ||
hw->phy.sfp_type == ixgbe_sfp_type_1g_bx_core0 ||
hw->phy.sfp_type == ixgbe_sfp_type_1g_bx_core1)) {
/* Make sure we're a supported PHY type */
if (hw->phy.type == ixgbe_phy_sfp_intel) {
status = IXGBE_SUCCESS;
Expand Down Expand Up @@ -1579,6 +1604,7 @@ u64 ixgbe_get_supported_phy_sfp_layer_generic(struct ixgbe_hw *hw)
u64 physical_layer = IXGBE_PHYSICAL_LAYER_UNKNOWN;
u8 comp_codes_10g = 0;
u8 comp_codes_1g = 0;
u8 bitrate_nominal = 0;

DEBUGFUNC("ixgbe_get_supported_phy_sfp_layer_generic");

Expand Down Expand Up @@ -1613,6 +1639,18 @@ u64 ixgbe_get_supported_phy_sfp_layer_generic(struct ixgbe_hw *hw)
physical_layer = IXGBE_PHYSICAL_LAYER_1000BASE_T;
else if (comp_codes_1g & IXGBE_SFF_1GBASESX_CAPABLE)
physical_layer = IXGBE_PHYSICAL_LAYER_1000BASE_SX;
else if (comp_codes_1g & IXGBE_SFF_BASEBX10_CAPABLE) {
hw->phy.ops.read_i2c_eeprom(hw,
IXGBE_SFF_BITRATE_NOMINAL, &bitrate_nominal);
/*
* 1000BASE-BX uses signaling rate of 1.25 Gbaud,
* rounded to 13 * 100 MBaud.
*/
if (bitrate_nominal == 13) {
physical_layer =
IXGBE_PHYSICAL_LAYER_1000BASE_BX;
}
}
break;
case ixgbe_phy_qsfp_intel:
case ixgbe_phy_qsfp_unknown:
Expand Down Expand Up @@ -1861,12 +1899,14 @@ s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw,
if (sfp_type == ixgbe_sfp_type_da_act_lmt_core0 ||
sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
sfp_type == ixgbe_sfp_type_1g_sx_core0)
sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
sfp_type == ixgbe_sfp_type_1g_bx_core0)
sfp_type = ixgbe_sfp_type_srlr_core0;
else if (sfp_type == ixgbe_sfp_type_da_act_lmt_core1 ||
sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
sfp_type == ixgbe_sfp_type_1g_cu_core1 ||
sfp_type == ixgbe_sfp_type_1g_sx_core1)
sfp_type == ixgbe_sfp_type_1g_sx_core1 ||
sfp_type == ixgbe_sfp_type_1g_bx_core1)
sfp_type = ixgbe_sfp_type_srlr_core1;

/* Read offset to PHY init contents */
Expand Down
2 changes: 2 additions & 0 deletions sys/dev/ixgbe/ixgbe_phy.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#define IXGBE_SFF_1GBE_COMP_CODES 0x6
#define IXGBE_SFF_10GBE_COMP_CODES 0x3
#define IXGBE_SFF_CABLE_TECHNOLOGY 0x8
#define IXGBE_SFF_BITRATE_NOMINAL 0xC
#define IXGBE_SFF_CABLE_SPEC_COMP 0x3C
#define IXGBE_SFF_SFF_8472_SWAP 0x5C
#define IXGBE_SFF_SFF_8472_COMP 0x5E
Expand All @@ -73,6 +74,7 @@
#define IXGBE_SFF_1GBASET_CAPABLE 0x8
#define IXGBE_SFF_10GBASESR_CAPABLE 0x10
#define IXGBE_SFF_10GBASELR_CAPABLE 0x20
#define IXGBE_SFF_BASEBX10_CAPABLE 0x40
#define IXGBE_SFF_SOFT_RS_SELECT_MASK 0x8
#define IXGBE_SFF_SOFT_RS_SELECT_10G 0x8
#define IXGBE_SFF_SOFT_RS_SELECT_1G 0x0
Expand Down
2 changes: 2 additions & 0 deletions sys/dev/ixgbe/ixgbe_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -3807,6 +3807,8 @@ enum ixgbe_sfp_type {
ixgbe_sfp_type_1g_sx_core1 = 12,
ixgbe_sfp_type_1g_lx_core0 = 13,
ixgbe_sfp_type_1g_lx_core1 = 14,
ixgbe_sfp_type_1g_bx_core0 = 15,
ixgbe_sfp_type_1g_bx_core1 = 16,
ixgbe_sfp_type_not_present = 0xFFFE,
ixgbe_sfp_type_unknown = 0xFFFF
};
Expand Down