* RE: [PATCH v4 03/20] net/ngbe: add missing CDR config for YT PHY
From: Zaiyu Wang @ 2026-05-27 11:06 UTC (permalink / raw)
To: 'Stephen Hemminger'; +Cc: dev
In-Reply-To: <20260517163740.52739478@phoenix.local>
> Semi-automated AI review feedback.
Thank you for the review. Based on the feedback, I have made the following adjustments:
>
> # DPDK Patch Review - net/ngbe: add missing CDR config for YT PHY
> ## WARNINGS
>
> ### 1. Missing error checks on PHY register writes
No code change.
In the long-term operation of the Wangxun Emerald Gigabit Ethernet controllers supported
by the ngbe driver, PHY register read/write failures are virtually never observed.
Consequently, ngbe_write_phy_reg_sds_ext_yt() effectively always returns 0.
We currently have no plan to add return value checks for PHY register access routines, and
we believe the existing approach is sufficiently robust in practice.
> ---
>
> ## INFO
>
> ### 1. Magic numbers in PHY register writes
No code change.
These values were provided by the PHY vendor (Motorcomm) and the bit definitions are not
documented in publicly available register description.
Replacing them with macros such as YT_CONFIG_REG_XXX would merely introduce meaningless
names without improving understandability. Therefore we prefer to keep the raw vendor
values as they are.
^ permalink raw reply
* [v1] crypto/openssl: update to OpenSSL 3.0 minimum version
From: Emma Finn @ 2026-05-27 11:02 UTC (permalink / raw)
To: Kai Ji; +Cc: dev, Emma Finn
Update the OpenSSL PMD to require OpenSSL 3.0.0 as the minimum
supported version, removing all compatibility code for earlier
versions (1.0.1, 1.1.0, 1.1.1).
Signed-off-by: Emma Finn <emma.finn@intel.com>
---
doc/guides/cryptodevs/openssl.rst | 4 +-
doc/guides/rel_notes/release_26_07.rst | 5 +
drivers/crypto/openssl/compat.h | 203 ------
drivers/crypto/openssl/openssl_pmd_private.h | 30 -
drivers/crypto/openssl/rte_openssl_pmd.c | 648 +------------------
drivers/crypto/openssl/rte_openssl_pmd_ops.c | 206 ------
6 files changed, 19 insertions(+), 1077 deletions(-)
diff --git a/doc/guides/cryptodevs/openssl.rst b/doc/guides/cryptodevs/openssl.rst
index 9d94668a9a..b4e2a014e2 100644
--- a/doc/guides/cryptodevs/openssl.rst
+++ b/doc/guides/cryptodevs/openssl.rst
@@ -74,9 +74,9 @@ To compile the OpenSSL PMD the openssl library must be installed. It will
then be picked up by the Meson/Ninja build system.
To ensure that you have the latest security fixes it is recommended that you
-use version 1.1.1g or newer.
+use the latest stable version of OpenSSL 3.x.
-* 1.1.1g, 2020-Apr-21. https://www.openssl.org/source/
+* OpenSSL 3.0.0 or newer: https://www.openssl.org/source/
Initialization
--------------
diff --git a/doc/guides/rel_notes/release_26_07.rst b/doc/guides/rel_notes/release_26_07.rst
index 58d782f77e..cf2776b606 100644
--- a/doc/guides/rel_notes/release_26_07.rst
+++ b/doc/guides/rel_notes/release_26_07.rst
@@ -90,6 +90,11 @@ Removed Items
Also, make sure to start the actual text at the margin.
=======================================================
+* **crypto/openssl: Removed support for OpenSSL 1.x versions from the OpenSSL crypto PMD.
+
+ The OpenSSL crypto PMD now requires OpenSSL 3.0 as the minimum version,
+ and all compatibility code for OpenSSL 1.0.1, 1.1.0, and 1.1.1 versions has been removed.
+
API Changes
-----------
diff --git a/drivers/crypto/openssl/compat.h b/drivers/crypto/openssl/compat.h
index e1814fea8c..14104dbf2e 100644
--- a/drivers/crypto/openssl/compat.h
+++ b/drivers/crypto/openssl/compat.h
@@ -5,7 +5,6 @@
#ifndef __RTA_COMPAT_H__
#define __RTA_COMPAT_H__
-#if OPENSSL_VERSION_NUMBER >= 0x30000000L
static __rte_always_inline void
free_hmac_ctx(EVP_MAC_CTX *ctx)
{
@@ -17,120 +16,7 @@ free_cmac_ctx(EVP_MAC_CTX *ctx)
{
EVP_MAC_CTX_free(ctx);
}
-#else
-static __rte_always_inline void
-free_hmac_ctx(HMAC_CTX *ctx)
-{
- HMAC_CTX_free(ctx);
-}
-
-static __rte_always_inline void
-free_cmac_ctx(CMAC_CTX *ctx)
-{
- CMAC_CTX_free(ctx);
-}
-#endif
-
-#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
-
-static __rte_always_inline int
-set_rsa_params(RSA *rsa, BIGNUM *p, BIGNUM *q)
-{
- rsa->p = p;
- rsa->q = q;
- return 0;
-}
-
-static __rte_always_inline int
-set_rsa_crt_params(RSA *rsa, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp)
-{
- rsa->dmp1 = dmp1;
- rsa->dmq1 = dmq1;
- rsa->iqmp = iqmp;
- return 0;
-}
-
-static __rte_always_inline int
-set_rsa_keys(RSA *rsa, BIGNUM *n, BIGNUM *e, BIGNUM *d)
-{
- rsa->n = n;
- rsa->e = e;
- rsa->d = d;
- return 0;
-}
-
-static __rte_always_inline int
-set_dh_params(DH *dh, BIGNUM *p, BIGNUM *g)
-{
- dh->p = p;
- dh->q = NULL;
- dh->g = g;
- return 0;
-}
-
-static __rte_always_inline int
-set_dh_priv_key(DH *dh, BIGNUM *priv_key)
-{
- dh->priv_key = priv_key;
- return 0;
-}
-
-static __rte_always_inline int
-set_dsa_params(DSA *dsa, BIGNUM *p, BIGNUM *q, BIGNUM *g)
-{
- dsa->p = p;
- dsa->q = q;
- dsa->g = g;
- return 0;
-}
-
-static __rte_always_inline void
-get_dh_pub_key(DH *dh, const BIGNUM **pub_key)
-{
- *pub_key = dh->pub_key;
-}
-
-static __rte_always_inline void
-get_dh_priv_key(DH *dh, const BIGNUM **priv_key)
-{
- *priv_key = dh->priv_key;
-}
-
-static __rte_always_inline void
-set_dsa_sign(DSA_SIG *sign, BIGNUM *r, BIGNUM *s)
-{
- sign->r = r;
- sign->s = s;
-}
-
-static __rte_always_inline void
-get_dsa_sign(DSA_SIG *sign, const BIGNUM **r, const BIGNUM **s)
-{
- *r = sign->r;
- *s = sign->s;
-}
-
-static __rte_always_inline int
-set_dsa_keys(DSA *dsa, BIGNUM *pub, BIGNUM *priv)
-{
- dsa->pub_key = pub;
- dsa->priv_key = priv;
- return 0;
-}
-
-static __rte_always_inline void
-set_dsa_pub_key(DSA *dsa, BIGNUM *pub)
-{
- dsa->pub_key = pub;
-}
-
-static __rte_always_inline void
-get_dsa_priv_key(DSA *dsa, BIGNUM **priv_key)
-{
- *priv_key = dsa->priv_key;
-}
-#elif (OPENSSL_VERSION_NUMBER >= 0x30000000L)
static __rte_always_inline void
set_dsa_sign(DSA_SIG *sign, BIGNUM *r, BIGNUM *s)
{
@@ -142,94 +28,5 @@ get_dsa_sign(DSA_SIG *sign, const BIGNUM **r, const BIGNUM **s)
{
DSA_SIG_get0(sign, r, s);
}
-#else
-
-static __rte_always_inline int
-set_rsa_params(RSA *rsa, BIGNUM *p, BIGNUM *q)
-{
- return !(RSA_set0_factors(rsa, p, q));
-}
-
-static __rte_always_inline int
-set_rsa_crt_params(RSA *rsa, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp)
-{
- return !(RSA_set0_crt_params(rsa, dmp1, dmq1, iqmp));
-}
-
-/* n, e must be non-null, d can be NULL */
-
-static __rte_always_inline int
-set_rsa_keys(RSA *rsa, BIGNUM *n, BIGNUM *e, BIGNUM *d)
-{
- return !(RSA_set0_key(rsa, n, e, d));
-}
-
-static __rte_always_inline int
-set_dh_params(DH *dh, BIGNUM *p, BIGNUM *g)
-{
- return !(DH_set0_pqg(dh, p, NULL, g));
-}
-
-static __rte_always_inline int
-set_dh_priv_key(DH *dh, BIGNUM *priv_key)
-{
- return !(DH_set0_key(dh, NULL, priv_key));
-}
-
-static __rte_always_inline void
-get_dh_pub_key(DH *dh_key, const BIGNUM **pub_key)
-{
- DH_get0_key(dh_key, pub_key, NULL);
-}
-
-static __rte_always_inline void
-get_dh_priv_key(DH *dh_key, const BIGNUM **priv_key)
-{
- DH_get0_key(dh_key, NULL, priv_key);
-}
-
-static __rte_always_inline int
-set_dsa_params(DSA *dsa, BIGNUM *p, BIGNUM *q, BIGNUM *g)
-{
- return !(DSA_set0_pqg(dsa, p, q, g));
-}
-
-static __rte_always_inline void
-set_dsa_priv_key(DSA *dsa, BIGNUM *priv_key)
-{
- DSA_set0_key(dsa, NULL, priv_key);
-}
-
-static __rte_always_inline void
-set_dsa_sign(DSA_SIG *sign, BIGNUM *r, BIGNUM *s)
-{
- DSA_SIG_set0(sign, r, s);
-}
-
-static __rte_always_inline void
-get_dsa_sign(DSA_SIG *sign, const BIGNUM **r, const BIGNUM **s)
-{
- DSA_SIG_get0(sign, r, s);
-}
-
-static __rte_always_inline int
-set_dsa_keys(DSA *dsa, BIGNUM *pub, BIGNUM *priv)
-{
- return !(DSA_set0_key(dsa, pub, priv));
-}
-
-static __rte_always_inline void
-set_dsa_pub_key(DSA *dsa, BIGNUM *pub_key)
-{
- DSA_set0_key(dsa, pub_key, NULL);
-}
-
-static __rte_always_inline void
-get_dsa_priv_key(DSA *dsa, const BIGNUM **priv_key)
-{
- DSA_get0_key(dsa, NULL, priv_key);
-}
-
-#endif /* version < 10100000 */
#endif /* __RTA_COMPAT_H__ */
diff --git a/drivers/crypto/openssl/openssl_pmd_private.h b/drivers/crypto/openssl/openssl_pmd_private.h
index d5a751600a..ab40012d61 100644
--- a/drivers/crypto/openssl/openssl_pmd_private.h
+++ b/drivers/crypto/openssl/openssl_pmd_private.h
@@ -13,10 +13,8 @@
#include <openssl/dh.h>
#include <openssl/dsa.h>
#include <openssl/ec.h>
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
#include <openssl/provider.h>
#include <openssl/core_names.h>
-#endif
#define CRYPTODEV_NAME_OPENSSL_PMD crypto_openssl
/**< Open SSL Crypto PMD device name */
@@ -84,13 +82,8 @@ struct evp_ctx_pair {
EVP_CIPHER_CTX *cipher;
union {
EVP_MD_CTX *auth;
-#if OPENSSL_VERSION_NUMBER >= 0x30000000L
EVP_MAC_CTX *hmac;
EVP_MAC_CTX *cmac;
-#else
- HMAC_CTX *hmac;
- CMAC_CTX *cmac;
-#endif
};
};
@@ -153,24 +146,13 @@ struct __rte_cache_aligned openssl_session {
/**< pointer to EVP key */
const EVP_MD *evp_algo;
/**< pointer to EVP algorithm function */
-# if OPENSSL_VERSION_NUMBER >= 0x30000000L
EVP_MAC_CTX * ctx;
-# else
- HMAC_CTX *ctx;
-# endif
/**< pointer to EVP context structure */
} hmac;
struct {
-# if OPENSSL_VERSION_NUMBER >= 0x30000000L
EVP_MAC_CTX * ctx;
/**< pointer to EVP context structure */
-# else
- const EVP_CIPHER * evp_algo;
- /**< pointer to EVP algorithm function */
- CMAC_CTX *ctx;
- /**< pointer to EVP context structure */
-# endif
} cmac;
};
@@ -198,9 +180,7 @@ struct __rte_cache_aligned openssl_asym_session {
struct rsa {
RSA *rsa;
uint32_t pad;
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
EVP_PKEY_CTX * ctx;
-#endif
} r;
struct exp {
BIGNUM *exp;
@@ -216,38 +196,28 @@ struct __rte_cache_aligned openssl_asym_session {
uint32_t key_op;
BIGNUM *p;
BIGNUM *g;
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
OSSL_PARAM_BLD * param_bld;
OSSL_PARAM_BLD *param_bld_peer;
-#endif
} dh;
struct {
DSA *dsa;
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
OSSL_PARAM_BLD * param_bld;
BIGNUM *p;
BIGNUM *g;
BIGNUM *q;
BIGNUM *priv_key;
-#endif
} s;
struct {
uint8_t curve_id;
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
EC_GROUP * group;
BIGNUM *priv_key;
-#endif
} ec;
struct {
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
OSSL_PARAM * params;
-#endif
} sm2;
struct {
uint8_t curve_id;
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
OSSL_PARAM * params;
-#endif
} eddsa;
struct {
uint8_t type;
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index c34efb8ad0..8748ef6195 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -19,35 +19,14 @@
#include "openssl_pmd_private.h"
#include "compat.h"
-#define DES_BLOCK_SIZE 8
-
-static uint8_t cryptodev_driver_id;
-
-#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
-static HMAC_CTX *HMAC_CTX_new(void)
-{
- HMAC_CTX *ctx = OPENSSL_malloc(sizeof(*ctx));
-
- if (ctx != NULL)
- HMAC_CTX_init(ctx);
- return ctx;
-}
-
-static void HMAC_CTX_free(HMAC_CTX *ctx)
-{
- if (ctx != NULL) {
- HMAC_CTX_cleanup(ctx);
- OPENSSL_free(ctx);
- }
-}
-#endif
-
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
-
#include <openssl/provider.h>
#include <openssl/core_names.h>
#include <openssl/param_build.h>
+#define DES_BLOCK_SIZE 8
+
+static uint8_t cryptodev_driver_id;
+
#define MAX_OSSL_ALGO_NAME_SIZE 16
OSSL_PROVIDER *legacy;
@@ -104,7 +83,6 @@ digest_name_get(enum rte_crypto_auth_algorithm algo)
return NULL;
}
}
-#endif
static int cryptodev_openssl_remove(struct rte_vdev_device *vdev);
@@ -306,14 +284,12 @@ get_auth_algo(enum rte_crypto_auth_algorithm sessalgo,
case RTE_CRYPTO_AUTH_SHA3_512_HMAC:
*algo = EVP_sha3_512();
break;
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
case RTE_CRYPTO_AUTH_SHAKE_128:
*algo = EVP_shake128();
break;
case RTE_CRYPTO_AUTH_SHAKE_256:
*algo = EVP_shake256();
break;
-#endif
default:
res = -EINVAL;
break;
@@ -659,12 +635,10 @@ static int
openssl_set_session_auth_parameters(struct openssl_session *sess,
const struct rte_crypto_sym_xform *xform)
{
-# if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
char algo_name[MAX_OSSL_ALGO_NAME_SIZE];
OSSL_PARAM params[2];
const char *algo;
EVP_MAC *mac;
-# endif
/* Select auth generate/verify */
sess->auth.operation = xform->auth.op;
sess->auth.algo = xform->auth.algo;
@@ -708,10 +682,8 @@ openssl_set_session_auth_parameters(struct openssl_session *sess,
case RTE_CRYPTO_AUTH_SHA3_256:
case RTE_CRYPTO_AUTH_SHA3_384:
case RTE_CRYPTO_AUTH_SHA3_512:
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
case RTE_CRYPTO_AUTH_SHAKE_128:
case RTE_CRYPTO_AUTH_SHAKE_256:
-#endif
sess->auth.mode = OPENSSL_AUTH_AS_AUTH;
if (get_auth_algo(xform->auth.algo,
&sess->auth.auth.evp_algo) != 0)
@@ -720,7 +692,6 @@ openssl_set_session_auth_parameters(struct openssl_session *sess,
break;
case RTE_CRYPTO_AUTH_AES_CMAC:
-# if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
if (xform->auth.key.length == 16)
algo = SN_aes_128_cbc;
else if (xform->auth.key.length == 24)
@@ -745,22 +716,8 @@ openssl_set_session_auth_parameters(struct openssl_session *sess,
xform->auth.key.length,
params) != 1)
return -EINVAL;
-# else
- sess->auth.mode = OPENSSL_AUTH_AS_CMAC;
- sess->auth.cmac.ctx = CMAC_CTX_new();
- if (get_cipher_algo(RTE_CRYPTO_CIPHER_AES_CBC,
- xform->auth.key.length,
- &sess->auth.cmac.evp_algo) != 0)
- return -EINVAL;
- if (CMAC_Init(sess->auth.cmac.ctx,
- xform->auth.key.data,
- xform->auth.key.length,
- sess->auth.cmac.evp_algo, NULL) != 1)
- return -EINVAL;
-# endif
break;
-# if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
case RTE_CRYPTO_AUTH_MD5_HMAC:
case RTE_CRYPTO_AUTH_SHA1_HMAC:
case RTE_CRYPTO_AUTH_SHA224_HMAC:
@@ -794,30 +751,6 @@ openssl_set_session_auth_parameters(struct openssl_session *sess,
params) != 1)
return -EINVAL;
break;
-# else
- case RTE_CRYPTO_AUTH_MD5_HMAC:
- case RTE_CRYPTO_AUTH_SHA1_HMAC:
- case RTE_CRYPTO_AUTH_SHA224_HMAC:
- case RTE_CRYPTO_AUTH_SHA256_HMAC:
- case RTE_CRYPTO_AUTH_SHA384_HMAC:
- case RTE_CRYPTO_AUTH_SHA512_HMAC:
- case RTE_CRYPTO_AUTH_SHA3_224_HMAC:
- case RTE_CRYPTO_AUTH_SHA3_256_HMAC:
- case RTE_CRYPTO_AUTH_SHA3_384_HMAC:
- case RTE_CRYPTO_AUTH_SHA3_512_HMAC:
- sess->auth.mode = OPENSSL_AUTH_AS_HMAC;
- sess->auth.hmac.ctx = HMAC_CTX_new();
- if (get_auth_algo(xform->auth.algo,
- &sess->auth.hmac.evp_algo) != 0)
- return -EINVAL;
-
- if (HMAC_Init_ex(sess->auth.hmac.ctx,
- xform->auth.key.data,
- xform->auth.key.length,
- sess->auth.hmac.evp_algo, NULL) != 1)
- return -EINVAL;
- break;
-# endif
default:
return -ENOTSUP;
}
@@ -1295,10 +1228,6 @@ process_openssl_auth_encryption_gcm(struct rte_mbuf *mbuf_src, int offset,
uint8_t *dst, uint8_t *tag, EVP_CIPHER_CTX *ctx)
{
int len = 0;
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
- int unused = 0;
- uint8_t empty[] = {};
-#endif
if (EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, iv) <= 0)
goto process_auth_encryption_gcm_err;
@@ -1312,12 +1241,6 @@ process_openssl_auth_encryption_gcm(struct rte_mbuf *mbuf_src, int offset,
srclen, ctx, 0))
goto process_auth_encryption_gcm_err;
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
- /* Workaround open ssl bug in version less then 1.0.1f */
- if (EVP_EncryptUpdate(ctx, empty, &unused, empty, 0) <= 0)
- goto process_auth_encryption_gcm_err;
-#endif
-
if (EVP_EncryptFinal_ex(ctx, dst, &len) <= 0)
goto process_auth_encryption_gcm_err;
@@ -1379,10 +1302,6 @@ process_openssl_auth_decryption_gcm(struct rte_mbuf *mbuf_src, int offset,
uint8_t *dst, uint8_t *tag, EVP_CIPHER_CTX *ctx)
{
int len = 0;
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
- int unused = 0;
- uint8_t empty[] = {};
-#endif
if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_TAG, 16, tag) <= 0)
goto process_auth_decryption_gcm_err;
@@ -1399,12 +1318,6 @@ process_openssl_auth_decryption_gcm(struct rte_mbuf *mbuf_src, int offset,
srclen, ctx, 0))
goto process_auth_decryption_gcm_err;
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
- /* Workaround open ssl bug in version less then 1.0.1f */
- if (EVP_DecryptUpdate(ctx, empty, &unused, empty, 0) <= 0)
- goto process_auth_decryption_gcm_err;
-#endif
-
if (EVP_DecryptFinal_ex(ctx, dst, &len) <= 0)
return -EFAULT;
@@ -1500,17 +1413,11 @@ process_openssl_auth(struct rte_mbuf *mbuf_src, uint8_t *dst, int offset,
process_auth_final:
/* SHAKE algorithms are XOFs and require EVP_DigestFinalXOF */
if (algo == EVP_shake128() || algo == EVP_shake256()) {
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
/* Set XOF output length before calling EVP_DigestFinalXOF */
if (EVP_MD_CTX_ctrl(ctx, EVP_MD_CTRL_XOF_LEN, digest_length, NULL) <= 0)
goto process_auth_err;
if (EVP_DigestFinalXOF(ctx, dst, digest_length) <= 0)
goto process_auth_err;
-#else
- RTE_SET_USED(digest_length);
- OPENSSL_LOG(ERR, "SHAKE algorithms require OpenSSL 3.0+");
- goto process_auth_err;
-#endif
} else {
if (EVP_DigestFinal_ex(ctx, dst, (unsigned int *)&dstlen) <= 0)
goto process_auth_err;
@@ -1523,7 +1430,6 @@ process_openssl_auth(struct rte_mbuf *mbuf_src, uint8_t *dst, int offset,
return -EINVAL;
}
-# if OPENSSL_VERSION_NUMBER >= 0x30000000L
/** Process standard openssl auth algorithms with hmac/cmac */
static int
process_openssl_auth_mac(struct rte_mbuf *mbuf_src, uint8_t *dst, int offset,
@@ -1576,109 +1482,6 @@ process_openssl_auth_mac(struct rte_mbuf *mbuf_src, uint8_t *dst, int offset,
OPENSSL_LOG(ERR, "Process openssl auth failed");
return -EINVAL;
}
-# else
-/** Process standard openssl auth algorithms with hmac */
-static int
-process_openssl_auth_hmac(struct rte_mbuf *mbuf_src, uint8_t *dst, int offset,
- int srclen, HMAC_CTX *ctx)
-{
- unsigned int dstlen;
- struct rte_mbuf *m;
- int l, n = srclen;
- uint8_t *src;
-
- for (m = mbuf_src; m != NULL && offset > rte_pktmbuf_data_len(m);
- m = m->next)
- offset -= rte_pktmbuf_data_len(m);
-
- if (m == 0)
- goto process_auth_err;
-
- src = rte_pktmbuf_mtod_offset(m, uint8_t *, offset);
-
- l = rte_pktmbuf_data_len(m) - offset;
- if (srclen <= l) {
- if (HMAC_Update(ctx, (unsigned char *)src, srclen) != 1)
- goto process_auth_err;
- goto process_auth_final;
- }
-
- if (HMAC_Update(ctx, (unsigned char *)src, l) != 1)
- goto process_auth_err;
-
- n -= l;
-
- for (m = m->next; (m != NULL) && (n > 0); m = m->next) {
- src = rte_pktmbuf_mtod(m, uint8_t *);
- l = rte_pktmbuf_data_len(m) < n ? rte_pktmbuf_data_len(m) : n;
- if (HMAC_Update(ctx, (unsigned char *)src, l) != 1)
- goto process_auth_err;
- n -= l;
- }
-
-process_auth_final:
- if (HMAC_Final(ctx, dst, &dstlen) != 1)
- goto process_auth_err;
-
- if (unlikely(HMAC_Init_ex(ctx, NULL, 0, NULL, NULL) != 1))
- goto process_auth_err;
-
- return 0;
-
-process_auth_err:
- OPENSSL_LOG(ERR, "Process openssl auth failed");
- return -EINVAL;
-}
-
-/** Process standard openssl auth algorithms with cmac */
-static int
-process_openssl_auth_cmac(struct rte_mbuf *mbuf_src, uint8_t *dst, int offset,
- int srclen, CMAC_CTX *ctx)
-{
- unsigned int dstlen;
- struct rte_mbuf *m;
- int l, n = srclen;
- uint8_t *src;
-
- for (m = mbuf_src; m != NULL && offset > rte_pktmbuf_data_len(m);
- m = m->next)
- offset -= rte_pktmbuf_data_len(m);
-
- if (m == 0)
- goto process_auth_err;
-
- src = rte_pktmbuf_mtod_offset(m, uint8_t *, offset);
-
- l = rte_pktmbuf_data_len(m) - offset;
- if (srclen <= l) {
- if (CMAC_Update(ctx, (unsigned char *)src, srclen) != 1)
- goto process_auth_err;
- goto process_auth_final;
- }
-
- if (CMAC_Update(ctx, (unsigned char *)src, l) != 1)
- goto process_auth_err;
-
- n -= l;
-
- for (m = m->next; (m != NULL) && (n > 0); m = m->next) {
- src = rte_pktmbuf_mtod(m, uint8_t *);
- l = rte_pktmbuf_data_len(m) < n ? rte_pktmbuf_data_len(m) : n;
- if (CMAC_Update(ctx, (unsigned char *)src, l) != 1)
- goto process_auth_err;
- n -= l;
- }
-
-process_auth_final:
- if (CMAC_Final(ctx, dst, (size_t *)&dstlen) != 1)
- goto process_auth_err;
- return 0;
-
-process_auth_err:
- OPENSSL_LOG(ERR, "Process openssl cmac auth failed");
- return -EINVAL;
-}
-# endif
/*----------------------------------------------------------------------------*/
static inline EVP_CIPHER_CTX *
@@ -1695,7 +1498,7 @@ get_local_cipher_ctx(struct openssl_session *sess, struct openssl_qp *qp)
/* EVP_CIPHER_CTX_dup() added in OSSL 3.2 */
*lctx = EVP_CIPHER_CTX_dup(sess->cipher.ctx);
return *lctx;
-#elif OPENSSL_VERSION_NUMBER >= 0x30000000L
+#else
if (sess->chain_order == OPENSSL_CHAIN_COMBINED) {
/* AESNI special-cased to use openssl_aesni_ctx_clone()
* to allow for working around lack of
@@ -1706,10 +1509,10 @@ get_local_cipher_ctx(struct openssl_session *sess, struct openssl_qp *qp)
*lctx = NULL;
return *lctx;
}
-#endif
*lctx = EVP_CIPHER_CTX_new();
EVP_CIPHER_CTX_copy(*lctx, sess->cipher.ctx);
+#endif
}
return *lctx;
@@ -1737,11 +1540,7 @@ get_local_auth_ctx(struct openssl_session *sess, struct openssl_qp *qp)
return *lctx;
}
-#if OPENSSL_VERSION_NUMBER >= 0x30000000L
static inline EVP_MAC_CTX *
-#else
-static inline HMAC_CTX *
-#endif
get_local_hmac_ctx(struct openssl_session *sess, struct openssl_qp *qp)
{
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L && OPENSSL_VERSION_NUMBER < 0x30003000L)
@@ -1759,31 +1558,16 @@ get_local_hmac_ctx(struct openssl_session *sess, struct openssl_qp *qp)
if (sess->ctx_copies_len == 0)
return sess->auth.hmac.ctx;
-#if OPENSSL_VERSION_NUMBER >= 0x30000000L
- EVP_MAC_CTX **lctx =
-#else
- HMAC_CTX **lctx =
-#endif
- &sess->qp_ctx[qp->id].hmac;
+ EVP_MAC_CTX **lctx = &sess->qp_ctx[qp->id].hmac;
- if (unlikely(*lctx == NULL)) {
-#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+ if (unlikely(*lctx == NULL))
*lctx = EVP_MAC_CTX_dup(sess->auth.hmac.ctx);
-#else
- *lctx = HMAC_CTX_new();
- HMAC_CTX_copy(*lctx, sess->auth.hmac.ctx);
-#endif
- }
return *lctx;
#endif
}
-#if OPENSSL_VERSION_NUMBER >= 0x30000000L
static inline EVP_MAC_CTX *
-#else
-static inline CMAC_CTX *
-#endif
get_local_cmac_ctx(struct openssl_session *sess, struct openssl_qp *qp)
{
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L && OPENSSL_VERSION_NUMBER < 0x30003000L)
@@ -1801,21 +1585,10 @@ get_local_cmac_ctx(struct openssl_session *sess, struct openssl_qp *qp)
if (sess->ctx_copies_len == 0)
return sess->auth.cmac.ctx;
-#if OPENSSL_VERSION_NUMBER >= 0x30000000L
- EVP_MAC_CTX **lctx =
-#else
- CMAC_CTX **lctx =
-#endif
- &sess->qp_ctx[qp->id].cmac;
+ EVP_MAC_CTX **lctx = &sess->qp_ctx[qp->id].cmac;
- if (unlikely(*lctx == NULL)) {
-#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+ if (unlikely(*lctx == NULL))
*lctx = EVP_MAC_CTX_dup(sess->auth.cmac.ctx);
-#else
- *lctx = CMAC_CTX_new();
- CMAC_CTX_copy(*lctx, sess->auth.cmac.ctx);
-#endif
- }
return *lctx;
#endif
@@ -2055,13 +1828,8 @@ process_openssl_auth_op(struct openssl_qp *qp, struct rte_crypto_op *op,
uint8_t *dst;
int srclen, status;
EVP_MD_CTX *ctx_a;
-# if OPENSSL_VERSION_NUMBER >= 0x30000000L
EVP_MAC_CTX *ctx_h;
EVP_MAC_CTX *ctx_c;
-# else
- HMAC_CTX *ctx_h;
- CMAC_CTX *ctx_c;
-# endif
srclen = op->sym->auth.data.length;
@@ -2076,30 +1844,18 @@ process_openssl_auth_op(struct openssl_qp *qp, struct rte_crypto_op *op,
break;
case OPENSSL_AUTH_AS_HMAC:
ctx_h = get_local_hmac_ctx(sess, qp);
-# if OPENSSL_VERSION_NUMBER >= 0x30000000L
status = process_openssl_auth_mac(mbuf_src, dst,
op->sym->auth.data.offset, srclen,
ctx_h);
-# else
- status = process_openssl_auth_hmac(mbuf_src, dst,
- op->sym->auth.data.offset, srclen,
- ctx_h);
-# endif
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L && OPENSSL_VERSION_NUMBER < 0x30003000L)
EVP_MAC_CTX_free(ctx_h);
#endif
break;
case OPENSSL_AUTH_AS_CMAC:
ctx_c = get_local_cmac_ctx(sess, qp);
-# if OPENSSL_VERSION_NUMBER >= 0x30000000L
status = process_openssl_auth_mac(mbuf_src, dst,
op->sym->auth.data.offset, srclen,
ctx_c);
-# else
- status = process_openssl_auth_cmac(mbuf_src, dst,
- op->sym->auth.data.offset, srclen,
- ctx_c);
-# endif
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L && OPENSSL_VERSION_NUMBER < 0x30003000L)
EVP_MAC_CTX_free(ctx_c);
#endif
@@ -2130,7 +1886,6 @@ process_openssl_auth_op(struct openssl_qp *qp, struct rte_crypto_op *op,
}
/* process dsa sign operation */
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
static int
process_openssl_dsa_sign_op_evp(struct rte_crypto_op *cop,
struct openssl_asym_session *sess)
@@ -2296,92 +2051,8 @@ process_openssl_dsa_verify_op_evp(struct rte_crypto_op *cop,
return ret;
}
-#else
-static int
-process_openssl_dsa_sign_op(struct rte_crypto_op *cop,
- struct openssl_asym_session *sess)
-{
- struct rte_crypto_dsa_op_param *op = &cop->asym->dsa;
- DSA *dsa = sess->u.s.dsa;
- DSA_SIG *sign = NULL;
-
- sign = DSA_do_sign(op->message.data,
- op->message.length,
- dsa);
-
- if (sign == NULL) {
- OPENSSL_LOG(ERR, "%s:%d", __func__, __LINE__);
- cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
- } else {
- const BIGNUM *r = NULL, *s = NULL;
- get_dsa_sign(sign, &r, &s);
-
- op->r.length = BN_bn2bin(r, op->r.data);
- op->s.length = BN_bn2bin(s, op->s.data);
- cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
- }
-
- DSA_SIG_free(sign);
-
- return 0;
-}
-
-/* process dsa verify operation */
-static int
-process_openssl_dsa_verify_op(struct rte_crypto_op *cop,
- struct openssl_asym_session *sess)
-{
- struct rte_crypto_dsa_op_param *op = &cop->asym->dsa;
- DSA *dsa = sess->u.s.dsa;
- int ret;
- DSA_SIG *sign = DSA_SIG_new();
- BIGNUM *r = NULL, *s = NULL;
- BIGNUM *pub_key = NULL;
-
- if (sign == NULL) {
- OPENSSL_LOG(ERR, " %s:%d", __func__, __LINE__);
- cop->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
- return -1;
- }
-
- r = BN_bin2bn(op->r.data,
- op->r.length,
- r);
- s = BN_bin2bn(op->s.data,
- op->s.length,
- s);
- pub_key = BN_bin2bn(op->y.data,
- op->y.length,
- pub_key);
- if (!r || !s || !pub_key) {
- BN_free(r);
- BN_free(s);
- BN_free(pub_key);
-
- cop->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
- return -1;
- }
- set_dsa_sign(sign, r, s);
- set_dsa_pub_key(dsa, pub_key);
-
- ret = DSA_do_verify(op->message.data,
- op->message.length,
- sign,
- dsa);
-
- if (ret != 1)
- cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
- else
- cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
-
- DSA_SIG_free(sign);
-
- return 0;
-}
-#endif
/* process dh operation */
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
static int
process_openssl_dh_op_evp(struct rte_crypto_op *cop,
struct openssl_asym_session *sess)
@@ -2555,141 +2226,6 @@ process_openssl_dh_op_evp(struct rte_crypto_op *cop,
return ret;
}
-#else
-static int
-process_openssl_dh_op(struct rte_crypto_op *cop,
- struct openssl_asym_session *sess)
-{
- struct rte_crypto_dh_op_param *op = &cop->asym->dh;
- struct rte_crypto_asym_op *asym_op = cop->asym;
- DH *dh_key = sess->u.dh.dh_key;
- BIGNUM *priv_key = NULL;
- int ret = 0;
-
- if (asym_op->dh.ke_type == RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE) {
- /* compute shared secret using peer public key
- * and current private key
- * shared secret = peer_key ^ priv_key mod p
- */
- BIGNUM *peer_key = NULL;
-
- /* copy private key and peer key and compute shared secret */
- peer_key = BN_bin2bn(op->pub_key.data,
- op->pub_key.length,
- peer_key);
- if (peer_key == NULL) {
- cop->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
- return -1;
- }
- priv_key = BN_bin2bn(op->priv_key.data,
- op->priv_key.length,
- priv_key);
- if (priv_key == NULL) {
- BN_free(peer_key);
- cop->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
- return -1;
- }
- ret = set_dh_priv_key(dh_key, priv_key);
- if (ret) {
- OPENSSL_LOG(ERR, "Failed to set private key");
- cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
- BN_free(peer_key);
- BN_free(priv_key);
- return 0;
- }
-
- ret = DH_compute_key(
- op->shared_secret.data,
- peer_key, dh_key);
- if (ret < 0) {
- cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
- BN_free(peer_key);
- /* priv key is already loaded into dh,
- * let's not free that directly here.
- * DH_free() will auto free it later.
- */
- return 0;
- }
- cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
- op->shared_secret.length = ret;
- BN_free(peer_key);
- return 0;
- }
-
- /*
- * other options are public and private key generations.
- *
- * if user provides private key,
- * then first set DH with user provided private key
- */
- if (asym_op->dh.ke_type == RTE_CRYPTO_ASYM_KE_PUB_KEY_GENERATE &&
- op->priv_key.length) {
- /* generate public key using user-provided private key
- * pub_key = g ^ priv_key mod p
- */
-
- /* load private key into DH */
- priv_key = BN_bin2bn(op->priv_key.data,
- op->priv_key.length,
- priv_key);
- if (priv_key == NULL) {
- cop->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
- return -1;
- }
- ret = set_dh_priv_key(dh_key, priv_key);
- if (ret) {
- OPENSSL_LOG(ERR, "Failed to set private key");
- cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
- BN_free(priv_key);
- return 0;
- }
- }
-
- /* generate public and private key pair.
- *
- * if private key already set, generates only public key.
- *
- * if private key is not already set, then set it to random value
- * and update internal private key.
- */
- if (!DH_generate_key(dh_key)) {
- cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
- return 0;
- }
-
- if (asym_op->dh.ke_type == RTE_CRYPTO_ASYM_KE_PUB_KEY_GENERATE) {
- const BIGNUM *pub_key = NULL;
-
- OPENSSL_LOG(DEBUG, "%s:%d update public key",
- __func__, __LINE__);
-
- /* get the generated keys */
- get_dh_pub_key(dh_key, &pub_key);
-
- /* output public key */
- op->pub_key.length = BN_bn2bin(pub_key,
- op->pub_key.data);
- }
-
- if (asym_op->dh.ke_type == RTE_CRYPTO_ASYM_KE_PRIV_KEY_GENERATE) {
- const BIGNUM *priv_key = NULL;
-
- OPENSSL_LOG(DEBUG, "%s:%d updated priv key",
- __func__, __LINE__);
-
- /* get the generated keys */
- get_dh_priv_key(dh_key, &priv_key);
-
- /* provide generated private key back to user */
- op->priv_key.length = BN_bn2bin(priv_key,
- op->priv_key.data);
- }
-
- cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
-
- return 0;
-}
-#endif
/* process modinv operation */
static int
@@ -2757,7 +2293,6 @@ process_openssl_modexp_op(struct rte_crypto_op *cop,
}
/* process rsa operations */
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
static int
process_openssl_rsa_op_evp(struct rte_crypto_op *cop,
struct openssl_asym_session *sess)
@@ -3333,133 +2868,7 @@ process_openssl_eddsa_op_evp(struct rte_crypto_op *cop,
return ret;
}
-#else
-static int
-process_openssl_rsa_op(struct rte_crypto_op *cop,
- struct openssl_asym_session *sess)
-{
- int ret = 0;
- struct rte_crypto_asym_op *op = cop->asym;
- RSA *rsa = sess->u.r.rsa;
- uint32_t pad = sess->u.r.pad;
- uint8_t *tmp;
- cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
-
- switch (pad) {
- case RTE_CRYPTO_RSA_PADDING_PKCS1_5:
- pad = RSA_PKCS1_PADDING;
- break;
- case RTE_CRYPTO_RSA_PADDING_NONE:
- pad = RSA_NO_PADDING;
- break;
- default:
- cop->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
- OPENSSL_LOG(ERR,
- "rsa pad type not supported %d", pad);
- return 0;
- }
-
- switch (op->rsa.op_type) {
- case RTE_CRYPTO_ASYM_OP_ENCRYPT:
- ret = RSA_public_encrypt(op->rsa.message.length,
- op->rsa.message.data,
- op->rsa.cipher.data,
- rsa,
- pad);
-
- if (ret > 0)
- op->rsa.cipher.length = ret;
- OPENSSL_LOG(DEBUG,
- "length of encrypted text %d", ret);
- break;
-
- case RTE_CRYPTO_ASYM_OP_DECRYPT:
- ret = RSA_private_decrypt(op->rsa.cipher.length,
- op->rsa.cipher.data,
- op->rsa.message.data,
- rsa,
- pad);
- if (ret > 0)
- op->rsa.message.length = ret;
- break;
-
- case RTE_CRYPTO_ASYM_OP_SIGN:
- ret = RSA_private_encrypt(op->rsa.message.length,
- op->rsa.message.data,
- op->rsa.sign.data,
- rsa,
- pad);
- if (ret > 0)
- op->rsa.sign.length = ret;
- break;
-
- case RTE_CRYPTO_ASYM_OP_VERIFY:
- tmp = rte_malloc(NULL, op->rsa.sign.length, 0);
- if (tmp == NULL) {
- OPENSSL_LOG(ERR, "Memory allocation failed");
- cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
- break;
- }
- ret = RSA_public_decrypt(op->rsa.sign.length,
- op->rsa.sign.data,
- tmp,
- rsa,
- pad);
-
- OPENSSL_LOG(DEBUG,
- "Length of public_decrypt %d "
- "length of message %zd",
- ret, op->rsa.message.length);
- if ((ret <= 0) || (CRYPTO_memcmp(tmp, op->rsa.message.data,
- op->rsa.message.length))) {
- OPENSSL_LOG(ERR, "RSA sign Verification failed");
- cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
- }
- rte_free(tmp);
- break;
-
- default:
- /* allow ops with invalid args to be pushed to
- * completion queue
- */
- cop->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
- break;
- }
-
- if (ret < 0)
- cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
-
- return 0;
-}
-
-static int
-process_openssl_ecfpm_op(struct rte_crypto_op *cop,
- struct openssl_asym_session *sess)
-{
- RTE_SET_USED(cop);
- RTE_SET_USED(sess);
- return -ENOTSUP;
-}
-
-static int
-process_openssl_sm2_op(struct rte_crypto_op *cop,
- struct openssl_asym_session *sess)
-{
- RTE_SET_USED(cop);
- RTE_SET_USED(sess);
- return -ENOTSUP;
-}
-
-static int
-process_openssl_eddsa_op(struct rte_crypto_op *cop,
- struct openssl_asym_session *sess)
-{
- RTE_SET_USED(cop);
- RTE_SET_USED(sess);
- return -ENOTSUP;
-}
-#endif
#if (OPENSSL_VERSION_NUMBER >= 0x30500000L)
static int
@@ -4085,14 +3494,12 @@ mldsa_sign_op_evp(struct rte_crypto_op *cop,
case RTE_CRYPTO_AUTH_SHA3_512:
check_md = EVP_sha3_512();
break;
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
case RTE_CRYPTO_AUTH_SHAKE_128:
check_md = EVP_shake128();
break;
case RTE_CRYPTO_AUTH_SHAKE_256:
check_md = EVP_shake256();
break;
-#endif
default:
break;
}
@@ -4328,11 +3735,7 @@ process_asym_op(struct openssl_qp *qp, struct rte_crypto_op *op,
switch (sess->xfrm_type) {
case RTE_CRYPTO_ASYM_XFORM_RSA:
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
retval = process_openssl_rsa_op_evp(op, sess);
-# else
- retval = process_openssl_rsa_op(op, sess);
-#endif
break;
case RTE_CRYPTO_ASYM_XFORM_MODEX:
retval = process_openssl_modexp_op(op, sess);
@@ -4341,51 +3744,26 @@ process_asym_op(struct openssl_qp *qp, struct rte_crypto_op *op,
retval = process_openssl_modinv_op(op, sess);
break;
case RTE_CRYPTO_ASYM_XFORM_DH:
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
retval = process_openssl_dh_op_evp(op, sess);
-# else
- retval = process_openssl_dh_op(op, sess);
-#endif
break;
case RTE_CRYPTO_ASYM_XFORM_DSA:
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
if (op->asym->dsa.op_type == RTE_CRYPTO_ASYM_OP_SIGN)
retval = process_openssl_dsa_sign_op_evp(op, sess);
else if (op->asym->dsa.op_type ==
RTE_CRYPTO_ASYM_OP_VERIFY)
retval =
process_openssl_dsa_verify_op_evp(op, sess);
-#else
- if (op->asym->dsa.op_type == RTE_CRYPTO_ASYM_OP_SIGN)
- retval = process_openssl_dsa_sign_op(op, sess);
- else if (op->asym->dsa.op_type ==
- RTE_CRYPTO_ASYM_OP_VERIFY)
- retval =
- process_openssl_dsa_verify_op(op, sess);
else
op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
-#endif
break;
case RTE_CRYPTO_ASYM_XFORM_ECFPM:
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
retval = process_openssl_ecfpm_op_evp(op, sess);
-#else
- retval = process_openssl_ecfpm_op(op, sess);
-#endif
break;
case RTE_CRYPTO_ASYM_XFORM_SM2:
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
retval = process_openssl_sm2_op_evp(op, sess);
-#else
- retval = process_openssl_sm2_op(op, sess);
-#endif
break;
case RTE_CRYPTO_ASYM_XFORM_EDDSA:
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
retval = process_openssl_eddsa_op_evp(op, sess);
-#else
- retval = process_openssl_eddsa_op(op, sess);
-#endif
break;
case RTE_CRYPTO_ASYM_XFORM_ML_KEM:
#if (OPENSSL_VERSION_NUMBER >= 0x30500000L)
@@ -4590,13 +3968,12 @@ cryptodev_openssl_create(const char *name,
rte_cryptodev_pmd_probing_finish(dev);
-# if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
/* Load legacy provider
* Some algorithms are no longer available in earlier version of openssl,
* unless the legacy provider explicitly loaded. e.g. DES
*/
ossl_legacy_provider_load();
-# endif
+
return 0;
init_error:
@@ -4645,9 +4022,8 @@ cryptodev_openssl_remove(struct rte_vdev_device *vdev)
if (cryptodev == NULL)
return -ENODEV;
-# if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
ossl_legacy_provider_unload();
-# endif
+
return rte_cryptodev_pmd_destroy(cryptodev);
}
diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
index 4e5fb07bb2..d927cc5228 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
@@ -10,11 +10,9 @@
#include "openssl_pmd_private.h"
#include "compat.h"
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
#include <openssl/provider.h>
#include <openssl/core_names.h>
#include <openssl/param_build.h>
-#endif
static const struct rte_cryptodev_capabilities openssl_pmd_capabilities[] = {
{ /* MD5 HMAC */
@@ -457,7 +455,6 @@ static const struct rte_cryptodev_capabilities openssl_pmd_capabilities[] = {
}, }
}, }
},
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
{ /* SHAKE_128 */
.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
{.sym = {
@@ -500,7 +497,6 @@ static const struct rte_cryptodev_capabilities openssl_pmd_capabilities[] = {
}, }
}, }
},
-#endif
{ /* AES CBC */
.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
{.sym = {
@@ -1222,7 +1218,6 @@ static int openssl_set_asym_session_parameters(
goto err_rsa;
asym_session->u.r.pad = xform->rsa.padding.type;
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
OSSL_PARAM_BLD * param_bld = OSSL_PARAM_BLD_new();
if (!param_bld) {
OPENSSL_LOG(ERR, "failed to allocate resources");
@@ -1323,79 +1318,7 @@ static int openssl_set_asym_session_parameters(
OSSL_PARAM_BLD_free(param_bld);
OSSL_PARAM_free(params);
ret = 0;
-#else
- RSA *rsa = RSA_new();
- if (rsa == NULL)
- goto err_rsa;
-
- if (xform->rsa.d.length > 0) {
- d = BN_bin2bn(
- (const unsigned char *)xform->rsa.d.data,
- xform->rsa.d.length,
- d);
- if (!d) {
- RSA_free(rsa);
- goto err_rsa;
- }
- }
-
- if (xform->rsa.key_type == RTE_RSA_KEY_TYPE_QT) {
- p = BN_bin2bn((const unsigned char *)
- xform->rsa.qt.p.data,
- xform->rsa.qt.p.length,
- p);
- q = BN_bin2bn((const unsigned char *)
- xform->rsa.qt.q.data,
- xform->rsa.qt.q.length,
- q);
- dmp1 = BN_bin2bn((const unsigned char *)
- xform->rsa.qt.dP.data,
- xform->rsa.qt.dP.length,
- dmp1);
- dmq1 = BN_bin2bn((const unsigned char *)
- xform->rsa.qt.dQ.data,
- xform->rsa.qt.dQ.length,
- dmq1);
- iqmp = BN_bin2bn((const unsigned char *)
- xform->rsa.qt.qInv.data,
- xform->rsa.qt.qInv.length,
- iqmp);
- if (!p || !q || !dmp1 || !dmq1 || !iqmp) {
- RSA_free(rsa);
- goto err_rsa;
- }
- ret = set_rsa_params(rsa, p, q);
- if (ret) {
- OPENSSL_LOG(ERR,
- "failed to set rsa params");
- RSA_free(rsa);
- goto err_rsa;
- }
- ret = set_rsa_crt_params(rsa, dmp1, dmq1, iqmp);
- if (ret) {
- OPENSSL_LOG(ERR,
- "failed to set crt params");
- RSA_free(rsa);
- /*
- * set already populated params to NULL
- * as its freed by call to RSA_free
- */
- p = q = NULL;
- goto err_rsa;
- }
- }
-
- ret = set_rsa_keys(rsa, n, e, d);
- if (ret) {
- OPENSSL_LOG(ERR, "Failed to load rsa keys");
- RSA_free(rsa);
- return ret;
- }
- asym_session->u.r.rsa = rsa;
- asym_session->xfrm_type = RTE_CRYPTO_ASYM_XFORM_RSA;
- break;
-#endif
err_rsa:
BN_clear_free(n);
BN_clear_free(e);
@@ -1469,7 +1392,6 @@ static int openssl_set_asym_session_parameters(
case RTE_CRYPTO_ASYM_XFORM_DH:
{
DH *dh = NULL;
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
BIGNUM **p = &asym_session->u.dh.p;
BIGNUM **g = &asym_session->u.dh.g;
@@ -1520,51 +1442,18 @@ static int openssl_set_asym_session_parameters(
asym_session->u.dh.param_bld = param_bld;
asym_session->u.dh.param_bld_peer = param_bld_peer;
-#else
- BIGNUM *p = NULL;
- BIGNUM *g = NULL;
-
- p = BN_bin2bn((const unsigned char *)
- xform->dh.p.data,
- xform->dh.p.length,
- p);
- g = BN_bin2bn((const unsigned char *)
- xform->dh.g.data,
- xform->dh.g.length,
- g);
- if (!p || !g)
- goto err_dh;
-
- dh = DH_new();
- if (dh == NULL) {
- OPENSSL_LOG(ERR,
- "failed to allocate resources");
- goto err_dh;
- }
- ret = set_dh_params(dh, p, g);
- if (ret) {
- DH_free(dh);
- goto err_dh;
- }
-#endif
asym_session->u.dh.dh_key = dh;
asym_session->xfrm_type = RTE_CRYPTO_ASYM_XFORM_DH;
break;
err_dh:
OPENSSL_LOG(ERR, " failed to set dh params");
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
BN_free(*p);
BN_free(*g);
-#else
- BN_free(p);
- BN_free(g);
-#endif
return -1;
}
case RTE_CRYPTO_ASYM_XFORM_DSA:
{
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
BIGNUM **p = &asym_session->u.s.p;
BIGNUM **g = &asym_session->u.s.g;
BIGNUM **q = &asym_session->u.s.q;
@@ -1615,85 +1504,16 @@ static int openssl_set_asym_session_parameters(
asym_session->u.s.param_bld = param_bld;
break;
-#else
- BIGNUM *p = NULL, *g = NULL;
- BIGNUM *q = NULL, *priv_key = NULL;
- BIGNUM *pub_key = BN_new();
- BN_zero(pub_key);
-
- p = BN_bin2bn((const unsigned char *)
- xform->dsa.p.data,
- xform->dsa.p.length,
- p);
-
- g = BN_bin2bn((const unsigned char *)
- xform->dsa.g.data,
- xform->dsa.g.length,
- g);
-
- q = BN_bin2bn((const unsigned char *)
- xform->dsa.q.data,
- xform->dsa.q.length,
- q);
- if (!p || !q || !g)
- goto err_dsa;
-
- priv_key = BN_bin2bn((const unsigned char *)
- xform->dsa.x.data,
- xform->dsa.x.length,
- priv_key);
- if (priv_key == NULL)
- goto err_dsa;
-
- DSA *dsa = DSA_new();
- if (dsa == NULL) {
- OPENSSL_LOG(ERR,
- " failed to allocate resources");
- goto err_dsa;
- }
-
- ret = set_dsa_params(dsa, p, q, g);
- if (ret) {
- DSA_free(dsa);
- OPENSSL_LOG(ERR, "Failed to dsa params");
- goto err_dsa;
- }
-
- /*
- * openssl 1.1.0 mandate that public key can't be
- * NULL in very first call. so set a dummy pub key.
- * to keep consistency, lets follow same approach for
- * both versions
- */
- /* just set dummy public for very 1st call */
- ret = set_dsa_keys(dsa, pub_key, priv_key);
- if (ret) {
- DSA_free(dsa);
- OPENSSL_LOG(ERR, "Failed to set keys");
- goto err_dsa;
- }
- asym_session->u.s.dsa = dsa;
- asym_session->xfrm_type = RTE_CRYPTO_ASYM_XFORM_DSA;
- break;
-#endif
err_dsa:
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
BN_free(*p);
BN_free(*q);
BN_free(*g);
BN_free(*priv_key);
-#else
- BN_free(p);
- BN_free(q);
- BN_free(g);
- BN_free(priv_key);
-#endif
BN_free(pub_key);
return -1;
}
case RTE_CRYPTO_ASYM_XFORM_ECFPM:
{
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
EC_GROUP *ecgrp = NULL;
asym_session->xfrm_type = xform->xform_type;
@@ -1727,14 +1547,9 @@ static int openssl_set_asym_session_parameters(
asym_session->u.ec.curve_id = xform->ec.curve_id;
asym_session->u.ec.group = ecgrp;
break;
-#else
- OPENSSL_LOG(WARNING, "ECFPM unsupported for OpenSSL Version < 3.0");
- return -ENOTSUP;
-#endif
}
case RTE_CRYPTO_ASYM_XFORM_SM2:
{
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
#ifndef OPENSSL_NO_SM2
OSSL_PARAM_BLD *param_bld = NULL;
OSSL_PARAM *params = NULL;
@@ -1818,10 +1633,6 @@ static int openssl_set_asym_session_parameters(
#else
OPENSSL_LOG(WARNING, "SM2 unsupported in current OpenSSL Version");
return -ENOTSUP;
-#endif
-#else
- OPENSSL_LOG(WARNING, "SM2 unsupported for OpenSSL Version < 3.0");
- return -ENOTSUP;
#endif
}
case RTE_CRYPTO_ASYM_XFORM_EDDSA:
@@ -1983,12 +1794,7 @@ static void openssl_reset_asym_session(struct openssl_asym_session *sess)
{
switch (sess->xfrm_type) {
case RTE_CRYPTO_ASYM_XFORM_RSA:
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
EVP_PKEY_CTX_free(sess->u.r.ctx);
-#else
- if (sess->u.r.rsa)
- RSA_free(sess->u.r.rsa);
-#endif
break;
case RTE_CRYPTO_ASYM_XFORM_MODEX:
if (sess->u.e.ctx) {
@@ -2003,35 +1809,23 @@ static void openssl_reset_asym_session(struct openssl_asym_session *sess)
}
break;
case RTE_CRYPTO_ASYM_XFORM_DH:
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
OSSL_PARAM_BLD_free(sess->u.dh.param_bld);
OSSL_PARAM_BLD_free(sess->u.dh.param_bld_peer);
sess->u.dh.param_bld = NULL;
sess->u.dh.param_bld_peer = NULL;
-#else
- if (sess->u.dh.dh_key)
- DH_free(sess->u.dh.dh_key);
-#endif
BN_clear_free(sess->u.dh.p);
BN_clear_free(sess->u.dh.g);
break;
case RTE_CRYPTO_ASYM_XFORM_DSA:
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
OSSL_PARAM_BLD_free(sess->u.s.param_bld);
sess->u.s.param_bld = NULL;
BN_clear_free(sess->u.s.p);
BN_clear_free(sess->u.s.q);
BN_clear_free(sess->u.s.g);
BN_clear_free(sess->u.s.priv_key);
-#else
- if (sess->u.s.dsa)
- DSA_free(sess->u.s.dsa);
-#endif
break;
case RTE_CRYPTO_ASYM_XFORM_SM2:
-#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
OSSL_PARAM_free(sess->u.sm2.params);
-#endif
break;
case RTE_CRYPTO_ASYM_XFORM_EDDSA:
#if (OPENSSL_VERSION_NUMBER >= 0x30300000L)
--
2.43.0
^ permalink raw reply related
* [PATCH] net/mlx5: promote private API to stable
From: Dariusz Sosnowski @ 2026-05-27 10:33 UTC (permalink / raw)
To: Viacheslav Ovsiienko, Bing Zhao, Ori Kam, Suanming Mou,
Matan Azrad; +Cc: dev
Following experimental functions are exposed by mlx5 PMD
since 25.11 release:
- rte_pmd_mlx5_driver_event_cb_register
- rte_pmd_mlx5_driver_event_cb_unregister
- rte_pmd_mlx5_enable_steering
- rte_pmd_mlx5_disable_steering
First two are used to register callbacks for driver events
(when Rx/Tx queues are created or destroyed).
Other two are used to enable/disable flow steering in mlx5 PMD.
No changes were made and no changes are planned to these symbols.
These are currently used by NVIDIA DOCA SDK since version 3.3,
which started depending on upstream DPDK releases [1].
Purpose of their use is to:
- expose HW identifiers of Rx/Tx mlx5 queues managed by DPDK and
- allow flow steering to happen outside of DPDK.
Also, some of these symbols will be used by netdev-doca backend
in Open vSwitch [2].
Whenever a DOCA netdev would be added/removed in Open vSwitch,
it will have to disable/enable steering for mlx5 driver.
Stabilizing these symbols is required by current OVS policy
to remove the need for ALLOW_EXPERIMENTAL_API [3].
This patch promotes aforementioned symbols to stable.
[1]: https://docs.nvidia.com/doca/sdk/customer-affecting-changes/index.html
[2]: https://patchwork.ozlabs.org/project/openvswitch/list/?series=504726&state=%2A&archive=both
[3]: https://mail.openvswitch.org/pipermail/ovs-dev/2026-May/432066.html
Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
drivers/net/mlx5/mlx5_driver_event.c | 4 ++--
drivers/net/mlx5/mlx5_flow.c | 4 ++--
drivers/net/mlx5/rte_pmd_mlx5.h | 4 ----
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_driver_event.c b/drivers/net/mlx5/mlx5_driver_event.c
index 1dc8029ee5..89e49331c8 100644
--- a/drivers/net/mlx5/mlx5_driver_event.c
+++ b/drivers/net/mlx5/mlx5_driver_event.c
@@ -236,7 +236,7 @@ notify_existing_devices(rte_pmd_mlx5_driver_event_callback_t cb, void *opaque)
notify_existing_queues(port_id, cb, opaque);
}
-RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_mlx5_driver_event_cb_register, 25.11)
+RTE_EXPORT_SYMBOL(rte_pmd_mlx5_driver_event_cb_register)
int
rte_pmd_mlx5_driver_event_cb_register(rte_pmd_mlx5_driver_event_callback_t cb, void *opaque)
{
@@ -264,7 +264,7 @@ rte_pmd_mlx5_driver_event_cb_register(rte_pmd_mlx5_driver_event_callback_t cb, v
return 0;
}
-RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_mlx5_driver_event_cb_unregister, 25.11)
+RTE_EXPORT_SYMBOL(rte_pmd_mlx5_driver_event_cb_unregister)
int
rte_pmd_mlx5_driver_event_cb_unregister(rte_pmd_mlx5_driver_event_callback_t cb)
{
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 915ea29a5a..a95dd9dc94 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -12506,7 +12506,7 @@ flow_disable_steering_run_on_related(struct rte_eth_dev *dev,
}
}
-RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_mlx5_disable_steering, 25.11)
+RTE_EXPORT_SYMBOL(rte_pmd_mlx5_disable_steering)
void
rte_pmd_mlx5_disable_steering(void)
{
@@ -12532,7 +12532,7 @@ rte_pmd_mlx5_disable_steering(void)
mlx5_steering_disabled = true;
}
-RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_mlx5_enable_steering, 25.11)
+RTE_EXPORT_SYMBOL(rte_pmd_mlx5_enable_steering)
int
rte_pmd_mlx5_enable_steering(void)
{
diff --git a/drivers/net/mlx5/rte_pmd_mlx5.h b/drivers/net/mlx5/rte_pmd_mlx5.h
index 7acfdae97d..8f355070e1 100644
--- a/drivers/net/mlx5/rte_pmd_mlx5.h
+++ b/drivers/net/mlx5/rte_pmd_mlx5.h
@@ -546,7 +546,6 @@ int rte_pmd_mlx5_external_sq_disable(uint16_t port_id, uint32_t sq_num);
* - (-EEXIST) if @p cb was already registered.
* - (-ENOMEM) if failed to allocate memory for callback entry.
*/
-__rte_experimental
int
rte_pmd_mlx5_driver_event_cb_register(rte_pmd_mlx5_driver_event_callback_t cb, void *opaque);
@@ -567,7 +566,6 @@ rte_pmd_mlx5_driver_event_cb_register(rte_pmd_mlx5_driver_event_callback_t cb, v
* - 0 if callback was successfully unregistered or if no such callback was registered.
* - (-EINVAL) if @p cb is NULL.
*/
-__rte_experimental
int
rte_pmd_mlx5_driver_event_cb_unregister(rte_pmd_mlx5_driver_event_callback_t cb);
@@ -605,7 +603,6 @@ rte_pmd_mlx5_driver_event_cb_unregister(rte_pmd_mlx5_driver_event_callback_t cb)
* with other functions from ethdev API used to configure any of the mlx5 ports.
* It is the responsibility of the application to enforce this.
*/
-__rte_experimental
void
rte_pmd_mlx5_disable_steering(void);
@@ -623,7 +620,6 @@ rte_pmd_mlx5_disable_steering(void);
* - 0 - Flow steering was successfully enabled or it flow steering was never disabled.
* - (-EBUSY) - There are mlx5 ports probed and re-enabling steering cannot be done safely.
*/
-__rte_experimental
int
rte_pmd_mlx5_enable_steering(void);
--
2.47.3
^ permalink raw reply related
* [PATCH] ethdev: promote flow metadata APIs to stable
From: Dariusz Sosnowski @ 2026-05-27 10:32 UTC (permalink / raw)
To: Ori Kam, Thomas Monjalon, Andrew Rybchenko; +Cc: dev
Following experimental symbols related to flow metadata
were added in v19.11:
- rte_flow_dynf_metadata_register
- rte_flow_dynf_metadata_offs
- rte_flow_dynf_metadata_mask
Type of rte_flow_dynf_metadata_offs was changed from int to int32_t
in v20.05 release.
There were no changes to these symbols since then.
This patch promotes these symbols and removes __rte_experimental
from the following inline functions:
- rte_flow_dynf_metadata_avail
- rte_flow_dynf_metadata_get
- rte_flow_dynf_metadata_set
All these symbols and functions will be used by netdev-doca
backend in Open vSwitch [1].
Stabilizing these symbols is required by current OVS policy
to remove the need for ALLOW_EXPERIMENTAL_API [2].
[1]: https://patchwork.ozlabs.org/project/openvswitch/list/?series=504726&state=%2A&archive=both
[2]: https://mail.openvswitch.org/pipermail/ovs-dev/2026-May/432066.html
Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
lib/ethdev/rte_flow.c | 6 +++---
lib/ethdev/rte_flow.h | 4 ----
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index 7a51b667cf..ec0fe08355 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -23,11 +23,11 @@
#define FLOW_LOG RTE_ETHDEV_LOG_LINE
/* Mbuf dynamic field name for metadata. */
-RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_flow_dynf_metadata_offs, 19.11)
+RTE_EXPORT_SYMBOL(rte_flow_dynf_metadata_offs)
int32_t rte_flow_dynf_metadata_offs = -1;
/* Mbuf dynamic field flag bit number for metadata. */
-RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_flow_dynf_metadata_mask, 19.11)
+RTE_EXPORT_SYMBOL(rte_flow_dynf_metadata_mask)
uint64_t rte_flow_dynf_metadata_mask;
/**
@@ -281,7 +281,7 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {
MK_FLOW_ACTION(JUMP_TO_TABLE_INDEX, sizeof(struct rte_flow_action_jump_to_table_index)),
};
-RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_flow_dynf_metadata_register, 19.11)
+RTE_EXPORT_SYMBOL(rte_flow_dynf_metadata_register)
int
rte_flow_dynf_metadata_register(void)
{
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index ba3bcc89a3..0c6d42c0d8 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -4253,14 +4253,12 @@ extern uint64_t rte_flow_dynf_metadata_mask;
#define RTE_MBUF_DYNFLAG_RX_METADATA (rte_flow_dynf_metadata_mask)
#define RTE_MBUF_DYNFLAG_TX_METADATA (rte_flow_dynf_metadata_mask)
-__rte_experimental
static inline uint32_t
rte_flow_dynf_metadata_get(struct rte_mbuf *m)
{
return *RTE_FLOW_DYNF_METADATA(m);
}
-__rte_experimental
static inline void
rte_flow_dynf_metadata_set(struct rte_mbuf *m, uint32_t v)
{
@@ -4590,7 +4588,6 @@ rte_flow_dev_dump(uint16_t port_id, struct rte_flow *flow,
* @return
* True if registered, false otherwise.
*/
-__rte_experimental
static inline int
rte_flow_dynf_metadata_avail(void)
{
@@ -4607,7 +4604,6 @@ rte_flow_dynf_metadata_avail(void)
* @return
* 0 on success, a negative errno value otherwise and rte_errno is set.
*/
-__rte_experimental
int
rte_flow_dynf_metadata_register(void);
--
2.47.3
^ permalink raw reply related
* Re: [RFC v2 2/3] lib: add fastmem library
From: Bruce Richardson @ 2026-05-27 10:18 UTC (permalink / raw)
To: Mattias Rönnblom
Cc: Stephen Hemminger, dev, Morten Brørup, Konstantin Ananyev,
Mattias Rönnblom, Yogaraj Baskaravel
In-Reply-To: <b3982582-3023-4f2c-9c62-10d4af20d4e2@lysator.liu.se>
On Wed, May 27, 2026 at 12:12:19PM +0200, Mattias Rönnblom wrote:
> On 5/26/26 15:23, Stephen Hemminger wrote:
> > On Tue, 26 May 2026 10:57:42 +0200
> > Mattias Rönnblom <hofors@lysator.liu.se> wrote:
> >
> > > +__rte_experimental
> > > +void *
> > > +rte_fastmem_alloc(size_t size, size_t align, unsigned int flags)
> > > + __rte_alloc_size(1) __rte_alloc_align(2);
> >
> > Should also add attribute __rte_malloc which tells compiler
> > that pointer returned cannot alias other memory
> >
> > And add __rte_dealloc(rte_fastmem_free, 1)
> > which tells compiler that the returned pointer should only go
> > back to fastmem (not free, rte_free, etc).
>
> Done. Only works for the single-object ops (not bulk) though.
>
> I've had a look at how to extend fastmem to support larger allocations
> (without suggesting this is the way to go).
>
> Seems to me that implementation should be something like
> a) slab allocator for small objects.
> b) a cache-less per-socket page run allocator for mid-sized objects.
> c) per-object memzones for large objects.
>
> If one would implement that, you would essentially have a plug-in
> replacement for rte_malloc.h (maybe minus some debug and some more esoteric
> DPDK heap features).
>
> Should fastmem be an outright replacement, or something that at least
> initially lives alongside the regular heap, maybe with a run- or
> compile-time option to make rte_malloc.h functions delegate to fastmem? This
> is unclear to me at this point. I fear the more ambitious, cleaner and more
> risky DPDK heap replacement path will go they way my attempts to replace
> rte_memcpy or rte_timer went.
>
> I would agree with anyone saying that we should have only one heap-like API
> for memory allocations. rte_malloc.h obviously needs to stay, for backward
> compatibility reason, if nothing else. I would like to add bulk alloc/free,
> and allow for smaller alignments than 64, since slabs can do that
> efficiently (DPDK heap per-object header is 128 bytes!). One could either go
> about that by extending rte_malloc.h or deprecating that API and starting
> anew. In the latter case, one could do many more minor tweaks, like removing
> the type pointers (only a nuance), remove the validate function, change and
> extend the stats interface, etc.
>
+1 for replacing rte_malloc. For a replacement, I'd tend towards aiming for
compatibilty over trying to fix too many little things at once. While
changing a couple of things is ok, I'd rather not force applications to
make too many updates to their code when moving from one DPDK version to
another.
/Bruce
^ permalink raw reply
* Re: [RFC v2 2/3] lib: add fastmem library
From: Mattias Rönnblom @ 2026-05-27 10:12 UTC (permalink / raw)
To: Stephen Hemminger
Cc: dev, Morten Brørup, Konstantin Ananyev,
Mattias Rönnblom, Yogaraj Baskaravel
In-Reply-To: <20260526062312.33f76fcc@phoenix.local>
On 5/26/26 15:23, Stephen Hemminger wrote:
> On Tue, 26 May 2026 10:57:42 +0200
> Mattias Rönnblom <hofors@lysator.liu.se> wrote:
>
>> +__rte_experimental
>> +void *
>> +rte_fastmem_alloc(size_t size, size_t align, unsigned int flags)
>> + __rte_alloc_size(1) __rte_alloc_align(2);
>
> Should also add attribute __rte_malloc which tells compiler
> that pointer returned cannot alias other memory
>
> And add __rte_dealloc(rte_fastmem_free, 1)
> which tells compiler that the returned pointer should only go
> back to fastmem (not free, rte_free, etc).
Done. Only works for the single-object ops (not bulk) though.
I've had a look at how to extend fastmem to support larger allocations
(without suggesting this is the way to go).
Seems to me that implementation should be something like
a) slab allocator for small objects.
b) a cache-less per-socket page run allocator for mid-sized objects.
c) per-object memzones for large objects.
If one would implement that, you would essentially have a plug-in
replacement for rte_malloc.h (maybe minus some debug and some more
esoteric DPDK heap features).
Should fastmem be an outright replacement, or something that at least
initially lives alongside the regular heap, maybe with a run- or
compile-time option to make rte_malloc.h functions delegate to fastmem?
This is unclear to me at this point. I fear the more ambitious, cleaner
and more risky DPDK heap replacement path will go they way my attempts
to replace rte_memcpy or rte_timer went.
I would agree with anyone saying that we should have only one heap-like
API for memory allocations. rte_malloc.h obviously needs to stay, for
backward compatibility reason, if nothing else. I would like to add bulk
alloc/free, and allow for smaller alignments than 64, since slabs can do
that efficiently (DPDK heap per-object header is 128 bytes!). One could
either go about that by extending rte_malloc.h or deprecating that API
and starting anew. In the latter case, one could do many more minor
tweaks, like removing the type pointers (only a nuance), remove the
validate function, change and extend the stats interface, etc.
^ permalink raw reply
* Re: [PATCH V2 00/15] power: unify and improve lcore ID verification
From: lihuisong (C) @ 2026-05-27 9:54 UTC (permalink / raw)
To: Stephen Hemminger
Cc: anatoly.burakov, sivaprasad.tummala, dev, thomas, fengchengwen,
yangxingui, zhanjie9
In-Reply-To: <20260526121813.0e15163e@phoenix.local>
On 5/27/2026 3:18 AM, Stephen Hemminger wrote:
> On Tue, 19 May 2026 21:09:47 +0800
> "lihuisong (C)" <lihuisong@huawei.com> wrote:
>
>> Thanks for giving me this AI review feedback.
>> Some of them are still acceptable. will fix it in next version.
>>
>> Is this summary from AI generated for each patche series?
>> May ask where you obtained this information about AI review?
> There is automated review from CI which is done after CI tests runs pass.
> But it is using older version of AGENTS.md and missing tool skills support.
> I use Claude AI project with current version of AGENTS.md.
> It gives the best reviews since it is willing to go look at the existing code.
> Other methods just look at the patch itself.
Got it. Thanks for your AI review.
^ permalink raw reply
* RE: [PATCH v5] mempool: improve cache behaviour and performance
From: Morten Brørup @ 2026-05-27 9:22 UTC (permalink / raw)
To: Bruce Richardson
Cc: dev, Andrew Rybchenko, Jingjing Wu, Praveen Shetty,
Hemant Agrawal, Sachin Saxena
In-Reply-To: <ahavyHwTzyPPDkQ4@bricha3-mobl1.ger.corp.intel.com>
> From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> Sent: Wednesday, 27 May 2026 10.48
>
> On Tue, May 26, 2026 at 07:45:24PM +0200, Morten Brørup wrote:
> > > From: Morten Brørup [mailto:mb@smartsharesystems.com]
> > > Sent: Tuesday, 26 May 2026 12.37
> > >
> > > > From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> > > > Sent: Tuesday, 26 May 2026 11.40
> > > >
> >
> > [...]
> >
> > > > [In all this, I am making the assumption that burst size is well
> less
> > > > than
> > > > cache size. Also, similar logic would be applicable for the
> inverse
> > > > scenario, e.g. flush to empty (and fill burst) and fill to 75%]
> > >
> > > I'm not so sure about this assumption.
> > > With a cache size of 512 and a bursts of 64, the cache only holds 8
> > > bursts.
> > > 50% is 4 bursts, and 25% is only 2 bursts.
> > >
> > > Using a replenish/drain level in the middle requires 5 bursts in
> either
> > > direction to pass the edge (and trigger replenish/flush).
> > > Using a replenish/drain level 25% from the edge requires only 3
> bursts
> > > in the wrong direction to pass the edge (and trigger
> replenish/flush).
> > > Much higher probability with random get/put.
> > >
> > > >
> > > > Now, all said, I tend to agree that we want to leave space for a
> > > decent
> > > > size burst after a fill. That is why I think that filling to 75%
> is
> > > > reasonable. After an alloc that triggers a fill, I don't want the
> > > cache
> > > > less than 50% full, but not completely full so there is room for
> a
> > > free
> > > > without a flush, and similarly for a free that triggers a flush,
> the
> > > > cache
> > > > should not be empty, but also should not be more than half full.
> > > >
> > > > One suggestion - we could always add a simple tunable that
> specifies
> > > > the
> > > > margin, or reserved entries for alloc and free. We can then guide
> in
> > > > the
> > > > docs that the value should be e.g. "zero for apps where alloc and
> > > free
> > > > take
> > > > place on different cores. 20%-50% of cache is recommended where
> alloc
> > > > and
> > > > free take place on the same core"
> > >
> > > Yes, a simple tunable is a really good idea.
> > >
> > > At this point, I think we should optimize for use case #1, and go
> for
> > > the 50% fill level.
> > > Then we can add a tunable to optimize for use case #2 later. I will
> try
> > > to come up with a draft for such a follow-up patch within the next
> few
> > > days.
> >
> > Adding a tunable is not so simple...
> > The choice of mempool cache algorithm (drain/replenish to 50% vs.
> drain/replenish completely) should be passed via the "flags" parameter
> in rte_mempool_create(), but rte_pktmbuf_pool_create() is missing the
> "flags" parameter.
> > We can add it at the next ABI breaking release.
> > WDYT?
> >
> I don't want this just a binary flag with two settings, I think it
> should be an actual numeric value.
If it was plain and simple to support a numeric value, I'd do it.
But the two algorithms differ too much.
If needed, the flag can be used as an enum to support more algorithms in the future.
My WIP (not even build tested), where you can see the different algorithms steered by the cache->flags field, looks like this:
static __rte_always_inline void
rte_mempool_do_generic_put(struct rte_mempool *mp, void * const *obj_table,
unsigned int n, struct rte_mempool_cache *cache)
{
void **cache_objs;
/* No cache provided? */
if (unlikely(cache == NULL))
goto driver_enqueue;
/* Increment stats now, adding in mempool always succeeds. */
RTE_MEMPOOL_CACHE_STAT_ADD(cache, put_bulk, 1);
RTE_MEMPOOL_CACHE_STAT_ADD(cache, put_objs, n);
__rte_assume(cache->size <= RTE_MEMPOOL_CACHE_MAX_SIZE);
__rte_assume(cache->len <= RTE_MEMPOOL_CACHE_MAX_SIZE);
__rte_assume(cache->len <= cache->size);
if (likely(cache->len + n <= cache->size)) {
/* Sufficient room in the cache for the objects. */
cache_objs = &cache->objs[cache->len];
cache->len += n;
/* Add the objects to the cache. */
rte_memcpy(cache_objs, obj_table, sizeof(void *) * n);
return;
}
/* Insufficient room in the cache for the objects. */
if (cache->flags & RTE_MEMPOOL_F_CACHE_ACCESS_ONE_WAY) {
/* The algorithm is optimized for put or get operations only. */
/* The request itself exceeds the cache bounce buffer limit? */
__rte_assume(cache->size <= RTE_MEMPOOL_CACHE_MAX_SIZE);
if (n > cache->size)
goto driver_enqueue_stats_incremented;
/* Fill the cache completely by adding the first part of the objects. */
cache_objs = &cache->objs[cache->len];
rte_memcpy(cache_objs, obj_table, sizeof(void *) * (cache->size - cache->len));
obj_table += cache->size - cache->len;
/* Flush the entire cache to the backend. */
rte_mempool_ops_enqueue_bulk(mp, &cache->objs[0], cache->size);
/* Add the remaining objects to the cache. */
cache->len = n - (cache->size - cache->len);
rte_memcpy(&cache->objs[0], obj_table, sizeof(void *) * cache->len);
} else {
/* The algorithm is optimized for a balanced mix of put and get operations. */
/* The request itself exceeds the cache bounce buffer limit? */
__rte_assume(cache->size / 2 <= RTE_MEMPOOL_CACHE_MAX_SIZE / 2);
if (n > cache->size / 2)
goto driver_enqueue_stats_incremented;
/*
* Flush part of the cache to the backend to make room for the objects;
* flush (size / 2) objects from the bottom of the cache, where
* objects are less hot, and move down the remaining objects, which
* are more hot, from the upper half of the cache.
*/
__rte_assume(cache->len > cache->size / 2);
rte_mempool_ops_enqueue_bulk(mp, &cache->objs[0], cache->size / 2);
rte_memcpy(&cache->objs[0], &cache->objs[cache->size / 2],
sizeof(void *) * (cache->len - cache->size / 2));
cache_objs = &cache->objs[cache->len - cache->size / 2];
cache->len = cache->len - cache->size / 2 + n;
/* Add the objects to the cache. */
rte_memcpy(cache_objs, obj_table, sizeof(void *) * n);
}
return;
driver_enqueue:
/* increment stat now, adding in mempool always success */
RTE_MEMPOOL_STAT_ADD(mp, put_bulk, 1);
RTE_MEMPOOL_STAT_ADD(mp, put_objs, n);
driver_enqueue_stats_incremented:
/* push objects to the backend */
rte_mempool_ops_enqueue_bulk(mp, obj_table, n);
}
> Can we not use function versioning to add the
> new parameter to all functions needing it, without worrying about ABI
> breakage.
The public structures will also change, so I don't think so.
>
> /Bruce
^ permalink raw reply
* RE: [PATCH v2] app/test-pmd: add generic PROG action parser support
From: Ajmera, Megha @ 2026-05-27 9:20 UTC (permalink / raw)
To: Stephen Hemminger
Cc: Richardson, Bruce, Dumitrescu, Cristian, Shetty, Praveen,
Singh, Aman Deep, dev@dpdk.org
In-Reply-To: <20260526122218.1c29d917@phoenix.local>
>
> This looks like a third attempt to parse text into rte_flow.
> Not sure how this fits in and why it would be useful?
Thanks for the feedback.
I wanted to clarify the intent of this patch. The backend support for the PROG action already exists in the PMD. This patch is focused on adding the corresponding frontend (testpmd) parser support so that users can configure and exercise this functionality via CLI.
The motivation here is to enable configuration of programmable actions that are already supported in the backend but cannot currently be invoked through testpmd. With this addition, new actions that are exposed through PROG can be configured using the flow command interface.
Regards,
Megha
^ permalink raw reply
* [v2 2/2] test/crypto: fix prehash in MLDSA session
From: Gowrishankar Muthukrishnan @ 2026-05-27 9:14 UTC (permalink / raw)
To: dev, Akhil Goyal, Fan Zhang, Gowrishankar Muthukrishnan; +Cc: stable
In-Reply-To: <20260527091405.2105-1-gmuthukrishn@marvell.com>
Set prehash flag in MLDSA session as per test parameter.
Fixes: 76a5877072c0 ("test/crypto: add ML-KEM and ML-DSA cases")
Cc: stable@dpdk.org
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
v2:
- Corrected Fixes tag.
---
app/test/test_cryptodev_asym.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
index 73a8198e53..90af49e485 100644
--- a/app/test/test_cryptodev_asym.c
+++ b/app/test/test_cryptodev_asym.c
@@ -4236,6 +4236,7 @@ mldsa_sign(const void *test_data)
xform.mldsa.type = vector->type;
xform.mldsa.sign_deterministic = vector->sign_deterministic;
+ xform.mldsa.sign_prehash = !!vector->hash;
xform.xform_type = RTE_CRYPTO_ASYM_XFORM_ML_DSA;
rte_cryptodev_info_get(dev_id, &dev_info);
@@ -4310,6 +4311,7 @@ mldsa_sign(const void *test_data)
self->op->asym->mldsa.sigver.pubkey.length = vector->pubkey.length;
self->op->asym->mldsa.sigver.sign.data = sign;
self->op->asym->mldsa.sigver.sign.length = sign_len;
+ self->op->asym->mldsa.sigver.hash = vector->hash;
TEST_ASSERT_SUCCESS(send_one(),
"Failed to process crypto op (ML-DSA Verify)");
@@ -4332,6 +4334,7 @@ mldsa_sign(const void *test_data)
self->op->asym->mldsa.sigver.pubkey.length = vector->pubkey.length;
self->op->asym->mldsa.sigver.sign.data = sign;
self->op->asym->mldsa.sigver.sign.length = sign_len;
+ self->op->asym->mldsa.sigver.hash = vector->hash;
TEST_ASSERT_SUCCESS(send_one_no_status_check(),
"Failed to process crypto op (ML-DSA Verify)");
@@ -4352,12 +4355,26 @@ mldsa_verify(const void *test_data)
const struct crypto_testsuite_mldsa_params *vector = test_data;
const uint8_t dev_id = params->valid_devs[0];
struct rte_crypto_asym_xform xform = {0};
+ struct rte_cryptodev_info dev_info;
uint8_t sign[TEST_DATA_SIZE] = {0};
size_t sign_len;
xform.mldsa.type = vector->type;
xform.mldsa.sign_deterministic = vector->sign_deterministic;
+ xform.mldsa.sign_prehash = !!vector->hash;
xform.xform_type = RTE_CRYPTO_ASYM_XFORM_ML_DSA;
+
+ rte_cryptodev_info_get(dev_id, &dev_info);
+
+ /* Check if prehash is supported */
+ if (vector->hash) {
+ if (!(dev_info.feature_flags & RTE_CRYPTODEV_FF_MLDSA_SIGN_PREHASH)) {
+ RTE_LOG(DEBUG, USER1,
+ "Device doesn't support prehash in ML-DSA verify. Test skipped\n");
+ return TEST_SKIPPED;
+ }
+ }
+
if (rte_cryptodev_asym_session_create(dev_id, &xform,
params->session_mpool, &self->sess) < 0) {
RTE_LOG(ERR, USER1, "line %u FAILED: Session creation failed",
@@ -4379,6 +4396,7 @@ mldsa_verify(const void *test_data)
self->op->asym->mldsa.sigver.pubkey.length = vector->pubkey.length;
self->op->asym->mldsa.sigver.sign.data = vector->sign.data;
self->op->asym->mldsa.sigver.sign.length = vector->sign.length;
+ self->op->asym->mldsa.sigver.hash = vector->hash;
TEST_ASSERT_SUCCESS(send_one(),
"Failed to process crypto op (ML-DSA Verify)");
@@ -4403,6 +4421,7 @@ mldsa_verify(const void *test_data)
self->op->asym->mldsa.sigver.pubkey.length = vector->pubkey.length;
self->op->asym->mldsa.sigver.sign.data = sign;
self->op->asym->mldsa.sigver.sign.length = sign_len;
+ self->op->asym->mldsa.sigver.hash = vector->hash;
TEST_ASSERT_SUCCESS(send_one_no_status_check(),
"Failed to process crypto op (ML-DSA Verify)");
--
2.37.1
^ permalink raw reply related
* [v2 1/2] test/crypto: validate ML crypto keys
From: Gowrishankar Muthukrishnan @ 2026-05-27 9:13 UTC (permalink / raw)
To: dev, Akhil Goyal, Fan Zhang, Gowrishankar Muthukrishnan; +Cc: stable
In-Reply-To: <20260527085257.1933-1-gmuthukrishn@marvell.com>
Validate ML-KEM and ML-DSA keys.
Fixes: 76a5877072c0 ("test/crypto: add ML-KEM and ML-DSA cases")
Cc: stable@dpdk.org
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
v2:
- corrected Fixes tag.
---
app/test/test_cryptodev_asym.c | 48 ++++++++-----------
app/test/test_cryptodev_ml_dsa_test_vectors.h | 8 ++++
app/test/test_cryptodev_ml_kem_test_vectors.h | 8 ++++
3 files changed, 36 insertions(+), 28 deletions(-)
diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
index bf1a1fc417..73a8198e53 100644
--- a/app/test/test_cryptodev_asym.c
+++ b/app/test/test_cryptodev_asym.c
@@ -3949,19 +3949,15 @@ mlkem_keygen(const void *test_data)
rte_crypto_ml_kem_pubkey_size[vector->type],
"Incorrect Encapsulation key length\n");
- /* If the seed is all zero, keys are deterministic */
- if (memcmp(vector->d.data, (uint8_t [32]) {0},
- vector->d.length) == 0) {
- TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->dk.data,
- self->result_op->asym->mlkem.keygen.dk.data,
- self->result_op->asym->mlkem.keygen.dk.length,
- "Incorrect Decapsulation key\n");
- TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->ek.data,
- self->result_op->asym->mlkem.keygen.ek.data,
- self->result_op->asym->mlkem.keygen.ek.length,
- "Incorrect Encapsulation key\n");
- RTE_LOG(DEBUG, USER1, "Deterministic keygen test passed\n");
- }
+ TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->dk.data,
+ self->result_op->asym->mlkem.keygen.dk.data,
+ self->result_op->asym->mlkem.keygen.dk.length,
+ "Incorrect Decapsulation key\n");
+ TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->ek.data,
+ self->result_op->asym->mlkem.keygen.ek.data,
+ self->result_op->asym->mlkem.keygen.ek.length,
+ "Incorrect Encapsulation key\n");
+ RTE_LOG(DEBUG, USER1, "Deterministic keygen test passed\n");
rte_cryptodev_asym_session_free(dev_id, self->sess);
return TEST_SUCCESS;
@@ -4071,7 +4067,7 @@ mlkem_encap(const void *test_data)
self->op->asym->mlkem.decap.sk.data = sk;
self->op->asym->mlkem.decap.sk.length = 32;
- TEST_ASSERT_SUCCESS(send_one(),
+ TEST_ASSERT_SUCCESS(send_one_no_status_check(),
"Failed to process crypto op (ML-KEM Decap)");
debug_hexdump(stdout, "Shared secret from negative test",
@@ -4149,7 +4145,7 @@ mlkem_decap(const void *test_data)
self->op->asym->mlkem.decap.sk.data = sk;
self->op->asym->mlkem.decap.sk.length = 32;
- TEST_ASSERT_SUCCESS(send_one(),
+ TEST_ASSERT_SUCCESS(send_one_no_status_check(),
"Failed to process crypto op (ML-KEM Decap)");
debug_hexdump(stdout, "Shared secret from negative test",
@@ -4214,19 +4210,15 @@ mldsa_keygen(const void *test_data)
rte_crypto_ml_dsa_pubkey_size[vector->type],
"Incorrect Public key length\n");
- /* If the seed is all zero, keys are deterministic */
- if (memcmp(vector->seed.data, (uint8_t [32]) {0},
- vector->seed.length) == 0) {
- TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->privkey.data,
- self->result_op->asym->mldsa.keygen.privkey.data,
- self->result_op->asym->mldsa.keygen.privkey.length,
- "Incorrect Private key\n");
- TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->pubkey.data,
- self->result_op->asym->mldsa.keygen.pubkey.data,
- self->result_op->asym->mldsa.keygen.pubkey.length,
- "Incorrect Public key\n");
- RTE_LOG(DEBUG, USER1, "Deterministic keygen test passed\n");
- }
+ TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->privkey.data,
+ self->result_op->asym->mldsa.keygen.privkey.data,
+ self->result_op->asym->mldsa.keygen.privkey.length,
+ "Incorrect Private key\n");
+ TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->pubkey.data,
+ self->result_op->asym->mldsa.keygen.pubkey.data,
+ self->result_op->asym->mldsa.keygen.pubkey.length,
+ "Incorrect Public key\n");
+ RTE_LOG(DEBUG, USER1, "Deterministic keygen test passed\n");
rte_cryptodev_asym_session_free(dev_id, self->sess);
return TEST_SUCCESS;
diff --git a/app/test/test_cryptodev_ml_dsa_test_vectors.h b/app/test/test_cryptodev_ml_dsa_test_vectors.h
index f2453b9f34..675a6fad04 100644
--- a/app/test/test_cryptodev_ml_dsa_test_vectors.h
+++ b/app/test/test_cryptodev_ml_dsa_test_vectors.h
@@ -1653,6 +1653,14 @@ struct crypto_testsuite_mldsa_params mldsa_keygen_test_vectors[] = {
.data = mldsa_44_seed,
.length = sizeof(mldsa_44_seed),
},
+ .privkey = {
+ .data = mldsa_44_privkey,
+ .length = sizeof(mldsa_44_privkey),
+ },
+ .pubkey = {
+ .data = mldsa_44_pubkey,
+ .length = sizeof(mldsa_44_pubkey),
+ },
},
{
.name = "mldsa_44_keygen (deterministic)",
diff --git a/app/test/test_cryptodev_ml_kem_test_vectors.h b/app/test/test_cryptodev_ml_kem_test_vectors.h
index 8294acc29e..a1d727b969 100644
--- a/app/test/test_cryptodev_ml_kem_test_vectors.h
+++ b/app/test/test_cryptodev_ml_kem_test_vectors.h
@@ -785,6 +785,14 @@ struct crypto_testsuite_mlkem_params mlkem_keygen_test_vectors[] = {
.data = mlkem_512_z,
.length = sizeof(mlkem_512_z),
},
+ .dk = {
+ .data = mlkem_512_dk,
+ .length = sizeof(mlkem_512_dk),
+ },
+ .ek = {
+ .data = mlkem_512_ek,
+ .length = sizeof(mlkem_512_ek),
+ }
},
{
.name = "mlkem_512_keygen (deterministic)",
--
2.37.1
^ permalink raw reply related
* [PATCH 2/2] test/crypto: fix prehash in MLDSA session
From: Gowrishankar Muthukrishnan @ 2026-05-27 8:52 UTC (permalink / raw)
To: dev, Akhil Goyal, Fan Zhang, Gowrishankar Muthukrishnan; +Cc: stable
In-Reply-To: <20260527085257.1933-1-gmuthukrishn@marvell.com>
Set prehash flag in MLDSA session as per test parameter.
Fixes: 76a5877072c ("test/crypto: add ML-KEM and ML-DSA cases")
Cc: stable@dpdk.org
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
app/test/test_cryptodev_asym.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
index 73a8198e53..90af49e485 100644
--- a/app/test/test_cryptodev_asym.c
+++ b/app/test/test_cryptodev_asym.c
@@ -4236,6 +4236,7 @@ mldsa_sign(const void *test_data)
xform.mldsa.type = vector->type;
xform.mldsa.sign_deterministic = vector->sign_deterministic;
+ xform.mldsa.sign_prehash = !!vector->hash;
xform.xform_type = RTE_CRYPTO_ASYM_XFORM_ML_DSA;
rte_cryptodev_info_get(dev_id, &dev_info);
@@ -4310,6 +4311,7 @@ mldsa_sign(const void *test_data)
self->op->asym->mldsa.sigver.pubkey.length = vector->pubkey.length;
self->op->asym->mldsa.sigver.sign.data = sign;
self->op->asym->mldsa.sigver.sign.length = sign_len;
+ self->op->asym->mldsa.sigver.hash = vector->hash;
TEST_ASSERT_SUCCESS(send_one(),
"Failed to process crypto op (ML-DSA Verify)");
@@ -4332,6 +4334,7 @@ mldsa_sign(const void *test_data)
self->op->asym->mldsa.sigver.pubkey.length = vector->pubkey.length;
self->op->asym->mldsa.sigver.sign.data = sign;
self->op->asym->mldsa.sigver.sign.length = sign_len;
+ self->op->asym->mldsa.sigver.hash = vector->hash;
TEST_ASSERT_SUCCESS(send_one_no_status_check(),
"Failed to process crypto op (ML-DSA Verify)");
@@ -4352,12 +4355,26 @@ mldsa_verify(const void *test_data)
const struct crypto_testsuite_mldsa_params *vector = test_data;
const uint8_t dev_id = params->valid_devs[0];
struct rte_crypto_asym_xform xform = {0};
+ struct rte_cryptodev_info dev_info;
uint8_t sign[TEST_DATA_SIZE] = {0};
size_t sign_len;
xform.mldsa.type = vector->type;
xform.mldsa.sign_deterministic = vector->sign_deterministic;
+ xform.mldsa.sign_prehash = !!vector->hash;
xform.xform_type = RTE_CRYPTO_ASYM_XFORM_ML_DSA;
+
+ rte_cryptodev_info_get(dev_id, &dev_info);
+
+ /* Check if prehash is supported */
+ if (vector->hash) {
+ if (!(dev_info.feature_flags & RTE_CRYPTODEV_FF_MLDSA_SIGN_PREHASH)) {
+ RTE_LOG(DEBUG, USER1,
+ "Device doesn't support prehash in ML-DSA verify. Test skipped\n");
+ return TEST_SKIPPED;
+ }
+ }
+
if (rte_cryptodev_asym_session_create(dev_id, &xform,
params->session_mpool, &self->sess) < 0) {
RTE_LOG(ERR, USER1, "line %u FAILED: Session creation failed",
@@ -4379,6 +4396,7 @@ mldsa_verify(const void *test_data)
self->op->asym->mldsa.sigver.pubkey.length = vector->pubkey.length;
self->op->asym->mldsa.sigver.sign.data = vector->sign.data;
self->op->asym->mldsa.sigver.sign.length = vector->sign.length;
+ self->op->asym->mldsa.sigver.hash = vector->hash;
TEST_ASSERT_SUCCESS(send_one(),
"Failed to process crypto op (ML-DSA Verify)");
@@ -4403,6 +4421,7 @@ mldsa_verify(const void *test_data)
self->op->asym->mldsa.sigver.pubkey.length = vector->pubkey.length;
self->op->asym->mldsa.sigver.sign.data = sign;
self->op->asym->mldsa.sigver.sign.length = sign_len;
+ self->op->asym->mldsa.sigver.hash = vector->hash;
TEST_ASSERT_SUCCESS(send_one_no_status_check(),
"Failed to process crypto op (ML-DSA Verify)");
--
2.37.1
^ permalink raw reply related
* [PATCH 1/2] test/crypto: validate ML crypto keys
From: Gowrishankar Muthukrishnan @ 2026-05-27 8:52 UTC (permalink / raw)
To: dev, Akhil Goyal, Fan Zhang, Gowrishankar Muthukrishnan; +Cc: stable
Validate ML-KEM and ML-DSA keys.
Fixes: 76a5877072c ("test/crypto: add ML-KEM and ML-DSA cases")
Cc: stable@dpdk.org
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
app/test/test_cryptodev_asym.c | 48 ++++++++-----------
app/test/test_cryptodev_ml_dsa_test_vectors.h | 8 ++++
app/test/test_cryptodev_ml_kem_test_vectors.h | 8 ++++
3 files changed, 36 insertions(+), 28 deletions(-)
diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
index bf1a1fc417..73a8198e53 100644
--- a/app/test/test_cryptodev_asym.c
+++ b/app/test/test_cryptodev_asym.c
@@ -3949,19 +3949,15 @@ mlkem_keygen(const void *test_data)
rte_crypto_ml_kem_pubkey_size[vector->type],
"Incorrect Encapsulation key length\n");
- /* If the seed is all zero, keys are deterministic */
- if (memcmp(vector->d.data, (uint8_t [32]) {0},
- vector->d.length) == 0) {
- TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->dk.data,
- self->result_op->asym->mlkem.keygen.dk.data,
- self->result_op->asym->mlkem.keygen.dk.length,
- "Incorrect Decapsulation key\n");
- TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->ek.data,
- self->result_op->asym->mlkem.keygen.ek.data,
- self->result_op->asym->mlkem.keygen.ek.length,
- "Incorrect Encapsulation key\n");
- RTE_LOG(DEBUG, USER1, "Deterministic keygen test passed\n");
- }
+ TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->dk.data,
+ self->result_op->asym->mlkem.keygen.dk.data,
+ self->result_op->asym->mlkem.keygen.dk.length,
+ "Incorrect Decapsulation key\n");
+ TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->ek.data,
+ self->result_op->asym->mlkem.keygen.ek.data,
+ self->result_op->asym->mlkem.keygen.ek.length,
+ "Incorrect Encapsulation key\n");
+ RTE_LOG(DEBUG, USER1, "Deterministic keygen test passed\n");
rte_cryptodev_asym_session_free(dev_id, self->sess);
return TEST_SUCCESS;
@@ -4071,7 +4067,7 @@ mlkem_encap(const void *test_data)
self->op->asym->mlkem.decap.sk.data = sk;
self->op->asym->mlkem.decap.sk.length = 32;
- TEST_ASSERT_SUCCESS(send_one(),
+ TEST_ASSERT_SUCCESS(send_one_no_status_check(),
"Failed to process crypto op (ML-KEM Decap)");
debug_hexdump(stdout, "Shared secret from negative test",
@@ -4149,7 +4145,7 @@ mlkem_decap(const void *test_data)
self->op->asym->mlkem.decap.sk.data = sk;
self->op->asym->mlkem.decap.sk.length = 32;
- TEST_ASSERT_SUCCESS(send_one(),
+ TEST_ASSERT_SUCCESS(send_one_no_status_check(),
"Failed to process crypto op (ML-KEM Decap)");
debug_hexdump(stdout, "Shared secret from negative test",
@@ -4214,19 +4210,15 @@ mldsa_keygen(const void *test_data)
rte_crypto_ml_dsa_pubkey_size[vector->type],
"Incorrect Public key length\n");
- /* If the seed is all zero, keys are deterministic */
- if (memcmp(vector->seed.data, (uint8_t [32]) {0},
- vector->seed.length) == 0) {
- TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->privkey.data,
- self->result_op->asym->mldsa.keygen.privkey.data,
- self->result_op->asym->mldsa.keygen.privkey.length,
- "Incorrect Private key\n");
- TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->pubkey.data,
- self->result_op->asym->mldsa.keygen.pubkey.data,
- self->result_op->asym->mldsa.keygen.pubkey.length,
- "Incorrect Public key\n");
- RTE_LOG(DEBUG, USER1, "Deterministic keygen test passed\n");
- }
+ TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->privkey.data,
+ self->result_op->asym->mldsa.keygen.privkey.data,
+ self->result_op->asym->mldsa.keygen.privkey.length,
+ "Incorrect Private key\n");
+ TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->pubkey.data,
+ self->result_op->asym->mldsa.keygen.pubkey.data,
+ self->result_op->asym->mldsa.keygen.pubkey.length,
+ "Incorrect Public key\n");
+ RTE_LOG(DEBUG, USER1, "Deterministic keygen test passed\n");
rte_cryptodev_asym_session_free(dev_id, self->sess);
return TEST_SUCCESS;
diff --git a/app/test/test_cryptodev_ml_dsa_test_vectors.h b/app/test/test_cryptodev_ml_dsa_test_vectors.h
index f2453b9f34..675a6fad04 100644
--- a/app/test/test_cryptodev_ml_dsa_test_vectors.h
+++ b/app/test/test_cryptodev_ml_dsa_test_vectors.h
@@ -1653,6 +1653,14 @@ struct crypto_testsuite_mldsa_params mldsa_keygen_test_vectors[] = {
.data = mldsa_44_seed,
.length = sizeof(mldsa_44_seed),
},
+ .privkey = {
+ .data = mldsa_44_privkey,
+ .length = sizeof(mldsa_44_privkey),
+ },
+ .pubkey = {
+ .data = mldsa_44_pubkey,
+ .length = sizeof(mldsa_44_pubkey),
+ },
},
{
.name = "mldsa_44_keygen (deterministic)",
diff --git a/app/test/test_cryptodev_ml_kem_test_vectors.h b/app/test/test_cryptodev_ml_kem_test_vectors.h
index 8294acc29e..a1d727b969 100644
--- a/app/test/test_cryptodev_ml_kem_test_vectors.h
+++ b/app/test/test_cryptodev_ml_kem_test_vectors.h
@@ -785,6 +785,14 @@ struct crypto_testsuite_mlkem_params mlkem_keygen_test_vectors[] = {
.data = mlkem_512_z,
.length = sizeof(mlkem_512_z),
},
+ .dk = {
+ .data = mlkem_512_dk,
+ .length = sizeof(mlkem_512_dk),
+ },
+ .ek = {
+ .data = mlkem_512_ek,
+ .length = sizeof(mlkem_512_ek),
+ }
},
{
.name = "mlkem_512_keygen (deterministic)",
--
2.37.1
^ permalink raw reply related
* Re: [PATCH v5] mempool: improve cache behaviour and performance
From: Bruce Richardson @ 2026-05-27 8:48 UTC (permalink / raw)
To: Morten Brørup
Cc: dev, Andrew Rybchenko, Jingjing Wu, Praveen Shetty,
Hemant Agrawal, Sachin Saxena
In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35F6589F@smartserver.smartshare.dk>
On Tue, May 26, 2026 at 07:45:24PM +0200, Morten Brørup wrote:
> > From: Morten Brørup [mailto:mb@smartsharesystems.com]
> > Sent: Tuesday, 26 May 2026 12.37
> >
> > > From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> > > Sent: Tuesday, 26 May 2026 11.40
> > >
>
> [...]
>
> > > [In all this, I am making the assumption that burst size is well less
> > > than
> > > cache size. Also, similar logic would be applicable for the inverse
> > > scenario, e.g. flush to empty (and fill burst) and fill to 75%]
> >
> > I'm not so sure about this assumption.
> > With a cache size of 512 and a bursts of 64, the cache only holds 8
> > bursts.
> > 50% is 4 bursts, and 25% is only 2 bursts.
> >
> > Using a replenish/drain level in the middle requires 5 bursts in either
> > direction to pass the edge (and trigger replenish/flush).
> > Using a replenish/drain level 25% from the edge requires only 3 bursts
> > in the wrong direction to pass the edge (and trigger replenish/flush).
> > Much higher probability with random get/put.
> >
> > >
> > > Now, all said, I tend to agree that we want to leave space for a
> > decent
> > > size burst after a fill. That is why I think that filling to 75% is
> > > reasonable. After an alloc that triggers a fill, I don't want the
> > cache
> > > less than 50% full, but not completely full so there is room for a
> > free
> > > without a flush, and similarly for a free that triggers a flush, the
> > > cache
> > > should not be empty, but also should not be more than half full.
> > >
> > > One suggestion - we could always add a simple tunable that specifies
> > > the
> > > margin, or reserved entries for alloc and free. We can then guide in
> > > the
> > > docs that the value should be e.g. "zero for apps where alloc and
> > free
> > > take
> > > place on different cores. 20%-50% of cache is recommended where alloc
> > > and
> > > free take place on the same core"
> >
> > Yes, a simple tunable is a really good idea.
> >
> > At this point, I think we should optimize for use case #1, and go for
> > the 50% fill level.
> > Then we can add a tunable to optimize for use case #2 later. I will try
> > to come up with a draft for such a follow-up patch within the next few
> > days.
>
> Adding a tunable is not so simple...
> The choice of mempool cache algorithm (drain/replenish to 50% vs. drain/replenish completely) should be passed via the "flags" parameter in rte_mempool_create(), but rte_pktmbuf_pool_create() is missing the "flags" parameter.
> We can add it at the next ABI breaking release.
> WDYT?
>
I don't want this just a binary flag with two settings, I think it should
be an actual numeric value. Can we not use function versioning to add the
new parameter to all functions needing it, without worrying about ABI
breakage.
/Bruce
^ permalink raw reply
* Re: [PATCH v2] eal: silence -Wconstant-logical-operand in RTE_IS_POWER_OF_2
From: Thomas Monjalon @ 2026-05-27 8:41 UTC (permalink / raw)
To: Stephen Hemminger
Cc: dev, stable, Bruce Richardson, Jack Bond-Preston, Pablo de Lara,
Gavin Hu, Honnappa Nagarahalli
In-Reply-To: <20260519135046.367128-1-stephen@networkplumber.org>
19/05/2026 15:49, Stephen Hemminger:
> Newer GCC warns when a non-boolean constant is an operand of &&, which
> trips whenever RTE_IS_POWER_OF_2 is used in a static_assert with a
> power-of-two literal. Make the zero check explicit.
>
> Fixes: 7c872b96983a ("hash: validate hash bucket entries while compiling")
> Cc: stable@dpdk.org
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Jack Bond-Preston <jack.bond-preston@foss.arm.com>
> ---
> v2 - use suggestion to make both sides comparisons
Applied, thanks.
^ permalink raw reply
* Re: [PATCH v2 4/6] eal/memory: get rid of global VA space limits
From: Burakov, Anatoly @ 2026-05-27 8:35 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev, Wathsala Vithanage
In-Reply-To: <ahXEJslh20SWaq3E@bricha3-mobl1.ger.corp.intel.com>
On 5/26/2026 6:02 PM, Bruce Richardson wrote:
> On Fri, Mar 13, 2026 at 04:06:35PM +0000, Anatoly Burakov wrote:
>> Currently, all VA space reservations take into account global memory limit.
>> The original intent was to limit memory allocations to however many NUMA
>> nodes the machine had taking into the account that socket ID's may be
>> discontiguous. Since we have had "socket count" API for while and it gives
>> us correct NUMA node count, taking discontiguousness into account, we can
>> relax the total limits and remove the restrictions, and let VA space usage
>> scale with NUMA nodes.
>>
>> The only place where we actually require a hard limit is in 32-bit code,
>> where we cannot allocate more than 2G of VA space.
>>
>> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
>
> Asking AI about this patch flags an issue whereby the contigmem driver does
> not guarantee the number of buffers is >0, which can cause issues. However,
> that's better fixed in contigmem.
>
> One additional comment inline below.
>
<snip>
>> diff --git a/doc/guides/prog_guide/env_abstraction_layer.rst b/doc/guides/prog_guide/env_abstraction_layer.rst
>> index 04368a3950..63e0568afa 100644
>> --- a/doc/guides/prog_guide/env_abstraction_layer.rst
>> +++ b/doc/guides/prog_guide/env_abstraction_layer.rst
>> @@ -208,8 +208,6 @@ variables:
>> can have (where "type" is defined as "page size + NUMA node" combination)
>
> Is the RTE_MAX_MEMSEG_PER_TYPE value still necessary?
Yes, the "per list" values are gone, but "per type" values stay as they
provide the defaults.
>
>> * ``RTE_MAX_MEM_MB_PER_TYPE`` controls how much megabytes of memory each
>> memory type can address
>> -* ``RTE_MAX_MEM_MB`` places a global maximum on the amount of memory
>> - DPDK can reserve
>>
> <snip>
--
Thanks,
Anatoly
^ permalink raw reply
* [PATCH v4 25/25] bus: add class device conversion macro
From: David Marchand @ 2026-05-27 7:56 UTC (permalink / raw)
To: dev
Cc: thomas, stephen, bruce.richardson, Nicolas Chautru, Parav Pandit,
Xueming Li, Nipun Gupta, Nikhil Agarwal, Chenbo Xia, Ashish Gupta,
Fan Zhang, Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj,
Gagandeep Singh, Hemant Agrawal, Pavan Nikhilesh, Shijith Thotton,
Tirthendu Sarkar, Jerin Jacob, Shepard Siegel, Ed Czeck,
John Miller, Igor Russkikh, Steven Webster, Matt Peters,
Selwin Sebastian, Julien Aube, Kishore Padmanabha, Ajit Khaparde,
Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao,
Harman Kalra, Potnuri Bharat Teja, Sachin Saxena, Shai Brandes,
Evgeny Schemeilin, Ron Beider, Amit Bernstein, Wajeeh Atrash,
Vanshika Shukla, John Daley, Hyong Youb Kim, Jeroen de Borst,
Joshua Washington, Xiaoyun Wang, Feifei Wang, Xingui Yang,
Chengwen Feng, Praveen Shetty, Vladimir Medvedkin,
Anatoly Burakov, Jingjing Wu, Rosen Xu, Dimon Zhao, Leon Yu,
Sam Chen, Long Li, Wei Hu, Chaoyong He, Jiawen Wu, Zaiyu Wang,
Vamsi Attunuru, Devendra Singh Rawat, Alok Prasad, Howard Wang,
Chunhao Lin, Xing Wang, Javen Xu, Wenbo Cao, Andrew Rybchenko,
Jie Liu, Maciej Czekaj, Maxime Coquelin, Jochen Behrens,
Renyong Wan, Na Na, Rong Qian, Xiaoxiong Zhang, Dongwei Xu,
Junlong Wang, Ming Ran
In-Reply-To: <20260527075654.3780732-1-david.marchand@redhat.com>
Add a new helper macro RTE_CLASS_TO_BUS_DEVICE that provides a unified
way to convert from any device class (ethdev, cryptodev, eventdev, etc.)
to a bus-specific device type. This macro works with any device class
that has a 'device' field pointing to struct rte_device.
Remove the bus-specific ethdev convenience macros (RTE_ETH_DEV_TO_PCI,
RTE_ETH_DEV_TO_AUXILIARY, RTE_ETH_DEV_TO_VDEV) and replace all uses
with the generic RTE_CLASS_TO_BUS_DEVICE macro.
Convert all drivers to use RTE_CLASS_TO_BUS_DEVICE instead of
the pattern RTE_BUS_DEVICE(dev->device).
Simplify code that was using an intermediate struct rte_device pointer
by applying RTE_CLASS_TO_BUS_DEVICE directly on the device class pointer.
This reduces code duplication and provides a consistent interface that
can be used for all device classes.
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
Changes since v3:
- updated sxe2 drivers,
---
drivers/baseband/acc/rte_acc100_pmd.c | 4 +-
drivers/baseband/acc/rte_vrb_pmd.c | 2 +-
.../fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 4 +-
drivers/baseband/fpga_lte_fec/fpga_lte_fec.c | 2 +-
drivers/bus/auxiliary/bus_auxiliary_driver.h | 3 --
drivers/bus/cdx/bus_cdx_driver.h | 2 -
drivers/bus/pci/bus_pci_driver.h | 3 --
drivers/bus/vdev/bus_vdev_driver.h | 3 --
drivers/compress/octeontx/otx_zip.c | 2 +-
drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 2 +-
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 3 +-
drivers/crypto/octeontx/otx_cryptodev_ops.c | 4 +-
drivers/event/cnxk/cnxk_eventdev.c | 2 +-
drivers/event/dlb2/pf/dlb2_pf.c | 2 +-
drivers/event/skeleton/skeleton_eventdev.c | 2 +-
drivers/net/ark/ark_ethdev.c | 2 +-
drivers/net/atlantic/atl_ethdev.c | 12 +++---
drivers/net/avp/avp_ethdev.c | 22 +++++-----
drivers/net/axgbe/axgbe_ethdev.c | 4 +-
drivers/net/bnx2x/bnx2x_ethdev.c | 2 +-
drivers/net/bnxt/bnxt_ethdev.c | 12 +++---
drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 4 +-
drivers/net/cnxk/cnxk_ethdev.c | 2 +-
drivers/net/cnxk/cnxk_ethdev_ops.c | 2 +-
drivers/net/cxgbe/cxgbe_ethdev.c | 4 +-
drivers/net/cxgbe/cxgbevf_ethdev.c | 4 +-
drivers/net/dpaa/dpaa_ethdev.c | 16 +++-----
drivers/net/dpaa2/dpaa2_ethdev.c | 8 ++--
drivers/net/dpaa2/dpaa2_recycle.c | 6 +--
drivers/net/ena/ena_ethdev.c | 10 ++---
drivers/net/enetc/enetc4_ethdev.c | 4 +-
drivers/net/enetc/enetc4_vf.c | 4 +-
drivers/net/enetc/enetc_ethdev.c | 2 +-
drivers/net/enic/enic_ethdev.c | 4 +-
drivers/net/enic/enic_fm_flow.c | 6 +--
drivers/net/enic/enic_vf_representor.c | 2 +-
drivers/net/gve/gve_ethdev.c | 2 +-
drivers/net/hinic/hinic_pmd_ethdev.c | 8 ++--
drivers/net/hinic3/base/hinic3_hwdev.c | 7 ++--
drivers/net/hinic3/hinic3_ethdev.c | 16 ++++----
drivers/net/hns3/hns3_cmd.c | 2 +-
drivers/net/hns3/hns3_common.c | 8 ++--
drivers/net/hns3/hns3_ethdev.c | 6 +--
drivers/net/hns3/hns3_ethdev_vf.c | 6 +--
drivers/net/hns3/hns3_rxtx.c | 4 +-
drivers/net/intel/cpfl/cpfl_ethdev.c | 4 +-
drivers/net/intel/cpfl/cpfl_ethdev.h | 2 +-
drivers/net/intel/e1000/em_ethdev.c | 12 +++---
drivers/net/intel/e1000/em_rxtx.c | 2 +-
drivers/net/intel/e1000/igb_ethdev.c | 30 +++++++-------
drivers/net/intel/e1000/igb_pf.c | 2 +-
drivers/net/intel/e1000/igc_ethdev.c | 22 +++++-----
drivers/net/intel/fm10k/fm10k_ethdev.c | 16 ++++----
drivers/net/intel/i40e/i40e_ethdev.c | 28 ++++++-------
drivers/net/intel/i40e/i40e_ethdev.h | 2 +-
drivers/net/intel/iavf/iavf_ethdev.c | 8 ++--
drivers/net/intel/ice/ice_dcf.c | 6 +--
drivers/net/intel/ice/ice_ethdev.c | 6 +--
drivers/net/intel/ice/ice_ethdev.h | 2 +-
drivers/net/intel/idpf/idpf_ethdev.h | 2 +-
drivers/net/intel/ipn3ke/ipn3ke_ethdev.h | 3 --
drivers/net/intel/ipn3ke/ipn3ke_representor.c | 6 +--
drivers/net/intel/ixgbe/ixgbe_ethdev.c | 40 +++++++++----------
drivers/net/intel/ixgbe/ixgbe_flow.c | 4 +-
drivers/net/intel/ixgbe/ixgbe_pf.c | 2 +-
drivers/net/intel/ixgbe/ixgbe_tm.c | 2 +-
.../net/intel/ixgbe/ixgbe_vf_representor.c | 2 +-
drivers/net/intel/ixgbe/rte_pmd_ixgbe.c | 20 +++++-----
drivers/net/nbl/nbl_core.c | 2 +-
drivers/net/nbl/nbl_dev/nbl_dev.c | 6 +--
drivers/net/netvsc/hn_ethdev.c | 3 +-
drivers/net/nfp/nfp_ethdev.c | 8 ++--
drivers/net/nfp/nfp_ethdev_vf.c | 6 +--
drivers/net/nfp/nfp_net_common.c | 8 ++--
drivers/net/ngbe/ngbe_ethdev.c | 20 +++++-----
drivers/net/ngbe/ngbe_ethdev_vf.c | 16 ++++----
drivers/net/ngbe/ngbe_pf.c | 2 +-
drivers/net/octeon_ep/otx_ep_ethdev.c | 2 +-
drivers/net/octeon_ep/otx_ep_mbox.c | 6 +--
drivers/net/qede/qede_ethdev.c | 6 +--
drivers/net/r8169/r8169_ethdev.c | 6 +--
drivers/net/rnp/rnp_ethdev.c | 6 +--
drivers/net/sfc/sfc.c | 4 +-
drivers/net/sfc/sfc_ethdev.c | 2 +-
drivers/net/sfc/sfc_intr.c | 10 ++---
drivers/net/sfc/sfc_rx.c | 3 +-
drivers/net/sfc/sfc_sriov.c | 2 +-
drivers/net/sfc/sfc_tx.c | 3 +-
drivers/net/sxe2/sxe2_ethdev.c | 4 +-
drivers/net/thunderx/nicvf_ethdev.c | 4 +-
drivers/net/txgbe/txgbe_ethdev.c | 26 ++++++------
drivers/net/txgbe/txgbe_ethdev_vf.c | 16 ++++----
drivers/net/txgbe/txgbe_flow.c | 4 +-
drivers/net/txgbe/txgbe_pf.c | 2 +-
drivers/net/txgbe/txgbe_tm.c | 2 +-
drivers/net/virtio/virtio_pci_ethdev.c | 11 ++---
drivers/net/vmxnet3/vmxnet3_ethdev.c | 4 +-
drivers/net/xsc/xsc_ethdev.c | 2 +-
drivers/net/zxdh/zxdh_ethdev.c | 8 ++--
drivers/raw/ifpga/afu_pmd_n3000.c | 4 +-
lib/eal/include/bus_driver.h | 18 +++++++++
101 files changed, 338 insertions(+), 342 deletions(-)
diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c
index 061f595a98..cbcacc7aa3 100644
--- a/drivers/baseband/acc/rte_acc100_pmd.c
+++ b/drivers/baseband/acc/rte_acc100_pmd.c
@@ -3993,7 +3993,7 @@ acc100_dequeue_ldpc_dec(struct rte_bbdev_queue_data *q_data,
static void
acc100_bbdev_init(struct rte_bbdev *dev, struct rte_pci_driver *drv)
{
- struct rte_pci_device *pci_dev = RTE_BUS_DEVICE(dev->device, *pci_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
dev->dev_ops = &acc100_bbdev_ops;
dev->enqueue_enc_ops = acc100_enqueue_enc;
@@ -4646,7 +4646,7 @@ rte_acc_configure(const char *dev_name, struct rte_acc_conf *conf)
dev_name);
return -ENODEV;
}
- struct rte_pci_device *pci_dev = RTE_BUS_DEVICE(bbdev->device, *pci_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(bbdev, *pci_dev);
rte_bbdev_log(INFO, "Configure dev id %x", pci_dev->id.device_id);
if (pci_dev->id.device_id == ACC100_PF_DEVICE_ID)
return acc100_configure(dev_name, conf);
diff --git a/drivers/baseband/acc/rte_vrb_pmd.c b/drivers/baseband/acc/rte_vrb_pmd.c
index fe23c01b5c..1f85e33462 100644
--- a/drivers/baseband/acc/rte_vrb_pmd.c
+++ b/drivers/baseband/acc/rte_vrb_pmd.c
@@ -4353,7 +4353,7 @@ vrb2_dequeue_mldts(struct rte_bbdev_queue_data *q_data,
static void
vrb_bbdev_init(struct rte_bbdev *dev, struct rte_pci_driver *drv)
{
- struct rte_pci_device *pci_dev = RTE_BUS_DEVICE(dev->device, *pci_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct acc_device *d = dev->data->dev_private;
dev->dev_ops = &vrb_bbdev_ops;
diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
index cb805a1732..45bd171ca7 100644
--- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
+++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
@@ -2873,7 +2873,7 @@ fpga_5gnr_dequeue_ldpc_dec(struct rte_bbdev_queue_data *q_data,
static void
fpga_5gnr_fec_init(struct rte_bbdev *dev, struct rte_pci_driver *drv)
{
- struct rte_pci_device *pci_dev = RTE_BUS_DEVICE(dev->device, *pci_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
dev->dev_ops = &fpga_5gnr_ops;
dev->enqueue_ldpc_enc_ops = fpga_5gnr_enqueue_ldpc_enc;
@@ -3376,7 +3376,7 @@ int rte_fpga_5gnr_fec_configure(const char *dev_name, const struct rte_fpga_5gnr
dev_name);
return -ENODEV;
}
- struct rte_pci_device *pci_dev = RTE_BUS_DEVICE(bbdev->device, *pci_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(bbdev, *pci_dev);
rte_bbdev_log(INFO, "Configure dev id %x", pci_dev->id.device_id);
if (pci_dev->id.device_id == VC_5GNR_PF_DEVICE_ID)
return vc_5gnr_configure(dev_name, conf);
diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
index d27164c6f4..04ac445820 100644
--- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
+++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
@@ -2316,7 +2316,7 @@ fpga_dequeue_dec(struct rte_bbdev_queue_data *q_data,
static void
fpga_lte_fec_init(struct rte_bbdev *dev, struct rte_pci_driver *drv)
{
- struct rte_pci_device *pci_dev = RTE_BUS_DEVICE(dev->device, *pci_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
dev->dev_ops = &fpga_ops;
dev->enqueue_enc_ops = fpga_enqueue_enc;
diff --git a/drivers/bus/auxiliary/bus_auxiliary_driver.h b/drivers/bus/auxiliary/bus_auxiliary_driver.h
index cab5f86d03..65e1814ec0 100644
--- a/drivers/bus/auxiliary/bus_auxiliary_driver.h
+++ b/drivers/bus/auxiliary/bus_auxiliary_driver.h
@@ -128,9 +128,6 @@ struct rte_auxiliary_driver {
uint32_t drv_flags; /**< Flags RTE_AUXILIARY_DRV_*. */
};
-#define RTE_ETH_DEV_TO_AUXILIARY(eth_dev) \
- RTE_BUS_DEVICE((eth_dev)->device, struct rte_auxiliary_device)
-
/** Device driver needs IOVA as VA and cannot work with IOVA as PA */
#define RTE_AUXILIARY_DRV_NEED_IOVA_AS_VA 0x002
diff --git a/drivers/bus/cdx/bus_cdx_driver.h b/drivers/bus/cdx/bus_cdx_driver.h
index d443178404..01684466ed 100644
--- a/drivers/bus/cdx/bus_cdx_driver.h
+++ b/drivers/bus/cdx/bus_cdx_driver.h
@@ -60,8 +60,6 @@ struct rte_cdx_device {
struct rte_intr_handle *intr_handle; /**< Interrupt handle */
};
-#define RTE_ETH_DEV_TO_CDX_DEV(eth_dev) RTE_BUS_DEVICE((eth_dev)->device, struct rte_cdx_device)
-
#ifdef __cplusplus
/** C++ macro used to help building up tables of device IDs. */
#define RTE_CDX_DEVICE(vend, dev) \
diff --git a/drivers/bus/pci/bus_pci_driver.h b/drivers/bus/pci/bus_pci_driver.h
index cb7039f8d6..c04ebddf59 100644
--- a/drivers/bus/pci/bus_pci_driver.h
+++ b/drivers/bus/pci/bus_pci_driver.h
@@ -47,9 +47,6 @@ struct rte_pci_device {
/**< Handler of VFIO request interrupt */
};
-#define RTE_ETH_DEV_TO_PCI(eth_dev) \
- RTE_BUS_DEVICE((eth_dev)->device, struct rte_pci_device)
-
#ifdef __cplusplus
/** C++ macro used to help building up tables of device IDs */
#define RTE_PCI_DEVICE(vend, dev) \
diff --git a/drivers/bus/vdev/bus_vdev_driver.h b/drivers/bus/vdev/bus_vdev_driver.h
index 8d114e4b3b..ecfc5384fc 100644
--- a/drivers/bus/vdev/bus_vdev_driver.h
+++ b/drivers/bus/vdev/bus_vdev_driver.h
@@ -19,9 +19,6 @@ struct rte_vdev_device {
struct rte_device device; /**< Inherit core device */
};
-#define RTE_ETH_DEV_TO_VDEV(eth_dev) \
- RTE_BUS_DEVICE((eth_dev)->device, struct rte_vdev_device)
-
static inline const char *
rte_vdev_device_name(const struct rte_vdev_device *dev)
{
diff --git a/drivers/compress/octeontx/otx_zip.c b/drivers/compress/octeontx/otx_zip.c
index 8673561a81..7cf3283680 100644
--- a/drivers/compress/octeontx/otx_zip.c
+++ b/drivers/compress/octeontx/otx_zip.c
@@ -142,7 +142,7 @@ zipvf_push_command(struct zipvf_qp *qp, union zip_inst_s *cmd)
int
zipvf_create(struct rte_compressdev *compressdev)
{
- struct rte_pci_device *pdev = RTE_BUS_DEVICE(compressdev->device, *pdev);
+ struct rte_pci_device *pdev = RTE_CLASS_TO_BUS_DEVICE(compressdev, *pdev);
struct zip_vf *zipvf = NULL;
char *dev_name = compressdev->data->name;
void *vbar0;
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
index f437350539..d3cf1ddd57 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
@@ -481,7 +481,7 @@ cnxk_cpt_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id,
if (dev->data->queue_pairs[qp_id] != NULL)
cnxk_cpt_queue_pair_release(dev, qp_id);
- pci_dev = RTE_BUS_DEVICE(dev->device, *pci_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
if (pci_dev->mem_resource[2].addr == NULL) {
plt_err("Invalid PCI mem address");
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index d7b53723e7..3d980d096f 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -4383,7 +4383,6 @@ static int
dpaa2_sec_dev_init(struct rte_cryptodev *cryptodev)
{
struct dpaa2_sec_dev_private *internals;
- struct rte_device *dev = cryptodev->device;
struct rte_dpaa2_device *dpaa2_dev;
struct rte_security_ctx *security_instance;
struct fsl_mc_io *dpseci;
@@ -4392,7 +4391,7 @@ dpaa2_sec_dev_init(struct rte_cryptodev *cryptodev)
int retcode, hw_id;
PMD_INIT_FUNC_TRACE();
- dpaa2_dev = RTE_BUS_DEVICE(dev, *dpaa2_dev);
+ dpaa2_dev = RTE_CLASS_TO_BUS_DEVICE(cryptodev, *dpaa2_dev);
hw_id = dpaa2_dev->object_id;
cryptodev->driver_id = cryptodev_driver_id;
diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c
index a499c8d0bc..d6d1b2cea9 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_ops.c
+++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c
@@ -156,7 +156,7 @@ otx_cpt_que_pair_setup(struct rte_cryptodev *dev,
DEFAULT_CMD_QLEN);
}
- pci_dev = RTE_BUS_DEVICE(dev->device, *pci_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
if (pci_dev->mem_resource[0].addr == NULL) {
CPT_LOG_ERR("PCI mem address null");
@@ -1001,7 +1001,7 @@ static struct rte_cryptodev_ops cptvf_ops = {
int
otx_cpt_dev_create(struct rte_cryptodev *c_dev)
{
- struct rte_pci_device *pdev = RTE_BUS_DEVICE(c_dev->device, *pdev);
+ struct rte_pci_device *pdev = RTE_CLASS_TO_BUS_DEVICE(c_dev, *pdev);
struct cpt_vf *cptvf = NULL;
void *reg_base;
char dev_name[32];
diff --git a/drivers/event/cnxk/cnxk_eventdev.c b/drivers/event/cnxk/cnxk_eventdev.c
index 6f000ff49e..272ba235a4 100644
--- a/drivers/event/cnxk/cnxk_eventdev.c
+++ b/drivers/event/cnxk/cnxk_eventdev.c
@@ -654,7 +654,7 @@ cnxk_sso_init(struct rte_eventdev *event_dev)
return -ENOMEM;
}
- pci_dev = RTE_BUS_DEVICE(event_dev->device, *pci_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(event_dev, *pci_dev);
dev->sso.pci_dev = pci_dev;
*(uint64_t *)mz->addr = (uint64_t)dev;
diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
index 82075bbf0b..c78783e59d 100644
--- a/drivers/event/dlb2/pf/dlb2_pf.c
+++ b/drivers/event/dlb2/pf/dlb2_pf.c
@@ -784,7 +784,7 @@ dlb2_eventdev_pci_init(struct rte_eventdev *eventdev)
dlb2_pf_iface_fn_ptrs_init();
- pci_dev = RTE_BUS_DEVICE(eventdev->device, *pci_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(eventdev, *pci_dev);
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
dlb2 = dlb2_pmd_priv(eventdev); /* rte_zmalloc_socket mem */
diff --git a/drivers/event/skeleton/skeleton_eventdev.c b/drivers/event/skeleton/skeleton_eventdev.c
index 4292644fde..c0e06e4aa0 100644
--- a/drivers/event/skeleton/skeleton_eventdev.c
+++ b/drivers/event/skeleton/skeleton_eventdev.c
@@ -332,7 +332,7 @@ skeleton_eventdev_init(struct rte_eventdev *eventdev)
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
- pci_dev = RTE_BUS_DEVICE(eventdev->device, *pci_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(eventdev, *pci_dev);
skel->reg_base = (uintptr_t)pci_dev->mem_resource[0].addr;
if (!skel->reg_base) {
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 8b25ed948f..d6e34021ce 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -315,7 +315,7 @@ ark_dev_init(struct rte_eth_dev *dev)
if (ret)
return ret;
- pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
rte_eth_copy_pci_info(dev, pci_dev);
dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c
index f8744da221..0b2033c084 100644
--- a/drivers/net/atlantic/atl_ethdev.c
+++ b/drivers/net/atlantic/atl_ethdev.c
@@ -360,7 +360,7 @@ static int
eth_atl_dev_init(struct rte_eth_dev *eth_dev)
{
struct atl_adapter *adapter = eth_dev->data->dev_private;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
int err = 0;
@@ -479,7 +479,7 @@ static int
atl_dev_start(struct rte_eth_dev *dev)
{
struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
uint32_t intr_vector = 0;
int status;
@@ -607,7 +607,7 @@ atl_dev_stop(struct rte_eth_dev *dev)
struct rte_eth_link link;
struct aq_hw_s *hw =
ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
PMD_INIT_FUNC_TRACE();
@@ -688,7 +688,7 @@ atl_dev_set_link_down(struct rte_eth_dev *dev)
static int
atl_dev_close(struct rte_eth_dev *dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct aq_hw_s *hw;
int ret;
@@ -1094,7 +1094,7 @@ atl_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
static int
atl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
dev_info->max_rx_queues = AQ_HW_MAX_RX_QUEUES;
dev_info->max_tx_queues = AQ_HW_MAX_TX_QUEUES;
@@ -1345,7 +1345,7 @@ atl_dev_link_status_print(struct rte_eth_dev *dev)
#ifdef DEBUG
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
PMD_DRV_LOG(DEBUG, "PCI Address: " PCI_PRI_FMT,
pci_dev->addr.domain,
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index 3bc5171336..8af6c45381 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -361,7 +361,7 @@ static void *
avp_dev_translate_address(struct rte_eth_dev *eth_dev,
rte_iova_t host_phys_addr)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct rte_mem_resource *resource;
struct rte_avp_memmap_info *info;
struct rte_avp_memmap *map;
@@ -414,7 +414,7 @@ avp_dev_version_check(uint32_t version)
static int
avp_dev_check_regions(struct rte_eth_dev *eth_dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct rte_avp_memmap_info *memmap;
struct rte_avp_device_info *info;
struct rte_mem_resource *resource;
@@ -550,7 +550,7 @@ _avp_set_rx_queue_mappings(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)
static void
_avp_set_queue_counts(struct rte_eth_dev *eth_dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
struct rte_avp_device_info *host_info;
void *addr;
@@ -610,7 +610,7 @@ avp_dev_attach(struct rte_eth_dev *eth_dev)
* re-run the device create utility which will parse the new host info
* and setup the AVP device queue pointers.
*/
- ret = avp_dev_create(RTE_ETH_DEV_TO_PCI(eth_dev), eth_dev);
+ ret = avp_dev_create(RTE_CLASS_TO_BUS_DEVICE(eth_dev, struct rte_pci_device), eth_dev);
if (ret < 0) {
PMD_DRV_LOG_LINE(ERR, "Failed to re-create AVP device, ret=%d",
ret);
@@ -664,7 +664,7 @@ static void
avp_dev_interrupt_handler(void *data)
{
struct rte_eth_dev *eth_dev = data;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
void *registers = pci_dev->mem_resource[RTE_AVP_PCI_MMIO_BAR].addr;
uint32_t status, value;
int ret;
@@ -723,7 +723,7 @@ avp_dev_interrupt_handler(void *data)
static int
avp_dev_enable_interrupts(struct rte_eth_dev *eth_dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
void *registers = pci_dev->mem_resource[RTE_AVP_PCI_MMIO_BAR].addr;
int ret;
@@ -748,7 +748,7 @@ avp_dev_enable_interrupts(struct rte_eth_dev *eth_dev)
static int
avp_dev_disable_interrupts(struct rte_eth_dev *eth_dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
void *registers = pci_dev->mem_resource[RTE_AVP_PCI_MMIO_BAR].addr;
int ret;
@@ -773,7 +773,7 @@ avp_dev_disable_interrupts(struct rte_eth_dev *eth_dev)
static int
avp_dev_setup_interrupts(struct rte_eth_dev *eth_dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
int ret;
/* register a callback handler with UIO for interrupt notifications */
@@ -793,7 +793,7 @@ avp_dev_setup_interrupts(struct rte_eth_dev *eth_dev)
static int
avp_dev_migration_pending(struct rte_eth_dev *eth_dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
void *registers = pci_dev->mem_resource[RTE_AVP_PCI_MMIO_BAR].addr;
uint32_t value;
@@ -954,7 +954,7 @@ eth_avp_dev_init(struct rte_eth_dev *eth_dev)
struct rte_pci_device *pci_dev;
int ret;
- pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
eth_dev->dev_ops = &avp_eth_dev_ops;
eth_dev->rx_pkt_burst = &avp_recv_pkts;
eth_dev->tx_pkt_burst = &avp_xmit_pkts;
@@ -1977,7 +1977,7 @@ avp_dev_tx_queue_release_all(struct rte_eth_dev *eth_dev)
static int
avp_dev_configure(struct rte_eth_dev *eth_dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
struct rte_avp_device_info *host_info;
struct rte_avp_device_config config;
diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
index e321959afd..61725d55ca 100644
--- a/drivers/net/axgbe/axgbe_ethdev.c
+++ b/drivers/net/axgbe/axgbe_ethdev.c
@@ -2231,7 +2231,7 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev)
rte_bit_relaxed_set32(AXGBE_STOPPED, &pdata->dev_state);
pdata->eth_dev = eth_dev;
- pci_dev = RTE_BUS_DEVICE(eth_dev->device, *pci_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
pdata->pci_dev = pci_dev;
pdata->xgmac_regs =
@@ -2454,7 +2454,7 @@ axgbe_dev_close(struct rte_eth_dev *eth_dev)
return 0;
pdata = eth_dev->data->dev_private;
- pci_dev = RTE_BUS_DEVICE(eth_dev->device, *pci_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
axgbe_dev_clear_queues(eth_dev);
/* disable uio intr before callback unregister */
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 7b96e1acee..4f1f97a999 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -639,7 +639,7 @@ bnx2x_common_dev_init(struct rte_eth_dev *eth_dev, int is_vf)
/* Extract key data structures */
sc = eth_dev->data->dev_private;
- pci_dev = RTE_BUS_DEVICE(eth_dev->device, *pci_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
pci_addr = pci_dev->addr;
snprintf(sc->devinfo.name, NAME_SIZE, PCI_SHORT_PRI_FMT ":dpdk-port-%u",
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index ac61ffda80..1b8cf3a52a 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -862,7 +862,7 @@ static int bnxt_alloc_prev_ring_stats(struct bnxt *bp)
static int bnxt_start_nic(struct bnxt *bp)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(bp->eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(bp->eth_dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
uint32_t intr_vector = 0;
uint32_t queue_id, base = BNXT_MISC_VEC_ID;
@@ -1167,7 +1167,7 @@ uint64_t bnxt_eth_rss_support(struct bnxt *bp)
static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
struct rte_eth_dev_info *dev_info)
{
- struct rte_pci_device *pdev = RTE_BUS_DEVICE(eth_dev->device, *pdev);
+ struct rte_pci_device *pdev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pdev);
struct bnxt *bp = eth_dev->data->dev_private;
uint16_t max_vnics, i, j, vpool, vrxq;
unsigned int max_rx_rings;
@@ -1719,7 +1719,7 @@ static int bnxt_ptp_start(struct bnxt *bp)
static int bnxt_dev_stop(struct rte_eth_dev *eth_dev)
{
struct bnxt *bp = eth_dev->data->dev_private;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct rte_eth_link link;
uint16_t i;
@@ -5143,7 +5143,7 @@ bool bnxt_stratus_device(struct bnxt *bp)
static int bnxt_map_pci_bars(struct rte_eth_dev *eth_dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct bnxt *bp = eth_dev->data->dev_private;
/* enable device (incl. PCI PM wakeup), and bus-mastering */
@@ -6600,7 +6600,7 @@ bnxt_parse_dev_args(struct bnxt *bp, struct rte_devargs *devargs)
*/
static int bnxt_drv_init(struct rte_eth_dev *eth_dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct bnxt *bp = eth_dev->data->dev_private;
int rc = 0;
@@ -6684,7 +6684,7 @@ static int bnxt_drv_init(struct rte_eth_dev *eth_dev)
static int
bnxt_dev_init(struct rte_eth_dev *eth_dev, void *params __rte_unused)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
static int version_printed;
struct bnxt *bp;
int rc;
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
index df30dbfc0f..a75da8aa19 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
@@ -192,7 +192,7 @@ ulp_session_init(struct bnxt *bp,
if (!bp)
return NULL;
- pci_dev = RTE_BUS_DEVICE(bp->eth_dev->device, *pci_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(bp->eth_dev, *pci_dev);
pci_addr = &pci_dev->addr;
pthread_mutex_lock(&bnxt_ulp_global_mutex);
@@ -556,7 +556,7 @@ bnxt_ulp_port_deinit(struct bnxt *bp)
bp->eth_dev->data->port_id);
/* Get the session details */
- pci_dev = RTE_BUS_DEVICE(bp->eth_dev->device, *pci_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(bp->eth_dev, *pci_dev);
pci_addr = &pci_dev->addr;
pthread_mutex_lock(&bnxt_ulp_global_mutex);
session = ulp_get_session(bp, pci_addr);
diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c
index 06d1c9b362..7ae16186c6 100644
--- a/drivers/net/cnxk/cnxk_ethdev.c
+++ b/drivers/net/cnxk/cnxk_ethdev.c
@@ -2177,7 +2177,7 @@ cnxk_eth_dev_init(struct rte_eth_dev *eth_dev)
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
- pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
rte_eth_copy_pci_info(eth_dev, pci_dev);
/* Parse devargs string */
diff --git a/drivers/net/cnxk/cnxk_ethdev_ops.c b/drivers/net/cnxk/cnxk_ethdev_ops.c
index 49e77e49a6..460ffa32b6 100644
--- a/drivers/net/cnxk/cnxk_ethdev_ops.c
+++ b/drivers/net/cnxk/cnxk_ethdev_ops.c
@@ -7,7 +7,7 @@
int
cnxk_nix_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *devinfo)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
int max_rx_pktlen;
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 0c337a6cc8..82e67eeff1 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -1704,7 +1704,7 @@ static int eth_cxgbe_dev_init(struct rte_eth_dev *eth_dev)
eth_dev->dev_ops = &cxgbe_eth_dev_ops;
eth_dev->rx_pkt_burst = &cxgbe_recv_pkts;
eth_dev->tx_pkt_burst = &cxgbe_xmit_pkts;
- pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
/* for secondary processes, we attach to ethdevs allocated by primary
* and do minimal initialization.
@@ -1767,7 +1767,7 @@ static int eth_cxgbe_dev_init(struct rte_eth_dev *eth_dev)
static int eth_cxgbe_dev_uninit(struct rte_eth_dev *eth_dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
uint16_t port_id;
int err = 0;
diff --git a/drivers/net/cxgbe/cxgbevf_ethdev.c b/drivers/net/cxgbe/cxgbevf_ethdev.c
index d8eba8afef..750dc7da4d 100644
--- a/drivers/net/cxgbe/cxgbevf_ethdev.c
+++ b/drivers/net/cxgbe/cxgbevf_ethdev.c
@@ -113,7 +113,7 @@ static int eth_cxgbevf_dev_init(struct rte_eth_dev *eth_dev)
eth_dev->dev_ops = &cxgbevf_eth_dev_ops;
eth_dev->rx_pkt_burst = &cxgbe_recv_pkts;
eth_dev->tx_pkt_burst = &cxgbe_xmit_pkts;
- pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
/* for secondary processes, we attach to ethdevs allocated by primary
* and do minimal initialization.
@@ -177,7 +177,7 @@ static int eth_cxgbevf_dev_init(struct rte_eth_dev *eth_dev)
static int eth_cxgbevf_dev_uninit(struct rte_eth_dev *eth_dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
uint16_t port_id;
int err = 0;
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index d4b4793f16..9f976d179b 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -217,7 +217,6 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
uint64_t rx_offloads = eth_conf->rxmode.offloads;
uint64_t tx_offloads = eth_conf->txmode.offloads;
struct dpaa_if *dpaa_intf = dev->data->dev_private;
- struct rte_device *rdev = dev->device;
struct rte_eth_link *link = &dev->data->dev_link;
struct rte_dpaa_device *dpaa_dev;
struct fman_if *fif = dev->process_private;
@@ -230,7 +229,7 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE();
- dpaa_dev = RTE_BUS_DEVICE(rdev, *dpaa_dev);
+ dpaa_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *dpaa_dev);
intr_handle = dpaa_dev->intr_handle;
__fif = container_of(fif, struct __fman_if, __if);
@@ -426,13 +425,12 @@ dpaa_supported_ptypes_get(struct rte_eth_dev *dev, size_t *no_of_elements)
static void dpaa_interrupt_handler(void *param)
{
struct rte_eth_dev *dev = param;
- struct rte_device *rdev = dev->device;
struct rte_dpaa_device *dpaa_dev;
struct rte_intr_handle *intr_handle;
uint64_t buf;
int bytes_read;
- dpaa_dev = RTE_BUS_DEVICE(rdev, *dpaa_dev);
+ dpaa_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *dpaa_dev);
intr_handle = dpaa_dev->intr_handle;
if (rte_intr_fd_get(intr_handle) < 0)
@@ -502,7 +500,6 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev)
{
struct fman_if *fif = dev->process_private;
struct __fman_if *__fif;
- struct rte_device *rdev = dev->device;
struct rte_dpaa_device *dpaa_dev;
struct rte_intr_handle *intr_handle;
struct rte_eth_link *link = &dev->data->dev_link;
@@ -530,7 +527,7 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev)
}
}
- dpaa_dev = RTE_BUS_DEVICE(rdev, *dpaa_dev);
+ dpaa_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *dpaa_dev);
intr_handle = dpaa_dev->intr_handle;
__fif = container_of(fif, struct __fman_if, __if);
@@ -1267,9 +1264,8 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
/* Set up the device interrupt handler */
if (dev->intr_handle == NULL) {
struct rte_dpaa_device *dpaa_dev;
- struct rte_device *rdev = dev->device;
- dpaa_dev = RTE_BUS_DEVICE(rdev, *dpaa_dev);
+ dpaa_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *dpaa_dev);
dev->intr_handle = dpaa_dev->intr_handle;
if (rte_intr_vec_list_alloc(dev->intr_handle,
NULL, dpaa_push_queue_max_num())) {
@@ -2119,7 +2115,7 @@ dpaa_dev_init_secondary(struct rte_eth_dev *eth_dev)
PMD_INIT_FUNC_TRACE();
- dpaa_device = RTE_BUS_DEVICE(eth_dev->device, *dpaa_device);
+ dpaa_device = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *dpaa_device);
dev_id = dpaa_device->id.dev_id;
cfg = dpaa_get_eth_port_cfg(dev_id);
fman_intf = cfg->fman_if;
@@ -2236,7 +2232,7 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
PMD_INIT_FUNC_TRACE();
- dpaa_device = RTE_BUS_DEVICE(eth_dev->device, *dpaa_device);
+ dpaa_device = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *dpaa_device);
dev_id = dpaa_device->id.dev_id;
dpaa_intf = eth_dev->data->dev_private;
cfg = dpaa_get_eth_port_cfg(dev_id);
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index dc9ea700ac..803a8321e0 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1339,7 +1339,6 @@ dpaa2_eth_setup_irqs(struct rte_eth_dev *dev, int enable)
static int
dpaa2_dev_start(struct rte_eth_dev *dev)
{
- struct rte_device *rdev = dev->device;
struct rte_dpaa2_device *dpaa2_dev;
struct rte_eth_dev_data *data = dev->data;
struct dpaa2_dev_priv *priv = data->dev_private;
@@ -1351,7 +1350,7 @@ dpaa2_dev_start(struct rte_eth_dev *dev)
int ret, i;
struct rte_intr_handle *intr_handle;
- dpaa2_dev = RTE_BUS_DEVICE(rdev, *dpaa2_dev);
+ dpaa2_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *dpaa2_dev);
intr_handle = dpaa2_dev->intr_handle;
PMD_INIT_FUNC_TRACE();
@@ -1458,12 +1457,11 @@ dpaa2_dev_stop(struct rte_eth_dev *dev)
struct fsl_mc_io *dpni = dev->process_private;
int ret;
struct rte_eth_link link;
- struct rte_device *rdev = dev->device;
struct rte_intr_handle *intr_handle;
struct rte_dpaa2_device *dpaa2_dev;
uint16_t i;
- dpaa2_dev = RTE_BUS_DEVICE(rdev, *dpaa2_dev);
+ dpaa2_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *dpaa2_dev);
intr_handle = dpaa2_dev->intr_handle;
PMD_INIT_FUNC_TRACE();
@@ -2918,7 +2916,7 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
return 0;
}
- dpaa2_dev = RTE_BUS_DEVICE(dev, *dpaa2_dev);
+ dpaa2_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *dpaa2_dev);
hw_id = dpaa2_dev->object_id;
ret = dpni_open(dpni_dev, CMD_PRI_LOW, hw_id, &priv->token);
diff --git a/drivers/net/dpaa2/dpaa2_recycle.c b/drivers/net/dpaa2/dpaa2_recycle.c
index 14416c41d0..f78d12362e 100644
--- a/drivers/net/dpaa2/dpaa2_recycle.c
+++ b/drivers/net/dpaa2/dpaa2_recycle.c
@@ -607,9 +607,8 @@ lx_serdes_eth_lpbk(uint16_t mac_id, int en)
int
dpaa2_dev_recycle_config(struct rte_eth_dev *eth_dev)
{
- struct rte_device *dev = eth_dev->device;
struct dpaa2_dev_priv *priv = eth_dev->data->dev_private;
- struct rte_dpaa2_device *dpaa2_dev = RTE_BUS_DEVICE(dev, *dpaa2_dev);
+ struct rte_dpaa2_device *dpaa2_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *dpaa2_dev);
struct fsl_mc_io *dpni_dev = eth_dev->process_private;
struct dpni_port_cfg port_cfg;
int ret;
@@ -674,9 +673,8 @@ dpaa2_dev_recycle_config(struct rte_eth_dev *eth_dev)
int
dpaa2_dev_recycle_deconfig(struct rte_eth_dev *eth_dev)
{
- struct rte_device *dev = eth_dev->device;
struct dpaa2_dev_priv *priv = eth_dev->data->dev_private;
- struct rte_dpaa2_device *dpaa2_dev = RTE_BUS_DEVICE(dev, *dpaa2_dev);
+ struct rte_dpaa2_device *dpaa2_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *dpaa2_dev);
struct fsl_mc_io *dpni_dev = eth_dev->process_private;
struct dpni_port_cfg port_cfg;
int ret = 0;
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index ea4afbc75d..ad2ac6dbbf 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -924,7 +924,7 @@ static inline void ena_indirect_table_release(struct ena_adapter *adapter)
static int ena_close(struct rte_eth_dev *dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct ena_adapter *adapter = dev->data->dev_private;
struct ena_com_dev *ena_dev = &adapter->ena_dev;
@@ -1457,7 +1457,7 @@ static int ena_stop(struct rte_eth_dev *dev)
{
struct ena_adapter *adapter = dev->data->dev_private;
struct ena_com_dev *ena_dev = &adapter->ena_dev;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
uint16_t i;
int rc;
@@ -1503,7 +1503,7 @@ static int ena_create_io_queue(struct rte_eth_dev *dev, struct ena_ring *ring)
{
struct ena_adapter *adapter = ring->adapter;
struct ena_com_dev *ena_dev = &adapter->ena_dev;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct ena_com_create_io_ctx ctx =
/* policy set to _HOST just to satisfy icc compiler */
@@ -2422,7 +2422,7 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev)
adapter->edev_data = eth_dev->data;
- pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
PMD_INIT_LOG_LINE(INFO, "Initializing " PCI_PRI_FMT,
pci_dev->addr.domain,
@@ -3978,7 +3978,7 @@ static int ena_parse_devargs(struct ena_adapter *adapter, struct rte_devargs *de
static int ena_setup_rx_intr(struct rte_eth_dev *dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
int rc;
uint16_t vectors_nb, i;
diff --git a/drivers/net/enetc/enetc4_ethdev.c b/drivers/net/enetc/enetc4_ethdev.c
index df9f007473..78eba70a08 100644
--- a/drivers/net/enetc/enetc4_ethdev.c
+++ b/drivers/net/enetc/enetc4_ethdev.c
@@ -956,7 +956,7 @@ enetc4_dev_hw_init(struct rte_eth_dev *eth_dev)
{
struct enetc_eth_hw *hw =
ENETC_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
eth_dev->rx_pkt_burst = &enetc_recv_pkts_nc;
eth_dev->tx_pkt_burst = &enetc_xmit_pkts_nc;
@@ -986,7 +986,7 @@ enetc4_dev_init(struct rte_eth_dev *eth_dev)
{
struct enetc_eth_hw *hw =
ENETC_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
int error = 0;
uint32_t si_cap;
struct enetc_hw *enetc_hw = &hw->hw;
diff --git a/drivers/net/enetc/enetc4_vf.c b/drivers/net/enetc/enetc4_vf.c
index 3f257234a0..bec7128e41 100644
--- a/drivers/net/enetc/enetc4_vf.c
+++ b/drivers/net/enetc/enetc4_vf.c
@@ -1249,7 +1249,7 @@ enetc4_vf_dev_init(struct rte_eth_dev *eth_dev)
{
struct enetc_eth_hw *hw =
ENETC_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
int error = 0;
uint32_t si_cap;
struct enetc_hw *enetc_hw = &hw->hw;
@@ -1297,7 +1297,7 @@ enetc4_vf_dev_intr(struct rte_eth_dev *eth_dev, bool enable)
struct enetc_eth_hw *hw =
ENETC_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
struct enetc_hw *enetc_hw = &hw->hw;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
int ret = 0;
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index b2bbace16c..f41f3c1803 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -886,7 +886,7 @@ static int
enetc_dev_init(struct rte_eth_dev *eth_dev)
{
int error = 0;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct enetc_eth_hw *hw =
ENETC_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index a853a5047a..2e5cd186f9 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -454,7 +454,7 @@ static uint32_t speed_capa_from_pci_id(struct rte_eth_dev *eth_dev)
struct rte_pci_device *pdev;
uint16_t id;
- pdev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ pdev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pdev);
id = pdev->id.subsystem_device_id;
for (m = vic_speed_capa_map; m->sub_devid != 0; m++) {
if (m->sub_devid == id)
@@ -1292,7 +1292,7 @@ static int eth_enic_dev_init(struct rte_eth_dev *eth_dev,
enic->rte_dev = eth_dev;
enic->dev_data = eth_dev->data;
- pdev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ pdev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pdev);
rte_eth_copy_pci_info(eth_dev, pdev);
enic->pdev = pdev;
addr = &pdev->addr;
diff --git a/drivers/net/enic/enic_fm_flow.c b/drivers/net/enic/enic_fm_flow.c
index c2c3e55206..4b0a513977 100644
--- a/drivers/net/enic/enic_fm_flow.c
+++ b/drivers/net/enic/enic_fm_flow.c
@@ -3229,7 +3229,7 @@ enic_fm_init(struct enic *enic)
if (rte_eth_dev_is_repr(enic->rte_dev))
addr = &VF_ENIC_TO_VF_REP(enic)->bdf;
else
- addr = &RTE_ETH_DEV_TO_PCI(enic->rte_dev)->addr;
+ addr = &RTE_CLASS_TO_BUS_DEVICE(enic->rte_dev, struct rte_pci_device)->addr;
rc = enic_fm_find_vnic(enic, addr, &enic->fm_vnic_handle);
if (rc) {
ENICPMD_LOG(ERR, "cannot find vnic handle for %x:%x:%x",
@@ -3361,7 +3361,7 @@ enic_fm_allocate_switch_domain(struct enic *pf)
if (rte_eth_dev_is_repr(pf->rte_dev))
return -EINVAL;
cur = pf;
- cur_a = &RTE_ETH_DEV_TO_PCI(cur->rte_dev)->addr;
+ cur_a = &RTE_CLASS_TO_BUS_DEVICE(cur->rte_dev, struct rte_pci_device)->addr;
/* Go through ports and find another PF that is on the same adapter */
RTE_ETH_FOREACH_DEV(pid) {
dev = &rte_eth_devices[pid];
@@ -3373,7 +3373,7 @@ enic_fm_allocate_switch_domain(struct enic *pf)
continue;
/* dev is another PF. Is it on the same adapter? */
prev = pmd_priv(dev);
- prev_a = &RTE_ETH_DEV_TO_PCI(dev)->addr;
+ prev_a = &RTE_CLASS_TO_BUS_DEVICE(dev, struct rte_pci_device)->addr;
if (!enic_fm_find_vnic(cur, prev_a, &vnic_h)) {
ENICPMD_LOG(DEBUG, "Port %u (PF BDF %x:%x:%x) and port %u (PF BDF %x:%x:%x domain %u) are on the same VIC",
cur->rte_dev->data->port_id,
diff --git a/drivers/net/enic/enic_vf_representor.c b/drivers/net/enic/enic_vf_representor.c
index 05b2efedcb..fc836100b4 100644
--- a/drivers/net/enic/enic_vf_representor.c
+++ b/drivers/net/enic/enic_vf_representor.c
@@ -655,7 +655,7 @@ int enic_vf_representor_init(struct rte_eth_dev *eth_dev, void *init_params)
}
/* Check for non-existent VFs */
- pdev = RTE_ETH_DEV_TO_PCI(pf->rte_dev);
+ pdev = RTE_CLASS_TO_BUS_DEVICE(pf->rte_dev, *pdev);
if (vf->vf_id >= pdev->max_vfs) {
ENICPMD_LOG(ERR, "VF ID is invalid. vf_id %u max_vfs %u",
vf->vf_id, pdev->max_vfs);
diff --git a/drivers/net/gve/gve_ethdev.c b/drivers/net/gve/gve_ethdev.c
index ed25b82848..476b2c311f 100644
--- a/drivers/net/gve/gve_ethdev.c
+++ b/drivers/net/gve/gve_ethdev.c
@@ -1491,7 +1491,7 @@ gve_dev_init(struct rte_eth_dev *eth_dev)
return 0;
}
- pci_dev = RTE_BUS_DEVICE(eth_dev->device, *pci_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
reg_bar = pci_dev->mem_resource[GVE_REG_BAR].addr;
if (!reg_bar) {
diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index 75534c1ce2..91a4348fb6 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -1234,7 +1234,7 @@ static int hinic_dev_stop(struct rte_eth_dev *dev)
static void hinic_disable_interrupt(struct rte_eth_dev *dev)
{
struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
int ret, retries = 0;
rte_bit_relaxed_clear32(HINIC_DEV_INTR_EN, &nic_dev->dev_status);
@@ -2745,7 +2745,7 @@ static int hinic_nic_dev_create(struct rte_eth_dev *eth_dev)
eth_dev->data->name);
return -ENOMEM;
}
- nic_dev->hwdev->pcidev_hdl = RTE_ETH_DEV_TO_PCI(eth_dev);
+ nic_dev->hwdev->pcidev_hdl = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *nic_dev->hwdev->pcidev_hdl);
/* init osdep*/
rc = hinic_osdep_init(nic_dev->hwdev);
@@ -3086,7 +3086,7 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev)
u32 mac_size;
int rc;
- pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
/* EAL is SECONDARY and eth_dev is already created */
if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
@@ -3218,7 +3218,7 @@ static int hinic_dev_init(struct rte_eth_dev *eth_dev)
{
struct rte_pci_device *pci_dev;
- pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
PMD_DRV_LOG(INFO, "Initializing pf hinic-" PCI_PRI_FMT " in %s process",
pci_dev->addr.domain, pci_dev->addr.bus,
diff --git a/drivers/net/hinic3/base/hinic3_hwdev.c b/drivers/net/hinic3/base/hinic3_hwdev.c
index 5d12cf7b5f..d09a8f7e7d 100644
--- a/drivers/net/hinic3/base/hinic3_hwdev.c
+++ b/drivers/net/hinic3/base/hinic3_hwdev.c
@@ -74,10 +74,11 @@ struct mgmt_event_handle {
};
bool
-hinic3_is_vfio_iommu_enable(const struct rte_eth_dev *rte_dev)
+hinic3_is_vfio_iommu_enable(const struct rte_eth_dev *eth_dev)
{
- return ((RTE_ETH_DEV_TO_PCI(rte_dev)->kdrv == RTE_PCI_KDRV_VFIO) &&
- (rte_vfio_noiommu_is_enabled() != 1));
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
+
+ return pci_dev->kdrv == RTE_PCI_KDRV_VFIO && rte_vfio_noiommu_is_enabled() != 1;
}
int
diff --git a/drivers/net/hinic3/hinic3_ethdev.c b/drivers/net/hinic3/hinic3_ethdev.c
index f4eb788686..361e52f7b9 100644
--- a/drivers/net/hinic3/hinic3_ethdev.c
+++ b/drivers/net/hinic3/hinic3_ethdev.c
@@ -1474,7 +1474,7 @@ hinic3_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t sq_id)
int
hinic3_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = PCI_DEV_TO_INTR_HANDLE(pci_dev);
struct hinic3_nic_dev *nic_dev = HINIC3_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
uint16_t msix_intr;
@@ -1493,7 +1493,7 @@ hinic3_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
int
hinic3_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = PCI_DEV_TO_INTR_HANDLE(pci_dev);
struct hinic3_nic_dev *nic_dev = HINIC3_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
uint16_t msix_intr;
@@ -1695,7 +1695,7 @@ static void
hinic3_disable_interrupt(struct rte_eth_dev *dev)
{
struct hinic3_nic_dev *nic_dev = HINIC3_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
if (!hinic3_get_bit(HINIC3_DEV_INIT, &nic_dev->dev_status))
return;
@@ -1710,7 +1710,7 @@ static void
hinic3_enable_interrupt(struct rte_eth_dev *dev)
{
struct hinic3_nic_dev *nic_dev = HINIC3_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
if (!hinic3_get_bit(HINIC3_DEV_INIT, &nic_dev->dev_status))
return;
@@ -2080,7 +2080,7 @@ hinic3_dev_release(struct rte_eth_dev *eth_dev)
{
struct hinic3_nic_dev *nic_dev =
HINIC3_ETH_DEV_TO_PRIVATE_NIC_DEV(eth_dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
int qid;
/* Release io resource. */
@@ -3394,7 +3394,7 @@ hinic3_func_init(struct rte_eth_dev *eth_dev)
struct rte_pci_device *pci_dev = NULL;
int err;
- pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
/* EAL is secondary and eth_dev is already created. */
if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
@@ -3460,7 +3460,7 @@ hinic3_func_init(struct rte_eth_dev *eth_dev)
err = -ENOMEM;
goto alloc_hwdev_mem_fail;
}
- nic_dev->hwdev->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ nic_dev->hwdev->pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *nic_dev->hwdev->pci_dev);
nic_dev->hwdev->dev_handle = nic_dev;
nic_dev->hwdev->eth_dev = eth_dev;
nic_dev->hwdev->port_id = eth_dev->data->port_id;
@@ -3616,7 +3616,7 @@ hinic3_dev_init(struct rte_eth_dev *eth_dev)
{
struct rte_pci_device *pci_dev;
- pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
PMD_DRV_LOG(INFO, "Initializing %.4x:%.2x:%.2x.%x in %s process",
pci_dev->addr.domain, pci_dev->addr.bus,
diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c
index ad4ef9e189..34e12e7359 100644
--- a/drivers/net/hns3/hns3_cmd.c
+++ b/drivers/net/hns3/hns3_cmd.c
@@ -551,7 +551,7 @@ hns3_set_dcb_capability(struct hns3_hw *hw)
return;
eth_dev = &rte_eth_devices[hw->data->port_id];
- pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
device_id = pci_dev->id.device_id;
if (device_id == HNS3_DEV_ID_25GE_RDMA ||
diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c
index 28d7e94ffb..29b51856d9 100644
--- a/drivers/net/hns3/hns3_common.c
+++ b/drivers/net/hns3/hns3_common.c
@@ -812,7 +812,7 @@ hns3_init_ring_with_vector(struct hns3_hw *hw)
int
hns3_map_rx_interrupt(struct rte_eth_dev *dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
uint16_t base = RTE_INTR_VEC_ZERO_OFFSET;
@@ -878,7 +878,7 @@ hns3_map_rx_interrupt(struct rte_eth_dev *dev)
void
hns3_unmap_rx_interrupt(struct rte_eth_dev *dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct hns3_adapter *hns = dev->data->dev_private;
struct hns3_hw *hw = &hns->hw;
@@ -912,7 +912,7 @@ int
hns3_restore_rx_interrupt(struct hns3_hw *hw)
{
struct rte_eth_dev *dev = &rte_eth_devices[hw->data->port_id];
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
uint16_t q_id;
int ret;
@@ -943,7 +943,7 @@ hns3_get_pci_revision_id(struct hns3_hw *hw, uint8_t *revision_id)
int ret;
eth_dev = &rte_eth_devices[hw->data->port_id];
- pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
ret = rte_pci_read_config(pci_dev, &revision, 1, RTE_PCI_REVISION_ID);
if (ret != 1) {
hns3_err(hw, "failed to read pci revision id, ret = %d", ret);
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index a66fc5d81a..dbe26df77d 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -4526,8 +4526,7 @@ hns3_get_port_supported_speed(struct rte_eth_dev *eth_dev)
static int
hns3_init_pf(struct rte_eth_dev *eth_dev)
{
- struct rte_device *dev = eth_dev->device;
- struct rte_pci_device *pci_dev = RTE_BUS_DEVICE(dev, *pci_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct hns3_adapter *hns = eth_dev->data->dev_private;
struct hns3_hw *hw = &hns->hw;
int ret;
@@ -4656,8 +4655,7 @@ static void
hns3_uninit_pf(struct rte_eth_dev *eth_dev)
{
struct hns3_adapter *hns = eth_dev->data->dev_private;
- struct rte_device *dev = eth_dev->device;
- struct rte_pci_device *pci_dev = RTE_BUS_DEVICE(dev, *pci_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct hns3_hw *hw = &hns->hw;
PMD_INIT_FUNC_TRACE();
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 59fb790240..84e733a0f5 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -1622,7 +1622,7 @@ hns3vf_clear_vport_list(struct hns3_hw *hw)
static int
hns3vf_init_vf(struct rte_eth_dev *eth_dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct hns3_adapter *hns = eth_dev->data->dev_private;
struct hns3_hw *hw = &hns->hw;
int ret;
@@ -1739,7 +1739,7 @@ hns3vf_notify_uninit(struct hns3_hw *hw)
static void
hns3vf_uninit_vf(struct rte_eth_dev *eth_dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct hns3_adapter *hns = eth_dev->data->dev_private;
struct hns3_hw *hw = &hns->hw;
@@ -2377,7 +2377,7 @@ static int
hns3vf_reinit_dev(struct hns3_adapter *hns)
{
struct rte_eth_dev *eth_dev = &rte_eth_devices[hns->hw.data->port_id];
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct hns3_hw *hw = &hns->hw;
int ret;
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index cd8b49999b..8060c37f23 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -1093,7 +1093,7 @@ hns3_dev_all_rx_queue_intr_enable(struct hns3_hw *hw, bool en)
int
hns3_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -3066,7 +3066,7 @@ hns3_tx_push_get_queue_tail_reg(struct rte_eth_dev *dev, uint16_t queue_id)
#define HNS3_TX_PUSH_QUICK_DOORBELL_OFFSET 64
#define HNS3_TX_PUSH_PCI_BAR_INDEX 4
- struct rte_pci_device *pci_dev = RTE_BUS_DEVICE(dev->device, *pci_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
uint8_t bar_id = HNS3_TX_PUSH_PCI_BAR_INDEX;
/*
diff --git a/drivers/net/intel/cpfl/cpfl_ethdev.c b/drivers/net/intel/cpfl/cpfl_ethdev.c
index 03599e6432..562b2dd3c9 100644
--- a/drivers/net/intel/cpfl/cpfl_ethdev.c
+++ b/drivers/net/intel/cpfl/cpfl_ethdev.c
@@ -2764,7 +2764,7 @@ cpfl_dev_vport_init(struct rte_eth_dev *dev, void *init_params)
uint8_t p2p_q_vc_out_info[IDPF_DFLT_MBX_BUF_SIZE] = {0};
struct cpfl_vport_id vi;
struct cpchnl2_vport_id v_id;
- struct rte_pci_device *pci_dev = RTE_BUS_DEVICE(dev->device, *pci_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
int ret = 0;
dev->dev_ops = &cpfl_eth_dev_ops;
@@ -2836,7 +2836,7 @@ cpfl_dev_vport_init(struct rte_eth_dev *dev, void *init_params)
}
/* get the vport info */
if (adapter->base.hw.device_id == IXD_DEV_ID_VCPF) {
- pci_dev = RTE_BUS_DEVICE(dev->device, *pci_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
vi.func_type = VCPF_CPCHNL2_FTYPE_LAN_VF;
vi.pf_id = CPFL_HOST0_CPF_ID;
vi.vf_id = pci_dev->addr.function;
diff --git a/drivers/net/intel/cpfl/cpfl_ethdev.h b/drivers/net/intel/cpfl/cpfl_ethdev.h
index 56f8f39829..4cc73f216b 100644
--- a/drivers/net/intel/cpfl/cpfl_ethdev.h
+++ b/drivers/net/intel/cpfl/cpfl_ethdev.h
@@ -298,7 +298,7 @@ int vcpf_add_queues(struct cpfl_adapter_ext *adapter);
int vcpf_del_queues(struct cpfl_adapter_ext *adapter);
#define CPFL_DEV_TO_PCI(eth_dev) \
- RTE_BUS_DEVICE((eth_dev)->device, struct rte_pci_device)
+ RTE_CLASS_TO_BUS_DEVICE(eth_dev, struct rte_pci_device)
#define CPFL_ADAPTER_TO_EXT(p) \
container_of((p), struct cpfl_adapter_ext, base)
#define CPFL_DEV_TO_VPORT(dev) \
diff --git a/drivers/net/intel/e1000/em_ethdev.c b/drivers/net/intel/e1000/em_ethdev.c
index 9e15e882b9..62ab57268f 100644
--- a/drivers/net/intel/e1000/em_ethdev.c
+++ b/drivers/net/intel/e1000/em_ethdev.c
@@ -273,7 +273,7 @@ eth_em_dev_is_ich8(struct e1000_hw *hw)
static int
eth_em_dev_init(struct rte_eth_dev *eth_dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct e1000_adapter *adapter =
E1000_DEV_PRIVATE(eth_dev->data->dev_private);
@@ -563,7 +563,7 @@ eth_em_start(struct rte_eth_dev *dev)
E1000_DEV_PRIVATE(dev->data->dev_private);
struct e1000_hw *hw =
E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
int ret, mask;
uint32_t intr_vector = 0;
@@ -762,7 +762,7 @@ eth_em_stop(struct rte_eth_dev *dev)
{
struct rte_eth_link link;
struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
/*
@@ -816,7 +816,7 @@ eth_em_close(struct rte_eth_dev *dev)
struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct e1000_adapter *adapter =
E1000_DEV_PRIVATE(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
int ret;
@@ -1062,7 +1062,7 @@ static int
eth_em_rx_queue_intr_enable(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id)
{
struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
/* device interrupts are only subscribed to in primary processes */
@@ -1647,7 +1647,7 @@ static int
eth_em_interrupt_action(struct rte_eth_dev *dev,
struct rte_intr_handle *intr_handle)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct e1000_hw *hw =
E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct e1000_interrupt *intr =
diff --git a/drivers/net/intel/e1000/em_rxtx.c b/drivers/net/intel/e1000/em_rxtx.c
index 54971fe285..e0dcc6a82a 100644
--- a/drivers/net/intel/e1000/em_rxtx.c
+++ b/drivers/net/intel/e1000/em_rxtx.c
@@ -2093,7 +2093,7 @@ em_flush_desc_rings(struct rte_eth_dev *dev)
{
uint32_t fextnvm11, tdlen;
struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
uint16_t pci_cfg_status = 0;
int ret;
diff --git a/drivers/net/intel/e1000/igb_ethdev.c b/drivers/net/intel/e1000/igb_ethdev.c
index ef1599ac38..a4370fe32b 100644
--- a/drivers/net/intel/e1000/igb_ethdev.c
+++ b/drivers/net/intel/e1000/igb_ethdev.c
@@ -529,7 +529,7 @@ igb_intr_enable(struct rte_eth_dev *dev)
E1000_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
struct e1000_hw *hw =
E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
if (rte_intr_allow_others(intr_handle) &&
@@ -546,7 +546,7 @@ igb_intr_disable(struct rte_eth_dev *dev)
{
struct e1000_hw *hw =
E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
if (rte_intr_allow_others(intr_handle) &&
@@ -783,7 +783,7 @@ static int
eth_igb_dev_init(struct rte_eth_dev *eth_dev)
{
int error = 0;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct e1000_hw *hw =
E1000_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
struct e1000_vfta * shadow_vfta =
@@ -1004,7 +1004,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev)
return 0;
}
- pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
rte_eth_copy_pci_info(eth_dev, pci_dev);
hw->device_id = pci_dev->id.device_id;
@@ -1300,7 +1300,7 @@ eth_igb_start(struct rte_eth_dev *dev)
E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct e1000_adapter *adapter =
E1000_DEV_PRIVATE(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
int ret, mask;
uint32_t tqavctrl;
@@ -1537,7 +1537,7 @@ static int
eth_igb_stop(struct rte_eth_dev *dev)
{
struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_eth_link link;
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct e1000_adapter *adapter =
@@ -1646,7 +1646,7 @@ eth_igb_close(struct rte_eth_dev *dev)
{
struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct rte_eth_link link;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct e1000_filter_info *filter_info =
E1000_DEV_PRIVATE_TO_FILTER_INFO(dev->data->dev_private);
@@ -2931,7 +2931,7 @@ static int eth_igb_rxq_interrupt_setup(struct rte_eth_dev *dev)
int ret;
struct e1000_hw *hw =
E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
int misc_shift = rte_intr_allow_others(intr_handle) ? 1 : 0;
struct rte_eth_dev_info dev_info;
@@ -3002,7 +3002,7 @@ eth_igb_interrupt_action(struct rte_eth_dev *dev,
E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct e1000_interrupt *intr =
E1000_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_eth_link link;
int ret;
@@ -3496,7 +3496,7 @@ igbvf_dev_start(struct rte_eth_dev *dev)
E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct e1000_adapter *adapter =
E1000_DEV_PRIVATE(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
int ret;
uint32_t intr_vector = 0;
@@ -3560,7 +3560,7 @@ igbvf_dev_start(struct rte_eth_dev *dev)
static int
igbvf_dev_stop(struct rte_eth_dev *dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct e1000_adapter *adapter =
E1000_DEV_PRIVATE(dev->data->dev_private);
@@ -3608,7 +3608,7 @@ igbvf_dev_close(struct rte_eth_dev *dev)
{
struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct rte_ether_addr addr;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
int ret;
PMD_INIT_FUNC_TRACE();
@@ -5410,7 +5410,7 @@ eth_igb_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
{
struct e1000_hw *hw =
E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
uint32_t vec = E1000_MISC_VEC_ID;
@@ -5434,7 +5434,7 @@ eth_igb_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
{
struct e1000_hw *hw =
E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
uint32_t vec = E1000_MISC_VEC_ID;
@@ -5516,7 +5516,7 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)
uint32_t vec = E1000_MISC_VEC_ID;
uint32_t base = E1000_MISC_VEC_ID;
uint32_t misc_shift = 0;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
/* won't configure msix register if no mapping is done
diff --git a/drivers/net/intel/e1000/igb_pf.c b/drivers/net/intel/e1000/igb_pf.c
index c7588ea57e..50df3daeb7 100644
--- a/drivers/net/intel/e1000/igb_pf.c
+++ b/drivers/net/intel/e1000/igb_pf.c
@@ -29,7 +29,7 @@
static inline uint16_t
dev_num_vf(struct rte_eth_dev *eth_dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
return pci_dev->max_vfs;
}
diff --git a/drivers/net/intel/e1000/igc_ethdev.c b/drivers/net/intel/e1000/igc_ethdev.c
index 727ea36c2b..de35da2c36 100644
--- a/drivers/net/intel/e1000/igc_ethdev.c
+++ b/drivers/net/intel/e1000/igc_ethdev.c
@@ -440,7 +440,7 @@ static void
igc_intr_other_disable(struct rte_eth_dev *dev)
{
struct e1000_hw *hw = IGC_DEV_PRIVATE_HW(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
if (rte_intr_allow_others(intr_handle) &&
@@ -460,7 +460,7 @@ igc_intr_other_enable(struct rte_eth_dev *dev)
{
struct igc_interrupt *intr = IGC_DEV_PRIVATE_INTR(dev);
struct e1000_hw *hw = IGC_DEV_PRIVATE_HW(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
if (rte_intr_allow_others(intr_handle) &&
@@ -576,7 +576,7 @@ static void
eth_igc_interrupt_action(struct rte_eth_dev *dev)
{
struct igc_interrupt *intr = IGC_DEV_PRIVATE_INTR(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_eth_link link;
int ret;
@@ -679,7 +679,7 @@ eth_igc_stop(struct rte_eth_dev *dev)
{
struct igc_adapter *adapter = IGC_DEV_PRIVATE(dev);
struct e1000_hw *hw = IGC_DEV_PRIVATE_HW(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct rte_eth_link link;
@@ -799,7 +799,7 @@ static void
igc_configure_msix_intr(struct rte_eth_dev *dev)
{
struct e1000_hw *hw = IGC_DEV_PRIVATE_HW(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
uint32_t intr_mask;
@@ -882,7 +882,7 @@ igc_rxq_interrupt_setup(struct rte_eth_dev *dev)
{
uint32_t mask;
struct e1000_hw *hw = IGC_DEV_PRIVATE_HW(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
int misc_shift = rte_intr_allow_others(intr_handle) ? 1 : 0;
int nb_efd;
@@ -990,7 +990,7 @@ eth_igc_start(struct rte_eth_dev *dev)
{
struct e1000_hw *hw = IGC_DEV_PRIVATE_HW(dev);
struct igc_adapter *adapter = IGC_DEV_PRIVATE(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
uint32_t nsec, sec, baset_l, baset_h, tqavctrl;
struct timespec system_time;
@@ -1307,7 +1307,7 @@ igc_dev_free_queues(struct rte_eth_dev *dev)
static int
eth_igc_close(struct rte_eth_dev *dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct e1000_hw *hw = IGC_DEV_PRIVATE_HW(dev);
struct igc_adapter *adapter = IGC_DEV_PRIVATE(dev);
@@ -1359,7 +1359,7 @@ igc_identify_hardware(struct rte_eth_dev *dev, struct rte_pci_device *pci_dev)
static int
eth_igc_dev_init(struct rte_eth_dev *dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct igc_adapter *igc = IGC_DEV_PRIVATE(dev);
struct e1000_hw *hw = IGC_DEV_PRIVATE_HW(dev);
int i, error = 0;
@@ -2257,7 +2257,7 @@ static int
eth_igc_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
{
struct e1000_hw *hw = IGC_DEV_PRIVATE_HW(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
uint32_t vec = IGC_MISC_VEC_ID;
@@ -2280,7 +2280,7 @@ static int
eth_igc_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
{
struct e1000_hw *hw = IGC_DEV_PRIVATE_HW(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
uint32_t vec = IGC_MISC_VEC_ID;
diff --git a/drivers/net/intel/fm10k/fm10k_ethdev.c b/drivers/net/intel/fm10k/fm10k_ethdev.c
index 97f61afec2..ca438d2d02 100644
--- a/drivers/net/intel/fm10k/fm10k_ethdev.c
+++ b/drivers/net/intel/fm10k/fm10k_ethdev.c
@@ -693,7 +693,7 @@ fm10k_dev_rx_init(struct rte_eth_dev *dev)
{
struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct fm10k_macvlan_filter_info *macvlan;
- struct rte_pci_device *pdev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pdev = RTE_CLASS_TO_BUS_DEVICE(dev, *pdev);
struct rte_intr_handle *intr_handle = pdev->intr_handle;
int i, ret;
struct fm10k_rx_queue *rxq;
@@ -1161,7 +1161,7 @@ static int
fm10k_dev_stop(struct rte_eth_dev *dev)
{
struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pdev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pdev = RTE_CLASS_TO_BUS_DEVICE(dev, *pdev);
struct rte_intr_handle *intr_handle = pdev->intr_handle;
int i;
@@ -1371,7 +1371,7 @@ fm10k_dev_infos_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info)
{
struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pdev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pdev = RTE_CLASS_TO_BUS_DEVICE(dev, *pdev);
PMD_INIT_FUNC_TRACE();
@@ -2364,7 +2364,7 @@ static int
fm10k_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
{
struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pdev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pdev = RTE_CLASS_TO_BUS_DEVICE(dev, *pdev);
/* Enable ITR */
if (hw->mac.type == fm10k_mac_pf)
@@ -2381,7 +2381,7 @@ static int
fm10k_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
{
struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pdev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pdev = RTE_CLASS_TO_BUS_DEVICE(dev, *pdev);
/* Disable ITR */
if (hw->mac.type == fm10k_mac_pf)
@@ -2397,7 +2397,7 @@ static int
fm10k_dev_rxq_interrupt_setup(struct rte_eth_dev *dev)
{
struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pdev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pdev = RTE_CLASS_TO_BUS_DEVICE(dev, *pdev);
struct rte_intr_handle *intr_handle = pdev->intr_handle;
uint32_t intr_vector, vec;
uint16_t queue_id;
@@ -2794,7 +2794,7 @@ static int
fm10k_dev_close(struct rte_eth_dev *dev)
{
struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pdev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pdev = RTE_CLASS_TO_BUS_DEVICE(dev, *pdev);
struct rte_intr_handle *intr_handle = pdev->intr_handle;
int ret;
@@ -3060,7 +3060,7 @@ static int
eth_fm10k_dev_init(struct rte_eth_dev *dev)
{
struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pdev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pdev = RTE_CLASS_TO_BUS_DEVICE(dev, *pdev);
struct rte_intr_handle *intr_handle = pdev->intr_handle;
int diag, i, ret;
struct fm10k_macvlan_filter_info *macvlan;
diff --git a/drivers/net/intel/i40e/i40e_ethdev.c b/drivers/net/intel/i40e/i40e_ethdev.c
index 100a751225..559df03a69 100644
--- a/drivers/net/intel/i40e/i40e_ethdev.c
+++ b/drivers/net/intel/i40e/i40e_ethdev.c
@@ -981,7 +981,7 @@ is_floating_veb_supported(struct rte_devargs *devargs)
static void
config_floating_veb(struct rte_eth_dev *dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -1549,7 +1549,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)
return 0;
}
i40e_set_default_ptype_table(dev);
- pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
intr_handle = pci_dev->intr_handle;
rte_eth_copy_pci_info(dev, pci_dev);
@@ -2041,7 +2041,7 @@ void
i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi)
{
struct rte_eth_dev *dev = I40E_VSI_TO_ETH_DEV(vsi);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
uint16_t msix_vect = vsi->msix_intr;
@@ -2157,7 +2157,7 @@ int
i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)
{
struct rte_eth_dev *dev = I40E_VSI_TO_ETH_DEV(vsi);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
uint16_t msix_vect = vsi->msix_intr;
@@ -2236,7 +2236,7 @@ void
i40e_vsi_enable_queues_intr(struct i40e_vsi *vsi)
{
struct rte_eth_dev *dev = I40E_VSI_TO_ETH_DEV(vsi);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
struct i40e_pf *pf = I40E_VSI_TO_PF(vsi);
@@ -2263,7 +2263,7 @@ void
i40e_vsi_disable_queues_intr(struct i40e_vsi *vsi)
{
struct rte_eth_dev *dev = I40E_VSI_TO_ETH_DEV(vsi);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
struct i40e_pf *pf = I40E_VSI_TO_PF(vsi);
@@ -2431,7 +2431,7 @@ i40e_dev_start(struct rte_eth_dev *dev)
struct i40e_adapter *ad =
I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
int ret, i;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
uint32_t intr_vector = 0;
struct i40e_vsi *vsi;
@@ -2612,7 +2612,7 @@ i40e_dev_stop(struct rte_eth_dev *dev)
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct i40e_vsi *main_vsi = pf->main_vsi;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
int i;
@@ -2674,7 +2674,7 @@ i40e_dev_close(struct rte_eth_dev *dev)
{
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct i40e_filter_control_settings settings;
struct rte_flow *p_flow;
@@ -3831,7 +3831,7 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct i40e_vsi *vsi = pf->main_vsi;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
dev_info->max_rx_queues = vsi->nb_qps;
dev_info->max_tx_queues = vsi->nb_qps;
@@ -4884,7 +4884,7 @@ i40e_pf_parameter_init(struct rte_eth_dev *dev)
{
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct i40e_hw *hw = I40E_PF_TO_HW(pf);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
uint16_t qp_count = 0, vsi_count = 0;
if (pci_dev->max_vfs && !hw->func_caps.sr_iov_1_1) {
@@ -10033,7 +10033,7 @@ i40e_dev_flow_ops_get(struct rte_eth_dev *dev,
static void
i40e_enable_extended_tag(struct rte_eth_dev *dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
uint32_t buf = 0;
int ret;
@@ -11219,7 +11219,7 @@ i40e_dev_get_dcb_info(struct rte_eth_dev *dev,
static int
i40e_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
uint16_t msix_intr;
@@ -11247,7 +11247,7 @@ i40e_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
static int
i40e_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
uint16_t msix_intr;
diff --git a/drivers/net/intel/i40e/i40e_ethdev.h b/drivers/net/intel/i40e/i40e_ethdev.h
index dcbdf65047..c39a5a8802 100644
--- a/drivers/net/intel/i40e/i40e_ethdev.h
+++ b/drivers/net/intel/i40e/i40e_ethdev.h
@@ -1467,7 +1467,7 @@ int i40e_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params);
int i40e_vf_representor_uninit(struct rte_eth_dev *ethdev);
#define I40E_DEV_TO_PCI(eth_dev) \
- RTE_BUS_DEVICE((eth_dev)->device, struct rte_pci_device)
+ RTE_CLASS_TO_BUS_DEVICE(eth_dev, struct rte_pci_device)
/* I40E_DEV_PRIVATE_TO */
#define I40E_DEV_PRIVATE_TO_PF(adapter) \
diff --git a/drivers/net/intel/iavf/iavf_ethdev.c b/drivers/net/intel/iavf/iavf_ethdev.c
index 1eca20bc9a..4ad9e594bb 100644
--- a/drivers/net/intel/iavf/iavf_ethdev.c
+++ b/drivers/net/intel/iavf/iavf_ethdev.c
@@ -1947,7 +1947,7 @@ iavf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
{
struct iavf_adapter *adapter =
IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter);
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
uint16_t msix_intr;
@@ -1983,7 +1983,7 @@ iavf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
static int
iavf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
uint16_t msix_intr;
@@ -2767,7 +2767,7 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
IAVF_DEV_PRIVATE_TO_ADAPTER(eth_dev->data->dev_private);
struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter);
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
int ret = 0;
PMD_INIT_FUNC_TRACE();
@@ -2926,7 +2926,7 @@ static int
iavf_dev_close(struct rte_eth_dev *dev)
{
struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct iavf_adapter *adapter =
IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
diff --git a/drivers/net/intel/ice/ice_dcf.c b/drivers/net/intel/ice/ice_dcf.c
index 51716a4d5b..0953fd6668 100644
--- a/drivers/net/intel/ice/ice_dcf.c
+++ b/drivers/net/intel/ice/ice_dcf.c
@@ -658,7 +658,7 @@ ice_dcf_send_aq_cmd(void *dcf_hw, struct ice_aq_desc *desc,
int
ice_dcf_handle_vsi_update_event(struct ice_dcf_hw *hw)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(hw->eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(hw->eth_dev, *pci_dev);
int i = 0;
int err = -1;
@@ -738,7 +738,7 @@ dcf_get_vlan_offload_caps_v2(struct ice_dcf_hw *hw)
int
ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
int ret, size;
hw->resetting = false;
@@ -873,7 +873,7 @@ ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
void
ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_QOS)
diff --git a/drivers/net/intel/ice/ice_ethdev.c b/drivers/net/intel/ice/ice_ethdev.c
index 715d1522f9..f0a9a8e536 100644
--- a/drivers/net/intel/ice/ice_ethdev.c
+++ b/drivers/net/intel/ice/ice_ethdev.c
@@ -2623,7 +2623,7 @@ ice_dev_init(struct rte_eth_dev *dev)
}
ice_set_default_ptype_table(dev);
- pci_dev = RTE_BUS_DEVICE(dev->device, *pci_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
intr_handle = pci_dev->intr_handle;
pf->adapter = ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
@@ -2956,7 +2956,7 @@ ice_dev_close(struct rte_eth_dev *dev)
{
struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct ice_adapter *ad =
ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
@@ -4520,7 +4520,7 @@ ice_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct ice_vsi *vsi = pf->main_vsi;
- struct rte_pci_device *pci_dev = RTE_BUS_DEVICE(dev->device, *pci_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
bool is_safe_mode = pf->adapter->is_safe_mode;
u64 phy_type_low;
u64 phy_type_high;
diff --git a/drivers/net/intel/ice/ice_ethdev.h b/drivers/net/intel/ice/ice_ethdev.h
index ea73f8bcb3..92baa62cc4 100644
--- a/drivers/net/intel/ice/ice_ethdev.h
+++ b/drivers/net/intel/ice/ice_ethdev.h
@@ -708,7 +708,7 @@ struct ice_vsi_vlan_pvid_info {
};
#define ICE_DEV_TO_PCI(eth_dev) \
- RTE_BUS_DEVICE((eth_dev)->device, struct rte_pci_device)
+ RTE_CLASS_TO_BUS_DEVICE(eth_dev, struct rte_pci_device)
/* ICE_DEV_PRIVATE_TO */
#define ICE_DEV_PRIVATE_TO_PF(adapter) \
diff --git a/drivers/net/intel/idpf/idpf_ethdev.h b/drivers/net/intel/idpf/idpf_ethdev.h
index 5105eea1c5..99496c59da 100644
--- a/drivers/net/intel/idpf/idpf_ethdev.h
+++ b/drivers/net/intel/idpf/idpf_ethdev.h
@@ -85,7 +85,7 @@ struct idpf_adapter_ext {
TAILQ_HEAD(idpf_adapter_list, idpf_adapter_ext);
#define IDPF_DEV_TO_PCI(eth_dev) \
- RTE_BUS_DEVICE((eth_dev)->device, struct rte_pci_device)
+ RTE_CLASS_TO_BUS_DEVICE(eth_dev, struct rte_pci_device)
#define IDPF_ADAPTER_TO_EXT(p) \
container_of((p), struct idpf_adapter_ext, base)
diff --git a/drivers/net/intel/ipn3ke/ipn3ke_ethdev.h b/drivers/net/intel/ipn3ke/ipn3ke_ethdev.h
index 6d531120b8..505b8f367a 100644
--- a/drivers/net/intel/ipn3ke/ipn3ke_ethdev.h
+++ b/drivers/net/intel/ipn3ke/ipn3ke_ethdev.h
@@ -310,9 +310,6 @@ struct ipn3ke_hw {
uint8_t *hw_addr;
};
-#define RTE_ETH_DEV_TO_AFU(eth_dev) \
- RTE_BUS_DEVICE((eth_dev)->device, struct rte_afu_device)
-
/**
* PCIe MMIO Access
*/
diff --git a/drivers/net/intel/ipn3ke/ipn3ke_representor.c b/drivers/net/intel/ipn3ke/ipn3ke_representor.c
index cd34d08055..af1af31f1d 100644
--- a/drivers/net/intel/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/intel/ipn3ke/ipn3ke_representor.c
@@ -2070,7 +2070,7 @@ ipn3ke_rpst_stats_reset(struct rte_eth_dev *ethdev)
return -EINVAL;
}
- afu_dev = RTE_ETH_DEV_TO_AFU(ethdev);
+ afu_dev = RTE_CLASS_TO_BUS_DEVICE(ethdev, *afu_dev);
if (!afu_dev) {
IPN3KE_AFU_PMD_ERR("afu device to reset is NULL!");
return -EINVAL;
@@ -2138,7 +2138,7 @@ ipn3ke_rpst_stats_get
return -EINVAL;
}
- afu_dev = RTE_ETH_DEV_TO_AFU(ethdev);
+ afu_dev = RTE_CLASS_TO_BUS_DEVICE(ethdev, *afu_dev);
if (!afu_dev) {
IPN3KE_AFU_PMD_ERR("afu device to get statistics is NULL!");
return -EINVAL;
@@ -2228,7 +2228,7 @@ ipn3ke_rpst_xstats_get
return -EINVAL;
}
- afu_dev = RTE_ETH_DEV_TO_AFU(ethdev);
+ afu_dev = RTE_CLASS_TO_BUS_DEVICE(ethdev, *afu_dev);
if (!afu_dev) {
IPN3KE_AFU_PMD_ERR("afu device to get statistics is NULL!");
return -EINVAL;
diff --git a/drivers/net/intel/ixgbe/ixgbe_ethdev.c b/drivers/net/intel/ixgbe/ixgbe_ethdev.c
index 57d929cf2c..39db5368b7 100644
--- a/drivers/net/intel/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/intel/ixgbe/ixgbe_ethdev.c
@@ -1085,7 +1085,7 @@ static int
eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)
{
struct ixgbe_adapter *ad = eth_dev->data->dev_private;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct ixgbe_hw *hw =
IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
@@ -1598,7 +1598,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
int diag;
uint32_t tc, tcs;
struct ixgbe_adapter *ad = eth_dev->data->dev_private;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct ixgbe_hw *hw =
IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
@@ -2264,7 +2264,7 @@ ixgbe_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
static int
ixgbe_check_vf_rss_rxq_num(struct rte_eth_dev *dev, uint16_t nb_rx_q)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
switch (nb_rx_q) {
case 1:
@@ -2506,7 +2506,7 @@ ixgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uint16_t vf,
struct rte_pci_device *pci_dev;
int ret;
- pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
ret = rte_eth_link_get_nowait(dev->data->port_id, &link);
if (ret < 0)
return ret;
@@ -2614,7 +2614,7 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct ixgbe_vf_info *vfinfo =
*IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
uint32_t intr_vector = 0;
int err;
@@ -2921,7 +2921,7 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct ixgbe_vf_info *vfinfo =
*IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
int vf;
struct ixgbe_tm_conf *tm_conf =
@@ -3082,7 +3082,7 @@ ixgbe_dev_close(struct rte_eth_dev *dev)
{
struct ixgbe_hw *hw =
IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
int retries = 0;
int ret;
@@ -3970,7 +3970,7 @@ ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
static int
ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
@@ -4100,7 +4100,7 @@ static int
ixgbevf_dev_info_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
dev_info->max_rx_queues = (uint16_t)hw->mac.max_rx_queues;
@@ -4668,7 +4668,7 @@ ixgbe_dev_interrupt_get_status(struct rte_eth_dev *dev)
static void
ixgbe_dev_link_status_print(struct rte_eth_dev *dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_eth_link link;
rte_eth_linkstatus_get(dev, &link);
@@ -4780,7 +4780,7 @@ static void
ixgbe_dev_interrupt_delayed_handler(void *param)
{
struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct ixgbe_interrupt *intr =
IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
@@ -5344,7 +5344,7 @@ ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index)
static int
ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
/*
* This function calls into the base driver, which in turn will use
@@ -5508,7 +5508,7 @@ ixgbevf_dev_start(struct rte_eth_dev *dev)
struct ixgbe_hw *hw =
IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
uint32_t intr_vector = 0;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
int err, mask = 0;
@@ -5621,7 +5621,7 @@ ixgbevf_dev_stop(struct rte_eth_dev *dev)
{
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct ixgbe_adapter *adapter = dev->data->dev_private;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
/*
@@ -5669,7 +5669,7 @@ static int
ixgbevf_dev_close(struct rte_eth_dev *dev)
{
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
int ret;
@@ -5975,7 +5975,7 @@ ixgbe_convert_vm_rx_mask_to_val(uint16_t rx_mask, uint32_t orig_val)
static int
ixgbevf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct ixgbe_interrupt *intr =
IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
@@ -6005,7 +6005,7 @@ ixgbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
struct ixgbe_hw *hw =
IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
uint32_t vec = IXGBE_MISC_VEC_ID;
@@ -6025,7 +6025,7 @@ ixgbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
static int
ixgbe_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
uint32_t mask;
struct ixgbe_hw *hw =
@@ -6162,7 +6162,7 @@ ixgbe_set_ivar_map(struct ixgbe_hw *hw, int8_t direction,
static void
ixgbevf_configure_msix(struct rte_eth_dev *dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct ixgbe_hw *hw =
IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -6213,7 +6213,7 @@ ixgbevf_configure_msix(struct rte_eth_dev *dev)
static void
ixgbe_configure_msix(struct rte_eth_dev *dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct ixgbe_hw *hw =
IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
diff --git a/drivers/net/intel/ixgbe/ixgbe_flow.c b/drivers/net/intel/ixgbe/ixgbe_flow.c
index 01cd4f9bde..659007980a 100644
--- a/drivers/net/intel/ixgbe/ixgbe_flow.c
+++ b/drivers/net/intel/ixgbe/ixgbe_flow.c
@@ -1272,7 +1272,7 @@ cons_parse_l2_tn_filter(struct rte_eth_dev *dev,
const struct rte_flow_item_e_tag *e_tag_mask;
const struct rte_flow_action *act;
const struct rte_flow_action_vf *act_vf;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
if (!pattern) {
rte_flow_error_set(error, EINVAL,
@@ -1430,7 +1430,7 @@ ixgbe_parse_l2_tn_filter(struct rte_eth_dev *dev,
{
int ret = 0;
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
uint16_t vf_num;
ret = cons_parse_l2_tn_filter(dev, attr, pattern,
diff --git a/drivers/net/intel/ixgbe/ixgbe_pf.c b/drivers/net/intel/ixgbe/ixgbe_pf.c
index d9a775f99a..2c014a0b96 100644
--- a/drivers/net/intel/ixgbe/ixgbe_pf.c
+++ b/drivers/net/intel/ixgbe/ixgbe_pf.c
@@ -32,7 +32,7 @@
static inline uint16_t
dev_num_vf(struct rte_eth_dev *eth_dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
return pci_dev->max_vfs;
}
diff --git a/drivers/net/intel/ixgbe/ixgbe_tm.c b/drivers/net/intel/ixgbe/ixgbe_tm.c
index 27a821285d..50c7fa228a 100644
--- a/drivers/net/intel/ixgbe/ixgbe_tm.c
+++ b/drivers/net/intel/ixgbe/ixgbe_tm.c
@@ -365,7 +365,7 @@ ixgbe_queue_base_nb_get(struct rte_eth_dev *dev, uint16_t tc_node_no,
uint16_t *base, uint16_t *nb)
{
uint8_t nb_tcs = ixgbe_tc_nb_get(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
uint16_t vf_num = pci_dev->max_vfs;
*base = 0;
diff --git a/drivers/net/intel/ixgbe/ixgbe_vf_representor.c b/drivers/net/intel/ixgbe/ixgbe_vf_representor.c
index 901d80e406..bad699dd70 100644
--- a/drivers/net/intel/ixgbe/ixgbe_vf_representor.c
+++ b/drivers/net/intel/ixgbe/ixgbe_vf_representor.c
@@ -190,7 +190,7 @@ ixgbe_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params)
representor->pf_ethdev =
((struct ixgbe_vf_representor *)init_params)->pf_ethdev;
- pci_dev = RTE_ETH_DEV_TO_PCI(representor->pf_ethdev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(representor->pf_ethdev, *pci_dev);
if (representor->vf_id >= pci_dev->max_vfs)
return -ENODEV;
diff --git a/drivers/net/intel/ixgbe/rte_pmd_ixgbe.c b/drivers/net/intel/ixgbe/rte_pmd_ixgbe.c
index c2300a8955..35d364fb19 100644
--- a/drivers/net/intel/ixgbe/rte_pmd_ixgbe.c
+++ b/drivers/net/intel/ixgbe/rte_pmd_ixgbe.c
@@ -25,7 +25,7 @@ rte_pmd_ixgbe_set_vf_mac_addr(uint16_t port, uint16_t vf,
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
dev = &rte_eth_devices[port];
- pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
if (!is_ixgbe_supported(dev))
return -ENOTSUP;
@@ -60,7 +60,7 @@ rte_pmd_ixgbe_ping_vf(uint16_t port, uint16_t vf)
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
dev = &rte_eth_devices[port];
- pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
if (!is_ixgbe_supported(dev))
return -ENOTSUP;
@@ -92,7 +92,7 @@ rte_pmd_ixgbe_set_vf_vlan_anti_spoof(uint16_t port, uint16_t vf, uint8_t on)
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
dev = &rte_eth_devices[port];
- pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
if (!is_ixgbe_supported(dev))
return -ENOTSUP;
@@ -123,7 +123,7 @@ rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on)
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
dev = &rte_eth_devices[port];
- pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
if (!is_ixgbe_supported(dev))
return -ENOTSUP;
@@ -153,7 +153,7 @@ rte_pmd_ixgbe_set_vf_vlan_insert(uint16_t port, uint16_t vf, uint16_t vlan_id)
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
dev = &rte_eth_devices[port];
- pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
if (!is_ixgbe_supported(dev))
return -ENOTSUP;
@@ -252,7 +252,7 @@ rte_pmd_ixgbe_set_vf_split_drop_en(uint16_t port, uint16_t vf, uint8_t on)
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
dev = &rte_eth_devices[port];
- pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
if (!is_ixgbe_supported(dev))
return -ENOTSUP;
@@ -289,7 +289,7 @@ rte_pmd_ixgbe_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on)
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
dev = &rte_eth_devices[port];
- pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
if (!is_ixgbe_supported(dev))
@@ -338,7 +338,7 @@ rte_pmd_ixgbe_set_vf_rxmode(uint16_t port, uint16_t vf,
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
dev = &rte_eth_devices[port];
- pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
if (!is_ixgbe_supported(dev))
return -ENOTSUP;
@@ -386,7 +386,7 @@ rte_pmd_ixgbe_set_vf_rx(uint16_t port, uint16_t vf, uint8_t on)
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
dev = &rte_eth_devices[port];
- pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
if (!is_ixgbe_supported(dev))
return -ENOTSUP;
@@ -438,7 +438,7 @@ rte_pmd_ixgbe_set_vf_tx(uint16_t port, uint16_t vf, uint8_t on)
RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
dev = &rte_eth_devices[port];
- pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
if (!is_ixgbe_supported(dev))
return -ENOTSUP;
diff --git a/drivers/net/nbl/nbl_core.c b/drivers/net/nbl/nbl_core.c
index df8c0c76ed..6a823e9bfb 100644
--- a/drivers/net/nbl/nbl_core.c
+++ b/drivers/net/nbl/nbl_core.c
@@ -32,7 +32,7 @@ static void nbl_init_func_caps(const struct rte_pci_device *pci_dev, struct nbl_
int nbl_core_init(struct nbl_adapter *adapter, struct rte_eth_dev *eth_dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
const struct nbl_product_core_ops *product_base_ops = NULL;
struct nbl_common_info *common = NBL_ADAPTER_TO_COMMON(adapter);
int ret = 0;
diff --git a/drivers/net/nbl/nbl_dev/nbl_dev.c b/drivers/net/nbl/nbl_dev/nbl_dev.c
index 2b0413fb7c..35485ea691 100644
--- a/drivers/net/nbl/nbl_dev/nbl_dev.c
+++ b/drivers/net/nbl/nbl_dev/nbl_dev.c
@@ -868,7 +868,7 @@ static int nbl_dev_common_start(struct nbl_dev_mgt *dev_mgt)
struct nbl_dev_net_mgt *net_dev = NBL_DEV_MGT_TO_NET_DEV(dev_mgt);
struct nbl_common_info *common = NBL_DEV_MGT_TO_COMMON(dev_mgt);
struct nbl_board_port_info *board_info;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(net_dev->eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(net_dev->eth_dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
u8 *mac;
int ret;
@@ -991,7 +991,7 @@ static void nbl_dev_leonis_stop(void *p)
const struct nbl_common_info *common = NBL_DEV_MGT_TO_COMMON(dev_mgt);
const struct nbl_dispatch_ops *disp_ops = NBL_DEV_MGT_TO_DISP_OPS(dev_mgt);
const struct nbl_channel_ops *chan_ops = NBL_DEV_MGT_TO_CHAN_OPS(dev_mgt);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(net_dev->eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(net_dev->eth_dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
u8 *mac;
@@ -1105,7 +1105,7 @@ static int nbl_dev_setup_net_dev(struct nbl_dev_mgt *dev_mgt,
struct nbl_register_net_param register_param = { 0 };
struct nbl_register_net_result register_result = { 0 };
struct nbl_dev_ring_mgt *ring_mgt;
- const struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ const struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
int ret = 0;
net_dev = rte_zmalloc("nbl_dev_net", sizeof(struct nbl_dev_net_mgt), 0);
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 7ec554cb83..9a193e4a7a 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -1627,7 +1627,6 @@ static int
eth_hn_dev_init(struct rte_eth_dev *eth_dev)
{
struct hn_data *hv = eth_dev->data->dev_private;
- struct rte_device *device = eth_dev->device;
struct rte_vmbus_device *vmbus;
uint32_t mtu;
unsigned int rxr_cnt;
@@ -1638,7 +1637,7 @@ eth_hn_dev_init(struct rte_eth_dev *eth_dev)
rte_spinlock_init(&hv->hotadd_lock);
LIST_INIT(&hv->hotadd_list);
- vmbus = RTE_BUS_DEVICE(device, *vmbus);
+ vmbus = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *vmbus);
eth_dev->dev_ops = &hn_eth_dev_ops;
eth_dev->rx_queue_count = hn_dev_rx_queue_count;
eth_dev->rx_descriptor_status = hn_dev_rx_queue_status;
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index cbd1deffb4..d2da18013c 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -363,7 +363,7 @@ nfp_net_start(struct rte_eth_dev *dev)
struct rte_eth_txmode *txmode;
struct nfp_net_hw_priv *hw_priv;
struct nfp_app_fw_nic *app_fw_nic;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
net_hw = dev->data->dev_private;
@@ -770,7 +770,7 @@ nfp_net_close(struct rte_eth_dev *dev)
hw = dev->data->dev_private;
pf_dev = hw_priv->pf_dev;
- pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
app_fw_nic = NFP_PRIV_TO_APP_FW_NIC(pf_dev->app_fw_priv);
/*
@@ -1022,7 +1022,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev,
struct nfp_net_hw_priv *hw_priv;
struct nfp_app_fw_nic *app_fw_nic;
- pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
net_hw = eth_dev->data->dev_private;
hw_init = para;
@@ -2879,7 +2879,7 @@ nfp_pci_uninit(struct rte_eth_dev *eth_dev)
uint16_t port_id;
struct rte_pci_device *pci_dev;
- pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
/* Free up all physical ports under PF */
RTE_ETH_FOREACH_DEV_OF(port_id, &pci_dev->device)
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 23fa5b82ad..a86cc36592 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -30,7 +30,7 @@ nfp_netvf_start(struct rte_eth_dev *dev)
struct nfp_net_hw *net_hw;
struct rte_eth_conf *dev_conf;
struct rte_eth_rxmode *rxmode;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
/* Disabling queues just in case... */
@@ -169,7 +169,7 @@ nfp_netvf_close(struct rte_eth_dev *dev)
return 0;
net_hw = dev->data->dev_private;
- pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
hw_priv = dev->process_private;
rte_free(net_hw->eth_xstats_base);
@@ -266,7 +266,7 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)
const struct nfp_dev_info *dev_info;
port = eth_dev->data->port_id;
- pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
dev_info = nfp_dev_info_get(pci_dev->id.device_id);
if (dev_info == NULL) {
diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index d35eee970a..2d36311cfe 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -1568,7 +1568,7 @@ nfp_rx_queue_intr_enable(struct rte_eth_dev *dev,
struct nfp_net_hw *hw;
struct rte_pci_device *pci_dev;
- pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
if (rte_intr_type_get(pci_dev->intr_handle) != RTE_INTR_HANDLE_UIO)
base = 1;
@@ -1589,7 +1589,7 @@ nfp_rx_queue_intr_disable(struct rte_eth_dev *dev,
struct nfp_net_hw *hw;
struct rte_pci_device *pci_dev;
- pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
if (rte_intr_type_get(pci_dev->intr_handle) != RTE_INTR_HANDLE_UIO)
base = 1;
@@ -1606,7 +1606,7 @@ static void
nfp_net_dev_link_status_print(struct rte_eth_dev *dev)
{
struct rte_eth_link link;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
rte_eth_linkstatus_get(dev, &link);
if (link.link_status != 0)
@@ -1635,7 +1635,7 @@ nfp_net_irq_unmask(struct rte_eth_dev *dev)
struct rte_pci_device *pci_dev;
hw = nfp_net_get_hw(dev);
- pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
/* Make sure all updates are written before un-masking */
rte_wmb();
diff --git a/drivers/net/ngbe/ngbe_ethdev.c b/drivers/net/ngbe/ngbe_ethdev.c
index 8b9d6371fb..f7b4a8b159 100644
--- a/drivers/net/ngbe/ngbe_ethdev.c
+++ b/drivers/net/ngbe/ngbe_ethdev.c
@@ -321,7 +321,7 @@ ngbe_swfw_lock_reset(struct ngbe_hw *hw)
static int
eth_ngbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct ngbe_hw *hw = ngbe_dev_hw(eth_dev);
struct ngbe_vfta *shadow_vfta = NGBE_DEV_VFTA(eth_dev);
struct ngbe_hwstrip *hwstrip = NGBE_DEV_HWSTRIP(eth_dev);
@@ -958,7 +958,7 @@ ngbe_dev_start(struct rte_eth_dev *dev)
{
struct ngbe_hw *hw = ngbe_dev_hw(dev);
struct ngbe_hw_stats *hw_stats = NGBE_DEV_STATS(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
uint32_t intr_vector = 0;
int err;
@@ -1160,7 +1160,7 @@ ngbe_dev_stop(struct rte_eth_dev *dev)
struct ngbe_adapter *adapter = ngbe_dev_adapter(dev);
struct ngbe_hw *hw = ngbe_dev_hw(dev);
struct ngbe_vf_info *vfinfo = *NGBE_DEV_VFDATA(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
int vf;
@@ -1256,7 +1256,7 @@ static int
ngbe_dev_close(struct rte_eth_dev *dev)
{
struct ngbe_hw *hw = ngbe_dev_hw(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
int retries = 0;
int ret;
@@ -1843,7 +1843,7 @@ ngbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
static int
ngbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct ngbe_hw *hw = ngbe_dev_hw(dev);
dev_info->max_rx_queues = (uint16_t)hw->mac.max_rx_queues;
@@ -2258,7 +2258,7 @@ ngbe_dev_interrupt_get_status(struct rte_eth_dev *dev)
static void
ngbe_dev_link_status_print(struct rte_eth_dev *dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_eth_link link;
rte_eth_linkstatus_get(dev, &link);
@@ -2472,7 +2472,7 @@ static s32
ngbe_fc_hpbthresh_set(struct rte_eth_dev *dev)
{
struct ngbe_hw *hw = ngbe_dev_hw(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
u32 max_frame_size, tc, dv_id, rx_pb;
s32 kb, marker;
@@ -2653,7 +2653,7 @@ ngbe_remove_rar(struct rte_eth_dev *dev, uint32_t index)
static int
ngbe_set_default_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
ngbe_remove_rar(dev, 0);
ngbe_add_rar(dev, addr, 0, pci_dev->max_vfs);
@@ -2797,7 +2797,7 @@ ngbe_uc_all_hash_table_set(struct rte_eth_dev *dev, uint8_t on)
static int
ngbe_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct ngbe_hw *hw = ngbe_dev_hw(dev);
uint32_t mask;
@@ -2867,7 +2867,7 @@ ngbe_set_ivar_map(struct ngbe_hw *hw, int8_t direction,
static void
ngbe_configure_msix(struct rte_eth_dev *dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct ngbe_hw *hw = ngbe_dev_hw(dev);
uint32_t queue_id, base = NGBE_MISC_VEC_ID;
diff --git a/drivers/net/ngbe/ngbe_ethdev_vf.c b/drivers/net/ngbe/ngbe_ethdev_vf.c
index 6406df40d0..ea3a988df6 100644
--- a/drivers/net/ngbe/ngbe_ethdev_vf.c
+++ b/drivers/net/ngbe/ngbe_ethdev_vf.c
@@ -152,7 +152,7 @@ eth_ngbevf_dev_init(struct rte_eth_dev *eth_dev)
{
int err;
uint32_t tc, tcs;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct ngbe_hw *hw = ngbe_dev_hw(eth_dev);
struct ngbe_vfta *shadow_vfta = NGBE_DEV_VFTA(eth_dev);
@@ -465,7 +465,7 @@ static int
ngbevf_dev_info_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct ngbe_hw *hw = ngbe_dev_hw(dev);
dev_info->max_rx_queues = (uint16_t)hw->mac.max_rx_queues;
@@ -588,7 +588,7 @@ ngbevf_dev_start(struct rte_eth_dev *dev)
{
struct ngbe_hw *hw = ngbe_dev_hw(dev);
uint32_t intr_vector = 0;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
int err, mask = 0;
@@ -688,7 +688,7 @@ ngbevf_dev_stop(struct rte_eth_dev *dev)
{
struct ngbe_hw *hw = ngbe_dev_hw(dev);
struct ngbe_adapter *adapter = ngbe_dev_adapter(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
if (hw->adapter_stopped)
@@ -725,7 +725,7 @@ static int
ngbevf_dev_close(struct rte_eth_dev *dev)
{
struct ngbe_hw *hw = ngbe_dev_hw(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
int ret;
@@ -898,7 +898,7 @@ ngbevf_vlan_offload_set(struct rte_eth_dev *dev, int mask)
static int
ngbevf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct ngbe_interrupt *intr = ngbe_dev_intr(dev);
struct ngbe_hw *hw = ngbe_dev_hw(dev);
@@ -920,7 +920,7 @@ ngbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
{
struct ngbe_interrupt *intr = ngbe_dev_intr(dev);
struct ngbe_hw *hw = ngbe_dev_hw(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
uint32_t vec = NGBE_MISC_VEC_ID;
@@ -960,7 +960,7 @@ ngbevf_set_ivar_map(struct ngbe_hw *hw, int8_t direction,
static void
ngbevf_configure_msix(struct rte_eth_dev *dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct ngbe_hw *hw = ngbe_dev_hw(dev);
uint32_t q_idx;
diff --git a/drivers/net/ngbe/ngbe_pf.c b/drivers/net/ngbe/ngbe_pf.c
index bb62e2fbb7..db2384e28c 100644
--- a/drivers/net/ngbe/ngbe_pf.c
+++ b/drivers/net/ngbe/ngbe_pf.c
@@ -18,7 +18,7 @@
static inline uint16_t
dev_num_vf(struct rte_eth_dev *eth_dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
/* EM only support 7 VFs. */
return pci_dev->max_vfs;
diff --git a/drivers/net/octeon_ep/otx_ep_ethdev.c b/drivers/net/octeon_ep/otx_ep_ethdev.c
index 99be30523a..876d2f9d7d 100644
--- a/drivers/net/octeon_ep/otx_ep_ethdev.c
+++ b/drivers/net/octeon_ep/otx_ep_ethdev.c
@@ -777,7 +777,7 @@ static int otx_ep_eth_dev_query_set_vf_mac(struct rte_eth_dev *eth_dev,
static int
otx_ep_eth_dev_init(struct rte_eth_dev *eth_dev)
{
- struct rte_pci_device *pdev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pdev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pdev);
struct otx_ep_device *otx_epvf = OTX_EP_DEV(eth_dev);
struct rte_ether_addr vf_mac_addr;
int ret = 0;
diff --git a/drivers/net/octeon_ep/otx_ep_mbox.c b/drivers/net/octeon_ep/otx_ep_mbox.c
index 3e94c66677..5e6be29a96 100644
--- a/drivers/net/octeon_ep/otx_ep_mbox.c
+++ b/drivers/net/octeon_ep/otx_ep_mbox.c
@@ -346,7 +346,7 @@ otx_ep_mbox_intr_handler(void *param)
{
struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)param;
struct otx_ep_device *otx_ep = (struct otx_ep_device *)eth_dev->data->dev_private;
- struct rte_pci_device *pdev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pdev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pdev);
union otx_ep_mbox_word mbox_cmd;
if (otx2_read64(otx_ep->hw_addr + CNXK_EP_R_MBOX_PF_VF_INT(0)) & CNXK_EP_MBOX_INTR) {
@@ -369,7 +369,7 @@ int
otx_ep_mbox_init(struct rte_eth_dev *eth_dev)
{
struct otx_ep_device *otx_ep = (struct otx_ep_device *)eth_dev->data->dev_private;
- struct rte_pci_device *pdev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pdev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pdev);
uint64_t reg_val;
int rc;
@@ -402,7 +402,7 @@ void
otx_ep_mbox_uninit(struct rte_eth_dev *eth_dev)
{
struct otx_ep_device *otx_ep = (struct otx_ep_device *)eth_dev->data->dev_private;
- struct rte_pci_device *pdev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pdev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pdev);
otx2_write64(0, otx_ep->hw_addr + CNXK_EP_R_MBOX_PF_VF_INT(0));
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index c676c6fa75..4efc2dd349 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1231,7 +1231,7 @@ static int qede_args_check(const char *key, const char *val, void *opaque)
static int qede_args(struct rte_eth_dev *eth_dev)
{
- struct rte_pci_device *pci_dev = RTE_BUS_DEVICE(eth_dev->device, *pci_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct rte_kvargs *kvlist;
struct rte_devargs *devargs;
int ret;
@@ -1540,7 +1540,7 @@ static void qede_poll_sp_sb_cb(void *param)
static int qede_dev_close(struct rte_eth_dev *eth_dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev);
struct ecore_dev *edev = QEDE_INIT_EDEV(qdev);
int ret = 0;
@@ -2529,7 +2529,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf)
adapter = eth_dev->data->dev_private;
adapter->ethdev = eth_dev;
edev = &adapter->edev;
- pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
pci_addr = pci_dev->addr;
PMD_INIT_FUNC_TRACE(edev);
diff --git a/drivers/net/r8169/r8169_ethdev.c b/drivers/net/r8169/r8169_ethdev.c
index b2b1882aa5..2ac0189b61 100644
--- a/drivers/net/r8169/r8169_ethdev.c
+++ b/drivers/net/r8169/r8169_ethdev.c
@@ -301,7 +301,7 @@ rtl_dev_start(struct rte_eth_dev *dev)
{
struct rtl_adapter *adapter = RTL_DEV_PRIVATE(dev);
struct rtl_hw *hw = &adapter->hw;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
int err;
@@ -684,7 +684,7 @@ rtl_dev_interrupt_handler(void *param)
static int
rtl_dev_close(struct rte_eth_dev *dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct rtl_adapter *adapter = RTL_DEV_PRIVATE(dev);
struct rtl_hw *hw = &adapter->hw;
@@ -908,7 +908,7 @@ rtl_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf
static int
rtl_dev_init(struct rte_eth_dev *dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct rtl_adapter *adapter = RTL_DEV_PRIVATE(dev);
struct rtl_hw *hw = &adapter->hw;
diff --git a/drivers/net/rnp/rnp_ethdev.c b/drivers/net/rnp/rnp_ethdev.c
index 3420842823..e48ad0e317 100644
--- a/drivers/net/rnp/rnp_ethdev.c
+++ b/drivers/net/rnp/rnp_ethdev.c
@@ -728,7 +728,7 @@ static int rnp_dev_close(struct rte_eth_dev *eth_dev)
if (adapter->intr_registered && adapter->eth_dev == eth_dev)
rnp_change_manage_port(adapter);
if (adapter->closed_ports == adapter->inited_ports) {
- struct rte_pci_device *pci_dev = RTE_BUS_DEVICE(eth_dev->device, *pci_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
if (adapter->intr_registered) {
/* disable uio irq before callback unregister */
rte_intr_disable(pci_dev->intr_handle);
@@ -1667,7 +1667,7 @@ rnp_rx_reset_pool_setup(struct rnp_eth_adapter *adapter)
static int
rnp_eth_dev_init(struct rte_eth_dev *eth_dev)
{
- struct rte_pci_device *pci_dev = RTE_BUS_DEVICE(eth_dev->device, *pci_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct rnp_eth_port *port = RNP_DEV_TO_PORT(eth_dev);
char name[RTE_ETH_NAME_MAX_LEN] = " ";
@@ -1798,7 +1798,7 @@ rnp_eth_dev_init(struct rte_eth_dev *eth_dev)
static int
rnp_eth_dev_uninit(struct rte_eth_dev *eth_dev)
{
- struct rte_pci_device *pci_dev = RTE_BUS_DEVICE(eth_dev->device, *pci_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
uint16_t port_id;
int err = 0;
diff --git a/drivers/net/sfc/sfc.c b/drivers/net/sfc/sfc.c
index 69747e49ae..39cd8d519a 100644
--- a/drivers/net/sfc/sfc.c
+++ b/drivers/net/sfc/sfc.c
@@ -781,7 +781,7 @@ static int
sfc_mem_bar_init(struct sfc_adapter *sa, const efx_bar_region_t *mem_ebrp)
{
struct rte_eth_dev *eth_dev = sa->eth_dev;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
efsys_bar_t *ebp = &sa->mem_bar;
struct rte_mem_resource *res =
&pci_dev->mem_resource[mem_ebrp->ebr_index];
@@ -1283,7 +1283,7 @@ sfc_probe(struct sfc_adapter *sa)
{
efx_bar_region_t mem_ebrp;
struct rte_eth_dev *eth_dev = sa->eth_dev;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
efx_nic_t *enp;
int rc;
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 6be98c49d0..6be91789cf 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -3309,7 +3309,7 @@ static int
sfc_eth_dev_init(struct rte_eth_dev *dev, void *init_params)
{
struct sfc_adapter_shared *sas = sfc_adapter_shared_by_eth_dev(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct sfc_ethdev_init_data *init_data = init_params;
uint32_t logtype_main;
struct sfc_adapter *sa;
diff --git a/drivers/net/sfc/sfc_intr.c b/drivers/net/sfc/sfc_intr.c
index ddddefad7b..6a09da9f67 100644
--- a/drivers/net/sfc/sfc_intr.c
+++ b/drivers/net/sfc/sfc_intr.c
@@ -56,7 +56,7 @@ sfc_intr_line_handler(void *cb_arg)
boolean_t fatal;
uint32_t qmask;
unsigned int lsc_seq = sa->port.lsc_seq;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(sa->eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(sa->eth_dev, *pci_dev);
sfc_log_init(sa, "entry");
@@ -102,7 +102,7 @@ sfc_intr_message_handler(void *cb_arg)
efx_nic_t *enp = sa->nic;
boolean_t fatal;
unsigned int lsc_seq = sa->port.lsc_seq;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(sa->eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(sa->eth_dev, *pci_dev);
sfc_log_init(sa, "entry");
@@ -158,7 +158,7 @@ sfc_intr_start(struct sfc_adapter *sa)
if (rc != 0)
goto fail_intr_init;
- pci_dev = RTE_ETH_DEV_TO_PCI(sa->eth_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(sa->eth_dev, *pci_dev);
intr_handle = pci_dev->intr_handle;
if (intr->handler != NULL) {
@@ -240,7 +240,7 @@ void
sfc_intr_stop(struct sfc_adapter *sa)
{
struct sfc_intr *intr = &sa->intr;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(sa->eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(sa->eth_dev, *pci_dev);
sfc_log_init(sa, "entry");
@@ -318,7 +318,7 @@ int
sfc_intr_attach(struct sfc_adapter *sa)
{
struct sfc_intr *intr = &sa->intr;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(sa->eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(sa->eth_dev, *pci_dev);
sfc_log_init(sa, "entry");
diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c
index a193229265..305c680944 100644
--- a/drivers/net/sfc/sfc_rx.c
+++ b/drivers/net/sfc/sfc_rx.c
@@ -1277,8 +1277,9 @@ sfc_rx_qinit(struct sfc_adapter *sa, sfc_sw_index_t sw_index,
info.nic_dma_info = &sas->nic_dma_info;
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(sa->eth_dev, *pci_dev);
rc = sa->priv.dp_rx->qcreate(sa->eth_dev->data->port_id, sw_index,
- &RTE_ETH_DEV_TO_PCI(sa->eth_dev)->addr,
+ &pci_dev->addr,
socket_id, &info, &rxq_info->dp);
if (rc != 0)
goto fail_dp_rx_qcreate;
diff --git a/drivers/net/sfc/sfc_sriov.c b/drivers/net/sfc/sfc_sriov.c
index 009b884d8d..f41d1b1719 100644
--- a/drivers/net/sfc/sfc_sriov.c
+++ b/drivers/net/sfc/sfc_sriov.c
@@ -44,7 +44,7 @@ sriov_mac_addr_assigned(const efx_vport_config_t *vport_config,
int
sfc_sriov_attach(struct sfc_adapter *sa)
{
- const struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(sa->eth_dev);
+ const struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(sa->eth_dev, *pci_dev);
struct sfc_sriov *sriov = &sa->sriov;
efx_vport_config_t *vport_config;
unsigned int i;
diff --git a/drivers/net/sfc/sfc_tx.c b/drivers/net/sfc/sfc_tx.c
index ebc0a8235b..fac56cb27c 100644
--- a/drivers/net/sfc/sfc_tx.c
+++ b/drivers/net/sfc/sfc_tx.c
@@ -230,8 +230,9 @@ sfc_tx_qinit(struct sfc_adapter *sa, sfc_sw_index_t sw_index,
info.max_pdu = encp->enc_mac_pdu_max;
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(sa->eth_dev, *pci_dev);
rc = sa->priv.dp_tx->qcreate(sa->eth_dev->data->port_id, sw_index,
- &RTE_ETH_DEV_TO_PCI(sa->eth_dev)->addr,
+ &pci_dev->addr,
socket_id, &info, &txq_info->dp);
if (rc != 0)
goto fail_dp_tx_qinit;
diff --git a/drivers/net/sxe2/sxe2_ethdev.c b/drivers/net/sxe2/sxe2_ethdev.c
index 6b82209f62..b6cc8703a7 100644
--- a/drivers/net/sxe2/sxe2_ethdev.c
+++ b/drivers/net/sxe2/sxe2_ethdev.c
@@ -561,7 +561,7 @@ static int32_t sxe2_dev_info_init(struct rte_eth_dev *dev)
{
struct sxe2_adapter *adapter =
SXE2_DEV_PRIVATE_TO_ADAPTER(dev);
- struct rte_pci_device *pci_dev = RTE_BUS_DEVICE(dev->device, *pci_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct sxe2_dev_info *dev_info = &adapter->dev_info;
struct sxe2_drv_dev_info_resp dev_info_resp = {0};
struct sxe2_drv_dev_fw_info_resp dev_fw_info_resp = {0};
@@ -600,7 +600,7 @@ static int32_t sxe2_dev_info_init(struct rte_eth_dev *dev)
int32_t sxe2_dev_pci_map_init(struct rte_eth_dev *dev)
{
struct sxe2_adapter *adapter = SXE2_DEV_PRIVATE_TO_ADAPTER(dev);
- struct rte_pci_device *pci_dev = RTE_BUS_DEVICE(dev->device, *pci_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct sxe2_pci_map_context *map_ctxt = &adapter->map_ctxt;
struct sxe2_pci_map_bar_info *bar_info = NULL;
struct sxe2_pci_map_segment_info *seg_info = NULL;
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 76ed76a045..6e34da7c3c 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -1471,7 +1471,7 @@ static int
nicvf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
{
struct nicvf *nic = nicvf_pmd_priv(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
PMD_INIT_FUNC_TRACE();
@@ -2234,7 +2234,7 @@ nicvf_eth_dev_init(struct rte_eth_dev *eth_dev)
}
}
- pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
rte_eth_copy_pci_info(eth_dev, pci_dev);
eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c
index 5d360f8305..0f484dfe91 100644
--- a/drivers/net/txgbe/txgbe_ethdev.c
+++ b/drivers/net/txgbe/txgbe_ethdev.c
@@ -525,7 +525,7 @@ static void
txgbe_parse_devargs(struct rte_eth_dev *dev)
{
struct rte_eth_fdir_conf *fdir_conf = TXGBE_DEV_FDIR_CONF(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_devargs *devargs = pci_dev->device.devargs;
struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
struct rte_kvargs *kvlist;
@@ -601,7 +601,7 @@ static int
eth_txgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)
{
struct txgbe_adapter *ad = eth_dev->data->dev_private;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct txgbe_hw *hw = TXGBE_DEV_HW(eth_dev);
struct txgbe_vfta *shadow_vfta = TXGBE_DEV_VFTA(eth_dev);
struct txgbe_hwstrip *hwstrip = TXGBE_DEV_HWSTRIP(eth_dev);
@@ -1397,7 +1397,7 @@ txgbe_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
static int
txgbe_check_vf_rss_rxq_num(struct rte_eth_dev *dev, uint16_t nb_rx_q)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
switch (nb_rx_q) {
case 1:
@@ -1664,7 +1664,7 @@ txgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uint16_t vf,
struct rte_pci_device *pci_dev;
int ret;
- pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
ret = rte_eth_link_get_nowait(dev->data->port_id, &link);
if (ret < 0)
return ret;
@@ -1736,7 +1736,7 @@ txgbe_dev_start(struct rte_eth_dev *dev)
struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
struct txgbe_hw_stats *hw_stats = TXGBE_DEV_STATS(dev);
struct txgbe_vf_info *vfinfo = *TXGBE_DEV_VFDATA(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
uint32_t intr_vector = 0;
int err;
@@ -2034,7 +2034,7 @@ txgbe_dev_stop(struct rte_eth_dev *dev)
struct txgbe_adapter *adapter = TXGBE_DEV_ADAPTER(dev);
struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
struct txgbe_vf_info *vfinfo = *TXGBE_DEV_VFDATA(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
int vf;
struct txgbe_tm_conf *tm_conf = TXGBE_DEV_TM_CONF(dev);
@@ -2163,7 +2163,7 @@ static int
txgbe_dev_close(struct rte_eth_dev *dev)
{
struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
int retries = 0;
int ret;
@@ -2822,7 +2822,7 @@ txgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
static int
txgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
dev_info->max_rx_queues = (uint16_t)hw->mac.max_rx_queues;
@@ -3500,7 +3500,7 @@ txgbe_dev_interrupt_get_status(struct rte_eth_dev *dev,
static void
txgbe_dev_link_status_print(struct rte_eth_dev *dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_eth_link link;
rte_eth_linkstatus_get(dev, &link);
@@ -3631,7 +3631,7 @@ static void
txgbe_dev_interrupt_delayed_handler(void *param)
{
struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct txgbe_interrupt *intr = TXGBE_DEV_INTR(dev);
struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
@@ -3978,7 +3978,7 @@ txgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index)
static int
txgbe_set_default_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
txgbe_remove_rar(dev, 0);
txgbe_add_rar(dev, addr, 0, pci_dev->max_vfs);
@@ -4149,7 +4149,7 @@ txgbe_convert_vm_rx_mask_to_val(uint16_t rx_mask, uint32_t orig_val)
static int
txgbe_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
uint32_t mask;
struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
@@ -4231,7 +4231,7 @@ txgbe_set_ivar_map(struct txgbe_hw *hw, int8_t direction,
static void
txgbe_configure_msix(struct rte_eth_dev *dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
uint32_t queue_id, base = TXGBE_MISC_VEC_ID;
diff --git a/drivers/net/txgbe/txgbe_ethdev_vf.c b/drivers/net/txgbe/txgbe_ethdev_vf.c
index 39a5fff65c..7a50c7a855 100644
--- a/drivers/net/txgbe/txgbe_ethdev_vf.c
+++ b/drivers/net/txgbe/txgbe_ethdev_vf.c
@@ -232,7 +232,7 @@ eth_txgbevf_dev_init(struct rte_eth_dev *eth_dev)
int err;
uint32_t tc, tcs;
struct txgbe_adapter *ad = eth_dev->data->dev_private;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct txgbe_hw *hw = TXGBE_DEV_HW(eth_dev);
struct txgbe_vfta *shadow_vfta = TXGBE_DEV_VFTA(eth_dev);
@@ -561,7 +561,7 @@ static int
txgbevf_dev_info_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
dev_info->max_rx_queues = (uint16_t)hw->mac.max_rx_queues;
@@ -696,7 +696,7 @@ txgbevf_dev_start(struct rte_eth_dev *dev)
{
struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
uint32_t intr_vector = 0;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
int err, mask = 0;
@@ -801,7 +801,7 @@ txgbevf_dev_stop(struct rte_eth_dev *dev)
{
struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
struct txgbe_adapter *adapter = TXGBE_DEV_ADAPTER(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
if (hw->adapter_stopped)
@@ -841,7 +841,7 @@ static int
txgbevf_dev_close(struct rte_eth_dev *dev)
{
struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
int ret;
@@ -1023,7 +1023,7 @@ txgbevf_vlan_offload_set(struct rte_eth_dev *dev, int mask)
static int
txgbevf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct txgbe_interrupt *intr = TXGBE_DEV_INTR(dev);
struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
@@ -1045,7 +1045,7 @@ txgbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
{
struct txgbe_interrupt *intr = TXGBE_DEV_INTR(dev);
struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
uint32_t vec = TXGBE_MISC_VEC_ID;
@@ -1085,7 +1085,7 @@ txgbevf_set_ivar_map(struct txgbe_hw *hw, int8_t direction,
static void
txgbevf_configure_msix(struct rte_eth_dev *dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
uint32_t q_idx;
diff --git a/drivers/net/txgbe/txgbe_flow.c b/drivers/net/txgbe/txgbe_flow.c
index a97588e57a..1bb0d3978c 100644
--- a/drivers/net/txgbe/txgbe_flow.c
+++ b/drivers/net/txgbe/txgbe_flow.c
@@ -1171,7 +1171,7 @@ cons_parse_l2_tn_filter(struct rte_eth_dev *dev,
const struct rte_flow_item_e_tag *e_tag_mask;
const struct rte_flow_action *act;
const struct rte_flow_action_vf *act_vf;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
if (!pattern) {
rte_flow_error_set(error, EINVAL,
@@ -1328,7 +1328,7 @@ txgbe_parse_l2_tn_filter(struct rte_eth_dev *dev,
struct rte_flow_error *error)
{
int ret = 0;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
uint16_t vf_num;
if (!txgbe_is_pf(TXGBE_DEV_HW(dev))) {
diff --git a/drivers/net/txgbe/txgbe_pf.c b/drivers/net/txgbe/txgbe_pf.c
index 700632bd88..91f73521fe 100644
--- a/drivers/net/txgbe/txgbe_pf.c
+++ b/drivers/net/txgbe/txgbe_pf.c
@@ -33,7 +33,7 @@
static inline uint16_t
dev_num_vf(struct rte_eth_dev *eth_dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
return pci_dev->max_vfs;
}
diff --git a/drivers/net/txgbe/txgbe_tm.c b/drivers/net/txgbe/txgbe_tm.c
index b62bcf54aa..29c7c4adfb 100644
--- a/drivers/net/txgbe/txgbe_tm.c
+++ b/drivers/net/txgbe/txgbe_tm.c
@@ -354,7 +354,7 @@ txgbe_queue_base_nb_get(struct rte_eth_dev *dev, uint16_t tc_node_no,
uint16_t *base, uint16_t *nb)
{
uint8_t nb_tcs = txgbe_tc_nb_get(dev);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
uint16_t vf_num = pci_dev->max_vfs;
*base = 0;
diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c
index fcda002297..d4f4bb0920 100644
--- a/drivers/net/virtio/virtio_pci_ethdev.c
+++ b/drivers/net/virtio/virtio_pci_ethdev.c
@@ -73,13 +73,13 @@ eth_virtio_pci_init(struct rte_eth_dev *eth_dev)
{
struct virtio_pci_dev *dev = eth_dev->data->dev_private;
struct virtio_hw *hw = &dev->hw;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
int ret;
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
hw->port_id = eth_dev->data->port_id;
VTPCI_DEV(hw) = pci_dev;
- ret = vtpci_init(RTE_ETH_DEV_TO_PCI(eth_dev), dev);
+ ret = vtpci_init(pci_dev, dev);
if (ret) {
PMD_INIT_LOG(ERR, "Failed to init PCI device");
return -1;
@@ -91,7 +91,7 @@ eth_virtio_pci_init(struct rte_eth_dev *eth_dev)
else
VIRTIO_OPS(hw) = &virtio_legacy_ops;
- ret = virtio_remap_pci(RTE_ETH_DEV_TO_PCI(eth_dev), dev);
+ ret = virtio_remap_pci(pci_dev, dev);
if (ret < 0) {
PMD_INIT_LOG(ERR, "Failed to remap PCI device");
return -1;
@@ -111,7 +111,7 @@ eth_virtio_pci_init(struct rte_eth_dev *eth_dev)
return 0;
err_unmap:
- rte_pci_unmap_device(RTE_ETH_DEV_TO_PCI(eth_dev));
+ rte_pci_unmap_device(pci_dev);
if (!dev->modern)
vtpci_legacy_ioport_unmap(hw);
@@ -127,11 +127,12 @@ eth_virtio_pci_uninit(struct rte_eth_dev *eth_dev)
PMD_INIT_FUNC_TRACE();
if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
dev = eth_dev->data->dev_private;
hw = &dev->hw;
if (dev->modern)
- rte_pci_unmap_device(RTE_ETH_DEV_TO_PCI(eth_dev));
+ rte_pci_unmap_device(pci_dev);
else
vtpci_legacy_ioport_unmap(hw);
return 0;
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index da9af08207..b7cf217724 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -308,7 +308,7 @@ eth_vmxnet3_setup_capabilities(struct vmxnet3_hw *hw,
struct rte_eth_dev *eth_dev)
{
uint32_t dcr, ptcr, value;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD,
VMXNET3_CMD_GET_MAX_CAPABILITIES);
@@ -381,7 +381,7 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
eth_dev->tx_pkt_burst = &vmxnet3_xmit_pkts;
eth_dev->tx_pkt_prepare = vmxnet3_prep_pkts;
eth_dev->rx_queue_count = vmxnet3_dev_rx_queue_count;
- pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
/* extra mbuf field is required to guess MSS */
vmxnet3_segs_dynfield_offset =
diff --git a/drivers/net/xsc/xsc_ethdev.c b/drivers/net/xsc/xsc_ethdev.c
index 07fc52ac7b..39a67ff8cd 100644
--- a/drivers/net/xsc/xsc_ethdev.c
+++ b/drivers/net/xsc/xsc_ethdev.c
@@ -1048,7 +1048,7 @@ xsc_ethdev_init(struct rte_eth_dev *eth_dev)
PMD_INIT_FUNC_TRACE();
priv->eth_dev = eth_dev;
- priv->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ priv->pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *priv->pci_dev);
ret = xsc_dev_init(priv->pci_dev, &priv->xdev);
if (ret) {
diff --git a/drivers/net/zxdh/zxdh_ethdev.c b/drivers/net/zxdh/zxdh_ethdev.c
index aeb01f4652..80ff19b3ea 100644
--- a/drivers/net/zxdh/zxdh_ethdev.c
+++ b/drivers/net/zxdh/zxdh_ethdev.c
@@ -111,7 +111,7 @@ zxdh_intr_unmask(struct rte_eth_dev *dev)
if (rte_intr_ack(dev->intr_handle) < 0)
return -1;
- hw->use_msix = zxdh_pci_msix_detect(RTE_ETH_DEV_TO_PCI(dev));
+ hw->use_msix = zxdh_pci_msix_detect(RTE_CLASS_TO_BUS_DEVICE(dev, struct rte_pci_device));
return 0;
}
@@ -1586,7 +1586,7 @@ static int32_t
zxdh_init_device(struct rte_eth_dev *eth_dev)
{
struct zxdh_hw *hw = eth_dev->data->dev_private;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
int ret = 0;
ret = zxdh_read_pci_caps(pci_dev, hw);
@@ -1820,7 +1820,7 @@ zxdh_get_dev_shared_data_idx(uint32_t dev_serial_id)
static int zxdh_init_dev_share_data(struct rte_eth_dev *eth_dev)
{
struct zxdh_hw *hw = eth_dev->data->dev_private;
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
uint32_t serial_id = (pci_dev->addr.domain << 16) |
(pci_dev->addr.bus << 8) | pci_dev->addr.devid;
uint16_t slot_id = 0;
@@ -2201,7 +2201,7 @@ is_inic_pf(uint16_t device_id)
static int
zxdh_eth_dev_init(struct rte_eth_dev *eth_dev)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev);
struct zxdh_hw *hw = eth_dev->data->dev_private;
int ret = 0;
diff --git a/drivers/raw/ifpga/afu_pmd_n3000.c b/drivers/raw/ifpga/afu_pmd_n3000.c
index f092ee2dec..d5520a0d71 100644
--- a/drivers/raw/ifpga/afu_pmd_n3000.c
+++ b/drivers/raw/ifpga/afu_pmd_n3000.c
@@ -1467,11 +1467,11 @@ static struct rte_pci_device *n3000_afu_get_pci_dev(struct afu_rawdev *dev)
if (!dev || !dev->rawdev || !dev->rawdev->device)
return NULL;
- afudev = RTE_BUS_DEVICE(dev->rawdev->device, *afudev);
+ afudev = RTE_CLASS_TO_BUS_DEVICE(dev->rawdev, *afudev);
if (!afudev->rawdev || !afudev->rawdev->device)
return NULL;
- return RTE_BUS_DEVICE(afudev->rawdev->device, struct rte_pci_device);
+ return RTE_CLASS_TO_BUS_DEVICE(afudev->rawdev, struct rte_pci_device);
}
static int dma_afu_set_irqs(struct afu_rawdev *dev, uint32_t vec_start,
diff --git a/lib/eal/include/bus_driver.h b/lib/eal/include/bus_driver.h
index 3d04efbd3f..0a7e23d98d 100644
--- a/lib/eal/include/bus_driver.h
+++ b/lib/eal/include/bus_driver.h
@@ -461,6 +461,24 @@ void rte_bus_unregister(struct rte_bus *bus);
#define RTE_BUS_DRIVER(drv, bus_drv_type) \
container_of(drv, typeof(bus_drv_type), driver)
+/**
+ * Helper macro to convert a device class pointer to a bus-specific device type.
+ * Works with any device class (ethdev, cryptodev, eventdev, bbdev, etc.) that has
+ * a 'device' field pointing to struct rte_device.
+ *
+ * Example: RTE_CLASS_TO_BUS_DEVICE(eth_dev, *pci_dev) or
+ * RTE_CLASS_TO_BUS_DEVICE(eth_dev, struct rte_pci_device)
+ *
+ * @param class_dev
+ * Pointer to device class structure (e.g., struct rte_eth_dev *)
+ * @param bus_dev_type
+ * Bus device type for type inference (e.g., *pci_dev or struct rte_pci_device)
+ * @return
+ * Pointer to the bus-specific device structure
+ */
+#define RTE_CLASS_TO_BUS_DEVICE(class_dev, bus_dev_type) \
+ RTE_BUS_DEVICE((class_dev)->device, bus_dev_type)
+
/**
* Helper macro to iterate over all devices on a bus.
*
--
2.53.0
^ permalink raw reply related
* [PATCH v4 24/25] eventdev: rename dev field to device
From: David Marchand @ 2026-05-27 7:56 UTC (permalink / raw)
To: dev
Cc: thomas, stephen, bruce.richardson, Pavan Nikhilesh,
Shijith Thotton, Tirthendu Sarkar, Jerin Jacob
In-Reply-To: <20260527075654.3780732-1-david.marchand@redhat.com>
Rename the rte_eventdev structure field from 'dev' to 'device' to align
with the naming convention used by all other device classes in DPDK
(ethdev, cryptodev, bbdev, compressdev, rawdev, regexdev, dmadev, gpudev,
and mldev).
This change provides consistency across all device classes: each device
class structure now contains a 'struct rte_device *device' field
pointing to the backing device.
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/event/cnxk/cn10k_eventdev.c | 8 ++++----
drivers/event/cnxk/cn20k_eventdev.c | 8 ++++----
drivers/event/cnxk/cn9k_eventdev.c | 6 +++---
drivers/event/cnxk/cnxk_eventdev.c | 2 +-
drivers/event/dlb2/pf/dlb2_pf.c | 2 +-
drivers/event/skeleton/skeleton_eventdev.c | 2 +-
lib/eventdev/eventdev_pmd.h | 2 +-
lib/eventdev/eventdev_pmd_pci.h | 4 ++--
lib/eventdev/eventdev_pmd_vdev.h | 2 +-
lib/eventdev/rte_eventdev.c | 14 +++++++-------
10 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/drivers/event/cnxk/cn10k_eventdev.c b/drivers/event/cnxk/cn10k_eventdev.c
index 2e4b8aab92..8289fc44d6 100644
--- a/drivers/event/cnxk/cn10k_eventdev.c
+++ b/drivers/event/cnxk/cn10k_eventdev.c
@@ -921,7 +921,7 @@ static int
cn10k_crypto_adapter_caps_get(const struct rte_eventdev *event_dev,
const struct rte_cryptodev *cdev, uint32_t *caps)
{
- CNXK_VALID_DEV_OR_ERR_RET(event_dev->dev, "event_cn10k", ENOTSUP);
+ CNXK_VALID_DEV_OR_ERR_RET(event_dev->device, "event_cn10k", ENOTSUP);
CNXK_VALID_DEV_OR_ERR_RET(cdev->device, "crypto_cn10k", ENOTSUP);
*caps = RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD |
@@ -939,7 +939,7 @@ cn10k_crypto_adapter_qp_add(const struct rte_eventdev *event_dev,
{
int ret;
- CNXK_VALID_DEV_OR_ERR_RET(event_dev->dev, "event_cn10k", EINVAL);
+ CNXK_VALID_DEV_OR_ERR_RET(event_dev->device, "event_cn10k", EINVAL);
CNXK_VALID_DEV_OR_ERR_RET(cdev->device, "crypto_cn10k", EINVAL);
cn10k_sso_fp_fns_set((struct rte_eventdev *)(uintptr_t)event_dev);
@@ -954,7 +954,7 @@ static int
cn10k_crypto_adapter_qp_del(const struct rte_eventdev *event_dev, const struct rte_cryptodev *cdev,
int32_t queue_pair_id)
{
- CNXK_VALID_DEV_OR_ERR_RET(event_dev->dev, "event_cn10k", EINVAL);
+ CNXK_VALID_DEV_OR_ERR_RET(event_dev->device, "event_cn10k", EINVAL);
CNXK_VALID_DEV_OR_ERR_RET(cdev->device, "crypto_cn10k", EINVAL);
return cnxk_crypto_adapter_qp_del(cdev, queue_pair_id);
@@ -973,7 +973,7 @@ cn10k_crypto_adapter_vec_limits(const struct rte_eventdev *event_dev,
const struct rte_cryptodev *cdev,
struct rte_event_crypto_adapter_vector_limits *limits)
{
- CNXK_VALID_DEV_OR_ERR_RET(event_dev->dev, "event_cn10k", EINVAL);
+ CNXK_VALID_DEV_OR_ERR_RET(event_dev->device, "event_cn10k", EINVAL);
CNXK_VALID_DEV_OR_ERR_RET(cdev->device, "crypto_cn10k", EINVAL);
limits->log2_sz = false;
diff --git a/drivers/event/cnxk/cn20k_eventdev.c b/drivers/event/cnxk/cn20k_eventdev.c
index ff3aaac16a..9d34168c32 100644
--- a/drivers/event/cnxk/cn20k_eventdev.c
+++ b/drivers/event/cnxk/cn20k_eventdev.c
@@ -1125,7 +1125,7 @@ static int
cn20k_crypto_adapter_caps_get(const struct rte_eventdev *event_dev,
const struct rte_cryptodev *cdev, uint32_t *caps)
{
- CNXK_VALID_DEV_OR_ERR_RET(event_dev->dev, "event_cn20k", ENOTSUP);
+ CNXK_VALID_DEV_OR_ERR_RET(event_dev->device, "event_cn20k", ENOTSUP);
CNXK_VALID_DEV_OR_ERR_RET(cdev->device, "crypto_cn20k", ENOTSUP);
*caps = RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD |
@@ -1142,7 +1142,7 @@ cn20k_crypto_adapter_qp_add(const struct rte_eventdev *event_dev, const struct r
{
int ret;
- CNXK_VALID_DEV_OR_ERR_RET(event_dev->dev, "event_cn20k", EINVAL);
+ CNXK_VALID_DEV_OR_ERR_RET(event_dev->device, "event_cn20k", EINVAL);
CNXK_VALID_DEV_OR_ERR_RET(cdev->device, "crypto_cn20k", EINVAL);
cn20k_sso_fp_fns_set((struct rte_eventdev *)(uintptr_t)event_dev);
@@ -1157,7 +1157,7 @@ static int
cn20k_crypto_adapter_qp_del(const struct rte_eventdev *event_dev, const struct rte_cryptodev *cdev,
int32_t queue_pair_id)
{
- CNXK_VALID_DEV_OR_ERR_RET(event_dev->dev, "event_cn20k", EINVAL);
+ CNXK_VALID_DEV_OR_ERR_RET(event_dev->device, "event_cn20k", EINVAL);
CNXK_VALID_DEV_OR_ERR_RET(cdev->device, "crypto_cn20k", EINVAL);
return cnxk_crypto_adapter_qp_del(cdev, queue_pair_id);
@@ -1175,7 +1175,7 @@ cn20k_crypto_adapter_vec_limits(const struct rte_eventdev *event_dev,
const struct rte_cryptodev *cdev,
struct rte_event_crypto_adapter_vector_limits *limits)
{
- CNXK_VALID_DEV_OR_ERR_RET(event_dev->dev, "event_cn20k", EINVAL);
+ CNXK_VALID_DEV_OR_ERR_RET(event_dev->device, "event_cn20k", EINVAL);
CNXK_VALID_DEV_OR_ERR_RET(cdev->device, "crypto_cn20k", EINVAL);
limits->log2_sz = false;
diff --git a/drivers/event/cnxk/cn9k_eventdev.c b/drivers/event/cnxk/cn9k_eventdev.c
index 5f24366770..313dcbb384 100644
--- a/drivers/event/cnxk/cn9k_eventdev.c
+++ b/drivers/event/cnxk/cn9k_eventdev.c
@@ -1038,7 +1038,7 @@ static int
cn9k_crypto_adapter_caps_get(const struct rte_eventdev *event_dev, const struct rte_cryptodev *cdev,
uint32_t *caps)
{
- CNXK_VALID_DEV_OR_ERR_RET(event_dev->dev, "event_cn9k", ENOTSUP);
+ CNXK_VALID_DEV_OR_ERR_RET(event_dev->device, "event_cn9k", ENOTSUP);
CNXK_VALID_DEV_OR_ERR_RET(cdev->device, "crypto_cn9k", ENOTSUP);
*caps = RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD |
@@ -1055,7 +1055,7 @@ cn9k_crypto_adapter_qp_add(const struct rte_eventdev *event_dev,
{
int ret;
- CNXK_VALID_DEV_OR_ERR_RET(event_dev->dev, "event_cn9k", EINVAL);
+ CNXK_VALID_DEV_OR_ERR_RET(event_dev->device, "event_cn9k", EINVAL);
CNXK_VALID_DEV_OR_ERR_RET(cdev->device, "crypto_cn9k", EINVAL);
cn9k_sso_fp_fns_set((struct rte_eventdev *)(uintptr_t)event_dev);
@@ -1070,7 +1070,7 @@ static int
cn9k_crypto_adapter_qp_del(const struct rte_eventdev *event_dev, const struct rte_cryptodev *cdev,
int32_t queue_pair_id)
{
- CNXK_VALID_DEV_OR_ERR_RET(event_dev->dev, "event_cn9k", EINVAL);
+ CNXK_VALID_DEV_OR_ERR_RET(event_dev->device, "event_cn9k", EINVAL);
CNXK_VALID_DEV_OR_ERR_RET(cdev->device, "crypto_cn9k", EINVAL);
return cnxk_crypto_adapter_qp_del(cdev, queue_pair_id);
diff --git a/drivers/event/cnxk/cnxk_eventdev.c b/drivers/event/cnxk/cnxk_eventdev.c
index 8eff2ba8e0..6f000ff49e 100644
--- a/drivers/event/cnxk/cnxk_eventdev.c
+++ b/drivers/event/cnxk/cnxk_eventdev.c
@@ -654,7 +654,7 @@ cnxk_sso_init(struct rte_eventdev *event_dev)
return -ENOMEM;
}
- pci_dev = RTE_BUS_DEVICE(event_dev->dev, *pci_dev);
+ pci_dev = RTE_BUS_DEVICE(event_dev->device, *pci_dev);
dev->sso.pci_dev = pci_dev;
*(uint64_t *)mz->addr = (uint64_t)dev;
diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
index a498ba8c41..82075bbf0b 100644
--- a/drivers/event/dlb2/pf/dlb2_pf.c
+++ b/drivers/event/dlb2/pf/dlb2_pf.c
@@ -784,7 +784,7 @@ dlb2_eventdev_pci_init(struct rte_eventdev *eventdev)
dlb2_pf_iface_fn_ptrs_init();
- pci_dev = RTE_BUS_DEVICE(eventdev->dev, *pci_dev);
+ pci_dev = RTE_BUS_DEVICE(eventdev->device, *pci_dev);
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
dlb2 = dlb2_pmd_priv(eventdev); /* rte_zmalloc_socket mem */
diff --git a/drivers/event/skeleton/skeleton_eventdev.c b/drivers/event/skeleton/skeleton_eventdev.c
index e07744d2f1..4292644fde 100644
--- a/drivers/event/skeleton/skeleton_eventdev.c
+++ b/drivers/event/skeleton/skeleton_eventdev.c
@@ -332,7 +332,7 @@ skeleton_eventdev_init(struct rte_eventdev *eventdev)
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
- pci_dev = RTE_BUS_DEVICE(eventdev->dev, *pci_dev);
+ pci_dev = RTE_BUS_DEVICE(eventdev->device, *pci_dev);
skel->reg_base = (uintptr_t)pci_dev->mem_resource[0].addr;
if (!skel->reg_base) {
diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
index d13cc433a7..9309dce5e1 100644
--- a/lib/eventdev/eventdev_pmd.h
+++ b/lib/eventdev/eventdev_pmd.h
@@ -156,7 +156,7 @@ struct __rte_cache_aligned rte_eventdev {
/**< Pointer to device data */
struct eventdev_ops *dev_ops;
/**< Functions exported by PMD */
- struct rte_device *dev;
+ struct rte_device *device;
/**< Device info. supplied by probing */
uint8_t attached : 1;
diff --git a/lib/eventdev/eventdev_pmd_pci.h b/lib/eventdev/eventdev_pmd_pci.h
index 5cb5916a84..ebc7d12b1d 100644
--- a/lib/eventdev/eventdev_pmd_pci.h
+++ b/lib/eventdev/eventdev_pmd_pci.h
@@ -68,7 +68,7 @@ rte_event_pmd_pci_probe_named(struct rte_pci_driver *pci_drv,
"device data");
}
- eventdev->dev = &pci_dev->device;
+ eventdev->device = &pci_dev->device;
/* Invoke PMD device initialization function */
retval = devinit(eventdev);
@@ -150,7 +150,7 @@ rte_event_pmd_pci_remove(struct rte_pci_device *pci_dev,
/* Free event device */
rte_event_pmd_release(eventdev);
- eventdev->dev = NULL;
+ eventdev->device = NULL;
return 0;
}
diff --git a/lib/eventdev/eventdev_pmd_vdev.h b/lib/eventdev/eventdev_pmd_vdev.h
index 4eaefa0b0b..ae1c950bed 100644
--- a/lib/eventdev/eventdev_pmd_vdev.h
+++ b/lib/eventdev/eventdev_pmd_vdev.h
@@ -67,7 +67,7 @@ rte_event_pmd_vdev_init(const char *name, size_t dev_private_size,
rte_panic("Cannot allocate memzone for private device"
" data");
}
- eventdev->dev = &vdev->device;
+ eventdev->device = &vdev->device;
return eventdev;
}
diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
index b921142d7b..572cd5bd7d 100644
--- a/lib/eventdev/rte_eventdev.c
+++ b/lib/eventdev/rte_eventdev.c
@@ -68,8 +68,8 @@ rte_event_dev_get_dev_id(const char *name)
for (i = 0; i < eventdev_globals.nb_devs; i++) {
cmp = (strncmp(rte_event_devices[i].data->name, name,
RTE_EVENTDEV_NAME_MAX_LEN) == 0) ||
- (rte_event_devices[i].dev ? (strncmp(
- rte_event_devices[i].dev->driver->name, name,
+ (rte_event_devices[i].device ? (strncmp(
+ rte_event_devices[i].device->driver->name, name,
RTE_EVENTDEV_NAME_MAX_LEN) == 0) : 0);
if (cmp && (rte_event_devices[i].attached ==
RTE_EVENTDEV_ATTACHED)) {
@@ -114,9 +114,9 @@ rte_event_dev_info_get(uint8_t dev_id, struct rte_event_dev_info *dev_info)
dev_info->dequeue_timeout_ns = dev->data->dev_conf.dequeue_timeout_ns;
- dev_info->dev = dev->dev;
- if (dev->dev != NULL && dev->dev->driver != NULL)
- dev_info->driver_name = dev->dev->driver->name;
+ dev_info->dev = dev->device;
+ if (dev->device != NULL && dev->device->driver != NULL)
+ dev_info->driver_name = dev->device->driver->name;
rte_eventdev_trace_info_get(dev_id, dev_info, dev_info->dev);
@@ -1812,8 +1812,8 @@ handle_dev_info(const char *cmd __rte_unused,
rte_tel_data_start_dict(d);
rte_tel_data_add_dict_int(d, "dev_id", dev_id);
- rte_tel_data_add_dict_string(d, "dev_name", dev->dev->name);
- rte_tel_data_add_dict_string(d, "dev_driver", dev->dev->driver->name);
+ rte_tel_data_add_dict_string(d, "dev_name", dev->device->name);
+ rte_tel_data_add_dict_string(d, "dev_driver", dev->device->driver->name);
rte_tel_data_add_dict_string(d, "state",
dev->data->dev_started ? "started" : "stopped");
rte_tel_data_add_dict_int(d, "socket_id", dev->data->socket_id);
--
2.53.0
^ permalink raw reply related
* [PATCH v4 23/25] drivers/bus: remove specific bus types
From: David Marchand @ 2026-05-27 7:56 UTC (permalink / raw)
To: dev
Cc: thomas, stephen, bruce.richardson, Parav Pandit, Xueming Li,
Nipun Gupta, Nikhil Agarwal, Hemant Agrawal, Sachin Saxena,
Chenbo Xia, Tomasz Duszynski, Chengwen Feng, Long Li, Wei Hu
In-Reply-To: <20260527075654.3780732-1-david.marchand@redhat.com>
All the buses can have a simple rte_bus object.
Mark as static whenever possible.
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/bus/auxiliary/auxiliary_common.c | 44 ++++++++-------
drivers/bus/auxiliary/linux/auxiliary.c | 10 ++--
drivers/bus/auxiliary/private.h | 9 +---
drivers/bus/cdx/bus_cdx_driver.h | 1 -
drivers/bus/cdx/cdx.c | 42 +++++++--------
drivers/bus/cdx/private.h | 7 ---
drivers/bus/dpaa/dpaa_bus.c | 58 +++++++++-----------
drivers/bus/fslmc/fslmc_bus.c | 62 +++++++++++-----------
drivers/bus/fslmc/fslmc_vfio.c | 30 +++++------
drivers/bus/fslmc/portal/dpaa2_hw_dprc.c | 2 +-
drivers/bus/fslmc/private.h | 9 +---
drivers/bus/pci/bsd/pci.c | 16 +++---
drivers/bus/pci/linux/pci.c | 13 +++--
drivers/bus/pci/pci_common.c | 60 ++++++++++-----------
drivers/bus/pci/pci_params.c | 2 +-
drivers/bus/pci/private.h | 9 +---
drivers/bus/pci/windows/pci.c | 13 +++--
drivers/bus/platform/bus_platform_driver.h | 1 -
drivers/bus/platform/platform.c | 52 +++++++++---------
drivers/bus/platform/private.h | 9 ----
drivers/bus/uacce/uacce.c | 49 +++++++----------
drivers/bus/vmbus/linux/vmbus_bus.c | 10 ++--
drivers/bus/vmbus/private.h | 9 +---
drivers/bus/vmbus/vmbus_common.c | 34 ++++++------
24 files changed, 236 insertions(+), 315 deletions(-)
diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index ff05716539..048aacf254 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -56,7 +56,7 @@ auxiliary_scan(void)
void
auxiliary_on_scan(struct rte_auxiliary_device *aux_dev)
{
- aux_dev->device.devargs = rte_bus_find_devargs(&auxiliary_bus.bus, aux_dev->name);
+ aux_dev->device.devargs = rte_bus_find_devargs(&auxiliary_bus, aux_dev->name);
}
static bool
@@ -156,7 +156,7 @@ auxiliary_parse(const char *name, void *addr)
if (strlen(name) == 0)
return 0;
- RTE_BUS_FOREACH_DRV(drv, &auxiliary_bus.bus) {
+ RTE_BUS_FOREACH_DRV(drv, &auxiliary_bus) {
if (drv->match(name))
break;
}
@@ -170,7 +170,7 @@ RTE_EXPORT_INTERNAL_SYMBOL(rte_auxiliary_register)
void
rte_auxiliary_register(struct rte_auxiliary_driver *driver)
{
- rte_bus_add_driver(&auxiliary_bus.bus, &driver->driver);
+ rte_bus_add_driver(&auxiliary_bus, &driver->driver);
}
/* Unregister a driver */
@@ -178,7 +178,7 @@ RTE_EXPORT_INTERNAL_SYMBOL(rte_auxiliary_unregister)
void
rte_auxiliary_unregister(struct rte_auxiliary_driver *driver)
{
- rte_bus_remove_driver(&auxiliary_bus.bus, &driver->driver);
+ rte_bus_remove_driver(&auxiliary_bus, &driver->driver);
}
static int
@@ -189,7 +189,7 @@ auxiliary_unplug(struct rte_device *dev)
ret = rte_auxiliary_driver_remove_dev(adev);
if (ret == 0) {
- rte_bus_remove_device(&auxiliary_bus.bus, &adev->device);
+ rte_bus_remove_device(&auxiliary_bus, &adev->device);
rte_devargs_remove(dev->devargs);
rte_intr_instance_free(adev->intr_handle);
free(adev);
@@ -203,7 +203,7 @@ auxiliary_cleanup(void)
struct rte_auxiliary_device *dev;
int error = 0;
- RTE_BUS_FOREACH_DEV(dev, &auxiliary_bus.bus) {
+ RTE_BUS_FOREACH_DEV(dev, &auxiliary_bus) {
int ret;
if (!rte_dev_is_probed(&dev->device))
@@ -250,7 +250,7 @@ auxiliary_get_iommu_class(void)
{
const struct rte_auxiliary_driver *drv;
- RTE_BUS_FOREACH_DRV(drv, &auxiliary_bus.bus) {
+ RTE_BUS_FOREACH_DRV(drv, &auxiliary_bus) {
if ((drv->drv_flags & RTE_AUXILIARY_DRV_NEED_IOVA_AS_VA) > 0)
return RTE_IOVA_VA;
}
@@ -258,22 +258,20 @@ auxiliary_get_iommu_class(void)
return RTE_IOVA_DC;
}
-struct rte_auxiliary_bus auxiliary_bus = {
- .bus = {
- .scan = auxiliary_scan,
- .probe = rte_bus_generic_probe,
- .cleanup = auxiliary_cleanup,
- .find_device = rte_bus_generic_find_device,
- .match = auxiliary_bus_match,
- .probe_device = auxiliary_probe_device,
- .unplug = auxiliary_unplug,
- .parse = auxiliary_parse,
- .dma_map = auxiliary_dma_map,
- .dma_unmap = auxiliary_dma_unmap,
- .get_iommu_class = auxiliary_get_iommu_class,
- .dev_iterate = rte_bus_generic_dev_iterate,
- },
+struct rte_bus auxiliary_bus = {
+ .scan = auxiliary_scan,
+ .probe = rte_bus_generic_probe,
+ .cleanup = auxiliary_cleanup,
+ .find_device = rte_bus_generic_find_device,
+ .match = auxiliary_bus_match,
+ .probe_device = auxiliary_probe_device,
+ .unplug = auxiliary_unplug,
+ .parse = auxiliary_parse,
+ .dma_map = auxiliary_dma_map,
+ .dma_unmap = auxiliary_dma_unmap,
+ .get_iommu_class = auxiliary_get_iommu_class,
+ .dev_iterate = rte_bus_generic_dev_iterate,
};
-RTE_REGISTER_BUS(auxiliary, auxiliary_bus.bus);
+RTE_REGISTER_BUS(auxiliary, auxiliary_bus);
RTE_LOG_REGISTER_DEFAULT(auxiliary_bus_logtype, NOTICE);
diff --git a/drivers/bus/auxiliary/linux/auxiliary.c b/drivers/bus/auxiliary/linux/auxiliary.c
index b40de65bdd..3a2dca2865 100644
--- a/drivers/bus/auxiliary/linux/auxiliary.c
+++ b/drivers/bus/auxiliary/linux/auxiliary.c
@@ -48,12 +48,12 @@ auxiliary_scan_one(const char *dirname, const char *name)
auxiliary_on_scan(dev);
/* Device is valid, add in list (sorted) */
- RTE_BUS_FOREACH_DEV(dev2, &auxiliary_bus.bus) {
+ RTE_BUS_FOREACH_DEV(dev2, &auxiliary_bus) {
ret = strcmp(dev->name, dev2->name);
if (ret > 0)
continue;
if (ret < 0) {
- rte_bus_insert_device(&auxiliary_bus.bus, &dev2->device, &dev->device);
+ rte_bus_insert_device(&auxiliary_bus, &dev2->device, &dev->device);
} else { /* already registered */
if (rte_dev_is_probed(&dev2->device) &&
dev2->device.devargs != dev->device.devargs) {
@@ -65,7 +65,7 @@ auxiliary_scan_one(const char *dirname, const char *name)
}
return 0;
}
- rte_bus_add_device(&auxiliary_bus.bus, &dev->device);
+ rte_bus_add_device(&auxiliary_bus, &dev->device);
return 0;
}
@@ -109,14 +109,14 @@ auxiliary_scan(void)
if (e->d_name[0] == '.')
continue;
- if (rte_bus_device_is_ignored(&auxiliary_bus.bus, e->d_name))
+ if (rte_bus_device_is_ignored(&auxiliary_bus, e->d_name))
continue;
snprintf(dirname, sizeof(dirname), "%s/%s",
AUXILIARY_SYSFS_PATH, e->d_name);
/* Ignore if no driver can handle. */
- RTE_BUS_FOREACH_DRV(drv, &auxiliary_bus.bus) {
+ RTE_BUS_FOREACH_DRV(drv, &auxiliary_bus) {
if (drv->match(e->d_name))
break;
}
diff --git a/drivers/bus/auxiliary/private.h b/drivers/bus/auxiliary/private.h
index 116154eb56..282ad94618 100644
--- a/drivers/bus/auxiliary/private.h
+++ b/drivers/bus/auxiliary/private.h
@@ -19,14 +19,7 @@ extern int auxiliary_bus_logtype;
#define AUXILIARY_LOG(level, ...) \
RTE_LOG_LINE(level, AUXILIARY_BUS, __VA_ARGS__)
-/*
- * Structure describing the auxiliary bus
- */
-struct rte_auxiliary_bus {
- struct rte_bus bus; /* Inherit the generic class */
-};
-
-extern struct rte_auxiliary_bus auxiliary_bus;
+extern struct rte_bus auxiliary_bus;
/*
* Test whether the auxiliary device exist.
diff --git a/drivers/bus/cdx/bus_cdx_driver.h b/drivers/bus/cdx/bus_cdx_driver.h
index aa44dee5a6..d443178404 100644
--- a/drivers/bus/cdx/bus_cdx_driver.h
+++ b/drivers/bus/cdx/bus_cdx_driver.h
@@ -25,7 +25,6 @@ extern "C" {
/* Forward declarations */
struct rte_cdx_device;
struct rte_cdx_driver;
-struct rte_cdx_bus;
#define RTE_CDX_BUS_DEVICES_PATH "/sys/bus/cdx/devices"
diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
index cb4f755b8e..2443161e1a 100644
--- a/drivers/bus/cdx/cdx.c
+++ b/drivers/bus/cdx/cdx.c
@@ -84,7 +84,7 @@
#define CDX_DEV_PREFIX "cdx-"
-struct rte_cdx_bus rte_cdx_bus;
+static struct rte_bus rte_cdx_bus;
static int
cdx_get_kernel_driver_by_path(const char *filename, char *driver_name,
@@ -194,7 +194,7 @@ cdx_scan_one(const char *dirname, const char *dev_name)
}
dev->id.device_id = (uint16_t)tmp;
- rte_bus_add_device(&rte_cdx_bus.bus, &dev->device);
+ rte_bus_add_device(&rte_cdx_bus, &dev->device);
return 0;
@@ -226,7 +226,7 @@ cdx_scan(void)
if (e->d_name[0] == '.')
continue;
- if (rte_bus_device_is_ignored(&rte_cdx_bus.bus, e->d_name))
+ if (rte_bus_device_is_ignored(&rte_cdx_bus, e->d_name))
continue;
snprintf(dirname, sizeof(dirname), "%s/%s",
@@ -363,7 +363,7 @@ RTE_EXPORT_INTERNAL_SYMBOL(rte_cdx_register)
void
rte_cdx_register(struct rte_cdx_driver *driver)
{
- rte_bus_add_driver(&rte_cdx_bus.bus, &driver->driver);
+ rte_bus_add_driver(&rte_cdx_bus, &driver->driver);
}
/* unregister a driver */
@@ -371,7 +371,7 @@ RTE_EXPORT_INTERNAL_SYMBOL(rte_cdx_unregister)
void
rte_cdx_unregister(struct rte_cdx_driver *driver)
{
- rte_bus_remove_driver(&rte_cdx_bus.bus, &driver->driver);
+ rte_bus_remove_driver(&rte_cdx_bus, &driver->driver);
}
/*
@@ -412,7 +412,7 @@ cdx_unplug(struct rte_device *dev)
ret = cdx_detach_dev(cdx_dev);
if (ret == 0) {
- rte_bus_remove_device(&rte_cdx_bus.bus, &cdx_dev->device);
+ rte_bus_remove_device(&rte_cdx_bus, &cdx_dev->device);
rte_devargs_remove(dev->devargs);
free(cdx_dev);
}
@@ -440,27 +440,25 @@ cdx_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova, size_t len)
static enum rte_iova_mode
cdx_get_iommu_class(void)
{
- if (TAILQ_EMPTY(&rte_cdx_bus.bus.device_list))
+ if (TAILQ_EMPTY(&rte_cdx_bus.device_list))
return RTE_IOVA_DC;
return RTE_IOVA_VA;
}
-struct rte_cdx_bus rte_cdx_bus = {
- .bus = {
- .scan = cdx_scan,
- .probe = rte_bus_generic_probe,
- .find_device = rte_bus_generic_find_device,
- .match = cdx_bus_match,
- .probe_device = cdx_probe_device,
- .unplug = cdx_unplug,
- .parse = cdx_parse,
- .dma_map = cdx_dma_map,
- .dma_unmap = cdx_dma_unmap,
- .get_iommu_class = cdx_get_iommu_class,
- .dev_iterate = rte_bus_generic_dev_iterate,
- },
+static struct rte_bus rte_cdx_bus = {
+ .scan = cdx_scan,
+ .probe = rte_bus_generic_probe,
+ .find_device = rte_bus_generic_find_device,
+ .match = cdx_bus_match,
+ .probe_device = cdx_probe_device,
+ .unplug = cdx_unplug,
+ .parse = cdx_parse,
+ .dma_map = cdx_dma_map,
+ .dma_unmap = cdx_dma_unmap,
+ .get_iommu_class = cdx_get_iommu_class,
+ .dev_iterate = rte_bus_generic_dev_iterate,
};
-RTE_REGISTER_BUS(cdx, rte_cdx_bus.bus);
+RTE_REGISTER_BUS(cdx, rte_cdx_bus);
RTE_LOG_REGISTER_DEFAULT(cdx_logtype_bus, NOTICE);
diff --git a/drivers/bus/cdx/private.h b/drivers/bus/cdx/private.h
index f69673aaab..289301bade 100644
--- a/drivers/bus/cdx/private.h
+++ b/drivers/bus/cdx/private.h
@@ -7,13 +7,6 @@
#include "bus_cdx_driver.h"
-/**
- * Structure describing the CDX bus.
- */
-struct rte_cdx_bus {
- struct rte_bus bus; /**< Inherit the generic class */
-};
-
/**
* Map a particular resource from a file.
*
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 08c1607647..ee467b94d5 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -57,10 +57,6 @@
#define DPAA_MAX_PUSH_MODE_QUEUE 8
#define DPAA_DEFAULT_PUSH_MODE_QUEUE 4
-struct rte_dpaa_bus {
- struct rte_bus bus;
-};
-
struct rte_dpaa_bus_private {
int device_count;
int detected;
@@ -69,7 +65,7 @@ struct rte_dpaa_bus_private {
RTE_ATOMIC(uint16_t) push_rxq_num;
};
-static struct rte_dpaa_bus rte_dpaa_bus;
+static struct rte_bus rte_dpaa_bus;
static struct rte_dpaa_bus_private dpaa_bus;
static struct netcfg_info *dpaa_netcfg;
@@ -168,17 +164,17 @@ dpaa_add_to_device_list(struct rte_dpaa_device *newdev)
int comp, inserted = 0;
struct rte_dpaa_device *dev = NULL;
- RTE_BUS_FOREACH_DEV(dev, &rte_dpaa_bus.bus) {
+ RTE_BUS_FOREACH_DEV(dev, &rte_dpaa_bus) {
comp = compare_dpaa_devices(newdev, dev);
if (comp < 0) {
- rte_bus_insert_device(&rte_dpaa_bus.bus, &dev->device, &newdev->device);
+ rte_bus_insert_device(&rte_dpaa_bus, &dev->device, &newdev->device);
inserted = 1;
break;
}
}
if (!inserted)
- rte_bus_add_device(&rte_dpaa_bus.bus, &newdev->device);
+ rte_bus_add_device(&rte_dpaa_bus, &newdev->device);
}
/*
@@ -253,7 +249,7 @@ dpaa_create_device_list(void)
(fman_intf->fman->idx + 1), fman_intf->mac_idx);
}
dev->device.name = dev->name;
- dev->device.devargs = rte_bus_find_devargs(&rte_dpaa_bus.bus, dev->name);
+ dev->device.devargs = rte_bus_find_devargs(&rte_dpaa_bus, dev->name);
if (dev->device.devargs != NULL)
DPAA_BUS_INFO("**Devargs matched %s", dev->name);
@@ -303,7 +299,7 @@ dpaa_create_device_list(void)
sprintf(dev->name, "dpaa_sec-%d", i+1);
DPAA_BUS_LOG(INFO, "%s cryptodev added", dev->name);
dev->device.name = dev->name;
- dev->device.devargs = rte_bus_find_devargs(&rte_dpaa_bus.bus, dev->name);
+ dev->device.devargs = rte_bus_find_devargs(&rte_dpaa_bus, dev->name);
if (dev->device.devargs != NULL)
DPAA_BUS_INFO("**Devargs matched %s", dev->name);
@@ -329,7 +325,7 @@ dpaa_create_device_list(void)
sprintf(dev->name, "dpaa_qdma-%d", i+1);
DPAA_BUS_LOG(INFO, "%s qdma device added", dev->name);
dev->device.name = dev->name;
- dev->device.devargs = rte_bus_find_devargs(&rte_dpaa_bus.bus, dev->name);
+ dev->device.devargs = rte_bus_find_devargs(&rte_dpaa_bus, dev->name);
if (dev->device.devargs != NULL)
DPAA_BUS_INFO("**Devargs matched %s", dev->name);
@@ -349,8 +345,8 @@ dpaa_clean_device_list(void)
{
struct rte_dpaa_device *dev = NULL;
- RTE_BUS_FOREACH_DEV(dev, &rte_dpaa_bus.bus) {
- rte_bus_remove_device(&rte_dpaa_bus.bus, &dev->device);
+ RTE_BUS_FOREACH_DEV(dev, &rte_dpaa_bus) {
+ rte_bus_remove_device(&rte_dpaa_bus, &dev->device);
rte_intr_instance_free(dev->intr_handle);
free(dev);
dev = NULL;
@@ -583,7 +579,7 @@ rte_dpaa_driver_register(struct rte_dpaa_driver *driver)
BUS_INIT_FUNC_TRACE();
- rte_bus_add_driver(&rte_dpaa_bus.bus, &driver->driver);
+ rte_bus_add_driver(&rte_dpaa_bus, &driver->driver);
}
/* un-register a dpaa bus based dpaa driver */
@@ -593,7 +589,7 @@ rte_dpaa_driver_unregister(struct rte_dpaa_driver *driver)
{
BUS_INIT_FUNC_TRACE();
- rte_bus_remove_driver(&rte_dpaa_bus.bus, &driver->driver);
+ rte_bus_remove_driver(&rte_dpaa_bus, &driver->driver);
}
static bool
@@ -760,7 +756,7 @@ rte_dpaa_bus_scan(void)
process_once = 1;
/* If no device present on DPAA bus nothing needs to be done */
- if (TAILQ_EMPTY(&rte_dpaa_bus.bus.device_list))
+ if (TAILQ_EMPTY(&rte_dpaa_bus.device_list))
return 0;
/* Register DPAA mempool ops only if any DPAA device has
@@ -768,7 +764,7 @@ rte_dpaa_bus_scan(void)
*/
rte_mbuf_set_platform_mempool_ops(DPAA_MEMPOOL_OPS_NAME);
- RTE_BUS_FOREACH_DEV(dev, &rte_dpaa_bus.bus) {
+ RTE_BUS_FOREACH_DEV(dev, &rte_dpaa_bus) {
if (dev->device_type == FSL_DPAA_ETH) {
ret = rte_dpaa_setup_intr(dev->intr_handle);
if (ret)
@@ -816,7 +812,7 @@ dpaa_bus_cleanup(void)
struct rte_dpaa_device *dev;
BUS_INIT_FUNC_TRACE();
- RTE_BUS_FOREACH_DEV(dev, &rte_dpaa_bus.bus) {
+ RTE_BUS_FOREACH_DEV(dev, &rte_dpaa_bus) {
const struct rte_dpaa_driver *drv;
int ret = 0;
@@ -859,19 +855,17 @@ RTE_FINI_PRIO(dpaa_cleanup, 102)
DPAA_BUS_DEBUG("Worker thread clean up done");
}
-static struct rte_dpaa_bus rte_dpaa_bus = {
- .bus = {
- .scan = rte_dpaa_bus_scan,
- .probe = rte_bus_generic_probe,
- .parse = rte_dpaa_bus_parse,
- .dev_compare = dpaa_bus_dev_compare,
- .find_device = rte_bus_generic_find_device,
- .get_iommu_class = rte_dpaa_get_iommu_class,
- .match = dpaa_bus_match,
- .probe_device = dpaa_bus_probe_device,
- .dev_iterate = rte_bus_generic_dev_iterate,
- .cleanup = dpaa_bus_cleanup,
- },
+static struct rte_bus rte_dpaa_bus = {
+ .scan = rte_dpaa_bus_scan,
+ .probe = rte_bus_generic_probe,
+ .parse = rte_dpaa_bus_parse,
+ .dev_compare = dpaa_bus_dev_compare,
+ .find_device = rte_bus_generic_find_device,
+ .get_iommu_class = rte_dpaa_get_iommu_class,
+ .match = dpaa_bus_match,
+ .probe_device = dpaa_bus_probe_device,
+ .dev_iterate = rte_bus_generic_dev_iterate,
+ .cleanup = dpaa_bus_cleanup,
};
static struct rte_dpaa_bus_private dpaa_bus = {
@@ -879,5 +873,5 @@ static struct rte_dpaa_bus_private dpaa_bus = {
.device_count = 0,
};
-RTE_REGISTER_BUS(dpaa_bus, rte_dpaa_bus.bus);
+RTE_REGISTER_BUS(dpaa_bus, rte_dpaa_bus);
RTE_LOG_REGISTER_DEFAULT(dpaa_logtype_bus, NOTICE);
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 821fe63955..88511d4dc7 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -27,7 +27,7 @@
#define VFIO_IOMMU_GROUP_PATH "/sys/kernel/iommu_groups"
-struct rte_fslmc_bus rte_fslmc_bus;
+struct rte_bus rte_fslmc_bus;
static int fslmc_bus_device_count[DPAA2_DEVTYPE_MAX];
#define DPAA2_SEQN_DYNFIELD_NAME "dpaa2_seqn_dynfield"
@@ -48,8 +48,8 @@ cleanup_fslmc_device_list(void)
{
struct rte_dpaa2_device *dev;
- RTE_BUS_FOREACH_DEV(dev, &rte_fslmc_bus.bus) {
- rte_bus_remove_device(&rte_fslmc_bus.bus, &dev->device);
+ RTE_BUS_FOREACH_DEV(dev, &rte_fslmc_bus) {
+ rte_bus_remove_device(&rte_fslmc_bus, &dev->device);
rte_intr_instance_free(dev->intr_handle);
free(dev);
dev = NULL;
@@ -85,17 +85,17 @@ insert_in_device_list(struct rte_dpaa2_device *newdev)
int comp, inserted = 0;
struct rte_dpaa2_device *dev = NULL;
- RTE_BUS_FOREACH_DEV(dev, &rte_fslmc_bus.bus) {
+ RTE_BUS_FOREACH_DEV(dev, &rte_fslmc_bus) {
comp = compare_dpaa2_devname(newdev, dev);
if (comp < 0) {
- rte_bus_insert_device(&rte_fslmc_bus.bus, &dev->device, &newdev->device);
+ rte_bus_insert_device(&rte_fslmc_bus, &dev->device, &newdev->device);
inserted = 1;
break;
}
}
if (!inserted)
- rte_bus_add_device(&rte_fslmc_bus.bus, &newdev->device);
+ rte_bus_add_device(&rte_fslmc_bus, &newdev->device);
}
static void
@@ -106,7 +106,7 @@ dump_device_list(void)
/* Only if the log level has been set to Debugging, print list */
if (rte_log_can_log(dpaa2_logtype_bus, RTE_LOG_DEBUG)) {
DPAA2_BUS_LOG(DEBUG, "List of devices scanned on bus:");
- RTE_BUS_FOREACH_DEV(dev, &rte_fslmc_bus.bus) {
+ RTE_BUS_FOREACH_DEV(dev, &rte_fslmc_bus) {
DPAA2_BUS_LOG(DEBUG, "\t\t%s", dev->device.name);
}
}
@@ -198,7 +198,7 @@ scan_one_fslmc_device(char *dev_name)
ret = -ENOMEM;
goto cleanup;
}
- dev->device.devargs = rte_bus_find_devargs(&rte_fslmc_bus.bus, dev_name);
+ dev->device.devargs = rte_bus_find_devargs(&rte_fslmc_bus, dev_name);
/* Update the device found into the device_count table */
fslmc_bus_device_count[dev->dev_type]++;
@@ -247,7 +247,7 @@ rte_fslmc_parse(const char *name, void *addr)
*/
if (sep_exists) {
/* If either of "fslmc" or "name" are starting part */
- if (!strncmp(name, rte_fslmc_bus.bus.name, strlen(rte_fslmc_bus.bus.name)) ||
+ if (!strncmp(name, rte_fslmc_bus.name, strlen(rte_fslmc_bus.name)) ||
(!strncmp(name, "name", strlen("name")))) {
goto jump_out;
} else {
@@ -317,8 +317,8 @@ rte_fslmc_scan(void)
struct rte_dpaa2_device *dev;
DPAA2_BUS_DEBUG("Fslmc bus already scanned. Not rescanning");
- RTE_BUS_FOREACH_DEV(dev, &rte_fslmc_bus.bus) {
- dev->device.devargs = rte_bus_find_devargs(&rte_fslmc_bus.bus,
+ RTE_BUS_FOREACH_DEV(dev, &rte_fslmc_bus) {
+ dev->device.devargs = rte_bus_find_devargs(&rte_fslmc_bus,
dev->device.name);
}
return 0;
@@ -369,7 +369,7 @@ rte_fslmc_scan(void)
dump_device_list();
/* Bus initialization - only if devices were found */
- if (!TAILQ_EMPTY(&rte_fslmc_bus.bus.device_list)) {
+ if (!TAILQ_EMPTY(&rte_fslmc_bus.device_list)) {
static const struct rte_mbuf_dynfield dpaa2_seqn_dynfield_desc = {
.name = DPAA2_SEQN_DYNFIELD_NAME,
.size = sizeof(dpaa2_seqn_t),
@@ -455,7 +455,7 @@ rte_fslmc_driver_register(struct rte_dpaa2_driver *driver)
RTE_VERIFY(driver);
RTE_VERIFY(driver->probe != NULL);
- rte_bus_add_driver(&rte_fslmc_bus.bus, &driver->driver);
+ rte_bus_add_driver(&rte_fslmc_bus, &driver->driver);
}
/*un-register a fslmc bus based dpaa2 driver */
@@ -463,7 +463,7 @@ RTE_EXPORT_INTERNAL_SYMBOL(rte_fslmc_driver_unregister)
void
rte_fslmc_driver_unregister(struct rte_dpaa2_driver *driver)
{
- rte_bus_remove_driver(&rte_fslmc_bus.bus, &driver->driver);
+ rte_bus_remove_driver(&rte_fslmc_bus, &driver->driver);
}
/*
@@ -475,8 +475,8 @@ fslmc_all_device_support_iova(void)
struct rte_dpaa2_device *dev;
struct rte_dpaa2_driver *drv;
- RTE_BUS_FOREACH_DEV(dev, &rte_fslmc_bus.bus) {
- RTE_BUS_FOREACH_DRV(drv, &rte_fslmc_bus.bus) {
+ RTE_BUS_FOREACH_DEV(dev, &rte_fslmc_bus) {
+ RTE_BUS_FOREACH_DRV(drv, &rte_fslmc_bus) {
if (!fslmc_bus_match(&drv->driver, &dev->device))
continue;
/* if the driver is not supporting IOVA */
@@ -496,7 +496,7 @@ rte_dpaa2_get_iommu_class(void)
if (rte_eal_iova_mode() == RTE_IOVA_PA)
return RTE_IOVA_PA;
- if (TAILQ_EMPTY(&rte_fslmc_bus.bus.device_list))
+ if (TAILQ_EMPTY(&rte_fslmc_bus.device_list))
return RTE_IOVA_DC;
/* check if all devices on the bus support Virtual addressing or not */
@@ -546,21 +546,19 @@ fslmc_bus_unplug(struct rte_device *rte_dev)
return -ENODEV;
}
-struct rte_fslmc_bus rte_fslmc_bus = {
- .bus = {
- .scan = rte_fslmc_scan,
- .probe = rte_bus_generic_probe,
- .cleanup = rte_fslmc_close,
- .parse = rte_fslmc_parse,
- .dev_compare = fslmc_dev_compare,
- .find_device = rte_bus_generic_find_device,
- .get_iommu_class = rte_dpaa2_get_iommu_class,
- .match = fslmc_bus_match,
- .probe_device = fslmc_bus_probe_device,
- .unplug = fslmc_bus_unplug,
- .dev_iterate = rte_bus_generic_dev_iterate,
- },
+struct rte_bus rte_fslmc_bus = {
+ .scan = rte_fslmc_scan,
+ .probe = rte_bus_generic_probe,
+ .cleanup = rte_fslmc_close,
+ .parse = rte_fslmc_parse,
+ .dev_compare = fslmc_dev_compare,
+ .find_device = rte_bus_generic_find_device,
+ .get_iommu_class = rte_dpaa2_get_iommu_class,
+ .match = fslmc_bus_match,
+ .probe_device = fslmc_bus_probe_device,
+ .unplug = fslmc_bus_unplug,
+ .dev_iterate = rte_bus_generic_dev_iterate,
};
-RTE_REGISTER_BUS(fslmc, rte_fslmc_bus.bus);
+RTE_REGISTER_BUS(fslmc, rte_fslmc_bus);
RTE_LOG_REGISTER_DEFAULT(dpaa2_logtype_bus, NOTICE);
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 5784adaf90..412b70e5ae 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -1554,12 +1554,12 @@ fslmc_vfio_close_group(void)
return -EIO;
}
- RTE_BUS_FOREACH_DEV(dev, &rte_fslmc_bus.bus) {
+ RTE_BUS_FOREACH_DEV(dev, &rte_fslmc_bus) {
if (dev->device.devargs &&
dev->device.devargs->policy == RTE_DEV_BLOCKED) {
DPAA2_BUS_LOG(DEBUG, "%s Blacklisted, skipping",
dev->device.name);
- rte_bus_remove_device(&rte_fslmc_bus.bus, &dev->device);
+ rte_bus_remove_device(&rte_fslmc_bus, &dev->device);
continue;
}
switch (dev->dev_type) {
@@ -1599,7 +1599,7 @@ fslmc_vfio_process_group(void)
bool is_dpmcp_in_blocklist = false, is_dpio_in_blocklist = false;
int dpmcp_count = 0, dpio_count = 0, current_device;
- RTE_BUS_FOREACH_DEV(dev, &rte_fslmc_bus.bus) {
+ RTE_BUS_FOREACH_DEV(dev, &rte_fslmc_bus) {
if (dev->dev_type == DPAA2_MPORTAL) {
dpmcp_count++;
if (dev->device.devargs &&
@@ -1616,14 +1616,14 @@ fslmc_vfio_process_group(void)
/* Search the MCP as that should be initialized first. */
current_device = 0;
- RTE_BUS_FOREACH_DEV(dev, &rte_fslmc_bus.bus) {
+ RTE_BUS_FOREACH_DEV(dev, &rte_fslmc_bus) {
if (dev->dev_type == DPAA2_MPORTAL) {
current_device++;
if (dev->device.devargs &&
dev->device.devargs->policy == RTE_DEV_BLOCKED) {
DPAA2_BUS_LOG(DEBUG, "%s Blocked, skipping",
dev->device.name);
- rte_bus_remove_device(&rte_fslmc_bus.bus,
+ rte_bus_remove_device(&rte_fslmc_bus,
&dev->device);
continue;
}
@@ -1632,7 +1632,7 @@ fslmc_vfio_process_group(void)
!is_dpmcp_in_blocklist) {
if (dpmcp_count == 1 ||
current_device != dpmcp_count) {
- rte_bus_remove_device(&rte_fslmc_bus.bus,
+ rte_bus_remove_device(&rte_fslmc_bus,
&dev->device);
continue;
}
@@ -1647,7 +1647,7 @@ fslmc_vfio_process_group(void)
found_mportal = 1;
}
- rte_bus_remove_device(&rte_fslmc_bus.bus, &dev->device);
+ rte_bus_remove_device(&rte_fslmc_bus, &dev->device);
free(dev);
dev = NULL;
/* Ideally there is only a single dpmcp, but in case
@@ -1666,26 +1666,26 @@ fslmc_vfio_process_group(void)
* other devices.
*/
current_device = 0;
- RTE_BUS_FOREACH_DEV(dev, &rte_fslmc_bus.bus) {
+ RTE_BUS_FOREACH_DEV(dev, &rte_fslmc_bus) {
if (dev->dev_type == DPAA2_DPRC) {
ret = fslmc_process_iodevices(dev);
if (ret) {
DPAA2_BUS_ERR("Unable to process dprc");
return ret;
}
- rte_bus_remove_device(&rte_fslmc_bus.bus, &dev->device);
+ rte_bus_remove_device(&rte_fslmc_bus, &dev->device);
}
}
current_device = 0;
- RTE_BUS_FOREACH_DEV(dev, &rte_fslmc_bus.bus) {
+ RTE_BUS_FOREACH_DEV(dev, &rte_fslmc_bus) {
if (dev->dev_type == DPAA2_IO)
current_device++;
if (dev->device.devargs &&
dev->device.devargs->policy == RTE_DEV_BLOCKED) {
DPAA2_BUS_LOG(DEBUG, "%s Blocked, skipping",
dev->device.name);
- rte_bus_remove_device(&rte_fslmc_bus.bus, &dev->device);
+ rte_bus_remove_device(&rte_fslmc_bus, &dev->device);
continue;
}
if (rte_eal_process_type() == RTE_PROC_SECONDARY &&
@@ -1693,7 +1693,7 @@ fslmc_vfio_process_group(void)
dev->dev_type != DPAA2_CRYPTO &&
dev->dev_type != DPAA2_QDMA &&
dev->dev_type != DPAA2_IO) {
- rte_bus_remove_device(&rte_fslmc_bus.bus, &dev->device);
+ rte_bus_remove_device(&rte_fslmc_bus, &dev->device);
continue;
}
switch (dev->dev_type) {
@@ -1735,13 +1735,13 @@ fslmc_vfio_process_group(void)
if (!is_dpio_in_blocklist && dpio_count > 1) {
if (rte_eal_process_type() == RTE_PROC_SECONDARY
&& current_device != dpio_count) {
- rte_bus_remove_device(&rte_fslmc_bus.bus,
+ rte_bus_remove_device(&rte_fslmc_bus,
&dev->device);
break;
}
if (rte_eal_process_type() == RTE_PROC_PRIMARY
&& current_device == dpio_count) {
- rte_bus_remove_device(&rte_fslmc_bus.bus,
+ rte_bus_remove_device(&rte_fslmc_bus,
&dev->device);
break;
}
@@ -1760,7 +1760,7 @@ fslmc_vfio_process_group(void)
/* Unknown - ignore */
DPAA2_BUS_DEBUG("Found unknown device (%s)",
dev->device.name);
- rte_bus_remove_device(&rte_fslmc_bus.bus, &dev->device);
+ rte_bus_remove_device(&rte_fslmc_bus, &dev->device);
free(dev);
dev = NULL;
}
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
index a66e55a456..868ed646af 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dprc.c
@@ -49,7 +49,7 @@ rte_dpaa2_create_dprc_device(int vdev_fd __rte_unused,
return ret;
}
- RTE_BUS_FOREACH_DEV(dev, &rte_fslmc_bus.bus) {
+ RTE_BUS_FOREACH_DEV(dev, &rte_fslmc_bus) {
/** DPRC is always created before it's children are created.*/
dev->container = dprc_node;
if (dev->dev_type == DPAA2_ETH) {
diff --git a/drivers/bus/fslmc/private.h b/drivers/bus/fslmc/private.h
index a0dda4f9d6..20a454c3fc 100644
--- a/drivers/bus/fslmc/private.h
+++ b/drivers/bus/fslmc/private.h
@@ -9,13 +9,6 @@
#include <bus_fslmc_driver.h>
-/*
- * FSLMC bus
- */
-struct rte_fslmc_bus {
- struct rte_bus bus; /**< Generic Bus object */
-};
-
-extern struct rte_fslmc_bus rte_fslmc_bus;
+extern struct rte_bus rte_fslmc_bus;
#endif /* BUS_FSLMC_PRIVATE_H */
diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index 78d14ab3ae..c6df31d486 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -297,20 +297,18 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
}
/* device is valid, add in list (sorted) */
- if (TAILQ_EMPTY(&rte_pci_bus.bus.device_list)) {
- rte_bus_add_device(&rte_pci_bus.bus, &dev->device);
- }
- else {
+ if (TAILQ_EMPTY(&rte_pci_bus.device_list)) {
+ rte_bus_add_device(&rte_pci_bus, &dev->device);
+ } else {
struct rte_pci_device *dev2 = NULL;
int ret;
- RTE_BUS_FOREACH_DEV(dev2, &rte_pci_bus.bus) {
+ RTE_BUS_FOREACH_DEV(dev2, &rte_pci_bus) {
ret = rte_pci_addr_cmp(&dev->addr, &dev2->addr);
if (ret > 0)
continue;
else if (ret < 0) {
- rte_bus_insert_device(&rte_pci_bus.bus, &dev2->device,
- &dev->device);
+ rte_bus_insert_device(&rte_pci_bus, &dev2->device, &dev->device);
} else { /* already registered */
dev2->kdrv = dev->kdrv;
dev2->max_vfs = dev->max_vfs;
@@ -322,7 +320,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
}
return 0;
}
- rte_bus_add_device(&rte_pci_bus.bus, &dev->device);
+ rte_bus_add_device(&rte_pci_bus, &dev->device);
}
return 0;
@@ -378,7 +376,7 @@ rte_pci_scan(void)
pci_addr.function = matches[i].pc_sel.pc_func;
rte_pci_device_name(&pci_addr, name, sizeof(name));
- if (rte_bus_device_is_ignored(&rte_pci_bus.bus, name))
+ if (rte_bus_device_is_ignored(&rte_pci_bus, name))
continue;
if (pci_scan_one(fd, &matches[i]) < 0)
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index cf8a60313b..9aae0a5d14 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -321,19 +321,18 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
return 0;
}
/* device is valid, add in list (sorted) */
- if (TAILQ_EMPTY(&rte_pci_bus.bus.device_list)) {
- rte_bus_add_device(&rte_pci_bus.bus, &dev->device);
+ if (TAILQ_EMPTY(&rte_pci_bus.device_list)) {
+ rte_bus_add_device(&rte_pci_bus, &dev->device);
} else {
struct rte_pci_device *dev2;
- RTE_BUS_FOREACH_DEV(dev2, &rte_pci_bus.bus) {
+ RTE_BUS_FOREACH_DEV(dev2, &rte_pci_bus) {
ret = rte_pci_addr_cmp(&dev->addr, &dev2->addr);
if (ret > 0)
continue;
if (ret < 0) {
- rte_bus_insert_device(&rte_pci_bus.bus, &dev2->device,
- &dev->device);
+ rte_bus_insert_device(&rte_pci_bus, &dev2->device, &dev->device);
} else { /* already registered */
if (!rte_dev_is_probed(&dev2->device)) {
dev2->kdrv = dev->kdrv;
@@ -377,7 +376,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
return 0;
}
- rte_bus_add_device(&rte_pci_bus.bus, &dev->device);
+ rte_bus_add_device(&rte_pci_bus, &dev->device);
}
return 0;
@@ -458,7 +457,7 @@ rte_pci_scan(void)
if (parse_pci_addr_format(e->d_name, sizeof(e->d_name), &addr) != 0)
continue;
- if (rte_bus_device_is_ignored(&rte_pci_bus.bus, e->d_name))
+ if (rte_bus_device_is_ignored(&rte_pci_bus, e->d_name))
continue;
snprintf(dirname, sizeof(dirname), "%s/%s",
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 2bdb94a924..fd18b8772b 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -87,7 +87,7 @@ pci_common_set(struct rte_pci_device *dev)
dev->name, sizeof(dev->name));
dev->device.name = dev->name;
- dev->device.devargs = rte_bus_find_devargs(&rte_pci_bus.bus, dev->name);
+ dev->device.devargs = rte_bus_find_devargs(&rte_pci_bus, dev->name);
if (dev->bus_info != NULL ||
asprintf(&dev->bus_info, "vendor_id=%"PRIx16", device_id=%"PRIx16,
@@ -329,7 +329,7 @@ pci_cleanup(void)
struct rte_pci_device *dev;
int error = 0;
- RTE_BUS_FOREACH_DEV(dev, &rte_pci_bus.bus) {
+ RTE_BUS_FOREACH_DEV(dev, &rte_pci_bus) {
const struct rte_pci_driver *drv;
int ret = 0;
@@ -353,7 +353,7 @@ pci_cleanup(void)
rte_intr_instance_free(dev->vfio_req_intr_handle);
dev->vfio_req_intr_handle = NULL;
- rte_bus_remove_device(&rte_pci_bus.bus, &dev->device);
+ rte_bus_remove_device(&rte_pci_bus, &dev->device);
pci_free(RTE_PCI_DEVICE_INTERNAL(dev));
}
@@ -387,7 +387,7 @@ rte_pci_dump(FILE *f)
{
struct rte_pci_device *dev = NULL;
- RTE_BUS_FOREACH_DEV(dev, &rte_pci_bus.bus) {
+ RTE_BUS_FOREACH_DEV(dev, &rte_pci_bus) {
pci_dump_one_device(f, dev);
}
}
@@ -422,7 +422,7 @@ RTE_EXPORT_INTERNAL_SYMBOL(rte_pci_register)
void
rte_pci_register(struct rte_pci_driver *driver)
{
- rte_bus_add_driver(&rte_pci_bus.bus, &driver->driver);
+ rte_bus_add_driver(&rte_pci_bus, &driver->driver);
}
/* unregister a driver */
@@ -430,7 +430,7 @@ RTE_EXPORT_INTERNAL_SYMBOL(rte_pci_unregister)
void
rte_pci_unregister(struct rte_pci_driver *driver)
{
- rte_bus_remove_driver(&rte_pci_bus.bus, &driver->driver);
+ rte_bus_remove_driver(&rte_pci_bus, &driver->driver);
}
/*
@@ -447,7 +447,7 @@ pci_find_device_by_addr(const void *failure_addr)
check_point = (uint64_t)(uintptr_t)failure_addr;
- RTE_BUS_FOREACH_DEV(pdev, &rte_pci_bus.bus) {
+ RTE_BUS_FOREACH_DEV(pdev, &rte_pci_bus) {
for (i = 0; i != RTE_DIM(pdev->mem_resource); i++) {
start = (uint64_t)(uintptr_t)pdev->mem_resource[i].addr;
len = pdev->mem_resource[i].len;
@@ -525,7 +525,7 @@ pci_unplug(struct rte_device *dev)
ret = rte_pci_detach_dev(pdev);
if (ret == 0) {
- rte_bus_remove_device(&rte_pci_bus.bus, &pdev->device);
+ rte_bus_remove_device(&rte_pci_bus, &pdev->device);
rte_devargs_remove(dev->devargs);
pci_free(RTE_PCI_DEVICE_INTERNAL(pdev));
}
@@ -582,7 +582,7 @@ rte_pci_get_iommu_class(void)
bool devices_want_pa = false;
int iommu_no_va = -1;
- RTE_BUS_FOREACH_DEV(dev, &rte_pci_bus.bus) {
+ RTE_BUS_FOREACH_DEV(dev, &rte_pci_bus) {
/*
* We can check this only once, because the IOMMU hardware is
* the same for all of them.
@@ -594,7 +594,7 @@ rte_pci_get_iommu_class(void)
if (dev->kdrv == RTE_PCI_KDRV_UNKNOWN ||
dev->kdrv == RTE_PCI_KDRV_NONE)
continue;
- RTE_BUS_FOREACH_DRV(drv, &rte_pci_bus.bus) {
+ RTE_BUS_FOREACH_DRV(drv, &rte_pci_bus) {
enum rte_iova_mode dev_iova_mode;
if (!pci_bus_match(&drv->driver, &dev->device))
@@ -772,27 +772,25 @@ rte_pci_pasid_set_state(const struct rte_pci_device *dev,
offset + RTE_PCI_PASID_CTRL) != sizeof(pasid) ? -1 : 0;
}
-struct rte_pci_bus rte_pci_bus = {
- .bus = {
- .allow_multi_probe = true,
- .scan = rte_pci_scan,
- .probe = rte_bus_generic_probe,
- .cleanup = pci_cleanup,
- .find_device = rte_bus_generic_find_device,
- .match = pci_bus_match,
- .probe_device = pci_probe_device,
- .unplug = pci_unplug,
- .parse = pci_parse,
- .dev_compare = pci_dev_compare,
- .devargs_parse = rte_pci_devargs_parse,
- .dma_map = pci_dma_map,
- .dma_unmap = pci_dma_unmap,
- .get_iommu_class = rte_pci_get_iommu_class,
- .dev_iterate = rte_pci_dev_iterate,
- .hot_unplug_handler = pci_hot_unplug_handler,
- .sigbus_handler = pci_sigbus_handler,
- },
+struct rte_bus rte_pci_bus = {
+ .allow_multi_probe = true,
+ .scan = rte_pci_scan,
+ .probe = rte_bus_generic_probe,
+ .cleanup = pci_cleanup,
+ .find_device = rte_bus_generic_find_device,
+ .match = pci_bus_match,
+ .probe_device = pci_probe_device,
+ .unplug = pci_unplug,
+ .parse = pci_parse,
+ .dev_compare = pci_dev_compare,
+ .devargs_parse = rte_pci_devargs_parse,
+ .dma_map = pci_dma_map,
+ .dma_unmap = pci_dma_unmap,
+ .get_iommu_class = rte_pci_get_iommu_class,
+ .dev_iterate = rte_pci_dev_iterate,
+ .hot_unplug_handler = pci_hot_unplug_handler,
+ .sigbus_handler = pci_sigbus_handler,
};
-RTE_REGISTER_BUS(pci, rte_pci_bus.bus);
+RTE_REGISTER_BUS(pci, rte_pci_bus);
RTE_LOG_REGISTER_DEFAULT(pci_bus_logtype, NOTICE);
diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
index e308c85ed2..6cbd98b4c8 100644
--- a/drivers/bus/pci/pci_params.c
+++ b/drivers/bus/pci/pci_params.c
@@ -75,7 +75,7 @@ rte_pci_dev_iterate(const struct rte_bus *bus __rte_unused,
return NULL;
}
}
- dev = rte_bus_generic_find_device(&rte_pci_bus.bus, start, pci_dev_match, kvargs);
+ dev = rte_bus_generic_find_device(&rte_pci_bus, start, pci_dev_match, kvargs);
rte_kvargs_free(kvargs);
return dev;
}
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index c54ea7b9d8..8103c32881 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -29,14 +29,7 @@ extern int pci_bus_logtype;
#define RTE_PCI_DEVICE_INTERNAL_CONST(ptr) \
container_of(ptr, const struct rte_pci_device_internal, device)
-/**
- * Structure describing the PCI bus
- */
-struct rte_pci_bus {
- struct rte_bus bus; /**< Inherit the generic class */
-};
-
-extern struct rte_pci_bus rte_pci_bus;
+extern struct rte_bus rte_pci_bus;
struct rte_pci_driver;
struct rte_pci_device;
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index 3b3f97da27..7b51301d1e 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -382,7 +382,7 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
goto end;
rte_pci_device_name(&addr, name, sizeof(name));
- if (rte_bus_device_is_ignored(&rte_pci_bus.bus, name)) {
+ if (rte_bus_device_is_ignored(&rte_pci_bus, name)) {
/*
* We won't add this device, but we want to continue
* looking for supported devices
@@ -430,18 +430,17 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
}
/* device is valid, add in list (sorted) */
- if (TAILQ_EMPTY(&rte_pci_bus.bus.device_list)) {
- rte_bus_add_device(&rte_pci_bus.bus, &dev->device);
+ if (TAILQ_EMPTY(&rte_pci_bus.device_list)) {
+ rte_bus_add_device(&rte_pci_bus, &dev->device);
} else {
struct rte_pci_device *dev2 = NULL;
- RTE_BUS_FOREACH_DEV(dev2, &rte_pci_bus.bus) {
+ RTE_BUS_FOREACH_DEV(dev2, &rte_pci_bus) {
ret = rte_pci_addr_cmp(&dev->addr, &dev2->addr);
if (ret > 0) {
continue;
} else if (ret < 0) {
- rte_bus_insert_device(&rte_pci_bus.bus, &dev2->device,
- &dev->device);
+ rte_bus_insert_device(&rte_pci_bus, &dev2->device, &dev->device);
} else { /* already registered */
dev2->kdrv = dev->kdrv;
dev2->max_vfs = dev->max_vfs;
@@ -451,7 +450,7 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
}
return 0;
}
- rte_bus_add_device(&rte_pci_bus.bus, &dev->device);
+ rte_bus_add_device(&rte_pci_bus, &dev->device);
}
return 0;
diff --git a/drivers/bus/platform/bus_platform_driver.h b/drivers/bus/platform/bus_platform_driver.h
index 3ac405a201..e4dcbacf5e 100644
--- a/drivers/bus/platform/bus_platform_driver.h
+++ b/drivers/bus/platform/bus_platform_driver.h
@@ -24,7 +24,6 @@ extern "C" {
#endif
/* Forward declarations */
-struct rte_platform_bus;
struct rte_platform_device;
struct rte_platform_driver;
diff --git a/drivers/bus/platform/platform.c b/drivers/bus/platform/platform.c
index 4492ed62ec..170a2e03d0 100644
--- a/drivers/bus/platform/platform.c
+++ b/drivers/bus/platform/platform.c
@@ -29,18 +29,20 @@
#define PLATFORM_BUS_DEVICES_PATH "/sys/bus/platform/devices"
+static struct rte_bus platform_bus;
+
RTE_EXPORT_INTERNAL_SYMBOL(rte_platform_register)
void
rte_platform_register(struct rte_platform_driver *pdrv)
{
- rte_bus_add_driver(&platform_bus.bus, &pdrv->driver);
+ rte_bus_add_driver(&platform_bus, &pdrv->driver);
}
RTE_EXPORT_INTERNAL_SYMBOL(rte_platform_unregister)
void
rte_platform_unregister(struct rte_platform_driver *pdrv)
{
- rte_bus_remove_driver(&platform_bus.bus, &pdrv->driver);
+ rte_bus_remove_driver(&platform_bus, &pdrv->driver);
}
static int
@@ -56,11 +58,11 @@ dev_add(const char *dev_name)
rte_strscpy(pdev->name, dev_name, sizeof(pdev->name));
pdev->device.name = pdev->name;
- pdev->device.devargs = rte_bus_find_devargs(&platform_bus.bus, dev_name);
+ pdev->device.devargs = rte_bus_find_devargs(&platform_bus, dev_name);
snprintf(path, sizeof(path), PLATFORM_BUS_DEVICES_PATH "/%s/numa_node", dev_name);
pdev->device.numa_node = eal_parse_sysfs_value(path, &val) ? rte_socket_id() : val;
- RTE_BUS_FOREACH_DEV(tmp, &platform_bus.bus) {
+ RTE_BUS_FOREACH_DEV(tmp, &platform_bus) {
if (!strcmp(tmp->name, pdev->name)) {
PLATFORM_LOG_LINE(INFO, "device %s already added", pdev->name);
@@ -72,7 +74,7 @@ dev_add(const char *dev_name)
}
}
- rte_bus_add_device(&platform_bus.bus, &pdev->device);
+ rte_bus_add_device(&platform_bus, &pdev->device);
PLATFORM_LOG_LINE(INFO, "adding device %s to the list", dev_name);
@@ -135,7 +137,7 @@ platform_bus_scan(void)
if (dev_name[0] == '.')
continue;
- if (rte_bus_device_is_ignored(&platform_bus.bus, dev_name))
+ if (rte_bus_device_is_ignored(&platform_bus, dev_name))
continue;
if (!dev_is_bound_vfio_platform(dev_name))
@@ -440,7 +442,7 @@ platform_bus_parse(const char *name, void *addr)
rte_strscpy(pdev.name, name, sizeof(pdev.name));
- RTE_BUS_FOREACH_DRV(pdrv, &platform_bus.bus) {
+ RTE_BUS_FOREACH_DRV(pdrv, &platform_bus) {
if (platform_bus_match(&pdrv->driver, &pdev.device))
break;
}
@@ -482,7 +484,7 @@ platform_bus_get_iommu_class(void)
const struct rte_platform_driver *pdrv;
struct rte_platform_device *pdev;
- RTE_BUS_FOREACH_DEV(pdev, &platform_bus.bus) {
+ RTE_BUS_FOREACH_DEV(pdev, &platform_bus) {
if (!rte_dev_is_probed(&pdev->device))
continue;
pdrv = RTE_BUS_DRIVER(pdev->device.driver, *pdrv);
@@ -498,8 +500,8 @@ platform_bus_cleanup(void)
{
struct rte_platform_device *pdev;
- RTE_BUS_FOREACH_DEV(pdev, &platform_bus.bus) {
- rte_bus_remove_device(&platform_bus.bus, &pdev->device);
+ RTE_BUS_FOREACH_DEV(pdev, &platform_bus) {
+ rte_bus_remove_device(&platform_bus, &pdev->device);
if (!rte_dev_is_probed(&pdev->device))
continue;
platform_bus_unplug(&pdev->device);
@@ -508,22 +510,20 @@ platform_bus_cleanup(void)
return 0;
}
-struct rte_platform_bus platform_bus = {
- .bus = {
- .scan = platform_bus_scan,
- .probe = rte_bus_generic_probe,
- .find_device = rte_bus_generic_find_device,
- .match = platform_bus_match,
- .probe_device = platform_bus_probe_device,
- .unplug = platform_bus_unplug,
- .parse = platform_bus_parse,
- .dma_map = platform_bus_dma_map,
- .dma_unmap = platform_bus_dma_unmap,
- .get_iommu_class = platform_bus_get_iommu_class,
- .dev_iterate = rte_bus_generic_dev_iterate,
- .cleanup = platform_bus_cleanup,
- },
+static struct rte_bus platform_bus = {
+ .scan = platform_bus_scan,
+ .probe = rte_bus_generic_probe,
+ .find_device = rte_bus_generic_find_device,
+ .match = platform_bus_match,
+ .probe_device = platform_bus_probe_device,
+ .unplug = platform_bus_unplug,
+ .parse = platform_bus_parse,
+ .dma_map = platform_bus_dma_map,
+ .dma_unmap = platform_bus_dma_unmap,
+ .get_iommu_class = platform_bus_get_iommu_class,
+ .dev_iterate = rte_bus_generic_dev_iterate,
+ .cleanup = platform_bus_cleanup,
};
-RTE_REGISTER_BUS(platform, platform_bus.bus);
+RTE_REGISTER_BUS(platform, platform_bus);
RTE_LOG_REGISTER_DEFAULT(platform_bus_logtype, NOTICE);
diff --git a/drivers/bus/platform/private.h b/drivers/bus/platform/private.h
index bf5d75df03..18d42d43d8 100644
--- a/drivers/bus/platform/private.h
+++ b/drivers/bus/platform/private.h
@@ -14,15 +14,6 @@
#include "bus_platform_driver.h"
-extern struct rte_platform_bus platform_bus;
-
-/*
- * Structure describing platform bus.
- */
-struct rte_platform_bus {
- struct rte_bus bus; /* Core bus */
-};
-
extern int platform_bus_logtype;
#define RTE_LOGTYPE_PLATFORM_BUS platform_bus_logtype
#define PLATFORM_LOG_LINE(level, ...) \
diff --git a/drivers/bus/uacce/uacce.c b/drivers/bus/uacce/uacce.c
index db49e887ad..eb58701a61 100644
--- a/drivers/bus/uacce/uacce.c
+++ b/drivers/bus/uacce/uacce.c
@@ -34,15 +34,8 @@
/* Support -a uacce:device-name when start DPDK application. */
#define UACCE_DEV_PREFIX "uacce:"
-/*
- * Structure describing the UACCE bus.
- */
-struct rte_uacce_bus {
- struct rte_bus bus; /* Inherit the generic class. */
-};
-
/* Forward declaration of UACCE bus. */
-static struct rte_uacce_bus uacce_bus;
+static struct rte_bus uacce_bus;
extern int uacce_bus_logtype;
@@ -229,7 +222,7 @@ uacce_scan_one(const char *dev_name)
return -ENOMEM;
dev->device.name = dev->name;
- dev->device.devargs = rte_bus_find_devargs(&uacce_bus.bus, dev_name);
+ dev->device.devargs = rte_bus_find_devargs(&uacce_bus, dev_name);
snprintf(dev->name, sizeof(dev->name), "%s", dev_name);
snprintf(dev->dev_root, sizeof(dev->dev_root), "%s/%s",
UACCE_BUS_CLASS_PATH, dev_name);
@@ -253,7 +246,7 @@ uacce_scan_one(const char *dev_name)
if (ret != 0)
goto err;
- rte_bus_add_device(&uacce_bus.bus, &dev->device);
+ rte_bus_add_device(&uacce_bus, &dev->device);
return 0;
err:
@@ -283,7 +276,7 @@ uacce_scan(void)
continue;
}
- if (rte_bus_device_is_ignored(&uacce_bus.bus, e->d_name))
+ if (rte_bus_device_is_ignored(&uacce_bus, e->d_name))
continue;
if (uacce_scan_one(e->d_name) < 0)
@@ -379,7 +372,7 @@ uacce_cleanup(void)
struct rte_uacce_device *dev;
int error = 0;
- RTE_BUS_FOREACH_DEV(dev, &uacce_bus.bus) {
+ RTE_BUS_FOREACH_DEV(dev, &uacce_bus) {
const struct rte_uacce_driver *dr;
int ret = 0;
@@ -397,7 +390,7 @@ uacce_cleanup(void)
dev->device.driver = NULL;
free:
- rte_bus_remove_device(&uacce_bus.bus, &dev->device);
+ rte_bus_remove_device(&uacce_bus, &dev->device);
free(dev);
}
@@ -431,7 +424,7 @@ uacce_unplug(struct rte_device *dev)
ret = uacce_detach_dev(uacce_dev);
if (ret == 0) {
- rte_bus_remove_device(&uacce_bus.bus, &uacce_dev->device);
+ rte_bus_remove_device(&uacce_bus, &uacce_dev->device);
rte_devargs_remove(dev->devargs);
free(uacce_dev);
}
@@ -550,29 +543,27 @@ RTE_EXPORT_INTERNAL_SYMBOL(rte_uacce_register)
void
rte_uacce_register(struct rte_uacce_driver *driver)
{
- rte_bus_add_driver(&uacce_bus.bus, &driver->driver);
+ rte_bus_add_driver(&uacce_bus, &driver->driver);
}
RTE_EXPORT_INTERNAL_SYMBOL(rte_uacce_unregister)
void
rte_uacce_unregister(struct rte_uacce_driver *driver)
{
- rte_bus_remove_driver(&uacce_bus.bus, &driver->driver);
+ rte_bus_remove_driver(&uacce_bus, &driver->driver);
}
-static struct rte_uacce_bus uacce_bus = {
- .bus = {
- .scan = uacce_scan,
- .probe = rte_bus_generic_probe,
- .cleanup = uacce_cleanup,
- .match = uacce_bus_match,
- .probe_device = uacce_probe_device,
- .unplug = uacce_unplug,
- .find_device = rte_bus_generic_find_device,
- .parse = uacce_parse,
- .dev_iterate = rte_bus_generic_dev_iterate,
- },
+static struct rte_bus uacce_bus = {
+ .scan = uacce_scan,
+ .probe = rte_bus_generic_probe,
+ .cleanup = uacce_cleanup,
+ .match = uacce_bus_match,
+ .probe_device = uacce_probe_device,
+ .unplug = uacce_unplug,
+ .find_device = rte_bus_generic_find_device,
+ .parse = uacce_parse,
+ .dev_iterate = rte_bus_generic_dev_iterate,
};
-RTE_REGISTER_BUS(uacce, uacce_bus.bus);
+RTE_REGISTER_BUS(uacce, uacce_bus);
RTE_LOG_REGISTER_DEFAULT(uacce_bus_logtype, NOTICE);
diff --git a/drivers/bus/vmbus/linux/vmbus_bus.c b/drivers/bus/vmbus/linux/vmbus_bus.c
index 6268a14d40..0af10f6a69 100644
--- a/drivers/bus/vmbus/linux/vmbus_bus.c
+++ b/drivers/bus/vmbus/linux/vmbus_bus.c
@@ -39,8 +39,6 @@ static const rte_uuid_t vmbus_nic_uuid = {
0xf2, 0xd2, 0xf9, 0x65, 0xed, 0xe
};
-extern struct rte_vmbus_bus rte_vmbus_bus;
-
/* Read sysfs file to get UUID */
static int
parse_sysfs_uuid(const char *filename, rte_uuid_t uu)
@@ -332,7 +330,7 @@ vmbus_scan_one(const char *name)
dev->monitor_id = UINT8_MAX;
}
- dev->device.devargs = rte_bus_find_devargs(&rte_vmbus_bus.bus, dev_name);
+ dev->device.devargs = rte_bus_find_devargs(&rte_vmbus_bus, dev_name);
dev->device.numa_node = SOCKET_ID_ANY;
if (vmbus_use_numa(dev)) {
@@ -356,7 +354,7 @@ vmbus_scan_one(const char *name)
/* device is valid, add in list (sorted) */
VMBUS_LOG(DEBUG, "Adding vmbus device %s", name);
- RTE_BUS_FOREACH_DEV(dev2, &rte_vmbus_bus.bus) {
+ RTE_BUS_FOREACH_DEV(dev2, &rte_vmbus_bus) {
int ret;
ret = rte_uuid_compare(dev->device_id, dev2->device_id);
@@ -364,7 +362,7 @@ vmbus_scan_one(const char *name)
continue;
if (ret < 0) {
- rte_bus_insert_device(&rte_vmbus_bus.bus, &dev2->device, &dev->device);
+ rte_bus_insert_device(&rte_vmbus_bus, &dev2->device, &dev->device);
} else { /* already registered */
VMBUS_LOG(NOTICE,
"%s already registered", name);
@@ -374,7 +372,7 @@ vmbus_scan_one(const char *name)
return 0;
}
- rte_bus_add_device(&rte_vmbus_bus.bus, &dev->device);
+ rte_bus_add_device(&rte_vmbus_bus, &dev->device);
return 0;
error:
VMBUS_LOG(DEBUG, "failed");
diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index 6abb97c607..6efac86b77 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -15,14 +15,7 @@
#include <rte_eal_paging.h>
#include <rte_vmbus_reg.h>
-/**
- * Structure describing the VM bus
- */
-struct rte_vmbus_bus {
- struct rte_bus bus; /**< Inherit the generic class */
-};
-
-extern struct rte_vmbus_bus rte_vmbus_bus;
+extern struct rte_bus rte_vmbus_bus;
extern int vmbus_logtype_bus;
#define RTE_LOGTYPE_VMBUS_BUS vmbus_logtype_bus
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index 2b1730afc2..01573927ce 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -23,8 +23,6 @@
#include "private.h"
-extern struct rte_vmbus_bus rte_vmbus_bus;
-
/* map a particular resource from a file */
void *
vmbus_map_resource(void *requested_addr, int fd, off_t offset, size_t size,
@@ -128,7 +126,7 @@ RTE_EXPORT_SYMBOL(rte_vmbus_probe)
int
rte_vmbus_probe(void)
{
- return rte_bus_generic_probe(&rte_vmbus_bus.bus);
+ return rte_bus_generic_probe(&rte_vmbus_bus);
}
static int
@@ -137,7 +135,7 @@ rte_vmbus_cleanup(void)
struct rte_vmbus_device *dev;
int error = 0;
- RTE_BUS_FOREACH_DEV(dev, &rte_vmbus_bus.bus) {
+ RTE_BUS_FOREACH_DEV(dev, &rte_vmbus_bus) {
const struct rte_vmbus_driver *drv;
int ret;
@@ -154,7 +152,7 @@ rte_vmbus_cleanup(void)
rte_vmbus_unmap_device(dev);
dev->device.driver = NULL;
- rte_bus_remove_device(&rte_vmbus_bus.bus, &dev->device);
+ rte_bus_remove_device(&rte_vmbus_bus, &dev->device);
free(dev);
}
@@ -194,7 +192,7 @@ rte_vmbus_register(struct rte_vmbus_driver *driver)
VMBUS_LOG(DEBUG,
"Registered driver %s", driver->driver.name);
- rte_bus_add_driver(&rte_vmbus_bus.bus, &driver->driver);
+ rte_bus_add_driver(&rte_vmbus_bus, &driver->driver);
}
/* unregister vmbus driver */
@@ -202,22 +200,20 @@ RTE_EXPORT_INTERNAL_SYMBOL(rte_vmbus_unregister)
void
rte_vmbus_unregister(struct rte_vmbus_driver *driver)
{
- rte_bus_remove_driver(&rte_vmbus_bus.bus, &driver->driver);
+ rte_bus_remove_driver(&rte_vmbus_bus, &driver->driver);
}
/* VMBUS doesn't support hotplug */
-struct rte_vmbus_bus rte_vmbus_bus = {
- .bus = {
- .scan = rte_vmbus_scan,
- .probe = rte_bus_generic_probe,
- .cleanup = rte_vmbus_cleanup,
- .find_device = rte_bus_generic_find_device,
- .match = vmbus_bus_match,
- .probe_device = vmbus_probe_device,
- .parse = vmbus_parse,
- .dev_compare = vmbus_dev_compare,
- },
+struct rte_bus rte_vmbus_bus = {
+ .scan = rte_vmbus_scan,
+ .probe = rte_bus_generic_probe,
+ .cleanup = rte_vmbus_cleanup,
+ .find_device = rte_bus_generic_find_device,
+ .match = vmbus_bus_match,
+ .probe_device = vmbus_probe_device,
+ .parse = vmbus_parse,
+ .dev_compare = vmbus_dev_compare,
};
-RTE_REGISTER_BUS(vmbus, rte_vmbus_bus.bus);
+RTE_REGISTER_BUS(vmbus, rte_vmbus_bus);
RTE_LOG_REGISTER_DEFAULT(vmbus_logtype_bus, NOTICE);
--
2.53.0
^ permalink raw reply related
* [PATCH v4 22/25] drivers/bus: separate specific bus metadata for NXP drivers
From: David Marchand @ 2026-05-27 7:56 UTC (permalink / raw)
To: dev; +Cc: thomas, stephen, bruce.richardson, Hemant Agrawal, Sachin Saxena
In-Reply-To: <20260527075654.3780732-1-david.marchand@redhat.com>
As a preparation for the next commit, split the specific bus types and
move specific fields to a private structure/singleton variable.
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/bus/dpaa/dpaa_bus.c | 55 ++++++++++++++++++++---------------
drivers/bus/fslmc/fslmc_bus.c | 6 ++--
drivers/bus/fslmc/private.h | 2 --
3 files changed, 34 insertions(+), 29 deletions(-)
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index ade093cd13..08c1607647 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -59,6 +59,9 @@
struct rte_dpaa_bus {
struct rte_bus bus;
+};
+
+struct rte_dpaa_bus_private {
int device_count;
int detected;
uint32_t svr_ver;
@@ -67,6 +70,7 @@ struct rte_dpaa_bus {
};
static struct rte_dpaa_bus rte_dpaa_bus;
+static struct rte_dpaa_bus_private dpaa_bus;
static struct netcfg_info *dpaa_netcfg;
/* define a variable to hold the portal_key, once created.*/
@@ -87,7 +91,7 @@ RTE_EXPORT_INTERNAL_SYMBOL(dpaa_get_eth_port_cfg)
RTE_EXPORT_INTERNAL_SYMBOL(dpaa_soc_ver)
uint32_t dpaa_soc_ver(void)
{
- return rte_dpaa_bus.svr_ver;
+ return dpaa_bus.svr_ver;
}
struct fm_eth_port_cfg *
@@ -103,11 +107,11 @@ dpaa_push_queue_num_update(void)
int ret = false;
uint16_t current, new_val;
- current = rte_atomic_load_explicit(&rte_dpaa_bus.push_rxq_num,
+ current = rte_atomic_load_explicit(&dpaa_bus.push_rxq_num,
rte_memory_order_acquire);
- if (current < rte_dpaa_bus.max_push_rxq_num) {
+ if (current < dpaa_bus.max_push_rxq_num) {
new_val = current + 1;
- if (rte_atomic_compare_exchange_strong_explicit(&rte_dpaa_bus.push_rxq_num,
+ if (rte_atomic_compare_exchange_strong_explicit(&dpaa_bus.push_rxq_num,
¤t, new_val,
rte_memory_order_release,
rte_memory_order_acquire))
@@ -121,7 +125,7 @@ RTE_EXPORT_INTERNAL_SYMBOL(dpaa_push_queue_max_num)
uint16_t
dpaa_push_queue_max_num(void)
{
- return rte_dpaa_bus.max_push_rxq_num;
+ return dpaa_bus.max_push_rxq_num;
}
static int
@@ -204,7 +208,7 @@ dpaa_create_device_list(void)
struct fm_eth_port_cfg *cfg;
struct fman_if *fman_intf;
- rte_dpaa_bus.device_count = 0;
+ dpaa_bus.device_count = 0;
/* Creating Ethernet Devices */
for (i = 0; dpaa_netcfg && (i < dpaa_netcfg->num_ethports); i++) {
@@ -256,7 +260,7 @@ dpaa_create_device_list(void)
dpaa_add_to_device_list(dev);
}
- rte_dpaa_bus.device_count += i;
+ dpaa_bus.device_count += i;
/* Unlike case of ETH, RTE_LIBRTE_DPAA_MAX_CRYPTODEV SEC devices are
* constantly created only if "sec" property is found in the device
@@ -289,7 +293,7 @@ dpaa_create_device_list(void)
}
dev->device_type = FSL_DPAA_CRYPTO;
- dev->id.dev_id = rte_dpaa_bus.device_count + i;
+ dev->id.dev_id = dpaa_bus.device_count + i;
/* Even though RTE_CRYPTODEV_NAME_MAX_LEN is valid length of
* crypto PMD, using RTE_ETH_NAME_MAX_LEN as that is the size
@@ -306,7 +310,7 @@ dpaa_create_device_list(void)
dpaa_add_to_device_list(dev);
}
- rte_dpaa_bus.device_count += i;
+ dpaa_bus.device_count += i;
qdma_dpaa:
/* Creating QDMA Device */
@@ -319,7 +323,7 @@ dpaa_create_device_list(void)
}
dev->device_type = FSL_DPAA_QDMA;
- dev->id.dev_id = rte_dpaa_bus.device_count + i;
+ dev->id.dev_id = dpaa_bus.device_count + i;
memset(dev->name, 0, RTE_ETH_NAME_MAX_LEN);
sprintf(dev->name, "dpaa_qdma-%d", i+1);
@@ -331,7 +335,7 @@ dpaa_create_device_list(void)
dpaa_add_to_device_list(dev);
}
- rte_dpaa_bus.device_count += i;
+ dpaa_bus.device_count += i;
return 0;
@@ -688,10 +692,10 @@ rte_dpaa_bus_scan(void)
return 0;
}
- if (rte_dpaa_bus.detected)
+ if (dpaa_bus.detected)
return 0;
- rte_dpaa_bus.detected = 1;
+ dpaa_bus.detected = 1;
/* create the key, supplying a function that'll be invoked
* when a portal affined thread will be deleted.
@@ -707,34 +711,34 @@ rte_dpaa_bus_scan(void)
svr_file = fopen(DPAA_SOC_ID_FILE, "r");
if (svr_file) {
if (fscanf(svr_file, "svr:%x", &svr_ver) > 0)
- rte_dpaa_bus.svr_ver = svr_ver & DPAA_SVR_MASK;
+ dpaa_bus.svr_ver = svr_ver & DPAA_SVR_MASK;
else
- rte_dpaa_bus.svr_ver = 0;
+ dpaa_bus.svr_ver = 0;
fclose(svr_file);
} else {
- rte_dpaa_bus.svr_ver = 0;
+ dpaa_bus.svr_ver = 0;
}
- if (rte_dpaa_bus.svr_ver == SVR_LS1046A_FAMILY) {
+ if (dpaa_bus.svr_ver == SVR_LS1046A_FAMILY) {
DPAA_BUS_LOG(INFO, "This is LS1046A family SoC.");
- } else if (rte_dpaa_bus.svr_ver == SVR_LS1043A_FAMILY) {
+ } else if (dpaa_bus.svr_ver == SVR_LS1043A_FAMILY) {
DPAA_BUS_LOG(INFO, "This is LS1043A family SoC.");
} else {
DPAA_BUS_LOG(WARNING,
"This is Unknown(%08x) DPAA1 family SoC.",
- rte_dpaa_bus.svr_ver);
+ dpaa_bus.svr_ver);
}
/* Disabling the default push mode for LS1043A */
- if (rte_dpaa_bus.svr_ver == SVR_LS1043A_FAMILY) {
- rte_dpaa_bus.max_push_rxq_num = 0;
+ if (dpaa_bus.svr_ver == SVR_LS1043A_FAMILY) {
+ dpaa_bus.max_push_rxq_num = 0;
return 0;
}
penv = getenv("DPAA_PUSH_QUEUES_NUMBER");
if (penv)
- rte_dpaa_bus.max_push_rxq_num = atoi(penv);
- if (rte_dpaa_bus.max_push_rxq_num > DPAA_MAX_PUSH_MODE_QUEUE)
- rte_dpaa_bus.max_push_rxq_num = DPAA_MAX_PUSH_MODE_QUEUE;
+ dpaa_bus.max_push_rxq_num = atoi(penv);
+ if (dpaa_bus.max_push_rxq_num > DPAA_MAX_PUSH_MODE_QUEUE)
+ dpaa_bus.max_push_rxq_num = DPAA_MAX_PUSH_MODE_QUEUE;
/* Device list creation is only done once */
if (!process_once) {
@@ -868,6 +872,9 @@ static struct rte_dpaa_bus rte_dpaa_bus = {
.dev_iterate = rte_bus_generic_dev_iterate,
.cleanup = dpaa_bus_cleanup,
},
+};
+
+static struct rte_dpaa_bus_private dpaa_bus = {
.max_push_rxq_num = DPAA_DEFAULT_PUSH_MODE_QUEUE,
.device_count = 0,
};
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index d855d6b36b..821fe63955 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -28,6 +28,7 @@
#define VFIO_IOMMU_GROUP_PATH "/sys/kernel/iommu_groups"
struct rte_fslmc_bus rte_fslmc_bus;
+static int fslmc_bus_device_count[DPAA2_DEVTYPE_MAX];
#define DPAA2_SEQN_DYNFIELD_NAME "dpaa2_seqn_dynfield"
RTE_EXPORT_INTERNAL_SYMBOL(dpaa2_seqn_dynfield_offset)
@@ -39,7 +40,7 @@ rte_fslmc_get_device_count(enum rte_dpaa2_dev_type device_type)
{
if (device_type >= DPAA2_DEVTYPE_MAX)
return 0;
- return rte_fslmc_bus.device_count[device_type];
+ return fslmc_bus_device_count[device_type];
}
static void
@@ -200,7 +201,7 @@ scan_one_fslmc_device(char *dev_name)
dev->device.devargs = rte_bus_find_devargs(&rte_fslmc_bus.bus, dev_name);
/* Update the device found into the device_count table */
- rte_fslmc_bus.device_count[dev->dev_type]++;
+ fslmc_bus_device_count[dev->dev_type]++;
/* Add device in the fslmc device list */
insert_in_device_list(dev);
@@ -559,7 +560,6 @@ struct rte_fslmc_bus rte_fslmc_bus = {
.unplug = fslmc_bus_unplug,
.dev_iterate = rte_bus_generic_dev_iterate,
},
- .device_count = {0},
};
RTE_REGISTER_BUS(fslmc, rte_fslmc_bus.bus);
diff --git a/drivers/bus/fslmc/private.h b/drivers/bus/fslmc/private.h
index 2fe592f24d..a0dda4f9d6 100644
--- a/drivers/bus/fslmc/private.h
+++ b/drivers/bus/fslmc/private.h
@@ -14,8 +14,6 @@
*/
struct rte_fslmc_bus {
struct rte_bus bus; /**< Generic Bus object */
- int device_count[DPAA2_DEVTYPE_MAX];
- /**< Count of all devices scanned */
};
extern struct rte_fslmc_bus rte_fslmc_bus;
--
2.53.0
^ permalink raw reply related
* [PATCH v4 21/25] dma/idxd: remove specific bus type
From: David Marchand @ 2026-05-27 7:56 UTC (permalink / raw)
To: dev; +Cc: thomas, stephen, bruce.richardson, Kevin Laatz
In-Reply-To: <20260527075654.3780732-1-david.marchand@redhat.com>
There is nothing that requires a specific bus type.
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/dma/idxd/idxd_bus.c | 38 ++++++++++++++-----------------------
1 file changed, 14 insertions(+), 24 deletions(-)
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index 1a9c07580e..4810d52f2a 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -41,34 +41,24 @@ struct rte_dsa_device {
};
/* forward prototypes */
-struct dsa_bus;
static int dsa_scan(void);
static bool dsa_match(const struct rte_driver *drv, const struct rte_device *dev);
static int dsa_probe_device(struct rte_driver *drv, struct rte_device *dev);
static enum rte_iova_mode dsa_get_iommu_class(void);
static int dsa_addr_parse(const char *name, void *addr);
-/**
- * Structure describing the DSA bus
- */
-struct dsa_bus {
- struct rte_bus bus; /**< Inherit the generic class */
- struct rte_driver driver; /**< Driver struct for devices to point to */
+struct rte_bus dsa_bus = {
+ .scan = dsa_scan,
+ .probe = rte_bus_generic_probe,
+ .match = dsa_match,
+ .probe_device = dsa_probe_device,
+ .find_device = rte_bus_generic_find_device,
+ .get_iommu_class = dsa_get_iommu_class,
+ .parse = dsa_addr_parse,
};
-struct dsa_bus dsa_bus = {
- .bus = {
- .scan = dsa_scan,
- .probe = rte_bus_generic_probe,
- .match = dsa_match,
- .probe_device = dsa_probe_device,
- .find_device = rte_bus_generic_find_device,
- .get_iommu_class = dsa_get_iommu_class,
- .parse = dsa_addr_parse,
- },
- .driver = {
- .name = "dmadev_idxd",
- },
+struct rte_driver dsa_driver = {
+ .name = "dmadev_idxd",
};
static inline const char *
@@ -267,7 +257,7 @@ static bool dsa_match(const struct rte_driver *drv, const struct rte_device *dev
{
const struct rte_dsa_device *dsa_dev = RTE_BUS_DEVICE(dev, *dsa_dev);
- if (drv == &dsa_bus.driver) {
+ if (drv == &dsa_driver) {
char type[64], name[64];
if (read_wq_string(dsa_dev, "type", type, sizeof(type)) >= 0 &&
@@ -319,7 +309,7 @@ dsa_scan(void)
continue;
}
strlcpy(dev->wq_name, wq->d_name, sizeof(dev->wq_name));
- rte_bus_add_device(&dsa_bus.bus, &dev->device);
+ rte_bus_add_device(&dsa_bus, &dev->device);
devcount++;
read_device_int(dev, "numa_node", &numa_node);
@@ -357,8 +347,8 @@ dsa_addr_parse(const char *name, void *addr)
return 0;
}
-RTE_REGISTER_BUS(dsa, dsa_bus.bus);
+RTE_REGISTER_BUS(dsa, dsa_bus);
RTE_INIT(dsa_bus_init)
{
- rte_bus_add_driver(&dsa_bus.bus, &dsa_bus.driver);
+ rte_bus_add_driver(&dsa_bus, &dsa_driver);
}
--
2.53.0
^ permalink raw reply related
* [PATCH v4 20/25] drivers/bus: remove bus-specific driver references
From: David Marchand @ 2026-05-27 7:56 UTC (permalink / raw)
To: dev
Cc: thomas, stephen, bruce.richardson, Parav Pandit, Xueming Li,
Nipun Gupta, Nikhil Agarwal, Hemant Agrawal, Sachin Saxena,
Rosen Xu, Chenbo Xia, Tomasz Duszynski, Chengwen Feng, Long Li,
Wei Hu
In-Reply-To: <20260527075654.3780732-1-david.marchand@redhat.com>
With the driver reference being set in the EAL before calling
bus->probe_device, buses now rely on the generic device.driver
field instead of maintaining their own bus-specific driver pointers.
This patch removes the use of bus-specific driver fields in favor
of the generic device.driver field, accessed through the RTE_BUS_DRIVER
macro in remove/cleanup paths.
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/bus/auxiliary/auxiliary_common.c | 4 ----
drivers/bus/auxiliary/bus_auxiliary_driver.h | 1 -
drivers/bus/cdx/bus_cdx_driver.h | 1 -
drivers/bus/cdx/cdx.c | 2 --
drivers/bus/dpaa/bus_dpaa_driver.h | 1 -
drivers/bus/dpaa/dpaa_bus.c | 3 ---
drivers/bus/fslmc/bus_fslmc_driver.h | 1 -
drivers/bus/fslmc/fslmc_bus.c | 2 --
drivers/bus/ifpga/bus_ifpga_driver.h | 1 -
drivers/bus/ifpga/ifpga_bus.c | 12 +-----------
drivers/bus/pci/bus_pci_driver.h | 1 -
drivers/bus/pci/pci_common.c | 5 -----
drivers/bus/platform/bus_platform_driver.h | 1 -
drivers/bus/platform/platform.c | 5 +----
drivers/bus/uacce/bus_uacce_driver.h | 1 -
drivers/bus/uacce/uacce.c | 3 ---
drivers/bus/vmbus/bus_vmbus_driver.h | 1 -
drivers/bus/vmbus/vmbus_common.c | 8 +-------
18 files changed, 3 insertions(+), 50 deletions(-)
diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index 2000ffa369..ff05716539 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -111,13 +111,10 @@ auxiliary_probe_device(struct rte_driver *drv, struct rte_device *dev)
return -ENOMEM;
}
- aux_dev->driver = aux_drv;
-
AUXILIARY_LOG(INFO, "Probe auxiliary driver: %s device: %s (NUMA node %i)",
aux_drv->driver.name, aux_dev->name, aux_dev->device.numa_node);
ret = aux_drv->probe(aux_drv, aux_dev);
if (ret != 0) {
- aux_dev->driver = NULL;
rte_intr_instance_free(aux_dev->intr_handle);
aux_dev->intr_handle = NULL;
}
@@ -144,7 +141,6 @@ rte_auxiliary_driver_remove_dev(struct rte_auxiliary_device *dev)
}
/* clear driver structure */
- dev->driver = NULL;
dev->device.driver = NULL;
return 0;
diff --git a/drivers/bus/auxiliary/bus_auxiliary_driver.h b/drivers/bus/auxiliary/bus_auxiliary_driver.h
index 165145b15e..cab5f86d03 100644
--- a/drivers/bus/auxiliary/bus_auxiliary_driver.h
+++ b/drivers/bus/auxiliary/bus_auxiliary_driver.h
@@ -113,7 +113,6 @@ struct rte_auxiliary_device {
struct rte_device device; /**< Inherit core device */
char name[RTE_DEV_NAME_MAX_LEN + 1]; /**< ASCII device name */
struct rte_intr_handle *intr_handle; /**< Interrupt handle */
- struct rte_auxiliary_driver *driver; /**< Device driver */
};
/**
diff --git a/drivers/bus/cdx/bus_cdx_driver.h b/drivers/bus/cdx/bus_cdx_driver.h
index aa62ab5730..aa44dee5a6 100644
--- a/drivers/bus/cdx/bus_cdx_driver.h
+++ b/drivers/bus/cdx/bus_cdx_driver.h
@@ -54,7 +54,6 @@ struct rte_cdx_id {
*/
struct rte_cdx_device {
struct rte_device device; /**< Inherit core device */
- struct rte_cdx_driver *driver; /**< CDX driver used in probing */
char name[RTE_DEV_NAME_MAX_LEN]; /**< Device name */
struct rte_cdx_id id; /**< CDX ID. */
struct rte_mem_resource mem_resource[RTE_CDX_MAX_RESOURCE];
diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
index 5a823a0dcd..cb4f755b8e 100644
--- a/drivers/bus/cdx/cdx.c
+++ b/drivers/bus/cdx/cdx.c
@@ -333,7 +333,6 @@ cdx_probe_device(struct rte_driver *drv, struct rte_device *dev)
cdx_drv->driver.name, dev_name, ret);
goto error_probe;
}
- cdx_dev->driver = cdx_drv;
return ret;
@@ -395,7 +394,6 @@ cdx_detach_dev(struct rte_cdx_device *dev)
}
/* clear driver structure */
- dev->driver = NULL;
dev->device.driver = NULL;
rte_cdx_unmap_device(dev);
diff --git a/drivers/bus/dpaa/bus_dpaa_driver.h b/drivers/bus/dpaa/bus_dpaa_driver.h
index 7e5e9b2126..5ddb52c419 100644
--- a/drivers/bus/dpaa/bus_dpaa_driver.h
+++ b/drivers/bus/dpaa/bus_dpaa_driver.h
@@ -85,7 +85,6 @@ struct rte_dpaa_device {
struct rte_cryptodev *crypto_dev;
struct rte_dma_dev *dmadev;
};
- struct rte_dpaa_driver *driver;
struct dpaa_device_id id;
struct rte_intr_handle *intr_handle;
enum rte_dpaa_type device_type; /**< Ethernet or crypto type device */
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 0fd6a8d7a6..ade093cd13 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -802,8 +802,6 @@ dpaa_bus_probe_device(struct rte_driver *drv, struct rte_device *dev)
ret = dpaa_drv->probe(dpaa_drv, dpaa_dev);
if (ret != 0)
DPAA_BUS_ERR("unable to probe: %s", dpaa_dev->name);
- else
- dpaa_dev->driver = dpaa_drv;
return ret;
}
@@ -828,7 +826,6 @@ dpaa_bus_cleanup(void)
rte_errno = errno;
return -1;
}
- dev->driver = NULL;
dev->device.driver = NULL;
}
dpaa_portal_finish((void *)DPAA_PER_LCORE_PORTAL);
diff --git a/drivers/bus/fslmc/bus_fslmc_driver.h b/drivers/bus/fslmc/bus_fslmc_driver.h
index ab8bc1c41d..44f81cf662 100644
--- a/drivers/bus/fslmc/bus_fslmc_driver.h
+++ b/drivers/bus/fslmc/bus_fslmc_driver.h
@@ -101,7 +101,6 @@ struct rte_dpaa2_device {
uint16_t ep_object_id; /**< Endpoint DPAA2 Object ID */
char ep_name[RTE_DEV_NAME_MAX_LEN];
struct rte_intr_handle *intr_handle; /**< Interrupt handle */
- struct rte_dpaa2_driver *driver; /**< Associated driver */
char name[FSLMC_OBJECT_MAX_LEN]; /**< DPAA2 Object name*/
};
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index e33b63259d..d855d6b36b 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -523,7 +523,6 @@ fslmc_bus_probe_device(struct rte_driver *driver, struct rte_device *rte_dev)
if (ret != 0) {
DPAA2_BUS_ERR("Unable to probe");
} else {
- dev->driver = drv;
DPAA2_BUS_INFO("%s Plugged", dev->device.name);
}
@@ -538,7 +537,6 @@ fslmc_bus_unplug(struct rte_device *rte_dev)
if (drv->remove != NULL) {
drv->remove(dev);
- dev->driver = NULL;
dev->device.driver = NULL;
DPAA2_BUS_INFO("%s Un-Plugged", dev->device.name);
return 0;
diff --git a/drivers/bus/ifpga/bus_ifpga_driver.h b/drivers/bus/ifpga/bus_ifpga_driver.h
index b56916167c..4df95485c9 100644
--- a/drivers/bus/ifpga/bus_ifpga_driver.h
+++ b/drivers/bus/ifpga/bus_ifpga_driver.h
@@ -75,7 +75,6 @@ struct rte_afu_device {
/**< AFU Memory Resource */
struct rte_afu_shared shared;
struct rte_intr_handle *intr_handle; /**< Interrupt handle */
- struct rte_afu_driver *driver; /**< Associated driver */
char path[IFPGA_BUS_BITSTREAM_PATH_MAX_LEN];
};
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index b13285230b..2c22329f65 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -272,17 +272,8 @@ ifpga_probe_device(struct rte_driver *drv, struct rte_device *dev)
{
struct rte_afu_device *afu_dev = RTE_BUS_DEVICE(dev, *afu_dev);
struct rte_afu_driver *afu_drv = RTE_BUS_DRIVER(drv, *afu_drv);
- int ret;
-
- /* reference driver structure */
- afu_dev->driver = afu_drv;
-
- /* call the driver probe() function */
- ret = afu_drv->probe(afu_dev);
- if (ret)
- afu_dev->driver = NULL;
- return ret;
+ return afu_drv->probe(afu_dev);
}
/*
@@ -310,7 +301,6 @@ ifpga_cleanup(void)
rte_errno = errno;
error = -1;
}
- afu_dev->driver = NULL;
afu_dev->device.driver = NULL;
free:
diff --git a/drivers/bus/pci/bus_pci_driver.h b/drivers/bus/pci/bus_pci_driver.h
index b0e5428e64..cb7039f8d6 100644
--- a/drivers/bus/pci/bus_pci_driver.h
+++ b/drivers/bus/pci/bus_pci_driver.h
@@ -39,7 +39,6 @@ struct rte_pci_device {
struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE];
/**< PCI Memory Resource */
struct rte_intr_handle *intr_handle; /**< Interrupt handle */
- struct rte_pci_driver *driver; /**< PCI driver used in probing */
uint16_t max_vfs; /**< sriov enable if not zero */
enum rte_pci_kernel_driver kdrv; /**< Kernel driver passthrough */
char name[PCI_PRI_STR_SIZE+1]; /**< PCI location (ASCII) */
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index e927f4af7b..2bdb94a924 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -245,11 +245,9 @@ pci_probe_device(struct rte_driver *drv, struct rte_device *dev)
return -ENOMEM;
}
- pci_dev->driver = pci_drv;
if (pci_drv->drv_flags & RTE_PCI_DRV_NEED_MAPPING) {
ret = rte_pci_map_device(pci_dev);
if (ret != 0) {
- pci_dev->driver = NULL;
rte_intr_instance_free(pci_dev->vfio_req_intr_handle);
pci_dev->vfio_req_intr_handle = NULL;
rte_intr_instance_free(pci_dev->intr_handle);
@@ -268,7 +266,6 @@ pci_probe_device(struct rte_driver *drv, struct rte_device *dev)
if (already_probed)
return ret; /* no rollback if already succeeded earlier */
if (ret) {
- pci_dev->driver = NULL;
if ((pci_drv->drv_flags & RTE_PCI_DRV_NEED_MAPPING) &&
/* Don't unmap if device is unsupported and
* driver needs mapped resources.
@@ -312,7 +309,6 @@ rte_pci_detach_dev(struct rte_pci_device *dev)
}
/* clear driver structure */
- dev->driver = NULL;
dev->device.driver = NULL;
if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING)
@@ -348,7 +344,6 @@ pci_cleanup(void)
rte_errno = errno;
error = -1;
}
- dev->driver = NULL;
dev->device.driver = NULL;
free:
diff --git a/drivers/bus/platform/bus_platform_driver.h b/drivers/bus/platform/bus_platform_driver.h
index 3912ed5b85..3ac405a201 100644
--- a/drivers/bus/platform/bus_platform_driver.h
+++ b/drivers/bus/platform/bus_platform_driver.h
@@ -95,7 +95,6 @@ struct rte_platform_resource {
*/
struct rte_platform_device {
struct rte_device device; /**< Core device */
- struct rte_platform_driver *driver; /**< Matching device driver */
char name[RTE_DEV_NAME_MAX_LEN]; /**< Device name */
unsigned int num_resource; /**< Number of device resources */
struct rte_platform_resource *resource; /**< Device resources */
diff --git a/drivers/bus/platform/platform.c b/drivers/bus/platform/platform.c
index 433bab9b60..4492ed62ec 100644
--- a/drivers/bus/platform/platform.c
+++ b/drivers/bus/platform/platform.c
@@ -329,10 +329,8 @@ device_setup(struct rte_platform_device *pdev)
static int
driver_call_probe(struct rte_platform_driver *pdrv, struct rte_platform_device *pdev)
{
- if (pdrv->probe != NULL) {
- pdev->driver = pdrv;
+ if (pdrv->probe != NULL)
return pdrv->probe(pdev);
- }
return 0;
}
@@ -418,7 +416,6 @@ device_release_driver(struct rte_platform_device *pdev)
}
pdev->device.driver = NULL;
- pdev->driver = NULL;
}
static int
diff --git a/drivers/bus/uacce/bus_uacce_driver.h b/drivers/bus/uacce/bus_uacce_driver.h
index 04ced912c9..afed71bb67 100644
--- a/drivers/bus/uacce/bus_uacce_driver.h
+++ b/drivers/bus/uacce/bus_uacce_driver.h
@@ -44,7 +44,6 @@ struct rte_uacce_driver;
*/
struct rte_uacce_device {
struct rte_device device; /**< Inherit core device. */
- struct rte_uacce_driver *driver; /**< Driver used in probing. */
char name[RTE_DEV_NAME_MAX_LEN]; /**< Device name. */
char dev_root[RTE_UACCE_DEV_PATH_SIZE]; /**< Sysfs path with device name. */
char cdev_path[RTE_UACCE_DEV_PATH_SIZE]; /**< Device path in devfs. */
diff --git a/drivers/bus/uacce/uacce.c b/drivers/bus/uacce/uacce.c
index ead920d261..db49e887ad 100644
--- a/drivers/bus/uacce/uacce.c
+++ b/drivers/bus/uacce/uacce.c
@@ -366,7 +366,6 @@ uacce_probe_device(struct rte_driver *drv, struct rte_device *dev)
UACCE_BUS_ERR("probe device %s with driver %s failed %d",
dev_name, uacce_drv->driver.name, ret);
} else {
- uacce_dev->driver = uacce_drv;
UACCE_BUS_DEBUG("probe device %s with driver %s success",
dev_name, uacce_drv->driver.name);
}
@@ -395,7 +394,6 @@ uacce_cleanup(void)
rte_errno = errno;
error = -1;
}
- dev->driver = NULL;
dev->device.driver = NULL;
free:
@@ -420,7 +418,6 @@ uacce_detach_dev(struct rte_uacce_device *dev)
return ret;
}
- dev->driver = NULL;
dev->device.driver = NULL;
return 0;
diff --git a/drivers/bus/vmbus/bus_vmbus_driver.h b/drivers/bus/vmbus/bus_vmbus_driver.h
index d53bda2340..888d856141 100644
--- a/drivers/bus/vmbus/bus_vmbus_driver.h
+++ b/drivers/bus/vmbus/bus_vmbus_driver.h
@@ -37,7 +37,6 @@ enum hv_uio_map {
* A structure describing a VMBUS device.
*/
struct rte_vmbus_device {
- const struct rte_vmbus_driver *driver; /**< Associated driver */
struct rte_device device; /**< Inherit core device */
rte_uuid_t device_id; /**< VMBUS device id */
rte_uuid_t class_id; /**< VMBUS device type */
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index b96f4133dd..2b1730afc2 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -107,19 +107,14 @@ vmbus_probe_device(struct rte_driver *drv, struct rte_device *dev)
if (ret != 0)
return ret;
- /* reference driver structure */
- vmbus_dev->driver = vmbus_drv;
-
if (vmbus_dev->device.numa_node < 0 && rte_socket_count() > 1)
VMBUS_LOG(INFO, "Device %s is not NUMA-aware", guid);
/* call the driver probe() function */
VMBUS_LOG(INFO, " probe driver: %s", vmbus_drv->driver.name);
ret = vmbus_drv->probe(vmbus_drv, vmbus_dev);
- if (ret != 0) {
- vmbus_dev->driver = NULL;
+ if (ret != 0)
rte_vmbus_unmap_device(vmbus_dev);
- }
return ret;
}
@@ -158,7 +153,6 @@ rte_vmbus_cleanup(void)
rte_vmbus_unmap_device(dev);
- dev->driver = NULL;
dev->device.driver = NULL;
rte_bus_remove_device(&rte_vmbus_bus.bus, &dev->device);
free(dev);
--
2.53.0
^ permalink raw reply related
* [PATCH v4 19/25] drivers: rely on generic driver
From: David Marchand @ 2026-05-27 7:56 UTC (permalink / raw)
To: dev
Cc: thomas, stephen, bruce.richardson, Parav Pandit, Xueming Li,
Nipun Gupta, Nikhil Agarwal, Hemant Agrawal, Sachin Saxena,
Rosen Xu, Chenbo Xia, Tomasz Duszynski, Chengwen Feng, Long Li,
Wei Hu, Kai Ji, Chengfei Han, Ming Ran, Christian Koue Muf,
Serhii Iliushyk, Jakub Palider, Akhil Goyal, Jingjing Wu,
Andrew Rybchenko
In-Reply-To: <20260527075654.3780732-1-david.marchand@redhat.com>
Now that the generic device object always references a generic driver, we
can rely on this reference and stop going through the bus-specific
driver reference.
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/bus/auxiliary/auxiliary_common.c | 12 +++++++-----
drivers/bus/cdx/cdx.c | 2 +-
drivers/bus/dpaa/dpaa_bus.c | 3 ++-
drivers/bus/fslmc/fslmc_bus.c | 2 +-
drivers/bus/fslmc/fslmc_vfio.c | 10 ++++++----
drivers/bus/ifpga/ifpga_bus.c | 6 ++++--
drivers/bus/pci/linux/pci_uio.c | 6 ++++--
drivers/bus/pci/pci_common.c | 20 +++++++++-----------
drivers/bus/platform/platform.c | 20 ++++++++++++--------
drivers/bus/uacce/uacce.c | 5 +++--
drivers/bus/vmbus/vmbus_common.c | 3 ++-
drivers/common/qat/qat_qp.c | 4 ++--
drivers/common/zsda/zsda_qp.c | 4 ++--
drivers/net/ntnic/ntnic_ethdev.c | 8 +++-----
drivers/raw/cnxk_bphy/cnxk_bphy.c | 2 +-
drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c | 2 +-
drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c | 2 +-
drivers/raw/ifpga/afu_pmd_core.c | 2 +-
drivers/raw/ifpga/ifpga_rawdev.c | 2 +-
drivers/raw/ntb/ntb.c | 2 +-
lib/ethdev/ethdev_pci.h | 7 +++++--
21 files changed, 69 insertions(+), 55 deletions(-)
diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index ba8c35ebbe..2000ffa369 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -131,7 +131,7 @@ auxiliary_probe_device(struct rte_driver *drv, struct rte_device *dev)
static int
rte_auxiliary_driver_remove_dev(struct rte_auxiliary_device *dev)
{
- struct rte_auxiliary_driver *drv = dev->driver;
+ const struct rte_auxiliary_driver *drv = RTE_BUS_DRIVER(dev->device.driver, *drv);
int ret = 0;
AUXILIARY_LOG(DEBUG, "Driver %s remove auxiliary device %s on NUMA node %i",
@@ -226,12 +226,13 @@ static int
auxiliary_dma_map(struct rte_device *dev, void *addr, uint64_t iova, size_t len)
{
struct rte_auxiliary_device *aux_dev = RTE_BUS_DEVICE(dev, *aux_dev);
+ const struct rte_auxiliary_driver *aux_drv = RTE_BUS_DRIVER(dev->driver, *aux_drv);
- if (aux_dev->driver->dma_map == NULL) {
+ if (aux_drv->dma_map == NULL) {
rte_errno = ENOTSUP;
return -1;
}
- return aux_dev->driver->dma_map(aux_dev, addr, iova, len);
+ return aux_drv->dma_map(aux_dev, addr, iova, len);
}
static int
@@ -239,12 +240,13 @@ auxiliary_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova,
size_t len)
{
struct rte_auxiliary_device *aux_dev = RTE_BUS_DEVICE(dev, *aux_dev);
+ const struct rte_auxiliary_driver *aux_drv = RTE_BUS_DRIVER(dev->driver, *aux_drv);
- if (aux_dev->driver->dma_unmap == NULL) {
+ if (aux_drv->dma_unmap == NULL) {
rte_errno = ENOTSUP;
return -1;
}
- return aux_dev->driver->dma_unmap(aux_dev, addr, iova, len);
+ return aux_drv->dma_unmap(aux_dev, addr, iova, len);
}
static enum rte_iova_mode
diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
index c6a4da7692..5a823a0dcd 100644
--- a/drivers/bus/cdx/cdx.c
+++ b/drivers/bus/cdx/cdx.c
@@ -382,7 +382,7 @@ rte_cdx_unregister(struct rte_cdx_driver *driver)
static int
cdx_detach_dev(struct rte_cdx_device *dev)
{
- struct rte_cdx_driver *dr = dev->driver;
+ const struct rte_cdx_driver *dr = RTE_BUS_DRIVER(dev->device.driver, *dr);
int ret = 0;
CDX_BUS_DEBUG("detach device %s using driver: %s",
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index b7d0caaf61..0fd6a8d7a6 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -815,11 +815,12 @@ dpaa_bus_cleanup(void)
BUS_INIT_FUNC_TRACE();
RTE_BUS_FOREACH_DEV(dev, &rte_dpaa_bus.bus) {
- struct rte_dpaa_driver *drv = dev->driver;
+ const struct rte_dpaa_driver *drv;
int ret = 0;
if (!rte_dev_is_probed(&dev->device))
continue;
+ drv = RTE_BUS_DRIVER(dev->device.driver, *drv);
if (drv->remove == NULL)
continue;
ret = drv->remove(dev);
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index ae69bd0da2..e33b63259d 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -534,7 +534,7 @@ static int
fslmc_bus_unplug(struct rte_device *rte_dev)
{
struct rte_dpaa2_device *dev = RTE_BUS_DEVICE(rte_dev, *dev);
- struct rte_dpaa2_driver *drv = dev->driver;
+ const struct rte_dpaa2_driver *drv = RTE_BUS_DRIVER(rte_dev->driver, *drv);
if (drv->remove != NULL) {
drv->remove(dev);
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index e38f3e9fe7..5784adaf90 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -1392,7 +1392,7 @@ fslmc_close_iodevices(struct rte_dpaa2_device *dev,
int vfio_fd)
{
struct rte_dpaa2_object *object = NULL;
- struct rte_dpaa2_driver *drv;
+ const struct rte_dpaa2_driver *drv;
int ret;
switch (dev->dev_type) {
@@ -1411,9 +1411,11 @@ fslmc_close_iodevices(struct rte_dpaa2_device *dev,
case DPAA2_ETH:
case DPAA2_CRYPTO:
case DPAA2_QDMA:
- drv = dev->driver;
- if (drv && drv->remove && drv->remove(dev))
- DPAA2_BUS_ERR("Unable to remove");
+ if (dev->device.driver != NULL) {
+ drv = RTE_BUS_DRIVER(dev->device.driver, *drv);
+ if (drv->remove && drv->remove(dev))
+ DPAA2_BUS_ERR("Unable to remove");
+ }
break;
default:
break;
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index a79a287fbe..b13285230b 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -296,11 +296,12 @@ ifpga_cleanup(void)
int error = 0;
RTE_BUS_FOREACH_DEV(afu_dev, &rte_ifpga_bus) {
- struct rte_afu_driver *drv = afu_dev->driver;
+ const struct rte_afu_driver *drv;
int ret = 0;
if (!rte_dev_is_probed(&afu_dev->device))
goto free;
+ drv = RTE_BUS_DRIVER(afu_dev->device.driver, *drv);
if (drv->remove == NULL)
goto free;
@@ -326,9 +327,10 @@ static int
ifpga_unplug(struct rte_device *dev)
{
struct rte_afu_device *afu_dev = RTE_BUS_DEVICE(dev, *afu_dev);
+ const struct rte_afu_driver *afu_drv = RTE_BUS_DRIVER(dev->driver, *afu_drv);
int ret;
- ret = afu_dev->driver->remove(afu_dev);
+ ret = afu_drv->remove(afu_dev);
if (ret)
return ret;
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index 4c1d3327a9..40e96b1c67 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -301,8 +301,10 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
struct pci_map *maps;
int wc_activate = 0;
- if (dev->driver != NULL)
- wc_activate = dev->driver->drv_flags & RTE_PCI_DRV_WC_ACTIVATE;
+ if (dev->device.driver != NULL) {
+ const struct rte_pci_driver *pdrv = RTE_BUS_DRIVER(dev->device.driver, *pdrv);
+ wc_activate = pdrv->drv_flags & RTE_PCI_DRV_WC_ACTIVATE;
+ }
loc = &dev->addr;
maps = uio_res->maps;
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 5c37c5e543..e927f4af7b 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -245,11 +245,6 @@ pci_probe_device(struct rte_driver *drv, struct rte_device *dev)
return -ENOMEM;
}
- /*
- * Reference driver structure.
- * This needs to be before rte_pci_map_device(), as it enables
- * to use driver flags for adjusting configuration.
- */
pci_dev->driver = pci_drv;
if (pci_drv->drv_flags & RTE_PCI_DRV_NEED_MAPPING) {
ret = rte_pci_map_device(pci_dev);
@@ -298,7 +293,7 @@ static int
rte_pci_detach_dev(struct rte_pci_device *dev)
{
struct rte_pci_addr *loc;
- struct rte_pci_driver *dr = dev->driver;
+ const struct rte_pci_driver *dr = RTE_BUS_DRIVER(dev->device.driver, *dr);
int ret = 0;
loc = &dev->addr;
@@ -339,11 +334,12 @@ pci_cleanup(void)
int error = 0;
RTE_BUS_FOREACH_DEV(dev, &rte_pci_bus.bus) {
- struct rte_pci_driver *drv = dev->driver;
+ const struct rte_pci_driver *drv;
int ret = 0;
if (!rte_dev_is_probed(&dev->device))
goto free;
+ drv = RTE_BUS_DRIVER(dev->device.driver, *drv);
if (drv->remove == NULL)
goto free;
@@ -545,9 +541,10 @@ static int
pci_dma_map(struct rte_device *dev, void *addr, uint64_t iova, size_t len)
{
struct rte_pci_device *pdev = RTE_BUS_DEVICE(dev, *pdev);
+ const struct rte_pci_driver *pdrv = RTE_BUS_DRIVER(dev->driver, *pdrv);
- if (pdev->driver->dma_map != NULL)
- return pdev->driver->dma_map(pdev, addr, iova, len);
+ if (pdrv->dma_map != NULL)
+ return pdrv->dma_map(pdev, addr, iova, len);
/**
* In case driver don't provides any specific mapping
* try fallback to VFIO.
@@ -564,9 +561,10 @@ static int
pci_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova, size_t len)
{
struct rte_pci_device *pdev = RTE_BUS_DEVICE(dev, *pdev);
+ const struct rte_pci_driver *pdrv = RTE_BUS_DRIVER(dev->driver, *pdrv);
- if (pdev->driver->dma_unmap != NULL)
- return pdev->driver->dma_unmap(pdev, addr, iova, len);
+ if (pdrv->dma_unmap != NULL)
+ return pdrv->dma_unmap(pdev, addr, iova, len);
/**
* In case driver don't provides any specific mapping
* try fallback to VFIO.
diff --git a/drivers/bus/platform/platform.c b/drivers/bus/platform/platform.c
index 671f36fac9..433bab9b60 100644
--- a/drivers/bus/platform/platform.c
+++ b/drivers/bus/platform/platform.c
@@ -408,7 +408,7 @@ platform_bus_probe_device(struct rte_driver *drv, struct rte_device *dev)
static void
device_release_driver(struct rte_platform_device *pdev)
{
- struct rte_platform_driver *pdrv = pdev->driver;
+ const struct rte_platform_driver *pdrv = RTE_BUS_DRIVER(pdev->device.driver, *pdrv);
int ret;
if (pdrv->remove != NULL) {
@@ -458,9 +458,10 @@ static int
platform_bus_dma_map(struct rte_device *dev, void *addr, uint64_t iova, size_t len)
{
struct rte_platform_device *pdev = RTE_BUS_DEVICE(dev, *pdev);
+ const struct rte_platform_driver *pdrv = RTE_BUS_DRIVER(dev->driver, *pdrv);
- if (pdev->driver->dma_map != NULL)
- return pdev->driver->dma_map(pdev, addr, iova, len);
+ if (pdrv->dma_map != NULL)
+ return pdrv->dma_map(pdev, addr, iova, len);
return rte_vfio_container_dma_map(RTE_VFIO_DEFAULT_CONTAINER_FD, (uint64_t)addr, iova, len);
}
@@ -469,9 +470,10 @@ static int
platform_bus_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova, size_t len)
{
struct rte_platform_device *pdev = RTE_BUS_DEVICE(dev, *pdev);
+ const struct rte_platform_driver *pdrv = RTE_BUS_DRIVER(dev->driver, *pdrv);
- if (pdev->driver->dma_unmap != NULL)
- return pdev->driver->dma_unmap(pdev, addr, iova, len);
+ if (pdrv->dma_unmap != NULL)
+ return pdrv->dma_unmap(pdev, addr, iova, len);
return rte_vfio_container_dma_unmap(RTE_VFIO_DEFAULT_CONTAINER_FD, (uint64_t)addr, iova,
len);
@@ -480,12 +482,14 @@ platform_bus_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova, size_t
static enum rte_iova_mode
platform_bus_get_iommu_class(void)
{
- struct rte_platform_driver *pdrv;
+ const struct rte_platform_driver *pdrv;
struct rte_platform_device *pdev;
RTE_BUS_FOREACH_DEV(pdev, &platform_bus.bus) {
- pdrv = pdev->driver;
- if (pdrv != NULL && pdrv->drv_flags & RTE_PLATFORM_DRV_NEED_IOVA_AS_VA)
+ if (!rte_dev_is_probed(&pdev->device))
+ continue;
+ pdrv = RTE_BUS_DRIVER(pdev->device.driver, *pdrv);
+ if (pdrv->drv_flags & RTE_PLATFORM_DRV_NEED_IOVA_AS_VA)
return RTE_IOVA_VA;
}
diff --git a/drivers/bus/uacce/uacce.c b/drivers/bus/uacce/uacce.c
index aa33499f55..ead920d261 100644
--- a/drivers/bus/uacce/uacce.c
+++ b/drivers/bus/uacce/uacce.c
@@ -381,11 +381,12 @@ uacce_cleanup(void)
int error = 0;
RTE_BUS_FOREACH_DEV(dev, &uacce_bus.bus) {
- struct rte_uacce_driver *dr = dev->driver;
+ const struct rte_uacce_driver *dr;
int ret = 0;
if (!rte_dev_is_probed(&dev->device))
goto free;
+ dr = RTE_BUS_DRIVER(dev->device.driver, *dr);
if (dr->remove == NULL)
goto free;
@@ -408,7 +409,7 @@ uacce_cleanup(void)
static int
uacce_detach_dev(struct rte_uacce_device *dev)
{
- struct rte_uacce_driver *dr = dev->driver;
+ const struct rte_uacce_driver *dr = RTE_BUS_DRIVER(dev->device.driver, *dr);
int ret = 0;
UACCE_BUS_DEBUG("detach device %s using driver: %s", dev->device.name, dr->driver.name);
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index 43652c0487..b96f4133dd 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -143,11 +143,12 @@ rte_vmbus_cleanup(void)
int error = 0;
RTE_BUS_FOREACH_DEV(dev, &rte_vmbus_bus.bus) {
- const struct rte_vmbus_driver *drv = dev->driver;
+ const struct rte_vmbus_driver *drv;
int ret;
if (!rte_dev_is_probed(&dev->device))
continue;
+ drv = RTE_BUS_DRIVER(dev->device.driver, *drv);
if (drv->remove == NULL)
continue;
diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
index 0d2bbdb8a5..fe28cb160d 100644
--- a/drivers/common/qat/qat_qp.c
+++ b/drivers/common/qat/qat_qp.c
@@ -174,7 +174,7 @@ qat_qp_setup(struct qat_pci_device *qat_dev,
snprintf(op_cookie_pool_name, RTE_RING_NAMESIZE,
"%s%d_cookies_%s_qp%hu",
- pci_dev->driver->driver.name, qat_dev->qat_dev_id,
+ pci_dev->device.driver->name, qat_dev->qat_dev_id,
qat_qp_conf->service_str, queue_pair_id);
QAT_LOG(DEBUG, "cookiepool: %s", op_cookie_pool_name);
@@ -252,7 +252,7 @@ qat_queue_create(struct qat_pci_device *qat_dev, struct qat_queue *queue,
*/
snprintf(queue->memz_name, sizeof(queue->memz_name),
"%s_%d_%s_%s_%d_%d",
- pci_dev->driver->driver.name, qat_dev->qat_dev_id,
+ pci_dev->device.driver->name, qat_dev->qat_dev_id,
qp_conf->service_str, "qp_mem",
queue->hw_bundle_number, queue->hw_queue_number);
qp_mz = queue_dma_zone_reserve(queue->memz_name, queue_size_bytes,
diff --git a/drivers/common/zsda/zsda_qp.c b/drivers/common/zsda/zsda_qp.c
index dab524e2d3..79172234af 100644
--- a/drivers/common/zsda/zsda_qp.c
+++ b/drivers/common/zsda/zsda_qp.c
@@ -592,12 +592,12 @@ zsda_queue_create(const uint8_t dev_id, struct zsda_queue *queue,
if (dir == RING_DIR_TX)
snprintf(queue->memz_name, sizeof(queue->memz_name),
- "%s_%d_%s_%s_%d", pci_dev->driver->driver.name, dev_id,
+ "%s_%d_%s_%s_%d", pci_dev->device.driver->name, dev_id,
qp_conf->service_str, "qptxmem",
queue->hw_queue_number);
else
snprintf(queue->memz_name, sizeof(queue->memz_name),
- "%s_%d_%s_%s_%d", pci_dev->driver->driver.name, dev_id,
+ "%s_%d_%s_%s_%d", pci_dev->device.driver->name, dev_id,
qp_conf->service_str, "qprxmem",
queue->hw_queue_number);
diff --git a/drivers/net/ntnic/ntnic_ethdev.c b/drivers/net/ntnic/ntnic_ethdev.c
index 89e751e7e0..7cc90a7a5b 100644
--- a/drivers/net/ntnic/ntnic_ethdev.c
+++ b/drivers/net/ntnic/ntnic_ethdev.c
@@ -2676,8 +2676,7 @@ nthw_pci_dev_deinit(struct rte_eth_dev *eth_dev __rte_unused)
}
static int
-nthw_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
- struct rte_pci_device *pci_dev)
+nthw_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
{
int ret;
@@ -2711,9 +2710,8 @@ nthw_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
pci_dev->id.subsystem_vendor_id, pci_dev->id.subsystem_device_id,
pci_dev->name[0] ? pci_dev->name : "NA",
pci_dev->device.numa_node,
- pci_dev->driver->driver.name ? pci_dev->driver->driver.name : "NA",
- pci_dev->driver->driver.alias ? pci_dev->driver->driver.alias : "NA");
-
+ (pci_drv->driver.name != NULL) ? pci_drv->driver.name : "NA",
+ (pci_drv->driver.alias != NULL) ? pci_drv->driver.alias : "NA");
ret = nthw_pci_dev_init(pci_dev);
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy.c b/drivers/raw/cnxk_bphy/cnxk_bphy.c
index 0c26cfbbe6..ea30a7100c 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy.c
@@ -351,7 +351,7 @@ bphy_rawdev_probe(struct rte_pci_driver *pci_drv,
bphy_rawdev->dev_ops = &bphy_rawdev_ops;
bphy_rawdev->device = &pci_dev->device;
- bphy_rawdev->driver_name = pci_dev->driver->driver.name;
+ bphy_rawdev->driver_name = pci_dev->device.driver->name;
bphy_dev = (struct bphy_device *)bphy_rawdev->dev_private;
bphy_dev->mem.res0 = pci_dev->mem_resource[0];
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c
index c82589baa2..e0c7257027 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c
@@ -319,7 +319,7 @@ cnxk_bphy_cgx_rawdev_probe(struct rte_pci_driver *pci_drv,
rawdev->dev_ops = &cnxk_bphy_cgx_rawdev_ops;
rawdev->device = &pci_dev->device;
- rawdev->driver_name = pci_dev->driver->driver.name;
+ rawdev->driver_name = pci_dev->device.driver->name;
cgx = rawdev->dev_private;
cgx->rcgx = rte_zmalloc(NULL, sizeof(*rcgx), 0);
diff --git a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c
index 60c2080740..57c7cc85f3 100644
--- a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c
+++ b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c
@@ -210,7 +210,7 @@ rvu_lf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
rvu_lf_rawdev->dev_ops = &rvu_lf_rawdev_ops;
rvu_lf_rawdev->device = &pci_dev->device;
- rvu_lf_rawdev->driver_name = pci_dev->driver->driver.name;
+ rvu_lf_rawdev->driver_name = pci_dev->device.driver->name;
roc_rvu_lf = (struct roc_rvu_lf *)rvu_lf_rawdev->dev_private;
roc_rvu_lf->pci_dev = pci_dev;
diff --git a/drivers/raw/ifpga/afu_pmd_core.c b/drivers/raw/ifpga/afu_pmd_core.c
index f650b76cfe..ca14ebf52f 100644
--- a/drivers/raw/ifpga/afu_pmd_core.c
+++ b/drivers/raw/ifpga/afu_pmd_core.c
@@ -310,7 +310,7 @@ static int afu_rawdev_create(struct rte_afu_device *afu_dev, int socket_id)
rawdev->dev_ops = &afu_rawdev_ops;
rawdev->device = &afu_dev->device;
- rawdev->driver_name = afu_dev->driver->driver.name;
+ rawdev->driver_name = afu_dev->device.driver->name;
dev = afu_rawdev_get_priv(rawdev);
if (!dev)
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index d1d54e9065..9f961c943f 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -1602,7 +1602,7 @@ ifpga_rawdev_create(struct rte_pci_device *pci_dev,
rawdev->dev_ops = &ifpga_rawdev_ops;
rawdev->device = &pci_dev->device;
- rawdev->driver_name = pci_dev->driver->driver.name;
+ rawdev->driver_name = pci_dev->device.driver->name;
/* must enumerate the adapter before use it */
ret = opae_adapter_enumerate(adapter);
diff --git a/drivers/raw/ntb/ntb.c b/drivers/raw/ntb/ntb.c
index 0ed4c14592..d54f2fb783 100644
--- a/drivers/raw/ntb/ntb.c
+++ b/drivers/raw/ntb/ntb.c
@@ -1478,7 +1478,7 @@ ntb_create(struct rte_pci_device *pci_dev, int socket_id)
rawdev->dev_ops = &ntb_ops;
rawdev->device = &pci_dev->device;
- rawdev->driver_name = pci_dev->driver->driver.name;
+ rawdev->driver_name = pci_dev->device.driver->name;
ret = ntb_init_hw(rawdev, pci_dev);
if (ret < 0) {
diff --git a/lib/ethdev/ethdev_pci.h b/lib/ethdev/ethdev_pci.h
index 2229ffa252..ce3e293818 100644
--- a/lib/ethdev/ethdev_pci.h
+++ b/lib/ethdev/ethdev_pci.h
@@ -39,10 +39,13 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev,
eth_dev->intr_handle = pci_dev->intr_handle;
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+ const struct rte_pci_driver *pci_drv;
+
+ pci_drv = RTE_BUS_DRIVER(pci_dev->device.driver, *pci_drv);
eth_dev->data->dev_flags = 0;
- if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC)
+ if (pci_drv->drv_flags & RTE_PCI_DRV_INTR_LSC)
eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_LSC;
- if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_RMV)
+ if (pci_drv->drv_flags & RTE_PCI_DRV_INTR_RMV)
eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_RMV;
eth_dev->data->numa_node = pci_dev->device.numa_node;
--
2.53.0
^ permalink raw reply related
* [PATCH v4 18/25] bus: factorize driver reference
From: David Marchand @ 2026-05-27 7:56 UTC (permalink / raw)
To: dev
Cc: thomas, stephen, bruce.richardson, Parav Pandit, Xueming Li,
Nipun Gupta, Nikhil Agarwal, Hemant Agrawal, Sachin Saxena,
Rosen Xu, Chenbo Xia, Tomasz Duszynski, Chengwen Feng, Long Li,
Wei Hu
In-Reply-To: <20260527075654.3780732-1-david.marchand@redhat.com>
Before this patch, setting the driver in the device object and error
rollback were the responsibility of each bus probe_device function.
This patch centralizes it in the EAL's local_dev_probe function.
The dev->driver field is now set before calling bus->probe_device,
ensuring that drivers can rely on it being set during probe.
On error, dev->driver is cleared only if the device was not previously
probed, to handle buses that support multiple probes
(RTE_PCI_DRV_PROBE_AGAIN).
As a consequence, each bus implementation no longer needs to set/clear
dev->driver and dev->device.driver.
In PCI bus, a side effect is that detecting a re-probe cannot use
rte_dev_is_probed (which checks dev->driver != NULL) anymore.
Switch to checking if intr_handle was allocated instead.
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/bus/auxiliary/auxiliary_common.c | 2 --
drivers/bus/cdx/cdx.c | 2 --
drivers/bus/dpaa/dpaa_bus.c | 6 ++----
drivers/bus/fslmc/fslmc_bus.c | 1 -
drivers/bus/ifpga/ifpga_bus.c | 2 --
drivers/bus/pci/pci_common.c | 6 ++----
drivers/bus/platform/platform.c | 8 +-------
drivers/bus/uacce/uacce.c | 1 -
drivers/bus/vmbus/vmbus_common.c | 2 --
lib/eal/common/eal_common_bus.c | 7 +++++++
lib/eal/common/eal_common_dev.c | 12 ++++++++++++
11 files changed, 24 insertions(+), 25 deletions(-)
diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index 206b69bbd4..ba8c35ebbe 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -120,8 +120,6 @@ auxiliary_probe_device(struct rte_driver *drv, struct rte_device *dev)
aux_dev->driver = NULL;
rte_intr_instance_free(aux_dev->intr_handle);
aux_dev->intr_handle = NULL;
- } else {
- aux_dev->device.driver = &aux_drv->driver;
}
return ret;
diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
index e1405d1372..c6a4da7692 100644
--- a/drivers/bus/cdx/cdx.c
+++ b/drivers/bus/cdx/cdx.c
@@ -332,8 +332,6 @@ cdx_probe_device(struct rte_driver *drv, struct rte_device *dev)
CDX_BUS_ERR("Probe CDX driver: %s device: %s failed: %d",
cdx_drv->driver.name, dev_name, ret);
goto error_probe;
- } else {
- cdx_dev->device.driver = &cdx_drv->driver;
}
cdx_dev->driver = cdx_drv;
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 7f4a85a91d..b7d0caaf61 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -800,12 +800,10 @@ dpaa_bus_probe_device(struct rte_driver *drv, struct rte_device *dev)
int ret;
ret = dpaa_drv->probe(dpaa_drv, dpaa_dev);
- if (ret != 0) {
+ if (ret != 0)
DPAA_BUS_ERR("unable to probe: %s", dpaa_dev->name);
- } else {
+ else
dpaa_dev->driver = dpaa_drv;
- dpaa_dev->device.driver = &dpaa_drv->driver;
- }
return ret;
}
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 29ef3b58cf..ae69bd0da2 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -524,7 +524,6 @@ fslmc_bus_probe_device(struct rte_driver *driver, struct rte_device *rte_dev)
DPAA2_BUS_ERR("Unable to probe");
} else {
dev->driver = drv;
- dev->device.driver = &drv->driver;
DPAA2_BUS_INFO("%s Plugged", dev->device.name);
}
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index b2eb4f4413..a79a287fbe 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -281,8 +281,6 @@ ifpga_probe_device(struct rte_driver *drv, struct rte_device *dev)
ret = afu_drv->probe(afu_dev);
if (ret)
afu_dev->driver = NULL;
- else
- afu_dev->device.driver = &afu_drv->driver;
return ret;
}
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index a507360ef6..5c37c5e543 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -203,7 +203,7 @@ pci_probe_device(struct rte_driver *drv, struct rte_device *dev)
if (pci_dev->device.numa_node < 0 && rte_socket_count() > 1)
PCI_LOG(INFO, "Device %s is not NUMA-aware", pci_dev->name);
- already_probed = rte_dev_is_probed(&pci_dev->device);
+ already_probed = (pci_dev->intr_handle != NULL);
if (already_probed && !(pci_drv->drv_flags & RTE_PCI_DRV_PROBE_AGAIN)) {
PCI_LOG(DEBUG, "Device %s is already probed", pci_dev->device.name);
return -EEXIST;
@@ -251,7 +251,7 @@ pci_probe_device(struct rte_driver *drv, struct rte_device *dev)
* to use driver flags for adjusting configuration.
*/
pci_dev->driver = pci_drv;
- if (pci_dev->driver->drv_flags & RTE_PCI_DRV_NEED_MAPPING) {
+ if (pci_drv->drv_flags & RTE_PCI_DRV_NEED_MAPPING) {
ret = rte_pci_map_device(pci_dev);
if (ret != 0) {
pci_dev->driver = NULL;
@@ -285,8 +285,6 @@ pci_probe_device(struct rte_driver *drv, struct rte_device *dev)
pci_dev->vfio_req_intr_handle = NULL;
rte_intr_instance_free(pci_dev->intr_handle);
pci_dev->intr_handle = NULL;
- } else {
- pci_dev->device.driver = &pci_drv->driver;
}
return ret;
diff --git a/drivers/bus/platform/platform.c b/drivers/bus/platform/platform.c
index 01c8239cbb..671f36fac9 100644
--- a/drivers/bus/platform/platform.c
+++ b/drivers/bus/platform/platform.c
@@ -329,17 +329,11 @@ device_setup(struct rte_platform_device *pdev)
static int
driver_call_probe(struct rte_platform_driver *pdrv, struct rte_platform_device *pdev)
{
- int ret;
-
if (pdrv->probe != NULL) {
pdev->driver = pdrv;
- ret = pdrv->probe(pdev);
- if (ret)
- return ret;
+ return pdrv->probe(pdev);
}
- pdev->device.driver = &pdrv->driver;
-
return 0;
}
diff --git a/drivers/bus/uacce/uacce.c b/drivers/bus/uacce/uacce.c
index 463d08bc12..aa33499f55 100644
--- a/drivers/bus/uacce/uacce.c
+++ b/drivers/bus/uacce/uacce.c
@@ -366,7 +366,6 @@ uacce_probe_device(struct rte_driver *drv, struct rte_device *dev)
UACCE_BUS_ERR("probe device %s with driver %s failed %d",
dev_name, uacce_drv->driver.name, ret);
} else {
- uacce_dev->device.driver = &uacce_drv->driver;
uacce_dev->driver = uacce_drv;
UACCE_BUS_DEBUG("probe device %s with driver %s success",
dev_name, uacce_drv->driver.name);
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index bd375ae6bb..43652c0487 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -119,8 +119,6 @@ vmbus_probe_device(struct rte_driver *drv, struct rte_device *dev)
if (ret != 0) {
vmbus_dev->driver = NULL;
rte_vmbus_unmap_device(vmbus_dev);
- } else {
- vmbus_dev->device.driver = &vmbus_drv->driver;
}
return ret;
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index 94b7be5f5f..ca13ccce5b 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -86,6 +86,7 @@ rte_bus_generic_probe(struct rte_bus *bus)
TAILQ_FOREACH(dev, &bus->device_list, next) {
struct rte_driver *drv = NULL;
+ bool was_probed;
int ret;
if (rte_bus_device_is_ignored(bus, dev->name))
@@ -102,7 +103,13 @@ rte_bus_generic_probe(struct rte_bus *bus)
if (drv == NULL)
continue;
+ was_probed = rte_dev_is_probed(dev);
+ if (!was_probed)
+ dev->driver = drv;
ret = bus->probe_device(drv, dev);
+ if (!was_probed && ret != 0)
+ dev->driver = NULL;
+
if (ret > 0)
goto next_driver;
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 9047a01c4a..48b631532a 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -229,7 +229,19 @@ local_dev_probe(const char *devargs, struct rte_device **new_dev)
EAL_LOG(INFO, "Device %s is already probed", dev->name);
ret = -EEXIST;
} else {
+ bool was_probed = rte_dev_is_probed(dev);
+
+ /*
+ * Reference driver structure.
+ * This needs to be before .probe_device as some bus (like PCI) use
+ * driver flags for adjusting configuration.
+ */
+ if (!was_probed)
+ dev->driver = drv;
ret = dev->bus->probe_device(drv, dev);
+ if (!was_probed && ret != 0)
+ dev->driver = NULL;
+
if (ret > 0)
goto next_driver;
}
--
2.53.0
^ permalink raw reply related
* [PATCH v4 17/25] bus: implement probe in EAL
From: David Marchand @ 2026-05-27 7:56 UTC (permalink / raw)
To: dev
Cc: thomas, stephen, bruce.richardson, Parav Pandit, Xueming Li,
Nipun Gupta, Nikhil Agarwal, Hemant Agrawal, Sachin Saxena,
Rosen Xu, Chenbo Xia, Tomasz Duszynski, Chengwen Feng, Long Li,
Wei Hu, Kevin Laatz
In-Reply-To: <20260527075654.3780732-1-david.marchand@redhat.com>
Add rte_bus_generic_probe() in EAL to eliminate duplicated device
probing logic across bus drivers. This function implements the common
pattern of iterating devices, finding matching drivers, and calling
the bus probe_device operation.
The generic probe includes rte_bus_device_is_ignored() check to skip
ignored devices during probing. Errors from probe_device() are logged
except for -EEXIST, which is silently skipped to support device reprobing.
Notes:
- rte_vmbus_probe() is kept as it's an exported public API, but
the .probe field is removed from rte_vmbus_bus structure.
- rte_ifpga_device_name() is removed as it has no user remaining.
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/bus/auxiliary/auxiliary_common.c | 39 +------------------
drivers/bus/cdx/cdx.c | 38 +-----------------
drivers/bus/dpaa/dpaa_bus.c | 30 +--------------
drivers/bus/fslmc/fslmc_bus.c | 29 +-------------
drivers/bus/ifpga/bus_ifpga_driver.h | 9 -----
drivers/bus/ifpga/ifpga_bus.c | 34 +---------------
drivers/bus/pci/pci_common.c | 42 +-------------------
drivers/bus/platform/platform.c | 33 +---------------
drivers/bus/uacce/uacce.c | 33 +---------------
drivers/bus/vdev/vdev.c | 37 +-----------------
drivers/bus/vmbus/vmbus_common.c | 35 +----------------
drivers/dma/idxd/idxd_bus.c | 21 +---------
lib/eal/common/eal_common_bus.c | 49 +++++++++++++++++++++++-
lib/eal/include/bus_driver.h | 23 ++++++++++-
14 files changed, 81 insertions(+), 371 deletions(-)
diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index c210e303ce..206b69bbd4 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -152,43 +152,6 @@ rte_auxiliary_driver_remove_dev(struct rte_auxiliary_device *dev)
return 0;
}
-/*
- * Scan the content of the auxiliary bus, and call the probe function for
- * all registered drivers to try to probe discovered devices.
- */
-static int
-auxiliary_probe(void)
-{
- struct rte_auxiliary_device *dev = NULL;
- size_t probed = 0, failed = 0;
-
- RTE_BUS_FOREACH_DEV(dev, &auxiliary_bus.bus) {
- struct rte_driver *drv = NULL;
- int ret;
-
- probed++;
-
-next_driver:
- drv = rte_bus_find_driver(&auxiliary_bus.bus, drv, &dev->device);
- if (drv == NULL)
- continue;
-
- ret = auxiliary_bus.bus.probe_device(drv, &dev->device);
- if (ret < 0) {
- if (ret != -EEXIST) {
- AUXILIARY_LOG(ERR, "Requested device %s cannot be used",
- dev->name);
- rte_errno = errno;
- failed++;
- }
- } else if (ret > 0) {
- goto next_driver;
- }
- }
-
- return (probed && probed == failed) ? -1 : 0;
-}
-
static int
auxiliary_parse(const char *name, void *addr)
{
@@ -302,7 +265,7 @@ auxiliary_get_iommu_class(void)
struct rte_auxiliary_bus auxiliary_bus = {
.bus = {
.scan = auxiliary_scan,
- .probe = auxiliary_probe,
+ .probe = rte_bus_generic_probe,
.cleanup = auxiliary_cleanup,
.find_device = rte_bus_generic_find_device,
.match = auxiliary_bus_match,
diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
index 64fb0a8534..e1405d1372 100644
--- a/drivers/bus/cdx/cdx.c
+++ b/drivers/bus/cdx/cdx.c
@@ -347,42 +347,6 @@ cdx_probe_device(struct rte_driver *drv, struct rte_device *dev)
return ret;
}
-/*
- * Scan the content of the CDX bus, and call the probe() function for
- * all registered drivers that have a matching entry in its id_table
- * for discovered devices.
- */
-static int
-cdx_probe(void)
-{
- struct rte_cdx_device *dev = NULL;
- size_t probed = 0, failed = 0;
-
- RTE_BUS_FOREACH_DEV(dev, &rte_cdx_bus.bus) {
- struct rte_driver *drv = NULL;
- int ret;
-
- probed++;
-
-next_driver:
- drv = rte_bus_find_driver(&rte_cdx_bus.bus, drv, &dev->device);
- if (drv == NULL)
- continue;
-
- ret = rte_cdx_bus.bus.probe_device(drv, &dev->device);
- if (ret < 0) {
- CDX_BUS_ERR("Requested device %s cannot be used",
- dev->name);
- rte_errno = errno;
- failed++;
- } else if (ret > 0) {
- goto next_driver;
- }
- }
-
- return (probed && probed == failed) ? -1 : 0;
-}
-
static int
cdx_parse(const char *name, void *addr)
{
@@ -489,7 +453,7 @@ cdx_get_iommu_class(void)
struct rte_cdx_bus rte_cdx_bus = {
.bus = {
.scan = cdx_scan,
- .probe = cdx_probe,
+ .probe = rte_bus_generic_probe,
.find_device = rte_bus_generic_find_device,
.match = cdx_bus_match,
.probe_device = cdx_probe_device,
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 43d71cefa4..7f4a85a91d 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -779,31 +779,6 @@ rte_dpaa_bus_scan(void)
return 0;
}
-static int
-rte_dpaa_bus_probe(void)
-{
- struct rte_dpaa_device *dev;
-
- /* For each registered driver, and device, call the driver->probe */
- RTE_BUS_FOREACH_DEV(dev, &rte_dpaa_bus.bus) {
- struct rte_driver *driver = NULL;
- int ret;
-
-next_driver:
- driver = rte_bus_find_driver(&rte_dpaa_bus.bus, driver, &dev->device);
- if (driver == NULL)
- continue;
-
- ret = rte_dpaa_bus.bus.probe_device(driver, &dev->device);
- if (ret < 0)
- DPAA_BUS_ERR("Failed to probe device %s", dev->name);
- else if (ret > 0)
- goto next_driver;
- }
-
- return 0;
-}
-
/*
* Get iommu class of DPAA2 devices on the bus.
*/
@@ -824,9 +799,6 @@ dpaa_bus_probe_device(struct rte_driver *drv, struct rte_device *dev)
struct rte_dpaa_driver *dpaa_drv = RTE_BUS_DRIVER(drv, *dpaa_drv);
int ret;
- if (rte_bus_device_is_ignored(&rte_dpaa_bus.bus, dpaa_dev->name))
- return 0;
-
ret = dpaa_drv->probe(dpaa_drv, dpaa_dev);
if (ret != 0) {
DPAA_BUS_ERR("unable to probe: %s", dpaa_dev->name);
@@ -890,7 +862,7 @@ RTE_FINI_PRIO(dpaa_cleanup, 102)
static struct rte_dpaa_bus rte_dpaa_bus = {
.bus = {
.scan = rte_dpaa_bus_scan,
- .probe = rte_dpaa_bus_probe,
+ .probe = rte_bus_generic_probe,
.parse = rte_dpaa_bus_parse,
.dev_compare = dpaa_bus_dev_compare,
.find_device = rte_bus_generic_find_device,
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 156f4e295f..29ef3b58cf 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -446,33 +446,6 @@ rte_fslmc_close(void)
return 0;
}
-static int
-rte_fslmc_probe(void)
-{
- struct rte_dpaa2_device *dev;
- int ret;
-
- RTE_BUS_FOREACH_DEV(dev, &rte_fslmc_bus.bus) {
- struct rte_driver *driver = NULL;
-
- if (rte_bus_device_is_ignored(&rte_fslmc_bus.bus, dev->device.name))
- continue;
-
-next_driver:
- driver = rte_bus_find_driver(&rte_fslmc_bus.bus, driver, &dev->device);
- if (driver == NULL)
- continue;
-
- ret = rte_fslmc_bus.bus.probe_device(driver, &dev->device);
- if (ret < 0)
- DPAA2_BUS_ERR("Failed to probe device %s", dev->device.name);
- else if (ret > 0)
- goto next_driver;
- }
-
- return 0;
-}
-
/*register a fslmc bus based dpaa2 driver */
RTE_EXPORT_INTERNAL_SYMBOL(rte_fslmc_driver_register)
void
@@ -578,7 +551,7 @@ fslmc_bus_unplug(struct rte_device *rte_dev)
struct rte_fslmc_bus rte_fslmc_bus = {
.bus = {
.scan = rte_fslmc_scan,
- .probe = rte_fslmc_probe,
+ .probe = rte_bus_generic_probe,
.cleanup = rte_fslmc_close,
.parse = rte_fslmc_parse,
.dev_compare = fslmc_dev_compare,
diff --git a/drivers/bus/ifpga/bus_ifpga_driver.h b/drivers/bus/ifpga/bus_ifpga_driver.h
index c1ff38bdb2..b56916167c 100644
--- a/drivers/bus/ifpga/bus_ifpga_driver.h
+++ b/drivers/bus/ifpga/bus_ifpga_driver.h
@@ -99,15 +99,6 @@ struct rte_afu_driver {
const struct rte_afu_uuid *id_table; /**< AFU uuid within FPGA. */
};
-__rte_internal
-static inline const char *
-rte_ifpga_device_name(const struct rte_afu_device *afu)
-{
- if (afu && afu->device.name)
- return afu->device.name;
- return NULL;
-}
-
/**
* Register a ifpga afu device driver.
*
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index d3f3370bc5..b2eb4f4413 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -287,38 +287,6 @@ ifpga_probe_device(struct rte_driver *drv, struct rte_device *dev)
return ret;
}
-/*
- * Scan the content of the Intel FPGA bus, and call the probe() function for
- * all registered drivers that have a matching entry in its id_table
- * for discovered devices.
- */
-static int
-ifpga_probe(void)
-{
- struct rte_afu_device *afu_dev = NULL;
- int ret = 0;
-
- RTE_BUS_FOREACH_DEV(afu_dev, &rte_ifpga_bus) {
- struct rte_driver *drv = NULL;
-
-next_driver:
- drv = rte_bus_find_driver(&rte_ifpga_bus, drv, &afu_dev->device);
- if (drv == NULL)
- continue;
-
- ret = rte_ifpga_bus.probe_device(drv, &afu_dev->device);
- if (ret == -EEXIST)
- continue;
- if (ret < 0)
- IFPGA_BUS_ERR("failed to initialize %s device",
- rte_ifpga_device_name(afu_dev));
- else if (ret > 0)
- goto next_driver;
- }
-
- return ret;
-}
-
/*
* Cleanup the content of the Intel FPGA bus, and call the remove() function
* for all registered devices.
@@ -421,7 +389,7 @@ ifpga_parse(const char *name, void *addr)
static struct rte_bus rte_ifpga_bus = {
.scan = ifpga_scan,
- .probe = ifpga_probe,
+ .probe = rte_bus_generic_probe,
.cleanup = ifpga_cleanup,
.find_device = rte_bus_generic_find_device,
.match = ifpga_bus_match,
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 02542a903a..a507360ef6 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -334,46 +334,6 @@ rte_pci_detach_dev(struct rte_pci_device *dev)
return 0;
}
-/*
- * Scan the content of the PCI bus, and call the probe() function for
- * all registered drivers that have a matching entry in its id_table
- * for discovered devices.
- */
-static int
-pci_probe(void)
-{
- struct rte_pci_device *dev = NULL;
- size_t probed = 0, failed = 0;
-
- RTE_BUS_FOREACH_DEV(dev, &rte_pci_bus.bus) {
- struct rte_driver *drv = NULL;
- int ret;
-
- probed++;
-
-next_driver:
- drv = rte_bus_find_driver(&rte_pci_bus.bus, drv, &dev->device);
- if (drv == NULL)
- continue;
-
- ret = rte_pci_bus.bus.probe_device(drv, &dev->device);
- if (ret < 0) {
- if (ret != -EEXIST) {
- PCI_LOG(ERR, "Requested device " PCI_PRI_FMT " cannot be used",
- dev->addr.domain, dev->addr.bus,
- dev->addr.devid, dev->addr.function);
- rte_errno = errno;
- failed++;
- }
- ret = 0;
- } else if (ret > 0) {
- goto next_driver;
- }
- }
-
- return (probed && probed == failed) ? -1 : 0;
-}
-
static int
pci_cleanup(void)
{
@@ -825,7 +785,7 @@ struct rte_pci_bus rte_pci_bus = {
.bus = {
.allow_multi_probe = true,
.scan = rte_pci_scan,
- .probe = pci_probe,
+ .probe = rte_bus_generic_probe,
.cleanup = pci_cleanup,
.find_device = rte_bus_generic_find_device,
.match = pci_bus_match,
diff --git a/drivers/bus/platform/platform.c b/drivers/bus/platform/platform.c
index 3d04ba4d25..01c8239cbb 100644
--- a/drivers/bus/platform/platform.c
+++ b/drivers/bus/platform/platform.c
@@ -401,40 +401,9 @@ platform_bus_match(const struct rte_driver *drv, const struct rte_device *dev)
return match;
}
-static int
-platform_bus_probe(void)
-{
- struct rte_platform_device *pdev;
-
- RTE_BUS_FOREACH_DEV(pdev, &platform_bus.bus) {
- struct rte_driver *drv = NULL;
- int ret;
-
-next_driver:
- drv = rte_bus_find_driver(&platform_bus.bus, drv, &pdev->device);
- if (drv == NULL)
- continue;
-
- ret = platform_bus.bus.probe_device(drv, &pdev->device);
- if (ret == -EBUSY) {
- PLATFORM_LOG_LINE(DEBUG, "device %s already probed", pdev->name);
- continue;
- }
- if (ret < 0)
- PLATFORM_LOG_LINE(ERR, "failed to probe %s", pdev->name);
- else if (ret > 0)
- goto next_driver;
- }
-
- return 0;
-}
-
static int
platform_bus_probe_device(struct rte_driver *drv, struct rte_device *dev)
{
- if (rte_bus_device_is_ignored(&platform_bus.bus, dev->name))
- return -EPERM;
-
if (!dev_is_bound_vfio_platform(dev->name))
return -EPERM;
@@ -547,7 +516,7 @@ platform_bus_cleanup(void)
struct rte_platform_bus platform_bus = {
.bus = {
.scan = platform_bus_scan,
- .probe = platform_bus_probe,
+ .probe = rte_bus_generic_probe,
.find_device = rte_bus_generic_find_device,
.match = platform_bus_match,
.probe_device = platform_bus_probe_device,
diff --git a/drivers/bus/uacce/uacce.c b/drivers/bus/uacce/uacce.c
index b34c263295..463d08bc12 100644
--- a/drivers/bus/uacce/uacce.c
+++ b/drivers/bus/uacce/uacce.c
@@ -375,37 +375,6 @@ uacce_probe_device(struct rte_driver *drv, struct rte_device *dev)
return ret;
}
-static int
-uacce_probe(void)
-{
- size_t probed = 0, failed = 0;
- struct rte_uacce_device *dev;
-
- RTE_BUS_FOREACH_DEV(dev, &uacce_bus.bus) {
- struct rte_driver *drv = NULL;
- int ret;
-
- probed++;
-
-next_driver:
- drv = rte_bus_find_driver(&uacce_bus.bus, drv, &dev->device);
- if (drv == NULL)
- continue;
-
- ret = uacce_bus.bus.probe_device(drv, &dev->device);
- if (ret < 0) {
- UACCE_BUS_LOG(ERR, "Requested device %s cannot be used",
- dev->name);
- rte_errno = errno;
- failed++;
- } else if (ret > 0) {
- goto next_driver;
- }
- }
-
- return (probed && probed == failed) ? -1 : 0;
-}
-
static int
uacce_cleanup(void)
{
@@ -597,7 +566,7 @@ rte_uacce_unregister(struct rte_uacce_driver *driver)
static struct rte_uacce_bus uacce_bus = {
.bus = {
.scan = uacce_scan,
- .probe = uacce_probe,
+ .probe = rte_bus_generic_probe,
.cleanup = uacce_cleanup,
.match = uacce_bus_match,
.probe_device = uacce_probe_device,
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 37820b9614..3121db1f79 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -546,41 +546,6 @@ vdev_scan(void)
return 0;
}
-static int
-vdev_probe(void)
-{
- struct rte_vdev_device *dev;
- int r, ret = 0;
-
- /* call the init function for each virtual device */
- RTE_BUS_FOREACH_DEV(dev, &rte_vdev_bus) {
- struct rte_driver *drv = NULL;
-
- /* we don't use the vdev lock here, as it's only used in DPDK
- * initialization; and we don't want to hold such a lock when
- * we call each driver probe.
- */
-
-next_driver:
- drv = rte_bus_find_driver(&rte_vdev_bus, drv, &dev->device);
- if (drv == NULL)
- continue;
-
- r = rte_vdev_bus.probe_device(drv, &dev->device);
- if (r < 0) {
- if (r == -EEXIST)
- continue;
- VDEV_LOG(ERR, "failed to initialize %s device",
- rte_vdev_device_name(dev));
- ret = -1;
- } else if (r > 0) {
- goto next_driver;
- }
- }
-
- return ret;
-}
-
static int
vdev_cleanup(void)
{
@@ -652,7 +617,7 @@ vdev_get_iommu_class(void)
static struct rte_bus rte_vdev_bus = {
.scan = vdev_scan,
- .probe = vdev_probe,
+ .probe = rte_bus_generic_probe,
.cleanup = vdev_cleanup,
.find_device = vdev_find_device,
.match = vdev_bus_match,
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index 24b1c24f43..bd375ae6bb 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -135,38 +135,7 @@ RTE_EXPORT_SYMBOL(rte_vmbus_probe)
int
rte_vmbus_probe(void)
{
- struct rte_vmbus_device *dev;
- size_t probed = 0, failed = 0;
- char ubuf[RTE_UUID_STRLEN];
-
- RTE_BUS_FOREACH_DEV(dev, &rte_vmbus_bus.bus) {
- struct rte_driver *drv = NULL;
- int ret;
-
- probed++;
-
- rte_uuid_unparse(dev->device_id, ubuf, sizeof(ubuf));
-
- if (rte_bus_device_is_ignored(&rte_vmbus_bus.bus, ubuf))
- continue;
-
-next_driver:
- drv = rte_bus_find_driver(&rte_vmbus_bus.bus, drv, &dev->device);
- if (drv == NULL)
- continue;
-
- ret = rte_vmbus_bus.bus.probe_device(drv, &dev->device);
- if (ret < 0) {
- VMBUS_LOG(NOTICE,
- "Requested device %s cannot be used", ubuf);
- rte_errno = errno;
- failed++;
- } else if (ret > 0) {
- goto next_driver;
- }
- }
-
- return (probed && probed == failed) ? -1 : 0;
+ return rte_bus_generic_probe(&rte_vmbus_bus.bus);
}
static int
@@ -247,7 +216,7 @@ rte_vmbus_unregister(struct rte_vmbus_driver *driver)
struct rte_vmbus_bus rte_vmbus_bus = {
.bus = {
.scan = rte_vmbus_scan,
- .probe = rte_vmbus_probe,
+ .probe = rte_bus_generic_probe,
.cleanup = rte_vmbus_cleanup,
.find_device = rte_bus_generic_find_device,
.match = vmbus_bus_match,
diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index 493ddc0d1e..1a9c07580e 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -45,7 +45,6 @@ struct dsa_bus;
static int dsa_scan(void);
static bool dsa_match(const struct rte_driver *drv, const struct rte_device *dev);
static int dsa_probe_device(struct rte_driver *drv, struct rte_device *dev);
-static int dsa_probe(void);
static enum rte_iova_mode dsa_get_iommu_class(void);
static int dsa_addr_parse(const char *name, void *addr);
@@ -60,9 +59,9 @@ struct dsa_bus {
struct dsa_bus dsa_bus = {
.bus = {
.scan = dsa_scan,
+ .probe = rte_bus_generic_probe,
.match = dsa_match,
.probe_device = dsa_probe_device,
- .probe = dsa_probe,
.find_device = rte_bus_generic_find_device,
.get_iommu_class = dsa_get_iommu_class,
.parse = dsa_addr_parse,
@@ -264,24 +263,6 @@ is_for_this_process_use(const char *name)
return retval;
}
-static int
-dsa_probe(void)
-{
- struct rte_dsa_device *dev;
-
- RTE_BUS_FOREACH_DEV(dev, &dsa_bus.bus) {
- if (dsa_match(&dsa_bus.driver, &dev->device) &&
- !rte_bus_device_is_ignored(&dsa_bus.bus, dev->device.name)) {
- dev->device.driver = &dsa_bus.driver;
- dsa_probe_device(&dsa_bus.driver, &dev->device);
- continue;
- }
- IDXD_PMD_DEBUG("WQ '%s', not allocated to DPDK", dev->wq_name);
- }
-
- return 0;
-}
-
static bool dsa_match(const struct rte_driver *drv, const struct rte_device *dev)
{
const struct rte_dsa_device *dsa_dev = RTE_BUS_DEVICE(dev, *dsa_dev);
diff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c
index 88c417e8d3..94b7be5f5f 100644
--- a/lib/eal/common/eal_common_bus.c
+++ b/lib/eal/common/eal_common_bus.c
@@ -72,6 +72,51 @@ rte_bus_scan(void)
return 0;
}
+/*
+ * Generic probe function for buses.
+ * Iterates through all devices on the bus, finds matching drivers,
+ * and calls bus->probe_device() for each device.
+ */
+RTE_EXPORT_INTERNAL_SYMBOL(rte_bus_generic_probe)
+int
+rte_bus_generic_probe(struct rte_bus *bus)
+{
+ size_t probed = 0, failed = 0;
+ struct rte_device *dev;
+
+ TAILQ_FOREACH(dev, &bus->device_list, next) {
+ struct rte_driver *drv = NULL;
+ int ret;
+
+ if (rte_bus_device_is_ignored(bus, dev->name))
+ continue;
+
+ if (rte_dev_is_probed(dev) && !bus->allow_multi_probe) {
+ EAL_LOG(INFO, "Device %s is already probed", dev->name);
+ continue;
+ }
+
+ probed++;
+next_driver:
+ drv = rte_bus_find_driver(bus, drv, dev);
+ if (drv == NULL)
+ continue;
+
+ ret = bus->probe_device(drv, dev);
+ if (ret > 0)
+ goto next_driver;
+
+ if (ret < 0) {
+ if (ret == -EEXIST)
+ continue;
+ EAL_LOG(ERR, "Failed to probe device %s", dev->name);
+ failed++;
+ }
+ }
+
+ return (probed && probed == failed) ? -1 : 0;
+}
+
/* Probe all devices of all buses */
RTE_EXPORT_SYMBOL(rte_bus_probe)
int
@@ -86,14 +131,14 @@ rte_bus_probe(void)
continue;
}
- ret = bus->probe();
+ ret = bus->probe(bus);
if (ret)
EAL_LOG(ERR, "Bus (%s) probe failed.",
rte_bus_name(bus));
}
if (vbus) {
- ret = vbus->probe();
+ ret = vbus->probe(vbus);
if (ret)
EAL_LOG(ERR, "Bus (%s) probe failed.",
rte_bus_name(vbus));
diff --git a/lib/eal/include/bus_driver.h b/lib/eal/include/bus_driver.h
index a2fd3bd82d..3d04efbd3f 100644
--- a/lib/eal/include/bus_driver.h
+++ b/lib/eal/include/bus_driver.h
@@ -40,11 +40,14 @@ typedef int (*rte_bus_scan_t)(void);
*
* This is called while iterating over each registered bus.
*
+ * @param bus
+ * A pointer to the bus structure.
+ *
* @return
* 0 for successful probe
* !0 for any error while probing
*/
-typedef int (*rte_bus_probe_t)(void);
+typedef int (*rte_bus_probe_t)(struct rte_bus *bus);
/**
* Device iterator to find a device on a bus.
@@ -598,6 +601,24 @@ __rte_internal
struct rte_driver *rte_bus_find_driver(const struct rte_bus *bus, const struct rte_driver *start,
const struct rte_device *dev);
+/**
+ * Generic probe function for buses.
+ *
+ * Iterates through all devices on the bus, finds matching drivers using
+ * rte_bus_find_driver(), and calls bus->probe_device() for each device that has
+ * a matching driver.
+ *
+ * This function can be used by buses that don't require special probe
+ * logic and just need the standard device iteration and driver matching.
+ *
+ * @param bus
+ * Pointer to the bus to probe.
+ * @return
+ * 0 on success.
+ */
+__rte_internal
+int rte_bus_generic_probe(struct rte_bus *bus);
+
#ifdef __cplusplus
}
#endif
--
2.53.0
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox