2015-09-11 18:43, Avi Kivity: > On 09/11/2015 06:12 PM, Vladislav Zolotarov wrote: > > On Sep 11, 2015 5:55 PM, "Thomas Monjalon" <thomas.monjalon at 6wind.com > > <mailto:thomas.monjalon at 6wind.com>> wrote: > > > 2015-09-11 17:47, Avi Kivity: > > > > On 09/11/2015 05:25 PM, didier.pallard wrote: > > > > > Hi vlad, > > > > > > > > > > Documentation states that a packet (or multiple packets in transmit > > > > > segmentation) can span any number of > > > > > buffers (and their descriptors) up to a limit of 40 minus WTHRESH > > > > > minus 2. > > > > > > > > > > Shouldn't there be a test in transmit function that drops > > properly the > > > > > mbufs with a too large number of > > > > > segments, while incrementing a statistic; otherwise transmit > > function > > > > > may be locked by the faulty packet without > > > > > notification. > > > > > > > > > > > > > What we proposed is that the pmd expose to dpdk, and dpdk expose > > to the > > > > application, an mbuf check function. This way applications that can > > > > generate complex packets can verify that the device will be able to > > > > process them, and applications that only generate simple mbufs can > > avoid > > > > the overhead by not calling the function. > > > > > > More than a check, it should be exposed as a capability of the port. > > > Anyway, if the application sends too much segments, the driver must > > > drop it to avoid hang, and maintain a dedicated statistic counter to > > > allow easy debugging. > > > > I agree with Thomas - this should not be optional. Malformed packets > > should be dropped. In the icgbe case it's a very simple test - it's a > > single branch per packet so i doubt that it could impose any > > measurable performance degradation. > > A drop allows the application no chance to recover. The driver must > either provide the ability for the application to know that it cannot > accept the packet, or it must fix it up itself.
I have the feeling that everybody agrees on the same thing: the application must be able to make a well formed packet by checking limitations of the port. What about a field rte_eth_dev_info.max_tx_segs? In case the application fails in its checks, the driver must drop it and notify the user via a stat counter. The driver can also remove the hardware limitation by gathering the segments but it may be hard to implement and would be a slow operation.