linux/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h

/*
 * Copyright (c) 2015, Mellanox Technologies. All rights reserved.
 *
 * This software is available to you under a choice of one of two
 * licenses.  You may choose to be licensed under the terms of the GNU
 * General Public License (GPL) Version 2, available from the file
 * COPYING in the main directory of this source tree, or the
 * OpenIB.org BSD license below:
 *
 *     Redistribution and use in source and binary forms, with or
 *     without modification, are permitted provided that the following
 *     conditions are met:
 *
 *      - Redistributions of source code must retain the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer.
 *
 *      - Redistributions in binary form must reproduce the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer in the documentation and/or other materials
 *        provided with the distribution.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

#ifndef _MLX5_FS_CORE_
#define _MLX5_FS_CORE_

#include <linux/refcount.h>
#include <linux/mlx5/fs.h>
#include <linux/rhashtable.h>
#include <linux/llist.h>
#include <steering/fs_dr.h>

#define FDB_TC_MAX_CHAIN
#define FDB_FT_CHAIN
#define FDB_TC_SLOW_PATH_CHAIN

/* The index of the last real chain (FT) + 1 as chain zero is valid as well */
#define FDB_NUM_CHAINS

#define FDB_TC_MAX_PRIO
#define FDB_TC_LEVELS_PER_PRIO

struct mlx5_flow_definer {};

enum mlx5_flow_resource_owner {};

struct mlx5_modify_hdr {};

struct mlx5_pkt_reformat {};

/* FS_TYPE_PRIO_CHAINS is a PRIO that will have namespaces only,
 * and those are in parallel to one another when going over them to connect
 * a new flow table. Meaning the last flow table in a TYPE_PRIO prio in one
 * parallel namespace will not automatically connect to the first flow table
 * found in any prio in any next namespace, but skip the entire containing
 * TYPE_PRIO_CHAINS prio.
 *
 * This is used to implement tc chains, each chain of prios is a different
 * namespace inside a containing TYPE_PRIO_CHAINS prio.
 */

enum fs_node_type {};

enum fs_flow_table_type {};

enum fs_flow_table_op_mod {};

enum fs_fte_status {};

enum mlx5_flow_steering_mode {};

enum mlx5_flow_steering_capabilty {};

struct mlx5_flow_steering {};

struct fs_node {};

struct mlx5_flow_rule {};

struct mlx5_flow_handle {};

/* Type of children is mlx5_flow_group */
struct mlx5_flow_table {};

struct mlx5_ft_underlay_qp {};

#define MLX5_FTE_MATCH_PARAM_RESERVED
/* Calculate the fte_match_param length and without the reserved length.
 * Make sure the reserved field is the last.
 */
#define MLX5_ST_SZ_DW_MATCH_PARAM

/* Type of children is mlx5_flow_rule */
struct fs_fte {};

/* Type of children is mlx5_flow_table/namespace */
struct fs_prio {};

/* Type of children is fs_prio */
struct mlx5_flow_namespace {};

struct mlx5_flow_group_mask {};

/* Type of children is fs_fte */
struct mlx5_flow_group {};

struct mlx5_flow_root_namespace {};

int mlx5_init_fc_stats(struct mlx5_core_dev *dev);
void mlx5_cleanup_fc_stats(struct mlx5_core_dev *dev);
void mlx5_fc_queue_stats_work(struct mlx5_core_dev *dev,
			      struct delayed_work *dwork,
			      unsigned long delay);
void mlx5_fc_update_sampling_interval(struct mlx5_core_dev *dev,
				      unsigned long interval);

const struct mlx5_flow_cmds *mlx5_fs_cmd_get_fw_cmds(void);

int mlx5_flow_namespace_set_peer(struct mlx5_flow_root_namespace *ns,
				 struct mlx5_flow_root_namespace *peer_ns,
				 u16 peer_vhca_id);

int mlx5_flow_namespace_set_mode(struct mlx5_flow_namespace *ns,
				 enum mlx5_flow_steering_mode mode);

int mlx5_fs_core_alloc(struct mlx5_core_dev *dev);
void mlx5_fs_core_free(struct mlx5_core_dev *dev);
int mlx5_fs_core_init(struct mlx5_core_dev *dev);
void mlx5_fs_core_cleanup(struct mlx5_core_dev *dev);

int mlx5_fs_egress_acls_init(struct mlx5_core_dev *dev, int total_vports);
void mlx5_fs_egress_acls_cleanup(struct mlx5_core_dev *dev);
int mlx5_fs_ingress_acls_init(struct mlx5_core_dev *dev, int total_vports);
void mlx5_fs_ingress_acls_cleanup(struct mlx5_core_dev *dev);

u32 mlx5_fs_get_capabilities(struct mlx5_core_dev *dev, enum mlx5_flow_namespace_type type);

struct mlx5_flow_root_namespace *find_root(struct fs_node *node);

#define fs_get_obj(v, _node)

#define fs_list_for_each_entry(pos, root)

#define fs_list_for_each_entry_safe(pos, tmp, root)

#define fs_for_each_ns_or_ft_reverse(pos, prio)

#define fs_for_each_ns_or_ft(pos, prio)

#define fs_for_each_prio(pos, ns)

#define fs_for_each_ns(pos, prio)

#define fs_for_each_ft(pos, prio)

#define fs_for_each_ft_safe(pos, tmp, prio)

#define fs_for_each_fg(pos, ft)

#define fs_for_each_fte(pos, fg)

#define fs_for_each_dst(pos, fte)

#define MLX5_CAP_FLOWTABLE_TYPE(mdev, cap, type)

#endif