Signed-off-by: Marek Lindner <mareklind...@neomailbox.ch>
---
 net/batman-adv/main.h     | 6 ++++--
 net/batman-adv/tp_meter.c | 5 +++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index 8da3c933..89dfaf87 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -137,9 +137,11 @@
 #define BATADV_NC_NODE_TIMEOUT 10000 /* Milliseconds */
 
 /**
- * BATADV_TP_MAX_NUM - maximum number of simultaneously active tp sessions
+ * BATADV_TP_MAX_NUM_QUEUE - maximum number of queued (outgoing) tp sessions
+ * BATADV_TP_MAX_NUM_RECV - maximum number of simultaneous receiving streams
  */
-#define BATADV_TP_MAX_NUM 5
+#define BATADV_TP_MAX_NUM_QUEUE 10
+#define BATADV_TP_MAX_NUM_RECV 1
 
 /**
  * enum batadv_mesh_state - State of a soft interface
diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c
index d91d371d..eb7862cd 100644
--- a/net/batman-adv/tp_meter.c
+++ b/net/batman-adv/tp_meter.c
@@ -939,7 +939,8 @@ void batadv_tp_start(struct batadv_priv *bat_priv, const u8 
*dst,
        session_cookie = batadv_tp_session_cookie(session_id, icmp_uid);
        *cookie = session_cookie;
 
-       if (!atomic_add_unless(&bat_priv->tp_num, 1, BATADV_TP_MAX_NUM)) {
+       if (!atomic_add_unless(&bat_priv->tp_num, 1, BATADV_TP_MAX_NUM_QUEUE)) {
+               spin_unlock_bh(&bat_priv->tp_list_lock);
                batadv_dbg(BATADV_DBG_TP_METER, bat_priv,
                           "Meter: too many ongoing sessions, aborting 
(SEND)\n");
                batadv_tp_batctl_error_notify(BATADV_TP_REASON_TOO_MANY, dst,
@@ -1316,7 +1317,7 @@ batadv_tp_init_recv(struct batadv_priv *bat_priv,
        if (tp_vars)
                goto out_unlock;
 
-       if (!atomic_add_unless(&bat_priv->tp_num, 1, BATADV_TP_MAX_NUM)) {
+       if (!atomic_add_unless(&bat_priv->tp_num, 1, BATADV_TP_MAX_NUM_RECV)) {
                batadv_dbg(BATADV_DBG_TP_METER, bat_priv,
                           "Meter: too many ongoing sessions, aborting 
(RECV)\n");
                goto out_unlock;
-- 
2.17.0

Reply via email to