]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ixgbe: add E610 .set_phys_id() callback implementation
authorJedrzej Jagielski <jedrzej.jagielski@intel.com>
Mon, 3 Mar 2025 12:06:30 +0000 (13:06 +0100)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Tue, 29 Apr 2025 22:13:44 +0000 (15:13 -0700)
Legacy implementation of .set_phys_id() ethtool callback is not
applicable for E610 device.

Add new implementation which uses 0x06E9 command by calling
ixgbe_aci_set_port_id_led().

Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Bharath R <bharath.r@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
drivers/net/ethernet/intel/ixgbe/ixgbe_e610.h
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
drivers/net/ethernet/intel/ixgbe/ixgbe_type_e610.h

index 9ada35f7d8f76ba8c0f1f0d8d3de0f36472e972b..71ea25de1bac7af36399833250d7e6a6a9a2919d 100644 (file)
@@ -1484,6 +1484,35 @@ static int ixgbe_start_hw_e610(struct ixgbe_hw *hw)
        return 0;
 }
 
+/**
+ * ixgbe_aci_set_port_id_led - set LED value for the given port
+ * @hw: pointer to the HW struct
+ * @orig_mode: set LED original mode
+ *
+ * Set LED value for the given port (0x06E9)
+ *
+ * Return: the exit code of the operation.
+ */
+int ixgbe_aci_set_port_id_led(struct ixgbe_hw *hw, bool orig_mode)
+{
+       struct ixgbe_aci_cmd_set_port_id_led *cmd;
+       struct ixgbe_aci_desc desc;
+
+       cmd = &desc.params.set_port_id_led;
+
+       ixgbe_fill_dflt_direct_cmd_desc(&desc, ixgbe_aci_opc_set_port_id_led);
+
+       cmd->lport_num = (u8)hw->bus.func;
+       cmd->lport_num_valid = IXGBE_ACI_PORT_ID_PORT_NUM_VALID;
+
+       if (orig_mode)
+               cmd->ident_mode = IXGBE_ACI_PORT_IDENT_LED_ORIG;
+       else
+               cmd->ident_mode = IXGBE_ACI_PORT_IDENT_LED_BLINK;
+
+       return ixgbe_aci_send_cmd(hw, &desc, NULL, 0);
+}
+
 /**
  * ixgbe_get_media_type_e610 - Gets media type
  * @hw: pointer to the HW struct
index 30bc1f1b2549b4c9867c4ebad3e0824d32e465e2..bb31d65bd1c8fe8a56c7b567f9984a7196c2cb46 100644 (file)
@@ -36,6 +36,7 @@ int ixgbe_aci_get_link_info(struct ixgbe_hw *hw, bool ena_lse,
                            struct ixgbe_link_status *link);
 int ixgbe_aci_set_event_mask(struct ixgbe_hw *hw, u8 port_num, u16 mask);
 int ixgbe_configure_lse(struct ixgbe_hw *hw, bool activate, u16 mask);
+int ixgbe_aci_set_port_id_led(struct ixgbe_hw *hw, bool orig_mode);
 enum ixgbe_media_type ixgbe_get_media_type_e610(struct ixgbe_hw *hw);
 int ixgbe_setup_link_e610(struct ixgbe_hw *hw, ixgbe_link_speed speed,
                          bool autoneg_wait);
index 435f3fc3cec346e161e13c4e947cd9d9c22c40dd..d8a919ab7027aa1a6b6a4196a92557c9c95e6f3f 100644 (file)
@@ -2491,6 +2491,26 @@ static int ixgbe_set_phys_id(struct net_device *netdev,
        return 0;
 }
 
+static int ixgbe_set_phys_id_e610(struct net_device *netdev,
+                                 enum ethtool_phys_id_state state)
+{
+       struct ixgbe_adapter *adapter = ixgbe_from_netdev(netdev);
+       bool led_active;
+
+       switch (state) {
+       case ETHTOOL_ID_ACTIVE:
+               led_active = true;
+               break;
+       case ETHTOOL_ID_INACTIVE:
+               led_active = false;
+               break;
+       default:
+               return -EOPNOTSUPP;
+       }
+
+       return ixgbe_aci_set_port_id_led(&adapter->hw, !led_active);
+}
+
 static int ixgbe_get_coalesce(struct net_device *netdev,
                              struct ethtool_coalesce *ec,
                              struct kernel_ethtool_coalesce *kernel_coal,
@@ -3756,7 +3776,7 @@ static const struct ethtool_ops ixgbe_ethtool_ops_e610 = {
        .set_msglevel           = ixgbe_set_msglevel,
        .self_test              = ixgbe_diag_test,
        .get_strings            = ixgbe_get_strings,
-       .set_phys_id            = ixgbe_set_phys_id,
+       .set_phys_id            = ixgbe_set_phys_id_e610,
        .get_sset_count         = ixgbe_get_sset_count,
        .get_ethtool_stats      = ixgbe_get_ethtool_stats,
        .get_coalesce           = ixgbe_get_coalesce,
index bea94e5ccb730a7f0a15075ac18dac72a0c04945..09df67f03cf470315a3057f061231cdf1cdabaa0 100644 (file)
@@ -223,6 +223,7 @@ enum ixgbe_aci_opc {
        ixgbe_aci_opc_write_mdio                        = 0x06E5,
        ixgbe_aci_opc_set_gpio_by_func                  = 0x06E6,
        ixgbe_aci_opc_get_gpio_by_func                  = 0x06E7,
+       ixgbe_aci_opc_set_port_id_led                   = 0x06E9,
        ixgbe_aci_opc_set_gpio                          = 0x06EC,
        ixgbe_aci_opc_get_gpio                          = 0x06ED,
        ixgbe_aci_opc_sff_eeprom                        = 0x06EE,
@@ -808,6 +809,18 @@ struct ixgbe_aci_cmd_get_link_topo_pin {
        u8 rsvd[7];
 };
 
+/* Set Port Identification LED (direct, 0x06E9) */
+struct ixgbe_aci_cmd_set_port_id_led {
+       u8 lport_num;
+       u8 lport_num_valid;
+       u8 ident_mode;
+       u8 rsvd[13];
+};
+
+#define IXGBE_ACI_PORT_ID_PORT_NUM_VALID       BIT(0)
+#define IXGBE_ACI_PORT_IDENT_LED_ORIG          0
+#define IXGBE_ACI_PORT_IDENT_LED_BLINK         BIT(0)
+
 /* Read/Write SFF EEPROM command (indirect 0x06EE) */
 struct ixgbe_aci_cmd_sff_eeprom {
        u8 lport_num;
@@ -985,6 +998,7 @@ struct ixgbe_aci_desc {
                struct ixgbe_aci_cmd_restart_an restart_an;
                struct ixgbe_aci_cmd_get_link_status get_link_status;
                struct ixgbe_aci_cmd_set_event_mask set_event_mask;
+               struct ixgbe_aci_cmd_set_port_id_led set_port_id_led;
                struct ixgbe_aci_cmd_get_link_topo get_link_topo;
                struct ixgbe_aci_cmd_get_link_topo_pin get_link_topo_pin;
                struct ixgbe_aci_cmd_sff_eeprom read_write_sff_param;