Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4664357rwb; Mon, 31 Jul 2023 10:10:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlGtXuwMkq0VPUTnPDEGVd/X1cesXJuljqMSg062v3WoDGrUg7J8ordqFves9QI3fqr4Fqtn X-Received: by 2002:a17:906:74d7:b0:991:b834:af83 with SMTP id z23-20020a17090674d700b00991b834af83mr332231ejl.59.1690823422739; Mon, 31 Jul 2023 10:10:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690823422; cv=none; d=google.com; s=arc-20160816; b=ijbSWIt+lKJKKkV+Iz4WHnOyF3ysWNBiP7pHvWPCba0Jtd3plmZDLZHjtFiZlU+8dy be1LWOlqop9zybqtRmNAHdkMq+euENM9TAhvTVbhfR5ym/NUGas2Y5wmQSwNRUB4c2rc F/iszGjzUi17mczsaHUh7MHsEPiGuRVcoUpDbsQTLES7QE1R1gX0ee3hTMkomewZiAk0 QFxBkpQZ49nYhJK3o/gHMVQEDgH3ECzVPmn4NY0yCQyrvrmzNQKpQK/WSqk1+ei0wyAT xY21fYyjKRaOXGAEGeO+SOAhxxWHfEtRIA9gE86AFhoSGIoVK6m7qq6bgX0VBVN7PURL NtEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=Ak31I13bPEew3/Tpszn9p9CRM7VDw+o7XZnvG9ECAZE=; fh=7XwpytWNJWz9RDezMNrW/rL2XV2qZuDON/LcrcvJR9o=; b=Dsm0/XDp7guwpzx3JEvoYiDXGZYg4f9Pta526gHYCb4mLsp8cJ+yy9YUhkBImpwt8K 2OZUcW/d0P3QqmqZ8XlQ1k4w8xX7R4kAM42l1V9bdmifkkv21lsZjKQ2wO/lcev9YUl3 HqHRLRrMiFVKJZC6vPrzC4vaIEWpOnNVIJsajdV/s7dSV0QfxDgF9f8xZ+AgrInmMeWt yP9CXJYZMvHEl95P07L1j26mPl9bXIYMQlc3JEUxj/yQLnzVpzOSiXhPnm6bviQl6Mno trXNZryeNXWy3FGmEs2St2Eii4dYmVzcLV/UW7tH6JMnMdgnyYPTPJeBsDX2WWNlJOVQ JjrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JwP2f6Ui; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j9-20020a170906050900b0099bcddb371esi205760eja.260.2023.07.31.10.09.57; Mon, 31 Jul 2023 10:10:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JwP2f6Ui; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233420AbjGaQwE (ORCPT + 99 others); Mon, 31 Jul 2023 12:52:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229998AbjGaQwD (ORCPT ); Mon, 31 Jul 2023 12:52:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8712AA6; Mon, 31 Jul 2023 09:52:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1939F61230; Mon, 31 Jul 2023 16:52:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E0D0C433C8; Mon, 31 Jul 2023 16:52:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690822321; bh=CGzW4Z4n87oXkmDgD3NYNy1uk7m9r4O9fbpQ0K4fcrw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=JwP2f6UiI/vu1DP9is9j8UII+ounDJXNS96unDEUTuoypnss/KVF645UcDhKT1oX+ MxD72lxig3/MfG2acIqu6QYXzcHTRD5Gu2QeJ6BWlTu+W14gikM9dg20Pvkl4iGC+G Wb3fiR6p4u6l0Lw05mRLbxTf3rRvNlY/kN5F1TO9wnosooHIRdQdF2wn+c9Fk0QW8T sEteJiW0DkcJXo8tJiRf+5rIuQbj1/OEKValoXbf/8RXyTqb50vvXO7t4kezgIE4mw /TrUY9WAxRAxGCdWYmP88TLvkiq7acc2xKsWUdoHC2bewk8jBZdMPE/Ua1P2QOVY4t L2Af9fI3xDQMw== Date: Mon, 31 Jul 2023 09:51:59 -0700 From: Jakub Kicinski To: Md Danish Anwar Cc: MD Danish Anwar , Randy Dunlap , Roger Quadros , Simon Horman , Vignesh Raghavendra , Andrew Lunn , Richard Cochran , Conor Dooley , Krzysztof Kozlowski , Rob Herring , Paolo Abeni , Eric Dumazet , "David S. Miller" , , , , , , , Subject: Re: [PATCH v12 06/10] net: ti: icssg-prueth: Add ICSSG ethernet driver Message-ID: <20230731095159.3b7e3b75@kernel.org> In-Reply-To: <8790da4f-1378-410c-f637-f85ca4d34604@ti.com> References: <20230727112827.3977534-1-danishanwar@ti.com> <20230727112827.3977534-7-danishanwar@ti.com> <20230728172419.702b4ac0@kernel.org> <8790da4f-1378-410c-f637-f85ca4d34604@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 31 Jul 2023 16:49:59 +0530 Md Danish Anwar wrote: > There are five error handling cases in xmit(). > > 1. DMA Mapping the linear buffer -- If we fail to map dma, we will return > NETDEV_TX_OK and goto drop_free_skb which will free the skb and drop the packet. > > 2. Allocating descriptor for linear buffer -- If we fail to allocate descriptor > this means it is a occupancy issue and we will goto drop_stop_q_busy which will > stop queue and return NETDEV_TX_BUSY. > > 3. Allocating descriptor when skb is fragmented. -- If we fail to allocate > descriptor when skb is fragmented, we will goto drop_stop_q which will stop the > queue, free the descriptor, free the skb, drop the packet and return NETDEV_TX_OK. This one should be BUSY, right? goto free_desc_stop_q_busy > 4. DMA mapping for fragment. -- If DMA mapping for fragment fails, we will go > to drop_free_descs which will free the descriptor, free the skb, drop the > packet and return NETDEV_TX_OK. > > 5. Tx push failed. -- If tx push fails we will goto drop_free_descs which will > free the descriptor, free the skb, drop the packet and return. > > We will only stop queue in case 2 and 3 where we failed to allocate descriptor. > In case 1, 4 and 5 we are encountering dma mapping error, so for these cases we > will not stop the queue. > > Below will be my goto labels. > > drop_stop_q: > netif_tx_stop_queue(netif_txq); > > drop_free_descs: > prueth_xmit_free(tx_chn, first_desc); > > drop_free_skb: > dev_kfree_skb_any(skb); > > /* error */ > ndev->stats.tx_dropped++; > netdev_err(ndev, "tx: error: %d\n", ret); > > return ret; free_desc_stop_q_busy: prueth_xmit_free(tx_chn, first_desc); > drop_stop_q_busy: > netif_tx_stop_queue(netif_txq); > return NETDEV_TX_BUSY;