@@ -180,22 +180,8 @@ pkt_burst_5tuple_swap(struct fwd_stream *fs)
return true;
}
-static void
-stream_init_5tuple_swap(struct fwd_stream *fs)
-{
- bool rx_stopped, tx_stopped;
-
- rx_stopped = ports[fs->rx_port].rxq[fs->rx_queue].state ==
- RTE_ETH_QUEUE_STATE_STOPPED;
- tx_stopped = ports[fs->tx_port].txq[fs->tx_queue].state ==
- RTE_ETH_QUEUE_STATE_STOPPED;
- fs->disabled = rx_stopped || tx_stopped;
-}
-
struct fwd_engine five_tuple_swap_fwd_engine = {
.fwd_mode_name = "5tswap",
- .port_fwd_begin = NULL,
- .port_fwd_end = NULL,
- .stream_init = stream_init_5tuple_swap,
+ .stream_init = common_fwd_stream_init,
.packet_fwd = pkt_burst_5tuple_swap,
};
@@ -1201,22 +1201,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
return true;
}
-static void
-stream_init_checksum_forward(struct fwd_stream *fs)
-{
- bool rx_stopped, tx_stopped;
-
- rx_stopped = ports[fs->rx_port].rxq[fs->rx_queue].state ==
- RTE_ETH_QUEUE_STATE_STOPPED;
- tx_stopped = ports[fs->tx_port].txq[fs->tx_queue].state ==
- RTE_ETH_QUEUE_STATE_STOPPED;
- fs->disabled = rx_stopped || tx_stopped;
-}
-
struct fwd_engine csum_fwd_engine = {
.fwd_mode_name = "csum",
- .port_fwd_begin = NULL,
- .port_fwd_end = NULL,
- .stream_init = stream_init_checksum_forward,
+ .stream_init = common_fwd_stream_init,
.packet_fwd = pkt_burst_checksum_forward,
};
@@ -199,22 +199,9 @@ flowgen_begin(portid_t pi)
return 0;
}
-static void
-flowgen_stream_init(struct fwd_stream *fs)
-{
- bool rx_stopped, tx_stopped;
-
- rx_stopped = ports[fs->rx_port].rxq[fs->rx_queue].state ==
- RTE_ETH_QUEUE_STATE_STOPPED;
- tx_stopped = ports[fs->tx_port].txq[fs->tx_queue].state ==
- RTE_ETH_QUEUE_STATE_STOPPED;
- fs->disabled = rx_stopped || tx_stopped;
-}
-
struct fwd_engine flow_gen_engine = {
.fwd_mode_name = "flowgen",
.port_fwd_begin = flowgen_begin,
- .port_fwd_end = NULL,
- .stream_init = flowgen_stream_init,
+ .stream_init = common_fwd_stream_init,
.packet_fwd = pkt_burst_flow_gen,
};
@@ -507,22 +507,8 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs)
return true;
}
-static void
-icmpecho_stream_init(struct fwd_stream *fs)
-{
- bool rx_stopped, tx_stopped;
-
- rx_stopped = ports[fs->rx_port].rxq[fs->rx_queue].state ==
- RTE_ETH_QUEUE_STATE_STOPPED;
- tx_stopped = ports[fs->tx_port].txq[fs->tx_queue].state ==
- RTE_ETH_QUEUE_STATE_STOPPED;
- fs->disabled = rx_stopped || tx_stopped;
-}
-
struct fwd_engine icmp_echo_engine = {
.fwd_mode_name = "icmpecho",
- .port_fwd_begin = NULL,
- .port_fwd_end = NULL,
- .stream_init = icmpecho_stream_init,
+ .stream_init = common_fwd_stream_init,
.packet_fwd = reply_to_icmp_echo_rqsts,
};
@@ -215,16 +215,10 @@ port_ieee1588_fwd_end(portid_t pi)
static void
port_ieee1588_stream_init(struct fwd_stream *fs)
{
- bool rx_stopped, tx_stopped;
-
/* Force transmission on reception port */
fs->tx_port = fs->rx_port;
- rx_stopped = ports[fs->rx_port].rxq[fs->rx_queue].state ==
- RTE_ETH_QUEUE_STATE_STOPPED;
- tx_stopped = ports[fs->tx_port].txq[fs->tx_queue].state ==
- RTE_ETH_QUEUE_STATE_STOPPED;
- fs->disabled = rx_stopped || tx_stopped;
+ common_fwd_stream_init(fs);
}
struct fwd_engine ieee1588_fwd_engine = {
@@ -82,22 +82,8 @@ pkt_burst_io_forward(struct fwd_stream *fs)
return true;
}
-static void
-stream_init_forward(struct fwd_stream *fs)
-{
- bool rx_stopped, tx_stopped;
-
- rx_stopped = ports[fs->rx_port].rxq[fs->rx_queue].state ==
- RTE_ETH_QUEUE_STATE_STOPPED;
- tx_stopped = ports[fs->tx_port].txq[fs->tx_queue].state ==
- RTE_ETH_QUEUE_STATE_STOPPED;
- fs->disabled = rx_stopped || tx_stopped;
-}
-
struct fwd_engine io_fwd_engine = {
.fwd_mode_name = "io",
- .port_fwd_begin = NULL,
- .port_fwd_end = NULL,
- .stream_init = stream_init_forward,
+ .stream_init = common_fwd_stream_init,
.packet_fwd = pkt_burst_io_forward,
};
@@ -113,22 +113,8 @@ pkt_burst_mac_forward(struct fwd_stream *fs)
return true;
}
-static void
-stream_init_mac_forward(struct fwd_stream *fs)
-{
- bool rx_stopped, tx_stopped;
-
- rx_stopped = ports[fs->rx_port].rxq[fs->rx_queue].state ==
- RTE_ETH_QUEUE_STATE_STOPPED;
- tx_stopped = ports[fs->tx_port].txq[fs->tx_queue].state ==
- RTE_ETH_QUEUE_STATE_STOPPED;
- fs->disabled = rx_stopped || tx_stopped;
-}
-
struct fwd_engine mac_fwd_engine = {
.fwd_mode_name = "mac",
- .port_fwd_begin = NULL,
- .port_fwd_end = NULL,
- .stream_init = stream_init_mac_forward,
+ .stream_init = common_fwd_stream_init,
.packet_fwd = pkt_burst_mac_forward,
};
@@ -92,22 +92,8 @@ pkt_burst_mac_swap(struct fwd_stream *fs)
return true;
}
-static void
-stream_init_mac_swap(struct fwd_stream *fs)
-{
- bool rx_stopped, tx_stopped;
-
- rx_stopped = ports[fs->rx_port].rxq[fs->rx_queue].state ==
- RTE_ETH_QUEUE_STATE_STOPPED;
- tx_stopped = ports[fs->tx_port].txq[fs->tx_queue].state ==
- RTE_ETH_QUEUE_STATE_STOPPED;
- fs->disabled = rx_stopped || tx_stopped;
-}
-
struct fwd_engine mac_swap_engine = {
.fwd_mode_name = "macswap",
- .port_fwd_begin = NULL,
- .port_fwd_end = NULL,
- .stream_init = stream_init_mac_swap,
+ .stream_init = common_fwd_stream_init,
.packet_fwd = pkt_burst_mac_swap,
};
@@ -278,22 +278,10 @@ noisy_fwd_begin(portid_t pi)
return 0;
}
-static void
-stream_init_noisy_vnf(struct fwd_stream *fs)
-{
- bool rx_stopped, tx_stopped;
-
- rx_stopped = ports[fs->rx_port].rxq[fs->rx_queue].state ==
- RTE_ETH_QUEUE_STATE_STOPPED;
- tx_stopped = ports[fs->tx_port].txq[fs->tx_queue].state ==
- RTE_ETH_QUEUE_STATE_STOPPED;
- fs->disabled = rx_stopped || tx_stopped;
-}
-
struct fwd_engine noisy_vnf_engine = {
.fwd_mode_name = "noisy",
.port_fwd_begin = noisy_fwd_begin,
.port_fwd_end = noisy_fwd_end,
- .stream_init = stream_init_noisy_vnf,
+ .stream_init = common_fwd_stream_init,
.packet_fwd = pkt_burst_noisy_vnf,
};
@@ -71,8 +71,6 @@ stream_init_receive(struct fwd_stream *fs)
struct fwd_engine rx_only_engine = {
.fwd_mode_name = "rxonly",
- .port_fwd_begin = NULL,
- .port_fwd_end = NULL,
.stream_init = stream_init_receive,
.packet_fwd = pkt_burst_receive,
};
@@ -114,8 +114,6 @@ shared_rxq_stream_init(struct fwd_stream *fs)
struct fwd_engine shared_rxq_engine = {
.fwd_mode_name = "shared_rxq",
- .port_fwd_begin = NULL,
- .port_fwd_end = NULL,
.stream_init = shared_rxq_stream_init,
.packet_fwd = shared_rxq_fwd,
};
@@ -2386,6 +2386,16 @@ launch_packet_forwarding(lcore_function_t *pkt_fwd_on_lcore)
}
}
+void
+common_fwd_stream_init(struct fwd_stream *fs)
+{
+ bool rx_stopped, tx_stopped;
+
+ rx_stopped = (ports[fs->rx_port].rxq[fs->rx_queue].state == RTE_ETH_QUEUE_STATE_STOPPED);
+ tx_stopped = (ports[fs->tx_port].txq[fs->tx_queue].state == RTE_ETH_QUEUE_STATE_STOPPED);
+ fs->disabled = rx_stopped || tx_stopped;
+}
+
/*
* Launch packet forwarding configuration.
*/
@@ -392,6 +392,8 @@ struct fwd_engine {
packet_fwd_t packet_fwd; /**< Mandatory. */
};
+void common_fwd_stream_init(struct fwd_stream *fs);
+
#define FLEX_ITEM_MAX_SAMPLES_NUM 16
#define FLEX_ITEM_MAX_LINKS_NUM 16
#define FLEX_MAX_FLOW_PATTERN_LENGTH 64
@@ -508,7 +508,6 @@ tx_only_stream_init(struct fwd_stream *fs)
struct fwd_engine tx_only_engine = {
.fwd_mode_name = "txonly",
.port_fwd_begin = tx_only_begin,
- .port_fwd_end = NULL,
.stream_init = tx_only_stream_init,
.packet_fwd = pkt_burst_transmit,
};