On 07/02/2023 06:21, Tinh Nguyen via groups.io wrote:
From: Tinh Nguyen <ti...@os.amperecomputing.com>
Date: Tue, 7 Feb 2023 12:43:17 +0700
Subject: [PATCH] UsbNetworkPkg: Support rate limitting
Signed-off-by: Tinh Nguyen <ti...@os.amperecomputing.com>
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
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#99722): https://edk2.groups.io/g/devel/message/99722
Mute This Topic: https://groups.io/mt/96740897/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-