Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2060930lqo; Sun, 19 May 2024 11:16:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXdhHcJWPeYszusfeM8R/isk8JbA32CfOQlXW6tltxsgZbHJRK2pUBKXyPyW1LcfHg1c9sKkmTtHBSKoi3A/sXFB6vAhkMr1RG4H8NTQg== X-Google-Smtp-Source: AGHT+IELODE1+C7bdNq+8b+p8nHxLpQJneE0WpQfuXL+KTYsSfALlA7bAH6gdRNjlbXBbqj+/uNt X-Received: by 2002:a17:90a:e616:b0:2b6:214a:71ac with SMTP id 98e67ed59e1d1-2bd60353110mr6096926a91.3.1716142596496; Sun, 19 May 2024 11:16:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716142596; cv=pass; d=google.com; s=arc-20160816; b=dV2NMEN5Pdq31a4fSmlsWbYfGKE8yDCgoDl+sAUPPo87cQUpFO6Vb+7PVejgykRWLZ qKMhFYDeHooQpkuMe2DbZANpEPqO1HRGdTKYNyOTgA8ZbIo3fW1j4mA8i/KDojfJT4M4 8K+zGsqJyL9UrE7GiNCos+Xbtuly+yW8bCP/KhiInxmlcKuBi/ocF57ET6tjQiJSuhY2 AxfzmCHyIplpUt2Pd+PZp7X1SHIjvRDu23ywGHH/x4hF4kCCpFB6DbkzTkklkDnRjVsX Zgtk8/l807R5RN29oxfARYKAJjz4f4nUxV4g62BWZTe1cAjxGuz1bGRMKT0dGzzPXwG4 aeVQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=UYsczhSMQVTcPtKcf8myz36ovdn5xE0T0cUehFANQaI=; fh=xxCsNu7J+h8y1EVcA22ulopN9zWCiIDt1XrP3Rq5kAc=; b=Y0aCzjFkteoVQZ33DoquX8aAhsXz0wXDM80O7oJDMxnNHTcuSgJ1sG4X2dgVsetBdj zVDnM4JZCWe3dXBh/VKlFnmk+94K9CnZ6GgSygaF8ubnjtq+hfGcOZlNtYaQxSk7R5fV a28o/Jesl6UJUntkshl5WuSEYOIhbk1WuxD4YPQSebvlSdY8owbCv0lpJhUWYf5VxbYB FjlYLqJ6Q2Q0R5pvb3ksNLAlNqehNoSehqdu8HZPRrfsNtuWiBu4QlPt20YWk0IeJ899 XNhi2zKMQjUXoJTPV0Yr43QNnYXJLQ7KONWGeQkVCUQ8foDeHKwSCZprhpRenFLaKsoo /Icw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Y1C9pHte; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-183116-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183116-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2b628fb9ac3si23229684a91.131.2024.05.19.11.16.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 May 2024 11:16:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-183116-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Y1C9pHte; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-183116-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183116-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B67A5B20DC3 for ; Sun, 19 May 2024 14:01:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CF83548CE0; Sun, 19 May 2024 14:00:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Y1C9pHte" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 1BAB08BEA; Sun, 19 May 2024 14:00:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716127255; cv=none; b=vEd9OiRMzeU+TW5nmcTocpS2BCxptANcuFM/KYnGh0Y75k0um3fdnNqoN0ukvUpsttBljisiVbhEmRI0LGrpj0drbJcI/8NNaXp6CrU8TY7Ap0w9rUncKixOOEq73UB4TZt4hrFLOsJV63ukRWYjc+T+uHijHkTbSZPlQR5SXjs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716127255; c=relaxed/simple; bh=q29JoiujTS2XkolE6zF5+VhKvwJw4Z7qx2SIZperaRY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Qys5xQ58T1atpNBOzkb2jfIhM8RHW6WIrogTvvxmG/pFhC5a0boWMJ/gbmcG2gdy2dX4vA3WSSTSww3DyfXNjYFxwZOAjFfd/TBk+iUONKrPLAskeJBmPd0DgAzwwAE7crS3sZDlELsk71EViYKfA2ogli8nHsRiqIzds9aCmyI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=Y1C9pHte; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=UYsczhSMQVTcPtKcf8myz36ovdn5xE0T0cUehFANQaI=; b=Y1C9pHtertFWleTQDsvZ5j/0kD TXtqk93sdYj1Ugwm8ZnYXN65UV8D4FvavTl6n2e2IhROmLQi3dmRhHk2F+M6rvGjMj6qHQchnt4h9 SYdkWzpkt6/v2p/duAGLGF9cQP1wgwu7tXZAXigVVYSXOoRrvn26Mzetr7R/BW9j3wr6NsrJFtDq9 Yw37NPG8xX79BEE4pRHxHXKCpU+LVCrR0/1rjXbPoEaXWYjQ0r2vhxb08qbV1tZnEUvcjvNP9HqWj gCc6QBm6OKThPwIfv2to8eQGh5NsKViokgz0A96Xpx1b0LCrq8YevSfW4u+QGrGBfYhZ8yiM8zE+0 DzoCTXcA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1s8h5f-0000000F4a1-07t2; Sun, 19 May 2024 14:00:43 +0000 Date: Sun, 19 May 2024 15:00:42 +0100 From: Matthew Wilcox To: Markus Elfring Cc: Siddharth Vadapalli , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel-janitors@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jonathan Corbet , MD Danish Anwar , Paolo Abeni , Roger Quadros , Vladimir Oltean , LKML , linux-doc@vger.kernel.org, Misael Lopez Cruz , Sriramakrishnan , Vignesh Raghavendra Subject: Re: [RFC PATCH net-next 12/28] net: ethernet: ti: cpsw-proxy-client: add NAPI RX polling function Message-ID: References: <20240518124234.2671651-13-s-vadapalli@ti.com> 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 Content-Transfer-Encoding: 8bit In-Reply-To: FYI, Markus can be safely ignored. His opinions are well-established as being irrelevant. On Sun, May 19, 2024 at 03:18:52PM +0200, Markus Elfring wrote: > … > > +++ b/drivers/net/ethernet/ti/cpsw-proxy-client.c > … > > @@ -988,6 +994,189 @@ static int vport_tx_poll(struct napi_struct *napi_tx, int budget) > … > > +static int vport_rx_packets(struct virtual_port *vport, u32 rx_chan_idx) > > +{ > … > > + if (unlikely(!netif_running(skb->dev))) { > > + dev_kfree_skb_any(skb); > > + return -ENODEV; > > + } > > I suggest to move such exception handling to the end of this function implementation > so that it can be better reused also by another if branch. > https://wiki.sei.cmu.edu/confluence/display/c/MEM12-C.+Consider+using+a+goto+chain+when+leaving+a+function+on+error+when+using+and+releasing+resources > > How do you think about to increase the application of scope-based resource management > also for such a software component? > https://elixir.bootlin.com/linux/v6.9.1/source/include/linux/cleanup.h > > Regards, > Markus >