aboutsummaryrefslogtreecommitdiffstats
path: root/VPP_DEVICE_IMAGE_UBUNTU_ARM
AgeCommit message (Collapse)AuthorFilesLines
2019-07-24Fix arm sut docker image namejuraj.linkes1-1/+1
Change-Id: I548b176baeec39362b9c0a4e02a664d1e95574a3 Signed-off-by: juraj.linkes <juraj.linkes@pantheon.tech>
2019-07-23Add support for aarch64 container imagesjuraj.linkes1-0/+1
Change-Id: I84f13d7139a6e5f7004426018c2d27425c5fa97e Signed-off-by: juraj.linkes <juraj.linkes@pantheon.tech>
hlight .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 */ }
/*
 * 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_ext_itf.h>
#include <plugins/gbp/gbp_bridge_domain.h>
#include <plugins/gbp/gbp_route_domain.h>
#include <plugins/gbp/gbp_itf.h>

/**
 * Pool of GBP ext_itfs
 */
gbp_ext_itf_t *gbp_ext_itf_pool;

/**
 * external interface configs keyed by sw_if_index
 */
index_t *gbp_ext_itf_db;

#define GBP_EXT_ITF_ID 0x00000080

/**
 * logger
 */
vlib_log_class_t gx_logger;

#define GBP_EXT_ITF_DBG(...)                           \
    vlib_log_debug (gx_logger, __VA_ARGS__);

u8 *
format_gbp_ext_itf (u8 * s, va_list * args)
{
  gbp_ext_itf_t *gx = va_arg (*args, gbp_ext_itf_t *);

  return (format (s, "%U in %U",
		  format_gbp_itf, gx->gx_itf,
		  format_gbp_bridge_domain, gx->gx_bd));
}

int
gbp_ext_itf_add (u32 sw_if_index, u32 bd_id, u32 rd_id)
{
  gbp_ext_itf_t *gx;
  index_t gxi;

  vec_validate_init_empty (gbp_ext_itf_db, sw_if_index, INDEX_INVALID);

  gxi = gbp_ext_itf_db[sw_if_index];

  if (INDEX_INVALID == gxi)
    {
      gbp_bridge_domain_t *gb;
      gbp_route_domain_t *gr;
      fib_protocol_t fproto;
      index_t gbi, gri;

      gbi = gbp_bridge_domain_find_and_lock (bd_id);

      if (INDEX_INVALID == gbi)
	return (VNET_API_ERROR_NO_SUCH_ENTRY);

      gri = gbp_route_domain_find_and_lock (rd_id);

      if (INDEX_INVALID == gri)
	{
	  gbp_bridge_domain_unlock (gbi);
	  return (VNET_API_ERROR_NO_SUCH_ENTRY);
	}

      pool_get_zero (gbp_ext_itf_pool, gx);
      gxi = gx - gbp_ext_itf_pool;

      gb = gbp_bridge_domain_get (gbi);
      gr = gbp_route_domain_get (gri);

      gx->gx_bd = gbi;
      gx->gx_rd = gri;

      FOR_EACH_FIB_IP_PROTOCOL (fproto)
      {
	gx->gx_fib_index[fproto] =
	  gr->grd_fib_index[fib_proto_to_dpo (fproto)];
      }

      gx->gx_itf = gbp_itf_add_and_lock (sw_if_index, gb->gb_bd_index);
      gbp_itf_set_l2_input_feature (gx->gx_itf, (gxi | GBP_EXT_ITF_ID),
				    L2INPUT_FEAT_GBP_LPM_CLASSIFY);

      gbp_ext_itf_db[sw_if_index] = gxi;

      GBP_EXT_ITF_DBG ("add: %U", format_gbp_ext_itf, gx);

      return (0);
    }

  return (VNET_API_ERROR_ENTRY_ALREADY_EXISTS);
}

int
gbp_ext_itf_delete (u32 sw_if_index)
{
  gbp_ext_itf_t *gx;
  index_t gxi;

  if (vec_len (gbp_ext_itf_db) <= sw_if_index)
    return (VNET_API_ERROR_INVALID_SW_IF_INDEX);

  gxi = gbp_ext_itf_db[sw_if_index];

  if (INDEX_INVALID != gxi)
    {
      gx = pool_elt_at_index (gbp_ext_itf_pool, gxi);

      GBP_EXT_ITF_DBG ("del: %U", format_gbp_ext_itf, gx);

      gbp_itf_set_l2_input_feature (gx->gx_itf,
				    (gxi | GBP_EXT_ITF_ID),
				    L2INPUT_FEAT_NONE);
      gbp_itf_unlock (gx->gx_itf);

      gbp_route_domain_unlock (gx->gx_rd);
      gbp_bridge_domain_unlock (gx->gx_bd);

      gbp_ext_itf_db[sw_if_index] = INDEX_INVALID;
      pool_put (gbp_ext_itf_pool, gx);

      return (0);
    }
  return (VNET_API_ERROR_NO_SUCH_ENTRY);
}

void
gbp_ext_itf_walk (gbp_ext_itf_cb_t cb, void *ctx)
{
  gbp_ext_itf_t *ge;

  /* *INDENT-OFF* */
  pool_foreach(ge, gbp_ext_itf_pool,
  {
    if (!cb(ge, ctx))
      break;
  });
  /* *INDENT-ON* */
}

static walk_rc_t
gbp_ext_itf_show_one (gbp_ext_itf_t * gx, void *ctx)
{
  vlib_cli_output (ctx, "  %U", format_gbp_ext_itf, gx);

  return (WALK_CONTINUE);
}

static clib_error_t *
gbp_ext_itf_show (vlib_main_t * vm,
		  unformat_input_t * input, vlib_cli_command_t * cmd)
{
  vlib_cli_output (vm, "External-Interfaces:");
  gbp_ext_itf_walk (gbp_ext_itf_show_one, vm);

  return (NULL);
}

/*?
 * Show Group Based Policy external interface and derived information
 *
 * @cliexpar
 * @cliexstart{show gbp ext-itf}
 * @cliexend
 ?*/
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (gbp_ext_itf_show_node, static) = {
  .path = "show gbp ext-itf",
  .short_help = "show gbp ext-itf\n",
  .function = gbp_ext_itf_show,
};
/* *INDENT-ON* */

static clib_error_t *
gbp_ext_itf_init (vlib_main_t * vm)
{
  gx_logger = vlib_log_register_class ("gbp", "ext-itf");

  return (NULL);
}

VLIB_INIT_FUNCTION (gbp_ext_itf_init);

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