Open zjmletang opened 1 year ago
@zjmletang !IUC, we need the steps to reproduce the case when we get more than 256 fragments.
@ybendito We can reproduce this issue by continuously sending extremely short TCP packets, with the occurrence being guaranteed. The code has been included in the attachment. You can see the results in the screenshot below, where I've printed out NumberOfElements of m_SGL in the driver. It can be observed that for packets of length 1515, there are 524 fragments in the driver. Test Environment: Windows Server 2019,AliCloud VM demo.zip
Why would I mention TSO (TCP Segmentation Offload)? Because in practice, the use of extremely short packets is less common. However, when TSO is enabled, scenarios involving short packets could also likely result in more than 256 fragments. Such practical scenarios are quite prevalent.
Describe the bug the maximum number of fragments that can be accommodated by one descriptor is 256.However, in the scenario of sending small TCP packets, one NB_BUFF may have more than 256 fragments, which can cause sending to fail. //related code virtio_get_indirect_page_capacity() {
return PAGE_SIZE / sizeof(struct vring_desc);
}
//related code
bool CTXDescriptor::AddDataChunk(const PHYSICAL_ADDRESS &PA, ULONG Length)
{ if (m_CurrVirtioSGLEntry < m_VirtioSGLSize) { m_VirtioSGL[m_CurrVirtioSGLEntry].physAddr = PA; m_VirtioSGL[m_CurrVirtioSGLEntry].length = Length; m_CurrVirtioSGLEntry++; DPrintf(0, "zjm current < viritoSGLSize [%d] [%d] Length [%d]\n", m_CurrVirtioSGLEntry, m_VirtioSGLSize, Length);
else { DPrintf(0, "zjm current > viritoSGLSize fail [%d] [%d]\n", m_CurrVirtioSGLEntry, m_VirtioSGLSize); // it may happen }
}
To Reproduce just like https://github.com/virtio-win/kvm-guest-drivers-windows/issues/942. The issue 942 primarily emphasizes the limitations on the network card hardware, while this case mainly illustrates the limitations of our own driver. However, the method of reproduction is the same.