Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (c) 2015, Mellanox Technologies. 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_FS_CMD_
0034 #define _MLX5_FS_CMD_
0035 
0036 #include "fs_core.h"
0037 
0038 struct mlx5_flow_cmds {
0039     int (*create_flow_table)(struct mlx5_flow_root_namespace *ns,
0040                  struct mlx5_flow_table *ft,
0041                  struct mlx5_flow_table_attr *ft_attr,
0042                  struct mlx5_flow_table *next_ft);
0043     int (*destroy_flow_table)(struct mlx5_flow_root_namespace *ns,
0044                   struct mlx5_flow_table *ft);
0045 
0046     int (*modify_flow_table)(struct mlx5_flow_root_namespace *ns,
0047                  struct mlx5_flow_table *ft,
0048                  struct mlx5_flow_table *next_ft);
0049 
0050     int (*create_flow_group)(struct mlx5_flow_root_namespace *ns,
0051                  struct mlx5_flow_table *ft,
0052                  u32 *in,
0053                  struct mlx5_flow_group *fg);
0054 
0055     int (*destroy_flow_group)(struct mlx5_flow_root_namespace *ns,
0056                   struct mlx5_flow_table *ft,
0057                   struct mlx5_flow_group *fg);
0058 
0059     int (*create_fte)(struct mlx5_flow_root_namespace *ns,
0060               struct mlx5_flow_table *ft,
0061               struct mlx5_flow_group *fg,
0062               struct fs_fte *fte);
0063 
0064     int (*update_fte)(struct mlx5_flow_root_namespace *ns,
0065               struct mlx5_flow_table *ft,
0066               struct mlx5_flow_group *fg,
0067               int modify_mask,
0068               struct fs_fte *fte);
0069 
0070     int (*delete_fte)(struct mlx5_flow_root_namespace *ns,
0071               struct mlx5_flow_table *ft,
0072               struct fs_fte *fte);
0073 
0074     int (*update_root_ft)(struct mlx5_flow_root_namespace *ns,
0075                   struct mlx5_flow_table *ft,
0076                   u32 underlay_qpn,
0077                   bool disconnect);
0078 
0079     int (*packet_reformat_alloc)(struct mlx5_flow_root_namespace *ns,
0080                      struct mlx5_pkt_reformat_params *params,
0081                      enum mlx5_flow_namespace_type namespace,
0082                      struct mlx5_pkt_reformat *pkt_reformat);
0083 
0084     void (*packet_reformat_dealloc)(struct mlx5_flow_root_namespace *ns,
0085                     struct mlx5_pkt_reformat *pkt_reformat);
0086 
0087     int (*modify_header_alloc)(struct mlx5_flow_root_namespace *ns,
0088                    u8 namespace, u8 num_actions,
0089                    void *modify_actions,
0090                    struct mlx5_modify_hdr *modify_hdr);
0091 
0092     void (*modify_header_dealloc)(struct mlx5_flow_root_namespace *ns,
0093                       struct mlx5_modify_hdr *modify_hdr);
0094 
0095     int (*set_peer)(struct mlx5_flow_root_namespace *ns,
0096             struct mlx5_flow_root_namespace *peer_ns);
0097 
0098     int (*create_ns)(struct mlx5_flow_root_namespace *ns);
0099     int (*destroy_ns)(struct mlx5_flow_root_namespace *ns);
0100     int (*create_match_definer)(struct mlx5_flow_root_namespace *ns,
0101                     u16 format_id, u32 *match_mask);
0102     int (*destroy_match_definer)(struct mlx5_flow_root_namespace *ns,
0103                      int definer_id);
0104 
0105     u32 (*get_capabilities)(struct mlx5_flow_root_namespace *ns,
0106                 enum fs_flow_table_type ft_type);
0107 };
0108 
0109 int mlx5_cmd_fc_alloc(struct mlx5_core_dev *dev, u32 *id);
0110 int mlx5_cmd_fc_bulk_alloc(struct mlx5_core_dev *dev,
0111                enum mlx5_fc_bulk_alloc_bitmask alloc_bitmask,
0112                u32 *id);
0113 int mlx5_cmd_fc_free(struct mlx5_core_dev *dev, u32 id);
0114 int mlx5_cmd_fc_query(struct mlx5_core_dev *dev, u32 id,
0115               u64 *packets, u64 *bytes);
0116 
0117 int mlx5_cmd_fc_get_bulk_query_out_len(int bulk_len);
0118 int mlx5_cmd_fc_bulk_query(struct mlx5_core_dev *dev, u32 base_id, int bulk_len,
0119                u32 *out);
0120 
0121 const struct mlx5_flow_cmds *mlx5_fs_cmd_get_default(enum fs_flow_table_type type);
0122 const struct mlx5_flow_cmds *mlx5_fs_cmd_get_fw_cmds(void);
0123 
0124 #endif