summaryrefslogtreecommitdiffstats
path: root/src/plugins/srv6-ad/ad.c
AgeCommit message (Expand)AuthorFilesLines
2018-10-23c11 safe string handling supportDave Barach1-1/+1
2018-08-22srv6-ad: Adding support for L2 trafficFrancois Clad1-89/+183
2018-08-22srv6-ad: Adding rewrite countersFrancois Clad1-16/+38
2018-04-10srv6-ad: fixing cache size issueFrancois Clad1-0/+2
2018-01-29SRv6 dynamic proxy pluginFrancois Clad1-0/+358
* Name.Function */ .highlight .nl { color: #f8f8f2 } /* Name.Label */ .highlight .nn { color: #f8f8f2 } /* Name.Namespace */ .highlight .nx { color: #a6e22e } /* Name.Other */ .highlight .py { color: #f8f8f2 } /* Name.Property */ .highlight .nt { color: #f92672 } /* Name.Tag */ .highlight .nv { color: #f8f8f2 } /* Name.Variable */ .highlight .ow { color: #f92672 } /* Operator.Word */ .highlight .w { color: #f8f8f2 } /* Text.Whitespace */ .highlight .mb { color: #ae81ff } /* Literal.Number.Bin */ .highlight .mf { color: #ae81ff } /* Literal.Number.Float */ .highlight .mh { color: #ae81ff } /* Literal.Number.Hex */ .highlight .mi { color: #ae81ff } /* Literal.Number.Integer */ .highlight .mo { color: #ae81ff } /* Literal.Number.Oct */ .highlight .sa { color: #e6db74 } /* Literal.String.Affix */ .highlight .sb { color: #e6db74 } /* Literal.String.Backtick */ .highlight .sc { color: #e6db74 } /* Literal.String.Char */ .highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */ .highlight .sd { color: #e6db74 } /* Literal.String.Doc */ .highlight .s2 { color: #e6db74 } /* Literal.String.Double */ .highlight .se { color: #ae81ff } /* Literal.String.Escape */ .highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */ .highlight .si { color: #e6db74 } /* Literal.String.Interpol */ .highlight .sx { color: #e6db74 } /* Literal.String.Other */ .highlight .sr { color: #e6db74 } /* Literal.String.Regex */ .highlight .s1 { color: #e6db74 } /* Literal.String.Single */ .highlight .ss { color: #e6db74 } /* Literal.String.Symbol */ .highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #a6e22e } /* Name.Function.Magic */ .highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */ .highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */ .highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */ .highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */ .highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */ } @media (prefers-color-scheme: light) { .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; 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 */ }
/*
 * gbp.h : Group Based Policy
 *
 * Copyright (c) 2018 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.
 */

#include <plugins/gbp/gbp.h>
#include <plugins/gbp/gbp_classify.h>
#include <vnet/l2/l2_input.h>

gbp_src_classify_main_t gbp_src_classify_main;

static clib_error_t *
gbp_src_classify_init (vlib_main_t * vm)
{
  gbp_src_classify_main_t *em = &gbp_src_classify_main;

  vlib_node_t *node = vlib_get_node_by_name (vm, (u8 *) "gbp-src-classify");

  /* Initialize the feature next-node indexes */
  feat_bitmap_init_next_nodes (vm,
			       node->index,
			       L2INPUT_N_FEAT,
			       l2input_get_feat_names (),
			       em->l2_input_feat_next[GBP_SRC_CLASSIFY_NULL]);

  node = vlib_get_node_by_name (vm, (u8 *) "gbp-null-classify");
  feat_bitmap_init_next_nodes (vm,
			       node->index,
			       L2INPUT_N_FEAT,
			       l2input_get_feat_names (),
			       em->l2_input_feat_next[GBP_SRC_CLASSIFY_PORT]);

  node = vlib_get_node_by_name (vm, (u8 *) "l2-gbp-lpm-classify");
  feat_bitmap_init_next_nodes (vm,
			       node->index,
			       L2INPUT_N_FEAT,
			       l2input_get_feat_names (),
			       em->l2_input_feat_next[GBP_SRC_CLASSIFY_LPM]);

  return 0;
}

VLIB_INIT_FUNCTION (gbp_src_classify_init);

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */
{ .format = "avf[%d] aq_enq_req: send_to_pf flags 0x%x datalen %d " "v_opcode %s (%d)", .format_args = "i4i2i2t2i2", .n_enum_strings = VIRTCHNL_N_OPS, .enum_strings = { #define _(v, n) [v] = #n, foreach_virtchnl_op #undef _ }, }; struct { u32 dev_instance; u16 flags; u16 datalen; u16 v_opcode; u16 v_opcode_val; } * ed; ed = ELOG_DATA (&vlib_global_main.elog_main, el); ed->dev_instance = ad->dev_instance; ed->flags = d->flags; ed->datalen = d->datalen; ed->v_opcode = ed->v_opcode_val = d->v_opcode; } else { ELOG_TYPE_DECLARE (el) = { .format = "avf[%d] aq_enq_req: opcode 0x%x flags 0x%x datalen %d", .format_args = "i4i2i2i2" }; struct { u32 dev_instance; u16 opcode; u16 flags; u16 datalen; } * ed; ed = ELOG_DATA (&vlib_global_main.elog_main, el); ed->dev_instance = ad->dev_instance; ed->opcode = d->opcode; ed->flags = d->flags; ed->datalen = d->datalen; } } void avf_elog_aq_enq_resp (avf_device_t *ad, avf_aq_desc_t *d) { ELOG_TYPE_DECLARE (el) = { .format = "avf[%d] aq_enq_resp: flags 0x%x retval %d", .format_args = "i4i2i2" }; struct { u32 dev_instance; u16 flags; u16 retval; } * ed; ed = ELOG_DATA (&vlib_global_main.elog_main, el); ed->dev_instance = ad->dev_instance; ed->flags = d->flags; ed->retval = d->retval; } void avf_elog_arq_desc (avf_device_t *ad, avf_aq_desc_t *d) { if (d->opcode == 0x802) { ELOG_TYPE_DECLARE (el) = { .format = "avf[%d] arq_desc: msg_from_pf flags 0x%x retval %d " "v_opcode %s (%d) v_retval %d", .format_args = "i4i2i2t2i2i2", .n_enum_strings = VIRTCHNL_N_OPS, .enum_strings = { #define _(v, n) [v] = #n, foreach_virtchnl_op #undef _ }, }; struct { u32 dev_instance; u16 flags; u16 retval; u16 v_opcode; u16 v_opcode_val; u16 v_retval; } * ed; ed = ELOG_DATA (&vlib_global_main.elog_main, el); ed->dev_instance = ad->dev_instance; ed->flags = d->flags; ed->retval = d->retval; ed->v_opcode = ed->v_opcode_val = d->v_opcode; ed->v_retval = d->v_retval; } else { ELOG_TYPE_DECLARE ( el) = { .format = "avf[%d] arq_desc: flags 0x%x retval %d opcode 0x%x", .format_args = "i4i2i2i2" }; struct { u32 dev_instance; u16 flags; u16 retval; u16 opcode; } * ed; ed = ELOG_DATA (&vlib_global_main.elog_main, el); ed->dev_instance = ad->dev_instance; ed->flags = d->flags; ed->retval = d->retval; ed->opcode = d->opcode; } } void avf_elog_reg (avf_device_t *ad, u32 addr, u32 val, int is_read) { uword *p; ELOG_TYPE_DECLARE (el) = { .format = "avf[%d] reg: %s %s [0x%04x] val 0x%08x", .format_args = "i4s4s4i4i4", }; struct { u32 dev_instance; char rw[4]; char reg_name[24]; u32 addr; u32 val; } * ed; ed = ELOG_DATA (&vlib_global_main.elog_main, el); ed->dev_instance = ad->dev_instance; ed->addr = addr; ed->val = val; ed->rw[0] = is_read ? 'r' : 'w'; ed->rw[1] = 0; p = hash_get (register_name_by_addr, addr); strncpy (ed->reg_name, p ? (char *) p[0] : "unknown", 24); ed->reg_name[23] = 0; } void avf_elog_init (void) { if (register_name_by_addr) return; register_name_by_addr = hash_create (0, sizeof (uword)); hash_set (register_name_by_addr, AVFINT_ICR0, "AVFINT_ICR0"); hash_set (register_name_by_addr, AVFINT_ICR0_ENA1, "INT_ICR0_ENA1"); hash_set (register_name_by_addr, AVFINT_DYN_CTL0, "INT_DYN_CTL0"); hash_set (register_name_by_addr, AVF_ARQBAH, "ARQBAH"); hash_set (register_name_by_addr, AVF_ATQH, "ATQH"); hash_set (register_name_by_addr, AVF_ATQLEN, "ATQLEN"); hash_set (register_name_by_addr, AVF_ARQBAL, "ARQBAL"); hash_set (register_name_by_addr, AVF_ARQT, "ARQT"); hash_set (register_name_by_addr, AVF_ARQH, "ARQH"); hash_set (register_name_by_addr, AVF_ATQBAH, "ATQBAH"); hash_set (register_name_by_addr, AVF_ATQBAL, "ATQBAL"); hash_set (register_name_by_addr, AVF_ARQLEN, "ARQLEN"); hash_set (register_name_by_addr, AVF_ATQT, "ATQT"); hash_set (register_name_by_addr, AVFGEN_RSTAT, "GEN_RSTAT"); for (int i = 0; i < 16; i++) { hash_set (register_name_by_addr, AVFINT_DYN_CTLN (i), format (0, "INT_DYN_CTLN(%u)%c", i, 0)); hash_set (register_name_by_addr, AVF_QTX_TAIL (i), format (0, "QTX_TAIL(%u)%c", i, 0)); hash_set (register_name_by_addr, AVF_QRX_TAIL (i), format (0, "QRX_TAIL(%u)%c", i, 0)); } }