Module Name: src Committed By: msaitoh Date: Thu Sep 16 09:55:28 UTC 2021
Modified Files: src/sys/dev/pci/ixgbe: ixgbe.c ixgbe.h ixv.c Log Message: Fix a bug that an mbuf chain which has more than 63488bytes MAY fail on TX. - Currently, The TX buffer dmamap's max number of segments is set to 32. MCLBYTES(== 2048) * 32 = 65536 and it's enough for IP_MAXPACKET(65535). If an mbuf chain has more than 32 mbufs, we call m_defrag() to make it lower than equal to 32, but it might not work. The reason is that our m_defrag() don't modify the first mbuf entry of the chain. e.g.: if an mbuf chain contains 63600bytes data and the first mbuf has 100bytes in the m_data, the new chain has 100+2048+2048+...+12 and the total number of the chain is not 32 but 33. It result in 43 TCP packets will drop. - One of the way to fix this problem is to change m_defrag() which add a new mbuf cluster to the first mbuf. It's need discussion. - Another solution is to change the max number of the TX DMA segment. It should be at least 33 to avoid the m_defrag()'s current limitation. The document (82599-X550 DS 7.2.1.1 "Transmit Storage in system Memory") says that a packet can be fragmented into 40 - WTHRESH - 2 (for 82598, the document say nothing and some people and code says it's unlimited). Currently WTHRESH is set to 8. 40 - 8 - 2 = 30. !?!?!? {Net,Free,Open}BSD and Linux use 32. Is that safe? Anyway, we change WTHRESH from 8 to 5 to fit it. The added comment in ixgbe.h is based on DragonFly's though they don't use WTHRESH. - Yet another solution is to use the Tx Head Pointer Write Back function instead of WTHRESH based write back (see 82599-X550 DS 7.2.3.5.2 "Tx Head Pointer Write Back" or 82598 "Transmit Completions Head Write Back" ). DragonFly, illumos and DPDK use it. - Yet yet another solution is to add tso_maxsize entry to struct ifnet and use it in the TCP stack. To generate a diff of this commit: cvs rdiff -u -r1.291 -r1.292 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.80 -r1.81 src/sys/dev/pci/ixgbe/ixgbe.h cvs rdiff -u -r1.167 -r1.168 src/sys/dev/pci/ixgbe/ixv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.