MFC r347233:Remove non-functional SCTP checksum offload support for virtio.Checksum offloading for SCTP is not currently specified for virtio.If the hypervisor announces checksum offloading supp
MFC r347233:Remove non-functional SCTP checksum offload support for virtio.Checksum offloading for SCTP is not currently specified for virtio.If the hypervisor announces checksum offloading support, it means TCPand UDP checksum offload. If an SCTP packet is sent and the host announcedchecksum offload support, the hypervisor inserts the IP checksum (16-bit)at the correct offset, but this is not the right checksum, which is a CRC32c.This results in all outgoing packets having the wrong checksum and thereforebreaking SCTP based communications.This patch removes SCTP checksum offloading support from the virtionetwork interface.Thanks to Felix Weinrank for making me aware of the issue.
show more ...
MFC r343552vtnet: fix typo in vtnet_free_taskqueuesBecause of a typo, the code was mistakenly resetting thevtnrx_vq pointer rather than vtntx_tq.Reviewed by: bryanvDifferential Revision:
MFC r343552vtnet: fix typo in vtnet_free_taskqueuesBecause of a typo, the code was mistakenly resetting thevtnrx_vq pointer rather than vtntx_tq.Reviewed by: bryanvDifferential Revision: https://reviews.freebsd.org/D19015
MFC :r340436vtnet: fix netmap supportnetmap(4) support for vtnet(4) was incomplete and had multiple bugs.This commit fixes those bugs to bring netmap on vtnet in a functional state.Changelist:
MFC :r340436vtnet: fix netmap supportnetmap(4) support for vtnet(4) was incomplete and had multiple bugs.This commit fixes those bugs to bring netmap on vtnet in a functional state.Changelist: - handle errors returned by virtqueue_enqueue() properly (they were previously ignored) - make sure netmap XOR rest of the kernel access each virtqueue. - compute the number of netmap slots for TX and RX separately, according to whether indirect descriptors are used or not for a given virtqueue. - make sure sglist are freed according to their type (mbufs or netmap buffers) - add support for mulitiqueue and netmap host (aka sw) rings. - intercept VQ interrupts directly instead of intercepting them in txq_eof and rxq_eof. This simplifies the code and makes it easier to make sure taskqueues are not running for a VQ while it is in netmap mode. - implement vntet_netmap_config() to cope with changes in the number of queues.Sponsored by: Sunny Valley NetworksDifferential Revision: https://reviews.freebsd.org/D17916Approved by: re (gjb)
ifnet: Replace if_addr_lock rwlock with epoch + mutexRun on LLNW canaries and tested by pho@gallatin:Using a 14-core, 28-HTT single socket E5-2697 v3 with a 40GbE MLX5based ConnectX 4-LX NIC, I
ifnet: Replace if_addr_lock rwlock with epoch + mutexRun on LLNW canaries and tested by pho@gallatin:Using a 14-core, 28-HTT single socket E5-2697 v3 with a 40GbE MLX5based ConnectX 4-LX NIC, I see an almost 12% improvement in receivedpacket rate, and a larger improvement in bytes delivered all the wayto userspace.When the host receiving 64 streams of netperf -H $DUT -t UDP_STREAM -- -m 1,I see, using nstat -I mce0 1 before the patch:InMpps OMpps InGbs OGbs err TCP Est %CPU syscalls csw irq GBfree4.98 0.00 4.42 0.00 4235592 33 83.80 4720653 2149771 1235 247.324.73 0.00 4.20 0.00 4025260 33 82.99 4724900 2139833 1204 247.324.72 0.00 4.20 0.00 4035252 33 82.14 4719162 2132023 1264 247.324.71 0.00 4.21 0.00 4073206 33 83.68 4744973 2123317 1347 247.324.72 0.00 4.21 0.00 4061118 33 80.82 4713615 2188091 1490 247.324.72 0.00 4.21 0.00 4051675 33 85.29 4727399 2109011 1205 247.324.73 0.00 4.21 0.00 4039056 33 84.65 4724735 2102603 1053 247.32After the patchInMpps OMpps InGbs OGbs err TCP Est %CPU syscalls csw irq GBfree5.43 0.00 4.20 0.00 3313143 33 84.96 5434214 1900162 2656 245.515.43 0.00 4.20 0.00 3308527 33 85.24 5439695 1809382 2521 245.515.42 0.00 4.19 0.00 3316778 33 87.54 5416028 1805835 2256 245.515.42 0.00 4.19 0.00 3317673 33 90.44 5426044 1763056 2332 245.515.42 0.00 4.19 0.00 3314839 33 88.11 5435732 1792218 2499 245.525.44 0.00 4.19 0.00 3293228 33 91.84 5426301 1668597 2121 245.52Similarly, netperf reports 230Mb/s before the patch, and 270Mb/s after the patchReviewed by: gallatinSponsored by: Limelight NetworksDifferential Revision: https://reviews.freebsd.org/D15366
Add netdump support to vtnet(4).Tested with bhyve.Reviewed by: bryanv, julianMFC after: 1 monthSponsored by: Dell EMC IsilonDifferential Revision: https://reviews.freebsd.org/D15261
Revert r327828, r327949, r327953, r328016-r328026, r328041:Uses of mallocarray(9).The use of mallocarray(9) has rocketed the required swap to build FreeBSD.This is likely caused by the allocation
Revert r327828, r327949, r327953, r328016-r328026, r328041:Uses of mallocarray(9).The use of mallocarray(9) has rocketed the required swap to build FreeBSD.This is likely caused by the allocation size attributes which put extra pressureon the compiler.Given that most of these checks are superfluous we have to choose betterwhere to use mallocarray(9). We still have more uses of mallocarray(9) buthopefully this is enough to bring swap usage to a reasonable level.Reported by: woschPR: 225197
dev: make some use of mallocarray(9).Focus on code where we are doing multiplications within malloc(9). None ofthese is likely to overflow, however the change is still useful as somestatic checke
dev: make some use of mallocarray(9).Focus on code where we are doing multiplications within malloc(9). None ofthese is likely to overflow, however the change is still useful as somestatic checkers can benefit from the allocation attributes we use formallocarray.This initial sweep only covers malloc(9) calls with M_NOWAIT. No goodreason but I started doing the changes before r327796 and at that time itwas convenient to make sure the sorrounding code could handle NULL values.
sys/dev: further adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 2-Clause license, however the tool Iwas using misidentified many licenses so this was mostly a manual - error
sys/dev: further adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 2-Clause license, however the tool Iwas using misidentified many licenses so this was mostly a manual - errorprone - task.The Software Package Data Exchange (SPDX) group provides a specificationto make it easier for automated tools to detect and summarize well knownopensource licenses. We are gradually adopting the specification, notingthat the tags are considered only advisory and do not, in any way,superceed or replace the license texts.
sys/dev: further adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 3-Clause license.The Software Package Data Exchange (SPDX) group provides a specificationto make it easier
sys/dev: further adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 3-Clause license.The Software Package Data Exchange (SPDX) group provides a specificationto make it easier for automated tools to detect and summarize well knownopensource licenses. We are gradually adopting the specification, notingthat the tags are considered only advisory and do not, in any way,superceed or replace the license texts.Special thanks to Wind River for providing access to "The Duke ofHighlander" tool: an older (2014) run over FreeBSD tree was useful as astarting point.
vtnet: Support jumbo frames without TSO/GSOCurrently in Virtio driver without TSO/GSO features enabled, the max scattergather segments for the TX path can be 4, which limits the support for 9K JUM
vtnet: Support jumbo frames without TSO/GSOCurrently in Virtio driver without TSO/GSO features enabled, the max scattergather segments for the TX path can be 4, which limits the support for 9K JUMBOframes. 9K JUMBO frames results in more than 4 scatter gather segments andvirtio driver fails to send the frame down to host OS. With TSO/GSO featureenabled max scatter gather segments can be 64, then 9K JUMBO frames are fine,this is making virtio driver to support JUMBO frames only with TSO/GSO.Increasing the VTNET_MIN_TX_SEGS which is the case for non TSO/GSO to 32 tosupport upto 64K JUMBO frames to Host.Submitted by: Lohith Bellad <[email protected]>Reviewed by: adrianDifferential Revision: https://reviews.freebsd.org/D8803
vtnet: don't update VLAN filter when parent is not runningSubmitted by: Gerrie Roos <groos -at- xiplink -dot- com>Reviewed by: gnnSponsored by: XipLink, Inc.Differential Revision: https://review
vtnet: don't update VLAN filter when parent is not runningSubmitted by: Gerrie Roos <groos -at- xiplink -dot- com>Reviewed by: gnnSponsored by: XipLink, Inc.Differential Revision: https://reviews.freebsd.org/D9573
Fix vtnet hang with max_virtqueue_pairs > VTNET_MAX_QUEUE_PAIRSCorrectly limit npairs passed to vtnet_ctrl_mq_cmd. This ensures thatVQ_ALLOC_INFO_INIT is called with the correct value, preventing
Fix vtnet hang with max_virtqueue_pairs > VTNET_MAX_QUEUE_PAIRSCorrectly limit npairs passed to vtnet_ctrl_mq_cmd. This ensures thatVQ_ALLOC_INFO_INIT is called with the correct value, preventing the systemfrom hanging when max_virtqueue_pairs > VTNET_MAX_QUEUE_PAIRS.Add new sysctl requested_vq_pairs which allow the user to configurethe requested number of virtqueue pairs. The actual value will still takeinto account the system limits.Also missing sysctls for the current tunables so their values can be seen.PR: 207446Reported by: Andy CarrelMFC after: 3 daysRelnotes: YesSponsored by: Multiplay
vtnet: fix panic on unloadSince r276367 added the virtio_mmio support vtnet_modevent() gets called twice.This resulted in a memory leak during load and a panic on unload.Count the loads so we on
vtnet: fix panic on unloadSince r276367 added the virtio_mmio support vtnet_modevent() gets called twice.This resulted in a memory leak during load and a panic on unload.Count the loads so we only initialise once (just like cxgbe(4)), and only cleanup in the final unload.PR: 209428Submitted by: [email protected]MFC after: 1 week
Lower the compiler warning: unused-but-set-variable.Approved by: bapt (mentor)Differential Revision: D3556
add netmap dependency when compiled as a module
Fix panic when adding vtnet interfaces to a bridgevtnet interfaces are always in promiscuous mode (at least if theVIRTIO_NET_F_CTRL_RX feature is not negotiated with the host). if_promisc() ona
Fix panic when adding vtnet interfaces to a bridgevtnet interfaces are always in promiscuous mode (at least if theVIRTIO_NET_F_CTRL_RX feature is not negotiated with the host). if_promisc() ona vtnet interface returned ENOTSUP although it has IFF_PROMISC set. Thisconfused the bridge code. Instead we now accept all enable/disable promiscuouscommands (and always keep IFF_PROMISC set).There are also two issues with the if_bridge error handling.If if_promisc() fails it uses bridge_delete_member() to clean up. This tries todisable promiscuous mode on the interface. That runs into an assert, becausepromiscuous mode was never set in the first place. (That's the panic reported inPR 200210.)We can only unset promiscuous mode if the interface actually is promiscuous.This goes against the reference counting done by if_promisc(), but only thefirst/last if_promic() calls can actually fail, so this is safe.A second issue is a double free of bif. It's already freed bybridge_delete_member().PR: 200210Differential Revision: https://reviews.freebsd.org/D2804Reviewed by: philip (mentor)
Fix typo when deregistering the VLAN unconfig event handlerSubmitted by: Masao Uebayashi <[email protected]>MFC after: 3 days
Don't free mbufs when stopping an interface in netmap mode.Currently if you ifconfig down a vtnet interface while it is being usedvia netmap, the kernel panics due to trying to treat the cookie va
Don't free mbufs when stopping an interface in netmap mode.Currently if you ifconfig down a vtnet interface while it is being usedvia netmap, the kernel panics due to trying to treat the cookie valuesin the virtio rings as mbufs to be freed. When netmap is enabled, thesecookie values are pointers to something else.Note that other netmap-aware drivers don't seem to need this as theystore the mbuf pointers in the software rings that mirror the hardwaredescriptor rings, and since netmap doesn't touch those, the softwarestate always has NULL mbuf pointers causing the loops to free mbufs tonot do anything. However, vtnet reuses the same state area for bothnetmap and non-netmap mode, so it needs to explicitly avoid looking atthe rings and treating the cookie values as mbufs if netmap isenabled.Differential Revision: https://reviews.freebsd.org/D2348Reviewed by: adrian, bryanv, luigiMFC after: 1 weekSponsored by: Norse Corp, Inc.
Add softc flag for when the indirect descriptor feature was negotiatedMFC after: 2 weeks
Use the appropriate IPv4 or IPv6 TSO HW assist flagMFC after: 2 weeks
Attach vtnet to virtio_mmio. Qemu provides this as an option with AArch64.Sponsored by: The FreeBSD Foundation
Start process of removing the use of the deprecated "M_FLOWID" flagfrom the FreeBSD network code. The flag is still kept around in the"sys/mbuf.h" header file, but does no longer have any users. In
Start process of removing the use of the deprecated "M_FLOWID" flagfrom the FreeBSD network code. The flag is still kept around in the"sys/mbuf.h" header file, but does no longer have any users. Insteadthe "m_pkthdr.rsstype" field in the mbuf structure is now used todecide the meaning of the "m_pkthdr.flowid" field. To modify the"m_pkthdr.rsstype" field please use the existing "M_HASHTYPE_XXX"macros as defined in the "sys/mbuf.h" header file.This patch introduces new behaviour in the transmit direction.Previously network drivers checked if "M_FLOWID" was set in "m_flags"before using the "m_pkthdr.flowid" field. This check has now now beenreplaced by checking if "M_HASHTYPE_GET(m)" is different from"M_HASHTYPE_NONE". In the future more hashtypes will be added, forexample hashtypes for hardware dedicated flows."M_HASHTYPE_OPAQUE" indicates that the "m_pkthdr.flowid" value isvalid and has no particular type. This change removes the need for an"if" statement in TCP transmit code checking for the presence of avalid flowid value. The "if" statement mentioned above is now a directvariable assignment which is then later checked by the respectivenetwork drivers like before.Additional notes:- The SCTP code changes will be committed as a separate patch.- Removal of the "M_FLOWID" flag will also be done separately.- The FreeBSD version has been bumped.MFC after: 1 monthSponsored by: Mellanox Technologies
Enable LRO by default when available on vtnet interfacesThe prior change to not enable LRO by default has confused severalpeople. The configurations where LRO is problematic is not thetypical use
Enable LRO by default when available on vtnet interfacesThe prior change to not enable LRO by default has confused severalpeople. The configurations where LRO is problematic is not thetypical use case for VirtIO, and due to other issues, this oftenrequires checksum offloading to be disabled anyways.PR: 185864MFC after: 2 weeks
- Provide if_get_counter() method for vtnet(4).- Do not accumulate statistics on every tick.- Accumulate statistics in vtnet_setup_stat_sysctl() and in vtnet_get_counter().Sponsored by: Netflix
- Provide if_get_counter() method for vtnet(4).- Do not accumulate statistics on every tick.- Accumulate statistics in vtnet_setup_stat_sysctl() and in vtnet_get_counter().Sponsored by: NetflixSponsored by: Nginx, Inc.
Use define from if_var.h to access a field inside struct if_data,that resides in struct ifnet.Sponsored by: Nginx, Inc.
123