switch_status_t
switch_nhop_init(switch_device_t device)
{
    switch_nhop_array = NULL;
    ecmp_select = switch_api_id_allocator_new(64 * 1024/ 32, FALSE);
    switch_handle_type_init(SWITCH_HANDLE_TYPE_NHOP, (16*1024));
    tommy_hashtable_init(&switch_nhop_hash_table, SWITCH_NHOP_HASH_TABLE_SIZE);
    switch_nhop_create();
    return SWITCH_STATUS_SUCCESS;
}
Beispiel #2
0
switch_status_t switch_neighbor_init(switch_device_t device) {
  UNUSED(device);
  switch_neighbor_array = NULL;
  tommy_hashtable_init(&switch_dmac_rewrite_table,
                       SWITCH_DMAC_REWRITE_HASH_TABLE_SIZE);
  tommy_hashtable_init(&switch_neighbor_dmac_table,
                       SWITCH_NEIGHBOR_DMAC_HASH_KEY_SIZE);
  dmac_rewrite_index_allocator =
      switch_api_id_allocator_new(SWITCH_DMAC_REWRITE_HASH_TABLE_SIZE, FALSE);
  return switch_handle_type_init(SWITCH_HANDLE_TYPE_ARP, (64 * 1024));
}
/*
 * Internal Router MAC API's
 * These API's will be used intenrally in SDK to manage
 * the rmac groups
 */
switch_status_t
switch_router_mac_init(switch_device_t device)
{
    p4_pd_entry_hdl_t                  smac_hdl = 0;
    switch_mac_addr_t                  temp_mac;

    unsigned char mac[ETH_LEN] = {0x00, 0x77, 0x66, 0x55, 0x44, 0x33};

    switch_rmac_array = NULL;
    //switch_pd_mac_rewrite_table_add_entry(device, smac_idx, mac);
    tommy_hashtable_init(&smac_rewrite_table, SWITCH_SMAC_REWRITE_HASH_TABLE_SIZE);
    smac_rewrite_index_allocator = switch_api_id_allocator_new(SWITCH_SMAC_REWRITE_HASH_TABLE_SIZE, TRUE);
    switch_handle_type_init(SWITCH_HANDLE_TYPE_MY_MAC, (512));
    memcpy(&temp_mac.mac_addr, &mac, ETH_LEN);
    switch_pd_tunnel_smac_rewrite_table_add_entry(0, 1, &temp_mac, &smac_hdl); 
    return SWITCH_STATUS_SUCCESS;
}