IOUserNetworkPacket GetDataLength is failed with kIOReturnBadArgument in Mac Big Sur

Hi
I'm developing USB network driver with NetworkingDriverKit.

develop environment
MacOS 10.15.4
XCode 11.6

My USB Networking Driver works fine in MacOS 10.15.
But in MacOS 11(Big Sur) GetDataLength method in IOUserNetworkPacket class always failed with kIOReturnBadArgument
.
IOUserNetworkPacket get from txSubmissionQueue.
GetDataLength Document link : https://developer.apple.com/documentation/networkingdriverkit/iousernetworkpacket/3294975-getdatalength

And my code similar below
Code Block language
IOUserNetworkPacket *packet;
uint32_t packetLength = 0;
ret = txSubmissionQueue->DequeuePacket(&packet);
-- if success
ret = packet->GetDataLength(&packetLength);
// ret always kIOReturnBadArgument in Big Sur


Does anyone have any ideas on how I can solve this?

Answered by sl149q in 627422022
GetDataLength() has been deprecated, look at the DriverKit-20 API, you'll find getDataLength().

Unfortunately, Catalina does not (currently) support DriverKit-20, so you will need to compile with GetDataLength() for Catalina and getDataLength() for Big Sur.

I assume that it is a bug that Big Sur returns an error for GetDataLength() as it is marked as deprecated not removed in the documentation.


Accepted Answer
GetDataLength() has been deprecated, look at the DriverKit-20 API, you'll find getDataLength().

Unfortunately, Catalina does not (currently) support DriverKit-20, so you will need to compile with GetDataLength() for Catalina and getDataLength() for Big Sur.

I assume that it is a bug that Big Sur returns an error for GetDataLength() as it is marked as deprecated not removed in the documentation.


IOUserNetworkPacket GetDataLength is failed with kIOReturnBadArgument in Mac Big Sur
 
 
Q