[prev in list] [next in list] [prev in thread] [next in thread]
List: mesos-commits
Subject: (mesos) 02/02: Exposed HTB qdisc config in the API.
From: bmahler () apache ! org
Date: 2024-01-24 18:09:42
Message-ID: 20240124180940.688B5440790 () gitbox2-he-fi ! apache ! org
[Download RAW message or body]
This is an automated email from the ASF dual-hosted git repository.
bmahler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 4a5dc0b3b1604133e32797172e2fbe95b13eaba9
Author: Ilya Pronin <ipronin@twitter.com>
AuthorDate: Wed Nov 8 09:45:10 2017 -0800
Exposed HTB qdisc config in the API.
---
src/linux/routing/queueing/htb.cpp | 17 +++++++----------
src/linux/routing/queueing/htb.hpp | 12 +++++++++++-
2 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/src/linux/routing/queueing/htb.cpp b/src/linux/routing/queueing/htb.cpp
index 5e5f0710b..eaaad55b0 100644
--- a/src/linux/routing/queueing/htb.cpp
+++ b/src/linux/routing/queueing/htb.cpp
@@ -38,14 +38,6 @@ using std::string;
namespace routing {
namespace queueing {
-namespace htb {
-
-// NOTE: The htb queueing discipline configuration is not exposed to
-// the user but the queueing class configuration is.
-struct DisciplineConfig {};
-
-} // namespace htb {
-
/////////////////////////////////////////////////
// Type specific {en}decoding functions for disciplines and classes.
/////////////////////////////////////////////////
@@ -60,6 +52,10 @@ Try<Nothing> encode<htb::DisciplineConfig>(
const Netlink<struct rtnl_qdisc>& qdisc,
const htb::DisciplineConfig& config)
{
+ int error = rtnl_htb_set_defcls(qdisc.get(), config.defcls);
+ if (error != 0) {
+ return Error(string(nl_geterror(error)));
+ }
return Nothing();
}
@@ -164,7 +160,8 @@ Try<bool> exists(const string& link, const Handle& parent)
Try<bool> create(
const string& link,
const Handle& parent,
- const Option<Handle>& handle)
+ const Option<Handle>& handle,
+ const Option<DisciplineConfig>& config)
{
return internal::create(
link,
@@ -172,7 +169,7 @@ Try<bool> create(
KIND,
parent,
handle,
- DisciplineConfig()));
+ config.getOrElse(DisciplineConfig())));
}
diff --git a/src/linux/routing/queueing/htb.hpp b/src/linux/routing/queueing/htb.hpp
index e5b4f5722..64f16841f 100644
--- a/src/linux/routing/queueing/htb.hpp
+++ b/src/linux/routing/queueing/htb.hpp
@@ -34,6 +34,15 @@ namespace htb {
constexpr char KIND[] = "htb";
+struct DisciplineConfig
+{
+ DisciplineConfig(uint32_t _defcls = 0)
+ : defcls(_defcls) {}
+
+ // Default class.
+ uint32_t defcls;
+};
+
// Returns true if there exists an htb queueing discipline on the
// egress side of the link.
Try<bool> exists(
@@ -47,7 +56,8 @@ Try<bool> exists(
Try<bool> create(
const std::string& link,
const Handle& parent,
- const Option<Handle>& handle);
+ const Option<Handle>& handle,
+ const Option<DisciplineConfig>& config = None());
// Removes the htb queueing discipline from the link. Returns
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic