Commit graph

40180 commits

Author SHA1 Message Date
Gustavo Padovan c240a714a6 staging/android: improve documentation for sync_file
num_fences was missing a colon mark and sync_file_create() now have
better description.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-29 17:37:10 -07:00
Gustavo Padovan d4cab38e15 staging/android: prepare sync_file for de-staging
Move its functions and structs to their own file. Also moves function's
docs to the .c file.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-29 17:37:10 -07:00
Gustavo Padovan d7c3110c28 staging/android: remove name arg from sync_file_create()
Simplifies the API to only receive the fence it needs to add to the
sync and create a name for the sync_file based on the fence context and
seqno.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-29 17:37:10 -07:00
Gustavo Padovan 10e362c387 staging/android: make sync_file_fdget() static
There is no plan in the near future to use this function outside of this
file so keep it as static.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-29 17:37:10 -07:00
Gustavo Padovan 4dff14e88e staging/android: make sync_file_merge() static
There is no plan in the near future to use this function outside of this
file so keep it as static.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-29 17:37:10 -07:00
Gustavo Padovan 696f74cf54 staging/android: move sync_file functions comments to sync.c
To keep comments in line with drivers/dma-buf/ move all sync_file comments
to sync.c.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-29 17:37:10 -07:00
Gustavo Padovan 2a7c1db557 staging/android: drop sync_file_install() and sync_file_put()
These two functions are just wrappers for one line functions, they
call fd_install() and fput() respectively, so just get rid of them
and use fd_install() and fput() directly for more simplicity.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-29 17:37:10 -07:00
Gustavo Padovan a64d6a6866 staging/android: remove redundant comments on sync_merge_data
struct sync_merge_data already have documentation on top of the
struct definition. No need to duplicate it.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-29 17:37:10 -07:00
Linus Torvalds 925d96a0c9 Final set of -rc fixes for 4.6
- A number of collected fixes for oopses, memory corruptions, deadlocks,
   etc.  All of these fixes are small (many only 5-10 lines), obvious,
   and tested.
 - Fix for the security issue related to the use of write for
   bi-directional communications.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJXIrZVAAoJELgmozMOVy/d/XEP/1A4Ohm7WiZMN09wvlFGSgLe
 2z2tY9ILvFuiAF++VZRfYyRmHorVKHYB1tk0JTsW1Ts1DrkjExgr4LS1/YDLOC42
 q8YlBZw2x7pdnD5W1MJm+HK6oNj7aZVVjEHG7QnfLUIXr57a2rBQIeeWLx24M+OS
 j1yvaY/v39qvf7dwHwVjs07rh2WW9QCZn2c/552G4xz1YDdTkYBTc2WNnl0eng1f
 1NqqMXhnajmNyR+Q+0+Vbcp4YWv551l5E6j9M+5nebehNtPSRb0GEIjxT3KnSGEg
 AjFev3XwnRF9EkQOwgbsg7a784+UHXe15vbr1MvbzGygcQeq4NVzLl04WEHExQe1
 Om0ES/i8zfRs6d5XYB5zMY8pJbdjSVM/20d+h21SQs//4JXXJrN35WVAyy8lgwrX
 M3oY4t21eBQlV7oezfEZQgEEbdtccr8LILfZZmRUWPHd2ymaTWg6e4pZwtn45rlD
 O/Gb11G/UT7SXgw+XiPLBj5xlQk7nRn0kGuaStR7PonkLQ9Zy1wSSptvJeGj0VWE
 W6TEJnIqtv0aiJLhIQn8Ee1pCxE/ds7UPW6wT5O9R8ccEdDeIB3BDgskTNg1xPuS
 I8e1o7iA9752YS3wMDhLA8PifwbmVbkGHxJUQecOBPiDcdukkM0q4/YoNYqXKLCc
 nLDv3fMztpinG1L1T2LM
 =MFdC
 -----END PGP SIGNATURE-----

Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma

Pull rdma fixes from Doug Ledford:
 "Final set of -rc fixes for 4.6.

  I've collected up a number of patches that are all pretty small with
  the exception of only a couple.  The hfi1 driver has a number of
  important patches, and it is what really drives the line count of this
  pull request up.  These are all small and I've got this kernel built
  and running in the test lab (I have most of the hardware, I think nes
  is the only thing in this patch set that I can't say I've personally
  tested and have up and running).

  Summary:

   - A number of collected fixes for oopses, memory corruptions,
     deadlocks, etc.  All of these fixes are small (many only 5-10
     lines), obvious, and tested.

   - Fix for the security issue related to the use of write for
     bi-directional communications"

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma:
  RDMA/nes: don't leak skb if carrier down
  IB/security: Restrict use of the write() interface
  IB/hfi1: Use kernel default llseek for ui device
  IB/hfi1: Don't attempt to free resources if initialization failed
  IB/hfi1: Fix missing lock/unlock in verbs drain callback
  IB/rdmavt: Fix send scheduling
  IB/hfi1: Prevent unpinning of wrong pages
  IB/hfi1: Fix deadlock caused by locking with wrong scope
  IB/hfi1: Prevent NULL pointer deferences in caching code
  MAINTAINERS: Update iser/isert maintainer contact info
  IB/mlx5: Expose correct max_sge_rd limit
  RDMA/iw_cxgb4: Fix bar2 virt addr calculation for T4 chips
  iw_cxgb4: handle draining an idle qp
  iw_cxgb3: initialize ibdev.iwcm->ifname for port mapping
  iw_cxgb4: initialize ibdev.iwcm->ifname for port mapping
  IB/core: Don't drain non-existent rq queue-pair
  IB/core: Fix oops in ib_cache_gid_set_default_gid
2016-04-29 17:07:54 -07:00
Gustavo Padovan 2d75c88fef staging/android: refactor SYNC IOCTLs
Change SYNC_IOC_FILE_INFO (former SYNC_IOC_FENCE_INFO) behaviour to avoid
future API breaks and optimize buffer allocation.

Now num_fences can be filled by the caller to inform how many fences it
wants to retrieve from the kernel. If the num_fences passed is greater
than zero info->sync_fence_info should point to a buffer with enough space
to fit all fences.

However if num_fences passed to the kernel is 0, the kernel will reply
with number of fences of the sync_file.

Sending first an ioctl with num_fences = 0 can optimize buffer allocation,
in a first call with num_fences = 0 userspace will receive the actual
number of fences in the num_fences filed.

Then it can allocate a buffer with the correct size on sync_fence_info and
call SYNC_IOC_FILE_INFO again, but now with the actual value of num_fences
in the sync_file.

info->sync_fence_info was converted to __u64 pointer to prevent 32bit
compatibility issues. And a flags member was added.

An example userspace code for the later would be:

	struct sync_file_info *info;
	int err, size, num_fences;

	info = malloc(sizeof(*info));

	info.flags = 0;
	err = ioctl(fd, SYNC_IOC_FILE_INFO, info);
	num_fences = info->num_fences;

	if (num_fences) {
		info.flags = 0;
		size = sizeof(struct sync_fence_info) * num_fences;
		info->num_fences = num_fences;
		info->sync_fence_info = (uint64_t) calloc(num_fences,
							  sizeof(struct sync_fence_info));

		err = ioctl(fd, SYNC_IOC_FILE_INFO, info);
	}

Finally the IOCTLs numbers were changed to avoid any potential old
userspace running the old API to get weird errors. Changing the opcodes
will make them fail right away. This is just a precaution, there no
upstream users of these interfaces yet and the only user is Android, but
we don't expect anyone trying to run android userspace and all it
dependencies on top of upstream kernels.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Greg Hackmann <ghackmann@google.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-29 17:03:49 -07:00
Leo Sperling b5b7fe8666 staging: android: Fix grammar error in Kconfig file
Remove the "s" from kills so that the help message is easier to understand

Signed-off-by: Leo Sperling <leosperling97@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-29 17:03:07 -07:00
Jes Sorensen af4981fc59 staging: rtl8723au: Add warning about this driver being deprecated
This driver is deprecated and superseded by rtl8xxxu. It will be
removed in a future kernel release.

Add a warning to Kconfig and at device init time to notify users and
allow them time to switch over.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-29 10:38:23 -07:00
H Hartley Sweeten 6c3b78aa6e staging: comedi: mite: don't expose CHSR_* bit defines
These bit defines are only used in the mite driver. Move them so they
are not needlessly exposed.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:19:49 -07:00
H Hartley Sweeten 0c912e5c9c staging: comedi: mite: return void from mite_ack_linkc()
Currently this function returns the value read from the mite channel
status register. None of the callers use, or need, the returned value.

For aesthetics, change the return to void.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:19:49 -07:00
H Hartley Sweeten f7d005c33c staging: comedi: mite: make mite_ack_linkc() handle mite_sync_dma()
The mite dma is always synced on a LINKC status. Some of the mite users
sync the dma regadless of the status.

Add a 'sync' parameter to mite_ack_linkc() to force a dma sync. Then do
the dma sync as needed.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:19:49 -07:00
H Hartley Sweeten 3da088cae2 staging: comedi: ni_mio_common: handle_a_interrupt() does not need ai_mite_status
This function only handles the analog input interrupts, the dma was already
handled.

Remove the unecessary parameter and fix ni_E_interrupts() so that the comedi
events are properly handled.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:19:49 -07:00
H Hartley Sweeten 7101711ee4 staging: comedi: ni_mio_common: simplify AI LINKC handling
Simplfy the LINKC handing for the analog input dma by moving it into
the main interrupt handler. This function already hold the spinlock
mite_channel_lock so call mite_sync_dma() directly instead of using
the helper function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:19:49 -07:00
H Hartley Sweeten ba5c0da886 staging: comedi: ni_mio_common: fix interrupt handler for dev->read_subdev
There may not be a dev->read_subdev, i.e. an analog input subdevice, that
supports async commands. If it doesn't exist the interrupt/dma will never
be enabled.  Fix ni_E_interrupt() so that the analog input subdevice is
only handled if it exists.

This also fixes minor NULL dereference issue in handle_a_interrupt().
If the dev->read_subdev is NULL the comedi_async pointer (s->async) will
not be allocated by the device postconfig so there is no way to get a
valid comedi_cmd (&s->async->cmd).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:19:49 -07:00
H Hartley Sweeten 4b2d73898f staging: comedi: ni_mio_common: handle_b_interrupt() does not need ao_mite_status
This function only handles the analog input interrupts, the dma was already
handled.

Remove the unecessary parameter and fix ni_E_interrupts() so that the comedi
events are properly handled.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:19:49 -07:00
H Hartley Sweeten 7ef1745f29 staging: comedi: ni_mio_common: fix interrupt handler for dev->write_subdev
There may not be a dev->write_subdev, i.e. an analog output subdevice, that
supports async commands. If it doesn't exist the interrupt/dma will never
be enabled.  Fix ni_E_interrupt() so that the analog output subdevice is
only handled if it exists.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:19:49 -07:00
H Hartley Sweeten 72639a1670 staging: comedi: ni_mio_common: absorb mite_handle_b_linkc()
Simplfy the LINKC handing by removing the helper function and moving
the mite_sync_dma() into the main interrupt handler.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:19:49 -07:00
H Hartley Sweeten cc38da7287 staging: comedi: mite: check for transfer errors in mite_ack_linkc()
Currently only some of the users of mite dma check for transfer errors.

The ni_mio_common code does the check for the analog input and analog
output subdevices. The m-series digital I/O subdevice and the counter
subdevices (handled by ni_tiocmd) do not check.

The ni_pcidio driver checks for the digital input subdevice.

The ni_660x driver counter subdevices (handled by ni_tiocmd) also do
not check.

Move the transfer error checking into mite_ack_linkc() so that the
drivers that use mite don't have to deal with it. This also makes
sure that all the subdevices that use mite for dma will cancel the
async command if a transfer error is detected.

Simplfy the transfer error check by just checking the CHSR_XFERR bit.
This bit will be set if one or more transfer processes terminated with
an error. The actual error is determined by the LERR, MERR, and DERR
bits.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:19:49 -07:00
H Hartley Sweeten 21e871fef7 staging: comedi: mite: cleanup remaining mite register/bits
For aesthetics, convert the register/bit enums into defines and
use the BIT() macro to define the bits.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:18:51 -07:00
H Hartley Sweeten 7024cc88bf staging: comedi: mite: remove BUG_ON() in MITE_IODWBSR_1_WSIZE_bits()
Prior to calling this function pci_ioremap_bar() is called. If the
pci_resource_len(), i.e. the 'size', was 0 the ioremap would fail
so this function would never be called. So the first BUG_ON() can
never occur.

The 'order' returned by ilog2() will always be > 0 so the second
BUG_ON() will also never occur.

Remove the unnecessary BUG_ON() checks and tidy up the function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:18:51 -07:00
H Hartley Sweeten 43d667243c staging: comedi: mite: document the mite_struct spinlock_t
Add a comment to fix the checkpatch.pl issue:
CHECK: spinlock_t definition without comment

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:18:51 -07:00
H Hartley Sweeten 268bc9cd3a staging: comedi: mite: rename CamelCase CHSR bit enums
Rename the CamelCase symbols to fix the checkpatch.pl issues.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:18:51 -07:00
H Hartley Sweeten 51d430056c staging: comedi: mite: introduce mite_sync_dma()
The struct mite_channel 'dir' member specifies if the dma is input
or output. Wrap the mite_sync_input_dma() and mite_sync_output_dma()
functions with a single mite_sync_dma() so that the drivers don't
have to worry about the sync direction.

The functions that actually sync the input/output dma currently return
-1 if an overflow/underrun is detected otherwise they return 0. If an
overflow/underrun is detected the async->event COMEDI_CB_OVERFLOW is
also set.

The callers never check the return value anyway so just make the
functions return void. The async->event can be checked if necessary
to detect any errors.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:18:51 -07:00
H Hartley Sweeten 33b0b6913d staging: comedi: mite: don't expose unnecessary register/bit info
Most of the mite registers are only accessed by the mite driver.
There is no reason to expose the register/bit info. Remove this
info from the header.

For aesthetics, convert the bit info enums into defines and use
the BIT() macro to define them. Tidy up the inline functions for
the retry limit and drq reqs bits in the config registers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:18:51 -07:00
H Hartley Sweeten 4d88096df9 staging: comedi: mite: introduce mite_ack_linkc()
Introduce a helper function to handle the ack of a LINKC interrupt.
Tidy up the drivers that use the new helper.

The extra check for CHSR_INT in the ni_pcidio driver is not necessary.
This bit will be set if any of the interrupt sources, including CHSR_LINKC,
have generated an interrupt. Remove the extra check.

The mite_get_status() function is now only used by the mite driver.
Make it static and remove the export.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:18:51 -07:00
H Hartley Sweeten 96f3153000 staging: comedi: mite: don't expose mite_dma_reset()
This function is only called by the mite driver. Remove the inline
function from the header and make it static in the driver.

Use the function in mite_prep_dma() instead of duplicating the code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:18:51 -07:00
H Hartley Sweeten eecbadef12 staging: comedi: ni_pcidio: remove redundant mite disarm/reset
The mite_release_channel() will disarm and reset the mite channel.
Remove the redundant calls in ni_pcidio_release_di_mite_channel().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:18:51 -07:00
H Hartley Sweeten ef81f55b07 staging: comedi: mite: remove mite_struct member 'daq_phys_addr'
This member of mite_struct is only used to map the mite I/O window.
For aesthetics, remove it and use a local variable instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:18:51 -07:00
H Hartley Sweeten 0db6624ae0 staging: comedi: mite: remove mite_struct member 'mite_phys_addr'
This member of mite_struct is set but never used. Just remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:18:51 -07:00
H Hartley Sweeten 0d9bfc2412 staging: comedi: mite: don't export internal functions
The functions that get the number of bytes written to and read from
memory are only used internally by the mite driver when syncing the
dma channel. Make them static and remove the exports.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:18:51 -07:00
H Hartley Sweeten a2a9d1b4c5 staging: comedi: mite: remove mite_dma_tcr()
This exported function is not used by any of the comedi drivers. The
only call point in mite.c is commented out. Remove the unused function
and the export.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:18:51 -07:00
H Hartley Sweeten ace613ee7c staging: comedi: mite: remove TOP_OF_PAGE() macro
This macro is not used. Remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:18:51 -07:00
H Hartley Sweeten aac00ea22c staging: comedi: mite: Prefer 'unsigned int' to bare use of 'unsigned'
Fix the checkpatch.pl issues.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:18:51 -07:00
H Hartley Sweeten 6f7fa70464 staging: comedi: ni_mio_common: introduce NI_STC_DMA_CHAN_SEL()
The inline helper ni_stc_dma_channel_select_bitfield() returns the
bits needed to select a MITE channel to use for DMA. The MITE code
is setup to handle up to 8 channels but in reality only channels 0
to 3 are used by most of the drivers. The PCI-6032E and PCI-6033E
boards can also use channels 4 and 5.

For aesthetics, convert this inline function into a macro and
remove the BUG() which will never occur.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:17:28 -07:00
H Hartley Sweeten bbd962206c staging: comedi: mite.h: rename CHSR_LxERR_mask
Fix the checkpatch.pl issue:
CHECK: Avoid CamelCase: <CHSR_LxERR_mask>

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:17:28 -07:00
H Hartley Sweeten b24a3ecd46 staging: comedi: ni_mio_common: fix CamelCase in ni_serial_hw_readwrite8()
Fix the checkpatch.pl issue:
CHECK: Avoid CamelCase: <Error>

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:17:28 -07:00
H Hartley Sweeten 68556ffc95 staging: comedi: ni_mio_common: remove 'fudge_factor_80_to_20Mhz'
For aesthetics, remove this local variable to fix the checkpatch.pl issue:
CHECK: Avoid CamelCase: <fudge_factor_80_to_20Mhz>

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:17:28 -07:00
H Hartley Sweeten 8a5b817ff7 staging: comedi: ni_mio_common: usleep_range is preferred over udelay
Fix the checkpatch.pl issues.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:17:28 -07:00
H Hartley Sweeten 2e2f7b7037 staging: comedi: ni_mio_common: tidy up ni_gpct_write_register()
The 'bits' value passed to this function is properly set by the callers
so the BUG_ON() can never occur when writing to the NITIO_G[01]_INT_ENA
and NITIO_G01_RESET registers. Remove the BUG_ON() checks.

For aesthetic, also remove the static const variables. They don't add
any additional clarity.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:17:28 -07:00
H Hartley Sweeten 1392dccbbd staging: comedi: ni_mio_common: tidy up AO scan begin
The (*do_cmdtest) validates that the cmd->scan_begin_src will only be
TRIG_TIMER or TRIG_EXT. Refactor ni_ao_cmd_set_update() and remove the
BUG() which can never occur.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:17:28 -07:00
H Hartley Sweeten 55f9e7d9d3 staging: comedi: ni_mio_common: tidy up AO trigger selection
The AO subdevice (*cancel), ni_ao_reset(), always sets the private
data 'ao_trigger_select' to 0. So when a command is started the
'trigsel' value in ni_ao_cmd_set_trigger() will always start as 0.
Remove the unnecessary member from the private data.

The (*do_cmdtest) validates that the cmd->start_src will only be
TRIG_INT or TRIG_EXT. Refactor ni_ao_cmd_set_trigger() and remove
the BUG() which can never occur.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:17:28 -07:00
H Hartley Sweeten 0b235d5ce4 staging: comedi: ni_mio_common: convert NI_GPCT_SUBDEV to a macro
The 'counter_index' is always in range (0 to < NUM_GPCT, which is 2).

For aesthetics, convert this inline function into a macro and remove
the BUG() which can never occur.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:17:28 -07:00
H Hartley Sweeten 73894987d6 staging: comedi: ni_mio_common: fix logical continuations
Fix the checkpatch.pl issues:
CHECK: Logical continuations should be on the previous line

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:17:28 -07:00
H Hartley Sweeten beb1cc1b02 staging: comedi: ni_mio_common: multiple assignments should be avoided
Fix the checkpatch.pl issues.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:17:28 -07:00
H Hartley Sweeten b6a0e5b32a staging: comedi: ni_mio_common: fix lines over 80 characters
Fix the checkpatch.pl issues.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:17:28 -07:00
H Hartley Sweeten bd474a02d3 staging: comedi: ni_mio_common: tidy up block comments
Fix the checkpatch.pl issues.
WARNING: Block comments use * on subsequent lines

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:17:28 -07:00
H Hartley Sweeten 546615f9f9 staging: comedi: ni_mio_common: use 'unsigned int' instead of kernel types
Generally comedi drivers use 'unsigned int' types instead of the kernel type
'u32' for unsigned 32-bit values.

For aesthetics, change all the 'u32' and 'uin32_t' types and fix the
checkpatch.pl issues about:
CHECK: Prefer kernel type 'u32' over 'uint32_t'

The various i/o helpers use for reading and writing the 32/16/8-bit registers
all start with an 'unsigned int' value for writing and finally return an
'unsigned int' value. For aesthetics, change all the 'uint16_t' and 'uint8_t'
types for insigned int and fix the checkpatch.pl issues about:
CHECK: Prefer kernel type 'u16' over 'uint16_t'

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:17:28 -07:00
H Hartley Sweeten fe20a34aff staging: comedi: ni_mio_common: Prefer 'unsigned int' to bare use of 'unsigned'
Fix the checkpatch.pl issues.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:17:28 -07:00
H Hartley Sweeten cf122bb4a6 staging: comedi: ni_mio_common: tidy up DIO subdevice ifdef'ery
This file is is bit of a mess. It's included by the ni_atmio, ni_mio_cs, and
ni_pcimio drivers. The ni_pcimio driver is the only one that uses DMA. It
defines PCIDMA so that the dma code is compiled it. This causes a bunch
of ifdef'ery in the file.

The DIO subdevice for the ni_pcidio "is_m_series" boards is quite different
from the standard e-series DIO. Mainly it supports async commands that use
DMA.

Tidy up some of the ifdef'ery by adding ifdef to the subdevice init. Move
the is_m_series check to the main interrupt handler so that the unneded
handle_cdio_interrupt() can be blocked out for the ni_atmio and ni_mio_cs
drivers.

Consolidate the other ifdef's to block out the affected code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:17:28 -07:00
H Hartley Sweeten b7cd3f6049 staging: comedi: ni_mio_common: tidy up mite dma channel releases
Absorb the inline helper functions that call ni_set_bitfield() to clear
the dma channel selection bits.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:17:28 -07:00
H Hartley Sweeten 38b81a7a41 staging: comedi: ni_mio_common: tidy up mite dma channel requests
Tidy up the functions that request the mite dma channels by absorbing the
inline helper functions that call ni_set_bitfield() to set the channel
selection bits.

Add support for the NI_M_CDIO_DMA_SEL_REG register to ni_set_bitfield()
so that all the soft_reg_copy_lock spinlocking is done in one place.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:17:28 -07:00
H Hartley Sweeten bf2388b1ea staging: comedi: ni_mio_common: remove some unnecessary BUG_ON()
The mite dma channels are only requested by a subdevice with a (*do_cmd)
and they are released by a (*cancel). The comedi core will only call the
(*do_cmd) if the subdevice is not already running a command and all
commands are terminated by the core with a (*cancel).

Remove the BUG_ON() checks in the request functions which can never
happen.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:17:28 -07:00
H Hartley Sweeten 098353038b staging: comedi: das1800: update the MODULE_DESCRIPTION
Change the MODULE_DESCRIPTION to something more usefull than the
generic "Comedi low-level driver".

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten a6b7dbb2be staging: comedi: das1800: allow setting the external trigger polarity
The external pin TGIN can be used to start and/or stop the analog input
command. Currently the driver only supports negative edge polarity for
this signal.

Add support to allow the user to select positive edge polarity using
the CR_INVERT flag.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten a2706b0943 staging: comedi: das1800: clarify the analog input cmd triggers
Clarify the documentation in the comedi driver comment block to
better explain the cmd triggert.

Add a comment to step 2b of the (*do_cmdtest) to clarify the
trigger check.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten 5f657f8bf3 staging: comedi: das1800: fix comments about the 'ao' board range
The waveform analog outputs on the 'ao' boards are not currently
supported. Modify the comment about the analog output range on
these boards so that the information is saved but fixes the
checkpatch.pl issues:
WARNING: Block comments use a trailing */ on a separate line

Move the comment so it's grouped with the comedi_lrange info.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten 6d8c9a9e88 staging: comedi: das1800: fix lines over 80 characters
These comments are just extra cruft. Remove them to fix the
checkpatch.pl issues:
WARNING: line over 80 characters

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten b52fd5f08e staging: comedi: das1800: fix comments in das1800_ai_handler()
Fix the checkpatch.pl issues:
WARNING: line over 80 characters

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten 99ad808faf staging: comedi: das1800: fix comments in das1800_ai_cmd()
Fix the checkpatch.pl issues:
WARNING: Block comments use a trailing */ on a separate line
WARNING: line over 80 characters

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten 18092f4486 staging: comedi: das1800: remove the function comments
These comments are just added cruft. Remove them.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten 7d5fa05cc4 staging: comedi: das1800: clarify step 4 of the ai (*do_cmdtest)
This step of the (*do_cmdtest) fixes the timing arguments when the
cmd->convert_src is TRIG_TIMER. The code is compact but it's a bit
hard to understand the "burst mode" vs. "non burst mode" (i.e. paced)
timing.

Clarify the fixup by splitting it into separate functions to check
the arguments based on if the command is doing 'paced' or 'burst'
timing. Add some comments to clarify the fixups.

This also fixes a minor issue with the 'burst' timing. When the
cmd->scan_begin_src is also TRIG_TIMER the pacer clock is used to
start each scan. The cmd->scan_begin_arg specifies the scan time.
The minimum (not maximum) value for this time must be large enough
for the 'burst' conversion time to sample all the channels.

The current 'max' check limits the scan time to the minimum time
(i.e. the max conversion speed).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten cf9eaee0ed staging: comedi: das1800: remove the private data member comments
The comments about the members of the private data are not really
necessary and removing them fixes a couple checkpatch.pl issues.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten 5b28b8c459 staging: comedi: das1800: move comment about max conversion speeds
For aesthetics, move this information into the comedi comment block.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten cc3ddba2c5 staging: comedi: das1800: change type of private data 'fifo_buf'
Fix the checkpatch.pl issue:
CHECK: Prefer kernel type 'u16' over 'uint16_t'

Change the type to 'unsigned short' as that is more typical in comedi
drivers.

Use sizeof(*p) instead of sizeof(type) when allocation the buffer.
Also fix the checkpatch.pl issue:
WARNING: line over 80 characters

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten bface0f323 staging: comedi: das1800: cleanup copyright and comedi comment blocks
Tidy up these multi-line comments to fix the checkpatch.pl issues:
WARNING: Block comments use * on subsequent lines
WARNING: line over 80 characters

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten 983330210f staging: comedi: das1800: document the spinlock
The comedi_device spinlock is used to protect the indirect addressing
selected by the DAS1800_SELECT register. It also prevents races between
the interrupt handler and the analog input (*poll).

Update the comments to make this clear.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten fb90ec01bc staging: comedi: das1800: absorb control_a_bits()
Absorb this helper function into the analog input (*do_cmd).
For aesthetics, convert the switch code into if/else.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten cfc2236bbc staging: comedi: das1800: use comedi_timeout()
Use the helper function to handle the busywaiting for the analog
input conversion to complete.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten 7b1924b6fc staging: comedi: das1800: refactor program_chanlist()
Refactor this function so it can be used to program the chanlist for
the analog input (*do_cmd) and (*insn_read).

Rename the function so it has namespace associated with the driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten ceba8220df staging: comedi: das1800: absorb control_c_bits()
Absorb this helper function into the analog input (*do_cmd).
For aesthetics, convert the switch code into if/else.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten 843681c883 staging: comedi: das1800: introduce das1800_ai_chanspec_bits()
Introduce a helper function for the common code needed to set the
control c register bits for a channel specification.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten 750bca653d staging: comedi: das1800: add analog output readback
Use the core provided readback support to allow reading back the last
value written to the analog output channels.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten a5405cfa1b staging: comedi: das1800: change type of 'ai_speed' boardinfo
This value is compared against the unsigned int cmd->convert_arg to
check the minimum value (max speed) for the analog input conversion
timing.

For aesthetics, change the type to match the cmd->convert_arg type.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten ac8ebf8a8f staging: comedi: das1800: remove 'qram_len' boardinfo
The "hc" type boards have 64 analog input channels with a 64
entry queue. All the others have 16 channels and a 256 entry
queue.

EXP-1800 expansion boards can be used to increase the number
of analog inputs on the 16 channel boards, 16 channels per
EXP-1800, for a total of 256 channels.

Remove the 'qram_len' member of the boardinfo and use the
'id' member to determine the number of channels.

Add a comment about the number of channels and the unclear
mapping of the channels when EXP-1800 boards are used.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten 5068827a78 staging: comedi: das1800: refactor 'range_ai' boardinfo
The boards supported by this driver have analog inputs with gains
of 1, 10, 50, and 250 ("01" type) or 1, 2, 4, and 8 ("02" type).
Unfortunately, the "01"/"02" type cannot be determined from the
boards id or by probing.

Replace the 'range_ai' member of the boardinfo with a bit-field flag,
'is_01_series' and only set it for the "01" type boards. Remove the
unnecessary initialization for the "02" type boards.

For aesthetics, rename the comedi_lrange arrays and document the gain.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten 8114b5ecb8 staging: comedi: das1800: remove 'ao_ability' boardinfo
The "da" and "hc" type boards have normal analog outputs. The
"ao" type boards have move advanced analog outputs with waveform
generation capability.

Remove the 'ao_ability' member of the boardinfo and use the
'id' member to determine if the subdevice should be initialized.

The "ao" waveform analog outputs are not currently supported.
For aesthetics, add an else if for the initialization of the
subdevice for these boards.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten 1322f14898 staging: comedi: das1800: remove 'ao_n_chan' boardinfo
The "st-da" board types have 4 analog output channels. All other
board types, with analog outputs, only have 2 channels.

Remove the 'ao_n_chan' member of the boardinfo and use the
'id' member to determine the subdevice 'n_chan'.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten 4c6f738e0f staging: comedi: das1800: tidy up das1800_ao_insn_write()
The (*insn_write) functions are supposed to write insn->n values to the
specified channel. Tidy up this function and make it work like the core
expects.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten 605b670e9b staging: comedi: das1800: initialize all analog outputs
The current code used to initialize the analog outputs only sets the
last channel. The other channels will be reloaded with the last value
that was written to them.

Move the code into the subdevice init and properly initialize all the
channels to 0V.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten bc524200ed staging: comedi: das1800: remove 'do_n_chan' boardinfo
The "hc" type boards have 8 digtial outputs. All other board
types have 4.

Remove the 'do_n_chan' member of the boardinfo and use the
'id' member to determine the subdevice 'n_chan'.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten dad1e30fde staging: comedi: das1800: remove 'resolution' boardinfo
The "hr" type boards have 16-bit analog inputs and outputs.
All other board types have 12-bit.

Remove the 'resolution' member of the boardinfo and use the
'id' member to determine the subdevices 'maxdata'.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten 90f39b9f99 staging: comedi: das1800: use comedi_offset_munge() for analog output
The analog outputs expect 2's complement data. For aesthetics, use
the helper function to handle the munging instead of depending on
the boardinfo 'resolution'.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten 7a9254962b staging: comedi: das1800: remove 'common' boardinfo member
The "hc" type boards do not support common mode analog inputs
all the other board types do.

Remove the unnecessary member from the boardinfo and use the
'id' member to determine if the SDF_COMMON flag should be set
for the subdevice.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten fa33428fe0 staging: comedi: das1800: tidy up das1800_probe()
Refactor das1800_probe() to return an errno instead of the boardinfo
pointer.

Add the board 'id' to the boardinfo to tidy up this function to clarify
the sanity check when the user provided a board name when trying to
attach to the driver.

Currently when this function probes for a boardinfo based on the board
id it returns the wrong boardinfo for the "st-da" and "hr-da" types.
This causes the analog input subdevice for those boards to not be
available. Fix the probe so that a proper boardinfo is used.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten 1e436ce3ff staging: comedi: das1800: tidy up boardinfo
For aesthetics, add some whitespace to the boardinfo array.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten 768417450e staging: comedi: das1800: tidy up analog input subdevice init
For aesthetics, add some whitespace to the subdevice init and rename
the subdevice support functions.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten f4c96e0120 staging: comedi: das1800: tidy up analog output subdevice init
For aesthetics, add some whitespace to the subdevice init and rename
the (*insn_write) function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten 92a3b54bd2 staging: comedi: das1800: tidy up digital input subdevice init
For aesthetics, add some whitespace to the subdevice init and rename
the (*insn_bits) function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten 5934ff9e7b staging: comedi: das1800: tidy up digital output subdevice init
For aesthetics, add some whitespace to the subdevice init and rename
the (*insn_bits) function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:16:10 -07:00
H Hartley Sweeten a512f530f6 staging: comedi: plx9080.h: rename CamelCase enum value
Rename the enum value to fix the checkpatch.pl issue:
CHECK: Avoid CamelCase: <MARB_PCIv21_MODE>

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:14:20 -07:00
H Hartley Sweeten a104336d0e staging: comedi: comedi_8254.h: tidy up the register map defines
Tidy up the defines to fix the checkpatch.pl issues:
CHECK: Prefer using the BIT macro

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:14:20 -07:00
H Hartley Sweeten d074aeb888 staging: comedi: amcc_s5933.h: tidy up comment issues
Tidy up the comments to fix the checkpatch.pl isses:
WARNING: Block comments use * on subsequent lines
WARNING: line over 80 characters

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:14:20 -07:00
H Hartley Sweeten c0cb87af51 staging: comedi: ni_stc.h: tidy up block comments
Tidy up the block comments to fix the checkpatch.pl issues:
WARNING: Block comments use * on subsequent lines

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:14:20 -07:00
H Hartley Sweeten fb82926f24 staging: comedi: ni_stc.h: Prefer kernel type 'u8' over 'uint8_t'
Change the type to fix the checkpatch.pl issues.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:14:20 -07:00
H Hartley Sweeten fd46fe7381 staging: comedi: ni_stc.h: Prefer 'unsigned int' to bare use of 'unsigned'
Change the types to fix the checkpatch.pl issues.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:14:20 -07:00
H Hartley Sweeten 30539a1155 staging: comedi: das1800: fix das-1801st-da boardinfo
The "da" type boards all have 4 analog outputs. Fix the boardinfo
for the das-1801st-da.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:12:06 -07:00
H Hartley Sweeten afd055838c staging: comedi: das1800: fix analog input sample munging
The analog input samples are 2's complement when the inputs are configured
for bipolar ranges and offset binary when they are unipolar ranges. For
bipolar ranges the sample needs to be munged to the offset binary format
that comedi uses.

The (*insn_read) does the munging correctly but the async command support
incorrectly munges the data for both bipolar and unipolar ranges when
reading the remaining samples from the fifo in das1800_handle_fifo_not_empty().

Add a (*munge) function to the analog input subdevice so that the samples
are correctly munged when they are added to the async buffer by
comedi_buf_write_samples(). Add a flag to the private data and set it in
the (*do_cmd) so that the munging is only done for bipolar ranges.

Clarify the code by using the core helper functions to check the range and
do the munging.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:12:06 -07:00
H Hartley Sweeten d375278d66 staging: comedi: das1800: fix possible NULL dereference
DMA is optional with this driver. If it was not enabled the devpriv->dma
pointer will be NULL.

Fix the possible NULL pointer dereference when trying to disable the DMA
channels in das1800_ai_cancel() and tidy up the comments to fix the
checkpatch.pl issues:
WARNING: line over 80 characters

It's probably harmless in das1800_ai_setup_dma() because the 'desc' pointer
will not be used if DMA is disabled but fix it there also.

Fixes: 99dfc3357e ("staging: comedi: das1800: remove depends on ISA_DMA_API limitation")
Cc: <stable@vger.kernel.org> # 4.0+
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:12:06 -07:00
David Binder 3a56d700f6 staging: unisys: visorbus: initialize variables
Initializes previously uninitialized variables that were flagged
as being problematic by Smatch.

Signed-off-by: David Binder <david.binder@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:10:27 -07:00
Erik Arfvidson 260d89929c staging: unisys: visorbus: remove unused chipsetready information
Chipsetready sysfs entry is not used by any guests or service
partitions.

remove unused g_chipset_msg_hdr our service partition

remove unused chipsetready_store and driver attributes:
        chipsetready_store()
        visorchipset_guest_attrs
        visorchipset_guest_groupw

remove unused chipsets_events:
        check_chipset_events()
        clear_chipset_events()
        visorchipset_holdchipsetready

remove sysfs documentation dealing with chipsetready

Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:10:27 -07:00
Alexander Curtin 39b9280983 staging: unisys: include: Added kerneldoc comments to visor_device
The visor_device struct is used between multiple drivers, so this
adds kerneldoc comments to the fields.

Signed-off-by: Alexander Curtin <alexander.curtin@unisys.com>
Signed-off-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:09:37 -07:00
Alexander Curtin b9edaf7ceb staging: unisys: include: Added kernel-doc for struct visor_driver
This adds kerneldoc style comments to the visor_driver struct since
it's shared between multiple modules.

Signed-off-by: Alexander Curtin <alexander.curtin@unisys.com>
Signed-off-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:09:37 -07:00
Tim Sell 6d24b4b10e staging: unisys: include: remove unused fields from struct visor_driver
The build_date and build_time fields are not used, and have been removed.

Signed-off-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:09:37 -07:00
David Binder 538b387234 staging: unisys: Documentation: Remove proc-entries.txt
Unisys drivers no longer utilize procfs. Therefore, the documentation
for our procfs entries is no longer needed.

Signed-off-by: David Binder <david.binder@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:09:37 -07:00
Erik Arfvidson 38d56c2fad staging: unisys: added display string size define
Display string size that is guaranteed to be no longer the 99 characters.

Don't use a magic number throughout the code, define it once and use it
throughout.

Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:09:37 -07:00
Tim Sell 6a957193ba staging: unisys: visornic: convert BUG_ON to dev_err() message
The caller of visor_copy_fragsinfo_from_skb() is prepared to log a
dev_err() message if it fails (by returning a negative value), so we now
just fail in the one occasion where visor_copy_fragsinfo_from_skb() was
doing a BUG_ON.

There was also a problem before where visor_copy_fragsinfo_from_skb() was
returning a negative to indicate error, yet it was declared to return an
unsigned value!  So obviously that needed correcting too.

Signed-off-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:09:37 -07:00
Sudip Mukherjee 853adce6fd staging: wilc1000: remove unused variables
These variables were havnig the pointer returned by wiphy_priv() but
they were never used.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:06:51 -07:00
Claudiu Beznea 245b431b76 Staging: wilc1000: Freed memory in case of error
This patch frees memory allocated inside wilc_wlan_txq_add_cfg_pkt()
in case wilc_wlan_txq_add_to_head() fails.

Signed-off-by: Claudiu Beznea <claudiu.beznea@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:06:51 -07:00
Chaehyun Lim 8958f5811c staging: wilc1000: rename result in handle_set_ip_address
This patch renames result to ret that is used to get return value from
wilc_send_config_pkt. Some handle_*() functions are used as result,
others are used as ret. It will be changed as ret in all handle_*()
functions to match variable name.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:04:55 -07:00
Chaehyun Lim cd7293ef39 staging: wilc1000: change data type of result in handle_set_ip_address
This patch changes data type of result variable from s32 to int. result
is used to get return value from wilc_send_config_pkt that has return
type of int.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:04:55 -07:00
Chaehyun Lim fc6138b6cf staging: wilc1000: change handle_set_ip_address's return type to void
When handle_set_ip_address is called in hostIFthread that is a kernel
thread, it is not checked return type of this function. This patch
changes return type to void and removes braces if statement due to have
a single statement.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:04:55 -07:00
Chaehyun Lim 14f3b086fc staging: wilc1000: rename result in handle_set_operation_mode
This patch renames result to ret that is used to get return value from
wilc_send_config_pkt. Some handle_*() functions are used as result,
others are used as ret. It will be changed as ret in all handle_*()
functions to match variable name.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:03:39 -07:00
Chaehyun Lim 197b053d9c staging: wilc1000: change data type of result in handle_set_operation_mode
This patch changes data type of result variable from s32 to int. result
is used to get return value from wilc_send_config_pkt that has return
type of int.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:03:39 -07:00
Chaehyun Lim b093d4fe60 staging: wilc1000: change handle_set_operation_mode's return type to void
When handle_set_operation_mode is called in hostIFthread that is a
kernel thread, it is not checked return type of this function. This
patch changes return type to void and removes braces if statement due to
have a single statement.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:03:39 -07:00
Chaehyun Lim fdcc285b77 staging: wilc1000: rename result in handle_set_wfi_drv_handler
This patch renames result to ret that is used to get return value from
wilc_send_config_pkt. Some handle_*() function are used as result,
others are used as ret. It will be changed as ret in all handle_*()
function to match variable name.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:03:39 -07:00
Chaehyun Lim d22002338f staging: wilc1000: change data type of result in handle_set_wfi_drv_handler
This patch changes data type of result variable from s32 to int.
result is used to get return value from wilc_send_config_pkt that has
return type of int.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:03:39 -07:00
Chaehyun Lim 62a0d45af6 staging: wilc1000: change handle_set_wfi_drv_handler's return type to void
When handle_set_wfi_drv_handler is called in hostIFthread that is a
kernel thread, it is not checked return type of this function. This
patch changes return type to void and removes braces if statement due to
have a single statement.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:03:39 -07:00
Chaehyun Lim 12915c51e9 staging: wilc1000: change return type of ret variable in handle_get_tx_pwr
This patch changes return type of ret variable from s32 to int.
ret has return value from wilc_send_config_pkt that has return type of
int.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:03:39 -07:00
Chaehyun Lim 31aab0e0ab staging: wilc1000: remove unused hif_drv in wilc_add_beacon
This patch removes unused hif_drv in wilc_add_beacon.
There is no need to check null and print debug log.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:02:04 -07:00
Chaehyun Lim d5dc940289 staging: wilc1000: remove unused hif_drv in wilc_del_beacon
This patch removes unused hif_drv in wilc_del_beacon.
There is no need to check null and print debug log.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:02:04 -07:00
Chaehyun Lim 4965c4dcdd staging: wilc1000: remove unused hif_drv in wilc_set_pmkid_info
This patch removes unused hif_drv in wilc_set_pmkid_info.
There is no need to check null and print debug log.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:02:04 -07:00
Chaehyun Lim 11d9e460cc staging: wilc1000: remove unused hif_drv in host_int_get_assoc_res_info
This patch removes unused hif_drv in host_int_get_assoc_res_info.
There is no need to check null and print debug log.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:02:04 -07:00
Chaehyun Lim a61c42319b staging: wilc1000: remove unused hif_drv in wilc_set_mac_chnl_num
This patch removes unused hif_drv in wilc_set_mac_chnl_num.
There is no need to check null and print debug log.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:02:04 -07:00
Chaehyun Lim 1f4b12f089 staging: wilc1000: remove unused hif_drv in wilc_remain_on_channel
This patch removes unused hif_drv in wilc_remain_on_channel.
There is no need to check null and print debug log.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:02:04 -07:00
Chaehyun Lim b0474e9eb9 staging: wilc1000: remove unused hif_drv in wilc_add_station
This patch removes unused hif_drv in wilc_add_station.
There is no need to check null and print debug log.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:02:04 -07:00
Chaehyun Lim d5db441435 staging: wilc1000: remove unused hif_drv in wilc_del_station
This patch removes unused hif_drv in wilc_del_station.
There is no need to check null and print debug log.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:02:04 -07:00
Chaehyun Lim d9a90eea69 staging: wilc1000: remove unused hif_drv in wilc_del_allstation
This patch removes unused hif_drv in wilc_del_allstation.
There is no need to check null and print debug log.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:02:04 -07:00
Chaehyun Lim f2b01d04e8 staging: wilc1000: remove unused hif_drv in wilc_edit_station
This patch removes unused hif_drv in wilc_edit_station.
There is no need to checku null and print debug log.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:02:04 -07:00
Chaehyun Lim 3cf996d428 staging: wilc1000: remove unused hif_drv in wilc_set_power_mgmt
This patch removes unused hif_drv in wilc_set_power_mgmt.
There is no need to check null and print debug log.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:02:04 -07:00
Chaehyun Lim 8bf4d84dca staging: wilc1000: remove unused hif_drv in wilc_setup_multicast_filter
This patch removes unused hif_drv in wilc_setup_multicast_filter.
There is no need to check null and print debug log.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:02:04 -07:00
Chaehyun Lim cc1aa4c8e9 staging: wilc1000: remove unused hif_drv in wilc_setup_ipaddress
This patch removes unused hif_drv in wilc_setup_ipaddress.
There is no need to check null and print debug log.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:02:04 -07:00
Chaehyun Lim 3de8fbac6a staging: wilc1000: remove unused hif_drv in host_int_get_ipaddress
This patch removes unused hif_drv in host_int_get_ipaddress.
There is no need to check null and print debug log.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:02:04 -07:00
Chaehyun Lim 2f27ad12ab staging: wilc1000: rename pu8Buffer in handle_scan
This patch renames pu8Buffer to buffer to avoid camelcase.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:00:52 -07:00
Chaehyun Lim 87b16cbf17 staging: wilc1000: rename u32WidsCount in handle_scan
This patch renames u32WidsCount to index to avoid camelcase.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:00:52 -07:00
Chaehyun Lim bbff83dbb7 staging: wilc1000: rename strWIDList in handle_scan
This patch renames strWIDList to wid_list to avoid camelcase.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:00:52 -07:00
Chaehyun Lim 34b107eded staging: wilc1000: rename pstrHostIFscanAttr in handle_scan
This patch renames pstrHostIFscanAttr to scan_info to avoid camelcase.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:00:52 -07:00
Chaehyun Lim ba7eac31a1 staging: wilc1000: rename Handle_Scan
This patch renames Handle_Scan to handle_scan to avoid camelcase.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:00:52 -07:00
Chaehyun Lim 03f00ac788 staging: wilc1000: remove block scope braces and fix indentation
This patch removes unnecessary block scope braces and fix indentation of
the codes.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:00:52 -07:00
Chaehyun Lim 4aa3387bc2 staging: wilc1000: move Handle_ScanDone function declaration
Handle_ScanDone function declaration is moved to front of
host_interface.c file.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:00:52 -07:00
Chaehyun Lim 960efe0f89 staging: wilc1000: rename goto label in handle_cfg_param
This patch changes goto label from ERRORHANDLER to unlock.
unlock is a more meaningful name than ERRORHANDLER.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 22:00:52 -07:00
Leo Kim b0f1836fad staging: wilc1000: adds a check routine when performed del_key()
This patch is adds a check routine when performed del_key().
We was find this situation while test the 'rmmod sdio'.
That is received inform a .del_key cmd from cfg80211.
If is not exist wep keys, must be ignore a wilc_remove_wep_key() function.
Thus, adds a check routine that key length of wep.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:58:42 -07:00
Leo Kim 8006109ba0 staging: wilc1000: adds a cfg80211_disconnected() function
This patch is adds a cfg80211_disconnected() when connection is lost already.
We was find this situation while test the 'rmmod sdio'.
SDIO remove function are include both remove mac_close and unregister net_device.
That is received one more a disconnect cmd from cfg80211.
Driver was already performed disconnect.
If wilc->close value was set to true, adds a call to cfg80211_disconnected().

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:58:42 -07:00
Leo Kim 3f626cf4a8 staging: wilc1000: add set to null after release firmware
This patch add set to null after release firmware.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:58:42 -07:00
Leo Kim a2c28de5c0 staging: wilc1000: removes unnecessary test code
This patch removes unnecessary test code that mac address hardcoding setting.
This test code is support to old firmware.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:58:42 -07:00
Leo Kim 11a54b3f99 staging: wilc1000: txq_thread_started: replaces a semaphore with a completion
This patch replaces a semaphore(txq_thread_started) with a completion.
Struct semaphore txq_thread_started is used to signal completion of txq thread.
It is better to use completion than semaphore for this case.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:58:42 -07:00
Leo Kim 01c7cee913 staging: wilc1000: removes duplicate del_timer_sync
This patch removes del_timer_sync(&periodic_rssi) which was
already performed this action.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:58:42 -07:00
Leo Kim 27e1f13964 staging: wilc1000: changes logic when happened mq_send fail
This patch changes logic when happened mq_send fail.
The check as a result value that mq_send fail.
But, regardless of the result value then perform a semaphore up.
That is an occur that semaphore locking.
Add to 'else' routine and move to 'else' position a semaphore up.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:58:42 -07:00
Andreas Dilger ae33a836df staging: lustre: llite: quiet overly verbose info message
The client doesn't need to print a message for every client mount that
the layout lock feature is enabled.  This can be found at runtime via
the "import" proc file.

