Previously, the ability to override the system default for the number
of handler threads was broken since to the introduction of the per-CPU
upcall handlers.
This patch rectifies this behavior by re-enabling manual configuration
of the handler thread count.
Fixes: b1e517bd2f81 ("dpif-netlink: Introduce per-cpu upcall dispatch.")
Signed-off-by: Eelco Chaudron <[email protected]>
---
lib/dpif-netlink.c | 8 +++++++-
lib/dpif-provider.h | 4 ++++
ofproto/ofproto-dpif-upcall.c | 2 +-
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c
index 84e2bd8ea..fd5532014 100644
--- a/lib/dpif-netlink.c
+++ b/lib/dpif-netlink.c
@@ -2839,7 +2839,13 @@ dpif_netlink_number_handlers_required(struct dpif
*dpif_, uint32_t *n_handlers)
struct dpif_netlink *dpif = dpif_netlink_cast(dpif_);
if (dpif_netlink_upcall_per_cpu(dpif)) {
- *n_handlers = dpif_netlink_calculate_n_handlers();
+ uint32_t calc_handlers = dpif_netlink_calculate_n_handlers();
+
+ /* When a specific number of handlers is requested, we honor this as
+ * long as they are less than the suggested number. */
+ if (!*n_handlers || *n_handlers > calc_handlers) {
+ *n_handlers = calc_handlers;
+ }
return true;
}
diff --git a/lib/dpif-provider.h b/lib/dpif-provider.h
index 520e21e68..fc3d39803 100644
--- a/lib/dpif-provider.h
+++ b/lib/dpif-provider.h
@@ -369,6 +369,10 @@ struct dpif_class {
/* Queries 'dpif' to see if a certain number of handlers are required by
* the implementation.
*
+ * The 'n_handlers' value can be initialize with a system/user suggestion.
+ * It's up to the implementation if this suggestion fits the requirements
+ * for correct operation.
+ *
* If a certain number of handlers are required, returns 'true' and sets
* 'n_handlers' to that number of handler threads.
*
diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
index 9a5c5c29c..f9d8f9cc7 100644
--- a/ofproto/ofproto-dpif-upcall.c
+++ b/ofproto/ofproto-dpif-upcall.c
@@ -660,7 +660,7 @@ udpif_set_threads(struct udpif *udpif, uint32_t n_handlers_,
uint32_t n_revalidators_)
{
ovs_assert(udpif);
- uint32_t n_handlers_requested;
+ uint32_t n_handlers_requested = n_handlers_;
uint32_t n_revalidators_requested;
bool forced = false;
--
2.43.0
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev