summaryrefslogtreecommitdiffstats
path: root/dpdk/Makefile
AgeCommit message (Expand)AuthorFilesLines
2016-07-22Add DPDK 16.07 support (rc3 based)Damjan Marion1-1/+1
2016-07-02Enable PCI extended tags in the DPDK configDamjan Marion1-1/+3
2016-06-05dpdk: download from dpdk.orgThomas Monjalon1-6/+6
2016-05-19Add support for multiple microarchitectures in single binaryDamjan Marion1-1/+2
2016-05-17dpdk/Makefile - Allow dpdk target to be set according to the platformChristophe Fontaine1-1/+10
2016-05-07Switch to using nexus.fd.io for dpdk tarballEd Warnicke1-1/+1
2016-04-26Fix compile errors reported by clangDamjan Marion1-3/+10
2016-04-26Build vpp w/ dpdk-16.04 by defaultDave Barach1-1/+1
2016-04-26Gernerate dpdk config out of target specific filesDamjan Marion1-7/+2
2016-04-12Add support for DPDK 16.04 release, rebase some of 2.2.0 patchesDamjan Marion1-1/+1
2016-04-11Bump DPDK 16.04 to RC4Damjan Marion1-1/+1
2016-03-29Add DPDK 16.04-rc2 supportDamjan Marion1-1/+4
2016-03-29Add abbility to specify dpdk tarball download base urlDamjan Marion1-1/+2
2016-03-25Use rte_mempool private data for storing vlib_buffer_tDamjan Marion1-1/+1
2016-03-14dpdk: fix link errorJean-Mickael Guerin1-1/+1
2016-02-25Add support of Ethernet link bonding utilizing DPDK link bondingJohn Lo1-2/+2
2016-02-13Increase number of dpdk lcores to 256Damjan Marion1-0/+1
2016-02-02Change default dpdk version to 2.2Damjan Marion1-1/+1
2015-12-16Introduce support for DPDK 2.2Damjan Marion1-3/+4
2015-12-08Initial commit of vpp code.v1.0.0Ed Warnicke1-0/+174
.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 */ }
/*
 *------------------------------------------------------------------
 * Copyright (c) 2017 Intel 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.
 *------------------------------------------------------------------
 */

#ifndef _PPPOE_H
#define _PPPOE_H

#include <vnet/plugin/plugin.h>
#include <vppinfra/lock.h>
#include <vppinfra/error.h>
#include <vppinfra/hash.h>
#include <vnet/vnet.h>
#include <vnet/ip/ip.h>
#include <vnet/ethernet/ethernet.h>
#include <vnet/ip/ip4_packet.h>
#include <vnet/ip/ip6_packet.h>
#include <vnet/dpo/dpo.h>
#include <vnet/adj/adj_types.h>
#include <vnet/fib/fib_table.h>
#include <vlib/vlib.h>
#include <vppinfra/bihash_8_8.h>


typedef struct
{
  u8 ver_type;
  u8 code;
  u16 session_id;
  u16 length;
  u16 ppp_proto;
} pppoe_header_t;

#define PPPOE_VER_TYPE 0x11
#define PPPOE_PADS 0x65

typedef struct
{
  /* Required for pool_get_aligned  */
  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);

  /* pppoe session_id in HOST byte order */
  u16 session_id;

  /* session client addresses */
  ip46_address_t client_ip;

  /* the index of tx interface for pppoe encaped packet */
  u32 encap_if_index;

  /** FIB indices - inner IP packet lookup here */
  u32 decap_fib_index;

  u8 local_mac[6];
  u8 client_mac[6];

  /* vnet intfc index */
  u32 sw_if_index;
  u32 hw_if_index;

} pppoe_session_t;

#define foreach_pppoe_input_next        \
_(DROP, "error-drop")                  \
_(IP4_INPUT, "ip4-input")              \
_(IP6_INPUT, "ip6-input" )             \
_(CP_INPUT, "pppoe-cp-dispatch" )      \

typedef enum
{
#define _(s,n) PPPOE_INPUT_NEXT_##s,
  foreach_pppoe_input_next
#undef _
    PPPOE_INPUT_N_NEXT,
} pppoe_input_next_t;

typedef enum
{
#define pppoe_error(n,s) PPPOE_ERROR_##n,
#include <pppoe/pppoe_error.def>
#undef pppoe_error
  PPPOE_N_ERROR,
} pppoe_input_error_t;


#define MTU 1500
#define MTU_BUFFERS ((MTU + vlib_buffer_get_default_data_size(vm) - 1) / vlib_buffer_get_default_data_size(vm))
#define NUM_BUFFERS_TO_ALLOC 32

/*
 * The size of pppoe session table
 */
#define PPPOE_NUM_BUCKETS (64 * 1024)
#define PPPOE_MEMORY_SIZE (8<<20)

/* *INDENT-OFF* */
/*
 * The PPPoE key is the mac address and session ID
 */
typedef struct
{
  union
  {
    struct
    {
      u16 session_id;
      u8 mac[6];
    } fields;
    struct
    {
      u32 w0;
      u32 w1;
    } words;
    u64 raw;
  };
} pppoe_entry_key_t;
/* *INDENT-ON* */

/* *INDENT-OFF* */
/*
 * The PPPoE entry results
 */
