Exemplo n.º 1
0
/*
 * This function takes a packet and routes it as per the flow table.
 */
static void
switch_packet(struct rte_mbuf *pkt, uint8_t in_port)
{
	int pos = 0;
	struct dpdk_upcall info = {0};

	flow_key_extract(pkt, in_port, &info.key);

	pos = rte_hash_lookup(handle, &info.key);

	if (pos < 0) {
		/* flow table miss, send unmatched packet to the daemon */
		info.cmd = PACKET_CMD_MISS;
		send_packet_to_vswitchd(pkt, &info);
	} else {
		flow_table_update_stats(pos, pkt);
		action_execute(pos, pkt);
	}
}
Exemplo n.º 2
0
/*
 * This function takes a packet and routes it as per the flow table.
 */
void
switch_packet(struct rte_mbuf *pkt, uint8_t in_port)
{
	int ret = 0;
	struct dpdk_upcall info = {0};
	struct action action = {0};

	flow_key_extract(pkt, in_port, &info.key);

	ret = flow_table_get_flow(&info.key, &action, NULL);
	if (ret >= 0) {
		flow_table_update_stats(&info.key, pkt);
		action_execute(&action, pkt);
	} else {
		/* flow table miss, send unmatched packet to the daemon */
		info.cmd = PACKET_CMD_MISS;
		send_packet_to_vswitchd(pkt, &info);
	}
}