From: "Rebecca Cran" <quic_rcran@quicinc.com>
To: <devel@edk2.groups.io>, <richardho@ami.com>
Cc: "Andrew Fish" <afish@apple.com>,
"Leif Lindholm" <quic_llindhol@quicinc.com>,
"Michael D Kinney" <michael.d.kinney@intel.com>,
"Michael Kubacki" <michael.kubacki@microsoft.com>,
"Zhiguang Liu" <zhiguang.liu@intel.com>,
"Liming Gao" <gaoliming@byosoft.com.cn>,
"TonyLo [羅金松]" <TonyLo@ami.com>
Subject: Re: [edk2-devel] [PATCH] UsbNetworkPkg: add USB network devices support
Date: Sat, 26 Nov 2022 11:56:04 -0700 [thread overview]
Message-ID: <b57b6fbb-7579-ed30-03ef-358e817f2c73@quicinc.com> (raw)
In-Reply-To: <20220902052418.2253-1-richardho@ami.com>
On 9/1/22 23:24, RichardHo [何明忠] via groups.io wrote:
> diff --git a/UsbNetworkPkg/Config/UsbNetworkPkgComponentsDxe.inc.dsc b/UsbNetworkPkg/Config/UsbNetworkPkgComponentsDxe.inc.dsc
> new file mode 100644
> index 0000000000..74b5a3c1b3
> --- /dev/null
> +++ b/UsbNetworkPkg/Config/UsbNetworkPkgComponentsDxe.inc.dsc
> @@ -0,0 +1,20 @@
> +## @file
> +# List of Core Components.
> +#
> +# Copyright (c) 2022, American Megatrends International LLC. All rights reserved.<BR>
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +##
> +
> + UsbNetworkPkg/NetworkCommon/NetworkCommon.inf
> +
> +!if gUsbNetworkPkgTokenSpaceGuid.UsbCdcEcmSupport
> + UsbNetworkPkg/UsbCdcEcm/UsbCdcEcm.inf
> +!endif
> +
> +!if gUsbNetworkPkgTokenSpaceGuid.UsbCdcNcmSupport
> + UsbNetworkPkg/UsbCdcNcm/UsbCdcNcm.inf
> +!endif
> +
> +!if gUsbNetworkPkgTokenSpaceGuid.UsbRndisSupport
> + UsbNetworkPkg/UsbRndis/UsbRndis.inf
> +!endif
Since some of the functions have the same name and aren't static, should
there be code to avoid allowing more than one protocol to be enabled at
the same time?
> diff --git a/UsbNetworkPkg/Include/Protocol/UsbEthernetProtocol.h b/UsbNetworkPkg/Include/Protocol/UsbEthernetProtocol.h
> new file mode 100644
> index 0000000000..1c1a450920
> --- /dev/null
> +++ b/UsbNetworkPkg/Include/Protocol/UsbEthernetProtocol.h
> +// Request Type Codes for USB Ethernet
> +#define USB_ETHERNET_GET_REQ_TYPE 0xA1
> +#define USB_ETHRTNET_SET_REQ_TYPE 0x21
Typo.
> +// The USB_ETHERNET_PROTOCOL provides some basic USB Ethernet device relevant
> +// descriptor and specific requests.
> +struct _USB_ETHERNET_PROTOCOL {
> + USB_ETHERNET_UNDI UsbEthUndi;
> + // for calling the UNDI child functions
> + USB_ETHERNET_INITIALIZE UsbEthInitialize;
> + USB_ETHERNET_STATISTICS UsbEthStatistics;
> + USB_ETHERNET_RECEIVE UsbEthReceive;
> + USB_ETHERNET_TRANSMIT UsbEthTransmit;
> + USB_ETHERNET_INTERRUPT UsbEthInterrupt;
> + USB_GET_ETH_MAC_ADDRESS UsbEthMacAddress;
> + USB_ETH_MAX_BULK_SIZE UsbEthMaxBulkSize;
> + USB_HEADER_FUNCTIONAL_DESCRIPTOR UsbHeaderFunDescriptor;
> + USB_UNION_FUNCTIONAL_DESCRIPTOR UsbUnionFunDescriptor;
> + USB_ETHERNET_FUNCTIONAL_DESCRIPTOR UsbEthFunDescriptor;
> + USB_ETHERNET_SET_ETH_MULTICAST_FILTERS SetUsbEthMcastFilter;
> + USB_ETHERNET_SET_ETH_POWER_MANAGE_PATTERN_FILTER SetUsbEthPowerPatternFilter;
> + USB_ETHERNET_GET_ETH_POWER_MANAGE_PATTERN_FILTER GetUsbEthPoewrPatternFilter;
Typo.
> diff --git a/UsbNetworkPkg/NetworkCommon/PxeFunction.c b/UsbNetworkPkg/NetworkCommon/PxeFunction.c
> new file mode 100644
> index 0000000000..f6505f7018
> --- /dev/null
> +++ b/UsbNetworkPkg/NetworkCommon/PxeFunction.c
> +/**
> + Set PXE receive filter.
> +
> + @param[in] Nic A pointer to the Network interface controller data.
> + @param[in] SetFilter PXE receive filter
> + @param[in] CpbAddr Command Parameter Block Address
> + @param[in] CpbSize Command Parameter Block Size
> +
> +**/
> +UINT16
> +Setfilter (
> + IN NIC_DATA *Nic,
> + IN UINT16 SetFilter,
> + IN UINT64 CpbAddr,
> + IN UINT32 CpbSize
> + )
Following naming conventions, this should probably be "SetFilter", with
an uppercase 'F'?
> +**/
> +UINT16
> +Receive (
> + IN PXE_CDB *Cdb,
> + IN OUT NIC_DATA *Nic,
> + IN UINT64 CpbAddr,
> + IN OUT UINT64 DbAddr
> + )
> +{
> + EFI_STATUS Status;
> + UINTN Index;
> + UINT16 StatCode = PXE_STATCODE_NO_DATA;
> + PXE_FRAME_TYPE FrameType = PXE_FRAME_TYPE_NONE;
> + PXE_CPB_RECEIVE *Cpb;
> + PXE_DB_RECEIVE *Db;
> + UINT8 *BulkInData;
> + UINTN DataLength = (UINTN)Nic->MaxSegmentSize;
> + EthernetHeader *Header;
> +
> + Cpb = (PXE_CPB_RECEIVE *)(UINTN)CpbAddr;
> + Db = (PXE_DB_RECEIVE *)(UINTN)DbAddr;
> +
> + Status = gBS->AllocatePool (EfiBootServicesData, DataLength, (VOID **)&BulkInData);
Allocating and freeing memory on every poll (i.e. 10ms) doesn't seem
like a good idea. Could we allocate it during initialize instead?
--
Rebecca Cran
next prev parent reply other threads:[~2022-11-26 18:56 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-02 5:24 [PATCH] UsbNetworkPkg: add USB network devices support RichardHo [何明忠]
2022-09-02 21:48 ` [edk2-devel] " Rebecca Cran
2022-09-09 7:06 ` Chang, Abner
2022-09-12 3:48 ` RichardHo [何明忠]
2022-09-12 7:55 ` Chang, Abner
2022-09-21 2:34 ` RichardHo [何明忠]
2022-09-22 12:52 ` Chang, Abner
2022-09-06 15:05 ` Rebecca Cran
2022-09-07 5:31 ` RichardHo [何明忠]
2022-09-07 17:46 ` Rebecca Cran
2022-09-23 5:03 ` 回复: " gaoliming
2022-09-23 5:54 ` RichardHo [何明忠]
2022-09-23 7:17 ` 回复: " gaoliming
2022-11-26 18:56 ` Rebecca Cran [this message]
2022-11-28 5:24 ` RichardHo [何明忠]
2022-12-05 3:14 ` Rebecca Cran
2022-12-06 9:15 ` RichardHo [何明忠]
-- strict thread matches above, loose matches on Subject: below --
2022-08-31 7:51 RichardHo [何明忠]
2022-08-31 13:28 ` [edk2-devel] " Rebecca Cran
2022-09-01 2:51 ` RichardHo [何明忠]
2022-09-01 9:05 ` Chang, Abner
2022-09-01 10:47 ` RichardHo [何明忠]
2022-09-01 12:38 ` Rebecca Cran
2022-08-31 2:31 RichardHo [何明忠]
2022-08-31 12:15 ` [edk2-devel] " Rebecca Cran
2022-08-19 9:17 richardho
2022-08-19 15:54 ` [edk2-devel] " Pedro Falcato
2022-08-19 15:56 ` Pedro Falcato
2022-08-29 10:57 ` RichardHo [何明忠]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b57b6fbb-7579-ed30-03ef-358e817f2c73@quicinc.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox