From a6ceacf3b05651e2ae5a40d47c96bdd9fc4d1416 Mon Sep 17 00:00:00 2001 From: SUTER Frederic Date: Fri, 2 Apr 2021 23:38:48 +0200 Subject: [PATCH] change way WIFI are create + make sharing_policy optional --- .../simgrid/kernel/routing/NetZoneImpl.hpp | 4 +-- include/simgrid/kernel/routing/WifiZone.hpp | 3 +- include/simgrid/s4u/Link.hpp | 1 + include/simgrid/s4u/NetZone.hpp | 10 ++----- src/kernel/lmm/maxmin.hpp | 2 ++ src/kernel/routing/NetZoneImpl.cpp | 10 ++++--- src/kernel/routing/VivaldiZone.cpp | 6 ++-- src/kernel/routing/WifiZone.cpp | 7 ++--- src/s4u/s4u_Link.cpp | 5 ++++ src/s4u/s4u_Netzone.cpp | 11 +++---- src/surf/network_cm02.cpp | 29 +++++++------------ src/surf/network_cm02.hpp | 6 ++-- src/surf/network_constant.cpp | 8 +++-- src/surf/network_constant.hpp | 4 +-- src/surf/network_interface.cpp | 5 ++++ src/surf/network_interface.hpp | 6 ++-- src/surf/network_ns3.cpp | 21 +++++++++----- src/surf/network_ns3.hpp | 9 +++--- src/surf/ptask_L07.cpp | 28 +++++++++--------- src/surf/ptask_L07.hpp | 6 ++-- src/surf/sg_platf.cpp | 3 +- 21 files changed, 95 insertions(+), 89 deletions(-) diff --git a/include/simgrid/kernel/routing/NetZoneImpl.hpp b/include/simgrid/kernel/routing/NetZoneImpl.hpp index 2e9b75b614..c1bf111d43 100644 --- a/include/simgrid/kernel/routing/NetZoneImpl.hpp +++ b/include/simgrid/kernel/routing/NetZoneImpl.hpp @@ -143,8 +143,8 @@ public: /** @brief Create a disk with the disk model from this NetZone */ s4u::Disk* create_disk(const std::string& name, double read_bandwidth, double write_bandwidth); /** @brief Make a link within that NetZone */ - virtual s4u::Link* create_link(const std::string& name, const std::vector& bandwidths, - s4u::Link::SharingPolicy policy); + virtual s4u::Link* create_link(const std::string& name, const std::vector& bandwidths); + virtual s4u::Link* create_wifi_link(const std::string& name, const std::vector& bandwidths); /** @brief Creates a new route in this NetZone */ virtual void add_bypass_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst, std::vector& link_list, bool symmetrical); diff --git a/include/simgrid/kernel/routing/WifiZone.hpp b/include/simgrid/kernel/routing/WifiZone.hpp index 381a7ba5cb..1c45b4fb44 100644 --- a/include/simgrid/kernel/routing/WifiZone.hpp +++ b/include/simgrid/kernel/routing/WifiZone.hpp @@ -30,8 +30,7 @@ public: WifiZone& operator=(const WifiZone) = delete; void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override; - s4u::Link* create_link(const std::string& name, const std::vector& bandwidths, - s4u::Link::SharingPolicy policy) override; + s4u::Link* create_link(const std::string& name, const std::vector& bandwidths) override; NetPoint* get_access_point() const { return access_point_; } }; } // namespace routing diff --git a/include/simgrid/s4u/Link.hpp b/include/simgrid/s4u/Link.hpp index 8ee0cf9f86..284f82c15d 100644 --- a/include/simgrid/s4u/Link.hpp +++ b/include/simgrid/s4u/Link.hpp @@ -72,6 +72,7 @@ public: Link* set_latency(const std::string& value); /** @brief Describes how the link is shared between flows */ + Link* set_sharing_policy(SharingPolicy policy); SharingPolicy get_sharing_policy() const; /** Setup the profile with states events (ON or OFF). The profile must contain boolean values. */ diff --git a/include/simgrid/s4u/NetZone.hpp b/include/simgrid/s4u/NetZone.hpp index a21b78d350..72922ec788 100644 --- a/include/simgrid/s4u/NetZone.hpp +++ b/include/simgrid/s4u/NetZone.hpp @@ -130,16 +130,12 @@ public: * @param policy Link sharing policy * @throw std::invalid_argument if bandwidth format is incorrect. */ - s4u::Link* create_link(const std::string& name, const std::vector& bandwidths, - Link::SharingPolicy policy = Link::SharingPolicy::SHARED); + s4u::Link* create_link(const std::string& name, const std::vector& bandwidths); /** @brief Create a link (string version) */ - s4u::Link* create_link(const std::string& name, const std::vector& bandwidths, - Link::SharingPolicy policy = Link::SharingPolicy::SHARED); + s4u::Link* create_link(const std::string& name, const std::vector& bandwidths); - /** - * @brief Seal this netzone configuration - */ + /** @brief Seal this netzone configuration */ void seal(); private: diff --git a/src/kernel/lmm/maxmin.hpp b/src/kernel/lmm/maxmin.hpp index b820202c09..d2dae4622c 100644 --- a/src/kernel/lmm/maxmin.hpp +++ b/src/kernel/lmm/maxmin.hpp @@ -187,6 +187,8 @@ public: /** @brief Unshare a constraint. */ void unshare() { sharing_policy_ = s4u::Link::SharingPolicy::FATPIPE; } + /** @brief Set how a constraint is shared */ + void set_sharing_policy(s4u::Link::SharingPolicy policy) { sharing_policy_ = policy; } /** @brief Check how a constraint is shared */ s4u::Link::SharingPolicy get_sharing_policy() const { return sharing_policy_; } diff --git a/src/kernel/routing/NetZoneImpl.cpp b/src/kernel/routing/NetZoneImpl.cpp index 0365866b0d..11c3363828 100644 --- a/src/kernel/routing/NetZoneImpl.cpp +++ b/src/kernel/routing/NetZoneImpl.cpp @@ -145,12 +145,14 @@ s4u::Disk* NetZoneImpl::create_disk(const std::string& name, double read_bandwid return l->get_iface(); } -s4u::Link* NetZoneImpl::create_link(const std::string& name, const std::vector& bandwidths, - s4u::Link::SharingPolicy policy) +s4u::Link* NetZoneImpl::create_link(const std::string& name, const std::vector& bandwidths) { - auto* l = network_model_->create_link(name, bandwidths, policy); + return network_model_->create_link(name, bandwidths)->get_iface(); +} - return l->get_iface(); +s4u::Link* NetZoneImpl::create_wifi_link(const std::string& name, const std::vector& bandwidths) +{ + return network_model_->create_wifi_link(name, bandwidths)->get_iface(); } s4u::Host* NetZoneImpl::create_host(const std::string& name, const std::vector& speed_per_pstate) diff --git a/src/kernel/routing/VivaldiZone.cpp b/src/kernel/routing/VivaldiZone.cpp index bc963e16a2..f073f37826 100644 --- a/src/kernel/routing/VivaldiZone.cpp +++ b/src/kernel/routing/VivaldiZone.cpp @@ -70,11 +70,9 @@ void VivaldiZone::set_peer_link(NetPoint* netpoint, double bw_in, double bw_out, std::string link_up = "link_" + netpoint->get_name() + "_UP"; std::string link_down = "link_" + netpoint->get_name() + "_DOWN"; - resource::LinkImpl* linkUp = - get_network_model()->create_link(link_up, std::vector(1, bw_out), s4u::Link::SharingPolicy::SHARED); + resource::LinkImpl* linkUp = get_network_model()->create_link(link_up, std::vector(1, bw_out)); linkUp->seal(); - resource::LinkImpl* linkDown = - get_network_model()->create_link(link_down, std::vector(1, bw_in), s4u::Link::SharingPolicy::SHARED); + resource::LinkImpl* linkDown = get_network_model()->create_link(link_down, std::vector(1, bw_in)); linkDown->seal(); add_private_link_at(netpoint->id(), {linkUp, linkDown}); } diff --git a/src/kernel/routing/WifiZone.cpp b/src/kernel/routing/WifiZone.cpp index 720b74887f..91ea7612e0 100644 --- a/src/kernel/routing/WifiZone.cpp +++ b/src/kernel/routing/WifiZone.cpp @@ -52,15 +52,12 @@ void WifiZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* } } -s4u::Link* WifiZone::create_link(const std::string& name, const std::vector& bandwidths, - s4u::Link::SharingPolicy policy) +s4u::Link* WifiZone::create_link(const std::string& name, const std::vector& bandwidths) { xbt_assert(wifi_link_ == nullptr, "WIFI netzone %s contains more than one link. Please only declare one, the wifi link.", get_cname()); - xbt_assert(policy == s4u::Link::SharingPolicy::WIFI, "Link %s in WIFI zone %s must follow the WIFI sharing policy.", - name.c_str(), get_cname()); - auto s4u_link = NetZoneImpl::create_link(name, bandwidths, policy); + auto s4u_link = NetZoneImpl::create_wifi_link(name, bandwidths)->set_sharing_policy(s4u::Link::SharingPolicy::WIFI); wifi_link_ = s4u_link->get_impl(); return s4u_link; } diff --git a/src/s4u/s4u_Link.cpp b/src/s4u/s4u_Link.cpp index 011917aea1..231b05d266 100644 --- a/src/s4u/s4u_Link.cpp +++ b/src/s4u/s4u_Link.cpp @@ -92,6 +92,11 @@ Link* Link::set_bandwidth(double value) return this; } +Link* Link::set_sharing_policy(Link::SharingPolicy policy) +{ + kernel::actor::simcall([this, policy] { pimpl_->set_sharing_policy(policy); }); + return this; +} Link::SharingPolicy Link::get_sharing_policy() const { return this->pimpl_->get_sharing_policy(); diff --git a/src/s4u/s4u_Netzone.cpp b/src/s4u/s4u_Netzone.cpp index 287d9e88ba..4111435738 100644 --- a/src/s4u/s4u_Netzone.cpp +++ b/src/s4u/s4u_Netzone.cpp @@ -158,15 +158,12 @@ s4u::Host* NetZone::create_host(const std::string& name, const std::vector& bandwidths, - s4u::Link::SharingPolicy policy) +s4u::Link* NetZone::create_link(const std::string& name, const std::vector& bandwidths) { - return kernel::actor::simcall( - [this, &name, &bandwidths, &policy] { return pimpl_->create_link(name, bandwidths, policy); }); + return kernel::actor::simcall([this, &name, &bandwidths] { return pimpl_->create_link(name, bandwidths); }); } -s4u::Link* NetZone::create_link(const std::string& name, const std::vector& bandwidths, - s4u::Link::SharingPolicy policy) +s4u::Link* NetZone::create_link(const std::string& name, const std::vector& bandwidths) { std::vector bw; bw.reserve(bandwidths.size()); @@ -179,7 +176,7 @@ s4u::Link* NetZone::create_link(const std::string& name, const std::vector{config::get_value("network/loopback-bw")}, - s4u::Link::SharingPolicy::FATPIPE) + loopback_ = create_link("__loopback__", std::vector{config::get_value("network/loopback-bw")}) + ->set_sharing_policy(s4u::Link::SharingPolicy::FATPIPE) ->set_latency(config::get_value("network/loopback-lat")); loopback_->seal(); } -LinkImpl* NetworkCm02Model::create_link(const std::string& name, const std::vector& bandwidths, - s4u::Link::SharingPolicy policy) +LinkImpl* NetworkCm02Model::create_link(const std::string& name, const std::vector& bandwidths) { - LinkImpl* link; - if (policy == s4u::Link::SharingPolicy::WIFI) { - link = new NetworkWifiLink(name, bandwidths, get_maxmin_system()); - } else { - xbt_assert(bandwidths.size() == 1, "Non-WIFI links must use only 1 bandwidth."); - link = new NetworkCm02Link(name, bandwidths[0], policy, get_maxmin_system()); - } + xbt_assert(bandwidths.size() == 1, "Non-WIFI links must use only 1 bandwidth."); + return (new NetworkCm02Link(name, bandwidths[0], get_maxmin_system()))->set_model(this); +} - link->set_model(this); - return link; +LinkImpl* NetworkCm02Model::create_wifi_link(const std::string& name, const std::vector& bandwidths) +{ + return (new NetworkWifiLink(name, bandwidths, get_maxmin_system()))->set_model(this); } void NetworkCm02Model::update_actions_state_lazy(double now, double /*delta*/) @@ -314,16 +309,12 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz /************ * Resource * ************/ -NetworkCm02Link::NetworkCm02Link(const std::string& name, double bandwidth, s4u::Link::SharingPolicy policy, - kernel::lmm::System* system) +NetworkCm02Link::NetworkCm02Link(const std::string& name, double bandwidth, kernel::lmm::System* system) : LinkImpl(name) { bandwidth_.scale = 1.0; bandwidth_.peak = bandwidth; this->set_constraint(system->constraint_new(this, sg_bandwidth_factor * bandwidth)); - - if (policy == s4u::Link::SharingPolicy::FATPIPE) - get_constraint()->unshare(); } void NetworkCm02Link::apply_event(kernel::profile::Event* triggered, double value) diff --git a/src/surf/network_cm02.hpp b/src/surf/network_cm02.hpp index 3cdf433898..da0d5cd9ff 100644 --- a/src/surf/network_cm02.hpp +++ b/src/surf/network_cm02.hpp @@ -31,8 +31,8 @@ class XBT_PRIVATE NetworkSmpiModel; class NetworkCm02Model : public NetworkModel { public: explicit NetworkCm02Model(const std::string& name); - LinkImpl* create_link(const std::string& name, const std::vector& bandwidths, - s4u::Link::SharingPolicy policy) override; + LinkImpl* create_link(const std::string& name, const std::vector& bandwidths) override; + LinkImpl* create_wifi_link(const std::string& name, const std::vector& bandwidths) override; void update_actions_state_lazy(double now, double delta) override; void update_actions_state_full(double now, double delta) override; Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override; @@ -44,7 +44,7 @@ public: class NetworkCm02Link : public LinkImpl { public: - NetworkCm02Link(const std::string& name, double bandwidth, s4u::Link::SharingPolicy policy, lmm::System* system); + NetworkCm02Link(const std::string& name, double bandwidth, lmm::System* system); void apply_event(kernel::profile::Event* event, double value) override; void set_bandwidth(double value) override; LinkImpl* set_latency(double value) override; diff --git a/src/surf/network_constant.cpp b/src/surf/network_constant.cpp index 9394505943..e24ea76c6c 100644 --- a/src/surf/network_constant.cpp +++ b/src/surf/network_constant.cpp @@ -26,8 +26,7 @@ namespace simgrid { namespace kernel { namespace resource { -LinkImpl* NetworkConstantModel::create_link(const std::string& name, const std::vector& /*bandwidth*/, - s4u::Link::SharingPolicy /*policy*/) +LinkImpl* NetworkConstantModel::create_link(const std::string& name, const std::vector& /*bandwidth*/) { xbt_die("Refusing to create the link %s: there is no link in the Constant network model. " "Please remove any link from your platform (and switch to routing='None')", @@ -35,6 +34,11 @@ LinkImpl* NetworkConstantModel::create_link(const std::string& name, const std:: return nullptr; } +LinkImpl* NetworkConstantModel::create_wifi_link(const std::string& name, const std::vector& bandwidths) +{ + return create_link(name, bandwidths); +} + double NetworkConstantModel::next_occurring_event(double /*now*/) { double min = -1.0; diff --git a/src/surf/network_constant.hpp b/src/surf/network_constant.hpp index fefadd8e19..c570741059 100644 --- a/src/surf/network_constant.hpp +++ b/src/surf/network_constant.hpp @@ -19,8 +19,8 @@ public: double next_occurring_event(double now) override; void update_actions_state(double now, double delta) override; - LinkImpl* create_link(const std::string& name, const std::vector& bws, - s4u::Link::SharingPolicy policy) override; + LinkImpl* create_link(const std::string& name, const std::vector& bws) override; + LinkImpl* create_wifi_link(const std::string& name, const std::vector& bws) override; }; class NetworkConstantAction : public NetworkAction { diff --git a/src/surf/network_interface.cpp b/src/surf/network_interface.cpp index c08c2833f0..4ffd1df006 100644 --- a/src/surf/network_interface.cpp +++ b/src/surf/network_interface.cpp @@ -108,6 +108,11 @@ double LinkImpl::get_bandwidth() const return bandwidth_.peak * bandwidth_.scale; } +LinkImpl* LinkImpl::set_sharing_policy(s4u::Link::SharingPolicy policy) +{ + get_constraint()->set_sharing_policy(policy); + return this; +} s4u::Link::SharingPolicy LinkImpl::get_sharing_policy() const { return get_constraint()->get_sharing_policy(); diff --git a/src/surf/network_interface.hpp b/src/surf/network_interface.hpp index 5cbb9c4923..e03a73df31 100644 --- a/src/surf/network_interface.hpp +++ b/src/surf/network_interface.hpp @@ -47,8 +47,9 @@ public: * @param bandwidth The initial bandwidth of the Link in bytes per second * @param policy The sharing policy of the Link */ - virtual LinkImpl* create_link(const std::string& name, const std::vector& bandwidths, - s4u::Link::SharingPolicy policy) = 0; + virtual LinkImpl* create_link(const std::string& name, const std::vector& bandwidths) = 0; + + virtual LinkImpl* create_wifi_link(const std::string& name, const std::vector& bandwidths) = 0; /** * @brief Create a communication between two hosts. @@ -137,6 +138,7 @@ public: virtual LinkImpl* set_latency(double value) = 0; /** @brief The sharing policy */ + virtual LinkImpl* set_sharing_policy(s4u::Link::SharingPolicy policy); virtual s4u::Link::SharingPolicy get_sharing_policy() const; /** @brief Check if the Link is used */ diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index 1195cc736b..6e4a467270 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -327,13 +327,15 @@ NetworkNS3Model::NetworkNS3Model(const std::string& name) : NetworkModel(name) s4u::NetZone::on_seal.connect(&zoneCreation_cb); } -LinkImpl* NetworkNS3Model::create_link(const std::string& name, const std::vector& bandwidths, - s4u::Link::SharingPolicy policy) +LinkImpl* NetworkNS3Model::create_link(const std::string& name, const std::vector& bandwidths) { xbt_assert(bandwidths.size() == 1, "ns-3 links must use only 1 bandwidth."); - auto link = new LinkNS3(name, bandwidths[0], policy); - link->set_model(this); - return link; + return (new LinkNS3(name, bandwidths[0]))->set_model(this); +} + +LinkImpl* NetworkNS3Model::create_wifi_link(const std::string& name, const std::vector& bandwidths) +{ + return create_link(name, bandwidths)->set_sharing_policy(s4u::Link::SharingPolicy::WIFI); } Action* NetworkNS3Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) @@ -434,8 +436,7 @@ void NetworkNS3Model::update_actions_state(double now, double delta) * Resource * ************/ -LinkNS3::LinkNS3(const std::string& name, double bandwidth, s4u::Link::SharingPolicy policy) - : LinkImpl(name), sharing_policy_(policy) +LinkNS3::LinkNS3(const std::string& name, double bandwidth) : LinkImpl(name) { bandwidth_.peak = bandwidth; } @@ -464,6 +465,12 @@ LinkImpl* LinkNS3::set_latency(double latency) latency_.peak = latency; return this; } + +LinkImpl* LinkNS3::set_sharing_policy(s4u::Link::SharingPolicy policy) +{ + sharing_policy_ = policy; + return this; +} /********** * Action * **********/ diff --git a/src/surf/network_ns3.hpp b/src/surf/network_ns3.hpp index 1e4dbc542b..7db4a38bc0 100644 --- a/src/surf/network_ns3.hpp +++ b/src/surf/network_ns3.hpp @@ -17,8 +17,8 @@ namespace resource { class NetworkNS3Model : public NetworkModel { public: explicit NetworkNS3Model(const std::string& name); - LinkImpl* create_link(const std::string& name, const std::vector& bandwidth, - s4u::Link::SharingPolicy policy) override; + LinkImpl* create_link(const std::string& name, const std::vector& bandwidth) override; + LinkImpl* create_wifi_link(const std::string& name, const std::vector& bandwidth) override; Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override; double next_occurring_event(double now) override; bool next_occurring_event_is_idempotent() override { return false; } @@ -30,15 +30,16 @@ public: ************/ class LinkNS3 : public LinkImpl { public: - explicit LinkNS3(const std::string& name, double bandwidth, s4u::Link::SharingPolicy policy); + explicit LinkNS3(const std::string& name, double bandwidth); ~LinkNS3() override; - s4u::Link::SharingPolicy sharing_policy_; + s4u::Link::SharingPolicy sharing_policy_ = s4u::Link::SharingPolicy::SHARED; void apply_event(profile::Event* event, double value) override; void set_bandwidth(double) override { THROW_UNIMPLEMENTED; } LinkImpl* set_latency(double) override; LinkImpl* set_bandwidth_profile(profile::Profile* profile) override; LinkImpl* set_latency_profile(profile::Profile* profile) override; + LinkImpl* set_sharing_policy(s4u::Link::SharingPolicy policy) override; s4u::Link::SharingPolicy get_sharing_policy() const override { return sharing_policy_; } }; diff --git a/src/surf/ptask_L07.cpp b/src/surf/ptask_L07.cpp index 5e249700c9..58184ed1c7 100644 --- a/src/surf/ptask_L07.cpp +++ b/src/surf/ptask_L07.cpp @@ -61,10 +61,10 @@ NetworkL07Model::NetworkL07Model(const std::string& name, HostL07Model* hmodel, : NetworkModel(name), hostModel_(hmodel) { set_maxmin_system(sys); - loopback_ = NetworkL07Model::create_link( - "__loopback__", std::vector{simgrid::config::get_value("network/loopback-bw")}, - s4u::Link::SharingPolicy::FATPIPE) - ->set_latency(simgrid::config::get_value("network/loopback-lat")); + loopback_ = + create_link("__loopback__", std::vector{simgrid::config::get_value("network/loopback-bw")}) + ->set_sharing_policy(s4u::Link::SharingPolicy::FATPIPE) + ->set_latency(simgrid::config::get_value("network/loopback-lat")); loopback_->seal(); } @@ -239,13 +239,16 @@ kernel::resource::Cpu* CpuL07Model::create_cpu(s4u::Host* host, const std::vecto return (new CpuL07(host, speed_per_pstate))->set_model(this); } -kernel::resource::LinkImpl* NetworkL07Model::create_link(const std::string& name, const std::vector& bandwidths, - s4u::Link::SharingPolicy policy) +kernel::resource::LinkImpl* NetworkL07Model::create_link(const std::string& name, const std::vector& bandwidths) { xbt_assert(bandwidths.size() == 1, "Non WIFI link must have only 1 bandwidth."); - auto link = new LinkL07(name, bandwidths[0], policy, get_maxmin_system()); - link->set_model(this); - return link; + return (new LinkL07(name, bandwidths[0], get_maxmin_system()))->set_model(this); +} + +kernel::resource::LinkImpl* NetworkL07Model::create_wifi_link(const std::string& name, + const std::vector& bandwidths) +{ + THROW_UNIMPLEMENTED; } /************ @@ -295,15 +298,10 @@ void CpuL07::on_speed_change() Cpu::on_speed_change(); } -LinkL07::LinkL07(const std::string& name, double bandwidth, s4u::Link::SharingPolicy policy, - kernel::lmm::System* system) - : LinkImpl(name) +LinkL07::LinkL07(const std::string& name, double bandwidth, kernel::lmm::System* system) : LinkImpl(name) { this->set_constraint(system->constraint_new(this, bandwidth)); bandwidth_.peak = bandwidth; - - if (policy == s4u::Link::SharingPolicy::FATPIPE) - get_constraint()->unshare(); } bool LinkL07::is_used() const diff --git a/src/surf/ptask_L07.hpp b/src/surf/ptask_L07.hpp index cc4e370fb5..6c7db7a1af 100644 --- a/src/surf/ptask_L07.hpp +++ b/src/surf/ptask_L07.hpp @@ -67,8 +67,8 @@ public: NetworkL07Model(const NetworkL07Model&) = delete; NetworkL07Model& operator=(const NetworkL07Model&) = delete; ~NetworkL07Model() override; - kernel::resource::LinkImpl* create_link(const std::string& name, const std::vector& bandwidths, - s4u::Link::SharingPolicy policy) override; + kernel::resource::LinkImpl* create_link(const std::string& name, const std::vector& bandwidths) override; + kernel::resource::LinkImpl* create_wifi_link(const std::string& name, const std::vector& bandwidths) override; kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override; void update_actions_state(double /*now*/, double /*delta*/) override{ @@ -106,7 +106,7 @@ protected: class LinkL07 : public kernel::resource::LinkImpl { public: - LinkL07(const std::string& name, double bandwidth, s4u::Link::SharingPolicy policy, kernel::lmm::System* system); + LinkL07(const std::string& name, double bandwidth, kernel::lmm::System* system); LinkL07(const LinkL07&) = delete; LinkL07& operator=(const LinkL07&) = delete; ~LinkL07() override; diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 0d06ac2c6e..154b2b82f7 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -108,11 +108,12 @@ simgrid::kernel::routing::NetPoint* sg_platf_new_router(const std::string& name, static void sg_platf_new_link(const simgrid::kernel::routing::LinkCreationArgs* args, const std::string& link_name) { - simgrid::s4u::Link* link = routing_get_current()->create_link(link_name, args->bandwidths, args->policy); + simgrid::s4u::Link* link = routing_get_current()->create_link(link_name, args->bandwidths); if (args->properties) link->set_properties(*args->properties); link->get_impl() // this call to get_impl saves some simcalls but can be removed + ->set_sharing_policy(args->policy) ->set_state_profile(args->state_trace) ->set_latency_profile(args->latency_trace) ->set_bandwidth_profile(args->bandwidth_trace) -- 2.20.1