From 15ad172a847fa667c57a4594ef4158405db9a984 Mon Sep 17 00:00:00 2001 From: Angelo Mantellini Date: Tue, 31 Mar 2020 17:50:43 +0200 Subject: [HICN-554] hicn-light refactoring MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I36f2d393741d4502ce14d3791158e43e3e9cd4cf Signed-off-by: Jordan Augé --- hicn-light/src/hicn/strategies/low_latency.h | 98 ++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 hicn-light/src/hicn/strategies/low_latency.h (limited to 'hicn-light/src/hicn/strategies/low_latency.h') diff --git a/hicn-light/src/hicn/strategies/low_latency.h b/hicn-light/src/hicn/strategies/low_latency.h new file mode 100644 index 000000000..4745c4c47 --- /dev/null +++ b/hicn-light/src/hicn/strategies/low_latency.h @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2017-2019 Cisco and/or its affiliates. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Forward on the path with lowest latency + */ + +#ifndef HICNLIGHT_STRATEGY_LOW_LATENCY_H +#define HICNLIGHT_STRATEGY_LOW_LATENCY_H + +#define MAX_FWD_STRATEGY_RELATED_PREFIXES 10 + +typedef struct { +} strategy_low_latency_nexthop_state_t; + +typedef struct { +} strategy_low_latency_state_t; + +typedef struct { + //Name ** related_prefixes; + Name *related_prefixes[MAX_FWD_STRATEGY_RELATED_PREFIXES]; + unsigned related_prefixes_len; +} strategy_low_latency_options_t; + +#if 0 + +/* + * We have global state in addition to state associated for each next hop : + */ +typedef struct { + bool in_use; + bool is_allowed; // XXX TODO the policy may not allow the use of this face +// unsigned face_id; + unsigned sent_packets; + /* switch metrics */ + unsigned last_try_to_switch_round; + unsigned try_to_switch_counter; + /* probes counters */ + unsigned recevied_probes; + unsigned rounds_without_probes; + unsigned sent_probes; + unsigned lost_probes; + unsigned non_lossy_rounds; + /* Averages */ + double avg_rtt; + double avg_rtt_in_use; + double avg_queue; + double avg_loss_rate; +} strategy_low_latency_nexthop_state_t; + +typedef struct { + // hash map from connectionId to StrategyNexthopStateLL + //PARCHashMap *strategy_state; + // XXX This is now store in each nexthop state + + /* + * Hhash map from sequence number to ticks (sent time) + * + * TODO improvement: the tick and face id could be stored in the probe and + * repeated in the reply to avoid state to be maintained. + * + * Also, in case we have few probes, linear scan might be more effective + */ + PARCHashMap *pending_probes_ticks; + + /* hash map from sequence number to face id */ + PARCHashMap *pending_probes_faces; + + const Forwarder * forwarder; + PARCEventTimer *sendProbes; + PARCEventTimer *computeBestFace; + uint8_t * probe; + hicn_name_t * name; + StrategyNexthopStateLL * bestFaces[2]; + unsigned round; + unsigned rounds_in_multipath; + unsigned rounds_with_error; + unsigned rounds_avoiding_multipath; + bool use2paths; + bool avoid_multipath; +} strategy_low_latency_state_t; + +#endif + + +#endif /* HICNLIGHT_STRATEGY_LOW_LATENCY_H */ -- cgit 1.2.3-korg