You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
171 lines
5.7 KiB
171 lines
5.7 KiB
From 5d842119dc4566fe1d548b21a6a212e33c8eeb01 Mon Sep 17 00:00:00 2001
|
|
From: Igor Russkikh <irusskik@redhat.com>
|
|
Date: Fri, 6 Nov 2020 18:37:00 -0500
|
|
Subject: [PATCH 043/139] [netdrv] net: atlantic: adding ethtool physical
|
|
identification
|
|
|
|
Message-id: <1604687916-15087-44-git-send-email-irusskik@redhat.com>
|
|
Patchwork-id: 338468
|
|
Patchwork-instance: patchwork
|
|
O-Subject: [RHEL8.4 BZ 1857861 043/139] net: atlantic: adding ethtool physical identification
|
|
Bugzilla: 1857861
|
|
RH-Acked-by: David Arcari <darcari@redhat.com>
|
|
RH-Acked-by: John Linville <linville@redhat.com>
|
|
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
|
|
|
|
Bugzilla: http://bugzilla.redhat.com/1857861
|
|
|
|
commit d1287ce4ffa1d1f121571ce90ed7ebd410e31a21
|
|
Author: Nikita Danilov <ndanilov@marvell.com>
|
|
Date: Thu Nov 7 22:41:55 2019 +0000
|
|
|
|
net: atlantic: adding ethtool physical identification
|
|
|
|
`ethtool -p eth0` will blink leds helping identify
|
|
physical port.
|
|
|
|
Signed-off-by: Nikita Danilov <ndanilov@marvell.com>
|
|
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
|
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
|
|
Signed-off-by: Igor Russkikh <irusskik@redhat.com>
|
|
|
|
Cc: David Arcari <darcari@redhat.com>
|
|
Cc: Igor Russkikh <irusskik@redhat.com>
|
|
Signed-off-by: Jan Stancek <jstancek@redhat.com>
|
|
---
|
|
.../net/ethernet/aquantia/atlantic/aq_ethtool.c | 30 ++++++++++++++++++++++
|
|
drivers/net/ethernet/aquantia/atlantic/aq_hw.h | 5 ++++
|
|
.../aquantia/atlantic/hw_atl/hw_atl_utils.c | 1 +
|
|
.../aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c | 14 ++++++++++
|
|
4 files changed, 50 insertions(+)
|
|
|
|
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
|
|
index 5be273892430..2f877fb46615 100644
|
|
--- a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
|
|
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
|
|
@@ -153,6 +153,35 @@ static void aq_ethtool_get_strings(struct net_device *ndev,
|
|
}
|
|
}
|
|
|
|
+static int aq_ethtool_set_phys_id(struct net_device *ndev,
|
|
+ enum ethtool_phys_id_state state)
|
|
+{
|
|
+ struct aq_nic_s *aq_nic = netdev_priv(ndev);
|
|
+ struct aq_hw_s *hw = aq_nic->aq_hw;
|
|
+ int ret = 0;
|
|
+
|
|
+ if (!aq_nic->aq_fw_ops->led_control)
|
|
+ return -EOPNOTSUPP;
|
|
+
|
|
+ mutex_lock(&aq_nic->fwreq_mutex);
|
|
+
|
|
+ switch (state) {
|
|
+ case ETHTOOL_ID_ACTIVE:
|
|
+ ret = aq_nic->aq_fw_ops->led_control(hw, AQ_HW_LED_BLINK |
|
|
+ AQ_HW_LED_BLINK << 2 | AQ_HW_LED_BLINK << 4);
|
|
+ break;
|
|
+ case ETHTOOL_ID_INACTIVE:
|
|
+ ret = aq_nic->aq_fw_ops->led_control(hw, AQ_HW_LED_DEFAULT);
|
|
+ break;
|
|
+ default:
|
|
+ break;
|
|
+ }
|
|
+
|
|
+ mutex_unlock(&aq_nic->fwreq_mutex);
|
|
+
|
|
+ return ret;
|
|
+}
|
|
+
|
|
static int aq_ethtool_get_sset_count(struct net_device *ndev, int stringset)
|
|
{
|
|
int ret = 0;
|
|
@@ -627,6 +656,7 @@ const struct ethtool_ops aq_ethtool_ops = {
|
|
.get_regs = aq_ethtool_get_regs,
|
|
.get_drvinfo = aq_ethtool_get_drvinfo,
|
|
.get_strings = aq_ethtool_get_strings,
|
|
+ .set_phys_id = aq_ethtool_set_phys_id,
|
|
.get_rxfh_indir_size = aq_ethtool_get_rss_indir_size,
|
|
.get_wol = aq_ethtool_get_wol,
|
|
.set_wol = aq_ethtool_set_wol,
|
|
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_hw.h b/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
|
|
index a5cf6e02d4f6..ce4b8db03882 100644
|
|
--- a/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
|
|
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
|
|
@@ -119,6 +119,9 @@ struct aq_stats_s {
|
|
#define AQ_HW_TXD_MULTIPLE 8U
|
|
#define AQ_HW_RXD_MULTIPLE 8U
|
|
|
|
+#define AQ_HW_LED_BLINK 0x2U
|
|
+#define AQ_HW_LED_DEFAULT 0x0U
|
|
+
|
|
struct aq_hw_s {
|
|
atomic_t flags;
|
|
u8 rbl_enabled:1;
|
|
@@ -304,6 +307,8 @@ struct aq_fw_ops {
|
|
|
|
int (*set_flow_control)(struct aq_hw_s *self);
|
|
|
|
+ int (*led_control)(struct aq_hw_s *self, u32 mode);
|
|
+
|
|
int (*set_power)(struct aq_hw_s *self, unsigned int power_state,
|
|
u8 *mac);
|
|
|
|
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
|
|
index fd2c6be4e22e..fc82ede18b20 100644
|
|
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
|
|
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
|
|
@@ -970,4 +970,5 @@ const struct aq_fw_ops aq_fw_1x_ops = {
|
|
.set_flow_control = NULL,
|
|
.send_fw_request = NULL,
|
|
.enable_ptp = NULL,
|
|
+ .led_control = NULL,
|
|
};
|
|
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c
|
|
index 9b89622fa5d4..4eab51b5b400 100644
|
|
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c
|
|
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c
|
|
@@ -17,6 +17,7 @@
|
|
#include "hw_atl_utils.h"
|
|
#include "hw_atl_llh.h"
|
|
|
|
+#define HW_ATL_FW2X_MPI_LED_ADDR 0x31c
|
|
#define HW_ATL_FW2X_MPI_RPC_ADDR 0x334
|
|
|
|
#define HW_ATL_FW2X_MPI_MBOX_ADDR 0x360
|
|
@@ -51,6 +52,8 @@
|
|
#define HAL_ATLANTIC_WOL_FILTERS_COUNT 8
|
|
#define HAL_ATLANTIC_UTILS_FW2X_MSG_WOL 0x0E
|
|
|
|
+#define HW_ATL_FW_VER_LED 0x03010026U
|
|
+
|
|
struct __packed fw2x_msg_wol_pattern {
|
|
u8 mask[16];
|
|
u32 crc;
|
|
@@ -450,6 +453,16 @@ static void aq_fw3x_enable_ptp(struct aq_hw_s *self, int enable)
|
|
aq_hw_write_reg(self, HW_ATL_FW3X_EXT_CONTROL_ADDR, ptp_opts);
|
|
}
|
|
|
|
+static int aq_fw2x_led_control(struct aq_hw_s *self, u32 mode)
|
|
+{
|
|
+ if (self->fw_ver_actual < HW_ATL_FW_VER_LED)
|
|
+ return -EOPNOTSUPP;
|
|
+
|
|
+ aq_hw_write_reg(self, HW_ATL_FW2X_MPI_LED_ADDR, mode);
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
static int aq_fw2x_set_eee_rate(struct aq_hw_s *self, u32 speed)
|
|
{
|
|
u32 mpi_opts = aq_hw_read_reg(self, HW_ATL_FW2X_MPI_CONTROL2_ADDR);
|
|
@@ -557,4 +570,5 @@ const struct aq_fw_ops aq_fw_2x_ops = {
|
|
.get_flow_control = aq_fw2x_get_flow_control,
|
|
.send_fw_request = aq_fw2x_send_fw_request,
|
|
.enable_ptp = aq_fw3x_enable_ptp,
|
|
+ .led_control = aq_fw2x_led_control,
|
|
};
|
|
--
|
|
2.13.6
|
|
|