/* * INIT */ static void init_ifnet(void) { char str[256]; ofp_config_interface_up_v4(port, vlan, vrf, dev_ip, 24); /* port 0 */ dev = ofp_get_ifnet(port, vlan); memcpy(dev->mac, dev_mac, OFP_ETHER_ADDR_LEN); dev->if_mtu = def_mtu; #ifdef SP dev->linux_index = port + 3; /* an if index of Linux != port val */ ofp_update_ifindex_lookup_tab(dev); #endif /* SP */ dev->pkt_pool = odp_pool_lookup(pool_name); sprintf(str, "out default queue:%d", port); dev->outq_def = odp_queue_create(str, NULL); if (dev->outq_def == ODP_QUEUE_INVALID) { fail_with_odp("Out default queue create failed.\n"); return; } dev->out_queue_num = 1; dev->out_queue_type = OFP_OUT_QUEUE_TYPE_QUEUE; /* port 0 vlan 1 */ ofp_config_interface_up_v4(port, vlan + 1, vrf, dev_ip + 1, 24); dev_vlan = ofp_get_ifnet(port, vlan + 1); memcpy(dev_vlan->mac, dev_vlan_mac, OFP_ETHER_ADDR_LEN); dev_vlan->if_mtu = def_mtu; #ifdef SP dev_vlan->linux_index = port + 4; /* an if index of Linux != port val */ ofp_update_ifindex_lookup_tab(dev_vlan); #endif /* SP */ dev_vlan->pkt_pool = odp_pool_lookup(pool_name); sprintf(str, "out default queue:%d", port); dev_vlan->outq_def = odp_queue_create(str, NULL); if (dev_vlan->outq_def == ODP_QUEUE_INVALID) { fail_with_odp("Out default queue create failed.\n"); return; } /* Tunnels */ ofp_config_interface_up_tun(GRE_PORTS, 100, 0, dev_ip, tun_rem_ip, tun_p2p, tun_addr, tun_mask); /* No nexthop for tunnel remote address */ ofp_config_interface_up_tun(GRE_PORTS, 200, 0, dev_ip, 0x08070605, tun_p2p + 1, tun_addr + 1, tun_mask); }
static void init_ifnet(void) { char str[256]; ofp_config_interface_up_v4(port, vlan, vrf, dev_ip, 24); dev = ofp_get_ifnet(port, vlan); memcpy(dev->mac, dev_mac, OFP_ETHER_ADDR_LEN); dev->if_mtu = def_mtu; #ifdef SP dev->linux_index = port + 3; /* an if index of Linux != port val */ ofp_update_ifindex_lookup_tab(dev); #endif /* SP */ dev->pkt_pool = odp_pool_lookup("packet_pool"); sprintf(str, "out default queue:%d", port); dev->outq_def = odp_queue_create(str, NULL); if (dev->outq_def == ODP_QUEUE_INVALID) { fail_with_odp("Out default queue create failed.\n"); return; } dev->out_queue_num = 1; dev->out_queue_type = OFP_OUT_QUEUE_TYPE_QUEUE; }
/* * INIT */ static void test_init_ifnet(void) { char str[256]; ofp_config_interface_up_v4(port, vlan, vrf, local_ip, 24); ifnet = ofp_get_ifnet(port, vlan); ifnet->pkt_pool = odp_pool_lookup("packet_pool"); #ifdef SP ifnet->linux_index = port + 3; /* an if index of Linux != port val */ ofp_update_ifindex_lookup_tab(ifnet); sprintf(str, "slow path stack port:%d", port); ifnet->spq_def = odp_queue_create(str, ODP_QUEUE_TYPE_POLL, NULL); if (ifnet->spq_def == ODP_QUEUE_INVALID) { fail_with_odp("Slow path queue create failed.\n"); return; } #endif sprintf(str, "out default queue:%d", port); ifnet->outq_def = odp_queue_create(str, ODP_QUEUE_TYPE_POLL, NULL); if (ifnet->outq_def == ODP_QUEUE_INVALID) { fail_with_odp("Out default queue create failed.\n"); return; } sprintf(str, "interface queue:%d", port); interface_queue[port] = odp_queue_create(str, ODP_QUEUE_TYPE_POLL, NULL); if (interface_queue[port] == ODP_QUEUE_INVALID) { OFP_ERR("Poll queue create failed.\n"); return; } ofp_queue_context_set(interface_queue[port], ifnet); ofp_config_interface_up_tun(GRE_PORTS, 100 + port, vrf, local_ip, tun_rem_ip, tun_p2p, tun_addr, tun_mask); }