diff mbox series

Treat 1G Cu SFPs as 1G SX for X550EM

Message ID 20220414172020.22396-1-jeffd@silicom-usa.com
State Superseded
Headers show
Series Treat 1G Cu SFPs as 1G SX for X550EM | expand

Commit Message

Jeff Daly April 14, 2022, 5:20 p.m. UTC
X550EM NICs do not support 1G Cu SFPs by default from Intel, this
patch enables treating these SFPs as 1G SX SFPs via a module
parameter similar to the parameter that allows the driver to be
able to recognize unsupported (by Intel) SFPs.

Signed-off-by: Jeff Daly <jeffd@silicom-usa.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |  8 ++++++++
 drivers/net/ethernet/intel/ixgbe/ixgbe_type.h |  1 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 16 +++++++++++++++-
 3 files changed, 24 insertions(+), 1 deletion(-)

Comments

Paul Menzel April 14, 2022, 6:06 p.m. UTC | #1
Dear Jeff,


Thank you for your patch.

Am 14.04.22 um 19:20 schrieb Jeff Daly:

Please add some prefix to the commit message summary. Also, I think, you 
should carbon-copy the maintainers.

> X550EM NICs do not support 1G Cu SFPs by default from Intel, this
> patch enables treating these SFPs as 1G SX SFPs via a module
> parameter similar to the parameter that allows the driver to be
> able to recognize unsupported (by Intel) SFPs.

(Please use at least 72 characters per line – checkpatch.pl checks for 75.)

> Signed-off-by: Jeff Daly <jeffd@silicom-usa.com>
> ---
>   drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |  8 ++++++++
>   drivers/net/ethernet/intel/ixgbe/ixgbe_type.h |  1 +
>   drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 16 +++++++++++++++-
>   3 files changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index c4a4954aa317..0d638e4bbc60 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -156,6 +156,11 @@ module_param(allow_unsupported_sfp, uint, 0);
>   MODULE_PARM_DESC(allow_unsupported_sfp,
>   		 "Allow unsupported and untested SFP+ modules on 82599-based adapters");
>   
> +static unsigned int cu_sfp_as_sx;
> +module_param(cu_sfp_as_sx, uint, 0);

Please use a boolean.


Kind regards,

Paul


