summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/handle_lat.c
diff options
context:
space:
mode:
Diffstat (limited to 'VNFs/DPPD-PROX/handle_lat.c')
-rw-r--r--VNFs/DPPD-PROX/handle_lat.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/VNFs/DPPD-PROX/handle_lat.c b/VNFs/DPPD-PROX/handle_lat.c
index 1fa44137..8cc5c32b 100644
--- a/VNFs/DPPD-PROX/handle_lat.c
+++ b/VNFs/DPPD-PROX/handle_lat.c
@@ -520,6 +520,16 @@ static int handle_lat_bulk(struct task_base *tbase, struct rte_mbuf **mbufs, uin
uint32_t pkt_rx_time, pkt_tx_time;
+ // If link is down, link_speed is 0
+ if (unlikely(task->link_speed == 0)) {
+ if (task->port && task->port->link_speed != 0) {
+ task->link_speed = task->port->link_speed * 125000L;
+ plog_info("\tPort %u: link speed is %ld Mbps\n",
+ (uint8_t)(task->port - prox_port_cfg), 8 * task->link_speed / 1000000);
+ } else
+ return 0;
+ }
+
if (n_pkts == 0) {
task->begin = tbase->aux->tsc_rx.before;
return 0;
@@ -688,11 +698,17 @@ static void lat_start(struct task_base *tbase)
{
struct task_lat *task = (struct task_lat *)tbase;
- 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.
+ if (task->port) {
+ // task->port->link_speed reports the link speed in Mbps e.g. 40k for a 40 Gbps NIC.
+ // task->link_speed reports link speed in Bytes per sec.
+ // It can be 0 if link is down, and must hence be updated in fast path.
task->link_speed = task->port->link_speed * 125000L;
- plog_info("\tReceiving at %lu Mbps\n", 8 * task->link_speed / 1000000);
+ if (task->link_speed)
+ plog_info("\tPort %u: link speed is %ld Mbps\n",
+ (uint8_t)(task->port - prox_port_cfg), 8 * task->link_speed / 1000000);
+ else
+ plog_info("\tPort %u: link speed is %ld Mbps - link might be down\n",
+ (uint8_t)(task->port - prox_port_cfg), 8 * task->link_speed / 1000000);
}
}