Commit 9728366f authored by Vu Pham's avatar Vu Pham Committed by Saeed Mahameed

net/mlx5e: Use change upper event to setup representors' bond_metadata

Use change upper event to detect slave representor from
enslaving/unslaving to/from lag device.

On enslaving event, call mlx5_enslave_rep() API to create, add
this slave representor shadow entry to the slaves list of
bond_metadata structure representing master lag device and use
its metadata to setup ingress acl metadata header.

On unslaving event, resetting the vport of unslaved representor
to use its default ingress/egress acls and rx rules with its
default_metadata.

The last slave will free the shared bond_metadata and its
unique metadata.
Signed-off-by: default avatarVu Pham <vuhuong@mellanox.com>
Reviewed-by: default avatarParav Pandit <parav@mellanox.com>
Reviewed-by: default avatarRoi Dayan <roid@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 88e96e53
......@@ -164,8 +164,13 @@ void mlx5e_rep_bond_unslave(struct mlx5_eswitch *esw,
priv = netdev_priv(netdev);
rpriv = priv->ppriv;
/* Reset bond_metadata to zero first then reset all ingress/egress
* acls and rx rules of unslave representor's vport
*/
mlx5_esw_acl_ingress_vport_bond_update(esw, rpriv->rep->vport, 0);
mlx5_esw_acl_egress_vport_unbond(esw, rpriv->rep->vport);
mlx5e_rep_bond_update(priv, false);
list_del(&s_entry->list);
netdev_dbg(netdev, "unslave rep vport(%d) lag_dev(%s) metadata(0x%x)\n",
......@@ -253,22 +258,23 @@ static void mlx5e_rep_changeupper_event(struct net_device *netdev, void *ptr)
{
struct netdev_notifier_changeupper_info *info = ptr;
struct mlx5e_rep_priv *rpriv;
struct net_device *lag_dev;
struct mlx5e_priv *priv;
if (!mlx5e_rep_is_lag_netdev(netdev))
return;
/* Nothing to setup for new enslaved representor */
if (info->linking)
return;
priv = netdev_priv(netdev);
rpriv = priv->ppriv;
netdev_dbg(netdev, "Unslave, reset vport(%d) egress acl\n", rpriv->rep->vport);
lag_dev = info->upper_dev;
/* Reset all egress acl rules of unslave representor's vport */
mlx5_esw_acl_egress_vport_unbond(priv->mdev->priv.eswitch,
rpriv->rep->vport);
netdev_dbg(netdev, "%sslave vport(%d) lag(%s)\n",
info->linking ? "en" : "un", rpriv->rep->vport, lag_dev->name);
if (info->linking)
mlx5e_rep_bond_enslave(priv->mdev->priv.eswitch, netdev, lag_dev);
else
mlx5e_rep_bond_unslave(priv->mdev->priv.eswitch, netdev, lag_dev);
}
/* Bond device of representors and netdev events are used here in specific way
......
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