> +MODULE_PARM_DESC(cu_sfp_as_sx,
> +		 "Allow treating 1G Cu SFP modules as 1G SX modules on X550-based adapters");
> +
>   #define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK)
>   static int debug = -1;
>   module_param(debug, int, 0);
> @@ -10814,6 +10819,9 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>   	if (allow_unsupported_sfp)
>   		hw->allow_unsupported_sfp = allow_unsupported_sfp;
>   
> +	if (cu_sfp_as_sx)
> +		hw->cu_sfp_as_sx = cu_sfp_as_sx;
> +
>   	/* reset_hw fills in the perm_addr as well */
>   	hw->phy.reset_if_overtemp = true;
>   	err = hw->mac.ops.reset_hw(hw);
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
> index 6da9880d766a..0ffe09c0d5a8 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
> @@ -3645,6 +3645,7 @@ struct ixgbe_hw {
>   	bool				allow_unsupported_sfp;
>   	bool				wol_enabled;
>   	bool				need_crosstalk_fix;
> +	bool				cu_sfp_as_sx;
>   };
>   
>   struct ixgbe_info {
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
> index e4b50c7781ff..aa12d589c39b 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
> @@ -1609,6 +1609,8 @@ static s32 ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw, ixgbe_link_speed *speed)
>    */
>   static s32 ixgbe_supported_sfp_modules_X550em(struct ixgbe_hw *hw, bool *linear)
>   {
> +	struct ixgbe_adapter *adapter = hw->back;
> +
>   	switch (hw->phy.sfp_type) {
>   	case ixgbe_sfp_type_not_present:
>   		return IXGBE_ERR_SFP_NOT_PRESENT;
> @@ -1626,9 +1628,21 @@ static s32 ixgbe_supported_sfp_modules_X550em(struct ixgbe_hw *hw, bool *linear)
>   	case ixgbe_sfp_type_1g_lx_core1:
>   		*linear = false;
>   		break;
> -	case ixgbe_sfp_type_unknown:
>   	case ixgbe_sfp_type_1g_cu_core0:
> +		if (hw->cu_sfp_as_sx) {
> +			e_warn(drv, "WARNING: Treating Cu SFP modules as SX modules is unsupported by Intel and may cause unstable operation or damage to the module or the adapter.  Intel Corporation is not responsible for any harm caused by using Cu modules in this way with this adapter.\n");
> +			*linear = false;
> +			hw->phy.sfp_type = ixgbe_sfp_type_1g_sx_core0;
> +			break;
> +		}
>   	case ixgbe_sfp_type_1g_cu_core1:
> +		if (hw->cu_sfp_as_sx) {
> +			e_warn(drv, "WARNING: Treating Cu SFP modules as SX modules is unsupported by Intel and may cause unstable operation or damage to the module or the adapter.  Intel Corporation is not responsible for any harm caused by using Cu modules in this way with this adapter.\n");
> +			*linear = false;
> +			hw->phy.sfp_type = ixgbe_sfp_type_1g_sx_core1;
> +			break;
> +		}
> +	case ixgbe_sfp_type_unknown:
>   	default:
>   		return IXGBE_ERR_SFP_NOT_SUPPORTED;
>   	}
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index c4a4954aa317..0d638e4bbc60 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -156,6 +156,11 @@  module_param(allow_unsupported_sfp, uint, 0);
 MODULE_PARM_DESC(allow_unsupported_sfp,
 		 "Allow unsupported and untested SFP+ modules on 82599-based adapters");
 
+static unsigned int cu_sfp_as_sx;
+module_param(cu_sfp_as_sx, uint, 0);
+MODULE_PARM_DESC(cu_sfp_as_sx,
+		 "Allow treating 1G Cu SFP modules as 1G SX modules on X550-based adapters");
+
 #define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK)
 static int debug = -1;
 module_param(debug, int, 0);
@@ -10814,6 +10819,9 @@  static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (allow_unsupported_sfp)
 		hw->allow_unsupported_sfp = allow_unsupported_sfp;
 
+	if (cu_sfp_as_sx)
+		hw->cu_sfp_as_sx = cu_sfp_as_sx;
+
 	/* reset_hw fills in the perm_addr as well */
 	hw->phy.reset_if_overtemp = true;
 	err = hw->mac.ops.reset_hw(hw);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
index 6da9880d766a..0ffe09c0d5a8 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
@@ -3645,6 +3645,7 @@  struct ixgbe_hw {
 	bool				allow_unsupported_sfp;
 	bool				wol_enabled;
 	bool				need_crosstalk_fix;
+	bool				cu_sfp_as_sx;
 };
 
 struct ixgbe_info {
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
index e4b50c7781ff..aa12d589c39b 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
@@ -1609,6 +1609,8 @@  static s32 ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw, ixgbe_link_speed *speed)
  */
 static s32 ixgbe_supported_sfp_modules_X550em(struct ixgbe_hw *hw, bool *linear)
 {
+	struct ixgbe_adapter *adapter = hw->back;
+
 	switch (hw->phy.sfp_type) {
 	case ixgbe_sfp_type_not_present:
 		return IXGBE_ERR_SFP_NOT_PRESENT;
@@ -1626,9 +1628,21 @@  static s32 ixgbe_supported_sfp_modules_X550em(struct ixgbe_hw *hw, bool *linear)
 	case ixgbe_sfp_type_1g_lx_core1:
 		*linear = false;
 		break;
-	case ixgbe_sfp_type_unknown:
 	case ixgbe_sfp_type_1g_cu_core0:
+		if (hw->cu_sfp_as_sx) {
+			e_warn(drv, "WARNING: Treating Cu SFP modules as SX modules is unsupported by Intel and may cause unstable operation or damage to the module or the adapter.  Intel Corporation is not responsible for any harm caused by using Cu modules in this way with this adapter.\n");
+			*linear = false;
+			hw->phy.sfp_type = ixgbe_sfp_type_1g_sx_core0;
+			break;
+		}
 	case ixgbe_sfp_type_1g_cu_core1:
+		if (hw->cu_sfp_as_sx) {
+			e_warn(drv, "WARNING: Treating Cu SFP modules as SX modules is unsupported by Intel and may cause unstable operation or damage to the module or the adapter.  Intel Corporation is not responsible for any harm caused by using Cu modules in this way with this adapter.\n");
+			*linear = false;
+			hw->phy.sfp_type = ixgbe_sfp_type_1g_sx_core1;
+			break;
+		}
+	case ixgbe_sfp_type_unknown:
 	default:
 		return IXGBE_ERR_SFP_NOT_SUPPORTED;
 	}