Commit bf11485f authored by Patrisious Haddad's avatar Patrisious Haddad Committed by Leon Romanovsky

net/mlx5: Register mlx5e priv to devcom in MPV mode

If the device is in MPV mode, the ethernet driver would now register
to events from IB driver about core devices affiliation or
de-affiliation.

Use the key provided in said event to connect each mlx5e priv
instance to it's master counterpart, this way the ethernet driver
is now aware of who is his master core device and even more, such
as knowing if partner device has IPsec configured or not.
Signed-off-by: default avatarPatrisious Haddad <phaddad@nvidia.com>
Reviewed-by: default avatarMark Bloch <mbloch@nvidia.com>
Link: https://lore.kernel.org/r/279adfa0aa3a1957a339086f2c1739a50b8e4b68.1695296682.git.leon@kernel.orgSigned-off-by: default avatarLeon Romanovsky <leon@kernel.org>
parent 0d293714
...@@ -936,6 +936,7 @@ struct mlx5e_priv { ...@@ -936,6 +936,7 @@ struct mlx5e_priv {
struct mlx5e_htb *htb; struct mlx5e_htb *htb;
struct mlx5e_mqprio_rl *mqprio_rl; struct mlx5e_mqprio_rl *mqprio_rl;
struct dentry *dfs_root; struct dentry *dfs_root;
struct mlx5_devcom_comp_dev *devcom;
}; };
struct mlx5e_dev { struct mlx5e_dev {
......
...@@ -42,6 +42,8 @@ ...@@ -42,6 +42,8 @@
#define MLX5E_IPSEC_SADB_RX_BITS 10 #define MLX5E_IPSEC_SADB_RX_BITS 10
#define MLX5E_IPSEC_ESN_SCOPE_MID 0x80000000L #define MLX5E_IPSEC_ESN_SCOPE_MID 0x80000000L
#define MPV_DEVCOM_MASTER_UP 1
struct aes_gcm_keymat { struct aes_gcm_keymat {
u64 seq_iv; u64 seq_iv;
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
#include "en/htb.h" #include "en/htb.h"
#include "qos.h" #include "qos.h"
#include "en/trap.h" #include "en/trap.h"
#include "lib/devcom.h"
bool mlx5e_check_fragmented_striding_rq_cap(struct mlx5_core_dev *mdev, u8 page_shift, bool mlx5e_check_fragmented_striding_rq_cap(struct mlx5_core_dev *mdev, u8 page_shift,
enum mlx5e_mpwrq_umr_mode umr_mode) enum mlx5e_mpwrq_umr_mode umr_mode)
...@@ -178,6 +179,37 @@ static void mlx5e_disable_async_events(struct mlx5e_priv *priv) ...@@ -178,6 +179,37 @@ static void mlx5e_disable_async_events(struct mlx5e_priv *priv)
mlx5_notifier_unregister(priv->mdev, &priv->events_nb); mlx5_notifier_unregister(priv->mdev, &priv->events_nb);
} }
static int mlx5e_devcom_event_mpv(int event, void *my_data, void *event_data)
{
struct mlx5e_priv *slave_priv = my_data;
mlx5_devcom_comp_set_ready(slave_priv->devcom, true);
return 0;
}
static int mlx5e_devcom_init_mpv(struct mlx5e_priv *priv, u64 *data)
{
priv->devcom = mlx5_devcom_register_component(priv->mdev->priv.devc,
MLX5_DEVCOM_MPV,
*data,
mlx5e_devcom_event_mpv,
priv);
if (IS_ERR_OR_NULL(priv->devcom))
return -EOPNOTSUPP;
if (mlx5_core_is_mp_master(priv->mdev))
mlx5_devcom_send_event(priv->devcom, MPV_DEVCOM_MASTER_UP,
MPV_DEVCOM_MASTER_UP, priv);
return 0;
}
static void mlx5e_devcom_cleanup_mpv(struct mlx5e_priv *priv)
{
mlx5_devcom_unregister_component(priv->devcom);
}
static int blocking_event(struct notifier_block *nb, unsigned long event, void *data) static int blocking_event(struct notifier_block *nb, unsigned long event, void *data)
{ {
struct mlx5e_priv *priv = container_of(nb, struct mlx5e_priv, blocking_events_nb); struct mlx5e_priv *priv = container_of(nb, struct mlx5e_priv, blocking_events_nb);
...@@ -192,6 +224,13 @@ static int blocking_event(struct notifier_block *nb, unsigned long event, void * ...@@ -192,6 +224,13 @@ static int blocking_event(struct notifier_block *nb, unsigned long event, void *
return NOTIFY_BAD; return NOTIFY_BAD;
} }
break; break;
case MLX5_DRIVER_EVENT_AFFILIATION_DONE:
if (mlx5e_devcom_init_mpv(priv, data))
return NOTIFY_BAD;
break;
case MLX5_DRIVER_EVENT_AFFILIATION_REMOVED:
mlx5e_devcom_cleanup_mpv(priv);
break;
default: default:
return NOTIFY_DONE; return NOTIFY_DONE;
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
enum mlx5_devcom_component { enum mlx5_devcom_component {
MLX5_DEVCOM_ESW_OFFLOADS, MLX5_DEVCOM_ESW_OFFLOADS,
MLX5_DEVCOM_MPV,
MLX5_DEVCOM_NUM_COMPONENTS, MLX5_DEVCOM_NUM_COMPONENTS,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment