aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/netmap
Commit message (Collapse)AuthorAgeFilesLines
...
* add valectl to the system commandsVincenzo Maffione2019-10-311-1/+1
| | | | | | | | | | | | | | The valectl(4) program is used to manage vale(4) switches. Add it to the system commands so that it can be used right away. This program was previously called vale-ctl, and stored in tools/tools/netmap Reviewed by: hrs, bcr, lwhsu, kevans MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22146 Notes: svn path=/head/; revision=354229
* netmap: enter NET_EPOCH on generic txsyncVincenzo Maffione2019-10-281-0/+9
| | | | | | | | | | | | | | | | After r353292, netmap generic adapter on if_vlan interfaces panics on asserting the NET_EPOCH. In more detail, this happens when nm_os_generic_xmit_frame() is called, that is in the generic txsync routine. Fix the issue by entering the NET_EPOCH during the generic txsync. We amortize the cost of entering/exiting over a whole batch of transmissions. PR: 241489 Reported by: Aleksandr Fedorov <aleksandr.fedorov@itglobal.com> Notes: svn path=/head/; revision=354137
* netmap: minor misc improvementsVincenzo Maffione2019-10-203-4/+5
| | | | | | | | | | | - use ring->head rather than ring->cur in lb(8) - use strlcat() rather than strncat() - fix bandwidth computation in pkt-gen(8) MFC after: 1 week Notes: svn path=/head/; revision=353775
* tap: add support for virtio-net offloadsVincenzo Maffione2019-10-181-304/+6
| | | | | | | | | | | | | | | | | | | | | | | | This patch is part of an effort to make bhyve networking (in particular TCP) faster. The key strategy to enhance TCP throughput is to let the whole packet datapath work with TSO/LRO packets (up to 64KB each), so that the per-packet overhead is amortized over a large number of bytes. This capability is supported in the guest by means of the vtnet(4) driver, which is able to handle TSO/LRO packets leveraging the virtio-net header (see struct virtio_net_hdr and struct virtio_net_hdr_mrg_rxbuf). A bhyve VM exchanges packets with the host through a network backend, which can be vale(4) or if_tap(4). While vale(4) supports TSO/LRO packets, if_tap(4) does not. This patch extends if_tap(4) with the ability to understand the virtio-net header, so that a tapX interface can process TSO/LRO packets. A couple of ioctl commands have been added to configure and probe the virtio-net header. Once the virtio-net header is set, the tapX interface acquires all the IFCAP capabilities necessary for TSO/LRO. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D21263 Notes: svn path=/head/; revision=353741
* (4/6) Protect page valid with the busy lock.Jeff Roberson2019-10-151-1/+1
| | | | | | | | | | | | | | Atomics are used for page busy and valid state when the shared busy is held. The details of the locking protocol and valid and dirty synchronization are in the updated vm_page.h comments. Reviewed by: kib, markj Tested by: pho Sponsored by: Netflix, Intel Differential Revision: https://reviews.freebsd.org/D21594 Notes: svn path=/head/; revision=353539
* Change synchonization rules for vm_page reference counting.Mark Johnston2019-09-091-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are several mechanisms by which a vm_page reference is held, preventing the page from being freed back to the page allocator. In particular, holding the page's object lock is sufficient to prevent the page from being freed; holding the busy lock or a wiring is sufficent as well. These references are protected by the page lock, which must therefore be acquired for many per-page operations. This results in false sharing since the page locks are external to the vm_page structures themselves and each lock protects multiple structures. Transition to using an atomically updated per-page reference counter. The object's reference is counted using a flag bit in the counter. A second flag bit is used to atomically block new references via pmap_extract_and_hold() while removing managed mappings of a page. Thus, the reference count of a page is guaranteed not to increase if the page is unbusied, unmapped, and the object's write lock is held. As a consequence of this, the page lock no longer protects a page's identity; operations which move pages between objects are now synchronized solely by the objects' locks. The vm_page_wire() and vm_page_unwire() KPIs are changed. The former requires that either the object lock or the busy lock is held. The latter no longer has a return value and may free the page if it releases the last reference to that page. vm_page_unwire_noq() behaves the same as before; the caller is responsible for checking its return value and freeing or enqueuing the page as appropriate. vm_page_wire_mapped() is introduced for use in pmap_extract_and_hold(). It fails if the page is concurrently being unmapped, typically triggering a fallback to the fault handler. vm_page_wire() no longer requires the page lock and vm_page_unwire() now internally acquires the page lock when releasing the last wiring of a page (since the page lock still protects a page's queue state). In particular, synchronization details are no longer leaked into the caller. The change excises the page lock from several frequently executed code paths. In particular, vm_object_terminate() no longer bounces between page locks as it releases an object's pages, and direct I/O and sendfile(SF_NOCACHE) completions no longer require the page lock. In these latter cases we now get linear scalability in the common scenario where different threads are operating on different files. __FreeBSD_version is bumped. The DRM ports have been updated to accomodate the KPI changes. Reviewed by: jeff (earlier version) Tested by: gallatin (earlier version), pho Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20486 Notes: svn path=/head/; revision=352110
* netmap: import changes from upstream (SHA 137f537eae513)Vincenzo Maffione2019-09-014-72/+146
| | | | | | | | | | | - Rework option processing. - Use larger integers for memory size values in the memory management code. MFC after: 2 weeks Notes: svn path=/head/; revision=351657
* netmap: remove obsolete fileVincenzo Maffione2019-08-251-1498/+0
| | | | | | | | | | | The netmap_pt.c module has become obsolete after the refactoring that added netmap_kloop.c. Remove it and unlink it from the build system. MFC after: 1 week Notes: svn path=/head/; revision=351488
* netmap: fix bug introduced by r349752Vincenzo Maffione2019-07-131-1/+2
| | | | | | | | | | | r349752 introduced a NULL pointer reference bug in the emulated netmap code. Reported by: lwhsu MFC after: 3 days Notes: svn path=/head/; revision=349966
* netmap: Remove pointer leakage in netmap_mem2.cVincenzo Maffione2019-07-041-2/+2
| | | | | | | | | | PR: 238641 Submitted by: Fuqian Huang <huangfq.daxian@gmail.com> Reviewed by: vmaffione MFC after: 1 week Notes: svn path=/head/; revision=349753
* netmap: fix kernel pointer printing in netmap_generic.cVincenzo Maffione2019-07-041-2/+2
| | | | | | | | | | | | | Print the adapter name rather than the address of the adapter to avoid kernel address leakage. PR: Bug 238642 Submitted by: Fuqian Huang <huangfq.daxian@gmail.com> Reviewed by: vmaffione MFC after: 1 week Notes: svn path=/head/; revision=349752
* netmap: fix two panics with emulated adapterVincenzo Maffione2019-07-011-0/+3
| | | | | | | | | | | | | | | This patch fixes 2 panics. The first one is due to the current VNET not being set in the emulated adapter transmission path. The second one is caused by the M_PKTHDR flag not being set when preallocated mbufs are recycled in the transmit path. Submitted by: aleksandr.fedorov@itglobal.com Reviewed by: vmaffione MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20824 Notes: svn path=/head/; revision=349581
* Add two missing eventhandler.h headersConrad Meyer2019-05-211-0/+1
| | | | | | | | | | | | | These are obviously missing from the .c files, but don't show up in any tinderbox configuration (due to latent header pollution of some kind). It seems some configurations don't have this pollution, and the includes are obviously missing, so go ahead and add them. Reported by: Peter Jeremy <peter AT rulingia.com> X-MFC-With: r347984 Notes: svn path=/head/; revision=348022
* netmap: align if_ptnet to the changes introduced by r347233Vincenzo Maffione2019-05-171-12/+2
| | | | | | | | | | This removes non-functional SCTP checksum offload support. More information in the log message of r347233. MFC after: 2 weeks Notes: svn path=/head/; revision=347944
* netmap: add support for multiple host ringsVincenzo Maffione2019-03-183-2/+52
| | | | | | | | | | | | | | | | Some applications forward from/to host rings most or all the traffic received or sent on a physical interface. In this cases it is desirable to have more than a pair of RX/TX host rings, and use multiple threads to speed up forwarding. This change adds support for multiple host rings. On registering a netmap port, the user can specify the number of desired receive and transmit host rings in the nr_host_tx_rings and nr_host_rx_rings fields of the nmreq_register structure. MFC after: 2 weeks Notes: svn path=/head/; revision=345269
* netmap: remove redundant call to nm_set_native_flags()Vincenzo Maffione2019-02-251-1/+0
| | | | | | | | | | This redundant call was introduced by mistake in r343772. MFC after: 3 days Sponsored by: Sunny Valley Networks Notes: svn path=/head/; revision=344510
* netmap: don't schedule kqueue notify task when kqueue is not usedVincenzo Maffione2019-02-182-7/+25
| | | | | | | | | | | | | | | | This change adds a counter (kqueue_users) to keep track of how many kqueue users are referencing a given struct nm_selinfo. In this way, nm_os_selwakeup() can schedule the kevent notification task only when kqueue is actually being used. This is important to avoid wasting CPU in the common case where kqueue is not used. Reviewed by: Aleksandr Fedorov <aleksandr.fedorov@itglobal.com> MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D19177 Notes: svn path=/head/; revision=344253
* netmap: revert netmap_attach_ext() to pre-r343772Vincenzo Maffione2019-02-071-2/+1
| | | | | | | | Reported by: marius MFC after: 1 week Notes: svn path=/head/; revision=343867
* netmap: refactor logging macros and pipesVincenzo Maffione2019-02-0514-467/+412
| | | | | | | | | | | | | | | | | Changelist: - Replace ND, D and RD macros with nm_prdis, nm_prinf, nm_prerr and nm_prlim, to avoid possible naming conflicts. - Add netmap_krings_mode_commit() helper function and use that to reduce code duplication. - Refactor pipes control code to export some functions that can be reused by the veth driver (on Linux) and epair(4). - Add check to reject API requests with version less than 11. - Small code refactoring for the null adapter. MFC after: 1 week Notes: svn path=/head/; revision=343772
* netmap: upgrade sync-kloop supportVincenzo Maffione2019-02-023-102/+323
| | | | | | | | | | Add SYNC_KLOOP_MODE option, and add support for direct mode, where application executes the TXSYNC and RXSYNC in the context of the ioeventfd wake up callback. MFC after: 5 days Notes: svn path=/head/; revision=343689
* netmap: fix lock order reversal related to kqueue usageVincenzo Maffione2019-01-303-23/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When using poll(), select() or kevent() on netmap file descriptors, netmap executes the equivalent of NIOCTXSYNC and NIOCRXSYNC commands, before collecting the events that are ready. In other words, the poll/kevent callback has side effects. This is done to avoid the overhead of two system call per iteration (e.g., poll() + ioctl(NIOC*XSYNC)). When the kqueue subsystem invokes the kqueue(9) f_event callback (netmap_knrw), it holds the lock of the struct knlist object associated to the netmap port (the lock is provided at initialization, by calling knlist_init_mtx). However, netmap_knrw() may need to wake up another netmap port (or even the same one), which means that it may need to call knote(). Since knote() needs the lock of the struct knlist object associated to the to-be-wake-up netmap port, it is possible to have a lock order reversal problem (AB/BA deadlock). This change prevents the deadlock by executing the knote() call in a per-selinfo taskqueue, where it is possible to hold a mutex. Reviewed by: aleksandr.fedorov_itglobal.com MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D18956 Notes: svn path=/head/; revision=343579
* netmap: add notifications on kloop stopVincenzo Maffione2019-01-293-54/+66
| | | | | | | | | | | On sync-kloop stop, send a wake-up signal to the kloop, so that waiting for the timeout is not needed. Also, improve logging in netmap_freebsd.c. MFC after: 3 days Notes: svn path=/head/; revision=343549
* netmap: fix crash with monitors and VALE portsVincenzo Maffione2019-01-241-1/+10
| | | | | | | | | Crash report described here: https://github.com/luigirizzo/netmap/issues/583 Fixed by providing dummy sync callback in case it is missing. Notes: svn path=/head/; revision=343413
* netmap: improvements to the netmap kloop (CSB mode)Vincenzo Maffione2019-01-233-104/+111
| | | | | | | | | | | | | | | | | | | | | | Changelist: - Add the proper memory barriers in the kloop ring processing functions. - Fix memory barriers usage in the user helpers (nm_sync_kloop_appl_write, nm_sync_kloop_appl_read). - Fix nm_kr_txempty() helper to look at rhead rather than rcur. This is important since the kloop can read a value of rcur which is ahead of the value of rhead (see explanation in nm_sync_kloop_appl_write) - Remove obsolete ptnetmap_guest_write_kring_csb() and ptnet_guest_read_kring_csb(), and update if_ptnet(4) to use those. - Prepare in advance the arguments for netmap_sync_kloop_[tr]x_ring(), to make the kloop faster. - Provide kernel and user implementation for nm_ldld_barrier() and nm_ldst_barrier() MFC after: 2 weeks Notes: svn path=/head/; revision=343346
* netmap: fix knote() argument to match the mutex stateVincenzo Maffione2019-01-233-50/+41
| | | | | | | | | | | | | | | | | The nm_os_selwakeup function needs to call knote() to wake up kqueue(9) users. However, this function can be called from different code paths, with different lock requirements. This patch fixes the knote() call argument to match the relavant lock state. Also, comments have been updated to reflect current code. PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219846 Reported by: Aleksandr Fedorov <aleksandr.fedorov@itglobal.com> Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D18876 Notes: svn path=/head/; revision=343344
* netmap: fix txsync check in netmap pollVincenzo Maffione2018-12-221-11/+18
| | | | | | | | | | | | | | | To check if txsync can be skipped, it is necessary to look for unseen TX space. However, this means comparing ring->cur against ring->tail, rather than ring->head against ring->tail (like nm_ring_empty() does). This change also adds some more comments to explain the optimization performed at the beginning of netmap_poll(). MFC after: 3 days Sponsored by: Sunny Valley Networks Notes: svn path=/head/; revision=342369
* netmap: fix bug in netmap_poll() optimizationVincenzo Maffione2018-12-221-4/+7
| | | | | | | | | | | | | | | | The bug was introduced by r339639, although it is present in the upstream netmap code since 2015. It is due to resetting the want_rx variable to POLLIN, rather than resetting it to POLLIN|POLLRDNORM. It only affects select(), which uses POLLRDNORM. poll() is not affected, because it uses POLLIN. Also, it only affects FreeBSD, because Linux skips the optimization implemented by the piece of code where the bug occurs. MFC after: 3 days Sponsored by: Sunny Valley Networks Notes: svn path=/head/; revision=342368
* netmap: move buf_size validation code to its own functionVincenzo Maffione2018-12-212-42/+53
| | | | | | | | | | | | This code validates the netmap buf_size against the interface MTU and maximum descriptor size, to make sure the values are consistent. Moving this functionality to its own function is needed because this function is also called by Linux-specific code. MFC after: 3 days Notes: svn path=/head/; revision=342300
* netmap: pipes: make sure both ends use the same number of slotsVincenzo Maffione2018-12-211-1/+3
| | | | Notes: svn path=/head/; revision=342299
* netmap: fix warning in netmap_kloop.cVincenzo Maffione2018-12-121-0/+2
| | | | | | | | Reported by: markj MFC after: 3 days Notes: svn path=/head/; revision=341992
* netmap: remove dead code obsoleted by iflibVincenzo Maffione2018-12-075-1887/+0
| | | | | | | | | | | | The iflib subsystem implements netmap support in a driver-independent way (sys/net/iflib.c). We can therefore remove the headers that used to implement netmap support for all the drivers now supported by iflib (em, igb, ixl, ixgbe, lem). MFC after: 1 week Notes: svn path=/head/; revision=341680
* netmap: netmap_transmit should honor bpf packet tap hookVincenzo Maffione2018-12-061-0/+5
| | | | | | | | | | | | | | This allows tcpdump to capture outbound kernel packets while in netmap mode Submitted by: Marc de la Gueronniere <mdelagueronniere@verisign.com> Reviewed by: vmaffione MFC after: 1 week Sponsored by: Verisign, Inc. Differential Revision: https://reviews.freebsd.org/D17896 Notes: svn path=/head/; revision=341624
* netmap: align codebase to the current upstream (760279cfb2730a585)Vincenzo Maffione2018-12-0516-925/+2310
| | | | | | | | | | | | | | | | | | | | | | | | Changelist: - Replace netmap passthrough host support with a more general mechanism to call TXSYNC/RXSYNC from an in-kernel event-loop. No kernel threads are used to use this feature: the application is required to spawn a thread (or a process) and issue a SYNC_KLOOP_START (NIOCCTRL) command in the thread body. The kernel loop is executed by the ioctl implementation, which returns to userspace only when a different thread calls SYNC_KLOOP_STOP or the netmap file descriptor is closed. - Update the if_ptnet driver to cope with the new data structures, and prune all the obsolete ptnetmap code. - Add support for "null" netmap ports, useful to allocate netmap_if, netmap_ring and netmap buffers to be used by specialized applications (e.g. hypervisors). TXSYNC/RXSYNC on these ports have no effect. - Various fixes and code refactoring. Sponsored by: Sunny Valley Networks Differential Revision: https://reviews.freebsd.org/D18015 Notes: svn path=/head/; revision=341516
* netmap: set IFCAP_NETMAP in if_capabilitiesVincenzo Maffione2018-11-281-0/+1
| | | | | | | | | | | | | Revision r307394 removed (by mistake) the code that sets IFCAP_NETMAP in if_capabilities on netmap_attach. This patch reverts this change. Reviewed by: np Approved by: gnn (mentor) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D17987 Notes: svn path=/head/; revision=341144
* vtnet: fix netmap supportVincenzo Maffione2018-11-141-207/+315
| | | | | | | | | | | | | | | | | | | | | | | | | | | | netmap(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. Reviewed by: bryanv Approved by: gnn (mentor) MFC after: 3 days Sponsored by: Sunny Valley Networks Differential Revision: https://reviews.freebsd.org/D17916 Notes: svn path=/head/; revision=340436
* Remove redundant redeclaration of netmap_vp_reg().Bjoern A. Zeeb2018-10-241-1/+0
| | | | | | | This should unbreak sparc64 and powerpc LINT builds. Notes: svn path=/head/; revision=339683
* netmap: align codebase to the current upstream (sha 8374e1a7e6941)Vincenzo Maffione2018-10-2310-2327/+2740
| | | | | | | | | | | | | | | | | | | Changelist: - Move large parts of VALE code to a new file and header netmap_bdg.[ch]. This is useful to reuse the code within upcoming projects. - Improvements and bug fixes to pipes and monitors. - Introduce nm_os_onattach(), nm_os_onenter() and nm_os_onexit() to handle differences between FreeBSD and Linux. - Introduce some new helper functions to handle more host rings and fake rings (netmap_all_rings(), netmap_real_rings(), ...) - Added new sysctl to enable/disable hw checksum in emulated netmap mode. - nm_inject: add support for NS_MOREFRAG Approved by: gnn (mentor) Differential Revision: https://reviews.freebsd.org/D17364 Notes: svn path=/head/; revision=339639
* Fix several memory leaks.David Bright2018-08-141-1/+1
| | | | | | | | | | | | | | | | | The libkqueue tests have several places that leak memory by using an idiom like: puts(kevent_to_str(kevp)); Rework to save the pointer returned from kevent_to_str() and then free() it after it has been used. Reported by: asomers (pointer to Coverity), Coverity CID: 1296063, 1296064, 1296065, 1296066, 1296067, 1350287, 1394960 Sponsored by: Dell EMC Notes: svn path=/head/; revision=337812
* netmap and iflib drivers, silence unused var warningsMatt Macy2018-05-191-1/+1
| | | | Notes: svn path=/head/; revision=333870
* netmap: compare e1 with e2, not with itselfMatt Macy2018-05-191-1/+1
| | | | Notes: svn path=/head/; revision=333865
* netmap: pull fix for 32-bit support from upstreamMatt Macy2018-05-1811-285/+308
| | | | | | | Approved by: sbruno Notes: svn path=/head/; revision=333778
* Fix build on 32-bit systems.Brooks Davis2018-04-131-2/+2
| | | | Notes: svn path=/head/; revision=332488
* netmap: align codebase to the current upstream (commit id 3fb001303718146)Vincenzo Maffione2018-04-1214-1364/+2570
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changelist: - Turn tx_rings and rx_rings arrays into arrays of pointers to kring structs. This patch includes fixes for ixv, ixl, ix, re, cxgbe, iflib, vtnet and ptnet drivers to cope with the change. - Generalize the nm_config() callback to accept a struct containing many parameters. - Introduce NKR_FAKERING to support buffers sharing (used for netmap pipes) - Improved API for external VALE modules. - Various bug fixes and improvements to the netmap memory allocator, including support for externally (userspace) allocated memory. - Refactoring of netmap pipes: now linked rings share the same netmap buffers, with a separate set of kring pointers (rhead, rcur, rtail). Buffer swapping does not need to happen anymore. - Large refactoring of the control API towards an extensible solution; the goal is to allow the addition of more commands and extension of existing ones (with new options) without the need of hacks or the risk of running out of configuration space. A new NIOCCTRL ioctl has been added to handle all the requests of the new control API, which cover all the functionalities so far supported. The netmap API bumps from 11 to 12 with this patch. Full backward compatibility is provided for the old control command (NIOCREGIF), by means of a new netmap_legacy module. Many parts of the old netmap.h header has now been moved to netmap_legacy.h (included by netmap.h). Approved by: hrs (mentor) Notes: svn path=/head/; revision=332423
* netmap: align codebase to upstream version v11.4Vincenzo Maffione2018-04-0919-463/+1230
| | | | | | | | | | | | | | | | | | | Changelist: - remove unused nkr_slot_flags - new nm_intr adapter callback to enable/disable interrupts - remove unused sysctls and document the other sysctls - new infrastructure to support NS_MOREFRAG for NIC ports - support for external memory allocator (for now linux-only), including linux-specific changes in common headers - optimizations within netmap pipes datapath - improvements on VALE control API - new nm_parse() helper function in netmap_user.h - various bug fixes and code clean up Approved by: hrs (mentor) Notes: svn path=/head/; revision=332319
* netmap: align if_ptnet guest driver to the upstream code (commit 0e15788)Vincenzo Maffione2018-04-043-174/+204
| | | | | | | | | | | | | The change upgrades the driver to use the split Communication Status Block (CSB) format. In this way the variables written by the guest and read by the host are allocated in a different cacheline than the variables written by the host and read by the guest; this is needed to avoid cache thrashing. Approved by: hrs (mentor) Notes: svn path=/head/; revision=332047
* Revert r327828, r327949, r327953, r328016-r328026, r328041:Pedro F. Giffuni2018-01-211-1/+1
| | | | | | | | | | | | | | | | | | 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 pressure on the compiler. Given that most of these checks are superfluous we have to choose better where to use mallocarray(9). We still have more uses of mallocarray(9) but hopefully this is enough to bring swap usage to a reasonable level. Reported by: wosch PR: 225197 Notes: svn path=/head/; revision=328218
* dev: make some use of mallocarray(9).Pedro F. Giffuni2018-01-131-1/+1
| | | | | | | | | | | | | | Focus on code where we are doing multiplications within malloc(9). None of these is likely to overflow, however the change is still useful as some static checkers can benefit from the allocation attributes we use for mallocarray. This initial sweep only covers malloc(9) calls with M_NOWAIT. No good reason but I started doing the changes before r327796 and at that time it was convenient to make sure the sorrounding code could handle NULL values. Notes: svn path=/head/; revision=327949
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-2716-16/+48
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326255
* Shorten list of arguments to mbuf external storage freeing function.Gleb Smirnoff2017-10-091-2/+2
| | | | | | | | | | | | | | | | | | | | All of these arguments are stored in m_ext, so there is no reason to pass them in the argument list. Not all functions need the second argument, some don't even need the first one. The second argument lives in next cache line, so not dereferencing it is a performance gain. This was discovered in sendfile(2), which will be covered by next commits. The second goal of this commit is to bring even more flexibility to m_ext mbufs, allowing to create more fields in m_ext, opaque to the generic mbuf code, and potentially set and dereferenced by subsystems. Reviewed by: gallatin, kbowling Differential Revision: https://reviews.freebsd.org/D12615 Notes: svn path=/head/; revision=324446
* Restore the changes done in r313982: Replace zero with NULL for pointers.Luiz Otavio O Souza2017-07-212-2/+2
| | | | | | | | | Spotted by: Harry Schmalzbauer MFC after: 1 week Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=321321