Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ixgbe: add E610 .set_phys_id() callback implementation

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>

authored by

Jedrzej Jagielski and committed by
Tony Nguyen
4bf2d119 7f58648d

+65 -1
+29
drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
··· 1485 1485 } 1486 1486 1487 1487 /** 1488 + * ixgbe_aci_set_port_id_led - set LED value for the given port 1489 + * @hw: pointer to the HW struct 1490 + * @orig_mode: set LED original mode 1491 + * 1492 + * Set LED value for the given port (0x06E9) 1493 + * 1494 + * Return: the exit code of the operation. 1495 + */ 1496 + int ixgbe_aci_set_port_id_led(struct ixgbe_hw *hw, bool orig_mode) 1497 + { 1498 + struct ixgbe_aci_cmd_set_port_id_led *cmd; 1499 + struct ixgbe_aci_desc desc; 1500 + 1501 + cmd = &desc.params.set_port_id_led; 1502 + 1503 + ixgbe_fill_dflt_direct_cmd_desc(&desc, ixgbe_aci_opc_set_port_id_led); 1504 + 1505 + cmd->lport_num = (u8)hw->bus.func; 1506 + cmd->lport_num_valid = IXGBE_ACI_PORT_ID_PORT_NUM_VALID; 1507 + 1508 + if (orig_mode) 1509 + cmd->ident_mode = IXGBE_ACI_PORT_IDENT_LED_ORIG; 1510 + else 1511 + cmd->ident_mode = IXGBE_ACI_PORT_IDENT_LED_BLINK; 1512 + 1513 + return ixgbe_aci_send_cmd(hw, &desc, NULL, 0); 1514 + } 1515 + 1516 + /** 1488 1517 * ixgbe_get_media_type_e610 - Gets media type 1489 1518 * @hw: pointer to the HW struct 1490 1519 *
+1
drivers/net/ethernet/intel/ixgbe/ixgbe_e610.h
··· 36 36 struct ixgbe_link_status *link); 37 37 int ixgbe_aci_set_event_mask(struct ixgbe_hw *hw, u8 port_num, u16 mask); 38 38 int ixgbe_configure_lse(struct ixgbe_hw *hw, bool activate, u16 mask); 39 + int ixgbe_aci_set_port_id_led(struct ixgbe_hw *hw, bool orig_mode); 39 40 enum ixgbe_media_type ixgbe_get_media_type_e610(struct ixgbe_hw *hw); 40 41 int ixgbe_setup_link_e610(struct ixgbe_hw *hw, ixgbe_link_speed speed, 41 42 bool autoneg_wait);
+21 -1
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
··· 2491 2491 return 0; 2492 2492 } 2493 2493 2494 + static int ixgbe_set_phys_id_e610(struct net_device *netdev, 2495 + enum ethtool_phys_id_state state) 2496 + { 2497 + struct ixgbe_adapter *adapter = ixgbe_from_netdev(netdev); 2498 + bool led_active; 2499 + 2500 + switch (state) { 2501 + case ETHTOOL_ID_ACTIVE: 2502 + led_active = true; 2503 + break; 2504 + case ETHTOOL_ID_INACTIVE: 2505 + led_active = false; 2506 + break; 2507 + default: 2508 + return -EOPNOTSUPP; 2509 + } 2510 + 2511 + return ixgbe_aci_set_port_id_led(&adapter->hw, !led_active); 2512 + } 2513 + 2494 2514 static int ixgbe_get_coalesce(struct net_device *netdev, 2495 2515 struct ethtool_coalesce *ec, 2496 2516 struct kernel_ethtool_coalesce *kernel_coal, ··· 3776 3756 .set_msglevel = ixgbe_set_msglevel, 3777 3757 .self_test = ixgbe_diag_test, 3778 3758 .get_strings = ixgbe_get_strings, 3779 - .set_phys_id = ixgbe_set_phys_id, 3759 + .set_phys_id = ixgbe_set_phys_id_e610, 3780 3760 .get_sset_count = ixgbe_get_sset_count, 3781 3761 .get_ethtool_stats = ixgbe_get_ethtool_stats, 3782 3762 .get_coalesce = ixgbe_get_coalesce,
+14
drivers/net/ethernet/intel/ixgbe/ixgbe_type_e610.h
··· 223 223 ixgbe_aci_opc_write_mdio = 0x06E5, 224 224 ixgbe_aci_opc_set_gpio_by_func = 0x06E6, 225 225 ixgbe_aci_opc_get_gpio_by_func = 0x06E7, 226 + ixgbe_aci_opc_set_port_id_led = 0x06E9, 226 227 ixgbe_aci_opc_set_gpio = 0x06EC, 227 228 ixgbe_aci_opc_get_gpio = 0x06ED, 228 229 ixgbe_aci_opc_sff_eeprom = 0x06EE, ··· 809 808 u8 rsvd[7]; 810 809 }; 811 810 811 + /* Set Port Identification LED (direct, 0x06E9) */ 812 + struct ixgbe_aci_cmd_set_port_id_led { 813 + u8 lport_num; 814 + u8 lport_num_valid; 815 + u8 ident_mode; 816 + u8 rsvd[13]; 817 + }; 818 + 819 + #define IXGBE_ACI_PORT_ID_PORT_NUM_VALID BIT(0) 820 + #define IXGBE_ACI_PORT_IDENT_LED_ORIG 0 821 + #define IXGBE_ACI_PORT_IDENT_LED_BLINK BIT(0) 822 + 812 823 /* Read/Write SFF EEPROM command (indirect 0x06EE) */ 813 824 struct ixgbe_aci_cmd_sff_eeprom { 814 825 u8 lport_num; ··· 998 985 struct ixgbe_aci_cmd_restart_an restart_an; 999 986 struct ixgbe_aci_cmd_get_link_status get_link_status; 1000 987 struct ixgbe_aci_cmd_set_event_mask set_event_mask; 988 + struct ixgbe_aci_cmd_set_port_id_led set_port_id_led; 1001 989 struct ixgbe_aci_cmd_get_link_topo get_link_topo; 1002 990 struct ixgbe_aci_cmd_get_link_topo_pin get_link_topo_pin; 1003 991 struct ixgbe_aci_cmd_sff_eeprom read_write_sff_param;