From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by mx.groups.io with SMTP id smtpd.web10.76428.1669488980807820738 for ; Sat, 26 Nov 2022 10:56:20 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@quicinc.com header.s=qcppdkim1 header.b=Ka3fuGHD; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: quicinc.com, ip: 205.220.168.131, mailfrom: quic_rcran@quicinc.com) Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AQIu7AQ007822; Sat, 26 Nov 2022 18:56:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=33PiYJBBcuTBrOVJQcAtIrRTQcOI56YdecSWLMre3Fk=; b=Ka3fuGHD60NbHXdzNfHY8O/aA1yDIn9sg6u1BD9K/hrTnK+i7RF1KCSpsGcQyR78FP0W fPy0COhY5tnY6ltnO7ACLucb+mODC1Q+aB+F+3vQ4m/TCrPudig5eRiL+Mo0xFJ2iOK/ 0MiQ0wAmlPf89F424d+eWerYm7tAifyAzVHHsVjD3Nn7Yw7/NFGlrFASTmlw9LOnN34k 44ih+NIV4N7Oh5nx7iKh6aVCJHfVy7c+P0VTHLwgCalfiJofrEELvPAOpauyf1DNP3gv yhbMMY7Mnl5SKus4s1TJI89pXWMI+X8zKhJerk3FXsMfNMU5HC7WNN1TZY2sbjYFbELa OA== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3m3bjrgwvr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 26 Nov 2022 18:56:06 +0000 Received: from nasanex01b.na.qualcomm.com (corens_vlan604_snip.qualcomm.com [10.53.140.1]) by NASANPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2AQIu6Kx029223 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 26 Nov 2022 18:56:06 GMT Received: from [10.110.115.186] (10.80.80.8) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Sat, 26 Nov 2022 10:56:05 -0800 Message-ID: Date: Sat, 26 Nov 2022 11:56:04 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [edk2-devel] [PATCH] UsbNetworkPkg: add USB network devices support To: , CC: Andrew Fish , Leif Lindholm , Michael D Kinney , Michael Kubacki , Zhiguang Liu , Liming Gao , =?UTF-8?B?VG9ueUxvIFvnvoXph5Hmnb5d?= References: <20220902052418.2253-1-richardho@ami.com> From: "Rebecca Cran" In-Reply-To: <20220902052418.2253-1-richardho@ami.com> X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: 5QDPuecBrBbk6jlydNyMbGFVFerWbDTh X-Proofpoint-GUID: 5QDPuecBrBbk6jlydNyMbGFVFerWbDTh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-26_13,2022-11-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1011 lowpriorityscore=0 phishscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 impostorscore=0 priorityscore=1501 adultscore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211260152 X-MIME-Autoconverted: from 8bit to quoted-printable by mx0a-0031df01.pphosted.com id 2AQIu7AQ007822 Content-Language: en-US Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable On 9/1/22 23:24, RichardHo [=E4=BD=95=E6=98=8E=E5=BF=A0] via groups.io wr= ote: > 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 right= s reserved.
> +# 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=20 there be code to avoid allowing more than one protocol to be enabled at=20 the same time? > diff --git a/UsbNetworkPkg/Include/Protocol/UsbEthernetProtocol.h b/Usb= NetworkPkg/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 r= elevant > +// 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 UsbEthMaxBulkSiz= e; > + USB_HEADER_FUNCTIONAL_DESCRIPTOR UsbHeaderFunDesc= riptor; > + USB_UNION_FUNCTIONAL_DESCRIPTOR UsbUnionFunDescr= iptor; > + USB_ETHERNET_FUNCTIONAL_DESCRIPTOR UsbEthFunDescrip= tor; > + USB_ETHERNET_SET_ETH_MULTICAST_FILTERS SetUsbEthMcastFi= lter; > + USB_ETHERNET_SET_ETH_POWER_MANAGE_PATTERN_FILTER SetUsbEthPowerPa= tternFilter; > + USB_ETHERNET_GET_ETH_POWER_MANAGE_PATTERN_FILTER GetUsbEthPoewrPa= tternFilter; 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 controlle= r 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=20 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 =3D PXE_STATCODE_NO_DATA; > + PXE_FRAME_TYPE FrameType =3D PXE_FRAME_TYPE_NONE; > + PXE_CPB_RECEIVE *Cpb; > + PXE_DB_RECEIVE *Db; > + UINT8 *BulkInData; > + UINTN DataLength =3D (UINTN)Nic->MaxSegmentSize; > + EthernetHeader *Header; > + > + Cpb =3D (PXE_CPB_RECEIVE *)(UINTN)CpbAddr; > + Db =3D (PXE_DB_RECEIVE *)(UINTN)DbAddr; > + > + Status =3D gBS->AllocatePool (EfiBootServicesData, DataLength, (VOID= **)&BulkInData); Allocating and freeing memory on every poll (i.e. 10ms) doesn't seem=20 like a good idea. Could we allocate it during initialize instead? --=20 Rebecca Cran