svn commit: r329202 - in stable/11/sys/dev/mlx5: . mlx5_core
Hans Petter Selasky
hselasky at FreeBSD.org
Tue Feb 13 14:46:30 UTC 2018
Author: hselasky
Date: Tue Feb 13 14:46:29 2018
New Revision: 329202
URL: https://svnweb.freebsd.org/changeset/base/329202
Log:
MFC r325656:
Add API functions to query and modify local loopback of multicast and
unicast traffic in mlx5 core.
Sponsored by: Mellanox Technologies
Modified:
stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c
stable/11/sys/dev/mlx5/vport.h
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c Tue Feb 13 14:45:05 2018 (r329201)
+++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c Tue Feb 13 14:46:29 2018 (r329202)
@@ -1485,6 +1485,72 @@ int mlx5_modify_nic_vport_promisc(struct mlx5_core_dev
}
EXPORT_SYMBOL_GPL(mlx5_modify_nic_vport_promisc);
+int mlx5_nic_vport_modify_local_lb(struct mlx5_core_dev *mdev,
+ enum mlx5_local_lb_selection selection,
+ u8 value)
+{
+ void *in;
+ int inlen = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in);
+ int err;
+
+ in = mlx5_vzalloc(inlen);
+ if (!in) {
+ mlx5_core_warn(mdev, "failed to allocate inbox\n");
+ return -ENOMEM;
+ }
+
+ MLX5_SET(modify_nic_vport_context_in, in, vport_number, 0);
+
+ if (selection == MLX5_LOCAL_MC_LB) {
+ MLX5_SET(modify_nic_vport_context_in, in,
+ field_select.disable_mc_local_lb, 1);
+ MLX5_SET(modify_nic_vport_context_in, in,
+ nic_vport_context.disable_mc_local_lb,
+ value);
+ } else {
+ MLX5_SET(modify_nic_vport_context_in, in,
+ field_select.disable_uc_local_lb, 1);
+ MLX5_SET(modify_nic_vport_context_in, in,
+ nic_vport_context.disable_uc_local_lb,
+ value);
+ }
+
+ err = mlx5_modify_nic_vport_context(mdev, in, inlen);
+
+ kvfree(in);
+ return err;
+}
+EXPORT_SYMBOL_GPL(mlx5_nic_vport_modify_local_lb);
+
+int mlx5_nic_vport_query_local_lb(struct mlx5_core_dev *mdev,
+ enum mlx5_local_lb_selection selection,
+ u8 *value)
+{
+ void *out;
+ int outlen = MLX5_ST_SZ_BYTES(query_nic_vport_context_out);
+ int err;
+
+ out = kzalloc(outlen, GFP_KERNEL);
+ if (!out)
+ return -ENOMEM;
+
+ err = mlx5_query_nic_vport_context(mdev, 0, out, outlen);
+ if (err)
+ goto done;
+
+ if (selection == MLX5_LOCAL_MC_LB)
+ *value = MLX5_GET(query_nic_vport_context_out, out,
+ nic_vport_context.disable_mc_local_lb);
+ else
+ *value = MLX5_GET(query_nic_vport_context_out, out,
+ nic_vport_context.disable_uc_local_lb);
+
+done:
+ kfree(out);
+ return err;
+}
+EXPORT_SYMBOL_GPL(mlx5_nic_vport_query_local_lb);
+
int mlx5_query_vport_counter(struct mlx5_core_dev *dev,
u8 port_num, u16 vport_num,
void *out, int out_size)
Modified: stable/11/sys/dev/mlx5/vport.h
==============================================================================
--- stable/11/sys/dev/mlx5/vport.h Tue Feb 13 14:45:05 2018 (r329201)
+++ stable/11/sys/dev/mlx5/vport.h Tue Feb 13 14:46:29 2018 (r329202)
@@ -41,7 +41,17 @@ int mlx5_vport_query_q_counter(struct mlx5_core_dev *m
int mlx5_vport_query_out_of_rx_buffer(struct mlx5_core_dev *mdev,
u16 counter_set_id,
u32 *out_of_rx_buffer);
+enum mlx5_local_lb_selection {
+ MLX5_LOCAL_MC_LB,
+ MLX5_LOCAL_UC_LB
+};
+int mlx5_nic_vport_query_local_lb(struct mlx5_core_dev *mdev,
+ enum mlx5_local_lb_selection selection,
+ u8 *value);
+int mlx5_nic_vport_modify_local_lb(struct mlx5_core_dev *mdev,
+ enum mlx5_local_lb_selection selection,
+ u8 value);
u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport);
u8 mlx5_query_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod,
u16 vport);
More information about the svn-src-stable
mailing list