| .. | .. |
|---|
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0 |
|---|
| 2 | | -/* Copyright (C) 2012-2018 B.A.T.M.A.N. contributors: |
|---|
| 2 | +/* Copyright (C) 2012-2020 B.A.T.M.A.N. contributors: |
|---|
| 3 | 3 | * |
|---|
| 4 | 4 | * Edo Monticelli, Antonio Quartulli |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or |
|---|
| 7 | | - * modify it under the terms of version 2 of the GNU General Public |
|---|
| 8 | | - * License as published by the Free Software Foundation. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, but |
|---|
| 11 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 13 | | - * General Public License for more details. |
|---|
| 14 | | - * |
|---|
| 15 | | - * You should have received a copy of the GNU General Public License |
|---|
| 16 | | - * along with this program; if not, see <http://www.gnu.org/licenses/>. |
|---|
| 17 | 5 | */ |
|---|
| 18 | 6 | |
|---|
| 19 | 7 | #include "tp_meter.h" |
|---|
| .. | .. |
|---|
| 33 | 21 | #include <linux/kernel.h> |
|---|
| 34 | 22 | #include <linux/kref.h> |
|---|
| 35 | 23 | #include <linux/kthread.h> |
|---|
| 24 | +#include <linux/limits.h> |
|---|
| 36 | 25 | #include <linux/list.h> |
|---|
| 37 | 26 | #include <linux/netdevice.h> |
|---|
| 38 | 27 | #include <linux/param.h> |
|---|
| .. | .. |
|---|
| 77 | 66 | |
|---|
| 78 | 67 | /** |
|---|
| 79 | 68 | * BATADV_TP_MAX_RTO - Maximum sender timeout. If the sender RTO gets beyond |
|---|
| 80 | | - * such amound of milliseconds, the receiver is considered unreachable and the |
|---|
| 69 | + * such amount of milliseconds, the receiver is considered unreachable and the |
|---|
| 81 | 70 | * connection is killed |
|---|
| 82 | 71 | */ |
|---|
| 83 | 72 | #define BATADV_TP_MAX_RTO 30000 |
|---|
| .. | .. |
|---|
| 119 | 108 | * batadv_tp_cwnd() - compute the new cwnd size |
|---|
| 120 | 109 | * @base: base cwnd size value |
|---|
| 121 | 110 | * @increment: the value to add to base to get the new size |
|---|
| 122 | | - * @min: minumim cwnd value (usually MSS) |
|---|
| 111 | + * @min: minimum cwnd value (usually MSS) |
|---|
| 123 | 112 | * |
|---|
| 124 | | - * Return the new cwnd size and ensures it does not exceed the Advertised |
|---|
| 125 | | - * Receiver Window size. It is wrap around safe. |
|---|
| 113 | + * Return the new cwnd size and ensure it does not exceed the Advertised |
|---|
| 114 | + * Receiver Window size. It is wrapped around safely. |
|---|
| 126 | 115 | * For details refer to Section 3.1 of RFC5681 |
|---|
| 127 | 116 | * |
|---|
| 128 | 117 | * Return: new congestion window size in bytes |
|---|
| .. | .. |
|---|
| 265 | 254 | * @dst: the other endpoint MAC address to look for |
|---|
| 266 | 255 | * |
|---|
| 267 | 256 | * Look for a tp_vars object matching dst as end_point and return it after |
|---|
| 268 | | - * having incremented the refcounter. Return NULL is not found |
|---|
| 257 | + * having increment the refcounter. Return NULL is not found |
|---|
| 269 | 258 | * |
|---|
| 270 | 259 | * Return: matching tp_vars or NULL when no tp_vars with @dst was found |
|---|
| 271 | 260 | */ |
|---|
| .. | .. |
|---|
| 302 | 291 | * @session: session identifier |
|---|
| 303 | 292 | * |
|---|
| 304 | 293 | * Look for a tp_vars object matching dst as end_point, session as tp meter |
|---|
| 305 | | - * session and return it after having incremented the refcounter. Return NULL |
|---|
| 294 | + * session and return it after having increment the refcounter. Return NULL |
|---|
| 306 | 295 | * is not found |
|---|
| 307 | 296 | * |
|---|
| 308 | 297 | * Return: matching tp_vars or NULL when no tp_vars was found |
|---|
| .. | .. |
|---|
| 368 | 357 | */ |
|---|
| 369 | 358 | static void batadv_tp_vars_put(struct batadv_tp_vars *tp_vars) |
|---|
| 370 | 359 | { |
|---|
| 360 | + if (!tp_vars) |
|---|
| 361 | + return; |
|---|
| 362 | + |
|---|
| 371 | 363 | kref_put(&tp_vars->refcount, batadv_tp_vars_release); |
|---|
| 372 | 364 | } |
|---|
| 373 | 365 | |
|---|