typedef struct
{
  union
  {
    struct
    {
      u32 sw_if_index;

      u32 session_index;

    } fields;
    u64 raw;
  };
}  pppoe_entry_result_t;
/* *INDENT-ON* */

typedef struct
{
  /* Vector of encap session instances, */
  pppoe_session_t *sessions;

  /* For CP:  vector of CP path */
    BVT (clib_bihash) link_table;

  /* For DP:  vector of DP path */
    BVT (clib_bihash) session_table;

  /* Free vlib hw_if_indices */
  u32 *free_pppoe_session_hw_if_indices;

  /* Mapping from sw_if_index to session index */
  u32 *session_index_by_sw_if_index;

  /* used for pppoe cp path */
  u32 cp_if_index;

  /* API message ID base */
  u16 msg_id_base;

  /* convenience */
  vlib_main_t *vlib_main;
  vnet_main_t *vnet_main;

} pppoe_main_t;

extern pppoe_main_t pppoe_main;

extern vlib_node_registration_t pppoe_input_node;
extern vlib_node_registration_t pppoe_cp_dispatch_node;

typedef struct
{
  u8 is_add;
  u8 is_ip6;
  u16 session_id;
  ip46_address_t client_ip;
  u32 encap_if_index;
  u32 decap_fib_index;
  u8 local_mac[6];
  u8 client_mac[6];
} vnet_pppoe_add_del_session_args_t;

int vnet_pppoe_add_del_session
  (vnet_pppoe_add_del_session_args_t * a, u32 * sw_if_indexp);

typedef struct
{
  u8 is_add;
  u32 client_if_index;
  u32 cp_if_index;
} vnet_pppoe_add_del_tap_args_t;

always_inline u64
pppoe_make_key (u8 * mac_address, u16 session_id)
{
  u64 temp;

  /*
   * The mac address in memory is A:B:C:D:E:F
   * The session_id in register is H:L
   */
#if CLIB_ARCH_IS_LITTLE_ENDIAN
  /*
   * Create the in-register key as F:E:D:C:B:A:H:L
   * In memory the key is L:H:A:B:C:D:E:F
   */
  temp = *((u64 *) (mac_address)) << 16;
  temp = (temp & ~0xffff) | (u64) (session_id);
#else
  /*
   * Create the in-register key as H:L:A:B:C:D:E:F
   * In memory the key is H:L:A:B:C:D:E:F
   */
  temp = *((u64 *) (mac_address)) >> 16;
  temp = temp | (((u64) session_id) << 48);
#endif

  return temp;
}

/**
 * Perform learning on one packet based on the mac table lookup result.
 * */
static_always_inline void
pppoe_learn_process (BVT (clib_bihash) * table,
		     u32 sw_if_index0,
		     pppoe_entry_key_t * key0,
		     pppoe_entry_key_t * cached_key,
		     u32 * bucket0, pppoe_entry_result_t * result0)
{
  /* Check mac table lookup result */
  if (PREDICT_TRUE (result0->fields.sw_if_index == sw_if_index0))
    {
      /*
       * The entry was in the table, and the sw_if_index matched, the normal case
       */
      return;
    }
  else if (result0->fields.sw_if_index == ~0)
    {
      /* The entry was not in table, so add it  */
      result0->fields.sw_if_index = sw_if_index0;
      result0->fields.session_index = ~0;
      cached_key->raw = ~0;	/* invalidate the cache */
    }
  else
    {
      /* The entry was in the table, but with the wrong sw_if_index mapping (mac move) */
      result0->fields.sw_if_index = sw_if_index0;
    }

  /* Update the entry */
  BVT (clib_bihash_kv) kv;
  kv.key = key0->raw;
  kv.value = result0->raw;
  BV (clib_bihash_add_del) (table, &kv, 1 /* is_add */ );
}

static_always_inline void
pppoe_lookup_1 (BVT (clib_bihash) * table,
		pppoe_entry_key_t * cached_key,
		pppoe_entry_result_t * cached_result,
		u8 * mac0,
		u16 session_id0,
		pppoe_entry_key_t * key0,
		u32 * bucket0, pppoe_entry_result_t * result0)
{
  /* set up key */
  key0->raw = pppoe_make_key (mac0, session_id0);
  *bucket0 = ~0;

  if (key0->raw == cached_key->raw)
    {
      /* Hit in the one-entry cache */
      result0->raw = cached_result->raw;
    }
  else
    {
      /* Do a regular session table lookup */
      BVT (clib_bihash_kv) kv;

      kv.key = key0->raw;
      kv.value = ~0ULL;
      BV (clib_bihash_search_inline) (table, &kv);
      result0->raw = kv.value;

      /* Update one-entry cache */
      cached_key->raw = key0->raw;
      cached_result->raw = result0->raw;
    }
}

static_always_inline void
pppoe_update_1 (BVT (clib_bihash) * table,
		u8 * mac0,
		u16 session_id0,
		pppoe_entry_key_t * key0,
		u32 * bucket0, pppoe_entry_result_t * result0)
{
  /* set up key */
  key0->raw = pppoe_make_key (mac0, session_id0);
  *bucket0 = ~0;

  /* Update the entry */
  BVT (clib_bihash_kv) kv;
  kv.key = key0->raw;
  kv.value = result0->raw;
  BV (clib_bihash_add_del) (table, &kv, 1 /* is_add */ );

}
#endif /* _PPPOE_H */

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