From nobody Mon Nov 25 14:45:33 2024 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 790C717C7C4 for ; Sun, 27 Oct 2024 20:00:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730059238; cv=none; b=ULfww3rAq7sbfZAlG8qWPO1fJNsmxe9+zBSY6z2Xme7aSe756mUB1XfgL6TjqAUV2AUeRItqIAxvc1F2oB0ePXxx9EjB19OW2qfk6JIi8HC05jJg+YEXLdo0byJeBQ66Yr5obVXFkIt5tt4hG9vk7YTLkBvyt0ZoVfy1vbevl+c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730059238; c=relaxed/simple; bh=VHhZB28IIwVBWZ2xsaRrLZwKAcbAvIs7KSme+L/DT+4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WAjv0rlC5hR6qtn704D/kZFTMYrPUzke3zlht8puREY3h7tR53Hep1NY84YrFViNOiqxIfo9481E7i+RIzJJ5J7Fwhq8C7rSDaf6sIE7a0iSWfPMRwz7TLxeXJR5mQ4X6XbqXZKfY5AcZLV5KrCOTpyz2oC8g4RNe2e5INubClQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kutsevol.com; spf=none smtp.mailfrom=kutsevol.com; dkim=pass (2048-bit key) header.d=kutsevol-com.20230601.gappssmtp.com header.i=@kutsevol-com.20230601.gappssmtp.com header.b=ChCfa5hl; arc=none smtp.client-ip=209.85.216.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kutsevol.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=kutsevol.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kutsevol-com.20230601.gappssmtp.com header.i=@kutsevol-com.20230601.gappssmtp.com header.b="ChCfa5hl" Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-2e2ed2230d8so2701857a91.0 for ; Sun, 27 Oct 2024 13:00:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kutsevol-com.20230601.gappssmtp.com; s=20230601; t=1730059236; x=1730664036; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=YENpUKbduqxVuEV/yivX0PhHhOYASce4Ahgx8awj2TE=; b=ChCfa5hlncWHU7rRPGYuScBtCxsjDFFGX/o9A+JgbULz70BhIedR0EN3FBKl94Gl1V Ixt4ItEIiE93p+njTE1GC1ANiR807WnbF1pCe9+CgXPtEvLM3lNDCBVI+94YSZHP34ad D4k+OA7k3HyvL2LHuPN+CGFsRBEEq9+NgFL4mDhb8DLnXsWDT0SqCCAvrVzSeSERQkMo DGTV/pVI1ML7w2ngYT6Io1JntxpETdTKRilSdgq8y3wPMF4znoETXvUA76YU/tJgLFn/ i0mE3Q2pSUhDbL063KYPdk/2DBjau2GdoG3ULAsXu47AA6P8GM8j6cK/auHZAjbMBdz3 mYXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730059236; x=1730664036; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YENpUKbduqxVuEV/yivX0PhHhOYASce4Ahgx8awj2TE=; b=AAiYB7YfFZYZyP8AMfXbOwX7V7thhbLBeOyJx3cwn4BbvJy3w4tcDN/WB+T+6DnAtY g60TopBx2IH/wYsfp7sWw4+bhyemR5AwoJ+CVF/FR+lKyWXI1DMoqsl8jpsRuaFnIpvQ GMJdaSEHy5l0JJEFyAjBMEPqhqoAUCLXduaa6GCEPbU6AmdqSlnSP7EZVT8bP5AnSKtX sq4jXOhL7aRYjkQ7uBg/CsxSBQ0AleJEGrkyGT78pTdTGIhAYtMUOwxRL+xaR6RL9iKC 2t9ZzZag4ui51PkNY5ZIj/Td4s9k1coePQCZausozdnoO3+df7KX94WbgIHOtxTnTzlS +X8g== X-Forwarded-Encrypted: i=1; AJvYcCVn/fmM+rlGwH1+o9Gy9Q7TDgTsEhzKJj+qldsWyDbrg5DTn1drMp1Z1C+sv7jNRMk50ACQOZD6a0CTTxk=@vger.kernel.org X-Gm-Message-State: AOJu0Yy6LstrUwI/J1kKzm9B+02mhTqqR3E2JhE2N5N3FQ9jUGacfk8N MoDx+ivhd3XdwxpKi6tMFZYIr5j+TqPPedZqdBrrdYGPQ6ICwahX/gus1uNjkQM= X-Google-Smtp-Source: AGHT+IHw4G2h5OhXN7y8gFSZCCL9yGR1i5dt7024b8+0E+2hUOMyvQtNo1/pO5VkO1GIACQasQpNTw== X-Received: by 2002:a17:90a:c089:b0:2e2:b69c:2a9 with SMTP id 98e67ed59e1d1-2e8f11ac969mr7039524a91.26.1730059235675; Sun, 27 Oct 2024 13:00:35 -0700 (PDT) Received: from localhost.localdomain (fwdproxy-ash-017.fbsv.net. [2a03:2880:20ff:11::face:b00c]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-461321431a1sm27946241cf.25.2024.10.27.13.00.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Oct 2024 13:00:35 -0700 (PDT) From: Maksym Kutsevol Date: Sun, 27 Oct 2024 12:59:41 -0700 Subject: [PATCH net-next v4 1/2] netpoll: Make netpoll_send_udp return status instead of void 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-Transfer-Encoding: quoted-printable Message-Id: <20241027-netcons-add-udp-send-fail-statistics-to-netconsole-v4-1-a8065a43c897@kutsevol.com> References: <20241027-netcons-add-udp-send-fail-statistics-to-netconsole-v4-0-a8065a43c897@kutsevol.com> In-Reply-To: <20241027-netcons-add-udp-send-fail-statistics-to-netconsole-v4-0-a8065a43c897@kutsevol.com> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Jonathan Corbet , Andrew Lunn , Breno Leitao Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Maksym Kutsevol X-Mailer: b4 0.13.0 netpoll_send_udp can return if send was successful. It will allow client code to be aware of the send status. Possible return values are the result of __netpoll_send_skb (cast to int) and -ENOMEM. This doesn't cover the case when TX was not successful instantaneously and was scheduled for later, __netpoll__send_skb returns success in that case. Signed-off-by: Maksym Kutsevol Reviewed-by: Breno Leitao --- include/linux/netpoll.h | 2 +- net/core/netpoll.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index cd4e28db0cbd..b1ba8d6331a5 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -56,7 +56,7 @@ static inline void netpoll_poll_disable(struct net_device= *dev) { return; } static inline void netpoll_poll_enable(struct net_device *dev) { return; } #endif =20 -void netpoll_send_udp(struct netpoll *np, const char *msg, int len); +int netpoll_send_udp(struct netpoll *np, const char *msg, int len); void netpoll_print_options(struct netpoll *np); int netpoll_parse_options(struct netpoll *np, char *opt); int __netpoll_setup(struct netpoll *np, struct net_device *ndev); diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 94b7f07a952f..1f36f351b5f9 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -390,7 +390,7 @@ netdev_tx_t netpoll_send_skb(struct netpoll *np, struct= sk_buff *skb) } EXPORT_SYMBOL(netpoll_send_skb); =20 -void netpoll_send_udp(struct netpoll *np, const char *msg, int len) +int netpoll_send_udp(struct netpoll *np, const char *msg, int len) { int total_len, ip_len, udp_len; struct sk_buff *skb; @@ -414,7 +414,7 @@ void netpoll_send_udp(struct netpoll *np, const char *m= sg, int len) skb =3D find_skb(np, total_len + np->dev->needed_tailroom, total_len - len); if (!skb) - return; + return -ENOMEM; =20 skb_copy_to_linear_data(skb, msg, len); skb_put(skb, len); @@ -490,7 +490,7 @@ void netpoll_send_udp(struct netpoll *np, const char *m= sg, int len) =20 skb->dev =3D np->dev; =20 - netpoll_send_skb(np, skb); + return (int)netpoll_send_skb(np, skb); } EXPORT_SYMBOL(netpoll_send_udp); =20 --=20 2.43.5