Pure coding style, but it might make it easier later if we want to move
fields in rte_cryptodev_driver and eth_driver structures.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Probe and Remove are more appropriate names for PCI init and uninint
operations. This is a cosmetic change.
Only MLX* uses the PCI direct registration, bypassing PMD_* macro.
The callbacks for this too have been updated.
VDEV are left out. For them, init/uninit are more appropriate.
Suggested-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: David Marchand <david.marchand@6wind.com>
As discussed in the past release, driver names are modified
to be more consistent, and the future driver should follow
this new convention.
Driver names consist of:
"driver category"_"driver folder name"_"optional extra name".
For example:
- Crypto null driver -> "crypto_null"
- Network IXGBE VF driver -> "net_ixgbe_vf"
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
PCI device ids moved from common header into igb driver itself.
KNI starts using pci_device_id from kni/ethtool/igb driver, this is only
for KNI ethtool support, KNI data path is not affected.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
PCI device ids moved from common header into ixgbe driver itself.
KNI starts using pci_device_id from kni/ethtool/ixgbe driver, this is
only for KNI ethtool support, KNI data path is not affected.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
The driver is incorrectly setting the RSS field in the last mbuf in
the packet chain instead of the first. Moreover, the last mbuf might
have already been freed if it only contained the Ethernet CRC.
Also, fix the call to i40e_rxd_build_fdir to store the fdir flags in
the first mbuf of the chain instead of the last.
Fixes: 4861cde461 ("i40e: new poll mode driver")
Fixes: 5a21d9715f ("i40e: report flow director matching")
Signed-off-by: Dumitru Ceara <dumitru.ceara@gmail.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
VSI structure needs to be removed from TAILQ list when releasing.
But for the child VSI it will be removed again after the structure
is freed. It will cause core dump when the DPDK i40e using as PF
host driver.
This patch fixes it to only remove child VSI from TAILQ before
send adminq command to remove it from hardware.
Fixes: 4861cde461 ("i40e: new poll mode driver")
Fixes: 440499cf53 ("net/i40e: support floating VEB")
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
i40e driver was removing elements when iterating tailq lists
with TAILQ_FOREACH macro, which is not safe.
It is especially visible since the memory is zeroed on free
(commit ea0bddbd14).
Instead, TAILQ_FOREACH_SAFE macro is used when removing/freeing
these elements.
Fixes: 4861cde461 ("i40e: new poll mode driver")
Fixes: 440499cf53 ("net/i40e: support floating VEB")
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
The commit cb6696d220 ("drivers: update registration macro usage")
changes the name from virtio-user to virtio_user, because hyphen
cannot be used in a C symbol name. However, this commit does not
update the strings in docs and source code, which could lead to
failure to start this device as per the docs.
This patch updates related strings in the docs and source code.
Fixes: cb6696d220 ("drivers: update registration macro usage")
Reported-by: Tiwei Bie <tiwei.bie@intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Sometimes app just wants to update the RSS hash function and no RSS key
update is needed, but fm10k pmd will return EINVAL for this case.
If the rss_key is NULL, we don't need to check the rss_key_len.
Fixes: 57033cdf8f ("fm10k: add PF RSS")
Reported-by: Xueqin Lin <xueqin.lin@intel.com>
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Rx loop inside _recv_raw_pkts_vec() ignores nb_pkts argument and always
tries to receive RTE_I40E_VPMD_RX_BURST (32) packets. This is a violation
of rte_eth_rx_burst() API and can lead to memory corruption (out-of-bounds
writes to struct rte_mbuf **rx_pkts) if nb_pkts is less than 32.
Fix this by actually using nb_pkts inside the loop.
Fixes: 9ed94e5bb0 ("i40e: add vector Rx")
Signed-off-by: Sergey Dyasly <s.dyasly@samsung.com>
Acked-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Adam Bynes <adambynes@outlook.com>
The configure function enicpmd_dev_configure() was not paying attention
to the rxmode VLAN strip bit. Set the VLAN strip mode according to the bit.
Fixes: fefed3d1e6 ("enic: new driver")
Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: David Harton <dharton@cisco.com>
Tested-by: David Harton <dharton@cisco.com>
Initialize the mbuf data offset to RTE_PKTMBUF_HEADROOM as the
enic takes ownership of them. If allocated mbufs had some offset
other than RTE_PKTMBUF_HEADROOM, the application would read mbuf
data starting at the wrong place and misinterpret the packet.
Fixes: 856d7ba7ed ("net/enic: support scattered Rx")
Reviewed-by: Nelson Escobar <neescoba@cisco.com>
Signed-off-by: John Daley <johndale@cisco.com>
drivers/net/ena/base/ena_com.c(346):
error #3656: variable "dev_node" may be used before its value is set
ENA_MEM_ALLOC_COHERENT_NODE(ena_dev->dmadev,
^
drivers/net/ena/base/ena_com.c(399):
error #3656: variable "prev_node" may be used before its value is set
ENA_MEM_ALLOC_COHERENT_NODE(ena_dev->dmadev,
^
Fixes: 3d3edc265f ("net/ena: make coherent memory allocation NUMA-aware")
Reported-by: Eoin Breen <eoin.breen@intel.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Jan Medala <jan@semihalf.com>
The rxq/txq for the queue_release callback could be NULL, say when
rte_eth_dev_configure() fails that the queue is not setup at all.
Do a simple NULL check would fix the crash issue.
Fixes: 01ad44fd37 ("net/virtio: split Rx/Tx queue")
Reported-by: Olivier Matz <olivier.matz@6wind.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
The support of virtio-user changed the way the mbuf dma address is
retrieved, using a physical address in case of virtio-pci and a virtual
address in case of virtio-user.
This change introduced some possible memory corruption in packets,
replacing:
m->buf_physaddr + RTE_PKTMBUF_HEADROOM
by:
m->buf_physaddr + m->data_off (through a macro)
This patch fixes this issue, restoring the original behavior.
By the way, it also rework the macros, adding a "VIRTIO_" prefix and
API comments.
Fixes: f24f8f9fee ("net/virtio: allow virtual address to fill vring descriptors")
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
When enic's interrupt handler is called indicating an error, it scans
through the receive queues (RQs) on the adapter looking for errors.
But since the inclusion of rx scatter, some of the RQs may not be in
use, and you shouldn't check them for errors.
Fixes: 856d7ba7ed ("net/enic: support scattered Rx")
Signed-off-by: Nelson Escobar <neescoba@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
The calculation of truncated packets didn't take into account packet
errors due to the adapter not having buffers, causing both the
ipackets, and imissed counts to be wrong if such errors occurred. In
order to properly calculate the number of packets truncated, we need
to subtract the count of errors due to no buffers.
Fixes: c44d9f01ad ("net/enic: count truncated packets")
Signed-off-by: Nelson Escobar <neescoba@cisco.com>
The exported device start and stop functions where not setting the queue
states to RTE_ETH_QUEUE_STATE_STARTED and RTE_ETH_QUEUE_STATE_STOPPED.
After starting the device, the RTE queue stop function would not call
the enic queue stop function since queue was already marked as stopped.
Put queue state updates in the lower level queue start/stop functions
which are called by both device and queue start/stop functions.
Fixes: fefed3d1e6 ("enic: new driver")
Reviewed-by: Nelson Escobar <neescoba@cisco.com>
Signed-off-by: John Daley <johndale@cisco.com>
The check that all Tx and Rx queues were set up was not
adequate when reconfiguring with a different number of
queues. Only the number of completion queues (CQs) was
being used to make the determination, but the CQ array
is shared between the underlying Rx and Tx queues.
Check that the internal Rx, Tx and CQs are all set up
before completing port configuration.
Fixes: fefed3d1e6 ("enic: new driver")
Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: Nelson Escobar <neescoba@cisco.com>
One instance of a filter add failure was not incrementing the
the fail counter.
Fixes: 4c2c7bf41f ("net/enic: fix negative array index write")
Signed-off-by: John Daley <johndale@cisco.com>
In the burst Tx cleanup function, the reference count in mbufs
returned to the pool should to be decremented before they are
returned. Decrementing is not done by rte_mempool_put_bulk()
so it must be done separately using __rte_pktmbuf_prefree_seg().
Also when returning unsent buffers when the device is stopped
use rte_mbuf_free_seg() instead of rte_mempool_put() so that
reference counts are properly decremented.
Fixes: 36935afbc5 ("net/enic: refactor Tx mbuf recycling")
Reviewed-by: Nelson Escobar <neescoba@cisco.com>
Signed-off-by: John Daley <johndale@cisco.com>
The enic PMD code has diverged from code that was once
shared with the enic kernel mode driver for performance
reasons. It is confusing and misleading to print the
internal version number. Remove it.
Fixes: fefed3d1e6 ("enic: new driver")
Signed-off-by: John Daley <johndale@cisco.com>
RHEL 7.1's GCC for POWER8 reports the following error in one rte_memcpy()
macro call by mlx5:
error: array subscript is above array bounds [-Werror=array-bounds]
It appears to be a GCC bug which can be worked around by making parentheses
more explicit.
Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
In multi-queue + FTAG use case, we need to turn tx_ftag_en on for all
the Tx queues.
Fixes: 7958b1310d ("fm10k: enable FTAG based forwarding")
Reported-by: Ricky Li <ricky.li@intel.com>
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
This reverts commit 4761f57d58.
Introducing VLAN table by adding VLAN adminq command will cause NIC's
throughput drop obviously. It's a hardware issue.
With this revert, VLAN filtering can only work when promiscuous mode
is disabled.
Reverts: 4761f57d58 ("net/i40e: fix VLAN filtering in promiscuous mode")
Reported-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by : Jing Chen <jing.d.chen@intel.com>
The error is reported using test build script:
$ scripts/test-build.sh x86_64-native-linuxapp-gcc
...
drivers/net/virtio/virtio_user_ethdev.c:345:2: error:
this ‘if’ clause does not guard... [-Werror=misleading-indentation]
if (rte_kvargs_count(kvlist, VIRTIO_USER_ARG_PATH) == 1)
^~
Fixes: 404bd6bfe3 ("net/virtio-user: fix return value not checked")
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Moved defines since the driver had no such information.
Used RTE_PCI_DEVICE in place of RTE_PCI_DEV_ID_DECL* stuff.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Reused defines from the driver and moved broadcom vendor id macro.
Used RTE_PCI_DEVICE in place of RTE_PCI_DEV_ID_DECL* stuff.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Moved cisco vendor id since the driver had no such information.
Used RTE_PCI_DEVICE in place of RTE_PCI_DEV_ID_DECL* stuff.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Moved vmware device ids macro since the driver had no such information.
Used RTE_PCI_DEVICE in place of RTE_PCI_DEV_ID_DECL* stuff.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Reused defines from the driver.
Used RTE_PCI_DEVICE in place of RTE_PCI_DEV_ID_DECL* stuff.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reused defines from the driver and added a Intel vendor id macro for use by
igb later.
Used RTE_PCI_DEVICE in place of RTE_PCI_DEV_ID_DECL* stuff.
igb/igbvf is left as is, waiting for kni/ethtool cleanup.
Signed-off-by: David Marchand <david.marchand@6wind.com>
The older versions of rte_eth_bond_8023ad_conf_get and
rte_eth_bond_8023ad_setup were available in the old way since 2.0 - at
least according to the map file.
But versioning in the code was set to 16.04.
That breaks compatibility checks for 2.0 on that library.
For example with the dpdk abi checker:
http://people.canonical.com/~paelzer/compat_report.html
To fix, version the old symbols on the 2.0 version as they were
initially added to the map file.
See http://people.canonical.com/~paelzer/compat_report.html
Fixes: dc40f17a ("net/bonding: allow external state machine in mode 4")
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
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: 863bfb4744 ("mempool: optimize copy in cache")
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Fixes a bug where rte_eth_vhost_get_queue_event would not return enabled
queues after a guest application restart.
Fixes: ee584e9710 ("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>
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: 01ad44fd37 ("net/virtio: split Rx/Tx queue")
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
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: ce2eabdd43 ("net/virtio-user: add virtual device")
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
The return value by rte_kvargs_parse is not free(d), which leads
to memory leak.
Coverity issue: 127482
Fixes: ce2eabdd43 ("net/virtio-user: add virtual device")
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
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: 6a84c37e39 ("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>
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: ce2eabdd43 ("net/virtio-user: add virtual device")
Fixes: 6a84c37e39 ("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>
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: 37a7eb2ae8 ("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>