Huawei Xie [Wed, 8 Oct 2014 18:54:38 +0000 (02:54 +0800)]
vhost: remove switching related logics
The following logics will be moved to vhost example:
1. mac learning, which is used to learn the mac address from the first
transmitted packet of guest and bind the vhost device to a queue in a
pool of VMDQ.
2. VMDQ mac/vlan filter: Each pool the vhost device is bind to is
assigned a mac/vlan filter.
3. num_devices is used to specify the maximum vhost devices the nic supports.
Huawei Xie [Wed, 8 Oct 2014 18:54:37 +0000 (02:54 +0800)]
vhost: remove useless code for Rx/Tx
Remove all other codes and only keep virtio_dev_rx, copy_from_mbuf_to_vring,
virtio_dev_merge_rx, virtio_dev_merge_tx.
Previous vhost merge-able feature introduces another version of tx function,
virtio_dev_merge_tx. Actually it is not related to merge-able feature but is
the fix for memcpy between mbuf and vring descriptors.
This lib will create the tx functions based on virtio_dev_merge_tx.
Signed-off-by: Huawei Xie <huawei.xie@intel.com> Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
[Thomas: do not remove code used or moved later]
Huawei Xie [Wed, 8 Oct 2014 18:54:35 +0000 (02:54 +0800)]
vhost: move from examples to dedicated library
Those files will be refactored in subsequent patches to form user space
vhost library.
Makefile and main.h are removed.
main.c is renamed to vhost_rxtx.c and will provide vring enqueue/dequeue API.
virtio-net.h is renamed to rte_virtio_net.h which is the API header file.
Signed-off-by: Huawei Xie <huawei.xie@intel.com> Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
[Thomas: remove from examples Makefile and merge file renaming]
Pablo de Lara [Wed, 1 Oct 2014 09:49:05 +0000 (10:49 +0100)]
examples: use factorized default Rx/Tx configuration
For apps that were using default rte_eth_rxconf and rte_eth_txconf
structures, these have been removed and now they are obtained by
calling rte_eth_dev_info_get, just before setting up RX/TX queues.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> Acked-by: David Marchand <david.marchand@6wind.com>
Pablo de Lara [Wed, 1 Oct 2014 09:49:04 +0000 (10:49 +0100)]
i40e: set default Rx/Tx configuration
Many sample apps use duplicated code to set rte_eth_txconf and rte_eth_rxconf
structures. This patch allows the user to get a default optimal RX/TX configuration
through rte_eth_dev_info get, and still any parameters may be tweaked as wished,
before setting up queues.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> Reviewed-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: David Marchand <david.marchand@6wind.com>
[Thomas: split patch]
Pablo de Lara [Wed, 1 Oct 2014 09:49:04 +0000 (10:49 +0100)]
ixgbe: set default Rx/Tx configuration
Many sample apps use duplicated code to set rte_eth_txconf and rte_eth_rxconf
structures. This patch allows the user to get a default optimal RX/TX configuration
through rte_eth_dev_info get, and still any parameters may be tweaked as wished,
before setting up queues.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> Reviewed-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: David Marchand <david.marchand@6wind.com>
[Thomas: split patch]
Pablo de Lara [Wed, 1 Oct 2014 09:49:04 +0000 (10:49 +0100)]
igb: set default Rx/Tx configuration
Many sample apps use duplicated code to set rte_eth_txconf and rte_eth_rxconf
structures. This patch allows the user to get a default optimal RX/TX configuration
through rte_eth_dev_info get, and still any parameters may be tweaked as wished,
before setting up queues.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> Reviewed-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: David Marchand <david.marchand@6wind.com>
[Thomas: split patch]
Pablo de Lara [Wed, 1 Oct 2014 09:49:04 +0000 (10:49 +0100)]
ethdev: get default Rx/Tx configuration from dev info
Many sample apps use duplicated code to set rte_eth_txconf and rte_eth_rxconf
structures. This patch allows the user to get a default optimal RX/TX configuration
through rte_eth_dev_info get, and still any parameters may be tweaked as wished,
before setting up queues.
Besides, if a NULL pointer is passed to rte_eth_rx_queue_setup or
rte_eth_tx_queue_setup, these functions get internally the default RX/TX
configuration for the user.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> Reviewed-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: David Marchand <david.marchand@6wind.com>
[Thomas: split patch]
Pablo de Lara [Wed, 1 Oct 2014 09:49:03 +0000 (10:49 +0100)]
ethdev: reset whole dev info structure before filling
To guarantee that RX/TX configuration structures are reseted
before modifying them, plus the other dev info fields,
dev info structure is zeroed beforehand.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> Acked-by: David Marchand <david.marchand@6wind.com>
app/testpmd: print message if queue start/stop is not supported
Print an error message to the user when trying to start/stop a rx/tx queue and
this function is not supported by the PMD driver. The patch does not check if
the return value is -EINVAL because testpmd is already validating the port and
queue id.
Signed-off-by: Nicolás Pernas Maradei <nico@emutex.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
librte_pmd_pcap driver was opening the pcap/interfaces only at init time and
closing them only when the port was being stopped. This behaviour would cause
problems (leading to segfault) if the user closed the port 2 times. The first
time the pcap/interfaces would be normally closed but libpcap would throw an
error causing a segfault if the closed pcaps/interfaces were closed again.
This behaviour is solved by re-openning pcaps/interfaces when the port is
started (only if these weren't open already for example at init time).
Signed-off-by: Nicolás Pernas Maradei <nico@emutex.com> Acked-by: Neil Horman <nhorman@tuxdriver.com>
Pablo de Lara [Wed, 1 Oct 2014 22:27:25 +0000 (23:27 +0100)]
ixgbe: fix build with bypass enabled
Since commit aae1047905621 ("use the right debug macro"),
DEBUGOUT was replaced by PMD_DRV_LOG which requires at least
2 arguments. But the level argument was missing.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
This patch takes the existing TX flags defined for the mbuf and shifts
each uniquely defined one left so that additional RX flags can be
defined without having RX and TX flags mixed together. Under the new
scheme, RX flags start at bit 0 and work left, TX flags start at bit 55
and work right, and bits 56-63 are reserved for generic mbuf use, not
for offloads.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Reviewed-by: Neil Horman <nhorman@tuxdriver.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Bruce Richardson [Tue, 23 Sep 2014 11:08:15 +0000 (12:08 +0100)]
app/testpmd: change rxfreet default to 32
To improve performance by using bulk alloc or vectored RX routines, we
need to set rx free threshold (rxfreet) value to 32, so make this the
testpmd default.
Thirty-two is the minimum setting needed to enable either the
bulk alloc or vector RX routines inside the ixgbe driver, so it's
best made the default for that reason. Please see
"check_rx_burst_bulk_alloc_preconditions()" in ixgbe_rxtx.c, and
RX function assignment logic in "ixgbe_dev_rx_queue_setup()" in
the same file.
The difference in IO performance for testpmd when called without any
optional parameters, and using 10G NICs using the ixgbe driver, can be
significant - approx 25% or more.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Bruce Richardson [Tue, 23 Sep 2014 11:08:14 +0000 (12:08 +0100)]
ixgbe: add prefetch to improve slow-path tx perf
Make a small improvement to slow path TX performance by adding in a
prefetch for the second mbuf cache line.
Also move assignment of l2/l3 length values only when needed.
What I've done with the prefetches is two-fold:
1) changed it from prefetching the mbuf (first cache line) to prefetching
the mbuf pool pointer (second cache line) so that when we go to access
the pool pointer to free transmitted mbufs we don't get a cache miss. When
clearing the ring and freeing mbufs, the pool pointer is the only mbuf
field used, so we don't need that first cache line.
2) changed the code to prefetch earlier - in effect to prefetch one mbuf
ahead. The original code prefetched the mbuf to be freed as soon as it
started processing the mbuf to replace it. Instead now, every time we
calculate what the next mbuf position is going to be we prefetch the mbuf
in that position (i.e. the mbuf pool pointer we are going to free the mbuf
to), even while we are still updating the previous mbuf slot on the ring.
This gives the prefetch much more time to resolve and get the data we need
in the cache before we need it.
In terms of performance difference, a quick sanity test using testpmd
on a Xeon (Sandy Bridge uarch) platform showed performance increases
between approx 8-18%, depending on the particular RX path used in
conjuntion with this TX path code.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Bruce Richardson [Tue, 23 Sep 2014 11:08:17 +0000 (12:08 +0100)]
mbuf: switch vlan_tci and reserved2 fields
Move the vlan_tci field up by two bytes in the mbuf data structure. This
has two effects:
* Ensures the the ixgbe vector driver places the vlan tag in the correct
place in the mbuf.
* Allows a second vlan tag field, if one is added in the future, to be
placed after the existing vlan field, rather than before.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Bruce Richardson [Tue, 23 Sep 2014 11:08:16 +0000 (12:08 +0100)]
mbuf: add userdata pointer field
While some applications may store metadata about packets in the packet
mbuf headroom, this is not a workable solution for packet metadata which
is either:
* larger than the headroom (or headroom is needed for adding pkt headers)
* needs to be shared or copied among packets
To support these use cases in applications, we reserve a general
"userdata" pointer field inside the second cache-line of the mbuf. This
is better than having the application store the pointer to the external
metadata in the packet headroom, as it saves an additional cache-line
from being used.
Apart from storing metadata, this field also provides a general 8-byte
scratch space inside the mbuf for any other application uses that are
applicable.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Bruce Richardson [Tue, 23 Sep 2014 11:08:13 +0000 (12:08 +0100)]
mbuf: ensure next pointer is set to null on free
The receive functions for packets do not modify the next pointer so
the next pointer should always be cleared on mbuf free, just in case.
The slow-path TX needs to clear it, and the standard mbuf free function
also needs to clear it. Fast path TX does not handle chained mbufs so
is unaffected
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Overloading the 'msg_size' field in the 'arq_event_info' struct
is a bad idea. It leads to bugs when the structure is used in a
loop, since the input value (buffer size) is overwritten by the
output value (actual message length). The fix introduces one
more field of 'buf_len' for the buffer size, and renames the
field of 'msg_size' to 'msg_len' for the real message size.
The firmware api request of writes to hardware registers should be
exposed to driver. The new API of 'i40e_aq_debug_write_register'
is introduced for that.
There are variables that represent values in little endian.
Adding prefix of '__Le' can remove warnings during sparse
checks. In addition, remove some unreachable 'break' statements,
and add 'UL' on a couple of constants.
The code wrapped in '#ifdef I40E_TPH_SUPPORT' was added
to check if 'TPH' (TLP Processing Hints) is supported, and enable it.
It is not used currently and can be removed.
The code wrapped in '#ifdef PREBOOT_SUPPORT' was added for
queue context initialization specifically for A0 silicon.
As A0 silicon has gone for a long time, the code should be
removed at all. In addition, the checks of 'QV_RELEASE'
and 'PREBOOT_SUPPORT' are also not needed anymore and can
be removed.
'nvmupdate' is intended to support the userland NVMUpdate tool for
Fortville eeprom. These code changes is to remove the conditional
compile macro, and support those by default. In addition, renaming
all 'errno' to avoid any compile warning or error.
In share code, 'tab' is used to align values rather than 'space'.
The changes in i40e_adminq_cmd.h is to make the indentation more
consistent in share code.
Add new file to support controller X550, therefore update the Makefile
and README file. It also updates the API functions, DCB related functions,
mailbox related functions, etc to support X550.
In addition, some new macros used by X550 are added.
- Store lan_id and physical semaphore mask into hardware physical information,
and use them to control read and write physical registers in IXGBE base code.
- Extend mask from 16 bits to 32 bits for releasing or acquiring SWFW semaphore
in IXGBE base code. It is used in reading and writing I2C byte.
Daniel Mrzyglod [Tue, 30 Sep 2014 12:10:25 +0000 (13:10 +0100)]
kni: fix build on Ubuntu 12.04.5
Recent Ubuntu 12.04.5 LTS is shipped with 3.13.0-36.63 as the only
supported kernel.
So skb_set_hash has been backported and is conflicting with kni kcompat one.
Commit a09b359daca ("fix build on Ubuntu 14.04") describes the initial problem.
Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
[Thomas: reorder conditions to ease reading] Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Bruce Richardson [Tue, 30 Sep 2014 09:40:08 +0000 (10:40 +0100)]
ixgbe: fix build with clang
Clang fails with an error about a variable being used uninitialized:
lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c:67:30:
error: variable 'dma_addr0' is uninitialized
when used here [-Werror,-Wuninitialized]
dma_addr0 = _mm_xor_si128(dma_addr0, dma_addr0);
^~~~~~~~~
This error can be fixed by replacing the call to xor which
takes two parameters, by a call to setzero, which does not take any.
Reported-by: Keith Wiles <keith.wiles@windriver.com> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Thomas Monjalon [Wed, 17 Sep 2014 16:11:12 +0000 (18:11 +0200)]
doc: apply one comment to all members of a group
A doxygen group begins with /**@{*/ and ends with /**@}*/.
By enabling DISTRIBUTE_GROUP_DOC, the first comment is applied
to each undocumented member of the group.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Thomas Monjalon [Fri, 26 Sep 2014 15:46:38 +0000 (17:46 +0200)]
pci: remove flag for multiple devices with single id
The flag RTE_PCI_DRV_MULTIPLE was used to register an eth_driver allowing
multiples devices with a single PCI id.
It is now possible to register a pci_driver and create ethdev objects
using rte_eth_dev_allocate().
Suggested-by: David Marchand <david.marchand@6wind.com> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
David Marchand [Tue, 26 Aug 2014 14:11:39 +0000 (16:11 +0200)]
eal: set iopl only when needed
There is no need for ioport access for applications that won't use virtio pmds.
Make rte_eal_iopl_init() non-static so that it is called from pmds that need it.
Signed-off-by: David Marchand <david.marchand@6wind.com> Acked-by: Huawei Xie <huawei.xie@intel.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
David Marchand [Tue, 26 Aug 2014 14:11:38 +0000 (16:11 +0200)]
eal/bsd: fix fd leak
From man(4) io:
"The initial implementation simply raised the IOPL of the current thread
when open(2) was called on the device. This behaviour is retained in the
current implementation as legacy support for both i386 and amd64."
http://www.freebsd.org/cgi/man.cgi?query=io&sektion=4
Nothing prevents from closing it just after.
Signed-off-by: David Marchand <david.marchand@6wind.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Thomas Monjalon [Fri, 26 Sep 2014 11:42:51 +0000 (13:42 +0200)]
examples: do not probe pci twice
Since commit a155d430119 ("support link bonding device initialization"),
rte_eal_pci_probe() is called in rte_eal_init().
So it doesn't have to be called by application anymore.
It has been fixed for testpmd in commit 2950a769315,
and this patch remove it from other applications.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com> Acked-by: David Marchand <david.marchand@6wind.com> Acked-by: Neil Horman <nhorman@tuxdriver.com>
David Marchand [Tue, 26 Aug 2014 14:12:17 +0000 (16:12 +0200)]
eal: revert link bonding specific initialization
Revert commit a155d430119 ("support link bonding device initialization"),
except PCI probing at rte_eal_init time.
Signed-off-by: David Marchand <david.marchand@6wind.com> Acked-by: Neil Horman <nhorman@tuxdriver.com>
[Thomas: merge revert with PCI probing restore] Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
David Marchand [Tue, 26 Aug 2014 14:12:16 +0000 (16:12 +0200)]
bond: move param parsing in configure step
Rework bond pmd initialisation so that we don't need to modify eal
for this pmd to work.
Signed-off-by: David Marchand <david.marchand@6wind.com> Acked-by: Neil Horman <nhorman@tuxdriver.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Thomas Monjalon [Fri, 26 Sep 2014 12:36:05 +0000 (14:36 +0200)]
ixgbe: allow unsupported SFP
No need to restrict usage of non Intel SFP.
If (hw->phy.type == ixgbe_phy_sfp_intel) is false,
a warning will be logged.
It was disabled for ixgbe and enabled but unused for i40e.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
ixgbe: fix crash caused by bulk allocation failure
Since the introduction of vector PMD, a bug in ixgbe_rxq_rearm could
cause a crash. As long as the memory pool allocated to the RX queue
has mbufs available, there is no problem. After allocation of _all_
mbufs from the memory pool, previously returned mbufs by
rte_eth_rx_burst could be accessed by subsequent calls to the PMD and
could be returned by subsequent calls to rte_eth_rx_burst. From the
perspective of the application, the means that fields within the mbuf
could change and that previously allocated mbufs could appear multiple
times.
After failure of mbuf allocation, the dd bits should indicate that the
packets are not ready. For this, this patch adds code to reset the dd
bits in the first RTE_IXGBE_DESCS_PER_LOOP packets of the next
RTE_IXGBE_RXQ_REARM_THRESH packets only if the next
RTE_IXGBE_RXQ_REARM_THRESH packets that will be accessed contain
previously allocated packets.
Setting the bits is not enough. The bits are checked _after_ setting
the mbuf fields, thus a mechanism is needed to prevent the previously
used mbuf pointers from being accessed during the speculative load of
the mbuf fields. For this reason, not only the dd bits are reset, but
also the mbufs associated to those descriptors are set to point to a
"fake" mbuf.
Signed-off-by: Balazs Nemeth <balazs.nemeth@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Pawel Wodkowski [Wed, 20 Aug 2014 07:46:28 +0000 (08:46 +0100)]
ixgbe: fix id and hash with flow director
When Flow Director was used together with bulk alloc, id and hash
was swapped when packet matches flow director filter due to improper
fdir field initialization.
igb_ethdev.c contains function eth_igb_infos_get() which should set
number of tx/rx queues supported by the hardware. It contains huge
[switch] but there is no i211 case!
Also, there are few other places which mention i210, but not mention i211.
I didn't check it enough to say it is totally correct.
For now I see that it just able to send and receive some packets.
ethdev: new method to retrieve extended statistics
This method can be implemented by a poll mode driver to provide
non-standard statistics (which are not part of the generic statistics
structure). Each statistic is returned in a generic form: "name" and
"value" and can be used to dump PMD-specific statistics in the same way
than ethtool in linux kernel.
If the PMD does not provide the xstats_get and xstats_set functions, the
ethdev API will return the generic statistics in the xstats format
(name, value).
This commit opens the door for a clean-up of the generic statistics
structure, only keeping statistics that are really common to all PMDs
and moving specific ones into the xstats API.
Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Reviewed-by: David Marchand <david.marchand@6wind.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
[Thomas: fix some comments] Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
David Marchand [Mon, 22 Sep 2014 08:38:00 +0000 (10:38 +0200)]
eal: rework long options parsing
Identify all options through the getopt_long return value.
This way, we only need a big switch/case.
Indentation is broken to ease commit review (fixed in next commit).
Suggested-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: David Marchand <david.marchand@6wind.com> Acked-by: Neil Horman <nhorman@tuxdriver.com>