summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/handle_gen.c
diff options
context:
space:
mode:
authorXavier Simonart <xavier.simonart@intel.com>2018-01-08 11:21:44 +0100
committerXavier Simonart <xavier.simonart@intel.com>2018-01-24 14:14:18 +0100
commit442501d625b6d05f38267d442fd4e42f6cebef7d (patch)
treeb3193066faf1255e1c9a34c4f0ebe5a05ec9adb4 /VNFs/DPPD-PROX/handle_gen.c
parentdeab1ee8197298bd7cf30d259a28206841d59383 (diff)
Fix extrapolation used in latency measurements
When doing latency measurements PROX takes into account the generation or reception of a bulk of packets. For instance, if PROX receives at time T 4 packets, it knows that the first packet was received by te NIC before T (the time to receive the other 3 packets, as they were received at maximum link speed). So the latency data is decreased by the minimum time to receive those 3 packets. For this PROX was using a default link speed of 10Gbps. This is wrong for 1Gbps and 40Gbps networks, and was causing for instance issues on 40 Gbps networks as extrapolating too much, resulting in either too low latencies or negative numbers (visible as very high latencies). Change-Id: I4e0f02e8383dd8d168ac50ecae37a05510ad08bc Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
Diffstat (limited to 'VNFs/DPPD-PROX/handle_gen.c')
-rw-r--r--VNFs/DPPD-PROX/handle_gen.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/VNFs/DPPD-PROX/handle_gen.c b/VNFs/DPPD-PROX/handle_gen.c
index c48b4c13..0f70ee6b 100644
--- a/VNFs/DPPD-PROX/handle_gen.c
+++ b/VNFs/DPPD-PROX/handle_gen.c
@@ -122,6 +122,7 @@ struct task_gen {
struct ether_addr src_mac;
uint8_t flags;
uint8_t cksum_offload;
+ struct prox_port_cfg *port;
} __rte_cache_aligned;
static inline uint8_t ipv4_get_hdr_len(struct ipv4_hdr *ip)
@@ -1144,6 +1145,12 @@ static void start(struct task_base *tbase)
if (tbase->l3.tmaster) {
register_all_ip_to_ctrl_plane(task);
}
+ if (task->port) {
+ // task->port->link->speed reports the link speed in Mbps e.g. 40k for a 40 Gbps NIC
+ // task->link_speed reported link speed in Bytes per sec.
+ task->link_speed = task->port->link_speed * 125000L;
+ plog_info("\tGenerating at %ld Mbps\n", 8 * task->link_speed / 1000000);
+ }
/* TODO
Handle the case when two tasks transmit to the same port
and one of them is stopped. In that case ARP (requests or replies)
@@ -1190,9 +1197,16 @@ static void init_task_gen(struct task_base *tbase, struct task_args *targ)
task->sig = targ->sig;
task->new_rate_bps = targ->rate_bps;
+ /*
+ * For tokens, use 10 Gbps as base rate
+ * Scripts can then use speed command, with speed=100 as 10 Gbps and speed=400 as 40 Gbps
+ * Script can query prox "port info" command to find out the port link speed to know
+ * at which rate to start. Note that virtio running on OVS returns 10 Gbps, so a script has
+ * probably also to check the driver (as returned by the same "port info" command.
+ */
struct token_time_cfg tt_cfg = token_time_cfg_create(1250000000, rte_get_tsc_hz(), -1);
-
token_time_init(&task->token_time, &tt_cfg);
+
init_task_gen_seeds(task);
task->min_bulk_size = targ->min_bulk_size;
@@ -1211,8 +1225,6 @@ static void init_task_gen(struct task_base *tbase, struct task_args *targ)
task->generator_id = targ->generator_id;
task->link_speed = UINT64_MAX;
- if (targ->nb_txrings == 0 && targ->nb_txports == 1)
- task->link_speed = 1250000000;
if (!strcmp(targ->pcap_file, "")) {
plog_info("\tUsing inline definition of a packet\n");
@@ -1237,6 +1249,7 @@ static void init_task_gen(struct task_base *tbase, struct task_args *targ)
struct prox_port_cfg *port = find_reachable_port(targ);
if (port) {
task->cksum_offload = port->capabilities.tx_offload_cksum;
+ task->port = port;
}
}