Beispiel #1
0
int main()
{

	int ret;

	ret = odp_rpc_server_start();
	if (ret) {
		fprintf(stderr, "[RPC] Error: Failed to start server\n");
		exit(EXIT_FAILURE);
	}

	if ( __k1_get_cluster_id() == 128 ) {
		printf("Spawning clusters\n");
		{
			static char const * _argv[] = {
				"odp_ipsec.kelf",
				"-i", "e0:loop,e1:loop",
				"-r", "192.168.111.2/32:e0:00.07.43.30.4a.70",
				"-r", "192.168.222.2/32:e1:00.07.43.30.4a.78",
				"-p", "192.168.111.0/24:192.168.222.0/24:out:both",
				"-e", "192.168.111.2:192.168.222.2:aesgcm:201:656c8523255ccc23a66c1917aa0cf309",
				"-a", "192.168.111.2:192.168.222.2:aesgcm:200:656c8523255ccc23a66c1917aa0cf309",
				"-p", "192.168.222.0/24:192.168.111.0/24:in:both",
				"-e", "192.168.222.2:192.168.111.2:aesgcm:301:656c8523255ccc23a66c1917aa0cf309",
				"-a", "192.168.222.2:192.168.111.2:aesgcm:300:656c8523255ccc23a66c1917aa0cf309",
				"-c", "14", "-m", "ASYNC_IN_PLACE", NULL
			};

			for (int i = 0; i < 16; i++) {
				if ( i % 4 == 0 ) continue;
				if ( i % 4 == 3 ) continue;
				boot_cluster(i, _argv[0], _argv);
			}
		}
		{
			static char const * _argv[] = {
				"odp_generator.kelf",
				"-I", "e0:loop:nofree",
				"--srcmac", "08:00:27:76:b5:e0",
				"--dstmac", "00:00:00:00:80:01",
				"--srcip",  "192.168.111.2",
				"--dstip", "192.168.222.2",
				"-m", "u",
				"-i", "0", "-w", "2", "-p", "256", NULL
			};

			for (int i = 0; i < 16; i += 4) {
        if ( i % 4 == 1 ) continue;
				if ( i % 4 == 2 ) continue;
				if ( i % 4 == 3 ) continue;
				boot_cluster(i, _argv[0], _argv);
			}
		}
		printf("Cluster booted\n");
	}

	join_clusters(NULL);

	return 0;
}
Beispiel #2
0
int boot_clusters(int argc, char * const argv[])
{
	unsigned int i;
	int opt;
	if (__k1_get_cluster_id() != 128)
		return -1;

	while ((opt = getopt(argc, argv, "c:a:")) != -1) {
		switch (opt) {
		case 'c':
			{
				struct clus_bin_boot *clus =
					&clus_bin_boots[clus_count];
				clus->bin = strdup(optarg);
				clus->id = clus_count;
				clus->argv[0] = clus->bin;
				clus->argc = 1;
				clus_count++;
			}
			break;
		case 'a':
			{
				char *pch = strtok(strdup(optarg), " ");
				while ( pch != NULL ) {
					struct clus_bin_boot *clus =
					  &clus_bin_boots[clus_count - 1];
					clus->argv[clus->argc] = pch;
					clus->argc++;
					pch = strtok(NULL, " ");
				}
			}
			break;
		default: /* '?' */
			fprintf(stderr, "Wrong arguments for boot\n");
			return -1;
		}
	}

	for (i = 0; i < clus_count; i++) {
		struct clus_bin_boot *clus = &clus_bin_boots[i];

		clus->argv[clus->argc] = NULL;
		if (boot_cluster(i, clus->argv[0], clus->argv))
			return -1;
	}
	return 0;
}
Beispiel #3
0
int main(int argc, char *const argv[])
{

	int ret;
	unsigned clusters = 0;
	unsigned n_clusters = 0;
	int opt;

	while ((opt = getopt(argc, argv, "c:h")) != -1) {
		switch (opt) {
		case 'c':
			{
				unsigned mask = 1 << atoi(optarg);
				if ((clusters & mask) == 0)
					n_clusters ++;
				clusters |= mask;
			}
			break;
		case 'h':
			printf("Usage: %s [ -c <clus_id> -c <clus_id> -c ... ]", argv[0]);
			exit(0);
			break;
		default: /* '?' */
			fprintf(stderr, "Wrong arguments\n");
			return -1;
		}
	}
	if (clusters == 0) {
		clusters = 0xffff;
		n_clusters = 16;
	}


	ret = pcie_init(MPPA_PCIE_ETH_IF_MAX, 0);
	if (ret != 0) {
		fprintf(stderr, "Failed to initialize PCIe eth interface\n");
		exit(1);
	}
	ret = odp_rpc_server_start();
	if (ret) {
		fprintf(stderr, "[RPC] Error: Failed to start server\n");
		exit(EXIT_FAILURE);
	}
	if ( __k1_get_cluster_id() == 128 ) {
		printf("Spawning clusters\n");
		{
			static char const * _argv[] = {
				"odp_l2fwd.kelf",
				"-i", "p0p0:tags=120,p1p0:tags=120",
				"-m", "0",
				"-s", "0",
				"-c", "10", NULL
			};

			while(clusters) {
				int clus_id = __builtin_k1_ctz(clusters);
				clusters &= ~ (1 << clus_id);
				boot_cluster(clus_id, _argv[0], _argv);
			}
		}
		printf("Cluster booted\n");
	}

	join_clusters(NULL);

	return 0;
}
Beispiel #4
0
int main(int argc, char *const argv[])
{

	int ret;
	unsigned n_clusters = 1;
	int opt;

	while ((opt = getopt(argc, argv, "c:h")) != -1) {
		switch (opt) {
			case 'c':
				n_clusters =  atoi(optarg);
				break;
			case 'h':
				printf("Usage: %s [ -c <n_clusters> (number of l2fwd clusters, 1..14) ]", argv[0]);
				exit(0);
				break;
			default: /* '?' */
				fprintf(stderr, "Wrong arguments\n");
				return -1;
		}
	}
	if (!n_clusters) n_clusters = 1;
	if (n_clusters > 14) n_clusters = 14;

	ret = pcie_init(MPPA_PCIE_ETH_IF_MAX, 0);
	if (ret != 0) {
		fprintf(stderr, "Failed to initialize PCIe eth interface\n");
		exit(1);
	}
	ret = odp_rpc_server_start();
	if (ret) {
		fprintf(stderr, "[RPC] Error: Failed to start server\n");
		exit(EXIT_FAILURE);
	}
	if ( __k1_get_cluster_id() == 128 ) {
		printf("Spawning clusters\n");
		{
			static char const * _argv[] = {
				"odp_l2fwd.kelf",
				"-i", "e0:tags=120:min_payload=48:max_payload=48,e1:tags=120:min_payload=48:max_payload=48",
				"-m", "0",
				"-s", "0",
				"-a", "2",
				//"-S",
				//"-t", "30",
				"-c", "8", NULL
			};

			for (unsigned i = 0; i < n_clusters; i++) 
				boot_cluster(i, _argv[0], _argv);
		}
		if (1)
		{
			static char const * _argv[] = {
				"odp_generator.kelf",
				"-I", "e0:nofree", // generates traffic on eth0,
				"--srcmac", "08:00:27:76:b5:e0",
				"--dstmac", "00:00:00:00:80:01",
				"--srcip",  "192.168.111.2",
				"--dstip",  "192.168.222.2",
				"-m", "u",   // UDP mode
				"-i", "0",   // interval between sends
				"-w", "1",   // worker generating traffic per cluster
				"-P", "64",  // total packet length 64B
				NULL
			};
			boot_cluster(14, _argv[0], _argv);
		}
		if (1)
		{
			static char const * _argv[] = {
				"odp_generator.kelf",
				"-I", "e1:nofree", // generates traffic on eth1,
				"--srcmac", "08:00:27:76:b5:e1",
				"--dstmac", "00:00:00:00:80:01",
				"--srcip",  "192.168.111.2",
				"--dstip",  "192.168.222.2",
				"-m", "u",   // UDP mode
				"-i", "0",   // interval between sends
				"-w", "1",   // worker generating traffic per cluster
				"-P", "64",  // total packet length 64B
				NULL
			};
			boot_cluster(15, _argv[0], _argv);
		}
		printf("Clusters booted\n");
	}

	join_clusters(NULL);

	return 0;
}
Beispiel #5
0
int main()
{

	int ret, status;
	unsigned nocTx;
	mppa_dnoc_header_t header = { 0 };
	mppa_dnoc_channel_config_t config = { 0 };
	mppa_ethernet_header_t eth_header;

	memset(&eth_header, 0, sizeof(eth_header));

	ret = odp_rpc_server_start();
	if (ret) {
		fprintf(stderr, "[RPC] Error: Failed to start server\n");
		exit(EXIT_FAILURE);
	}
	printf("CNOC setup\n");
	if (cluster_init_cnoc_rx() < 0){
		fprintf(stderr, "Failed to setup CNoC\n");
		exit(EXIT_FAILURE);
	}
	printf("CNOC setup done\n");

	printf("Spawning clusters\n");
	{
		static char const * _argv[] = {
			"pktio-ddr",
			"-i", "ioddr0:min_rx=" TOSTRING(MIN_TAG)
			":max_rx=" TOSTRING(MAX_TAG)
			":tags=" TOSTRING(N_RX)
			":log2fragments=" TOSTRING(_ODP_LOG2MAX_FRAGS)
			":cnoc=2:rrpolicy=20:rroffset=20:fc=1,drop",
			"-m", "0",
			"-s", "0",
			"-t", "15",
			"-c", "2", NULL
		};

		boot_cluster(0, _argv[0], _argv);
	}
	printf("Cluster booted\n");


	for (int i = 0; i < DATA_SIZE; ++i)
		data[i] = i;
	ret = mppa_routing_get_dnoc_unicast_route(128, 0, &config, &header);
	if (ret != MPPA_ROUTING_RET_SUCCESS) {
		fprintf(stderr, "Failed to route to cluster 0\n");
		return -1;
	}

	config._.loopback_multicast = 0;
	config._.cfg_pe_en = 1;
	config._.cfg_user_en = 1;
	config._.write_pe_en = 1;
	config._.write_user_en = 1;
	config._.decounter_id = 0;
	config._.decounted = 0;
	config._.payload_min = 0;
	config._.payload_max = 32;
	config._.bw_current_credit = 0xff;
	config._.bw_max_credit     = 0xff;
	config._.bw_fast_delay     = 0x00;
	config._.bw_slow_delay     = 0x00;

	header._.multicast = 0;
	header._.valid = 1;

	ret = mppa_noc_dnoc_tx_alloc_auto(0, &nocTx, MPPA_NOC_BLOCKING);
	if (ret != MPPA_NOC_RET_SUCCESS) {
		fprintf(stderr, "Failed to find an available Tx on DMA 0\n");
		return -1;
	}

	sleep(10);
	header._.tag = MIN_TAG;
	eth_header.timestamp = 0;
	eth_header.info._.pkt_id = 0;
	eth_header.info._.pkt_size = PKTIO_MTU + sizeof(eth_header);

	uint64_t pkt_count = 0;
	printf("Start sending\n");
	while(pkt_count < 1200000) {
		for( int i = 0; i < DATA_SIZE / PKTIO_MTU; i ++) {
			uint64_t remote_pkt_count;

			ret = mppa_noc_dnoc_tx_configure(0, nocTx, header, config);
			if (ret != MPPA_NOC_RET_SUCCESS) {
				fprintf(stderr, "Failed to configure Tx\n");
				return -1;
			}

			eth_header.timestamp++;
			eth_header.info._.pkt_id++;

			do {
				remote_pkt_count = mppa_noc_cnoc_rx_get_value(0, CNOC_RX);
			} while(pkt_count > remote_pkt_count + (MAX_TAG - MIN_TAG + 1));
			mppa_noc_dnoc_tx_send_data(0, nocTx, sizeof(eth_header), &eth_header);
			mppa_noc_dnoc_tx_send_data_eot(0, nocTx, PKTIO_MTU, &data[i * PKTIO_MTU]);

			header._.tag++;
			if (header._.tag > MAX_TAG)
				header._.tag = MIN_TAG;

			pkt_count++;
		}
	}

	if ((ret = join_clusters(&status)) != 0) {
		fprintf(stderr, "Failed to joined clusters\n");
		return ret;
	}
	if (status){
		fprintf(stderr, "Clusters returned with errors: %d\n", status);
		fflush(stderr);
		return status;
	}

	return 0;
}