Main core can be different than first core (default behavior) as it
can be specified by application argument. It can be useful to
determine if given thread is matching main core.
Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I25292a91ad677806eaf19ad68acdda0f28da6cfb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16596
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
During secondary process shutdown, when nvme device
would get detached, it would trigger env_dpdk to
send rte_eal_hotplug_remove event for the corresponding
BDF. But this isn't valid from a secondary process -
we can only attach/detach from the primary process.
Usually this would just result in a bunch of annoying
print messages as the secondary and primary process
sent rte messages between each other. But occasionally
one of the response messages from the primary process
could arrive just as the secondary process was going
through rte_eal_cleanup. The message would get
kicked to the DPDK intr thread, we would do bus_cleanup
which frees all of the PCI state, and then the message
would execute on the intr thread causing seg faults,
use-after-free or some other violation.
It's possible some kind of cleanup should be
implemented in DPDK, but for now, let's just not
induce incorrect behavior from SPDK, and don't send
the hotplug_remove messages from a secondary
process.
Fixes issue #2651.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ie431a1f8e74503e1de1be36cbb9589682d6dc94a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16553
Reviewed-by: Michal Berger <michal.berger@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
To allow SO_MINOR updates on LTS for the whole year it is supported,
the major version for all components needs to be increased.
This is to prevent scenario where two versions exists with matching
versions, but conflicting ABI.
Ex. Next SPDK release adds an API call increasing the minor version,
then LTS needs just a subset of those additions.
Increasing major so version after LTS, allows the future releases
to update versions as needed. Yet allowing LTS to increase minor
version separately.
Disabled test for increasing SO version without ABI change, as
that is goal of this patch. This check shall be removed with SPDK 23.05
release.
Looks like this was left over from prior LTS, to avoid that
make sure it is only skipped when running against v23.01.x as latest
release.
This patch:
- increases SO_VER by 1 for all components
- resets SO_MINOR to 0 for all components
- removes suppressions for ABI tests
Short reference to how the versions were changed:
MAX=$(git grep "SO_VER := " | cut -d" " -f 3 | sort -ubnr | head -1)
for((i=$MAX;i>0;i-=1)); do find . -name "Makefile" -exec \
sed -i -e "s/SO_VER := $i\$/SO_VER := $(($i+1))/g" {} +; done
find . -name "Makefile" -exec \
sed -i -e "s/SO_MINOR := .*/SO_MINOR := 0/g" {} +
Change-Id: I3e5681802c0a5ac6d7d652a18896997cd07cc8bf
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16419
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This allows to get start address and length of each
memory chunk in order to create app-specific
resources.
Since we don't want to expose rte structure in the
callback, we have to remap rte data types to SPDK.
Signed-off-by: Alexey Marchuk <alexeymar@nvidia.com>
Change-Id: I3865c4cfe532c6a99a5a3c6c983ded8b9a338de1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16324
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This is the port of the vbdev compress logic into the accel
framework. It includes just one enhancement, to only fill each
mbuf in either src or dst array with max "window size" param to
avoid QAT errors. Note that DPDK ISAL PMD was not ported as we
have native ISAL compression in accel now.
Note: ISAL w/DPDK is still built w/this patch, that can't be
removed until the vbdev module moves to accel fw as it still
depends on DPDK ISAL PMD.
Follow-on patches will include addition C API for PMD selection,
this patch just gets equivalent functionality going. Upcoming
patches will also convert the vbdev compress module to use the
accel framework instead of talking directly to compressdev.
More patches will also address comments on vbdev common code
that addressed here would make the review challenging.
This patch also fixes a bug in the ported code that needs to
be fixed here to pass CI. Capability discovery was incorrect
causing all devices to appear to not support chained mbufs,
with the mbuf splitting code this is important to get right.
Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I7f526404819b145ef26e40877122ba80a02fcf51
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15178
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
When initializing SPDK, the used DPDK args are printed.
Unfortunately before each argument a timestamp is added.
Rather than use SPDK_PRINTF for each argument, bunch
up whole line to be printed and then print it in one go.
Please see before:
[2022-12-20 13:52:05.647131] [ DPDK EAL parameters: [2022-12-20
13:52:05.647145] spdk_tgt [2022-12-20 13:52:05.647159] --no-shconf
[2022-12-20 13:52:05.647170] -c 0x1 [2022-12-20 13:52:05.647185]
--huge-unlink [2022-12-20 13:52:05.647199] --log-level=lib.eal:6
[2022-12-20 13:52:05.647221] --log-level=lib.cryptodev:5 [2022-12-20
13:52:05.647232] --log-level=user1:6 [2022-12-20 13:52:05.647251]
--iova-mode=pa [2022-12-20 13:52:05.647261] --base-virtaddr=0x200000000000
[2022-12-20 13:52:05.647275] --match-allocations [2022-12-20
13:52:05.647286] --file-prefix=spdk_pid1352179 [2022-12-20 13:52:05.647307]
]
And after:
[2022-12-20 13:52:29.038353] [ DPDK EAL parameters: spdk_tgt --no-shconf -c
0x1 --huge-unlink --log-level=lib.eal:6 --log-level=lib.cryptodev:5
--log-level=user1:6 --iova-mode=pa --base-virtaddr=0x200000000000
--match-allocations --file-prefix=spdk_pid1358716 ]
Change-Id: I4c6c25818ae99bad942bf61ab590f971d339ffc6
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16031
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Always add -larchive to DPDK static link args if
libarchive is available. This is less fragile than
previous mechanism of trying to remove
RTE_HAS_LIBARCHIVE to keep DPDK from trying to use it.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ib26fc204927d8967b98d416373fc91446169d5af
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15951
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Patch below started checking development version of DPDK
using rte_version_release():
(32e6ffb) env_dpdk: add support for DPDK main branch for 23.03
rte_version_release() is present starting with DPDK 21.11,
so it broke earlier versions like DPDK 20.11 packaged on Fedora 35.
SPDK supports only last two DPDK LTS versions, which does not include DPDK 20.11.
Yet there is no need to break older versions unnecessarily.
Another aspect is that rte_version_release() is marked as experimental,
so it could change in the future. Only using stable rte_version(),
helps with forwards compatibility too.
Change-Id: Id17d643a12dcfc03c2d4688d1bc5030dc339f428
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reported-by: Michal Berger <michal.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16017
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Michal Berger <michal.berger@intel.com>
For validation of upcoming DPDK releases, pci_dpdk needs
to initialize and work.
This patch adds support for testing DPDK main branch,
with appropriate notice given when that DPDK version is used.
Change-Id: I5257beac3a3926bd432d9c00e50858facd21e6f5
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15891
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Since SPDK holds copies of local DPDK headers for DPDK PCI API,
the same headers will now be used as includes.
It was already the case for DPDK 22.11, but not for DPDK 22.07.
Change-Id: I5859a630d1fb20b4ebf8628adb962f5e46c23788
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15969
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Shortly after DPDK 22.11 release it was amended with single
patch, which bumped the minor version.
No changes have occurred to the DPDK PCI API.
Change-Id: I94dadb23b3ad79cfbb21e848d718d909493137d1
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15890
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Michal Berger <michal.berger@intel.com>
Recently while updating the copyright notices
throughout SPDK the headers, env_dpdk copies of
DPDK headers were modified too.
This patch brings them to the exact version as
in DPDK upstream.
Change-Id: If30b8556386a539d81d2fc1a5e42293522ed91f5
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15856
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Michal Berger <michal.berger@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Copies of headers for DPDK PCI API were created before the
actual DPDK 22.11 release. The rte_bus_pci.h was
modified slightly with addition of rte_compat.h
include.
Please see relevant DPDK patch:
(1094dd9)cleanup compat header inclusions
This patch only makes the two align.
Change-Id: Ieb0397c6cf2d9027cf600bd0e064863b3782b846
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15855
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Michal Berger <michal.berger@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
The kernel vfio_pci driver module introduced vf_token checking
mechanism since kernel version 5.7, and has been supported by
DPDK. So add support for it to deal with the scenario of VF.
Signed-off-by: Jun Zeng <jun1.zeng@intel.com>
Change-Id: Ie9700fa395327da4e847c6213167284c148a64e3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14424
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This is in prep for adding a new compressDev accel_fw
module that will contain all of the DPDK compressDev specifics
on it, the vbdev will make calls to the accel_fw instead.
As the accel_fw has SW based compression, we want the configure
option to apply to building the vbdev module but not the accel_sw
software implementation or the upcoming compressdev module.
Renamed to "compress" as reduce is a term specific to the vbdev
implementation of the compression to be provided by the accel_fw
and thus the same reason why we leave the test flag called REDUCE
because it's controlling tests for the reduce library as well as
the vbdev module that is using reduce. The flag does not apply
to the SW implementation of compression.
This does not affect upcoming accel_fw compressdev module, that
will have its own configure option.
Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: If8ed3e48e1e3dabcaad1cd161289e78122cd9d58
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15179
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
The 2211 implementation only gets used when runtime
detects the DPDK version is DPDK 22.11. But we still
compile this file even if it gets built against an
older DPDK.
This is typically fine, except there are some interrupt
APIs that changed in DPDK 21.11, so older DPDKs don't
have some of the functions used in this file. We need
to use ifdefs to allow this to compile.
We will need some more work to handle this case properly,
but this patch at least fixes the 2211.c case for now.
We will probably need a 2108.c file that exactly matches
the 2207.c file except for this interrupt API changes.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I6055694ccbb79845798e750ebb7127ec6c160e2e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15236
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Michal Berger <michal.berger@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Update code for read the virtual address width to use glob to locate the
Intel and AMD iommu capability registers. This code should work for all
AMD numa configurations.
Fixes issue 2730
Signed-off-by: Michael Piszczek <mpiszczek@ddn.com>
Change-Id: Ibf5789087b7e372d892b53101e4c0231809053f0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14961
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Mellanox Build Bot
per Intel policy to include file commit date using git cmd
below. The policy does not apply to non-Intel (C) notices.
git log --follow -C90% --format=%ad --date default <file> | tail -1
and then pull just the 4 digit year from the result.
Intel copyrights were not added to files where Intel either had
no contribution ot the contribution lacked substance (ie license
header updates, formatting changes, etc). Contribution date used
"--follow -C95%" to get the most accurate date.
Note that several files in this patch didn't end the license/(c)
block with a blank comment line so these were added as the vast
majority of files do have this last blank line. Simply there for
consistency.
Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Id5b7ce4f658fe87132f14139ead58d6e285c04d4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15192
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Mellanox Build Bot
DPDK has merged changes which hide remove some DPDK
object such as rte_device and rte_driver from the
public API.
So we add copies of the necessary header files into
our tree, along with a 22.11-specific pci_dpdk
implementation.
These files are copied over exactly, except for one
#include which needs to change from <> to "" so that
it picks up the header in our tree instead of looking
for it in system headers.
Longer-term we may want to look at ways to automated
checking and updating of these header files. DPDK 22.11
isn't officially released yet, so the header files could
change, but we want to get this in now since without
it SPDK cannot build against DPDK tip at all.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I89ffd0abab52c404cfff911c1c9b0cd9e889241d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14570
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Patch below added copies of pci realted headers to keep
compatiblity with <= DPDK 22.07.
(1eb35ac) env_dpdk: add copies of 22.07 pci-related header files
Unfortunetly the rte_bus/bus_pci/dev headers from DPDK 22.07 are
not compatibile going back to DPDK 20.11.
The issues are:
- lack of RTE_TAILQ_ENTRY defined in rte_os.h
- rte_intr_handle being part of rte_pci_device rather than pointer
pci_dpdk_2207.c even before this patch is not binary compatible with
DPDK 20.11 - see pci_device_*_interrupt_2207() functions.
There would need to be another copy of headers matching that version
of DPDK to resolve this issue.
SPDK supports up to two latest LTS releases. Which right now includes
DPDK 20.11, but soon will be dropped due to DPDK 22.11 release.
Having compile time defines here, keeps the older DPDK working.
Meanwhile backwards compatiblity in SPDK is no worse than before.
The recent changes to env_dpdk, are aiming to improve support
with newer versions of DPDK.
Change-Id: If4dc601cb03e18c2cad61f3a93080e8265ca5fcc
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14795
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This allows eliminating dpdk_pci_device_vtophys and
dpdk_pci_device_map_bar, reducing the amount of
code we need to maintain in the per-DPDK version
implementations.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I73d15eb75bf7fe8340d85494425e15651fec5425
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14722
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Break this function up into three APIs instead:
* dpdk_pci_device_get_addr
* dpdk_pci_device_get_id
* dpdk_pci_device_get_numa_node
This more clearly delineates the requirements we
have from the DPDK PCI device/driver APIs.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ie585c8252d63c15c6e6884d60f8a064c3f0ab94f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14684
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Moving forward, we want to still be able to run against
<= 22.07 versions of DPDK, which exposed the necessary
data structures in public header files. But since we
will be building against newer versions of DPDK which
don't expose them publicly, we need a copy of the 22.07
header files in our tree.
Exclude these header files from astyle and POSIX include
file checks in check_format.sh
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Icd8a067af41a2ba031ce8f875a8a2b63f722ab69
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14683
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
By doing the registration immediately upon mapping the BAR instead of
when the memory is inserted into the spdk_mem_map, we're able to
register BARs that are not 2MB multiples in size and alignment. The SPDK
API for registering a BAR already returns the physical/io address in the
map call, and it can be used directly without a call to
spdk_mem_register().
If the user does elect to later register the BAR using
spdk_mem_register(), we attempt to insert the 2MB aligned segments we
can into the spdk_mem_map. Users may still need to register memory for a
few reasons, such as making spdk_vtophys() work, or for setting up the
BAR as a target for RDMA. These cases still require 2MB aligned and
sized segments.
Change-Id: I395ae8803ec4bf22703f6f76db54200949e82532
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14017
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
These variants did not exist in DPDK 20.11 which is
still supported by SPDK.
So we will instead need to scan the rte_version()
string to get these values.
Fixes issue #2715.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I79657002a7a605a38a0d98b944ac53c02fa6d78c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14661
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
This checks the current version to make sure we have
a dpdk_fn_table that supports it.
This is easy for now, since the DPDK PCI API is
public. Moving forward, DPDK 22.11 will likely make
these APIs private, requiring us to carry header file
copies for different DPDK versions so that we can
not only build against DPDK but also use the correct
data strucures and APIs to interact with those private
DPDK interfaces. We will also need to consider
minor (i.e. stable or point) releases since they
could technically change PCI ABI as well - the current
year + month checks won't be sufficient.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ic9f41d9d13778f3d078b20b08da48d8d16362b11
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14637
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This allows it to return error codes. Have the
init code check the return value and fail the init
process when pci_env_init() returns error.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I7c8a4f9a6da6b3438ed09a881153b7a4ceef3a83
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14635
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Get ready to have multiple implementations of the
dpdk_fn_table. We could do some fancy self-registering
constructor functions, but let's just keep it simple
for now and extern declare each implementation in
the pci_dpdk.h header file.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I8f5621412d1c8bd22c95ab74ef66c5bcc41d1380
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14636
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This is the next step in supporting multiple DPDK
PCI device/driver ABIs once those APIs are no longer
public and subject to ABI versioning rules.
This patch does the following:
1) introduce dpdk_fn_table
2) rename the existing dpdk_xx functions to xx_2207,
to denote these functions are valid for DPDK versions
up to and including 22.07
3) create a dpdk_fn_table pointing to the xx_2207
functions
4) create a global dpdk_fn_table pointer that points
directly to the 2207 fn_table
5) create new dpdk_xx functions that just redirect
to the associated dpdk_fn_table function pointer
Future patches will add the machinery to register
multiple function tables and pick the one to use at
run time based on rte_version() calls.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I1171fbdb4f72ff117416ac1fb282ff6f9fa5cadf
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14634
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Rename it to dpdk_pci_driver_register. This way we
follow the dpdk_pci_xxx naming convention for all
DPDK PCI structure/API dependent functions.
Also move it to the end of the file, to prepare for
moving it into the separate file.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ifca4110f737095a94f9db3d27525f5b9af0546c9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14546
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
This touches the rte_pci_device structure, so let's
make a separate accessor function just for that.
We will start putting the definitions for these
new dpdk_pci_device_xxx functions at the end of
pci.c. At the end of this series, we will then
just lop off the end of pci.c containing all of
the dpdk_pci_device functions and move them to
a DPDK-dependent pci_22_07.c file.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I0323fc19b51d21d1bac899df21d6ebf4354ab339
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14542
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
struct rte_pci_driver will become private, and its
size may change between DPDK releases. But we want
to keep the spdk_pci_driver structure generic. So
allocate 256 bytes of space for the rte_pci_driver
structure, which is far more than the 104 bytes it
currently occupies. We will keep a struct
rte_pci_driver pointer to this memory in spdk_pci_driver
which can be set up in the generic code. This will
make it easier in future patches to make sure that
anything actually touching the rte_pci_driver
structure will be in the separate DPDK dependent
files.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I29aa7e71137da25a5480b34c71f2e0d5c9c02eae
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14541
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Preparing for potential 22.11 changes, refactor this code using DPDK api:
- a bus device list can be walked through via RTE_DEV_FOREACH,
- a reference to the bus object is directly available under the device,
Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Id3a21a6e62dfa1619a92465fac5a82afb9b43cb0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14532
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Also remove all pci-related DPDK includes from
env_internal.h, and add rte_bus_pci.h to pci.c
only.
Now pci.c has all references to DPDK pci-related
header files and data structures.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I5f1727d465eaa73cf71d2f3589cecd3ebb83eb85
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14531
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This moves the only references to the rte_pci_device
data structure from memory.c to pci.c. This helps
prepare SPDK for possible changes to DPDK around
visibility of these DPDK data structures, making it
easier for SPDK to manage if only one file is
affected.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I26b1907fabd7a6c23701523811abd1ce12606683
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14530
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
It'll make it possible to remove a PCI device from within the callback.
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I4cea2207a29bb145aee968715e873076a8c0993c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13956
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Tom Nabarro <tom.nabarro@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Dong Yi <dongx.yi@intel.com>
This makes it possible to notify other PCI device providers (VMD) that a
PCI device is no longer used. The VMD will driver will unhook that
device and free any resources tied to it.
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I42752afbb371a1d33972dac50fd679f68d05b597
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13887
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tom Nabarro <tom.nabarro@intel.com>
Now that we have a attach_device() callback, the devices can be hooked
during spdk_pci_device_attach(). With DPDK, driver->cb_fn() is called
in pci_device_init(), so we need to do the same in
spdk_pci_hook_device().
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Iada8b83ce7592aa62561530192072a50ec3a904b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13884
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tom Nabarro <tom.nabarro@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
The primary motivation for this patch is to allow the VMD driver to be
notified of when users wants to attach a device under a given BDF and to
make it more similar to the regular PCI path. Currently, the way the
VMD driver scans for the devices is a little bit different. The initial
scan is done during initialization and there's a separate poller for
checking hotplugs. Also, there's no device_attach() interface, so with
hotplug poller disabled, it isn't possible to attach to a device not
present in the initial scan, even if the BDF is known.
This causes a few issues. First of all, the VMD library isn't notified
when a device is stopped being used (i.e. user calls
spdk_pci_device_detach()), so when such a device is hotremoved, it never
gets unhooked. But we cannot simply add a spdk_pci_device.detach()
callback, as this would break cases when user detaches a device (without
hotremove) and then tries to reattach it again (via
spdk_pci_device_attach()), as the VMD doesn't get notified about the
device_attach() call.
So, in order to resolve this, a device_attach() callback is added, which
will notify the VMD library that the user wants to attach a device under
a specific PCI address. Then, in subsequent patches, a
spdk_pci_device_provider.detach_cb() callback is added to make sure that
devices are unhooked once they're no longer used.
Once that is done, it'll be also possible to get rid of the VMD hotplug
poller by adding something like scan_cb() to spdk_pci_device_provider and
call it from spdk_pci_enumerate().
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I084a27dcd12455f0f841440b7692375e80d07e84
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13883
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tom Nabarro <tom.nabarro@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
In SPDK, declarations have the return type on the same line. Definitions
have the return type on a separate line. Astyle has an option for
enforcing this. Unfortunately, it seems to have two bugs:
1) It doesn't work correctly at all on C++ files.
2) It often fails on functions that return enums, or long type names
Deal with 1) by adjusting the check_format.sh script to only tell astyle
to fix return type line breaks for C files and not C++. Deal with 2) by
adding a few typedefs to work around the problem.
Change-Id: Idf28281466cab8411ce252d5f02ab384166790c6
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13437
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Dong Yi <dongx.yi@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>