aboutsummaryrefslogtreecommitdiff
path: root/sys/ofed/include/linux
Commit message (Collapse)AuthorAgeFilesLines
* MFC 294366:John Baldwin2016-01-231-1/+1
| | | | | | | | | | | | | | | | | Initialize vm_page_prot to VM_MEMATTR_DEFAULT instead of 0. If a driver's Linux mmap callback passed vm_page_prot through unchanged, then linux_dev_mmap_single() would try to apply whatever VM_MEMATTR_xxx value 0 is to the mapping. On x86, VM_MEMATTR_DEFAULT is the PAT value for write-back (WB) which is 6, while 0 maps to the PAT value for uncacheable (UC). Thus, any mmap request that did not explicitly set page_prot was tried to map memory as UC triggering the warning in sg_pager_getpages(). Sponsored by: Chelsio Communications Notes: svn path=/stable/10/; revision=294636
* MFC r292989:Hans Petter Selasky2016-01-121-3/+4
| | | | | | | | Handle when filedescriptors are closed before initialized. An early fdclose() call can cause fget_unlocked() to fail. Notes: svn path=/stable/10/; revision=293736
* MFC r289563,r291481,r292537,r292538,r292542,r292543,r292544 and r292834:Hans Petter Selasky2016-01-047-93/+260
| | | | | | | | | | | | | | | | | | | | | | | Update the LinuxKPI: - Add more functions and types. - Implement ACCESS_ONCE(), WRITE_ONCE() and READ_ONCE(). - Implement sleepable RCU mechanism using shared exclusive locks. - Minor workqueue cleanup: - Make some functions global instead of inline to ease debugging. - Fix some minor style issues. - In the zero delay case in queue_delayed_work() use the return value from taskqueue_enqueue() instead of reading "ta_pending" unlocked and also ensure the callout is stopped before proceeding. - Implement drain_workqueue() function. - Reduce memory consumption when allocating kobject strings in the LinuxKPI. Compute string length before allocating memory instead of using fixed size allocations. Make kobject_set_name_vargs() global instead of inline to save some bytes when compiling. Sponsored by: Mellanox Technologies Notes: svn path=/stable/10/; revision=293151
* MFC r270212,r270332:Enji Cooper2015-12-301-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This helps reduce the diff in pci(4) between head and stable/10 to help pave the way for bringing in IOV/nv(9) more cleanly Differential Revision: https://reviews.freebsd.org/D4728 Relnotes: yes Reviewed by: hselasky (ofed piece), royger (overall change) Sponsored by: EMC / Isilon Storage Division r270212 (by royger): pci: make MSI(-X) enable and disable methods of the PCI bus Make the functions pci_disable_msi, pci_enable_msi and pci_enable_msix methods of the newbus PCI bus. This code should not include any functional change. Sponsored by: Citrix Systems R&D Reviewed by: imp, jhb Differential Revision: https://reviews.freebsd.org/D354 dev/pci/pci.c: - Convert the mentioned functions to newbus methods. - Fix the callers of the converted functions. sys/dev/pci/pci_private.h: dev/pci/pci_if.m: - Declare the new methods. dev/pci/pcivar.h: - Add helpers to call the newbus methods. ofed/include/linux/pci.h: - Add define to prevent the ofed version of pci_enable_msix from clashing with the FreeBSD native version. r270332 (by royger): pci: add a new pci_child_added newbus method. This is needed so when running under Xen the calls to pci_child_added can be intercepted and a custom Xen method can be used to register those devices with Xen. This should not include any functional change, since the Xen implementation will be added in a following patch and the native implementation is a noop. Sponsored by: Citrix Systems R&D Reviewed by: jhb dev/pci/pci.c: dev/pci/pci_if.m: dev/pci/pci_private.h: dev/pci/pcivar.h: - Add the pci_child_added newbus method. Notes: svn path=/stable/10/; revision=292907
* MFC r290003:Hans Petter Selasky2015-12-141-1/+18
| | | | | | | | | | Add support for binding IRQs to CPUs in the LinuxKPI. The new function added is for BSD only and does not exist in Linux. Sponsored by: Mellanox Technologies Notes: svn path=/stable/10/; revision=292192
* MFC r290710, r291694, r291699 and r291793:Hans Petter Selasky2015-12-114-2/+17
| | | | | | | | | | | | | | | | | | | | | | - Fix print formatting compile warnings for Sparc64 and PowerPC platforms. - Updated the mlx4 and mlxen drivers to the latest version, v2.1.6: - Added support for dumping the SFP EEPROM content to dmesg. - Fixed handling of network interface capability IOCTLs. - Fixed race when loading and unloading the mlxen driver by applying appropriate locking. - Removed two unused C-files. - Convert the mlxen driver to use the BUSDMA(9) APIs instead of vtophys() when loading mbufs for transmission and reception. While at it all pointer arithmetic and cast qualifier issues were fixed, mostly related to transmission and reception. - Fix i386 build WITH_OFED=YES. Remove some redundant KASSERTs. Sponsored by: Mellanox Technologies Differential Revision: https://reviews.freebsd.org/D4283 Differential Revision: https://reviews.freebsd.org/D4284 Notes: svn path=/stable/10/; revision=292107
* MFC r291693:Hans Petter Selasky2015-12-111-0/+19
| | | | | | | | | | | Add some structures and defines which will be used when decoding small form factor, SFF, standards compliant ethernet EEPROMs. Obtained from: Linux Sponsored by: Mellanox Technologies Notes: svn path=/stable/10/; revision=292105
* MFC r291690:Hans Petter Selasky2015-12-111-4/+0
| | | | | | | | | | Remove incorrect defines. The proper version of these macros is defined in linux/etherdevice.h. Sponsored by: Mellanox Technologies Notes: svn path=/stable/10/; revision=292103
* MFC 287440:John Baldwin2015-09-112-25/+22
| | | | | | | | | | | | | | | | | | Currently the Linux character device mmap handling only supports mmap operations that map a single page that has an associated vm_page_t. This does not permit mapping larger regions (such as a PCI memory BAR) and it does not permit mapping addresses beyond the top of RAM (such as a 64-bit BAR located above the top of RAM). Instead of using a single OBJT_DEVICE object and passing the physaddr via the offset as a hack, create a new sglist and OBJT_SG object for each mmap request. The requested memory attribute is applied to the object thus affecting all pages mapped by the request. Sponsored by: Chelsio Notes: svn path=/stable/10/; revision=287637
* MFC r286418:Mark Johnston2015-08-271-2/+2
| | | | | | | | ipv4_is_zeronet() and ipv4_is_loopback() expect an address in network order, but IN_ZERONET and IN_LOOPBACK expect it in host order. Notes: svn path=/stable/10/; revision=287229
* Merge r283612:Gleb Smirnoff2015-08-171-0/+23
| | | | | | | | | | | | | | | | | Add SIOCGI2C ioctl support to the driver. Would work only on ConnectX-3 with fresh firmware. The low level code is based on code provided by Mellanox. Thanks to Mellanox and their distributor Must (http://mustcompany.ru) for providing hardware. In collaboration with: Andre Melkoumian <andre mellanox.com> Reviewed by: hselasky Sponsored by: Netflix Sponsored by: Nginx, Inc. Notes: svn path=/stable/10/; revision=286841
* MFC r285088:Hans Petter Selasky2015-07-112-16/+19
| | | | | | | | | | | | | Fix broken implementation of "kvasprintf()" function by adding missing kmalloc() call. Make function global instead of static inline to fix compiler warnings about passing variable argument lists to inline functions. Sponsored by: Mellanox Technologies Approved by: re, gjb Notes: svn path=/stable/10/; revision=285410
* MFC r277229:Navdeep Parhar2015-06-171-1/+1
| | | | | | | | Use parentheses instead of close proximity to ensure layer + 1 is evaluated before the rest of the expression. Notes: svn path=/stable/10/; revision=284530
* MFC r282331:Mark Johnston2015-05-293-11/+25
| | | | | | | | | | | | | | | | | | Don't drop the idr lock before verifying that the newly-inserted element is present in the tree. MFC r282741: find_next_bit() and find_next_zero_bit(): if the caller-specified offset lies within the last block of the bit set and no bits are set beyond the offset, terminate the search immediately instead of continuing as though there are further blocks in the set and subsequently returning an incorrect result. MFC r282743: Ensure that msecs_to_jiffies(0) == 0. Notes: svn path=/stable/10/; revision=283675
* MFC r277396, r278681, r278865, r278924, r279205, r280208,Hans Petter Selasky2015-05-0519-174/+342
| | | | | | | | | | | | | | | | | | | | | | | | r280210, r280764 and r280768: Update the Linux compatibility layer: - Add more functions. - Add some missing includes which are needed when the header files are not included in a particular order. - The kasprintf() function cannot be inlined due to using a variable number of arguments. Move it to a C-file. - Fix problems about 32-bit ticks wraparound and unsigned long conversion. Jiffies or ticks in FreeBSD have integer type and are not long. - Add missing "order_base_2()" macro. - Fix BUILD_BUG_ON() macro. - Declare a missing symbol which is needed when compiling without -O2 - Clean up header file inclusions in the linux/completion.h, linux/in.h and linux/fs.h header files. Sponsored by: Mellanox Technologies Notes: svn path=/stable/10/; revision=282513
* MFC r280211:Hans Petter Selasky2015-03-251-2/+2
| | | | | | | | | Add missing void pointer argument to SYSINIT() functions. Sponsored by: Mellanox Technologies Notes: svn path=/stable/10/; revision=280540
* MFC r279587:Hans Petter Selasky2015-03-071-0/+2
| | | | | | | | | | Define PTR_ALIGN() macro which will be needed coming Mellanox driver releases. Sponsored by: Mellanox Technologies Notes: svn path=/stable/10/; revision=279737
* MFC r278866:Hans Petter Selasky2015-03-071-0/+40
| | | | | | | | | | Define standard formatting strings to print GIDs in a separate header file. Sponsored by: Mellanox Technologies Notes: svn path=/stable/10/; revision=279732
* MFC r279584:Hans Petter Selasky2015-03-072-4/+17
| | | | | | | | | | | | | | | | | | | | | | Updates for the Mellanox ethernet driver > List of fixes: * use correct format for GID printouts * double array indexing * spelling in printouts * void pointer arithmetic * allow more receive rings * correct maximum number of transmit rings * use "const" instead of "static" for constants * check for invalid VLAN tags * check for lack of IRQ resources > Added more hardware specific defines > Added more verbose printouts of firmware status codes Sponsored by: Mellanox Technologies Notes: svn path=/stable/10/; revision=279731
* MFC r276749:Hans Petter Selasky2015-01-136-36/+84
| | | | | | | | | | | | | | | | | | | | | | | Fixes and updates for the Linux compatibility layer: - Remove unsupported "bus" field from "struct pci_dev". - Fix logic inside "pci_enable_msix()" when the number of allocated interrupts are less than the number of available interrupts. - Update header files included from "list.h". - Ensure that "idr_destroy()" removes all entries before destroying the IDR root node(s). - Set the "device->release" function so that we don't leak memory at device destruction. - Use FreeBSD's "log()" function for certain debug printouts. - Put parenthesis around arguments inside the min, max, min_t and max_t macros. - Make sure we don't leak file descriptors by dropping the extra file reference counts done by the FreeBSD kernel when calling falloc() and fget_unlocked(). MFC after: 1 week Sponsored by: Mellanox Technologies Notes: svn path=/stable/10/; revision=277139
* Merge r275599:Craig Rodrigues2015-01-061-0/+2
| | | | | | | | | | | | | | | | Use CURVNET macros inside inet_get_local_port_range() function. Without this fix, a kernel with VIMAGE + Infiniband will panic on bootup. Certain necessary #include statements require LIST_HEAD. Add these includes to ofed/include/linux/list.h, because LIST_HEAD is specifically overridden in this file. PR: 191468 Differential Revision: D1279 Reviewed by: hselasky Notes: svn path=/stable/10/; revision=276744
* MFC r275636:Hans Petter Selasky2014-12-121-2/+2
| | | | | | | | | Move OFED init a bit earlier so that PXE boot works. Sponsored by: Mellanox Technologies Notes: svn path=/stable/10/; revision=275724
* MFC r272683:Hans Petter Selasky2014-10-211-1/+0
| | | | | | | | | | - Fix compile warning when compiling with GCC. - Add missed chunk in previous driver code MFC. Sponsored by: Mellanox Technologies Notes: svn path=/stable/10/; revision=273379
* MFC r273135:Hans Petter Selasky2014-10-1810-104/+234
| | | | | | | | | | | | | | | | | | | | Update the OFED Linux compatibility layer and Mellanox hardware driver(s): - Properly name an inclusion guard - Fix compile warnings regarding unsigned enums - Add two new sysctl nodes - Remove all empty linux header files - Make an error printout more verbose - Use "mod_delayed_work()" instead of cancelling and starting a timeout. - Implement more Linux scatterlist functions. Sponsored by: Mellanox Technologies Notes: svn path=/stable/10/; revision=273246
* MFC r272027:Hans Petter Selasky2014-10-026-82/+369
| | | | | | | | | | | | | | | | | | | | | | Hardware driver update from Mellanox Technologies, including: - improved performance - better stability - new features - bugfixes Supported HCAs: - ConnectX-2 - ConnectX-3 - ConnectX-3 Pro NOTE: - TSO feature needs r271946, which is not yet merged. Sponsored by: Mellanox Technologies Approved by: re, glebius Notes: svn path=/stable/10/; revision=272407
* MFC r270710 and r270821:Hans Petter Selasky2014-09-0482-234/+1188
| | | | | | | | | | | | | | | | | | - Update the OFED Linux Emulation layer as a preparation for a hardware driver update from Mellanox Technologies. - Remove empty files from the OFED Linux Emulation layer. - Fix compile warnings related to printf() and the "%lld" and "%llx" format specifiers. - Add some missing 2-clause BSD copyrights. - Add "Mellanox Technologies, Ltd." to list of copyright holders. - Add some new compatibility files. - Fix order of uninit in the mlx4ib module to avoid crash at unload using the new module_exit_order() function. Sponsored by: Mellanox Technologies Notes: svn path=/stable/10/; revision=271127
* MFC r269859:Hans Petter Selasky2014-08-191-20/+64
| | | | | | | | | Fix for memory leak. Sponsored by: Mellanox Technologies Notes: svn path=/stable/10/; revision=270166
* MFC r268316:Hans Petter Selasky2014-08-121-3/+8
| | | | | | | | | | | | Fix OFED startup order: All SYSINIT()'s and modules should be loaded prior to starting "/sbin/init" which will run all the "/etc/rc.d/xxx" scripts. Else there can be a race configuring the interfaces via "/etc/rc.conf". Sponsored by: Mellanox Technologies Notes: svn path=/stable/10/; revision=269862
* MFC r267395:Hans Petter Selasky2014-06-151-5/+5
| | | | | | | | - Fix out of range shifting bug in bitops.h. - Make code a bit easier to read by adding parenthesis. Notes: svn path=/stable/10/; revision=267517
* MFC: r257862, r257863, r257864Alfred Perlstein2013-11-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | r257862: Use explicit long cast to avoid overflow in bitopts. This was causing problems with the buddy allocator inside of ofed. r257863: Fix for bad performance when mtu is increased. Update the auto moderation behavior in the mlxen driver to match the new LINUX OFED code. r257864: Do not use a sleep lock when protecting the driver flags. This was causing a locking issue with lagg. Approved by: re Notes: svn path=/stable/10/; revision=257867
* Fix __free_pages() in the linux shim.Alfred Perlstein2013-10-171-3/+3
| | | | | | | | | | | | __free_pages() is actaully supposed to take a "struct page *" not an address. MFC: 256546 Approved by: re Notes: svn path=/stable/10/; revision=256686
* Fix mis-merge of upstream fix.Alfred Perlstein2013-10-011-4/+0
| | | | | | | | | | | We would accidentally make the string one byte too short. Submitted by: Orit Moskovich (oritm mellanox.com) Approved by: re Notes: svn path=/head/; revision=255968
* Update OFED to Linux 3.7 and update Mellanox drivers.Alfred Perlstein2013-09-2925-174/+1373
| | | | | | | | | | | | | | | | | | | | | | | | | | Update the OFED Infiniband core to the version supplied in Linux version 3.7. The update to OFED is nearly all additional defines and functions with the exception of the addition of additional parameters to ib_register_device() and the reg_user_mr callback. In addition the ibcore (Infiniband core) and ipoib (IP over Infiniband) have both been made into completely loadable modules to facilitate testing of the OFED stack in FreeBSD. Finally the Mellanox Infiniband drivers are now updated to the latest version shipping with Linux 3.7. Submitted by: Mellanox FreeBSD driver team: Oded Shanoon (odeds mellanox.com), Meny Yossefi (menyy mellanox.com), Orit Moskovich (oritm mellanox.com) Approved by: re Notes: svn path=/head/; revision=255932
* Handle cases where capability rights are not provided.Pawel Jakub Dawidek2013-09-051-3/+9
| | | | | | | Reported by: kib Notes: svn path=/head/; revision=255240
* Fix implementation of sock_getname.Navdeep Parhar2013-08-231-5/+5
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=254734
* Make sendfile() a method in the struct fileops. Currently onlyGleb Smirnoff2013-08-151-0/+1
| | | | | | | | | | | vnode backed file descriptors have this method implemented. Reviewed by: kib Sponsored by: Nginx, Inc. Sponsored by: Netflix Notes: svn path=/head/; revision=254356
* - Correctly handle various edge cases in sysfs emulation.Jeff Roberson2013-08-091-4/+7
| | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=254121
* - Use the correct type in the linux bitops emulation.Jeff Roberson2013-08-091-4/+9
| | | | | | | Submitted by: Maxim Ignatenko <gelraen.ua@gmail.com> Notes: svn path=/head/; revision=254120
* Split the pagequeues per NUMA domains, and split pageademon processKonstantin Belousov2013-08-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into threads each processing queue in a single domain. The structure of the pagedaemons and queues is kept intact, most of the changes come from the need for code to find an owning page queue for given page, calculated from the segment containing the page. The tie between NUMA domain and pagedaemon thread/pagequeue split is rather arbitrary, the multithreaded daemon could be allowed for the single-domain machines, or one domain might be split into several page domains, to further increase concurrency. Right now, each pagedaemon thread tries to reach the global target, precalculated at the start of the pass. This is not optimal, since it could cause excessive page deactivation and freeing. The code should be changed to re-check the global page deficit state in the loop after some number of iterations. The pagedaemons reach the quorum before starting the OOM, since one thread inability to meet the target is normal for split queues. Only when all pagedaemons fail to produce enough reusable pages, OOM is started by single selected thread. Launder is modified to take into account the segments layout with regard to the region for which cleaning is performed. Based on the preliminary patch by jeff, sponsored by EMC / Isilon Storage Division. Reviewed by: alc Tested by: pho Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=254065
* Replace kernel virtual address space allocation with vmem. This providesJeff Roberson2013-08-073-9/+9
| | | | | | | | | | | | | | | | transparent layering and better fragmentation. - Normalize functions that allocate memory to use kmem_* - Those that allocate address space are named kva_* - Those that operate on maps are named kmap_* - Implement recursive allocation handling for kmem_arena in vmem. Reviewed by: alc Tested by: pho Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=254025
* rename scheduler->swapper and SI_SUB_RUN_SCHEDULER->SI_SUB_LASTAndriy Gapon2013-07-241-3/+3
| | | | | | | | | | | | | | | | | | | Also directly call swapper() at the end of mi_startup instead of relying on swapper being the last thing in sysinits order. Rationale: - "RUN_SCHEDULER" was misleading, scheduling already takes place at that stage - "scheduler" was misleading, the function swaps in the swapped out processes - another SYSINIT(SI_SUB_RUN_SCHEDULER, SI_ORDER_ANY) could never be invoked depending on its relative order with scheduler; this was not obvious and the bug actually used to exist Reviewed by: kib (ealier version) MFC after: 14 days Notes: svn path=/head/; revision=253604
* Rework the previous fix for the IB vs Ethernet sysctl handler to be moreJohn Baldwin2013-07-181-17/+15
| | | | | | | | | | | | | | | | | | generic and apply to all sysfs attributes: - Use sysctl_handle_string() instead of reimplementing it. - Remove trailing newline from the current value before passing it to userland and append a newline to the new string value before passing it to the attribute's store function. - Don't leak the temporary buffer if the first error check triggers. - Revert earlier change to mlx4 port mode handler. PR: kern/174213 Submitted by: Garrett Cooper Reviewed by: Shakar Klein @ Mellanox MFC after: 1 week Notes: svn path=/head/; revision=253449
* Allow mlx4 devices to switch from Ethernet to Infiniband (and vice versa):John Baldwin2013-07-081-2/+7
| | | | | | | | | | | | | | | - Fix sysctl wrapper for sysfs attributes to properly handle new string values similar to sysctl_handle_string() (only copyin the user's supplied length and nul-terminate the string). - Don't check for a trailing newline when evaluating the desired operating mode of a mlx4 device. PR: kern/179999 Submitted by: Shahar Klein <shahark@mellanox.com> MFC after: 1 week Notes: svn path=/head/; revision=253048
* Store a reference to the vnode associated with a file descriptor in theJohn Baldwin2013-06-112-1/+5
| | | | | | | | | | | | | | linux_file structure and use it instead of directly accessing td_fpop when destroying the linux_file structure. The td_fpop pointer is not valid when a cdevpriv destructor is run, and the type-specific close method has already been called, so f_vnode may not be valid (and the vnode might have been recycled without our own reference). Tested by: Julian Stecklina <jsteckli@os.inf.tu-dresden.de> MFC after: 1 week Notes: svn path=/head/; revision=251617
* According to the documentation, on Linux, cancel_delayed_work() does notXin LI2013-05-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | do drain (flush_workqueue() in Linux terms) but instead returns true if the work was removed before it is run, or false otherwise. Simulate this by removing the taskqueue_drain() and return the value derived from taskqueue_cancel()'s return value. This would solve a witness warning caused by calling taskqueue_drain() with a non-sleepable lock held, like: taskqueue_drain with the following non-sleepable locks held: exclusive rw lle (lle) r = 0 (0xfffffe001450b410) locked @ /usr/src/sys/netinet/in.c:1484 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xffffff848d4f7690 kdb_backtrace() at kdb_backtrace+0x39/frame 0xffffff848d4f7740 witness_warn() at witness_warn+0x4a8/frame 0xffffff848d4f7800 taskqueue_drain() at taskqueue_drain+0x3a/frame 0xffffff848d4f7840 set_timeout() at set_timeout+0x4a/frame 0xffffff848d4f7860 netevent_callback() at netevent_callback+0x16/frame 0xffffff848d4f7870 arpintr() at arpintr+0x9b5/frame 0xffffff848d4f7930 This do not affect kernel without OFED compiled in. Reported by: Garrett Cooper <yaneurabeya gmail com> (who also tested an earlier version of this patch, but bugs are mine) MFC after: 2 weeks Notes: svn path=/head/; revision=250374
* Switch the vm_object mutex to be a rwlock. This will enable in theAttilio Rao2013-03-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | future further optimizations where the vm_object lock will be held in read mode most of the time the page cache resident pool of pages are accessed for reading purposes. The change is mostly mechanical but few notes are reported: * The KPI changes as follow: - VM_OBJECT_LOCK() -> VM_OBJECT_WLOCK() - VM_OBJECT_TRYLOCK() -> VM_OBJECT_TRYWLOCK() - VM_OBJECT_UNLOCK() -> VM_OBJECT_WUNLOCK() - VM_OBJECT_LOCK_ASSERT(MA_OWNED) -> VM_OBJECT_ASSERT_WLOCKED() (in order to avoid visibility of implementation details) - The read-mode operations are added: VM_OBJECT_RLOCK(), VM_OBJECT_TRYRLOCK(), VM_OBJECT_RUNLOCK(), VM_OBJECT_ASSERT_RLOCKED(), VM_OBJECT_ASSERT_LOCKED() * The vm/vm_pager.h namespace pollution avoidance (forcing requiring sys/mutex.h in consumers directly to cater its inlining functions using VM_OBJECT_LOCK()) imposes that all the vm/vm_pager.h consumers now must include also sys/rwlock.h. * zfs requires a quite convoluted fix to include FreeBSD rwlocks into the compat layer because the name clash between FreeBSD and solaris versions must be avoided. At this purpose zfs redefines the vm_object locking functions directly, isolating the FreeBSD components in specific compat stubs. The KPI results heavilly broken by this commit. Thirdy part ports must be updated accordingly (I can think off-hand of VirtualBox, for example). Sponsored by: EMC / Isilon storage division Reviewed by: jeff Reviewed by: pjd (ZFS specific review) Discussed with: alc Tested by: pho Notes: svn path=/head/; revision=248084
* Add protective parentheses for macro argument, missed in r247671.Alexander Motin2013-03-021-1/+1
| | | | Notes: svn path=/head/; revision=247675
* MFcalloutng:Alexander Motin2013-03-021-7/+9
| | | | | | | | Give OFED Linux wrapper own "expires" field instead of abusing callout's c_time, which will change its type and units with calloutng commit. Notes: svn path=/head/; revision=247671
* Merge Capsicum overhaul:Pawel Jakub Dawidek2013-03-021-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Capability is no longer separate descriptor type. Now every descriptor has set of its own capability rights. - The cap_new(2) system call is left, but it is no longer documented and should not be used in new code. - The new syscall cap_rights_limit(2) should be used instead of cap_new(2), which limits capability rights of the given descriptor without creating a new one. - The cap_getrights(2) syscall is renamed to cap_rights_get(2). - If CAP_IOCTL capability right is present we can further reduce allowed ioctls list with the new cap_ioctls_limit(2) syscall. List of allowed ioctls can be retrived with cap_ioctls_get(2) syscall. - If CAP_FCNTL capability right is present we can further reduce fcntls that can be used with the new cap_fcntls_limit(2) syscall and retrive them with cap_fcntls_get(2). - To support ioctl and fcntl white-listing the filedesc structure was heavly modified. - The audit subsystem, kdump and procstat tools were updated to recognize new syscalls. - Capability rights were revised and eventhough I tried hard to provide backward API and ABI compatibility there are some incompatible changes that are described in detail below: CAP_CREATE old behaviour: - Allow for openat(2)+O_CREAT. - Allow for linkat(2). - Allow for symlinkat(2). CAP_CREATE new behaviour: - Allow for openat(2)+O_CREAT. Added CAP_LINKAT: - Allow for linkat(2). ABI: Reuses CAP_RMDIR bit. - Allow to be target for renameat(2). Added CAP_SYMLINKAT: - Allow for symlinkat(2). Removed CAP_DELETE. Old behaviour: - Allow for unlinkat(2) when removing non-directory object. - Allow to be source for renameat(2). Removed CAP_RMDIR. Old behaviour: - Allow for unlinkat(2) when removing directory. Added CAP_RENAMEAT: - Required for source directory for the renameat(2) syscall. Added CAP_UNLINKAT (effectively it replaces CAP_DELETE and CAP_RMDIR): - Allow for unlinkat(2) on any object. - Required if target of renameat(2) exists and will be removed by this call. Removed CAP_MAPEXEC. CAP_MMAP old behaviour: - Allow for mmap(2) with any combination of PROT_NONE, PROT_READ and PROT_WRITE. CAP_MMAP new behaviour: - Allow for mmap(2)+PROT_NONE. Added CAP_MMAP_R: - Allow for mmap(PROT_READ). Added CAP_MMAP_W: - Allow for mmap(PROT_WRITE). Added CAP_MMAP_X: - Allow for mmap(PROT_EXEC). Added CAP_MMAP_RW: - Allow for mmap(PROT_READ | PROT_WRITE). Added CAP_MMAP_RX: - Allow for mmap(PROT_READ | PROT_EXEC). Added CAP_MMAP_WX: - Allow for mmap(PROT_WRITE | PROT_EXEC). Added CAP_MMAP_RWX: - Allow for mmap(PROT_READ | PROT_WRITE | PROT_EXEC). Renamed CAP_MKDIR to CAP_MKDIRAT. Renamed CAP_MKFIFO to CAP_MKFIFOAT. Renamed CAP_MKNODE to CAP_MKNODEAT. CAP_READ old behaviour: - Allow pread(2). - Disallow read(2), readv(2) (if there is no CAP_SEEK). CAP_READ new behaviour: - Allow read(2), readv(2). - Disallow pread(2) (CAP_SEEK was also required). CAP_WRITE old behaviour: - Allow pwrite(2). - Disallow write(2), writev(2) (if there is no CAP_SEEK). CAP_WRITE new behaviour: - Allow write(2), writev(2). - Disallow pwrite(2) (CAP_SEEK was also required). Added convinient defines: #define CAP_PREAD (CAP_SEEK | CAP_READ) #define CAP_PWRITE (CAP_SEEK | CAP_WRITE) #define CAP_MMAP_R (CAP_MMAP | CAP_SEEK | CAP_READ) #define CAP_MMAP_W (CAP_MMAP | CAP_SEEK | CAP_WRITE) #define CAP_MMAP_X (CAP_MMAP | CAP_SEEK | 0x0000000000000008ULL) #define CAP_MMAP_RW (CAP_MMAP_R | CAP_MMAP_W) #define CAP_MMAP_RX (CAP_MMAP_R | CAP_MMAP_X) #define CAP_MMAP_WX (CAP_MMAP_W | CAP_MMAP_X) #define CAP_MMAP_RWX (CAP_MMAP_R | CAP_MMAP_W | CAP_MMAP_X) #define CAP_RECV CAP_READ #define CAP_SEND CAP_WRITE #define CAP_SOCK_CLIENT \ (CAP_CONNECT | CAP_GETPEERNAME | CAP_GETSOCKNAME | CAP_GETSOCKOPT | \ CAP_PEELOFF | CAP_RECV | CAP_SEND | CAP_SETSOCKOPT | CAP_SHUTDOWN) #define CAP_SOCK_SERVER \ (CAP_ACCEPT | CAP_BIND | CAP_GETPEERNAME | CAP_GETSOCKNAME | \ CAP_GETSOCKOPT | CAP_LISTEN | CAP_PEELOFF | CAP_RECV | CAP_SEND | \ CAP_SETSOCKOPT | CAP_SHUTDOWN) Added defines for backward API compatibility: #define CAP_MAPEXEC CAP_MMAP_X #define CAP_DELETE CAP_UNLINKAT #define CAP_MKDIR CAP_MKDIRAT #define CAP_RMDIR CAP_UNLINKAT #define CAP_MKFIFO CAP_MKFIFOAT #define CAP_MKNOD CAP_MKNODAT #define CAP_SOCK_ALL (CAP_SOCK_CLIENT | CAP_SOCK_SERVER) Sponsored by: The FreeBSD Foundation Reviewed by: Christoph Mallon <christoph.mallon@gmx.de> Many aspects discussed with: rwatson, benl, jonathan ABI compatibility discussed with: kib Notes: svn path=/head/; revision=247602
* Redo r242842, now actually fixing the warnings, as follows:Dimitry Andric2012-11-121-4/+6
| | | | | | | | | | | | | | | | | | | - In sys/ofed/drivers/infiniband/core/cma.c, an enum struct member is interpreted as an int, so cast it to an int. - In sys/ofed/drivers/infiniband/core/ud_header.c, initialize the packet_length variable in ib_ud_header_init(), to prevent undefined behaviour. - In sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c, call rdma_notify() with the correct enum type and value. - In sys/ofed/include/linux/pci.h, change the PCI_DEVICE and PCI_VDEVICE macros to use C99 struct initializers, so additional members can be overridden. Reviewed by: delphij, Garrett Cooper <yanegomi@gmail.com> MFC after: 1 week Notes: svn path=/head/; revision=242933