I also noticed that deleting OST objects logs into the debug log with
D_HA status, which is enabled by default.  Move this over to D_INODE
so it doesn't fill the OST debug logs.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1095
Reviewed-on: http://review.whamcloud.com/7918
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:55:26 -07:00
Emoly Liu 69daf080b7 staging: lustre: debugfs: improve osc/mdc "imports" connect data
Improve /sys/debug/fs/lustre/{osc,mdc}/*/import files to print
the struct obd_connect_data data fields as "connect_data:"
in addition to the "connect_flags:" field.

Signed-off-by: Emoly Liu <emoly.liu@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3386
Reviewed-on: http://review.whamcloud.com/6588
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:55:26 -07:00
Emoly Liu 882b0a1359 staging: lustre: obd: add case LCFG_PARAM to osd_process_config
Some proc parameters were moved from ofd to osd module and only
their symlinks were kept in ofd for interoperability/compatibility.
To process this kind of config params passed by ofd, this patch is
to do the following fixes:

 - since these parameters are not included by the static lprocfs var
   list, a pre-check is added for them to avoid "unknown param" error
   message confuses the uses. If they are matched in this check, they
   will be passed to the osd directly.
 - improve the error messages in class_process_proc_param() and
   class_process_proc_seq_param() a little.

Signed-off-by: Emoly Liu <emoly.liu@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4221
Reviewed-on: http://review.whamcloud.com/8238
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:55:26 -07:00
Sebastien Buisson 6f6c8e7c75 staging: lustre: ldlm: dont always check max_pages_per_rpc alignement
If connection is not established yet, cli->cl_chunkbits is
uninitilized so we cannot use it to check max_pages_per_rpc
alignment.

Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4379
Reviewed-on: http://review.whamcloud.com/8558
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:55:26 -07:00
wang di b78c2b9b3e staging: lustre: fld: add local fldb to each target
Add local FLDB to each MDT, so OSD/OUT can check whether
FID is remote by looking up local FLDB, i.e. no need send RPC
to MDT0. This is just the client part of the work.

Signed-off-by: wang di <di.wang@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4076
Reviewed-on: http://review.whamcloud.com/7884
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:55:26 -07:00
Alexander Boyko 8bd3efb755 staging: lustre: brw: added OBDO short io flag
To prevent collisions with any future flags needed in features written
against this branch.

Signed-off-by: Alexander Boyko <alexander_boyko@xyratex.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1757
Xyratex-bug-id: MRP-1460
Reviewed-on: http://review.whamcloud.com/8182
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Vitaly Fertman <vitaly_fertman@xyratex.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:55:26 -07:00
John L. Hammond b201c24765 staging: lustre: echo: remove echo_env_info() regions from echo_client.c
This function declartion is not needed so remove it.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675
Reviewed-on: http://review.whamcloud.com/5580
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:55:26 -07:00
Oleg Drokin 83e8d02ce7 staging: lustre: debug: initialize debug_msg_data if needed
initialize the libcfs_debug_msg_data only if needed

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1408
Reviewed-on: http://review.whamcloud.com/8338
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:55:26 -07:00
Dmitry Eremin 1b3f4f90c4 staging: lustre: llite: fixup return value ll_direct_IO_26
Return the correct values from ll_direct_IO_26.

Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4069
Reviewed-on: http://review.whamcloud.com/8080
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-Off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:53:18 -07:00
Mikhail Pershin 7018750621 staging: lustre: ptlrpc: initialize request session early
Initialize request session early to make it available in
high-priority handlers

Signed-off-by: Mikhail Pershin <mike.pershin@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3467
Reviewed-on: http://review.whamcloud.com/7350
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:53:18 -07:00
Lai Siyao 8fb2990eb7 staging: lustre: llog: we don't need vfsmount
The patch for LU-3286 removed vfsmount instances used
on the server side. Since this is server side only we
can remove it from the upstream client.

Signed-off-by: Lai Siyao <lai.siyao@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3286
Reviewed-on: http://review.whamcloud.com/8286
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:53:18 -07:00
Swapnil Pimpale fe956e728a staging: lustre: llite: check ret of ll_prep_md_op_data in ll_dir_filler
ll_dir_filler() now checks the returned pointer from
ll_prep_md_op_data() using IS_ERR()

Signed-off-by: Swapnil Pimpale <spimpale@ddn.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4082
Reviewed-on: http://review.whamcloud.com/8073
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:53:18 -07:00
Andreas Dilger 5787be9472 staging: lustre: llite: debugging for ll_file_open LASSERT
Add debugging for LASSERTF(it_disposition(it, DISP_ENQ_OPEN_REF)
in ll_file_open(), since this is a rarely hit failure under racer,
and it would be useful to get more information if this is hit
again.  Print the full intent disposition, as well as the status,
in case Oleg's earlier comment about bailing out on any error is
actually the case here.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1993
Reviewed-on: http://review.whamcloud.com/6250
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:53:18 -07:00
Andriy Skulysh 9ebd489658 staging: lustre: libcfs: Fix NUMA emulated mode
Kernel commit c1c3443c9c
assigns all allowed cpus to emulated node.

End cpt initialization loop when all CPUs are assigned.

Signed-off-by: Andriy Skulysh <Andriy_Skulysh@xyratex.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3992
Reviewed-on: http://review.whamcloud.com/7724
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:53:18 -07:00
Lai Siyao 98f2ec6120 staging: lustre: fid: add a connect flag for open by FID
Add OBD_CONNECT_OPEN_BY_FID for open by FID, if MDS supports this,
for open by FID, it won't retry with name if object with the FID
doesn't exist; while if client supports this, client won't pack
name in open request if FID is known.

Signed-off-by: Lai Siyao <lai.siyao@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3544
Reviewed-on: http://review.whamcloud.com/8093
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:53:18 -07:00
Swapnil Pimpale d8555069e2 staging: lustre: obd: cleanup client import if client_obd_setup fails
client_obd_setup() allocates an obd_import which should be cleaned up
if there is any failure afterwards in callers of client_obd_setup().
This patch fixes the bug in osc_setup(), mgc_setup(), mdc_setup() and
lwp_setup(). The fix is to call obd_cleanup_client_import() before
calling client_obd_cleanup() in case of an error.

Signed-off-by: Swapnil Pimpale <spimpale@ddn.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3810
Reviewed-on: http://review.whamcloud.com/7561
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:53:18 -07:00
Dmitry Eremin 6956583961 staging: lustre: ldlm: check all errors during ldlm_debugfs_setup()
Fix ignoring errors from ldebugfs_add_vars() function.

Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3885
Reviewed-on: http://review.whamcloud.com/8115
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:53:18 -07:00
Mikhail Pershin 45fe5b139c staging: lustre: ptlrpc: use unified handler for OST requests
Switch OST/OFD request processing to the unified request
handle.

Signed-off-by: Mikhail Pershin <mike.pershin@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3467
Reviewed-on: http://review.whamcloud.com/7130
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:53:18 -07:00
Amir Shehata c4ab96e7ca staging: lustre: obd: add newline for dumped config record
The function class_config_parse_rec() parses the llog record
and places it into a buffer to be returned. That buffer needs
to end with a newline which is currently missing.

Signed-off-by: Amir Shehata <amir.shehata@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2149
Reviewed-on: http://review.whamcloud.com/4254
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:53:18 -07:00
Amir Shehata b828b9cac7 staging: lustre: obd: remove newline from LCONSOLE string
Remove the newline from the LCONSOLE debug macro in the
function class_config_dump_handler().

Signed-off-by: Amir Shehata <amir.shehata@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2149
Reviewed-on: http://review.whamcloud.com/4254
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:53:18 -07:00
Andreas Dilger 35e458160d staging: lustre: ptlrpc: quiet warning for 2.1/2.5 connections
The Lustre 2.5.4 client will print a warning about connections with
2.1.3 servers, yet they are still supposed to be interoperable.
Increase the window of warning to be up to Lustre 2.5.50, since we
do not intend to allow interoperability between 2.1 and 2.6 systems.
This was from the time when major releases like Lustre 1.4 and 1.8
were many years apart would have no chance for interoperation.

Only print this message once per client, to avoid flooding the console
for connections to many servers or frequent network reconnections.
Server versions should all be nearly the same in any case.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2528
Reviewed-on: http://review.whamcloud.com/7916
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:51:58 -07:00
Prakash Surya ad479287b4 staging: lustre: osc: Use SOFT_SYNC to urge server commit
This change adds a BRW page flag, OBD_BRW_SOFT_SYNC. This flag is
intended to urge a server to commit a client's unstable pages to
stable storage. A client will add this flag to any BRW requests while
it is in a state where it has "many" unstable pages pinned in its cache.

The server, upon receiving a page with this flag set, *should* begin
an async commit. The idea being that, with the proactive async commit,
the client's pinned unstable pages will transition into a stable state
faster than they would have otherwise. Although, the server side portion
of this agreement is still unimplemented, so the OBD_BRW_SOFT_SYNC flag
will currently fall on deaf ears.

Signed-off-by: Prakash Surya <surya1@llnl.gov>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2139
Reviewed-on: http://review.whamcloud.com/4375
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:51:58 -07:00
Prakash Surya dece0b95dd staging: lustre: osc: Track number of "unstable" pages per osc
This change adds simple accounting hooks for "unstable" pages on a per
OSC basis. Now, in addition to the per filesystem tracking, each OSC
will maintain a running total of its unstable pages. These counters are
exported through the proc interface, and can be read using the lctl
command.

For example:

	# Read number of unstable pages contained by each OSC
	lctl get_param osc.*.unstable_stats

The motivation for this change is in anticipation of implementing a
"soft sync" functionality, urging servers to commit these unstable
pages to stable storage. The per OSC accounting allows a client to
limit the soft sync request to only the OSCs which have outstanding
unstable pages.

Signed-off-by: Prakash Surya <surya1@llnl.gov>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2139
Reviewed-on: http://review.whamcloud.com/4374
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:51:58 -07:00
Prakash Surya ac5b148109 staging: lustre: osc: Track and limit "unstable" pages
This change adds a global counter to track the number of "unstable"
pages held by a given client, along with per file system counters. An
"unstable" page is defined as a page which has been sent to the server
as part of a bulk request, but is uncommitted to stable storage.

In addition to simply tracking the unstable pages, they now also count
towards the maximum number of "pinned" pages on the system at any given
time. Thus, a client will now be bound on the number of dirty and
unstable pages it can pin in memory. Previously only dirty pages were
accounted for in this limit.

In addition to tracking the number of unstable pages in Lustre, the
NR_UNSTABLE_NFS memory zone is also incremented and decremented for
easy monitoring using the "NFS_Unstable:" field in /proc/meminfo.
This field is also used internally by the kernel to limit the total
amount of unstable pages on the system.

The motivation for this change is twofold. First, the client must not
allow itself to disconnect from an OST while still holding unstable
pages. Otherwise, these unstable pages can get lost due to an OST
failure, and replay is not possible due to the disconnect via unmount.

Secondly, the client needs a mechanism to prevent it from allocating too
much of its available RAM to unreclaimable pages pinned by the ptlrpc
layer. If this case occurs, out of memory events can trigger as a side
effect, which we need to avoid.

The current number of unstable pages accounted for on a per file system
granularity is exported by the unstable_stats proc file, contained under
each file system's llite namespace. An example of retrieving this
information is below:

	$ lctl get_param llite.*.unstable_stats

Signed-off-by: Prakash Surya <surya1@llnl.gov>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2139
Reviewed-on: http://review.whamcloud.com/6284
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:51:58 -07:00
Sebastien Buisson 7bbe9f838e staging: lustre: mgc: fix 'error handling' issues
Fix 'error handling' issues found by Coverity version 6.6.1:
Unchecked return value (CHECKED_RETURN)
Calling function without checking return value.
Argument cannot be negative (NEGATIVE_RETURNS)
Negative value used as argument to a function expecting a
positive value.

Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4055
Reviewed-on: http://review.whamcloud.com/7842
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: James Nunez <james.a.nunez@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:51:58 -07:00
Niu Yawei 72a50e4f30 staging: lustre: clio: add debug message in osc_completion()
Replace LASSERT with LASSERTF in osc_completion, thus we can get
more info when the LASSERT is triggered.

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3843
Reviewed-on: http://review.whamcloud.com/7494
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:51:58 -07:00
James Nunez 97a075cddb staging: lustre: llite: Replace printing of i_ino with ll_inode2fid()
The printing of i_ino/i_generation in llite messages is not nearly so
useful as printing the full inode FID, since i_ino is a "compressed"
version of the FID and there may be duplicate values for i_ino in some
cases (especially if running on a 32-bit client).

All instances of printing i_ino/i_generation are replaced with
the FID using ll_inode2fid(). All instances, except for one, of
printing just i_ino was replaced by printing the FID. In all
CERROR lines touched by the i_ino replacements, the device name
or fsname was added at the beginning of the message if it did not
already exist.

Signed-off-by: James Nunez <james.a.nunez@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3491
Reviewed-on: http://review.whamcloud.com/6848
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:51:58 -07:00
Bruce Korb b97fa87f80 staging: lustre: ldlm: update comments about ldlm l_flags
Add and update documentation about some of the ldlm l_flags.

Signed-off-by: Bruce Korb <bruce.korb@gmail.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2906
Reviewed-by: Keith Mannthey <Keith.Mannthey@intel.com>
Reviewed-on: http://review.whamcloud.com/7963
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:51:58 -07:00
Bruce Korb efceaf7cdb staging: lustre: ldlm: remove code wireshark handling
Wireshark output moved to userland file "lustre_dlm_flags_wshark.c"
and only bits that can actually appear "on the wire" are emitted.
The user land "packet-lustre.c" code that references these bits
now gets emitted into that file. e.g. the "local_only" bit is
never put on the wire, so references to it in wireshark are gone.

Signed-off-by: Bruce Korb <bruce.korb@gmail.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2906
Reviewed-by: Keith Mannthey <Keith.Mannthey@intel.com>
Reviewed-on: http://review.whamcloud.com/7963
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:51:58 -07:00
Bruce Korb d76964056a staging: lustre: ldlm: clean up l_flags
Remove the now obsolete LDLM_AST_FLAGS and LDLM_INHERIT_FLAGS defines.
Remove the obsolete LDLM_FL_HIDE_LOCK_MASK define.
Rename "local_only" mask to "off_wire" since it is confusingly similar
to a flag that (I think) means, "do not copy this lock over the wire."

Signed-off-by: Bruce Korb <bruce.korb@gmail.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2906
Reviewed-by: Keith Mannthey <Keith.Mannthey@intel.com>
Reviewed-on: http://review.whamcloud.com/7963
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:51:58 -07:00
Bruce Korb 5a9a80baa7 staging: lustre: ldlm: use accessor macros for l_flags
Convert most of the ldlm lock's l_flags references from direct
bit twiddling to using bit specific macros.  A few multi-bit
operations are left as an exercise for the reader.

The changes are mostly in ldlm, but also in llite, osc and quota.
Also add a multi-bit (mask) test.

Signed-off-by: Bruce Korb <bruce.korb@gmail.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2906
Reviewed-by: Keith Mannthey <Keith.Mannthey@intel.com>
Reviewed-on: http://review.whamcloud.com/7963
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:51:58 -07:00
Dmitry Eremin 0fdd2b8d7c staging: lustre: lmv: kernel crash due to misconfigured MDT
There are few places with access to lmv->tgts[] without check for NULL.
Usually it may happens when MDT configured starting from index 1
instead of 0. For example:
	mkfs.lustre --reformat --mgs --mdt --index=1 /dev/sdd1

Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4098
Reviewed-on: http://review.whamcloud.com/7941
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:51:58 -07:00
Wang Di 7f937beb0a staging: lustre: obdclass: add LCT_SERVER_SESSION for server session
Add LCT_SERVER_SESSION for server session, and separate the
server session flag from LCT_SESSION, so to avoid allocating
session info for client stack for each server request, if
client and server are on the same node.

Signed-off-by: Wang Di <di.wang@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3806
Reviewed-on: http://review.whamcloud.com/7412
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:51:58 -07:00
Dmitry Eremin ac7af34e67 staging: lustre: llite: NFS reexport issue
Suppress erroneous/confusing messages when NFS
is out of sync and requests old data.

Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4050
Reviewed-on: http://review.whamcloud.com/7850
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:51:58 -07:00
Jinshan Xiong c355855359 staging: lustre: llite: reset writeback index in ll_writepages
Otherwise after one round the writeback index will become beyond
the file size and ->writepages() turns into an empty operation.

Also, a safety guard is added to limit the wait time for grant to
10 minutes(take recovery into consideration) at maximum in the
osc_enter_cache() function. Otherwise, EDQUOT will be returned to
the applications to start sync write.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3416
Reviewed-on: http://review.whamcloud.com/6554
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-28 21:51:58 -07:00
Linus Torvalds ba14e961b4 media fixes for v4.6-rc6
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJXIhgfAAoJEAhfPr2O5OEVlY4P/Rw71pT4fJ5MJdwrg11V7Kor
 ev3QxqjKQbeAi2oQEooIaLIlGtvHiGdKApo/jT+VjpvHvdT1y1YDTck0pLYGKTEz
 61dGWWGe3S6WKLXI+jDww7r/MscmdqzYheEGx+qtwB1nvpni6e3szxrIwhKyup70
 wTmh+LO80VhzHOORnYs9E4gUWIlYYOBxtnb1TDeYKzZquly7Mls32gQ+3Uixk4pt
 AFsilvsq8iUU/0LAyxtkPClmmf8ZWoKgLSgAhFBOHZx5TR6Kwa/YwLE+WH6kd4fS
 CQuyD2rvxKwix4PocYjtZJB2YEVGeUU/Ux6VMsKkDrh5aG/V0F3dcqQwCr3iSoTU
 51ieaBh9wFdesT/FnWCznOtVINr4v23wRuOyAHEHd6HrVxXxkLo8R1ADMynwr6HU
 YQMS1Su3icoQcLsdwlYxpQwaJaYvUV4LzDycE5G8weXg9hb2Tfv60svQc1zbXSWc
 Urvw8c7k23vHNLky0h1yYadkgE9K0b567/Am78FXTnFJR1saMpdt9kS7vxqpSJXC
 hoTw+MAaJrmM9jNk+Nmic6ps5xDKAiptjMxZ6YfCzrSK7IHjyYSvay3Lnd9M0zwm
 CKDEaXf9YhDEGEVpaSOIuluo6tcSFumlRY4FFoRysI4n/A779X7X7Ittd6vCrO8Z
 ymL6dhrTgFrnCLEWV9cB
 =REYX
 -----END PGP SIGNATURE-----

Merge tag 'media/v4.6-4' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media fixes from Mauro Carvalho Chehab:
 "Some regression fixes:

   - videobuf2 core: avoid the risk of going past buffer on multi-planes
     and fix rw mode

   - fix support for 4K formats at V4L2 core

   - fix a trouble at davinci_fpe, caused by a bad patch

   - usbvision: revert a patch with a partial fixup.  The fixup patch
     was merged already, and this one has some issues"

* tag 'media/v4.6-4' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
  [media] vb2-memops: Fix over allocation of frame vectors
  [media] media: vb2: Fix regression on poll() for RW mode
  [media] v4l2-dv-timings.h: fix polarity for 4k formats
  [media] davinci_vpfe: Revert "staging: media: davinci_vpfe: remove,unnecessary ret variable"
  [media] usbvision: revert commit 588afcc1
  [media] videobuf2-v4l2: Verify planes array in buffer dequeueing
  [media] videobuf2-core: Check user space planes array in dqbuf
2016-04-28 19:44:47 -07:00
Jubin John d35cf74492 IB/hfi1: Serialize hrtimer function calls
hrtimer functions do not guarantee serialization, so we extend the
cca_timer_lock to cover the hrtimer_forward_now() in the hrtimer
callback handler and the hrtimer_start() in process_becn(). This
prevents races between these 2 functions to update the hrtimer state
leading to problems such as:
kernel BUG at kernel/hrtimer.c:1282!
encountered during validation of the CCA feature.

Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Jubin John <jubin.john@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:29 -04:00
Dean Luick 1cbaa67035 IB/hfi1: Fix MAD port poll for active cables
A MAD directive to start polling must go through the normal
link tuning and start steps in order to correctly handle
active cables.

Reviewed-by: Easwar Hariharan <easwar.hariharan@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:29 -04:00
Dean Luick 015e91fbc9 IB/hfi1: Correctly report neighbor link down reason
The code to save the link down reason for reporting to the SMA
was in a location before the actual reason was read.  Move the
SMA link down reason assignment to a better location.

Reviewed-by: Easwar Hariharan <easwar.hariharan@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:29 -04:00
Dean Luick feb831ddf2 IB/hfi1: Use the neighbor link down reason only when valid
The 8051 uses a link down reason to inform the driver why the
link went down.  The neighbor planned link down reason code is
only valid when a link down idle message is received by the 8051.
Enhance the explanation on why the link went down.

Reviewed-by: Easwar Hariharan <easwar.hariharan@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:29 -04:00
Dean Luick f9b5635cbe IB/hfi1: Ignore link downgrade with 0 lanes
Versions of the 8051 firmware < 0.38 may report a link failure
as a link downgrade with a width of 0 followed by a link down
notification.  Ignore the zero width downgrade notification -
the driver should follow the link down path.

Reviewed-by: Easwar Hariharan <easwar.hariharan@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:29 -04:00
Dean Luick 8f000f7f6e IB/hfi1: Add RSM rule for user FECN handling
Add a receive side mapping rule to extract expected user packets with
the FECN bit set and place them in an eager buffer.  This will allow
user libraries to recognize that a FECN was sent when using header
suppression and respond appropriately.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:29 -04:00
Dean Luick b12349ae13 IB/hfi1: Create a routine to set a receive side mapping rule
Move the rule setting code into its own routine for improved
searchability and reuse.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:28 -04:00
Dean Luick 4a818bedf7 IB/hfi1: Move QOS decision logic into its own function
The decision to use QOS affects other resource allocation.
Move the QOS decision logic into its own function so it can
be called by other interested parties.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:28 -04:00
Dean Luick 372cc85a13 IB/hfi1: Extract RSM map table init from QOS
Refactor the allocation, tracking, and writing of the RSM map table
into its own set of routines.  This will allow the map table to be
passed to multiple users to fill in as needed.  Start with the original
user, QOS.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:28 -04:00
Jianxin Xiong 44306f15f0 IB/hfi1: Reduce kernel context pio buffer allocation
The pio buffers were pooled evenly among all kernel contexts and
user contexts. However, the demand from kernel contexts is much
lower than user contexts. This patch reduces the allocation for
kernel contexts and thus makes more credits available for PSM,
helping performance. This is especially useful on high core-count
systems where large numbers of contexts are used.

A new context type SC_VL15 is added to distinguish the context used
for VL15 from other kernel contexts. The reason is that VL15 needs
to support 2KB sized packet while other kernel contexts need only
support packets up to the size determined by "piothreshold", which
has a default value of 256.

The new allocation method allows triple buffering of largest pio
packets configured for these contexts. This is sufficient to maintain
verbs performance. The largest pio packet size is 2048B for VL15
and "piothreshold" for other kernel contexts. A cap is applied to
"piothreshold" to avoid excessive buffer allocation.

The special case that SDMA is disable is handled differently. In
that case, the original pooling allocation is used to better
support the much higher pio traffic.

Notice that if adaptive pio is disabled (piothreshold==0), the pio
buffer size doesn't matter for non-VL15 kernel send contexts when
SDMA is enabled because pio is not used at all on these contexts
and thus the new allocation is still valid. If SDMA is disabled then
pooling allocation is used as mentioned in previous paragraph.

Adjustment is also made to the calculation of the credit return
threshold for the kernel contexts. Instead of purely based on
the MTU size, a percentage based threshold is also considered and
the smaller one of the two is chosen. This is necessary to ensure
that with the reduced buffer allocation credits are returned in
time to avoid unnecessary stall in the send path.

Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Reviewed-by: Dean Luick <dean.luick@intel.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: Mark Debbage <mark.debbage@intel.com>
Reviewed-by: Jubin John <jubin.john@intel.com>
Signed-off-by: Jianxin Xiong <jianxin.xiong@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:28 -04:00
Jubin John 0852d241f4 IB/hfi1: Change default number of user contexts
Change the default number of user contexts to the number of real
(non-HT) cpu cores in order to reduce the division of hfi1 hardware
contexts in the case of high core counts with hyper-threading enabled.

Reviewed-by: Dean Luick <dean.luick@intel.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: Mitko Haralanov <mitko.haralanov@intel.com>
Signed-off-by: Jubin John <jubin.john@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:28 -04:00
Mike Marciniszyn b218f786ad IB/hfi1: Use global defines for upper bits in opcode
The awkward coding for setting the allowed_ops field
was tripping an smatch warning.

This patch uses the more appropriate defines from include/rdma
to avoid the issue.

As part of the patch remove a mask that was duplicated
in rdmavt include files and use that mask as appropriate.

Fixes: 8bea6b1cfe6f ("IB/rdmavt: Add create queue pair functionality")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:28 -04:00
Mike Marciniszyn 87717f0a75 IB/hfi1: Remove unreachable code
Remove unreachable code from RC ack handling to fix an
smatch error.

Fixes: 633d273995 ("staging/rdma/hfi1: use mod_timer when appropriate")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:28 -04:00
Dean Luick e4e0e39c8d IB/hfi1: Fix double QSFP resource acquire on cache refresh
The function refresh_qsfp_cache() acquires the i2c chain resource,
but one caller already holds the resource.  Change the acquire so
all calls to refresh_qsfp_cache() are covered by the acquire and
remove the acquire within refresh_qsfp_cache().

Reviewed-by: Easwar Hariharan <easwar.hariharan@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:28 -04:00
Dean Luick 90315ad86a IB/hfi1: Guard against concurrent I2C access across all chains
The discrete ASIC board design makes the two I2C chains not
independent of each other.  That is, only one chain can safely
be accessed at a time.  For discrete ASIC devices, adjust the
resource locking so that access to one I2C chain will lock both
of the chains.

Reviewed-by: Easwar Hariharan <easwar.hariharan@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:28 -04:00
Easwar Hariharan 623bba2d92 IB/hfi1: Remove module presence check outside pre-LNI checks
The pre-LNI SerDes and channel tuning algorithm already checks for
module presence assertion for the relevant port types. The extraneous
check removed in this patch blocks link up for port types for which
the module presence assertion is not relevant.

Reviewed-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Easwar Hariharan <easwar.hariharan@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:28 -04:00
Easwar Hariharan 145dd2b399 IB/hfi1: Always turn on CDRs for low power QSFP modules
Clock and data recovery mechanisms (CDRs) in active QSFP modules
can be turned on or off to improve the bit error rate observed on
the channel. Signal integrity and bit error rate requirements require
us to always turn on any CDRs present in low power cables (power
dissipation 2.5W or lower). However, we adhere to the platform
designer's settings (provided in the platform configuration) for
higher power cables (dissipation 3.5W or higher) if the platform
designer has determined that the platform requires the CDRs to be
turned on (or off) and is capable of supplying and cooling the higher
power modules.

This patch also introduces the get_qsfp_power_class function to
centralize the bit twiddling required to determine the QSFP power class
across the code. Reusing this function improves the readability of code
that depends on knowing the power class of the cable, such as the
active and optical channel tuning algorithm.

Reviewed-by: Dean Luick <dean.luick@intel.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Easwar Hariharan <easwar.hariharan@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:27 -04:00
Sebastian Sanchez e38d1e4f50 IB/hfi1: Check P_KEY for all sent packets from user mode
Add the P_KEY check for user-context mechanism for
both PIO and SDMA. For PIO, the
SendCtxtCheckEnable.DisallowKDETHPackets is set by
default. When the P_KEY is set,
SendCtxtCheckEnable.DisallowKDETHPackets is cleared.
For SDMA, a software check was included. This change
requires user processes to set the P_KEY before sending
any packets, otherwise, the sent packet will fail. The
original submission didn't have this check but it's
required.

Reviewed-by: Dean Luick <dean.luick@intel.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: Mikto Haralanov <mitko.haralanov@intel.com>
Signed-off-by: Sebastian Sanchez <sebastian.sanchez@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:27 -04:00
Sebastian Sanchez ef699e849c IB/hfi1: Adjust default MTU to be 10KB
Increasing the default MTU size to 10KB improves performance
for PSM. Change the default MTU to 10KB but constrain
Verbs MTU to 8KB. Also update default MTU module parameter
description to be HFI1_DEFAULT_MAX_MTU.

Reviewed-by: Dean Luick <dean.luick@intel.com>
Reviewed-by: Mitko Haralanov <mitko.haralanov@intel.com>
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Reviewed-by: Jubin John <jubin.john@intel.com>
Signed-off-by: Sebastian Sanchez <sebastian.sanchez@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:27 -04:00
Dean Luick 60d585ad6e IB/hfi1: Simplify init_qpmap_table()
Make init_qpmap_table() easier to understand by simplifying
the loop indexing and writing each register when it is "full",
removing the need for a follow-on register write.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:27 -04:00
Dean Luick de882ff5b8 IB/hfi1: Correctly obtain the full service class
The function hdr2sc was using an unshifted mask to obtain
the 5th bit of the service class.  Correct the issue by using
the shifted mask.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:27 -04:00
Dean Luick 33a9eb5271 IB/hfi1: Fix QOS rule mappings
The QOS RSM rule mappings are off by one, referencing a kernel receive
context that does not exist.

Correctly start the QOS RSM map entries at FIRST_KERNEL_CONTEXT rather
than MIN_KERNEL_KCTXTS.  Remove the cruft that hid this.

Change the QP map table so all traffic not caught by QOS RSM goes to
the control context rather than the first QOS context.

Correct comments to match the actual code operation and intent.

Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:27 -04:00
Dean Luick 35969d9b94 IB/hfi1: Remove invalid QOS check
Remove an invalid compare of the number of QOS RSM map table entries
against the number of physical receive contexts.  The RSM map table
has its own size and has no relation to the number of physical receive
contexts.

Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:27 -04:00
Dean Luick 153d58cd8e IB/hfi1: Fix QOS num_vl bit width
The bit width for num_vls, n, needs to be calculated based on
the pow2 rounded up of the number of vls.  Otherwise num_vls of 3,
5, 6, and 7 will have misplaced QOS RSM map entries.

Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:27 -04:00
Dean Luick f9c82a0b75 IB/hfi1: Fix i2c resource reservation checks
The i2c and qsfp read/write routines should check for the resource
reservation of the incoming argument target rather than the implicit
target of the hardware HFI.

Reviewed-by: Easwar Hariharan <easwar.hariharan@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Jubin John <jubin.john@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:27 -04:00
Dean Luick 4ee1585972 IB/hfi1: Fix sysfs file offset usage
Two sysfs files do not pay attention to the file offset when
reading data. Fix that.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Jubin John <jubin.john@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:27 -04:00
Jubin John ea0e4ce3bc IB/rdmavt,hfi1,qib: Fix memory leak
rdi->ports has memory allocated in rvt_alloc_device(), but does not get
freed because the hfi1 and qib drivers drivers call ib_dealloc_device()
directly instead of going through rdmavt. Add a rvt_dealloc_device()
that frees rdi->ports and then calls ib_dealloc_device(). Switch hfi1
and qib drivers to calling rvt_dealloc_device() instead of
ib_dealloc_device() directly.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: Brian Welty <brian.welty@intel.com>
Signed-off-by: Jubin John <jubin.john@intel.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:27 -04:00
Mitko Haralanov e88c9271d9 IB/hfi1: Fix buffer cache races which may cause corruption
There are two possible causes for node/memory corruption both
of which are related to the cache eviction algorithm. One way
to cause corruption is due to the asynchronous nature of the
MMU invalidation and the locking used when invalidating node.

The MMU invalidation routine would temporarily release the
RB tree lock to avoid a deadlock. However, this would allow
the eviction function to take the lock resulting in the removal
of cache nodes.

If the node being removed by the eviction code is the same as
the node being invalidated, the result is use after free.

The same is true in the other direction due to the temporary
release of the eviction list lock in the eviction loop.

Another corner case exists when dealing with the SDMA buffer
cache that could cause memory corruption of kernel memory.
The most common way, in which this corruption exhibits itself
is a linked list node corruption. In that case, the kernel will
complain that a node with poisoned pointers is being removed.
The fact that the pointers are already poisoned means that the
node has already been removed from the list.

To root cause of this corruption was a mishandling of the
eviction list maintained by the driver. In order for this
to happen four conditions need to be satisfied:

   1. A node describing a user buffer already exists in the
      interval RB tree,
   2. The beginning of the current user buffer matches that
      node but is bigger. This will cause the node to be
      extended.
   3. The amount of cached buffers is close or at the limit
      of the buffer cache size.
   4. The node has dropped close to the end of the eviction
      list. This will cause the node to be considered for
      eviction.

If all of the above conditions have been satisfied, it is
possible for the eviction algorithm to evict the current node,
which will free the node without the driver knowing.

To solve both issues described above:
   - the locking around the MMU invalidation loop and cache
     eviction loop has been improved so locks are not released in
     the loop body,
   - a new RB function is introduced which will "atomically" find
     and remove the matching node from the RB tree, preventing the
     MMU invalidation loop from touching it, and
   - the node being extended by the pin_vector_pages() function is
     removed from the eviction list prior to calling the eviction
     function.

Reviewed-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Mitko Haralanov <mitko.haralanov@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:26 -04:00
Mitko Haralanov f53af85e47 IB/hfi1: Extract and reinsert MMU RB node on lookup
The page pinning function, which also maintains the pin cache,
behaves one of two ways when an exact buffer match is not found:
  1. If no node is not found (a buffer with the same starting address
     is not found in the cache), a new node is created, the buffer
     pages are pinned, and the node is inserted into the RB tree, or
  2. If a node is found but the buffer in that node is a subset of
     the new user buffer, the node is extended with the new buffer
     pages.

Both modes of operation require (re-)insertion into the interval RB
tree.

When the node being inserted is a new node, the operations are pretty
simple. However, when the node is already existing and is being
extended, special care must be taken.

First, we want to guard against an asynchronous attempt to
delete the node by the MMU invalidation notifier. The simplest way to
do this is to remove the node from the RB tree, preventing the search
algorithm from finding it.

Second, the node needs to be re-inserted so it lands in the proper place
in the tree and the tree is correctly re-balanced. This also requires
the node to be removed from the RB tree.

This commit adds the hfi1_mmu_rb_extract() function, which will search
for a node in the interval RB tree matching an address and length and
remove it from the RB tree if found. This allows for both of the above
special cases be handled in a single step.

Reviewed-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Mitko Haralanov <mitko.haralanov@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:26 -04:00
Mitko Haralanov de79093b28 IB/hfi1: Correctly compute node interval
The computation of the interval of an interval RB node
was incorrect leading to data corruption due to the RB
search algorithm not properly finding the all RB nodes
in an MMU invalidation interval.

The problem stemmed from the fact that the beginning
address of the node's range was being aligned to a page
boundary. For certain buffer sizes, this would lead to
a end address calculation that was off by 1 page.

An important aspect of keeping the RB same is also
updating the node's range in the case it's being extended.

Reviewed-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Mitko Haralanov <mitko.haralanov@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:26 -04:00
Mitko Haralanov 782f6697d2 IB/hfi1: Protect the interval RB tree when cleaning up
The current implementation of the clean up function for
the interval RB trees has two flaws which may cause
problems in cases of concurrent executing of the function
and MMU notifier.

The flaws were due to the fact that deregistration of the
MMU callbacks was done after the tree was emptied and,
furthermore, the tree was not being locked.

This commit fixes both of these flaws by, first, switch the
order of operations, and, second, locking the tree while
traversing it to prevent any other operations.

Reviewed-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Mitko Haralanov <mitko.haralanov@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:26 -04:00
Mitko Haralanov 0ad2d3d05b IB/hfi1: Fix memory leak in user ExpRcv and SDMA
The driver had two memory leaks - one in the user
expected receive code and one in SDMA buffer cache.

The leak in the expected receive code only showed up
when the user/admin had set ulimit sufficiently low
and the driver did not have enough room in the cache
before hitting the limit of allowed cachable memory.

When this condition occurred, the driver returned
early signaling userland that it needed to free some
buffers to free up room in the cache.

The bug was that the driver was not cleaning up
allocated memory prior to returning early.

The leak in the SDMA buffer cache could occur (even
though it never did), when the insertion of a buffer
node in the interval RB tree failed. In this case, the
driver failed to unpin the pages of the node instead
erroneously returning success.

Reviewed-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Mitko Haralanov <mitko.haralanov@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:26 -04:00
Mitko Haralanov 4787bc5e17 IB/hfi1: Don't remove list entries if they are not in a list
The SDMA cache logic maintains an eviction list which is ordered
by most recently used user buffers. Upon errors or buffer freeing,
the list nodes were unconditionally being deleted. This would lead
to list corruption warnings if the nodes were never inserted in the
eviction list to begin with.

This commit prevents this by checking that the nodes are already
part of the eviction list.

Reviewed-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Mitko Haralanov <mitko.haralanov@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:26 -04:00
Mike Marciniszyn 747f4d7a9d IB/qib, IB/hfi1: Fix up UD loopback use of irq flags
The dual lock patch moved locking around and missed an issue
with handling irq flags when processing UD loopback
packets.  This issue was revealed by smatch.

Fix for both qib and hfi1 to pass the saved flags to the UD request
builder and handle the changes correctly.

Fixes: 46a80d62e6 ("IB/qib, staging/rdma/hfi1: add s_hlock for use in post send")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 16:32:26 -04:00
Doug Ledford e29bff46b9 Merge branch 'k.o/for-4.6-rc' into testing/4.6 2016-04-28 15:16:32 -04:00
Jason Gunthorpe e6bd18f57a IB/security: Restrict use of the write() interface
The drivers/infiniband stack uses write() as a replacement for
bi-directional ioctl().  This is not safe. There are ways to
trigger write calls that result in the return structure that
is normally written to user space being shunted off to user
specified kernel memory instead.

For the immediate repair, detect and deny suspicious accesses to
the write API.

For long term, update the user space libraries and the kernel API
to something that doesn't present the same security vulnerabilities
(likely a structured ioctl() interface).

The impacted uAPI interfaces are generally only available if
hardware from drivers/infiniband is installed in the system.

Reported-by: Jann Horn <jann@thejh.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
[ Expanded check to all known write() entry points ]
Cc: stable@vger.kernel.org
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 12:03:16 -04:00
Dean Luick 7723d8c244 IB/hfi1: Use kernel default llseek for ui device
The ui device llseek had a mistake with SEEK_END and did
not fully follow seek semantics.  Correct all this by
using a kernel supplied function for fixed size devices.

Cc: Al Viro <viro@ZenIV.linux.org.uk>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 12:00:39 -04:00
Mitko Haralanov 94158442eb IB/hfi1: Don't attempt to free resources if initialization failed
Attempting to free resources which have not been allocated and
initialized properly led to the following kernel backtrace:

    BUG: unable to handle kernel NULL pointer dereference at           (null)
    IP: [<ffffffffa09658fe>] unlock_exp_tids.isra.8+0x2e/0x120 [hfi1]
    PGD 852a43067 PUD 85d4a6067 PMD 0
    Oops: 0000 [#1] SMP
    CPU: 0 PID: 2831 Comm: osu_bw Tainted: G          IO 3.12.18-wfr+ #1
    task: ffff88085b15b540 ti: ffff8808588fe000 task.ti: ffff8808588fe000
    RIP: 0010:[<ffffffffa09658fe>]  [<ffffffffa09658fe>] unlock_exp_tids.isra.8+0x2e/0x120 [hfi1]
    RSP: 0018:ffff8808588ffde0  EFLAGS: 00010282
    RAX: 0000000000000000 RBX: ffff880858a31800 RCX: 0000000000000000
    RDX: ffff88085d971bc0 RSI: ffff880858a318f8 RDI: ffff880858a318c0
    RBP: ffff8808588ffe20 R08: 0000000000000000 R09: 0000000000000000
    R10: ffff88087ffd6f40 R11: 0000000001100348 R12: ffff880852900000
    R13: ffff880858a318c0 R14: 0000000000000000 R15: ffff88085d971be8
    FS:  00007f4674e83740(0000) GS:ffff88087f400000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000000000 CR3: 000000085c377000 CR4: 00000000001407f0
    Stack:
     ffffffffa0941a71 ffff880858a318f8 ffff88085d971bc0 ffff880858a31800
     ffff880852900000 ffff880858a31800 00000000003ffff7 ffff88085d971bc0
     ffff8808588ffe60 ffffffffa09663fc ffff8808588ffe60 ffff880858a31800
    Call Trace:
     [<ffffffffa0941a71>] ? find_mmu_handler+0x51/0x70 [hfi1]
     [<ffffffffa09663fc>] hfi1_user_exp_rcv_free+0x6c/0x120 [hfi1]
     [<ffffffffa0932809>] hfi1_file_close+0x1a9/0x340 [hfi1]
     [<ffffffff8116c189>] __fput+0xe9/0x270
     [<ffffffff8116c35e>] ____fput+0xe/0x10
     [<ffffffff81065707>] task_work_run+0xa7/0xe0
     [<ffffffff81002969>] do_notify_resume+0x59/0x80
     [<ffffffff814ffc1a>] int_signal+0x12/0x17

This commit re-arranges the context initialization code in a way that
would allow for context event flags to be used to determine whether
the context has been successfully initialized.

In turn, this can be used to skip the resource de-allocation if they
were never allocated in the first place.

Fixes: 3abb33ac65 ("staging/hfi1: Add TID cache receive init and free funcs")
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Mitko Haralanov <mitko.haralanov@intel.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com.
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 12:00:39 -04:00
Mike Marciniszyn b9b06cb6fe IB/hfi1: Fix missing lock/unlock in verbs drain callback
The iowait_sdma_drained() callback lacked locking to
protect the qp s_flags field.

This causes the s_flags to be out of sync
on multiple CPUs, potentially corrupting the s_flags.

Fixes: a545f5308b ("staging/rdma/hfi: fix CQ completion order issue")
Reviewed-by: Sebastian Sanchez <sebastian.sanchez@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 12:00:39 -04:00
Mitko Haralanov 849e3e9398 IB/hfi1: Prevent unpinning of wrong pages
The routine used by the SDMA cache to handle already
cached nodes can extend an already existing node.

In its error handling code, the routine will unpin pages
when not all pages of the buffer extension were pinned.

There was a bug in that part of the routine, which would
mistakenly unpin pages from the original set rather than
the newly pinned pages.

This commit fixes that bug by offsetting the page array
to the proper place pointing at the beginning of the newly
pinned pages.

Reviewed-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Mitko Haralanov <mitko.haralanov@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 12:00:38 -04:00
Mitko Haralanov de82bdff62 IB/hfi1: Fix deadlock caused by locking with wrong scope
The locking around the interval RB tree is designed to prevent
access to the tree while it's being modified. The locking in its
current form is too overzealous, which is causing a deadlock in
certain cases with the following backtrace:

    Kernel panic - not syncing: Watchdog detected hard LOCKUP on cpu 0
    CPU: 0 PID: 5836 Comm: IMB-MPI1 Tainted: G           O 3.12.18-wfr+ #1
     0000000000000000 ffff88087f206c50 ffffffff814f1caa ffffffff817b53f0
     ffff88087f206cc8 ffffffff814ecd56 0000000000000010 ffff88087f206cd8
     ffff88087f206c78 0000000000000000 0000000000000000 0000000000001662
    Call Trace:
     <NMI>  [<ffffffff814f1caa>] dump_stack+0x45/0x56
     [<ffffffff814ecd56>] panic+0xc2/0x1cb
     [<ffffffff810d4370>] ? restart_watchdog_hrtimer+0x50/0x50
     [<ffffffff810d4432>] watchdog_overflow_callback+0xc2/0xd0
     [<ffffffff81109b4e>] __perf_event_overflow+0x8e/0x2b0
     [<ffffffff8110a714>] perf_event_overflow+0x14/0x20
     [<ffffffff8101c906>] intel_pmu_handle_irq+0x1b6/0x390
     [<ffffffff814f927b>] perf_event_nmi_handler+0x2b/0x50
     [<ffffffff814f8ad8>] nmi_handle.isra.3+0x88/0x180
     [<ffffffff814f8d39>] do_nmi+0x169/0x310
     [<ffffffff814f8177>] end_repeat_nmi+0x1e/0x2e
     [<ffffffff81272600>] ? unmap_single+0x30/0x30
     [<ffffffff814f780d>] ? _raw_spin_lock_irqsave+0x2d/0x40
     [<ffffffff814f780d>] ? _raw_spin_lock_irqsave+0x2d/0x40
     [<ffffffff814f780d>] ? _raw_spin_lock_irqsave+0x2d/0x40
     <<EOE>>  <IRQ>  [<ffffffffa056c4a8>] hfi1_mmu_rb_search+0x38/0x70 [hfi1]
     [<ffffffffa05919cb>] user_sdma_free_request+0xcb/0x120 [hfi1]
     [<ffffffffa0593393>] user_sdma_txreq_cb+0x263/0x350 [hfi1]
     [<ffffffffa057fad7>] ? sdma_txclean+0x27/0x1c0 [hfi1]
     [<ffffffffa0593130>] ? user_sdma_send_pkts+0x1710/0x1710 [hfi1]
     [<ffffffffa057fdd6>] sdma_make_progress+0x166/0x480 [hfi1]
     [<ffffffff810762c9>] ? ttwu_do_wakeup+0x19/0xd0
     [<ffffffffa0581c7e>] sdma_engine_interrupt+0x8e/0x100 [hfi1]
     [<ffffffffa0546bdd>] sdma_interrupt+0x5d/0xa0 [hfi1]
     [<ffffffff81097e57>] handle_irq_event_percpu+0x47/0x1d0
     [<ffffffff81098017>] handle_irq_event+0x37/0x60
     [<ffffffff8109aa5f>] handle_edge_irq+0x6f/0x120
     [<ffffffff810044af>] handle_irq+0xbf/0x150
     [<ffffffff8104c9b7>] ? irq_enter+0x17/0x80
     [<ffffffff8150168d>] do_IRQ+0x4d/0xc0
     [<ffffffff814f7c6a>] common_interrupt+0x6a/0x6a
     <EOI>  [<ffffffff81073524>] ? finish_task_switch+0x54/0xe0
     [<ffffffff814f56c6>] __schedule+0x3b6/0x7e0
     [<ffffffff810763a6>] __cond_resched+0x26/0x30
     [<ffffffff814f5eda>] _cond_resched+0x3a/0x50
     [<ffffffff814f4f82>] down_write+0x12/0x30
     [<ffffffffa0591619>] hfi1_release_user_pages+0x69/0x90 [hfi1]
     [<ffffffffa059173a>] sdma_rb_remove+0x9a/0xc0 [hfi1]
     [<ffffffffa056c00d>] __mmu_rb_remove.isra.5+0x5d/0x70 [hfi1]
     [<ffffffffa056c536>] hfi1_mmu_rb_remove+0x56/0x70 [hfi1]
     [<ffffffffa059427b>] hfi1_user_sdma_process_request+0x74b/0x1160 [hfi1]
     [<ffffffffa055c763>] hfi1_aio_write+0xc3/0x100 [hfi1]
     [<ffffffff8116a14c>] do_sync_readv_writev+0x4c/0x80
     [<ffffffff8116b58b>] do_readv_writev+0xbb/0x230
     [<ffffffff811a9da1>] ? fsnotify+0x241/0x320
     [<ffffffff81073524>] ? finish_task_switch+0x54/0xe0
     [<ffffffff8116b795>] vfs_writev+0x35/0x60
     [<ffffffff8116b8c9>] SyS_writev+0x49/0xc0
     [<ffffffff810cd876>] ? __audit_syscall_exit+0x1f6/0x2a0
     [<ffffffff814ff992>] system_call_fastpath+0x16/0x1b

As evident from the backtrace above, the process was being put to sleep
while holding the lock.

Limiting the scope of the lock only to the RB tree operation fixes the
above error allowing for proper locking and the process being put to
sleep when needed.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Mitko Haralanov <mitko.haralanov@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 12:00:38 -04:00
Mitko Haralanov f19bd643db IB/hfi1: Prevent NULL pointer deferences in caching code
There is a potential kernel crash when the MMU notifier calls the
invalidation routines in the hfi1 pinned page caching code for sdma.

The invalidation routine could call the remove callback
for the node, which in turn ends up dereferencing the
current task_struct to get a pointer to the mm_struct.
However, the mm_struct pointer could be NULL resulting in
the following backtrace:

    BUG: unable to handle kernel NULL pointer dereference at 00000000000000a8
    IP: [<ffffffffa041f75a>] sdma_rb_remove+0xaa/0x100 [hfi1]
    15
    task: ffff88085e66e080 ti: ffff88085c244000 task.ti: ffff88085c244000
    RIP: 0010:[<ffffffffa041f75a>]  [<ffffffffa041f75a>] sdma_rb_remove+0xaa/0x100 [hfi1]
    RSP: 0000:ffff88085c245878  EFLAGS: 00010002
    RAX: 0000000000000000 RBX: ffff88105b9bbd40 RCX: ffffea003931a830
    RDX: 0000000000000004 RSI: ffff88105754a9c0 RDI: ffff88105754a9c0
    RBP: ffff88085c245890 R08: ffff88105b9bbd70 R09: 00000000fffffffb
    R10: ffff88105b9bbd58 R11: 0000000000000013 R12: ffff88105754a9c0
    R13: 0000000000000001 R14: 0000000000000001 R15: ffff88105b9bbd40
    FS:  0000000000000000(0000) GS:ffff88107ef40000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00000000000000a8 CR3: 0000000001a0b000 CR4: 00000000001407e0
    Stack:
     ffff88105b9bbd40 ffff88080ec481a8 ffff88080ec481b8 ffff88085c2458c0
     ffffffffa03fa00e ffff88080ec48190 ffff88080ed9cd00 0000000001024000
     0000000000000000 ffff88085c245920 ffffffffa03fa0e7 0000000000000282
    Call Trace:
     [<ffffffffa03fa00e>] __mmu_rb_remove.isra.5+0x5e/0x70 [hfi1]
     [<ffffffffa03fa0e7>] mmu_notifier_mem_invalidate+0xc7/0xf0 [hfi1]
     [<ffffffffa03fa143>] mmu_notifier_page+0x13/0x20 [hfi1]
     [<ffffffff81156dd0>] __mmu_notifier_invalidate_page+0x50/0x70
     [<ffffffff81140bbb>] try_to_unmap_one+0x20b/0x470
     [<ffffffff81141ee7>] try_to_unmap_anon+0xa7/0x120
     [<ffffffff81141fad>] try_to_unmap+0x4d/0x60
     [<ffffffff8111fd7b>] shrink_page_list+0x2eb/0x9d0
     [<ffffffff81120ab3>] shrink_inactive_list+0x243/0x490
     [<ffffffff81121491>] shrink_lruvec+0x4c1/0x640
     [<ffffffff81121641>] shrink_zone+0x31/0x100
     [<ffffffff81121b0f>] kswapd_shrink_zone.constprop.62+0xef/0x1c0
     [<ffffffff811229e3>] kswapd+0x403/0x7e0
     [<ffffffff811225e0>] ? shrink_all_memory+0xf0/0xf0
     [<ffffffff81068ac0>] kthread+0xc0/0xd0
     [<ffffffff81068a00>] ? insert_kthread_work+0x40/0x40
     [<ffffffff814ff8ec>] ret_from_fork+0x7c/0xb0
     [<ffffffff81068a00>] ? insert_kthread_work+0x40/0x40

To correct this, the mm_struct passed to us by the MMU notifier is
used (which is what should have been done to begin with). This avoids
the broken derefences and ensures that the correct mm_struct is used.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Mitko Haralanov <mitko.haralanov@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-04-28 12:00:38 -04:00
Iban Rodriguez 610cc3a49f Staging: lustre: Make lustre_profile_list static
Variable lustre_profile_list is only used inside obd_config.c,
better make it static

Signed-off-by: Iban Rodriguez <iban.rodriguez@ono.com>
Acked-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-26 15:13:13 -07:00
John L. Hammond abe958236f staging: lustre: hsm: don't use real suppgid
In the MDC HSM handlers that do not pack a real suppgid, use -1 rather
than 0 for the suppgid in mdt_body.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3866
Reviewed-on: http://review.whamcloud.com/7565
Reviewed-by: Aurelien Degremont <aurelien.degremont@cea.fr>
Reviewed-by: Faccini Bruno <bruno.faccini@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-26 15:13:13 -07:00
John L. Hammond 1cc28b7779 staging: lustre: hsm: permission checks for HSM ioctl operations
In the LL_IOC_HSM_CT_START case of ll_dir_ioctl() require
CAP_SYS_ADMIN, since the local handler for this ioctl may modify the
global KUC table.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3866
Reviewed-on: http://review.whamcloud.com/7565
Reviewed-by: Aurelien Degremont <aurelien.degremont@cea.fr>
Reviewed-by: Faccini Bruno <bruno.faccini@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-26 15:13:13 -07:00
Andriy Skulysh 554f0724af staging: lustre: lov: Don't wait for active target with OBD_STATFS_NODELAY
Patch for LU-631 which was landed before the upstream merge broke
OBD_STATFS_NODELAY behaviour. It adds unnecessary delay while
running df command with inactive OSTs. We shouldn't try to recover
connection to OST in this case.

Signed-off-by: Andriy Skulysh <Andriy_Skulysh@xyratex.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4010
Reviewed-on: http://review.whamcloud.com/7762
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-26 15:13:13 -07:00
Bruno Faccini ad1daf47c9 staging: lustre: lov: return minimal FIEMAP for released files
Since st_blocks = NULL is returned for released files, FIEMAP
should at least return a minimal mapping to make users aware
that file contains data but it is not immediately available.
This will make coreutils and tools such tar happy and have
them presume file is sparse.

Also, add a new test_228 in sanity-hsm to verify it works
for "[cp,tar] --sparse" commands.

Also fix a LBUG ("lov_fiemap()) ASSERTION( fm_local ) failed")
likely to occur when no-object/ENOMEM conditions and also now
when released.

Signed-off-by: Bruno Faccini <bruno.faccini@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3864
Reviewed-on: http://review.whamcloud.com/7584
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Aurelien Degremont <aurelien.degremont@cea.fr>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-26 15:13:13 -07:00
Andrew Perepechko b3ffe666ca staging: lustre: lprocfs: implement log2 using bitops
This patch implements log2 using fls.

Signed-off-by: Andrew Perepechko <andrew_perepechko@xyratex.com>
Reviewed-by: Alexander Boyko <Alexander_Boyko@xyratex.com>
Reviewed-by: alexander_zarochentsev@xyratex.com
Reviewed-by: Vitaly Fertman <Vitaly_Fertman@xyratex.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3496
Xyratex-bug-id: MRP-999
Reviewed-on: http://review.whamcloud.com/6757
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-26 15:13:13 -07:00
Jinshan Xiong b59d812d00 staging: lustre: osc: osc_extent_wait() shouldn't be interruptible
Otherwise it will hit the assertion at cl_lock.c:

 cl_lock.c:1967:discard_cb())
  ASSERTION( (!(page->cp_type == CPT_CACHEABLE) ||
  (!PageWriteback(cl_page_vmpage(env, page)))) ) failed:

This is because in osc_lock_flush() we have to make sure the IO
is finished before discarding the pages.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2779
Reviewed-on: http://review.whamcloud.com/5419
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-26 15:13:13 -07:00
Jinshan Xiong 1b1594da71 staging: lustre: llite: Truncate to restore file
Truncate up is safe so it won't trigger restore.

Copy optimization for truncate down - only copy the part under
truncate length. If a file is truncated to zero usually it'll be
followed by write so I choose to restore the file and set correct
stripe information.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3817
Reviewed-on: http://review.whamcloud.com/7505
Reviewed-by: jacques-Charles Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Reviewed-by: Henri Doreau <henri.doreau@cea.fr>
Reviewed-by: Aurelien Degremont <aurelien.degremont@cea.fr>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-26 15:13:13 -07:00
Swapnil Pimpale cc3b775896 staging: lustre: ptlrpc: return a meaningful status from ptlrpcd_init()
This patch has the following:
1) Fix for the return value from ptlrpcd_init(). It will now return a
   correct status instead of returning zero always.
2) ptlrpcd_addref() should not increment ptlrpcd_users on error.
3) Added code in a mdc_setup() and mgc_setup() to test the return
   value of ptlrpcd_addref() and return on error.

Signed-off-by: Swapnil Pimpale <spimpale@ddn.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3808
Reviewed-on: http://review.whamcloud.com/7522
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-26 15:13:13 -07:00
Bobi Jam 489d82fcd8 staging: lustre: obd: MDT mount fails on MDS w/o MGS on it
If we specify multiple --mgsnode for a MDT, when we start MDS upon
it while MGS is no the other node, the MGC import connection will
always select the local nid (which is one of the candidate mgsnode)
since it think its the closest connection.

This patch treats further --mgsnode nids as failover nids, so that
multiple import connections are added for the MGC import.

Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3829
Reviewed-on: http://review.whamcloud.com/7509
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-26 15:13:13 -07:00
Jinshan Xiong 32cc01c42f staging: lustre: llite: error setting max_cache_mb at mount time
The root cause is that when max_cache_mb conf parameter is applied,
the client isn't connected to the OST yet so that sbi->ll_dt_exp is
NULL. However, it's not necessary to shrink the cache memory in this
case so success should be returned.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3676
Reviewed-on: http://review.whamcloud.com/7194
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-26 15:13:13 -07:00
Andrew Perepechko 3c4b9d0972 staging: lustre: llite: speedup in unlink/rmdir
Assume dchild argument is fully initialized in ->unlink and
->rmdir callbacks, so additional lookup for ELC is not needed.

Signed-off-by: Andrew Perepechko <andrew_perepechko@xyratex.com>
Reviewed-by: Alexander Boyko <Alexander_Boyko@xyratex.com>
Reviewed-by: Vitaly Fertman <Vitaly_Fertman@xyratex.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3473
Xyratex-bug-id: MRP-1027
Reviewed-on: http://review.whamcloud.com/6648
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-26 15:13:13 -07:00
Andrew Perepechko 96d61c247e staging: lustre: llite: variable rename in namei.c
With the patch 6648 a fee variables were renamed. We do these
renames in broken out patch to the fix obvious.

Signed-off-by: Andrew Perepechko <andrew_perepechko@xyratex.com>
Reviewed-by: Alexander Boyko <Alexander_Boyko@xyratex.com>
Reviewed-by: Vitaly Fertman <Vitaly_Fertman@xyratex.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3473
Xyratex-bug-id: MRP-1027
Reviewed-on: http://review.whamcloud.com/6648
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-26 15:13:13 -07:00
Bruno Faccini e9ada6fa3c staging: lustre: ldlm: refine LU-2665 patch for POSIX compliance
Follow-on to patch introduced to fix LU-2665 ticket (Gerrit
Change at http://review.whamcloud.com/6415 with Change-Id:
I8faa331712abeadee46eabe111ee1c23a05840d5).
Original patch introduced regressions against POSIX test suite
(fcntl.18/fcntl.35 tests in LSB-VSX POSIX test suite at
http://www.opengroup.org/testing/linux-test/lsb-vsx.html),
so the idea is to only resend F_UNLCKs to have both LU-2665 bug
and POSIX test suite happy.

Signed-off-by: Bruno Faccini <bruno.faccini@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3701
Reviewed-on: http://review.whamcloud.com/7453
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-26 15:13:13 -07:00
Bruno Faccini 7e74e54f08 staging: lustre: ldlm: Fix a race during FLock handling
Protect against race where lock could have been just destroyed
due to overlap, in ldlm_process_flock_lock().
Easy reproducer is BULL's NFS Locktests in pthread mode.
(http://nfsv4.bullopensource.org/tools/tests/locktest.php)

Signed-off-by: Bruno Faccini <bruno.faccini@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1126
Reviewed-on: http://review.whamcloud.com/7134
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-26 15:13:13 -07:00
Niu Yawei 800548b1b1 staging: lustre: clio: incorrect assertions in 'enable-invariants'
Fixed several incorrect assumptions in 'enable-invariants'.

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3521
Reviewed-on: http://review.whamcloud.com/6832
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-26 15:13:13 -07:00
Sebastien Buisson 82281bc0c3 staging: lustre: osc: fix race issues thanks to oap_lock
Fix 'data race condition' defects found by Coverity version 6.5.0:

Data race condition (MISSING_LOCK)

Accessing variable without holding lock. Elsewhere,
this variable is accessed with lock held.

This patch is dedicated to code fragments involving oap_lock.

Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2744
Reviewed-on: http://review.whamcloud.com/6572
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-26 15:13:13 -07:00
Bobi Jam 06d2fccd6b staging/lustre/llite: suppress non active IO error message
Current CLIO does not support fadvise, suppress the error message.

Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Reviewed-on: http://review.whamcloud.com/9658
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4717
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-26 15:13:13 -07:00
Oleg Drokin 6a65147194 staging/lustre: Fix blank line after/before {/} style
This patch fixes all checkpatch occurences of
CHECK: Blank lines aren't necessary after an open brace '{'
CHECK: Blank lines aren't necessary before a close brace '}'
in Lustre code.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-26 15:13:13 -07:00
Aleksei Fedotov abcdb1e471 staging: lustre: libcfs: Fix libcfs_ioctl() prototype.
Fix libcfs_ioctl() prototype according to its definition in
libcfs/module.c.

Signed-off-by: Aleksei Fedotov <lexa@cfotr.com>
Acked-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-26 15:11:09 -07:00
James Simmons 45d2f4fb5a staging: lustre: selftest: convert wire protocol to use struct
Change all the wire protocol typedefs to proper structures

Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-26 15:11:09 -07:00