From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fhigh-a6-smtp.messagingengine.com (fhigh-a6-smtp.messagingengine.com [103.168.172.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E3BC635966; Mon, 3 Feb 2025 09:20:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.157 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738574440; cv=none; b=sMRsBSfdw24NmRNm1uXF31zkoe1p9JdCknpxoN9Y9AGoLAQgGKHrOCZs1ZRRscrjGsESms7Sk/tH0rFJuvfNUPNj7npSFDUWNyBWNv0kPIU7TmD1DLjQHXl1fdC4EQ6IdnPJ3YoS+mKjvcauFspnINNWmeiPrDaEjADEMnBYBcE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738574440; c=relaxed/simple; bh=eH8RTlzzHp4UeP8KiQIoY8gIaSQQAs8szmF27FWar1c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=im5urJQGPGBkkh2GicJuWFjFq2aCuxPhakddrf7rA+nATCWLZHlb1z/6ds02w76uRXX+LWSuT2kiwsBgzUOQtog8K8/is2nD4FWB1Z7Se1KQznGZpIak+XrzqApRq4H2RyW3mQmacfep/bwufX7UYRuBXVtadejmexaBtZv3MIs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=queasysnail.net; spf=pass smtp.mailfrom=queasysnail.net; dkim=pass (2048-bit key) header.d=queasysnail.net header.i=@queasysnail.net header.b=Vd9frdIm; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=PwVTjJiB; arc=none smtp.client-ip=103.168.172.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=queasysnail.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=queasysnail.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=queasysnail.net header.i=@queasysnail.net header.b="Vd9frdIm"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="PwVTjJiB" Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfhigh.phl.internal (Postfix) with ESMTP id B06D91140172; Mon, 3 Feb 2025 04:20:35 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Mon, 03 Feb 2025 04:20:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=queasysnail.net; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm1; t=1738574435; x= 1738660835; bh=YlFWSO22bl8+fawPp6D8ReMiTZsYoX3fNRXYOkRD+pw=; b=V d9frdImBGEGNN6HH2PlR+iCuevMDIBikfhw4bmf75WnKy+9Z7tbZ04hBVaY84Riu Uph5qGx28t6hoVT2oryTI6NtMqQFvOA5bj/JLb1rAcQc5zQOAyrEVvokxYQDr/Dw a/nYrtj4RdP+MaBKefxEADAAC9qLBIs9u9z5dBzOssEZVm/4wx78C5ZyyDySmVCf A54zf6kamdGTQUDGTdzcwon1px8SPICo7zl5N88vDdyoliIxObIsTx+E4s9p8Y1M BAy/4Y8FzMug6ogRBbATemrBr6F6RtzxRGFIDt+ahEbLLhzB7vl1OrdDWiqB8lJ0 rzCPNVlU30vqYC+MuUNIQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1738574435; x=1738660835; bh=YlFWSO22bl8+fawPp6D8ReMiTZsYoX3fNRX YOkRD+pw=; b=PwVTjJiBiXi7CTfXdINoIOd4rhsNSaUgd+VjZnANQkP6MtjXRyr MWWOcx2YT9Fky0JpKDlM860arvHGo0ayBJjIAz9Zc3NWPFSjl6ufOfk1LBI7YSmr 5967oyQBaT5sp/ajyfZHt9LtTx/4QJz07YUrnJyPICKBbqsmmAruGqkoIXhSeVqe qAr1FN0GH7Fmb+Wahw4JXkz2cKNWuHvjHYR/xdLrLaVmc1jat4vzFLwSTkppUrDA SzsVF3kb3Eo4cfcKfeJZiqcy6QXNLoecHHeLyAjO9VhtwkxrGJpeQxuXAAov0Q4w KLxsSOUEs430dKjjqWUkXXIngioMAARNmiw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddujedvvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpeffhffvvefukfhfgggtuggjsehttdertddttdej necuhfhrohhmpefurggsrhhinhgrucffuhgsrhhotggruceoshgusehquhgvrghshihsnh grihhlrdhnvghtqeenucggtffrrghtthgvrhhnpeeuhffhfffgfffhfeeuiedugedtfefh keegteehgeehieffgfeuvdeuffefgfduffenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpehsugesqhhuvggrshihshhnrghilhdrnhgvthdpnhgs pghrtghpthhtohepudefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegrnhhtoh hnihhosehophgvnhhvphhnrdhnvghtpdhrtghpthhtohepnhgvthguvghvsehvghgvrhdr khgvrhhnvghlrdhorhhgpdhrtghpthhtohepvgguuhhmrgiivghtsehgohhoghhlvgdrtg homhdprhgtphhtthhopehkuhgsrgeskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepphgr sggvnhhisehrvgguhhgrthdrtghomhdprhgtphhtthhopeguohhnrghlugdrhhhunhhtvg hrsehgmhgrihhlrdgtohhmpdhrtghpthhtohepshhhuhgrhheskhgvrhhnvghlrdhorhhg pdhrtghpthhtoheprhihrgiirghnohhvrdhsrdgrsehgmhgrihhlrdgtohhmpdhrtghpth htoheprghnughrvgifodhnvghtuggvvheslhhunhhnrdgthh X-ME-Proxy: Feedback-ID: i934648bf:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 3 Feb 2025 04:20:34 -0500 (EST) Date: Mon, 3 Feb 2025 10:20:32 +0100 From: Sabrina Dubroca To: Antonio Quartulli Cc: netdev@vger.kernel.org, Eric Dumazet , Jakub Kicinski , Paolo Abeni , Donald Hunter , Shuah Khan , ryazanov.s.a@gmail.com, Andrew Lunn , Simon Horman , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Xiao Liang Subject: Re: [PATCH net-next v18 17/25] ovpn: implement keepalive mechanism Message-ID: References: <20250113-b4-ovpn-v18-0-1f00db9c2bd6@openvpn.net> <20250113-b4-ovpn-v18-17-1f00db9c2bd6@openvpn.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20250113-b4-ovpn-v18-17-1f00db9c2bd6@openvpn.net> 2025-01-13, 10:31:36 +0100, Antonio Quartulli wrote: > +void ovpn_xmit_special(struct ovpn_peer *peer, const void *data, > + const unsigned int len) > +{ > + struct ovpn_priv *ovpn; > + struct sk_buff *skb; > + > + ovpn = peer->ovpn; > + if (unlikely(!ovpn)) > + return; > + > + skb = alloc_skb(256 + len, GFP_ATOMIC); > + if (unlikely(!skb)) > + return; > + > + skb_reserve(skb, 128); > + skb->priority = TC_PRIO_BESTEFFORT; > + __skb_put_data(skb, data, len); > + > + /* increase reference counter when passing peer to sending queue */ > + if (!ovpn_peer_hold(peer)) { > + netdev_dbg(ovpn->dev, > + "cannot hold peer reference for sending special packet\n"); > + kfree_skb(skb); > + return; > + } > + > + ovpn_send(ovpn, skb, peer); > +} [...] > +static void ovpn_peer_keepalive_send(struct work_struct *work) > +{ > + struct ovpn_peer *peer = container_of(work, struct ovpn_peer, > + keepalive_work); > + > + local_bh_disable(); > + ovpn_xmit_special(peer, ovpn_keepalive_message, > + sizeof(ovpn_keepalive_message)); > + local_bh_enable(); > + ovpn_peer_put(peer); nit: could we simply drop this put and the hold in ovpn_xmit_special? ovpn_peer_keepalive_send has a reference on the peer from the WQ, just transfer it to ovpn_xmit_special and then ovpn_send. No need to pretend to acquire one for ovpn_send's sake and drop the one we got from the WQ? (ovpn_xmit_special would need to _put(peer) in case of early return) > +} -- Sabrina