Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp206978lqp; Tue, 11 Jun 2024 21:21:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW0HcICoCIWuMVFqlHr5+5iW5U38P5rx/cqg98SQneM/LAv1j08NRI7E/4xKFfucmwEilKQxXLch9GfygcCqcocYBdPm8v2hPVoEeKD1A== X-Google-Smtp-Source: AGHT+IHW6j6kae5ScnORN90NuFimDxwMu7t2LR9oBlDCblwHtZ9Ijzgly46ooVPpGHRPO6SkdlaN X-Received: by 2002:a9d:784f:0:b0:6fa:fee:bec with SMTP id 46e09a7af769-6fa1c45cd0fmr720978a34.38.1718166094699; Tue, 11 Jun 2024 21:21:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718166094; cv=pass; d=google.com; s=arc-20160816; b=zp33UGFV+Ev/WF1YNUKRaQMJx8SskzGatqG2qXm2Tzx5h3kY27gbzDc4CNXg1fajJ7 8PGId+gEQt68gS60i98AtMqkyCvD3pvrXgeeu+b579eLMQaMaiFmcQsaYaGzTadh/iC5 32JChHz/VgdZOvx03xryBfYAMOnpanjqHW/SCN+zaDNPPclc1/BRkauhuAC3X3GNGtl9 4nhmKqnwHVxrNRfvRREyZhvexnKbrOnI5WwF+80mWkA94GT725ONnfx5hMsvfPlNET6K ql6ZiTTJeZLO85T8eFyB/QmMd79MKnEaTaPZB74GKhImYc6vQZnOV8wphENuxUmpHKie 2Hgw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:content-language:accept-language :in-reply-to:references:message-id:date:thread-index:thread-topic :subject:cc:to:from; bh=P2VwJXv9sxaUtU5rO54PIo+L9DkRIJHvM7H1ZxAUx2U=; fh=4BZBcyHdOhjHS5mkqEqYfTkhq0a5/gGcfQZWC22V3dI=; b=AbPGjBLS38oldL3eUJJb90vI8CUnmY+W2/6V0c2Z7g+BBJqM2g+rWt7w0EaVfzOoH1 8F63JxR5cqCbItECgG9VZ/a8jLnDDbi9o0PGQBXpVp6Rt4/DAN5irRikfLgoG+eQBcGF Ro75IGZrN8qOGgXdgpvcovqle6fB2h51mizH8xloLGhrFaqY1KyxPV20b7TbaeFFqDVD m0hxp+4kydWSYYQnTXyemqMHqcAAN0uEeB38Oarf0RVM2liykjRetBFdGclkUXql3UIb pXVFSy8D1Tmioq2ciRv1WI6TXS8ZIKtDkTu6zeen4ot5WvTx4/vlpanNmtvvS+KOuK1g 4BZg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-kernel+bounces-210902-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210902-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6e8c6796beasi7107369a12.865.2024.06.11.21.21.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 21:21:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210902-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-kernel+bounces-210902-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210902-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 3D74F28643C for ; Wed, 12 Jun 2024 04:21:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 02B9B250EC; Wed, 12 Jun 2024 04:21:26 +0000 (UTC) Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (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 58328179B7; Wed, 12 Jun 2024 04:21:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.75.126.72 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718166085; cv=none; b=FGNqi/TXQc/CrnUVwlrZ68Ko3/UOZSXjCvxAod4sy1xyD09yAUwbGMJ3Sdip3wlG3OWTZt2GfU4LdkRfR3wZD9yOXuJmoOo4DTCjNhLyw02GZbmDHI811dcw3GXm92qg/nXEmxcoiaii05jw+/ydtjmg62zJ/Z/nEbgHeljiJJs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718166085; c=relaxed/simple; bh=SO2mP7JAos8SHqZ+Wh9MxKGiIDIdaOKMZcDcbVhjwNw=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=VUPoaI7yAFFD1nh3SnJ38RmwojDBJ7lPDNAjRWAvegzWafZjkScsQGqobmWN6fHIYO0+2lIUqSdUagF43MP3X0Y8FN18saf7cXp0DFh6TMDYXum73VpY8F2Q0KuvD1FFUGR0vw89CQ5N9uPltBT8tu06JJIq7ie1ObkJwArYIZ8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; arc=none smtp.client-ip=211.75.126.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 45C4KUPj8881504, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/2.95/5.92) with ESMTPS id 45C4KUPj8881504 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2024 12:20:30 +0800 Received: from RTEXMBS01.realtek.com.tw (172.21.6.94) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 12 Jun 2024 12:20:30 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXMBS01.realtek.com.tw (172.21.6.94) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 12 Jun 2024 12:20:29 +0800 Received: from RTEXMBS04.realtek.com.tw ([fe80::1a1:9ae3:e313:52e7]) by RTEXMBS04.realtek.com.tw ([fe80::1a1:9ae3:e313:52e7%5]) with mapi id 15.01.2507.035; Wed, 12 Jun 2024 12:20:29 +0800 From: Justin Lai To: Ratheesh Kannoth CC: "kuba@kernel.org" , "davem@davemloft.net" , "edumazet@google.com" , "pabeni@redhat.com" , "linux-kernel@vger.kernel.org" , "netdev@vger.kernel.org" , "andrew@lunn.ch" , "jiri@resnulli.us" , "horms@kernel.org" , Ping-Ke Shih , Larry Chiu Subject: RE: [PATCH net-next v20 06/13] rtase: Implement .ndo_start_xmit function Thread-Topic: [PATCH net-next v20 06/13] rtase: Implement .ndo_start_xmit function Thread-Index: AQHauLdmYuDGRjyaP0maBwRhxExTNLG77l8AgAefqjA= Date: Wed, 12 Jun 2024 04:20:29 +0000 Message-ID: <4a894465ea0747d08c96282602bcdf6b@realtek.com> References: <20240607084321.7254-1-justinlai0215@realtek.com> <20240607084321.7254-7-justinlai0215@realtek.com> <20240607155420.GA3743392@maili.marvell.com> In-Reply-To: <20240607155420.GA3743392@maili.marvell.com> Accept-Language: zh-TW, en-US Content-Language: zh-TW x-kse-serverinfo: RTEXMBS01.realtek.com.tw, 9 x-kse-antispam-interceptor-info: fallback x-kse-antivirus-interceptor-info: fallback Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-KSE-AntiSpam-Interceptor-Info: fallback > On 2024-06-07 at 14:13:14, Justin Lai (justinlai0215@realtek.com) wrote: > > Implement .ndo_start_xmit function to fill the information of the > > packet to be transmitted into the tx descriptor, and then the hardware > > will transmit the packet using the information in the tx descriptor. > > In addition, we also implemented the tx_handler function to enable the > > tx descriptor to be reused. > > > > Signed-off-by: Justin Lai > > --- > > .../net/ethernet/realtek/rtase/rtase_main.c | 285 ++++++++++++++++++ > > 1 file changed, 285 insertions(+) > > > > diff --git a/drivers/net/ethernet/realtek/rtase/rtase_main.c > > b/drivers/net/ethernet/realtek/rtase/rtase_main.c > > index 23406c195cff..6bdb4edbfbc1 100644 > > --- a/drivers/net/ethernet/realtek/rtase/rtase_main.c > > +++ b/drivers/net/ethernet/realtek/rtase/rtase_main.c > > @@ -256,6 +256,68 @@ static void rtase_mark_to_asic(union rtase_rx_desc > *desc, u32 rx_buf_sz) > > cpu_to_le32(RTASE_DESC_OWN | eor | rx_buf_sz)); } > > > > +static u32 rtase_tx_avail(struct rtase_ring *ring) { > > + return READ_ONCE(ring->dirty_idx) + RTASE_NUM_DESC - > > + READ_ONCE(ring->cur_idx); } > dirty_idx and cur_idx wont wrap ? its 32bit in size. >=20 > > cur_idx and dirty_idx may wrap, but all we want is the difference between them, so this won't have any effect. In addition, the difference between the two will not exceed RTASE_NUM_DESC, and dirty_idx will not exceed cur_idx, so the calculation won't go wrong.