From owner-svn-src-stable@freebsd.org Tue Feb 13 14:46:30 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D642F06084; Tue, 13 Feb 2018 14:46:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 367CC7BF3C; Tue, 13 Feb 2018 14:46:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E06E2225F; Tue, 13 Feb 2018 14:46:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1DEkTMR009477; Tue, 13 Feb 2018 14:46:29 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1DEkTtL009475; Tue, 13 Feb 2018 14:46:29 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802131446.w1DEkTtL009475@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 13 Feb 2018 14:46:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329202 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 329202 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 14:46:30 -0000 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);