svn commit: r325656 - in head/sys/dev/mlx5: . mlx5_core
Hans Petter Selasky
hselasky at FreeBSD.org
Fri Nov 10 13:56:12 UTC 2017
Author: hselasky
Date: Fri Nov 10 13:56:11 2017
New Revision: 325656
URL: https://svnweb.freebsd.org/changeset/base/325656
Log:
Add API functions to query and modify local loopback of multicast and
unicast traffic in mlx5 core.
Sponsored by: Mellanox Technologies
MFC after: 1 week
Modified:
head/sys/dev/mlx5/mlx5_core/mlx5_vport.c
head/sys/dev/mlx5/vport.h
Modified: head/sys/dev/mlx5/mlx5_core/mlx5_vport.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_core/mlx5_vport.c Fri Nov 10 13:53:53 2017 (r325655)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_vport.c Fri Nov 10 13:56:11 2017 (r325656)
@@ -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: head/sys/dev/mlx5/vport.h
==============================================================================
--- head/sys/dev/mlx5/vport.h Fri Nov 10 13:53:53 2017 (r325655)
+++ head/sys/dev/mlx5/vport.h Fri Nov 10 13:56:11 2017 (r325656)
@@ -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-all
mailing list