dpdk.git
8 years agovfio: move global config out of PCI files
Jan Viktorin [Mon, 4 Jul 2016 15:16:46 +0000 (17:16 +0200)]
vfio: move global config out of PCI files

The vfio_cfg is a module-global variable and so together with this
variable, it is necessary to move functions:

* pci_vfio_get_group_fd
  - renamed to vfio_get_group_fd
  - pci_* version removed (no other call in EAL)

* pci_vfio_setup_device
  - renamed as vfio_setup_device

* pci_vfio_enable
  - renamed as vfio_enable
  - generalized to check for a specific vfio driver presence
  - pci_* specialization preserved as a wrapper

* pci_vfio_is_enabled
  - renamed as vfio_is_enabled
  - generalized to check for a specific vfio driver presence
    to preserve the semantics of VFIO + PCI
  - pci_* specialization preserved as a wrapper

* clear_current_group
  - private function, just moved

To stop GCC complaining about "defined but not used", the private
function pci_vfio_get_group_no has been removed entirely.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
8 years agovfio: extract setup logic out of resource mapping
Jan Viktorin [Mon, 4 Jul 2016 15:16:45 +0000 (17:16 +0200)]
vfio: extract setup logic out of resource mapping

The setup logic access the global vfio_cfg variable that will be moved in the
following commits. We need to separate all accesses to this variable to a
general code.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
8 years agovfio: generalize non PCI-specific functions
Jan Viktorin [Mon, 4 Jul 2016 15:16:40 +0000 (17:16 +0200)]
vfio: generalize non PCI-specific functions

The pci_vfio_set_iommu_type is not PCI-specific and it is a private function
of the eal_pci_vfio.c. We just rename the function and make it available even
for non-PCI devices.

The pci_vfio_has_supported_extensions is not PCI-specific and it is a private
function of the eal_pci_vfio.c. We just rename the function and make it
available even for non-PCI devices.

The pci_vfio_get_container_fd is not PCI-specific. Move the implementation to
the eal_vfio.c as vfio_get_container_fd. No other code seems to call this
function.

Generalize the pci_vfio_get_group_no to not be PCI-specific. Move the general
implementation to the eal_vfio.c as vfio_get_group_no and leave the original
pci_vfio_get_group_no being a wrapper around this to preserve compilation
issues. The pci_vfio_get_group_no function will be removed later.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
8 years agovfio: move common code out of PCI file
Jan Viktorin [Mon, 4 Jul 2016 15:16:39 +0000 (17:16 +0200)]
vfio: move common code out of PCI file

We make the iommu_types public temporarily here until the depending stuff is
refactored. The iommu_types and dma_map functions will be changed to be private
inside the eal_vfio module later.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
8 years agovfio: move definitions from PCI to VFIO header
Jan Viktorin [Mon, 4 Jul 2016 15:16:37 +0000 (17:16 +0200)]
vfio: move definitions from PCI to VFIO header

The common VFIO definitions should be separated from the PCI-specific parts.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
8 years agovfio: fix private include to be local
Jan Viktorin [Mon, 4 Jul 2016 15:16:36 +0000 (17:16 +0200)]
vfio: fix private include to be local

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
8 years agonet/virtio: fix 32-bit build with gcc 6
Ferruh Yigit [Thu, 7 Jul 2016 13:49:08 +0000 (14:49 +0100)]
net/virtio: fix 32-bit build with gcc 6

This is for target i686-native-linuxapp-gcc and gcc6,

Compilation error is:

In file included from
  include/rte_mempool.h:77:0, from
  drivers/net/virtio/virtio_rxtx_simple.c:
