Fix potential crash if link speed is null 81/52781/1
authorXavier Simonart <xavier.simonart@intel.com>
Tue, 27 Feb 2018 22:44:51 +0000 (23:44 +0100)
committerXavier Simonart <xavier.simonart@intel.com>
Tue, 27 Feb 2018 22:44:51 +0000 (23:44 +0100)
Link_speed could be null when prox started with the ports down.
This was potentially causing a crash.
Another task will need to update link speed when the port come
up. Failing to do this results in less accurate latencies
(no extrapolation)

Change-Id: I597b68e30117e6edb9ccb4732c2acedd5eb8ac80
Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
VNFs/DPPD-PROX/handle_gen.c
VNFs/DPPD-PROX/handle_lat.c

index 515c1da..9bb34fc 100644 (file)
@@ -1145,7 +1145,7 @@ static void start(struct task_base *tbase)
        if (tbase->l3.tmaster) {
                register_all_ip_to_ctrl_plane(task);
        }
-       if (task->port) {
+       if (task->port && task->port->link_speed) {
                // 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;
index 3962b21..7901173 100644 (file)
@@ -682,7 +682,7 @@ static void lat_start(struct task_base *tbase)
 {
        struct task_lat *task = (struct task_lat *)tbase;
 
-       if (task->port) {
+       if (task->port && task->port->link_speed) {
                // 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;