No need to keep residues of a fix which is replaced by another one.
This reverts commit 5a6d9897f9
(residual fix about resetting big Tx queues).
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
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>
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>
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>
In rte.sdkbuild.mk with CONFIG_RTE_LIBRTE_PMD_PCAP=y,
we error-exit if LIBPCAP_CFLAGS is empty.
On some distros (e.g., Centos 6.4), it is normal for "pcap-config --cflags"
to output only a newline, because pcap header files reside in /usr/include/.
Solution is to remove the line that checks whether LIBPCAP_CFLAGS is empty.
Signed-off-by: Robert Sanford <rsanford@prolexic.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Use pcap-config to populate CFLAGS and LDFLAGS.
LIBPCAP_CFLAGS and LIBPCAP_LDFLAGS can be used to override this (useful when
cross-compiling).
Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
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>
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>
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>
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>
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>
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>
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>
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>
Since DPDK 1.4, if RTE_EAL_UNBIND_PORTS is disabled, igb_uio mapping is
done for all devices (commit eee16c964c), 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 a22f5ce8fc).
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>
Since DPDK 1.4, bars mapping is checked and prevent from initializing
drivers which do not use igb_uio mapping (see commit eee16c964c).
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>
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.
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>
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>
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>
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>
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>
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>
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>
Extract rte_mem_virt2phy() from get_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>
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>
TSC frequency was guessed by reading CLOCK_MONOTONIC_RAW or sleeping 1 sec.
Now, read frequency from cpuinfo first.
Keep other methods as fallbacks.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Ivan Boule <ivan.boule@6wind.com>
Read flags from /proc/cpuinfo and warn if constant_tsc or nonstop_tsc is
not found.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Ivan Boule <ivan.boule@6wind.com>
Checkin
a132a9cf2b 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>
This reverts commit "log: get full path as syslog id" (494a02537f)
and restore the original patch from Stephen Hemminger (04210699ee).
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Reference the new library in doxygen.
Move also some items from misc to a new basic section.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Add a file app/test/test_kvargs.c that checks the rte_kvargs API.
The test passes:
RTE>>kvargs
== test valid case ==
== test invalid case ==
PMD: Error parsing device, invalid key <wrong-key>
Test OK
I also tested that rte_eth_pcap runs with the following arguments:
./app/testpmd -c 0x15 -n 3 --proc-type=primary --huge-dir=/mnt/huge \
--use-device="eth_pcap0;iface=ixgbe0" \
-- -i --port-topology=chained
./app/testpmd -c 0x15 -n 3 --proc-type=primary --huge-dir=/mnt/huge \
--use-device="eth_pcap0;rx_iface=ixgbe0;rx_iface=ixgbe1;tx_iface=ixgbe0" \
-- -i --port-topology=chained
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
This macro was used for blacklist parsing but is not used anymore
since commit 5a55b9ac91.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
1) In the EAL initialization phase, invoke the function rte_eal_cpu_init
to detect the set of running cores (and enable them by default) before
processing the [enabled] core mask option that is performed during the
parsing of EAL arguments.
2) In the function rte_eal_cpu_init():
- to parse the set of all running logical cores on the machine, do not
use the RTE_LCORE_FOREACH macro that considers the set of already
detected cores...
Instead, use a standard loop based on the RTE_MAX_LCORE constant.
- explicitely set to ROLE_RTE the role of each detected logical core
that is recorded in the EAL configuration, as all running cores are
enabled by default.
3) In the function eal_parse_coremask(), update the "lcore_count" field
of the EAL configuration with the effective number of logical cores
that are set in the mask of enabled logical cores.
Signed-off-by: Ivan Boule <ivan.boule@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Adding or subtracting a value to a pointer makes a new pointer
of unknown type.
So typeof() is replaced by (void*) in RTE_PTR_ADD() and RTE_PTR_SUB().
But RTE_PTR_ALIGN_* macros have in their explicit API to return a pointer
of the same type. Since RTE_PTR_ALIGN_CEIL is based on RTE_PTR_ADD, a
typeof() is added to keep the original behaviour.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Add an option to specify libraries to be loaded before probing the PCI.
For instance, testpmd -d librte_pmd_xxx.so can be used to enable xxx driver
support on testpmd without any recompilation of testpmd.
Plugins are loaded before creating threads because we want the threads to
inherit any property that could be set while loading a plugin, such as iopl().
Signed-off-by: Damien Millescamps <damien.millescamps@6wind.com>
Signed-off-by: Jean-Mickael Guerin <jean-mickael.guerin@6wind.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Before recompiling a file, rte.compile-pre.mk checks whether the command
line is different from the previous one.
This is done by storing for each object file the entire command line in a
kind of dependency file with a .cmd extension (see obj2cmd). If that file
exists, the line is retrieved first and compared against $(C_TO_O_STR).
The object file gets recompiled if the file doesn't exist or if the line
is different.
The problem is that sometimes, files are recompiled for no apparent reason.
The check doesn't work properly when a command line contains double-quoted
strings such as -DFOO='"bar"' because the shell interprets and strips them.
This is fixed by protecting C_TO_O_CMD with simple quotes, knowing that
such quotes are already escaped in C_TO_O_STR.
Moreover, because simple quotes are escaped in C_TO_O_STR, the retrieved
command should be compared against C_TO_O instead.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
The GCC prefix -Wl was ignored because the command line value has higher priority.
It ended in impossibilty for GCC to pass parameters to LD.
The prefixed value must override the command line one.
Signed-off-by: Julien Courtat <julien.courtat@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Add mk/rte.shared.mk and mk/rte.extshared.mk in framework to
allow shared libraries compilation through framework
Signed-off-by: Didier Pallard <didier.pallard@6wind.com>
Acked-by: Ivan Boule <ivan.boule@6wind.com>