In function `virtio_xmit_pkts_simple':
  include/rte_memcpy.h:551:2: error:
    array subscript is above array bounds
      rte_mov16((uint8_t *)dst + 1 * 16, (const uint8_t *)src + 1 * 16);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Call stack is as following:

virtio_xmit_pkts_simple
  virtio_xmit_cleanup
    rte_mempool_put_bulk
      rte_mempool_generic_put
        __mempool_generic_put
  rte_memcpy

The array used as source buffer in virtio_xmit_cleanup (free) is a
pointer array with 32 elements, in 32bit this makes 128 bytes.

in rte_memcpy() implementation, there a code piece as following:
if (size > 256) {
    rte_move128(...);
    rte_move128(...); <--- [1]
    ....
}

The compiler traces the array all through the call stack and knows the
size of array is 128 and generates a warning on above [1] which tries to
access beyond byte 128.
But unfortunately it ignores the "(size > 256)" check.

Giving a hint to compiler that variable "size" is related to the size of
the source buffer fixes compiler warning.

Fixes: 863bfb474493 ("mempool: optimize copy in cache")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/vhost: fix queue state not reset on destroy
Rich Lane [Fri, 1 Jul 2016 16:31:12 +0000 (09:31 -0700)]
net/vhost: fix queue state not reset on destroy

Fixes a bug where rte_eth_vhost_get_queue_event would not return enabled
queues after a guest application restart.

Fixes: ee584e9710b9 ("vhost: add driver on top of the library")

Signed-off-by: Rich Lane <rich.lane@bigswitch.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agoexamples/vhost: print error logs on failure
Jianfeng Tan [Fri, 1 Jul 2016 08:50:31 +0000 (08:50 +0000)]
examples/vhost: print error logs on failure

When the specified cores and memory lie on different NUMA socket with
physical NIC, vhost fails to set up Rx queue, and exits without any
hints. This could leads to confusion of users.

This patch fixes it by adding some error messages when calling ether
APIs returns errors.

Suggested-by: Yulong Pei <yulong.pei@intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/virtio: fix null pointer dereference
Jianfeng Tan [Tue, 5 Jul 2016 11:42:59 +0000 (11:42 +0000)]
net/virtio: fix null pointer dereference

There is a logic bug in this code, that could lead to null pointer
dereference when cvq is NULL. Fix this problem by changing logic
&& to logic ||.

   >> CID 127480:  Null pointer dereferences  (FORWARD_NULL)
   >> Dereferencing null pointer "cvq".
    if (!cvq && !cvq->vq) {
            ...
        }

Coverity issue: 127480
Fixes: 01ad44fd374f ("net/virtio: split Rx/Tx queue")

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agodoc: explain virtio Rx/Tx functions
Zhihong Wang [Fri, 1 Jul 2016 03:28:01 +0000 (23:28 -0400)]
doc: explain virtio Rx/Tx functions

This patch explains current virtio PMD Rx/Tx callbacks, to help understand
what's the difference, and how to enable the right ones.

Signed-off-by: Zhihong Wang <zhihong.wang@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/virtio-user: fix string unterminated
Jianfeng Tan [Wed, 29 Jun 2016 09:05:36 +0000 (09:05 +0000)]
net/virtio-user: fix string unterminated

When use strcpy() to copy string with length exceeding the last
parameter of strcpy(), it may lead to the destination string
unterminated.

We replaced strncpy with snprintf to make sure it's NULL terminated.

Coverity issue: 127476
Fixes: ce2eabdd43ec ("net/virtio-user: add virtual device")

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/virtio-user: fix resource leaks
Jianfeng Tan [Wed, 29 Jun 2016 09:05:35 +0000 (09:05 +0000)]
net/virtio-user: fix resource leaks

The return value by rte_kvargs_parse is not free(d), which leads
to memory leak.

Coverity issue: 127482
Fixes: ce2eabdd43ec ("net/virtio-user: add virtual device")

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/virtio-user: fix string overflow
Jianfeng Tan [Wed, 29 Jun 2016 09:05:34 +0000 (09:05 +0000)]
net/virtio-user: fix string overflow

When parsing /proc/self/maps to get hugepage information, the string
was being copied with strcpy(), which could, theoretically but in fact
not possiblly, overflow the destination buffer. Anyway, to avoid the
false alarm, we replaced strncpy with snprintf for safely copying the
strings.

Coverity issue: 127484
Fixes: 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer")

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/virtio-user: fix return value not checked
Jianfeng Tan [Wed, 29 Jun 2016 09:05:33 +0000 (09:05 +0000)]
net/virtio-user: fix return value not checked

When return values of function calls are not checked, Coverity will
report errors like:

    if (rte_kvargs_count(kvlist, VIRTIO_USER_ARG_PATH) == 1)
    >>>     CID 127477:    (CHECKED_RETURN)
    >>>     Calling "rte_kvargs_process" without checking return value
            (as is done elsewhere 25 out of 30 times).
          rte_kvargs_process(kvlist, VIRTIO_USER_ARG_PATH,
             &get_string_arg, &path);

Coverity issue: 127477, 127478
Fixes: ce2eabdd43ec ("net/virtio-user: add virtual device")
Fixes: 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer")

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/virtio-user: fix build on Suse 11
Jianfeng Tan [Wed, 29 Jun 2016 03:23:03 +0000 (03:23 +0000)]
net/virtio-user: fix build on Suse 11

On some older systems, such as SUSE 11, the compiling error shows
as:
   .../dpdk/drivers/net/virtio/virtio_user/virtio_user_dev.c:67:22:
         error: ‘O_CLOEXEC’ undeclared (first use in this function)

The fix is to use EFD_CLOEXEC, which is defined in sys/eventfd.h,
instead of O_CLOEXEC which needs _GNU_SOURCE defined on some old
systems.

Fixes: 37a7eb2ae816 ("net/virtio-user: add device emulation layer")

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/virtio-user: fix missing default config value
Jianfeng Tan [Wed, 29 Jun 2016 03:20:06 +0000 (03:20 +0000)]
net/virtio-user: fix missing default config value

With current config structure, all configuration parameters put into
common_base with a default value, and overwritten in environment file
if required, CONFIG_RTE_VIRTIO_USER is missing in common_base.

This fix is simple, by adding CONFIG_RTE_VIRTIO_USER=n as the default
macro value.

Fixes: ce2eabdd43ec ("net/virtio-user: add virtual device")

Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agovhost: fix potential null pointer dereference
Yuanhan Liu [Tue, 28 Jun 2016 03:58:31 +0000 (11:58 +0800)]
vhost: fix potential null pointer dereference

Fix the potential NULL pointer dereference issue raised by Coverity.

    578             reconn = malloc(sizeof(*reconn));
    >>>     CID 127481:  Null pointer dereferences  (NULL_RETURNS)
    >>>     Dereferencing a null pointer "reconn".
    579             reconn->un = un;

Coverity issue: 127481
Fixes: e623e0c6d8a5 ("vhost: add reconnect ability")

Reported-by: John McNamara <john.mcnamara@intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agovhost: fix not null terminated string
Yuanhan Liu [Tue, 28 Jun 2016 03:58:30 +0000 (11:58 +0800)]
vhost: fix not null terminated string

Fix an issue raised by Coverity.

    >>>     CID 127475:  Memory - illegal accesses  (BUFFER_SIZE_WARNING)
    >>>     Calling strncpy with a maximum size argument of 108 bytes on
    >>>     destination array "un->sun_path" of size 108 bytes might leave
    >>>     the destination string unterminated.
    441             strncpy(un->sun_path, path, sizeof(un->sun_path));
    442
    443             return fd;
    444     }

Coverity issue: 127475
Fixes: 64ab701c3d1e ("vhost: add vhost-user client mode")

Reported-by: John McNamara <john.mcnamara@intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agovhost: fix memory leak
Yuanhan Liu [Tue, 28 Jun 2016 03:58:29 +0000 (11:58 +0800)]
vhost: fix memory leak

Fix potential memory leak raised by Coverity.

    >>>     Variable "vsocket" going out of scope leaks the storage it
    >>>     points to.

Coverity issue: 127483
Fixes: e623e0c6d8a5 ("vhost: add reconnect ability")

Reported-by: John McNamara <john.mcnamara@intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/ena: fix unneeded doorbell submission
Jan Medala [Fri, 8 Jul 2016 11:11:30 +0000 (13:11 +0200)]
net/ena: fix unneeded doorbell submission

Avoid submitting doorbell when:
* no packets have been submitted to TX
* no free resources have been submitted while RX

Sending doorbell without actual work to be performed by device
violates ENA specification and can lead to unpredictable behavior.

Fixes: 1173fca25af9 ("ena: add polling-mode driver")

Signed-off-by: Alexander Matushevsky <matua@amazon.com>
Signed-off-by: Jan Medala <jan@semihalf.com>
8 years agonet/enic: fix removing old MAC address when setting new one
Nelson Escobar [Fri, 8 Jul 2016 01:11:08 +0000 (18:11 -0700)]
net/enic: fix removing old MAC address when setting new one

enic_set_mac_address() meant to remove the old MAC address before
setting the new one, but accidentally tried removing the new MAC
address before setting the new MAC address.

Fixes: fefed3d1e62c ("enic: new driver")

Signed-off-by: Nelson Escobar <neescoba@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
8 years agonet/enic: fix setting MAC address when a port is restarted
Nelson Escobar [Fri, 8 Jul 2016 01:10:21 +0000 (18:10 -0700)]
net/enic: fix setting MAC address when a port is restarted

enic_disable() removed the MAC address when a port was shut down but
enic_enable() didn't add the MAC address back when the port was
started again. Move where we set the MAC address for the adapter from
enic_setup_finish() to a enic_enable() so that port restarting works
properly.

Fixes: fefed3d1e62c ("enic: new driver")

Signed-off-by: Nelson Escobar <neescoba@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
8 years agonet/bnx2x: add xstats
Rasesh Mody [Thu, 7 Jul 2016 22:50:39 +0000 (15:50 -0700)]
net/bnx2x: add xstats

This patch adds support for extended statistics for BNX2X PMD.

Signed-off-by: Rasesh Mody <rasesh.mody@qlogic.com>
Acked-by: Remy Horton <remy.horton@intel.com>
8 years agonet/qede: add xstats
Rasesh Mody [Thu, 7 Jul 2016 22:50:38 +0000 (15:50 -0700)]
net/qede: add xstats

This patch adds support for extended statistics for QEDE PMD.

Signed-off-by: Rasesh Mody <rasesh.mody@qlogic.com>
Acked-by: Remy Horton <remy.horton@intel.com>
8 years agonet/mlx5: fix crash in Rx
Nélio Laranjeiro [Fri, 8 Jul 2016 12:43:26 +0000 (14:43 +0200)]
net/mlx5: fix crash in Rx

Fixed issue could occur when Mbuf starvation happens in a middle of
reception of a segmented packet. In such a situation, the PMD has to
release all segments of that packet.  The end condition was wrong
causing it to free an Mbuf still handled by the NIC.

Fixes: 9964b965ad69 ("net/mlx5: re-add Rx scatter support")

Reported-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
8 years agonet/mlx5: fix packet type and offload flags on Rx
Maxime Leroy [Thu, 7 Jul 2016 16:34:45 +0000 (18:34 +0200)]
net/mlx5: fix packet type and offload flags on Rx

In mlx5 rx function, the packet_type and ol_flags mbuf fields are not
properly initialized when no rx offload feature is enabled (checksum, l2
tun checksum, vlan_strip, crc). Thus, these fields can have a value
different of 0 depending on their value when the mbuf was freed.

This can result in an incorrect application behavior if invalid
ol_flags/ptype are set, or memory corruptions if IND_ATTACHED_MBUF is
set in ol_flags.

Fixes: 081f7eae242e ("mlx5: process offload flags only when requested")

Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
8 years agonet/enic: fix resource check failures when bonding devices
Nelson Escobar [Wed, 6 Jul 2016 23:21:59 +0000 (16:21 -0700)]
net/enic: fix resource check failures when bonding devices

The enic PMD was using the same variables in the enic structure to
track two different things.  Initially rq_count, wq_count, cq_count,
and intr_count were set to the values obtained from the VIC adapters
as the maximum resources allocated on the VIC, then in
enic_set_vnic_res(), they were set to the counts of resources actually
used, discarding the initial values. The checks in enic_set_vnic_res()
were technically incorrect if it is called more than once on a port,
which happens when using bonding, but were harmless in practice as the
checks couldn't fail on the second call.

The enic rx-scatter patch misunderstood the subtleties of
enic_set_vnic_res(), and naively added a multiply by two to the
rq_count check. This resulted in the rq_count check failing when
enic_set_vnic_res() was called a second time, ie when using bonding.

This patch adds new variables to the enic structure to track the
maximum resources the VIC is configured to provide so that the
information isn't later lost and calls to enic_set_vnic_res() do
the expected thing.

Fixes: 856d7ba7ed22 ("net/enic: support scattered Rx")

Signed-off-by: Nelson Escobar <neescoba@cisco.com>
8 years agodoc: update Linux guide for i40e firmware version
Ian Stokes [Wed, 6 Jul 2016 10:29:31 +0000 (11:29 +0100)]
doc: update Linux guide for i40e firmware version

Update the 'High Performance of Small Packets on 40G NIC' section of the
Getting Started Guide (GSG) as the firmware version referenced for a NIC
using the i40e driver was version 4.2.5 which is no longer validated.
Instruct users to consult release notes for current validated firmware
versions.

Signed-off-by: Ian Stokes <ian.stokes@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agonet/i40e: fix out-of-bounds access
Beilei Xing [Tue, 5 Jul 2016 06:10:05 +0000 (14:10 +0800)]
net/i40e: fix out-of-bounds access

When calling i40e_flowtype_to_pctype in i40e_get_hash_filter_global_config
and i40e_set_hash_filter_global_config, function i40e_flowtype_to_pctype
will be possibly make an out-of-bounds access, because size of the array
is 15. So check the flow type is valid before calling
i40e_flowtype_to_pctype.
In the process fix other occurances of the same problem

Coverity issue: 37793, 37794
Fixes: 782c8c92f13f ("i40e: add hash configuration")
Fixes: f2b2e2354bbd ("i40e: split function for hash and flow director input")
Fixes: 98f055707685 ("i40e: configure input fields for RSS or flow director")

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agonet/i40e: fix dereference before null check
Beilei Xing [Tue, 5 Jul 2016 06:10:04 +0000 (14:10 +0800)]
net/i40e: fix dereference before null check

Null-checking vsi suggests that it may be null, but it
has been dereferenced before null-checking. So move the
check to before the assignment statement using the pointer.

Coverity issue: 119265, 119266
Fixes: d0a349409bd7 ("i40e: support AQ based RSS config")
Fixes: 647d1eaf758b ("i40evf: support AQ based RSS config")

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agonet/i40e: fix log error
Beilei Xing [Tue, 5 Jul 2016 06:10:03 +0000 (14:10 +0800)]
net/i40e: fix log error

The condition, "(pf->flags | I40E_FLAG_VMDQ)" will always be true,
regardless of the value of the flags operand, because I40E_FLAG_VMDQ
is 4ULL - meaning at least one bit will always be set in the result.
That will cause log error when VMDq is disabled.
Since the original intent behind the condition is to check if VMDq
is enabled, fix the code by changing "|" to "&".

Coverity issue: 13219, 13221
Fixes: 4805ed59e957 ("i40e: enhance mac address operations")

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agonet/bnxt: fix broadcast/multicast Rx
Ajit Khaparde [Mon, 4 Jul 2016 18:52:04 +0000 (13:52 -0500)]
net/bnxt: fix broadcast/multicast Rx

Currently we are wrongly setting HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_MCAST
flag in bnxt_hwrm_cfa_l2_set_rx_mask() which is preventing promiscuous
and multicast promiscuous settings from working correctly.
This patch fixes it.

Fixes: 244bc98b0da7 ("net/bnxt: set L2 Rx mask")

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
8 years agonet/ena: fix freeing memory using correct API
Jan Medala [Thu, 30 Jun 2016 15:04:58 +0000 (17:04 +0200)]
net/ena: fix freeing memory using correct API

Memory zones should be freed using the proper memzone_free function not
rte_free which is for malloc calls.
After allocating memzone it's required to zeroize memory in it, so do so
before storing the handle for later freeing.

Fixes: 9ba7981ec992 ("ena: add communication layer for DPDK")

Signed-off-by: Alexander Matushevsky <matua@amazon.com>
Signed-off-by: Jakub Palider <jpa@semihalf.com>
Signed-off-by: Jan Medala <jan@semihalf.com>
8 years agonet/ena: make coherent memory allocation NUMA-aware
Jan Medala [Thu, 30 Jun 2016 15:04:57 +0000 (17:04 +0200)]
net/ena: make coherent memory allocation NUMA-aware

While allocating (coherent) memory, get information about calling node Id
and pass that as parameter when reserving a memzone.

Signed-off-by: Alexander Matushevsky <matua@amazon.com>
Signed-off-by: Jakub Palider <jpa@semihalf.com>
Signed-off-by: Jan Medala <jan@semihalf.com>
8 years agonet/ena: disable readless communication when no HW support
Jan Medala [Thu, 30 Jun 2016 15:04:56 +0000 (17:04 +0200)]
net/ena: disable readless communication when no HW support

Depending on HW revision readless communcation between host and device
may be unavailable. In that case prevent PMD from setting up readless
communication mechanism.

"readless" refers to ability to read ENA registers without actually
issuing read request from host (x86). Instead, host programs 2 registers
on the device that triggers a DMA from device to host and reports a
register value. However, this functionality is not going to be available
in all types of devices. The decision if this mode is supported or not,
is taken from revision_id in pci configuration space.

Signed-off-by: Alexander Matushevsky <matua@amazon.com>
Signed-off-by: Jakub Palider <jpa@semihalf.com>
Signed-off-by: Jan Medala <jan@semihalf.com>
8 years agonet/ena: add dedicated memory area for extra device info
Jan Medala [Thu, 30 Jun 2016 15:04:55 +0000 (17:04 +0200)]
net/ena: add dedicated memory area for extra device info

Increase maintenance and debug potentiality with dedicated areas of memory
where additional information can be stored by the ENA device.

Signed-off-by: Alexander Matushevsky <matua@amazon.com>
Signed-off-by: Jakub Palider <jpa@semihalf.com>
Signed-off-by: Jan Medala <jan@semihalf.com>
8 years agonet/ena: update ENA comms layer for latest FW
Jan Medala [Thu, 30 Jun 2016 15:04:54 +0000 (17:04 +0200)]
net/ena: update ENA comms layer for latest FW

Synchronize ENA communication layer with latest ENA FW version.

Signed-off-by: Alexander Matushevsky <matua@amazon.com>
Signed-off-by: Jakub Palider <jpa@semihalf.com>
Signed-off-by: Jan Medala <jan@semihalf.com>
8 years agonet/enic: fix Rx queue init after restarting a device
John Daley [Wed, 29 Jun 2016 23:03:21 +0000 (16:03 -0700)]
net/enic: fix Rx queue init after restarting a device

If you stop, then start a port that had already received some packets,
the NIC could fetch discriptors from the wrong location. This could
effectivly reduce the size of the Rx queue by a random amount and
cause packet drop or reduced performance.

Reset the NIC fetch index to 0 when allocating and posting mbuf
addresses to the NIC.

Fixes: 947d860c821f ("enic: improve Rx performance")

Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: Nelson Escobar <neescoba@cisco.com>
8 years agonet/enic: fix Tx crash after restart
Nelson Escobar [Wed, 29 Jun 2016 23:03:20 +0000 (16:03 -0700)]
net/enic: fix Tx crash after restart

If you stop then start a port that had already sent some packets,
there was a segfault due to not resetting the number of completed
sends to zero.

Fixes: a3b1e9551c26 ("net/enic: streamline mbuf handling in Tx path")

Signed-off-by: Nelson Escobar <neescoba@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
8 years agonet/mlx4: add link up/down callback functions
Fengtian Guo [Mon, 4 Jul 2016 08:24:19 +0000 (10:24 +0200)]
net/mlx4: add link up/down callback functions

Implement dev_set_link_up and dev_set_link_down device
operations. Code is inspired by mlx5 implementations.

Signed-off-by: Fengtian Guo <fengtian.guo@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
8 years agonet/mlx5: fix API comment of link set function
Olivier Matz [Mon, 4 Jul 2016 08:24:18 +0000 (10:24 +0200)]
net/mlx5: fix API comment of link set function

Fixes: 62072098b54e ("mlx5: support setting link up or down")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
8 years agonet/mlx: fix setting interface flags
Olivier Matz [Mon, 4 Jul 2016 08:24:17 +0000 (10:24 +0200)]
net/mlx: fix setting interface flags

According to the documentation, the function
priv_set_flags(priv, keep, flags) should not modify the flags
in "keep" mask.

So 'flags' argument should be masked with '~keep' before ORing
it with the previous flags value.

This avoids messing up the kernel interface flags when calling
priv_set_flags(priv, ~IFF_UP, ~IFF_UP) in priv_set_link():

  $ ip link
  26: eth0: BROADCAST,MULTICAST,NOARP,ALLMULTI,PROMISC,DEBUG,\
      DYNAMIC,AUTOMEDIA,PORTSEL,NOTRAILERS

Fixes: 7fae69eeff13 ("mlx4: new poll mode driver")
Fixes: 771fa900b73a ("mlx5: introduce new driver for Mellanox ConnectX-4 adapters")

Reported-by: Fengtian Guo <fengtian.guo@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
8 years agonet/fm10k: fix Rx descriptor read timing
Xiao Wang [Mon, 4 Jul 2016 07:51:08 +0000 (15:51 +0800)]
net/fm10k: fix Rx descriptor read timing

We find that when traffic is light, a small number of packets will have
wrong metadata (e.g. packet type), however this issue will not happen
when traffic is heavy.

The root cause is some fields in fm10k_rx_desc are read at the wrong time,
since the descriptor (being 16-bytes big) is not read as a single atomic
operation. When the input speed is slower than software's capability,
fm10k scalar Rx function accesses descriptors at about the same time
as HW writes them, so the scenario can occur: some fields like pkt_info
in fm10k_rx_desc are read before HW writeback but some fields like DD bit
are read after HW writeback, this will lead to the later packet parsing
function using incorrect value.

This patch fixes this issue by reading and parsing Rx descriptor only after
first checking that the DD bit is set.

Fixes: 4b61d3bfa941 ("fm10k: add receive and tranmit")
Fixes: c82dd0a7bfa5 ("fm10k: add scatter receive")

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agonet/thunderx: fix memory alloc issue when changing ring size
Kamil Rytarowski [Mon, 4 Jul 2016 07:16:14 +0000 (12:46 +0530)]
net/thunderx: fix memory alloc issue when changing ring size

Allocate maximum supported hardware ring hardware descriptors
memory on the first rte_eth_dma_zone_reserve call in order to
get sufficient hardware ring buffer space on subsequent queue
setup request with different queue size.

Fixes: aa0d976e501d ("net/thunderx: add Rx queue setup and release")
Fixes: 3f3c6f9724a8 ("net/thunderx: add Tx queue setup and release")
Fixes: 7413feee662d ("net/thunderx: add device start/stop and close")

Signed-off-by: Kamil Rytarowski <kamil.rytarowski@caviumnetworks.com>
Signed-off-by: Zyta Szpak <zyta.szpak@semihalf.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
8 years agonet/ixgbe: fix build whith offload flags disabled
Olivier Matz [Fri, 1 Jul 2016 08:02:27 +0000 (10:02 +0200)]
net/ixgbe: fix build whith offload flags disabled

The ixgbe driver does not compile if CONFIG_RTE_IXGBE_RX_OLFLAGS_ENABLE=n
because the macro has not the proper number of parameters. To reproduce
the issue:

  make config T=x86_64-native-linuxapp-gcc
  sed -i 's,\(IXGBE_RX_OLFLAGS_ENABLE\)=y,\1=n,' build/.config
  make -j4
  [...]
   ixgbe_rxtx_vec_sse.c: In function ‘_recv_raw_pkts_vec’:
   ixgbe_rxtx_vec_sse.c:345:53: error:
     macro "desc_to_olflags_v" passed 3 arguments, but takes just 2
      desc_to_olflags_v(descs, vlan_flags, &rx_pkts[pos]);
                                                        ^
   ixgbe_rxtx_vec_sse.c:345:3: error:
     ‘desc_to_olflags_v’ undeclared (first use in this function)
      desc_to_olflags_v(descs, vlan_flags, &rx_pkts[pos]);
      ^
   ixgbe_rxtx_vec_sse.c:231:10: error:
     variable ‘vlan_flags’ set but not used
     uint8_t vlan_flags;
             ^

This patch fixes the number of arguments in the macro, and ensures that
vlan_flags is marked as used to avoid the third error.

Fixes: b37b528d957c ("mbuf: add new Rx flags for stripped VLAN")

Reported-by: Amin Tootoonchian <amint@icsi.berkeley.edu>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agonet/i40e: fix VLAN filtering in promiscuous mode
Jingjing Wu [Thu, 30 Jun 2016 01:25:55 +0000 (09:25 +0800)]
net/i40e: fix VLAN filtering in promiscuous mode

For VLAN filtering, the VLAN table should be enabled.
But the VLAN table is disabled by default until a rule is added.
In promiscuous mode no rule is added to enable the VLAN table.

This patch clears promiscuous VLAN flag on VSI, and adds a
rule to enable the VLAN table to fix VLAN filtering in promiscuous
mode.

Fixes: 4861cde46116 ("i40e: new poll mode driver")

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
8 years agonet/bnx2x: fix incorrect number of supported queues
Charles (Chas) Williams [Tue, 28 Jun 2016 16:14:50 +0000 (12:14 -0400)]
net/bnx2x: fix incorrect number of supported queues

We need sc->igu_sb_cnt determined before calculating the number of queues
we can support, so move the call to bnx2x_init_rte() to later in the code.

Fixes: 3754101cd74c ("net/bnx2x: fix MSIX vector and VF resource counts")

Signed-off-by: Charles (Chas) Williams <ciwillia@brocade.com>
Acked-by: Rasesh Mody <rasesh.mody@qlogic.com>
8 years agonet/bnx2x: set random MAC address if none assigned
Charles (Chas) Williams [Tue, 21 Jun 2016 12:18:46 +0000 (08:18 -0400)]
net/bnx2x: set random MAC address if none assigned

If the PF hasn't assigned an address, assign one randomly.  While here,
convert to use DPDK's ether address utility routines.

Fixes: 540a211084a7 ("bnx2x: driver core")

Signed-off-by: Charles (Chas) Williams <ciwillia@brocade.com>
Acked-by: Rasesh Mody <rasesh.mody@qlogic.com>
8 years agoscripts: add more git log capitalization checks
Bruce Richardson [Tue, 5 Jul 2016 16:03:11 +0000 (17:03 +0100)]
scripts: add more git log capitalization checks

Add API, NUMA, HW, SW, FW and VMDq to list of words to capitalize properly.
Since VMDq is a bit unusual, add it as special case check so we can
print an error message giving the correct way to write it.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agoscripts: check headline of drivers commits
Nelio Laranjeiro [Wed, 29 Jun 2016 15:55:08 +0000 (17:55 +0200)]
scripts: check headline of drivers commits

A driver patch under net should start with "net/<driver name>" or if
a patch touch multiple drivers, it should only start with "net:".
The same apply for crypto.
A patch touching all drivers (net + crypto) should start with "drivers:".

Longer prefixes like "net/mlx:" (for mlx4/mlx5) or "net/e1000/base:" are
handled by not checking the colon.

The directories doc/ and config/ are ignored because a driver patch
can modify them.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoscripts: reduce line size of commit checks
Thomas Monjalon [Tue, 5 Jul 2016 21:13:24 +0000 (23:13 +0200)]
scripts: reduce line size of commit checks

Small cleanup to comply with the 80 chars limit.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoscripts: check spacing after commit references
Thomas Monjalon [Tue, 5 Jul 2016 16:24:21 +0000 (18:24 +0200)]
scripts: check spacing after commit references

A blank line between "Fixes" and "Signed-off-by" helps to
separate information in blocks.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoscripts: fix commit check for empty list
Thomas Monjalon [Fri, 8 Jul 2016 17:45:54 +0000 (19:45 +0200)]
scripts: fix commit check for empty list

When running check-git-log.sh on a clean tree it was complaining
of a wrong empty headline because '^[^:]*$' was matching.
It is fixed by matching at least one character with +.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoscripts: fix commit check of first word
Thomas Monjalon [Tue, 5 Jul 2016 15:47:05 +0000 (17:47 +0200)]
scripts: fix commit check of first word

The first word of each commit message is checked.
But when the commit range was greater than 1, only the latest commit
was checked.
It is fixed by checking each commit separately.

Fixes: 9c24780f0d5e ("scripts: check first word of commit messages")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Tested-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agoexamples: fix dependencies on hash library
Thomas Monjalon [Wed, 6 Jul 2016 14:33:01 +0000 (16:33 +0200)]
examples: fix dependencies on hash library

The multi_process example do not need rte_hash.
But these examples cannot compile if rte_hash is not available:
- ipsec-secgw (was already protected - no change)
- ipv4_multicast
- l3fwd-power
- l3fwd-vf
- tep_termination
- ip_pipeline

The ip_pipeline example is not disabled because its dependencies
are handled with #ifdef. It may require a separate fix.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agotable: remove unneeded dependency on hash library
Thomas Monjalon [Wed, 6 Jul 2016 14:31:47 +0000 (16:31 +0200)]
table: remove unneeded dependency on hash library

Fixes: 8aa327214ceb ("table: hash")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agonet/bnx2x: remove unneeded dependency on hash library
Thomas Monjalon [Wed, 6 Jul 2016 14:30:20 +0000 (16:30 +0200)]
net/bnx2x: remove unneeded dependency on hash library

Fixes: 9fb557035d90 ("bnx2x: enable PMD build")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Rasesh Mody <rasesh.mody@qlogic.com>
8 years agonet/enic: remove useless assert macro
Thomas Monjalon [Wed, 6 Jul 2016 15:23:01 +0000 (17:23 +0200)]
net/enic: remove useless assert macro

The macro ENIC_ASSERT does the same thing as RTE_ASSERT,
thus it can be removed.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: John Daley <johndale@cisco.com>
8 years agoapp/test: remove useless clock estimation
Thomas Monjalon [Wed, 6 Jul 2016 14:58:39 +0000 (16:58 +0200)]
app/test: remove useless clock estimation

The function get_machclk_freq() in RED test can be replaced by
rte_get_timer_hz() which already estimates the clock frequency at EAL init.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoigb_uio: fix possible mmap failure with Linux 4.5
Ferruh Yigit [Tue, 5 Jul 2016 15:00:52 +0000 (16:00 +0100)]
igb_uio: fix possible mmap failure with Linux 4.5

mmap the iomem range of the PCI device fails for kernels that
enabled CONFIG_IO_STRICT_DEVMEM option:

EAL: pci_map_resource():
         cannot mmap(39, 0x7f1c51800000, 0x100000, 0x0):
         Invalid argument (0xffffffffffffffff)

CONFIG_IO_STRICT_DEVMEM is introduced in Linux v4.5 and not enabled
by default:
Linux commit: 90a545e restrict /dev/mem to idle io memory ranges

As a workaround igb_uio can stop reserving PCI memory resources, from
kernel point of view iomem region looks like idle and mmap works
again. This matches uio_pci_generic usage.

With this update device iomem range is not protected against any
other kernel drivers or userspace access. But this  shouldn't
be a problem for dpdk usage module since purpose of the igb_uio
module is to provide userspace access.

Fixes: af75078fece3 ("first public release")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
8 years agomem: do not zero out memory on zmalloc
Sergio Gonzalez Monroy [Tue, 5 Jul 2016 11:01:16 +0000 (12:01 +0100)]
mem: do not zero out memory on zmalloc

Zeroing out memory on rte_zmalloc_socket is not required anymore since all
allocated memory is already zeroed.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
8 years agomem: zero out memory on free
Sergio Gonzalez Monroy [Tue, 5 Jul 2016 11:01:15 +0000 (12:01 +0100)]
mem: zero out memory on free

Since commit fafcc11985a2, memzones are not guaranteed to be zeroed out.
This could potentially cause issues as applications might have been
relying on the allocated memory being zeroed out.

On init all allocated memory is zeroed by the kernel, so by zeroing out
memory on free, all available dpdk memory is always zeroed.

Fixes: fafcc11985a2 ("mem: rework memzone to be allocated by malloc")

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
8 years agomem: fix hugepage resource leak
Daniel Mrzyglod [Wed, 6 Jul 2016 10:44:53 +0000 (12:44 +0200)]
mem: fix hugepage resource leak

Current code does not munmap 'hugepage' mapping (hugepage info file) on
function exit, leaking resources.

Coverity issue: 97920
Fixes: b6a468ad41d5 ("memory: add --socket-mem option")

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
8 years agopdump: close client socket on error
Reshma Pattan [Mon, 4 Jul 2016 16:17:29 +0000 (17:17 +0100)]
pdump: close client socket on error

Close the client socket before returning on error.

Coverity issue: 127555
Fixes: f3c1829130ac ("pdump: check missing home environment variable")

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agohash: retrieve a key given its position
Yari Adan Petralanda [Mon, 4 Jul 2016 08:59:52 +0000 (10:59 +0200)]
hash: retrieve a key given its position

The function rte_hash_get_key_with_position is added in this patch.
As the position returned when adding a key is frequently used as an
offset into an array of user data, this function performs the operation
of retrieving a key given this offset.

A possible use case would be to delete a key from the hash table when
its entry in the array of data has certain value. For instance, the key
could be a flow 5-tuple, and the value stored in the array a time
stamp.

Signed-off-by: Juan Antonio Montesinos <juan.antonio.montesinos.delgado@ericsson.com>
Signed-off-by: Yari Adan Petralanda <yari.adan.petralanda@ericsson.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoethdev: fix xstats id mismatch
Remy Horton [Fri, 8 Jul 2016 15:44:24 +0000 (16:44 +0100)]
ethdev: fix xstats id mismatch

When fetching xstats values the driver specific parameters are
placed after the generic ones, but when fetching xstats names
the driver specific parameter names came first. This patch fixes
the resulting id mismatch between names and values.

Fixes: bd6aa172cf35 ("ethdev: fetch extended statistics with integer ids")

Signed-off-by: Remy Horton <remy.horton@intel.com>
8 years agoethdev: get registers width
Zyta Szpak [Mon, 4 Jul 2016 11:36:46 +0000 (13:36 +0200)]
ethdev: get registers width

The ethtool app was allocating too little space for 64-bit
registers which resulted in memory corruption.

Removes hard-coded assumption that device registers
are always 32 bits wide. The rte_eth_dev_get_reg_length
and rte_eth_dev_get_reg_info callbacks did not
provide register size to the app in any way while is
needed to allocate correct number of bytes before
retrieving registers using rte_eth_dev_get_reg.

This commit changes rte_eth_dev_get_reg_info so that
it can be used to retrieve both the number of registers
and their width, and removes the now-redundant
rte_eth_dev_get_reg_length.

Signed-off-by: Zyta Szpak <zyta.szpak@semihalf.com>
Acked-by: Remy Horton <remy.horton@intel.com>
8 years agoapp/test: fix missing operation initialization
Deepak Kumar Jain [Sun, 10 Jul 2016 10:20:57 +0000 (11:20 +0100)]
app/test: fix missing operation initialization

Initializing the authentication op parameter.

Fixes: eec136f3c54f ("aesni_gcm: add driver for AES-GCM crypto operations")

Signed-off-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agocrypto/qat: fix digest verification
Deepak Kumar Jain [Sun, 10 Jul 2016 10:21:22 +0000 (11:21 +0100)]
crypto/qat: fix digest verification

This fixes the cases in which operation was Digest verify.

Fixes: e25200fbb45d ("qat: add cipher/auth only")

Signed-off-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agocrypto/kasumi: restrict cipher bit-level operations
Pablo de Lara [Sat, 9 Jul 2016 16:35:58 +0000 (17:35 +0100)]
crypto/kasumi: restrict cipher bit-level operations

KASUMI PMD only supports bit-level cipher operations
when destination buffer is different from the source
(out of place operations). This commit adds a check
in the code to prevent the user from trying to perform
in-place bit-level ciphering.

Fixes: 2773c86d061a ("crypto/kasumi: add driver for KASUMI library")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agocrypto/kasumi: fix AAD size of F9 function
Pablo de Lara [Fri, 8 Jul 2016 08:40:08 +0000 (09:40 +0100)]
crypto/kasumi: fix AAD size of F9 function

Additional authenticated data (AAD) in KASUMI F9 (UIA1) is 8 bytes
and not 9 bytes, since direction bit is obtained just after the
end of the message, and it is separated from the AAD.

Fixes: 2773c86d061a ("crypto/kasumi: add driver for KASUMI library")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agonet/bonding: fix range of mode parameter
Pablo de Lara [Sat, 9 Jul 2016 01:06:14 +0000 (02:06 +0100)]
net/bonding: fix range of mode parameter

The range of the supported bonding modes is 0-6, instead of 0-4.

Fixes: cb6696d22023 ("drivers: update registration macro usage")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
8 years agodrivers: add virtio and xenvirt parameters infos
Pablo de Lara [Sat, 9 Jul 2016 01:06:13 +0000 (02:06 +0100)]
drivers: add virtio and xenvirt parameters infos

Virtio and Xenvirt are two virtual device drivers that admit
arguments, so DRIVER_REGISTER_PARAM_STRING should be used
in them.

Fixes: cb6696d22023 ("drivers: update registration macro usage")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
8 years agodrivers: split parameters infos in multiple lines
Pablo de Lara [Sat, 9 Jul 2016 01:06:12 +0000 (02:06 +0100)]
drivers: split parameters infos in multiple lines

Driver arguments shown with DRIVER_REGISTER_PARAM_STRING
have been separated in multiple lines and indented to
ease their readability.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
8 years agodrivers: remove static driver names
Pablo de Lara [Sat, 9 Jul 2016 01:06:11 +0000 (02:06 +0100)]
drivers: remove static driver names

Since now the PMD_REGISTER_DRIVER macro sets the driver names,
there is no need to have the rte_driver structure setting it
statically, as it will get overridden.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
8 years agodrivers: revert vdev driver names to original
Pablo de Lara [Sat, 9 Jul 2016 01:06:10 +0000 (02:06 +0100)]
drivers: revert vdev driver names to original

In order to avoid API breakage, the driver names of the virtual devices
have been renamed to their original name, before the modification
of the PMD_REGISTER_DRIVER macro, which sets now the driver names.

Fixes: cb6696d22023 ("drivers: update registration macro usage")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
8 years agotools: fix pmdinfo for FreeBSD
Bruce Richardson [Fri, 8 Jul 2016 20:37:05 +0000 (21:37 +0100)]
tools: fix pmdinfo for FreeBSD

There were a couple of issues which prevented pmdinfo.py from running on
FreeBSD, both of which are fixed by this patch.

* The path to python is not /usr/bin/python as on Linux, so use
  /usr/bin/env to find it on both OS's.
* The path to the pci ids DB is in a different location on FreeBSD,
  so use the platform python library to look in different default
  locations depending on the underlying OS. [There are two possible
  locations to look on FreeBSD, as defined by pciconf manpage, so
  check in both in order of better to worse]

Fixes: c67c9a5c646a ("tools: query binaries for HW and other support information")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agopmdinfogen: fix build on FreeBSD
Bruce Richardson [Fri, 8 Jul 2016 20:37:04 +0000 (21:37 +0100)]
pmdinfogen: fix build on FreeBSD

error on compilation caused by missing include for libgen.h.
buildtools/pmdinfogen/pmdinfogen.c:402:4: error:
implicit declaration of function 'basename' is invalid in C99
                        basename(argv[0]));

Fixes: 840e5dfea3f8 ("pmdinfogen: fix usage message")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agocryptodev: move KASUMI to end of list
Pablo de Lara [Wed, 6 Jul 2016 14:05:32 +0000 (15:05 +0100)]
cryptodev: move KASUMI to end of list

New cryptodev type for the new KASUMI PMD was added
in the cryptodev type enum, but not at the end of it,
causing an ABI breakage.

Fixes: 2773c86d061a ("crypto/kasumi: add driver for KASUMI library")

Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agocrypto: normalize driver names with macros
Pablo de Lara [Fri, 8 Jul 2016 16:46:51 +0000 (17:46 +0100)]
crypto: normalize driver names with macros

Recently reported, the introduction of pmd information exports led to a
breakage of cryptodev unit tests because the test infrastructure relies on the
cryptodev names being available in macros.  This patch fixes the pmd naming to
use the macro names.  Note that the macro names were already pre-stringified,
which won't work as the PMD_REGISTER_DRIVER macro requires the name in both a
processing token and stringified form.  As such the names are defined now as
tokens, and converted where needed to stringified form on demand using RTE_STR.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agomaintainers: add section for pmdinfo
Thomas Monjalon [Thu, 7 Jul 2016 09:59:33 +0000 (11:59 +0200)]
maintainers: add section for pmdinfo

The author of this feature is Neil Horman.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
8 years agodoc: fix syntax in pmdinfogen guide
Thomas Monjalon [Thu, 7 Jul 2016 09:52:40 +0000 (11:52 +0200)]
doc: fix syntax in pmdinfogen guide

Sphynx reports this error:

doc/guides/prog_guide/dev_kit_build_system.rst:337: WARNING:
Pygments lexer name u'C' is not known

Fixes: 737ddf3fb ("doc: add prog guide section documenting pmdinfo script")

Reported-by: Bernard Iremonger <bernard.iremonger@intel.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
8 years agoeal: remove PCI include from generic driver header
Thomas Monjalon [Thu, 7 Jul 2016 14:59:14 +0000 (16:59 +0200)]
eal: remove PCI include from generic driver header

Remove include of rte_pci.h in the generic header rte_dev.h.

Fixes: cb6696d22023 ("drivers: update registration macro usage")

Suggested-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
8 years agopmdinfogen: fix usage message
Thomas Monjalon [Thu, 7 Jul 2016 14:24:36 +0000 (16:24 +0200)]
pmdinfogen: fix usage message

The name of the tool is pmdinfogen.

Fixes: 98b0fdb0ffc6 ("pmdinfogen: add buildtools and pmdinfogen utility")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
8 years agopmdinfogen: fix build warnings
Thomas Monjalon [Thu, 7 Jul 2016 12:41:36 +0000 (14:41 +0200)]
pmdinfogen: fix build warnings

When compiled with a standard clang, pmdinfogen can raise a warning:
    buildtools/pmdinfogen/pmdinfogen.c:365:1: warning:
    control reaches end of non-void function

Actually there can be more warnings with stricter compilers.
In order to catch them early and fix most of them, the DPDK standard flags
WERROR_FLAGS are used.

The warnings fixed are:
    no previous prototype for ...
    no return statement in function returning non-void
    variable ‘secstrings’ set but not used
    ‘sec_name’ defined but not used
    ‘get_symbol_index’ defined but not used
    pointer of type ‘void *’ used in arithmetic

Fixes: 98b0fdb0ffc6 ("pmdinfogen: add buildtools and pmdinfogen utility")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
8 years agomk: fix verbose pmdinfogen run
Thomas Monjalon [Thu, 7 Jul 2016 12:06:38 +0000 (14:06 +0200)]
mk: fix verbose pmdinfogen run

When building with "make V=1" it is expected to see the output of each
compiler command in order to debug them.
Unfortunately the pmdinfogen related commands were always quiet.

It is fixed by defining the commands in some Makefile variables.
They are printed if the verbose mode is enabled.

The other benefit of this rework is to stop compilation after a
failure with pmdinfogen.

The command readlink is removed in this rework because it seems useless.

Fixes: 3d781ca32874 ("mk: do post processing on objects that register a driver")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
8 years agomk: fix driver build with installed SDK
Thomas Monjalon [Thu, 7 Jul 2016 12:19:54 +0000 (14:19 +0200)]
mk: fix driver build with installed SDK

The tool pmdinfogen was called from RTE_OUTPUT/app/ which does not exist
if building a driver outside of the SDK build.
When building DPDK, RTE_SDK_BIN is RTE_OUTPUT. When building an external
driver, RTE_SDK_BIN must point to the installed DPDK directory containing
includes, libs, etc.

That's why pmdinfogen must be installed in the SDK directory and be part
of the SDK installation.

Fixes: 3d781ca32874 ("mk: do post processing on objects that register a driver")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
8 years agomk: remove traces of hostapp build directory
Thomas Monjalon [Thu, 7 Jul 2016 11:49:58 +0000 (13:49 +0200)]
mk: remove traces of hostapp build directory

The recipe rte.hostapp.mk does not build in hostapp/ anymore.

Fixes: 98b0fdb0ffc6 ("pmdinfogen: add buildtools and pmdinfogen utility")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
8 years agomk: fix build dependency of drivers on pmdinfogen
Thomas Monjalon [Thu, 7 Jul 2016 08:20:28 +0000 (10:20 +0200)]
mk: fix build dependency of drivers on pmdinfogen

When compiling the drivers, some code is generated with pmdinfogen.
A fresh parallel build can fail if a driver is compiled before pmdinfogen:
build/buildtools/dpdk-pmdinfogen: Permission denied

There was a dependency declared in drivers/Makefile but it cannot work
because this file is based on mk/rte.subdir.mk which do not handle
dependencies.

It is fixed by declaring the whole buildtools as (order only) prerequisite
of drivers.

Fixes: cb6696d22023 ("drivers: update registration macro usage")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
8 years agodrivers: fix build with new register macro
Thomas Monjalon [Wed, 6 Jul 2016 21:14:20 +0000 (23:14 +0200)]
drivers: fix build with new register macro

Compilation fails because of some typos.

Fixes: cb6696d22023 ("drivers: update registration macro usage")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Tested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
8 years agodoc: add prog guide section documenting pmdinfo script
Neil Horman [Fri, 17 Jun 2016 18:46:25 +0000 (14:46 -0400)]
doc: add prog guide section documenting pmdinfo script

Information on pmdinfogen may be useful to 3rd party driver developers.
Include documentation on what it does

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Remy Horton <remy.horton@intel.com>
8 years agotools: query binaries for HW and other support information
Neil Horman [Fri, 17 Jun 2016 18:46:24 +0000 (14:46 -0400)]
tools: query binaries for HW and other support information

This tool searches for the primer sting PMD_DRIVER_INFO= in any ELF binary,
and, if found parses the remainder of the string as a json encoded string,
outputting the results in either a human readable or raw, script parseable
format

Note that, in the case of dynamically linked applications, pmdinfo.py will
scan for implicitly linked PMDs by searching the specified binaries
.dynamic section for DT_NEEDED entries that contain the substring
librte_pmd.  The DT_RUNPATH, LD_LIBRARY_PATH, /usr/lib and /lib are
searched for these libraries, in that order

If a file is specified with no path, it is assumed to be a PMD DSO, and the
LD_LIBRARY_PATH, /usr/lib[64]/ and /lib[64] is searched for it

Currently the tool can output data in 3 formats:

a) raw, suitable for scripting, where the raw JSON strings are dumped out
b) table format (default) where hex pci ids are dumped in a table format
c) pretty, where a user supplied pci.ids file is used to print out vendor
and device strings

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: Remy Horton <remy.horton@intel.com>
8 years agomk: do post processing on objects that register a driver
Neil Horman [Fri, 17 Jun 2016 18:46:23 +0000 (14:46 -0400)]
mk: do post processing on objects that register a driver

Modify the compilation makefile to identify C files that export PMD
information, and use that to trigger execution of the pmdinfo binary.  If
the execution of pmdinfo is successful, compile the output C file to an
object, and use the linker to do relocatable linking on the resultant
object file into the parent object that it came from.  This effectively
just adds the json string into the string table of the object that defines
the PMD to the outside world.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: Remy Horton <remy.horton@intel.com>
8 years agoeal: export default plugin path to external tools
Neil Horman [Fri, 17 Jun 2016 18:46:22 +0000 (14:46 -0400)]
eal: export default plugin path to external tools

Export a symbol containing the string:
DPDK_PLUGIN_PATH="$(CONFIG_RTE_EAL_PMD_PATH)"

Where the latter half of the string is set at build time to a location from
which autoloaded DSO's will be found.  This string is used by pmdinfo in
'plugin' mode, whereby a user can specify a dpdk installation directory (or
static binary), and scan the associated path (if found) for pmd DSO's and
report on their hardware support.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: Remy Horton <remy.horton@intel.com>
8 years agodrivers: update registration macro usage
Neil Horman [Fri, 17 Jun 2016 18:46:21 +0000 (14:46 -0400)]
drivers: update registration macro usage

Modify the PMD_REGISTER_DRIVER macro, adding a name argument to it.  The
addition of a name argument creates a token that can be used for subsequent
macros in the creation of unique symbol names to export additional bits of
information for use by the pmdinfogen tool.  For example:

PMD_REGISTER_DRIVER(ena_driver, ena);

registers the ena_driver struct as it always did, and creates a symbol
const char this_pmd_name0[] __attribute__((used)) = "ena";

which pmdinfogen can search for and extract.  The subsequent macro

DRIVER_REGISTER_PCI_TABLE(ena, ena_pci_id_map);

creates a symbol const char ena_pci_tbl_export[] __attribute__((used)) =
"ena_pci_id_map";

Which allows pmdinfogen to find the pci table of this driver

Using this pattern, we can export arbitrary bits of information.

pmdinfo uses this information to extract hardware support from an object
file and create a json string to make hardware support info discoverable
later.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: Remy Horton <remy.horton@intel.com>
8 years agopmdinfogen: add buildtools and pmdinfogen utility
Neil Horman [Fri, 17 Jun 2016 18:46:20 +0000 (14:46 -0400)]
pmdinfogen: add buildtools and pmdinfogen utility

pmdinfogen is a tool used to parse object files and build json strings for
use in later determining hardware support in a dso or application binary.
pmdinfo looks for the non-exported symbol names this_pmd_name<n> and
this_pmd_tbl<n> (where n is a integer counter).  It records the name of
each of these tuples, using the later to find the symbolic name of the
pci_table for physical devices that the object supports.  With this
information, it outputs a C file with a single line of the form:

static char *<pmd_name>_driver_info[] __attribute__((used)) = " \
PMD_DRIVER_INFO=<json string>";

Where <pmd_name> is the arbitrary name of the pmd, and <json_string> is the
json encoded string that hold relevant pmd information, including the pmd
name, type and optional array of pci device/vendor ids that the driver
supports.

This c file is suitable for compiling to object code, then relocatably
linking into the parent file from which the C was generated.  This creates
an entry in the string table of the object that can inform a later tool
about hardware support.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: Remy Horton <remy.horton@intel.com>
8 years agoversion: 16.07-rc1
Thomas Monjalon [Mon, 4 Jul 2016 01:43:08 +0000 (03:43 +0200)]
version: 16.07-rc1

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agonet/virtio-user: fix build with icc
Jianfeng Tan [Sun, 26 Jun 2016 13:48:13 +0000 (13:48 +0000)]
net/virtio-user: fix build with icc

Implicit int to enum conversion is not allowed when icc is used as
the compiler. It raises the compiling error like,
    drivers/net/virtio/virtio_user/vhost_user.c(257):
        error #188: enumerated type mixed with another type
    msg.request = req;
                ^

The fix is simple, change the type of parameter req to enum
vhost_user_request.

Fixes: 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer")

Suggested-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/vhost: fix Tx error counting
Tetsuya Mukawa [Fri, 24 Jun 2016 02:04:20 +0000 (11:04 +0900)]
net/vhost: fix Tx error counting

According to 'rte_eth_stats' structure comments, 'imissed'
should represent RX error counting, but currently 'imissed' is
used to count TX error.

The patch replaces 'imissed' by 'oerrors'.

Fixes: ee584e9710b9 ("vhost: add driver on top of the library")

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>