Skip to content

Commit

Permalink
hw-mgmt: kernel patches: 4.19: mlxsw: minimal: Add support for line c…
Browse files Browse the repository at this point in the history
…ard event handling

Extend "minimal" driver with interrupt handler to support line card
initialization and de-initialization events.

It provides support for Nvidia modular Ethernet switch system, which is
equipped with Spectrum-3 chip and with programmable devices with logic
providing system control.

It could be also relevant for the vendors which build its own system,
equipped with Nvidia Spectrum-3 chip and with programmable device or
devices implementing the same logic.

This logic includes interrupt controller for line card related events.
Whenever any event is happened, the relevant signal is raised to CPU.
These events are associated with a number of line card states, like
line card insertion and removing, security validation, powering on and
off, enabling (release from reset) and disabling (hold in reset),
firmware active and inactive. The final event in initialization flow is
firmware active. And it indicates that firmware is fully prepared for
line card ports handling.

When "active event" is received for particular line card, its network,
hardware monitoring and thermal interfaces should be configured
according to the configuration obtained from the firmware. When
opposite "inactive event" is received all the above interfaces should
be teared down.

It is important to note that there are two different flows for line
card configuration. The first one is for "spectrum" driver working over
PCIe bus and running on host CPU. The second one is for "minimal"
driver working over I2C bus, which could be running on host CPU or on
Baseboard Management Controller (BMC).

Within the first flow "active event" and "inactive event" raised to CPU
directly from the Spectrum chip firmware in form of a trap
notification. Such trapping mechanism required Ethernet Management
Datagrams support from the driver. For the second flow this mechanism
is not available, since it does not supported over I2C bus.

The only way to deliver these events to "minimal" driver is to route
them from the Spectrum chip firmware to system programmable device,
which in their turn will generate relevant signal to CPU.

The purpose of "minimal" driver interrupt handler is to handle these
signals and invoke related APIs: mlxsw_core_line_card_init() for
"active event" and mlxsw_core_line_card_fini() for "inactive event",
while "active event" / "inactive event" are detected through PRM
Management DownStream Device Query Register

This interrupt handler shares physical interrupt line with system
interrupt handler, implemented in programmable device logic:
17:	0	...	0	IR-IO-APIC  17-fasteoi mlxreg-hotplug,
mlxsw-minimal

Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
  • Loading branch information
vadimp-nvidia committed Feb 25, 2021
1 parent 440eae6 commit 99573cb
Showing 1 changed file with 8 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From f816455d6a407c6c044a93fd6db623f87ef522f5 Mon Sep 17 00:00:00 2001
From 7b75504108f0cda8218677d452f0cb7d605675ba Mon Sep 17 00:00:00 2001
From: Vadim Pasternak <vadimp@nvidia.com>
Date: Thu, 25 Feb 2021 10:55:01 +0200
Subject: [PATCH backport 4.19 5/5] mlxsw: minimal: Add support for line card
Date: Thu, 25 Feb 2021 22:46:51 +0200
Subject: [PATCH backport 4.19 1/1] mlxsw: minimal: Add support for line card
event handling

Extend "minimal" driver with interrupt handler to support line card
Expand Down Expand Up @@ -62,8 +62,8 @@ Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
drivers/net/ethernet/mellanox/mlxsw/core.c | 3 +-
drivers/net/ethernet/mellanox/mlxsw/core.h | 4 +-
drivers/net/ethernet/mellanox/mlxsw/i2c.c | 84 ++++++++++++++++++++++++++-
drivers/net/ethernet/mellanox/mlxsw/minimal.c | 32 ++++++----
4 files changed, 110 insertions(+), 13 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/minimal.c | 21 +++++++
4 files changed, 109 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c
index ed34c54bf71e..2013423bd602 100644
Expand Down Expand Up @@ -252,29 +252,10 @@ index e04d521d9376..10754f704c7d 100644
mutex_destroy(&mlxsw_i2c->cmd.lock);

diff --git a/drivers/net/ethernet/mellanox/mlxsw/minimal.c b/drivers/net/ethernet/mellanox/mlxsw/minimal.c
index 1623f827f36e..c9024d3e2ba6 100644
index 1623f827f36e..83bbd44a2971 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/minimal.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/minimal.c
@@ -228,18 +228,8 @@ static void mlxsw_m_port_remove(struct mlxsw_m_area *mlxsw_m_area, u8 local_port

static int mlxsw_m_ports_create(struct mlxsw_m_area *mlxsw_m_area, u8 slot_index)
{
- char mgpir_pl[MLXSW_REG_MGPIR_LEN];
int i, err;

- mlxsw_reg_mgpir_pack(mgpir_pl, slot_index);
- err = mlxsw_reg_query(mlxsw_m_area->mlxsw_m->core, MLXSW_REG(mgpir),
- mgpir_pl);
- if (err)
- return err;
-
- mlxsw_reg_mgpir_unpack(mgpir_pl, NULL, NULL, NULL,
- &mlxsw_m_area->max_ports, NULL);
-
if (!mlxsw_m_area->max_ports)
return 0;

@@ -287,10 +277,31 @@ static void mlxsw_m_ports_remove(struct mlxsw_m_area *mlxsw_m_area)
@@ -287,6 +287,26 @@ static void mlxsw_m_ports_remove(struct mlxsw_m_area *mlxsw_m_area)
kfree(mlxsw_m_area->ports);
}

Expand All @@ -301,12 +282,7 @@ index 1623f827f36e..c9024d3e2ba6 100644
static int mlxsw_m_init(struct mlxsw_core *mlxsw_core,
const struct mlxsw_bus_info *mlxsw_bus_info)
{
struct mlxsw_m *mlxsw_m = mlxsw_core_driver_priv(mlxsw_core);
+ char mgpir_pl[MLXSW_REG_MGPIR_LEN];
int err;

mlxsw_m->main = kzalloc(sizeof(*mlxsw_m->main), GFP_KERNEL);
@@ -328,6 +339,7 @@ static struct mlxsw_driver mlxsw_m_driver = {
@@ -328,6 +348,7 @@ static struct mlxsw_driver mlxsw_m_driver = {
.priv_size = sizeof(struct mlxsw_m),
.init = mlxsw_m_init,
.fini = mlxsw_m_fini,
Expand Down

0 comments on commit 99573cb

Please sign in to comment.