Re: [PATCH net-next v20 20/25] ovpn: implement peer add/get/dump/delete via netlink

2025-03-02 Thread Antonio Quartulli




On 02/03/2025 19:24, Sabrina Dubroca wrote:

2025-02-27, 02:21:45 +0100, Antonio Quartulli wrote:

@@ -1310,9 +1329,12 @@ void ovpn_peer_keepalive_work(struct work_struct *work)
if (next_run > 0 && ovpn->registered) {
netdev_dbg(ovpn->dev,
   "scheduling keepalive work: now=%llu next_run=%llu 
delta=%llu\n",
-  next_run, now, next_run - now);
+  next_run, now, next_run - now ?: 0);


nit: I don't think this "?: 0" does anything


Ouch, I missed the ">= 0".
The idea is that now may have outgrown next_run and in that case we must 
reschedule the worker immediately (while also avoid passing a negative 
number as delay).



Will get this fixed.

Cheers,




+   /* due to the waiting above, the next_run deadline may have
+* passed: in this case we reschedule the worker immediately
+*/
schedule_delayed_work(&ovpn->keepalive_work,
- (next_run - now) * HZ);
+ (next_run - now) * HZ ?: 0);


nit: same here



--
Antonio Quartulli
OpenVPN Inc.




Re: [PATCH net-next v20 20/25] ovpn: implement peer add/get/dump/delete via netlink

2025-03-02 Thread Sabrina Dubroca
2025-02-27, 02:21:45 +0100, Antonio Quartulli wrote:
> @@ -1310,9 +1329,12 @@ void ovpn_peer_keepalive_work(struct work_struct *work)
>   if (next_run > 0 && ovpn->registered) {
>   netdev_dbg(ovpn->dev,
>  "scheduling keepalive work: now=%llu next_run=%llu 
> delta=%llu\n",
> -next_run, now, next_run - now);
> +next_run, now, next_run - now ?: 0);

nit: I don't think this "?: 0" does anything

> + /* due to the waiting above, the next_run deadline may have
> +  * passed: in this case we reschedule the worker immediately
> +  */
>   schedule_delayed_work(&ovpn->keepalive_work,
> -   (next_run - now) * HZ);
> +   (next_run - now) * HZ ?: 0);

nit: same here

-- 
Sabrina