summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2014-02-26version: 1.5.2r2v1.5.2r2Thomas Monjalon
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-02-26timer: add precise TSC functionDidier Pallard
According to Intel Developer's Manual: "The RDTSC instruction is not a serializing instruction. It does not necessarily wait until all previous instructions have been executed before reading the counter. Simi- larly, subsequent instructions may begin execution before the read operation is performed. If software requires RDTSC to be executed only after all previous instruc- tions have completed locally, it can either use RDTSCP (if the processor supports that instruction) or execute the sequence LFENCE;RDTSC." So add a rte_rdtsc_precise function that do a memory barrier before rdtsc to synchronize operations and ensure that the TSC read is done at the expected place. Use r/w memory barrier instead of lfence to serialize both loads and stores. Signed-off-by: Didier Pallard <didier.pallard@6wind.com> Reviewed-by: François-Frédéric Ozog <ff@ozog.com> Reviewed-by: Konstantin Ananyev <konstantin.ananyev@intel.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-02-25hash: reverse the operand order to crc32H. Peter Anvin
Checkin a132a9cf2bcd440a974b9d3f5c44ba30b2c895a1 hash: use intrinsic changed the rte_hash_crc.h from using the crc32 instruction via inline assembly to using an intrinsic. The intrinsic should allow for better compiler performance, but the change did not account for the fact that the inline assembly being in AT&T syntax used the opposite operand order of the intrinsic. This turns out to not matter for correctness, because the CRC32 operation is commutative. However, it could potentially matter for performance, because the loop is more efficient with the moving pointer in the source operand and the accumulation in the destination operand. This was discovered by Jan Beulich when looking at the equivalent code in the Linux kernel. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Reported-by: Jan Beulich <jbeulich@suse.com> Reported-by: Pashupati Kumar <kumarp@brocade.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-02-04kni: fix build with kernel 3.14Aaro Koskinen
ether_addr_equal() was added in Linux 3.5. compare_ether_addr() was deleted in 3.14. Start using ether_addr_equal() and provide an own implementation for older kernels. This fixes the compilation with Linux 3.14-rc1. Signed-off-by: Aaro Koskinen <aaro.koskinen@nsn.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-02-04kvargs: make the NULL key to match all entriesOlivier Matz
In rte_kvargs_process() and rte_kvargs_count(), if the key_match argument is NULL, process all entries. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2014-02-04kvargs: add the key in handler pametersOlivier Matz
This argument can be useful when rte_kvargs_process() is called with key=NULL, in this case the handler is invoked for all entries of the kvlist. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2014-02-04kvargs: add const attribute in handler parametersOlivier Matz
The "value" argument is read-only and should be const. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2014-02-04kvargs: be strict when matching a keyOlivier Matz
When we match a key in is_valid_key() and rte_kvargs_process(), do a strict comparison (strcmp()) instead of using strstr(s1, s2) which tries a find s1 in s2. This old behavior could lead to unexpected match, for instance "cola" match "chocolate". Surprisingly, no patch was needed on rte_kvargs_count() as it already used strcmp(). Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2014-02-04kvargs: simpler parsing and allow duplicated keysOlivier Matz
Remove the rte_kvargs_add_pair() function whose only role was to check if a key is duplicated. Having duplicated keys is now allowed by kvargs API. Also replace rte_strsplit() by more a standard function strtok_r() that is easier to understand for people already knowing the libc. It also avoids useless calls to strnlen(). The delimiters macros become strings instead of chars due to the strtok_r() API. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2014-02-04kvargs: rework API to fix memory leakOlivier Matz
Before the patch, a call to rte_kvargs_tokenize() resulted in a call to strdup() to allocate a modifiable copy of the argument string. This string was never freed, excepted in the error cases of rte_kvargs_tokenize() where rte_free() was wrongly called instead of free(). In other cases, freeing this string was impossible as the pointer not saved. This patch introduces rte_kvargs_free() in order to free the structure properly. The pointer to the duplicated string is now kept in the rte_kvargs structure. A call to rte_kvargs_parse() directly allocates the structure, making rte_kvargs_init() useless. The only drawback of this API change is that a key/value associations cannot be added to an existing kvlist. But it's not used today, and there is not obvious use case for that. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2014-02-04kvargs: remove useless size fieldOlivier Matz
This value was not very useful as the size of the table is fixed (equals RTE_KVARGS_MAX). By the way, the memset in the initialization function was wrong (size too short). Even if it was not really an issue since we rely on the "count" field, it is now fixed by this patch. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2014-02-04kvargs: remove driver name in argumentsOlivier Matz
Now that rte_kvargs is a generic library, there is no need to have an argument for the driver name in rte_kvargs_tokenize() and rte_kvargs_parse() prototypes. This argument was only used to log the driver name in case of error. Instead, we can add a log in init function of pmd_pcap and pmd_ring. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2014-02-04kvargs: use the new library in pmd_pcapOlivier Matz
The rte_kvargs library is a reworked copy of rte_eth_pcap_arg_parser, so it provides the same service. Therefore we can use it and remove the code of rte_eth_pcap_arg_parser. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2014-02-04kvargs: add a new library to parse key/value argumentsOlivier Matz
Copy the code from rte_eth_pcap_arg_parser.[ch], without any functional modifications, only: - rename functions and structure - restyle (indentation) - add comments (doxygen style) - add "const" or "static" attributes, remove unneeded "inline" Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2014-01-28pci: add option --create-uio-dev to run without hotplugOlivier Matz
When the user specifies --create-uio-dev in dpdk eal start options, the DPDK will create the /dev/uioX instead of waiting that a program does it (which is usually hotplug). This option is useful in embedded environments where there is no hotplug to do the work. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-01-28pci: split the function providing uio device and mappingsOlivier Matz
Add a new function pci_get_uio_dev() that parses /sys/bus/pci/devices to get the uio device associated with a PCI device. This patch just moves some code that was in pci_uio_map_resource() in the new function without any functional change. Thanks to this change, the next commit will be easier to understand. Moreover it improves readability: having smaller functions help to understand what pci_uio_map_resource() does. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-01-27spinlock: fix build with clangOlivier Matz
LLVM clang requires an explicitly sized "cmp" assembly instruction. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-01-27pcap: save if_index of the bound deviceMats Liljegren
Use command line parameters to get the name of the interface. This name is converted into if_index, which is provided as device info. Signed-off-by: Mats Liljegren <mats.liljegren@enea.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-01-27ethdev: introduce if_index in device infoMats Liljegren
This field is intended for pcap to describe the name of the interface as known to Linux. It is an interface index, but can be translated into an interface name using if_indextoname() function. When using pcap, interrupt affinity becomes important, and this field gives the application a chance to ensure that interrupt affinity is set to the lcore handling the device. Signed-off-by: Mats Liljegren <mats.liljegren@enea.com> Reviewed-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-01-16version: 1.5.2r1v1.5.2r1Thomas Monjalon
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-01-15version: add 4th digit and helper macrosThomas Monjalon
Applications can test versions, for compatibility, this way: #if RTE_VERSION >= RTE_VERSION_NUM(1,2,3,4) RTE_VERSION was already defined for use with rte_config. It is moved in rte_version.h and updated to current version number. Note that the first tag having this helper is 1.2.3r2. Releases r0 have not this patch. Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com> Acked-by: Olivier Matz <olivier.matz@6wind.com>
2014-01-15kni: fix build with kernel < 3.3 with netdev_features_t backportAdrien Mazarguil
The netdev_features_t typedef appeared in Linux 3.3, but checking the kernel version isn't enough with some distributions (such as Debian Wheezy) that backported it into 3.2, causing a compilation failure due to redefinition. Since the presence of a typedef can't be tested at compile time, this commit adds type kni_netdev_features_t, which, depending on the kernel version, translates either to u32 or netdev_features_t. Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-01-15kni: fix build with 802.1p kernel supportThomas Monjalon
C90 compilers forbid mixed declaration and code. Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2014-01-15ixgbe: fix offloading bits when Rx bulk alloc is usedBryan Benson
This is a fix for the ixgbe hardware offload flags not being set when bulk alloc RX is used. The issue was caused by masking off the bits that store the hardware offload values in the status_error field to retrieve the done bit for the descriptor. Commit 7431041062b9fd0555bac7ca4abebc99e3379fa5 in DPDK-1.3.0 introduced bulk dequeue, which included the bug. Signed-off-by: Bryan Benson <bmbenson@amazon.com> Acked-by: Ivan Boule <ivan.boule@6wind.com>
2014-01-15ixgbe: query assignment of VF queuesQinglai Xiao
Physical Function assignes Tx/Rx queues to each Virtual Function according to different schemes[1]. By querying through mailbox, VF is able to get number of Tx/Rx queues assigned to it. Note that current Intel ixgbe driver ixgbe-3.18.7 does not fully support mailbox message IXGBE_VF_GET_QUEUES. The service routine for IXGBE_VF_GET_QUEUES must be fixed, otherwise PF always return 1 as Tx/Rx queue number. [1] See section 7.2.1.2.1, 7.1.2.2 and 7.10.2.7.2 of Intel 82599 10 Gbe Controller Datasheet. Signed-off-by: Qinglai Xiao <jigsaw@gmail.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-01-15ixgbe: add Tx->Rx loopback mode for 82599Qinglai Xiao
82599 has two loopback operation modes, Tx->Rx and Rx->Tx. For the time being only Tx->Rx is supported. The new field lpbk_mode added in struct rte_eth_conf defines loopback operation mode for certain ethernet controller. By default the value of lpbk_mode is 0, meaning loopback mode disabled. Since each ethernet controller has its own definition of loopback modes, API user has to check both datasheet and implementation of certain driver so as to understand what are valid values to be set, and what are the expected behaviors. Check IXGBE_LPBK_82599_XXX which are defined in ixgbe_ethdev.h for valid values of 82599 loopback mode. Signed-off-by: Qinglai Xiao <jigsaw@gmail.com> Acked-by: Ivan Boule <ivan.boule@6wind.com> Acked-by: Venky Venkatesan <venky.venkatesan@intel.com>
2014-01-15ixgbe: remove residual fix about resetting big Tx queuesThomas Monjalon
No need to keep residues of a fix which is replaced by another one. This reverts commit 5a6d9897f91f6bb4b2 (residual fix about resetting big Tx queues). Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-01-15igb/ixgbe: allow RSS with only one Rx queueMaxime Leroy
It should be possible to enable RSS with one Rx queue. RSS hash can be useful independently of the number of Rx queues. Applications can use RSS hash to identify different IP flows. Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com> Acked-by: Ivan Boule <ivan.boule@6wind.com>
2014-01-15igb/ixgbe: ETH_MQ_RX_NONE should disable RSSMaxime Leroy
As explained in rte_ethdev.h, ETH_MQ_RX_NONE allows to not choose RSS, DCB or VMDQ mode. But the igb/ixgbe code always silently select the RSS mode with ETH_MQ_RX_NONE. This patch fixes this incoherence between the API and the implementation. Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com> Acked-by: Ivan Boule <ivan.boule@6wind.com>
2014-01-15igb: restore workaround errata with wthresh on 82576Stephen Hemminger
The 82576 has known issues which require the write threshold to be set to 1. See: http://download.intel.com/design/network/specupdt/82576_SPECUPDATE.pdf If not then single packets will hang in transmit ring until more arrive. Simple tests like ping will fail. The workaround was in the wrong file (commit a30ebfbb8c3a). Move it in igb one to restore original patch (7e9e49feea). Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-01-15pcap: fix build when pcap_sendpacket is unavailableDavid Marchand
Before libpcap 1.0.0, pcap_sendpacket was not available on linux targets (unless backported). When using such a library, we won't be able to send packet on the wire, yet we can still dump packets into a pcap file. Signed-off-by: David Marchand <david.marchand@6wind.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-01-15pcap: fix build with old libpcapDavid Marchand
For backwards compatibility, pcap.h includes pcap/pcap.h. Hence, to be compatible with older pcap libraries, we must include pcap.h. Signed-off-by: David Marchand <david.marchand@6wind.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-01-15pcap: remove unused constantThomas Monjalon
RTE_ETH_PCAP_MBUFS is not used anymore since commit 6eb0ae218a9803bc0 (pcap: fix mbuf allocation). Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-01-15ethdev: fix non-reconfigurable pmd initThomas Monjalon
Some Poll-Mode Drivers (PMD) are not reconfigurable and, thus, do not implement (rx|tx)_queue_release functions. For these drivers, the functions rte_eth_dev_(rx|tx)_queue_config must return an ENOTSUP error only when reconfiguring, but not at initial configuration. Move the FUNC_PTR_OR_ERR_RET check into the case of reconfiguration. Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com> Acked-by: Ivan Boule <ivan.boule@6wind.com>
2014-01-15ethdev: add pause frame counters for em/igb/ixgbeIvan Boule
Add into the `rte_eth_stats` data structure 4 (64-bit) counters of XOFF/XON pause frames received and sent on a given port. Update em, igb, and ixgbe drivers to return the value of the 4 XOFF/XON counters through the `rte_eth_stats_get` function exported by the DPDK API. Display the value of the 4 XOFF/XON counters in the `testpmd` application. Signed-off-by: Ivan Boule <ivan.boule@6wind.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-01-15ethdev: add support for device offload capabilitiesIvan Boule
1) Make device RX and TX offload capabilities to be returned in the rte_eth_dev_info data structure by the function rte_eth_dev_info_get The following initial set of RX offload capabilities are defined: - VLAN header stripping - IPv4 header checksum check - UDP checksum check - TCP checksum check - TCP large receive offload (LRO) The following initial set of TX offload capabilities are defined: - VLAN header insertion - IPv4 header checksum computation - UDP checksum computation - TCP checksum computation - SCTP checksum computation - TCP segmentation offload (Transmit Segmentation Offload) - UDP segmentation offload 2) Update the eth_dev_infos_get() function of the igb and ixgbe PMDs to return the offload capabilities which are supported by the device and that are effectively managed by the driver. Signed-off-by: Ivan Boule <ivan.boule@6wind.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-01-15pci: support 82546EBThomas Monjalon
Intel 82546EB Gigabit ethernet controller is reported to be working with copper. Tested-by: Ognjen Joldzic <ognjen.joldzic@gmail.com> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-01-15pci: add flag to force unbind deviceDamien Millescamps
Some devices need to be unbound in order to be used via the PMD without kernel module. Signed-off-by: Damien Millescamps <damien.millescamps@6wind.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-01-15pci: use igb_uio mapping only when neededThomas Monjalon
Since DPDK 1.4, if RTE_EAL_UNBIND_PORTS is disabled, igb_uio mapping is done for all devices (commit eee16c964cd), breaking some non-Intel drivers. But pci_uio_map_resource() should only be called for Intel devices (using igb_uio kernel module). The flag RTE_PCI_DRV_NEED_IGB_UIO is set for all those devices, even when RTE_EAL_UNBIND_PORTS is disabled (fixes commit a22f5ce8fcc). Signed-off-by: David Marchand <david.marchand@6wind.com> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com> Acked-by: Damien Millescamps <damien.millescamps@6wind.com>
2014-01-15pci: do not check BAR0 mappingDavid Marchand
Since DPDK 1.4, bars mapping is checked and prevent from initializing drivers which do not use igb_uio mapping (see commit eee16c964cd). There is no need to check for bars mapping, especially BAR0 is not required. If bars mapping failed, then pci_uio_map_resource will fail and we won't reach this check. So get rid of BAR0 check. Signed-off-by: David Marchand <david.marchand@6wind.com> Acked-by: Stephen Hemminger <shemminger@vyatta.com> Acked-by: Damien Millescamps <damien.millescamps@6wind.com>
2014-01-15mem: remove duplicated linesPei Chao
Extra space for future alignment was reserved twice. It was introduced in version 1.3.0 (commit 916e4f4f4e45a1d3cdd473cf9ef). Signed-off-by: Pei Chao <peichao85@gmail.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-01-15mem: fix log for --no-hugeThomas Monjalon
In some cases, it is possible to not use hugepages. So a simple malloc is used to initialize DPDK memory. Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com> Acked-by: Damien Millescamps <damien.millescamps@6wind.com>
2014-01-15mem: fix mempool for --no-hugeDamien Millescamps
In --no-huge mode, mempool provides objects with their associated header/trailer fitting in a standard page (usually 4KB). This means all non-UIO driver should work correctly in this mode, since UIO drivers allocate ring sizes that cannot fit in a page. Extend rte_mempool_virt2phy to obtain the correct physical address when elements of the pool are not on the same physically contiguous memory region. This is a first step for enhancement PR #29696. Reason for this patch is to be able to run on a kernel < 2.6.37 without the need to patch it, since all kernel below are either bugged or don't have huge page support at all (< 2.6.28). Signed-off-by: Damien Millescamps <damien.millescamps@6wind.com> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2014-01-15mem: get hugepages configDamien Millescamps
Allow external libraries and applications to know if hugepages are enabled. Signed-off-by: Damien Millescamps <damien.millescamps@6wind.com> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2014-01-15mem: get memzone from any CPU socket when hugepages are disabledAdrien Mazarguil
When huge pages are disabled, memory is allocated for a single, undefined CPU socket using malloc(), causing rte_memzone_reserve_aligned() to fail most of the time. This patch causes that memory to use SOCKET_ID_ANY instead of 0, and allow it to be used in place of any socket ID specified by user. Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com> Acked-by: Damien Millescamps <damien.millescamps@6wind.com>
2014-01-15mem: fix rte_malloc(SOCKET_ID_ANY), try to allocate on other nodesOlivier Matz
Before this patch, rte_malloc(SOCKET_ID_ANY) was equivalent to rte_malloc(this_socket). If the user specifies SOCKET_ID_ANY, it means that memory can be allocated on any socket. So fix the behavior of rte_malloc() in order to do that. The current CPU socket is still the default, but if it fails, other sockets are tested. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-01-15mem: remove unneeded logOlivier Matz
Remove an error log in memzone_reserve_aligned_thread_unsafe(). It is up to the caller to log the error, and this is already done in DPDK code (especially in network drivers). Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-01-15mem: get physical address of any rte_malloc bufferDidier Pallard
Get physical address of any rte_malloc allocated buffer using function rte_malloc_virt2phy(addr). The rte_memzone pointer is now stored in each allocated memory block header to allow simple computation of physical address of a block using the memzone it comes from. The function rte_malloc_virt2phy has a dependency on rte_memory.h: phys_addr_t must be defined. Signed-off-by: Didier Pallard <didier.pallard@6wind.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-01-15mem: more const qualifiers in malloc APIThomas Monjalon
Some functions don't modify their parameter which should be marked as const. Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2014-01-15mem: get physical address of any pointerDamien Millescamps
Extract rte_mem_virt2phy() from find_physaddr(). rte_mem_virt2phy() permits to obtain the physical address of any virtual address mapped to the current process calling this function. Note that this function is very slow and shouldn't be called after initialization to avoid a performance bottleneck. The memory must be locked with mlock(). The function rte_mem_lock_page() is a mlock() helper that lock the whole page. A better name would be rte_mem_virt2phys but rte_mem_virt2phy is more consistent with rte_mempool_virt2phy. Signed-off-by: Damien Millescamps <damien.millescamps@6wind.com> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com> Acked-by: Olivier Matz <olivier.matz@6wind.com>