Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (c) 2013-2015, Mellanox Technologies, Ltd.  All rights reserved.
0003  *
0004  * This software is available to you under a choice of one of two
0005  * licenses.  You may choose to be licensed under the terms of the GNU
0006  * General Public License (GPL) Version 2, available from the file
0007  * COPYING in the main directory of this source tree, or the
0008  * OpenIB.org BSD license below:
0009  *
0010  *     Redistribution and use in source and binary forms, with or
0011  *     without modification, are permitted provided that the following
0012  *     conditions are met:
0013  *
0014  *      - Redistributions of source code must retain the above
0015  *        copyright notice, this list of conditions and the following
0016  *        disclaimer.
0017  *
0018  *      - Redistributions in binary form must reproduce the above
0019  *        copyright notice, this list of conditions and the following
0020  *        disclaimer in the documentation and/or other materials
0021  *        provided with the distribution.
0022  *
0023  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0024  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0025  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
0026  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
0027  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
0028  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
0029  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
0030  * SOFTWARE.
0031  */
0032 
0033 #ifndef __MLX5_VPORT_H__
0034 #define __MLX5_VPORT_H__
0035 
0036 #include <linux/mlx5/driver.h>
0037 #include <linux/mlx5/device.h>
0038 
0039 #define MLX5_VPORT_MANAGER(mdev)                    \
0040     (MLX5_CAP_GEN(mdev, vport_group_manager) &&         \
0041      (MLX5_CAP_GEN(mdev, port_type) == MLX5_CAP_PORT_TYPE_ETH) &&   \
0042      mlx5_core_is_pf(mdev))
0043 
0044 enum {
0045     MLX5_CAP_INLINE_MODE_L2,
0046     MLX5_CAP_INLINE_MODE_VPORT_CONTEXT,
0047     MLX5_CAP_INLINE_MODE_NOT_REQUIRED,
0048 };
0049 
0050 /* Vport number for each function must keep unchanged */
0051 enum {
0052     MLX5_VPORT_PF           = 0x0,
0053     MLX5_VPORT_FIRST_VF     = 0x1,
0054     MLX5_VPORT_ECPF         = 0xfffe,
0055     MLX5_VPORT_UPLINK       = 0xffff
0056 };
0057 
0058 u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport);
0059 int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod,
0060                   u16 vport, u8 other_vport, u8 state);
0061 int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev,
0062                      u16 vport, bool other, u8 *addr);
0063 int mlx5_query_mac_address(struct mlx5_core_dev *mdev, u8 *addr);
0064 int mlx5_query_nic_vport_min_inline(struct mlx5_core_dev *mdev,
0065                     u16 vport, u8 *min_inline);
0066 void mlx5_query_min_inline(struct mlx5_core_dev *mdev, u8 *min_inline);
0067 int mlx5_modify_nic_vport_min_inline(struct mlx5_core_dev *mdev,
0068                      u16 vport, u8 min_inline);
0069 int mlx5_modify_nic_vport_mac_address(struct mlx5_core_dev *dev,
0070                       u16 vport, const u8 *addr);
0071 int mlx5_query_nic_vport_mtu(struct mlx5_core_dev *mdev, u16 *mtu);
0072 int mlx5_modify_nic_vport_mtu(struct mlx5_core_dev *mdev, u16 mtu);
0073 int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev,
0074                        u64 *system_image_guid);
0075 int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid);
0076 int mlx5_modify_nic_vport_node_guid(struct mlx5_core_dev *mdev,
0077                     u16 vport, u64 node_guid);
0078 int mlx5_query_nic_vport_qkey_viol_cntr(struct mlx5_core_dev *mdev,
0079                     u16 *qkey_viol_cntr);
0080 int mlx5_query_hca_vport_gid(struct mlx5_core_dev *dev, u8 other_vport,
0081                  u8 port_num, u16  vf_num, u16 gid_index,
0082                  union ib_gid *gid);
0083 int mlx5_query_hca_vport_pkey(struct mlx5_core_dev *dev, u8 other_vport,
0084                   u8 port_num, u16 vf_num, u16 pkey_index,
0085                   u16 *pkey);
0086 int mlx5_query_hca_vport_context(struct mlx5_core_dev *dev,
0087                  u8 other_vport, u8 port_num,
0088                  u16 vf_num,
0089                  struct mlx5_hca_vport_context *rep);
0090 int mlx5_query_hca_vport_system_image_guid(struct mlx5_core_dev *dev,
0091                        u64 *sys_image_guid);
0092 int mlx5_query_hca_vport_node_guid(struct mlx5_core_dev *dev,
0093                    u64 *node_guid);
0094 int mlx5_query_nic_vport_mac_list(struct mlx5_core_dev *dev,
0095                   u16 vport,
0096                   enum mlx5_list_type list_type,
0097                   u8 addr_list[][ETH_ALEN],
0098                   int *list_size);
0099 int mlx5_modify_nic_vport_mac_list(struct mlx5_core_dev *dev,
0100                    enum mlx5_list_type list_type,
0101                    u8 addr_list[][ETH_ALEN],
0102                    int list_size);
0103 int mlx5_query_nic_vport_promisc(struct mlx5_core_dev *mdev,
0104                  u16 vport,
0105                  int *promisc_uc,
0106                  int *promisc_mc,
0107                  int *promisc_all);
0108 int mlx5_modify_nic_vport_promisc(struct mlx5_core_dev *mdev,
0109                   int promisc_uc,
0110                   int promisc_mc,
0111                   int promisc_all);
0112 int mlx5_modify_nic_vport_vlans(struct mlx5_core_dev *dev,
0113                 u16 vlans[],
0114                 int list_size);
0115 
0116 int mlx5_nic_vport_enable_roce(struct mlx5_core_dev *mdev);
0117 int mlx5_nic_vport_disable_roce(struct mlx5_core_dev *mdev);
0118 int mlx5_query_vport_down_stats(struct mlx5_core_dev *mdev, u16 vport,
0119                 u8 other_vport, u64 *rx_discard_vport_down,
0120                 u64 *tx_discard_vport_down);
0121 int mlx5_core_query_vport_counter(struct mlx5_core_dev *dev, u8 other_vport,
0122                   int vf, u8 port_num, void *out);
0123 int mlx5_core_modify_hca_vport_context(struct mlx5_core_dev *dev,
0124                        u8 other_vport, u8 port_num,
0125                        int vf,
0126                        struct mlx5_hca_vport_context *req);
0127 int mlx5_nic_vport_update_local_lb(struct mlx5_core_dev *mdev, bool enable);
0128 int mlx5_nic_vport_query_local_lb(struct mlx5_core_dev *mdev, bool *status);
0129 
0130 int mlx5_nic_vport_affiliate_multiport(struct mlx5_core_dev *master_mdev,
0131                        struct mlx5_core_dev *port_mdev);
0132 int mlx5_nic_vport_unaffiliate_multiport(struct mlx5_core_dev *port_mdev);
0133 
0134 u64 mlx5_query_nic_system_image_guid(struct mlx5_core_dev *mdev);
0135 #endif /* __MLX5_VPORT_H__ */