aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlibapi/CMakeLists.txt
AgeCommit message (Expand)AuthorFilesLines
2022-09-26api: replace print functions wth formatDamjan Marion1-0/+1
2022-09-26api: keep api common code in vlibapiDamjan Marion1-9/+11
2021-09-17build: use GNUInstallDirs install destinationsNick Brown1-1/+1
2018-12-13API: Use string type instead of u8.Ole Troan1-0/+1
2018-09-07cmake: set packaging component for different filesDamjan Marion1-0/+2
2018-08-26cmake: add add_vpp_library and add_vpp_executable macrosDamjan Marion1-1/+5
2018-08-25cmake: add more headers to the install listDamjan Marion1-0/+19
699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/*
 * Copyright (c) 2015 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * l2_rw is based on vnet classifier and provides a way
 * to modify packets matching a given table.
 *
 * Tables must be created using vnet's classify features.
 * Entries contained within these tables must have their
 * opaque index set to the rewrite entry created with l2_rw_mod_entry.
 */

#ifndef L2_RW_H_
#define L2_RW_H_

#include <vnet/l2/l2_input.h>

/* *INDENT-OFF* */
typedef CLIB_PACKED(struct _l2_rw_entry {
  u16 skip_n_vectors;
  u16 rewrite_n_vectors;
  u64 hit_count;
  u32x4 *mask;
  u32x4 *value;
}) l2_rw_entry_t;
/* *INDENT-ON* */

/* l2_rw configuration for one interface */
/* *INDENT-OFF* */
typedef CLIB_PACKED(struct _l2_rw_config {
  u32 table_index; /* Which classify table to use */
  u32 miss_index;  /* Rewrite entry to use if table does not match */
}) l2_rw_config_t;
/* *INDENT-ON* */

typedef struct
{
  /* Next feature node indexes */
  u32 feat_next_node_index[32];

  /* A pool of entries */
  l2_rw_entry_t *entries;

  /* Config vector indexed by sw_if_index */
  l2_rw_config_t *configs;
  uword *configs_bitmap;
} l2_rw_main_t;

extern l2_rw_main_t l2_rw_main;

/*
 * Specifies which classify table and miss_index should be used
 * with the given interface.
 * Use special values ~0 in order to un-set table_index
 * or miss_index.
 * l2_rw feature is automatically enabled for the interface
 * when table_index or miss_index is not ~0.
 * returns 0 on success and something else on error.
 */
int l2_rw_interface_set_table (u32 sw_if_index,
			       u32 table_index, u32 miss_index);

/*
 * Creates, modifies or delete a rewrite entry.
 * If *index != ~0, modifies an existing entry (or simply
 * deletes it if is_del is set).
 * If *index == ~0, creates a new entry and the created
 * entry index is stored in *index (Does nothing if is_del
 * is set).
 * returns 0 on success and something else on error.
 */
int l2_rw_mod_entry (u32 * index,
		     u8 * mask, u8 * value, u32 len, u32 skip, u8 is_del);

extern vlib_node_registration_t l2_rw_node;

#endif /* L2_FW_H_ */

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */