Commit Graph

40 Commits

Author SHA1 Message Date
Sepherosa Ziehau
1ea448225c tcp/lro: Change SLIST to LIST, so that removing an entry is O(1)
This is kinda critical to the performance when the CPU is slow and
network bandwidth is high, e.g. in the hypervisor.

Reviewed by:	rrs, gallatin, Dexuan Cui <decui microsoft com>
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5765
2016-04-01 06:43:05 +00:00
Navdeep Parhar
b03384114d Add wait_event_interruptible_timeout to linuxkpi.
Submitted by:	Krishnamraju Eraparaju @ Chelsio
Reviewed by:	hselasky@
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D5776
2016-03-31 17:11:58 +00:00
Hans Petter Selasky
9ad5ce9d01 Fix bugs in currently unused bit searching loop.
MFC after:	3 days
Sponsored by:	Mellanox Technologies
2016-03-31 06:19:15 +00:00
Hans Petter Selasky
cb19abd277 Run the LinuxKPI PCI shutdown handler free of the Giant mutex.
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2016-03-07 14:35:31 +00:00
Hans Petter Selasky
510ebed7be Add more functions to the LinuxKPI.
Define strnicmp as a function macro instead of a regular macro while
at it.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2016-03-03 09:56:04 +00:00
Svatopluk Kraus
a1e1814d76 As <machine/pmap.h> is included from <vm/pmap.h>, there is no need to
include it explicitly when <vm/pmap.h> is already included.

Reviewed by:	alc, kib
Differential Revision:	https://reviews.freebsd.org/D5373
2016-02-22 09:02:20 +00:00
Hans Petter Selasky
fe68f570d4 Update and add various macros to the LinuxKPI and resolve a macro
redefinition issue in the cxgb driver.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
Reviewed by:	np @
2016-01-26 15:26:35 +00:00
Hans Petter Selasky
c7c96d1093 LinuxKPI list updates:
- Add some new hlist macros.
- Update existing hlist macros removing the need for a temporary
  iteration variable.
- Properly define the RCU hlist macros to be SMP safe with regard
  to RCU.
- Safe list macro arguments by adding a pair of parentheses.
- Prefix the _list_add() and _list_splice() functions with "linux"
  to reflect they are LinuxKPI internal functions.

Obtained from:	Linux
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2016-01-26 15:12:31 +00:00
Hans Petter Selasky
e6ef991e5e Implement ether_addr_equal(), ether_addr_equal_64bits() and
random_ether_addr() for the LinuxKPI.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2016-01-26 14:36:16 +00:00
Hans Petter Selasky
f15ffb5e63 Implement is_vlan_dev() and vlan_dev_vlan_id() for the LinuxKPI.
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2016-01-26 14:33:20 +00:00
Hans Petter Selasky
e28297940b Implement bitmap_weight() and bitmap_equal() for the LinuxKPI.
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2016-01-26 14:31:20 +00:00
Hans Petter Selasky
d211177315 Add more network related macros and functions to the LinuxKPI.
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2016-01-26 14:29:50 +00:00
Hans Petter Selasky
4a19cc98b3 Add definition for the NETDEV_CHANGE event and tidy up the LinuxKPI
notifier header file a bit while at it.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2016-01-26 14:27:00 +00:00
Hans Petter Selasky
9f34efb9f4 Define __get_user() and __put_user() for the LinuxKPI.
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2016-01-26 14:21:30 +00:00
Hans Petter Selasky
a65ef21558 Add more LinuxKPI PCI related functions and defines.
Removed comments deriving from Linux.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2016-01-26 14:20:25 +00:00
Hans Petter Selasky
f919b7a664 Implement 64-bit atomic operations for the LinuxKPI.
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2016-01-21 17:56:23 +00:00
Hans Petter Selasky
29cbb3bef2 LinuxKPI atomic fixes:
- Fix implementation of atomic_add_unless(). The atomic_cmpset_int()
  function returns a boolean and not the previous value of the atomic
  variable.
- The atomic counters should be signed according to Linux.
- Some minor cosmetics and styling while at it.

Reviewed by:	alfred @
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2016-01-21 17:52:55 +00:00
Hans Petter Selasky
1f6112d50a Use function macro instead of non-function macro to reduce chance of
incorrect expansion.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2016-01-21 17:36:06 +00:00
Hans Petter Selasky
2d1bee654a Implement idr_preload(), idr_preload_end(), idr_alloc() and
idr_alloc_cyclic() in the LinuxKPI. Bump the FreeBSD version to
force recompilation of all KLDs due to IDR structure size change.

MFC after:	2 weeks
Sponsored by:	Mellanox Technologies
2016-01-21 14:57:45 +00:00
John Baldwin
e23cd1b923 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().

Tested by:	np
Reported by:	Krishnamraju Eraparaju @ Chelsio
MFC after:	3 days
Sponsored by:	Chelsio Communications
2016-01-20 00:14:34 +00:00
Hans Petter Selasky
7d1333938f Implement support for PCI suspend, resume and shutdown events in the
LinuxKPI. Fix a few spaces to tabs. Bump the FreeBSD version to force
recompilation of existing KMODs.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2016-01-15 11:18:58 +00:00
Hans Petter Selasky
0c510167fb LinuxKPI style changes:
- Properly prefix internal functions with "linux_" instead of only a
  single underscore to avoid future namespace collisions.
- Make some functions global instead of inline to ease debugging and
  to avoid unnecessary code duplication.
- Remove no longer existing kthread_create() function's prototype.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2016-01-08 10:04:19 +00:00
Hans Petter Selasky
e10c4cc0a4 Implement RCU mechanism using shared exclusive locks.
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2016-01-05 12:22:45 +00:00
Hans Petter Selasky
b648035313 Handle when filedescriptors are closed before initialized. An early
fdclose() call can cause fget_unlocked() to fail.

Found by:	mjg @
MFC after:	1 week
Reviewed by:	Mark Block <markb@mellanox.com>
Sponsored by:	Mellanox Technologies
Differential Revision:	https://reviews.freebsd.org/D4351
2015-12-31 14:47:45 +00:00
Hans Petter Selasky
06204f8e25 Minor LinuxKPI code cleanup:
- Declare some static functions in linux_compat.c instead if inside
  various header files.
- Prefix FreeBSD local functions in the LinuxKPI with "linux_" to
  avoid symbol name conflicts in the future and to make debugging
  easier.
- Make the "struct kobj_ktype" declaractions constant to shave off a
  few bytes from the data segment.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2015-12-31 12:30:19 +00:00
Hans Petter Selasky
337cb9f04c Make the kobject refcounting compliant with Linux. Refcounting on the
parent kobject cannot be factored out and must be done by the kobject
consumers.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2015-12-31 11:27:36 +00:00
Hans Petter Selasky
260194052e 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.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2015-12-28 18:20:05 +00:00
Hans Petter Selasky
c4e58b4efe Implement drain_workqueue() function.
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2015-12-21 12:20:02 +00:00
Hans Petter Selasky
9782763db2 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.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2015-12-21 12:13:03 +00:00
Hans Petter Selasky
55d445d317 Minor workqueue cleanup:
- Make some functions global instead of inline to ease debugging.
- Fix some minor style issues.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2015-12-21 11:58:59 +00:00
Hans Petter Selasky
c094330345 Implement sleepable RCU mechanism using shared exclusive locks.
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2015-12-21 11:03:12 +00:00
Hans Petter Selasky
cee21041cf Implement ACCESS_ONCE(), WRITE_ONCE() and READ_ONCE().
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2015-12-21 10:56:38 +00:00
Hans Petter Selasky
f837e46d16 Add some structures and defines which will be used when decoding small
form factor, SFF, standards compliant ethernet EEPROMs.

MFC after:	1 week
Obtained from:	Linux
Sponsored by:	Mellanox Technologies
2015-12-03 12:51:54 +00:00
Hans Petter Selasky
9ce5ab9ce6 Remove incorrect defines. The proper version of these macros is
defined in linux/etherdevice.h.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2015-12-03 11:45:12 +00:00
Hans Petter Selasky
52ba05767f Add more functions and types to the LinuxKPI.
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2015-11-30 09:24:12 +00:00
Hans Petter Selasky
f727a767e9 Add assert and note about the size of "unsigned long" inside the
LinuxKPI for the future.

Sponsored by:	Mellanox Technologies
2015-11-13 09:00:39 +00:00
Hans Petter Selasky
86845417d1 Build fixes:
- Add some missing I/O functions for non-i386 and amd64 platforms.
- Stub ioremap() to NULL using a macro to ensure non-existing memory
  attributes are not referred when they do not exist.
- Add more header files to linux/list.h to resolve driver compilation
  issues on Sparc64 and PowerPC platforms.

Sponsored by:	Mellanox Technologies
2015-11-12 09:18:22 +00:00
Conrad Meyer
3b383c9ede linuxkpi/sysfs.h: Cast arg2 through intptr_t to avoid GCC warning
The code compiles fine under Clang, but GCC on PPC is less permissive about
integer and pointer sizes.  (An intmax_t is clearly *large enough* to hold a
pointer value.)

Another follow-up to r290475.

Reported by:	jhibbits
Sponsored by:	EMC / Isilon Storage Division
2015-11-09 16:50:42 +00:00
Hans Petter Selasky
8e7baabc9f Make all the LinuxKPI include files compile standalone.
Sponsored by:	Mellanox Technologies
2015-11-03 12:37:55 +00:00
Hans Petter Selasky
8d59ecb214 Finish process of moving the LinuxKPI module into the default kernel build.
- Move all files related to the LinuxKPI into sys/compat/linuxkpi and
  its subfolders.
- Update sys/conf/files and some Makefiles to use new file locations.
- Added description of COMPAT_LINUXKPI to sys/conf/NOTES which in turn
  adds the LinuxKPI to all LINT builds.
- The LinuxKPI can be added to the kernel by setting the
  COMPAT_LINUXKPI option. The OFED kernel option no longer builds the
  LinuxKPI into the kernel. This was done to keep the build rules for
  the LinuxKPI in sys/conf/files simple.
- Extend the LinuxKPI module to include support for USB by moving the
  Linux USB compat from usb.ko to linuxkpi.ko.
- Bump the FreeBSD_version.
- A universe kernel build has been done.

Reviewed by:	np @ (cxgb and cxgbe related changes only)
Sponsored by:	Mellanox Technologies
2015-10-29 08:28:39 +00:00