From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from a7-19.smtp-out.eu-west-1.amazonses.com (a7-19.smtp-out.eu-west-1.amazonses.com [54.240.7.19]) by mx.groups.io with SMTP id smtpd.web11.78956.1675758010769825764 for ; Tue, 07 Feb 2023 00:20:11 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@ipxe.org header.s=cphpx6z2rfcgehlykjjh3gknqe3hsoe2 header.b=HP1Xtcc+; spf=pass (domain: eu-west-1.amazonses.com, ip: 54.240.7.19, mailfrom: 010201862af5f9a8-3ff78c40-4bcb-4fdf-83dd-e8888694d1a5-000000@eu-west-1.amazonses.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=cphpx6z2rfcgehlykjjh3gknqe3hsoe2; d=ipxe.org; t=1675758008; h=Message-ID:Date:MIME-Version:Subject:To:References:From:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=z1oC8Kej1RnrEWRjQnpCZ6DO/c9Fyex/utSC7j//6wM=; b=HP1Xtcc+hyeSGMCo8jQawGZIprT7H1wTHeHy2NQcGRpPrrMZpA1fC8bhyAFs5RSk JNBkpD8Vkfw4oEcrqjvmYEsEP7Zj2bzqArJz3G7Olr+Yn3pwFXLrBRpp7M/K2XAkBYL M+SB1VLdIfhmfqDs61arSjQh13UN5Y5o5H/xagy1f+aOp8FrgOgobIpFS+Va840OwMn 82qcBv6pTrgni6ATcsvJZ7j5HChaGJlG3MX1SsgO1enHs1xi/a3hHCVsP/HqDm4ZKTZ rWYr7p5SKC8+mZLF2vX+2AgT1tCIlK9mie4NHGSgqawHO9aBoZsxUuercfUOKvbuS2R IM3ob+0FxA== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ihchhvubuqgjsxyuhssfvqohv7z3u4hn; d=amazonses.com; t=1675758008; h=Message-ID:Date:MIME-Version:Subject:To:References:From:In-Reply-To:Content-Type:Content-Transfer-Encoding:Feedback-ID; bh=z1oC8Kej1RnrEWRjQnpCZ6DO/c9Fyex/utSC7j//6wM=; b=iD4RKyYVNYDiG3KBLsA7EvFFfa4GjBJBweS5NVnQGc/GcPtWNMsoCmtNkDkfZsvW XZ2SpFbu5A5jaNsqLM9TTVfG/2bubQk2/g0nfPBsNFKILOc3kg7mAfin954oy6Uk0Tz UbY3D/0tm/IFbIWWKx57WI5pz8mAlsNRzobaZL4o= Message-ID: <010201862af5f9a8-3ff78c40-4bcb-4fdf-83dd-e8888694d1a5-000000@eu-west-1.amazonses.com> Date: Tue, 7 Feb 2023 08:20:08 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [edk2-devel] [PATCH v2 1/3] UsbNetworkPkg/UsbRndis: Add USB RNDIS devices support To: devel@edk2.groups.io, tinhnguyen@os.amperecomputing.com, richardho@ami.com References: <20230204085359.1469-1-richardho@ami.com> <7e1d26ff-33a1-6090-6fe0-38fcb88dddaa@amperemail.onmicrosoft.com> From: "Michael Brown" In-Reply-To: <7e1d26ff-33a1-6090-6fe0-38fcb88dddaa@amperemail.onmicrosoft.com> X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED,URIBL_DBL_BLOCKED_OPENDNS,URIBL_ZEN_BLOCKED_OPENDNS autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on blyat.fensystems.co.uk Feedback-ID: 1.eu-west-1.fspj4M/5bzJ9NLRzJP0PaxRwxrpZqiDQJ1IF94CF2TA=:AmazonSES X-SES-Outgoing: 2023.02.07-54.240.7.19 Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 07/02/2023 06:21, Tinh Nguyen via groups.io wrote: > From: Tinh Nguyen > Date: Tue, 7 Feb 2023 12:43:17 +0700 > Subject: [PATCH] UsbNetworkPkg: Support rate limitting > > Signed-off-by: Tinh Nguyen Thank you for extending my patch to add the PCD support. The overall patch appears still to be substantially my code: could you please credit it as such? > +  if (Nic->RateLimitCredit < PcdGet32 (RateLimitingResumeTime)) { > +    Nic->RateLimitCredit++; > +  } Is PcdGet32() guaranteed to be a compile-time constant? If not, then it's probably a good idea to read it once upon initialisation, rather than once per timer interrupt handler invocation. > +  if ((Nic->RateLimitCredit == 0) && (PcdGetBool (EnableRateLimiting))) { > +    return PXE_STATCODE_NO_DATA; > +  } Again: unless PcdGetBool() is guaranteed to be a compile-time constant, then it's probably best to avoid reading it on every call to Receive(). (Sorry, I've never been clear on how the PCD mechanism works, so I'm not sure whether or not there is any runtime overhead from reading them.) Thanks, Michael