@@ -233,7 +233,8 @@ mlx5_devlink_port_supported(const struct mlx5_core_dev *dev,
{
return vport->vport == MLX5_VPORT_UPLINK ||
vport->vport == MLX5_VPORT_PF ||
- mlx5_eswitch_is_vf_vport(dev->priv.eswitch, vport->vport);
+ mlx5_eswitch_is_vf_vport(dev->priv.eswitch, vport->vport) ||
+ mlx5_eswitch_is_sf_vport(dev->priv.eswitch, vport->vport);
}
static unsigned int
@@ -280,6 +281,11 @@ int mlx5_devlink_port_register(struct mlx5_core_dev *dev,
&ppid.id[0], ppid.id_len,
dev->pdev->devfn,
vport->vport - 1);
+ else if (mlx5_eswitch_is_sf_vport(dev->priv.eswitch, vport->vport))
+ devlink_port_attrs_mdev_set(&vport->dl_port,
+ &ppid.id[0], ppid.id_len,
+ vport->port_alias);
+
return devlink_port_register(devlink, &vport->dl_port, dl_port_index);
}
@@ -141,6 +141,7 @@ struct mlx5_vport {
bool enabled;
enum mlx5_eswitch_vport_event enabled_events;
struct devlink_port dl_port;
+ const char *port_alias; /* Applicable Only for SF vport */
};
enum offloads_fdb_flags {
@@ -308,7 +309,8 @@ int mlx5_eswitch_vport_enable_qos(struct mlx5_eswitch *esw,
u32 initial_max_rate, u32 initial_bw_share);
void mlx5_eswitch_vport_disable_qos(struct mlx5_eswitch *esw,
struct mlx5_vport *vport);
-int mlx5_eswitch_setup_sf_vport(struct mlx5_eswitch *esw, u16 vport_num);
+int mlx5_eswitch_setup_sf_vport(struct mlx5_eswitch *esw, u16 vport_num,
+ const char *port_alias);
void mlx5_eswitch_cleanup_sf_vport(struct mlx5_eswitch *esw, u16 vport_num);
void mlx5_eswitch_del_send_to_vport_rule(struct mlx5_flow_handle *rule);
@@ -1706,7 +1706,8 @@ esw_disable_sf_vport(struct mlx5_eswitch *esw, struct mlx5_vport *vport)
esw_vport_destroy_offloads_acl_tables(esw, vport);
}
-int mlx5_eswitch_setup_sf_vport(struct mlx5_eswitch *esw, u16 vport_num)
+int mlx5_eswitch_setup_sf_vport(struct mlx5_eswitch *esw, u16 vport_num,
+ const char *port_alias)
{
struct mlx5_vport *vport = mlx5_eswitch_get_vport(esw, vport_num);
int ret;
@@ -1718,6 +1719,8 @@ int mlx5_eswitch_setup_sf_vport(struct mlx5_eswitch *esw, u16 vport_num)
if (ret)
return ret;
+ vport->port_alias = port_alias;
+
ret = esw_offloads_load_vport_reps(esw, vport_num);
if (ret)
esw_disable_sf_vport(esw, vport);
@@ -9,6 +9,8 @@
#include "meddev/sf.h"
#include "eswitch.h"
+#define MLX5_MEDDEV_ALIAS_LEN 12
+
struct mlx5_mdev_table {
struct mlx5_sf_table sf_table;
/* Synchronizes with mdev table cleanup check and mdev creation. */
@@ -87,7 +89,8 @@ static int mlx5_meddev_create(struct kobject *kobj, struct mdev_device *meddev)
return -ENODEV;
}
- sf = mlx5_sf_alloc(parent_coredev, &table->sf_table, mdev_dev(meddev));
+ sf = mlx5_sf_alloc(parent_coredev, &table->sf_table, mdev_dev(meddev),
+ mdev_alias(meddev));
if (IS_ERR(sf)) {
ret = PTR_ERR(sf);
goto sf_err;
@@ -111,9 +114,15 @@ static int mlx5_meddev_remove(struct mdev_device *meddev)
return 0;
}
+static unsigned int mlx5_meddev_get_alias_length(void)
+{
+ return MLX5_MEDDEV_ALIAS_LEN;
+}
+
static const struct mdev_parent_ops mlx5_meddev_ops = {
.create = mlx5_meddev_create,
.remove = mlx5_meddev_remove,
+ .get_alias_length = mlx5_meddev_get_alias_length,
.supported_type_groups = mlx5_meddev_groups,
};
@@ -126,7 +126,7 @@ static u16 mlx5_sf_hw_id(const struct mlx5_core_dev *coredev, u16 sf_id)
/* Perform SF allocation using parent device BAR. */
struct mlx5_sf *
mlx5_sf_alloc(struct mlx5_core_dev *coredev, struct mlx5_sf_table *sf_table,
- struct device *dev)
+ struct device *dev, const char *port_alias)
{
struct mlx5_sf *sf;
u16 hw_function_id;
@@ -150,7 +150,8 @@ mlx5_sf_alloc(struct mlx5_core_dev *coredev, struct mlx5_sf_table *sf_table,
if (ret)
goto enable_err;
- ret = mlx5_eswitch_setup_sf_vport(coredev->priv.eswitch, hw_function_id);
+ ret = mlx5_eswitch_setup_sf_vport(coredev->priv.eswitch,
+ hw_function_id, port_alias);
if (ret)
goto vport_err;
@@ -42,7 +42,7 @@ void mlx5_sf_table_cleanup(struct mlx5_core_dev *dev,
struct mlx5_sf *
mlx5_sf_alloc(struct mlx5_core_dev *coredev, struct mlx5_sf_table *sf_table,
- struct device *dev);
+ struct device *dev, const char *port_alias);
void mlx5_sf_free(struct mlx5_core_dev *coredev, struct mlx5_sf_table *sf_table,
struct mlx5_sf *sf);
u16 mlx5_core_max_sfs(const struct mlx5_core_dev *dev,