aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@gmail.com>2018-11-27 10:44:39 +0000
committerLuca Boccassi <luca.boccassi@gmail.com>2018-11-27 10:45:47 +0000
commita4f0fa29488e582ab8b5ef9db475b3d26ded690c (patch)
treede163f35a726d518a3f93ab6ee4ac25b8982635d /lib
parent29058550643267a554e0368806dece63b047c5cb (diff)
New upstream version 18.11upstream/18.11upstream
Change-Id: I6c63198045de1e34fda8a7b4665d89d5f4a20d20 Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/librte_cfgfile/rte_cfgfile_version.map4
-rw-r--r--lib/librte_compressdev/rte_compressdev_version.map4
-rw-r--r--lib/librte_cryptodev/rte_cryptodev_version.map2
-rw-r--r--lib/librte_eal/bsdapp/eal/eal.c6
-rw-r--r--lib/librte_eal/common/eal_common_dev.c12
-rw-r--r--lib/librte_eal/common/eal_common_proc.c34
-rw-r--r--lib/librte_eal/common/hotplug_mp.c43
-rw-r--r--lib/librte_eal/common/include/rte_bitmap.h45
-rw-r--r--lib/librte_eal/common/include/rte_common.h32
-rw-r--r--lib/librte_eal/common/include/rte_version.h4
-rw-r--r--lib/librte_eal/linuxapp/eal/eal_memory.c2
-rw-r--r--lib/librte_ethdev/rte_ethdev.h2
-rw-r--r--lib/librte_eventdev/rte_event_eth_rx_adapter.c2
-rw-r--r--lib/librte_eventdev/rte_event_eth_tx_adapter.c2
-rw-r--r--lib/librte_ip_frag/rte_ip_frag_version.map4
-rw-r--r--lib/librte_kni/rte_kni.c2
-rw-r--r--lib/librte_power/rte_power_version.map17
-rw-r--r--lib/librte_security/rte_security.c6
-rw-r--r--lib/librte_security/rte_security.h6
-rw-r--r--lib/librte_security/rte_security_version.map8
-rw-r--r--lib/librte_vhost/vhost.h22
21 files changed, 121 insertions, 138 deletions
diff --git a/lib/librte_cfgfile/rte_cfgfile_version.map b/lib/librte_cfgfile/rte_cfgfile_version.map
index cc4a11f6..a0a11cea 100644
--- a/lib/librte_cfgfile/rte_cfgfile_version.map
+++ b/lib/librte_cfgfile/rte_cfgfile_version.map
@@ -22,9 +22,9 @@ DPDK_16.04 {
} DPDK_2.0;
DPDK_17.05 {
- global:
+ global:
- rte_cfgfile_load_with_params;
+ rte_cfgfile_load_with_params;
} DPDK_16.04;
diff --git a/lib/librte_compressdev/rte_compressdev_version.map b/lib/librte_compressdev/rte_compressdev_version.map
index 6f900b67..9e2d3528 100644
--- a/lib/librte_compressdev/rte_compressdev_version.map
+++ b/lib/librte_compressdev/rte_compressdev_version.map
@@ -1,5 +1,5 @@
EXPERIMENTAL {
- global:
+ global:
rte_compressdev_capability_get;
rte_compressdev_close;
@@ -35,5 +35,5 @@ EXPERIMENTAL {
rte_comp_op_free;
rte_comp_op_pool_create;
- local: *;
+ local: *;
};
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 7ca00735..a695b61d 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -89,7 +89,7 @@ DPDK_18.05 {
} DPDK_17.11;
EXPERIMENTAL {
- global:
+ global:
rte_cryptodev_asym_capability_get;
rte_cryptodev_asym_get_header_session_size;
diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index 508cbc46..b8152a75 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -556,9 +556,11 @@ int rte_eal_has_hugepages(void)
int
rte_eal_iopl_init(void)
{
- static int fd;
+ static int fd = -1;
+
+ if (fd < 0)
+ fd = open("/dev/io", O_RDWR);
- fd = open("/dev/io", O_RDWR);
if (fd < 0)
return -1;
/* keep fd open for iopl */
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 1fdc9ab1..fd7f5ca7 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -166,18 +166,20 @@ local_dev_probe(const char *devargs, struct rte_device **new_dev)
ret = -ENODEV;
goto err_devarg;
}
+ /* Since there is a matching device, it is now its responsibility
+ * to manage the devargs we've just inserted. From this point
+ * those devargs shouldn't be removed manually anymore.
+ */
ret = dev->bus->plug(dev);
- if (ret) {
- if (rte_dev_is_probed(dev)) /* if already succeeded earlier */
- return ret; /* no rollback */
+ if (ret && !rte_dev_is_probed(dev)) { /* if hasn't ever succeeded */
RTE_LOG(ERR, EAL, "Driver cannot attach the device (%s)\n",
dev->name);
- goto err_devarg;
+ return ret;
}
*new_dev = dev;
- return 0;
+ return ret;
err_devarg:
if (rte_devargs_remove(da) != 0) {
diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c
index f65ef56c..1c3f09aa 100644
--- a/lib/librte_eal/common/eal_common_proc.c
+++ b/lib/librte_eal/common/eal_common_proc.c
@@ -827,28 +827,6 @@ mp_request_async(const char *dst, struct rte_mp_msg *req,
goto fail;
}
- /*
- * set the alarm before sending message. there are two possible error
- * scenarios to consider here:
- *
- * - if the alarm set fails, we free the memory right there
- * - if the alarm set succeeds but sending message fails, then the alarm
- * will trigger and clean up the memory
- *
- * Even if the alarm triggers too early (i.e. immediately), we're still
- * holding the lock to pending requests queue, so the interrupt thread
- * will just spin until we release the lock, and either release the
- * memory, or doesn't find any pending requests in the queue because we
- * never added any due to send message failure.
- */
- if (rte_eal_alarm_set(ts->tv_sec * 1000000 + ts->tv_nsec / 1000,
- async_reply_handle, pending_req) < 0) {
- RTE_LOG(ERR, EAL, "Fail to set alarm for request %s:%s\n",
- dst, req->name);
- ret = -1;
- goto fail;
- }
-
ret = send_msg(dst, req, MP_REQ);
if (ret < 0) {
RTE_LOG(ERR, EAL, "Fail to send request %s:%s\n",
@@ -859,10 +837,18 @@ mp_request_async(const char *dst, struct rte_mp_msg *req,
ret = 0;
goto fail;
}
- TAILQ_INSERT_TAIL(&pending_requests.requests, pending_req, next);
-
param->user_reply.nb_sent++;
+ /* if alarm set fails, we simply ignore the reply */
+ if (rte_eal_alarm_set(ts->tv_sec * 1000000 + ts->tv_nsec / 1000,
+ async_reply_handle, pending_req) < 0) {
+ RTE_LOG(ERR, EAL, "Fail to set alarm for request %s:%s\n",
+ dst, req->name);
+ ret = -1;
+ goto fail;
+ }
+ TAILQ_INSERT_TAIL(&pending_requests.requests, pending_req, next);
+
return 0;
fail:
free(pending_req);
diff --git a/lib/librte_eal/common/hotplug_mp.c b/lib/librte_eal/common/hotplug_mp.c
index 7c9fcc46..070e2e0c 100644
--- a/lib/librte_eal/common/hotplug_mp.c
+++ b/lib/librte_eal/common/hotplug_mp.c
@@ -87,7 +87,7 @@ __handle_secondary_request(void *param)
const struct eal_dev_mp_req *req =
(const struct eal_dev_mp_req *)msg->param;
struct eal_dev_mp_req tmp_req;
- struct rte_devargs *da;
+ struct rte_devargs da;
struct rte_device *dev;
struct rte_bus *bus;
int ret = 0;
@@ -114,15 +114,11 @@ __handle_secondary_request(void *param)
goto rollback;
}
} else if (req->t == EAL_DEV_REQ_TYPE_DETACH) {
- da = calloc(1, sizeof(*da));
- if (da == NULL) {
- ret = -ENOMEM;
- goto finish;
- }
-
- ret = rte_devargs_parse(da, req->devargs);
+ ret = rte_devargs_parse(&da, req->devargs);
if (ret != 0)
goto finish;
+ free(da.args); /* we don't need those */
+ da.args = NULL;
ret = eal_dev_hotplug_request_to_secondary(&tmp_req);
if (ret != 0) {
@@ -131,16 +127,16 @@ __handle_secondary_request(void *param)
goto rollback;
}
- bus = rte_bus_find_by_name(da->bus->name);
+ bus = rte_bus_find_by_name(da.bus->name);
if (bus == NULL) {
- RTE_LOG(ERR, EAL, "Cannot find bus (%s)\n", da->bus->name);
+ RTE_LOG(ERR, EAL, "Cannot find bus (%s)\n", da.bus->name);
ret = -ENOENT;
goto finish;
}
- dev = bus->find_device(NULL, cmp_dev_name, da->name);
+ dev = bus->find_device(NULL, cmp_dev_name, da.name);
if (dev == NULL) {
- RTE_LOG(ERR, EAL, "Cannot find plugged device (%s)\n", da->name);
+ RTE_LOG(ERR, EAL, "Cannot find plugged device (%s)\n", da.name);
ret = -ENOENT;
goto finish;
}
@@ -264,6 +260,19 @@ static void __handle_primary_request(void *param)
goto quit;
}
+ if (!rte_dev_is_probed(dev)) {
+ if (req->t == EAL_DEV_REQ_TYPE_ATTACH_ROLLBACK) {
+ /**
+ * Don't fail the rollback just because there's
+ * nothing to do.
+ */
+ ret = 0;
+ } else
+ ret = -ENODEV;
+
+ goto quit;
+ }
+
ret = local_dev_remove(dev);
quit:
free(da->args);
@@ -391,13 +400,13 @@ int eal_dev_hotplug_request_to_secondary(struct eal_dev_mp_req *req)
struct eal_dev_mp_req *resp =
(struct eal_dev_mp_req *)mp_reply.msgs[i].param;
if (resp->result != 0) {
- req->result = resp->result;
if (req->t == EAL_DEV_REQ_TYPE_ATTACH &&
- req->result != -EEXIST)
- break;
+ resp->result == -EEXIST)
+ continue;
if (req->t == EAL_DEV_REQ_TYPE_DETACH &&
- req->result != -ENOENT)
- break;
+ resp->result == -ENOENT)
+ continue;
+ req->result = resp->result;
}
}
diff --git a/lib/librte_eal/common/include/rte_bitmap.h b/lib/librte_eal/common/include/rte_bitmap.h
index 7a36ce73..77727c82 100644
--- a/lib/librte_eal/common/include/rte_bitmap.h
+++ b/lib/librte_eal/common/include/rte_bitmap.h
@@ -43,10 +43,6 @@ extern "C" {
#include <rte_branch_prediction.h>
#include <rte_prefetch.h>
-#ifndef RTE_BITMAP_OPTIMIZATIONS
-#define RTE_BITMAP_OPTIMIZATIONS 1
-#endif
-
/* Slab */
#define RTE_BITMAP_SLAB_BIT_SIZE 64
#define RTE_BITMAP_SLAB_BIT_SIZE_LOG2 6
@@ -97,43 +93,12 @@ __rte_bitmap_index2_set(struct rte_bitmap *bmp)
bmp->index2 = (((bmp->index1 << RTE_BITMAP_SLAB_BIT_SIZE_LOG2) + bmp->offset1) << RTE_BITMAP_CL_SLAB_SIZE_LOG2);
}
-#if RTE_BITMAP_OPTIMIZATIONS
-
-static inline int
+static inline int __rte_deprecated
rte_bsf64(uint64_t slab, uint32_t *pos)
{
- if (likely(slab == 0)) {
- return 0;
- }
-
- *pos = __builtin_ctzll(slab);
- return 1;
+ return rte_bsf64_safe(slab, pos);
}
-#else
-
-static inline int
-rte_bsf64(uint64_t slab, uint32_t *pos)
-{
- uint64_t mask;
- uint32_t i;
-
- if (likely(slab == 0)) {
- return 0;
- }
-
- for (i = 0, mask = 1; i < RTE_BITMAP_SLAB_BIT_SIZE; i ++, mask <<= 1) {
- if (unlikely(slab & mask)) {
- *pos = i;
- return 1;
- }
- }
-
- return 0;
-}
-
-#endif
-
static inline uint32_t
__rte_bitmap_get_memory_footprint(uint32_t n_bits,
uint32_t *array1_byte_offset, uint32_t *array1_slabs,
@@ -439,9 +404,8 @@ __rte_bitmap_scan_search(struct rte_bitmap *bmp)
value1 = bmp->array1[bmp->index1];
value1 &= __rte_bitmap_mask1_get(bmp);
- if (rte_bsf64(value1, &bmp->offset1)) {
+ if (rte_bsf64_safe(value1, &bmp->offset1))
return 1;
- }
__rte_bitmap_index1_inc(bmp);
bmp->offset1 = 0;
@@ -450,9 +414,8 @@ __rte_bitmap_scan_search(struct rte_bitmap *bmp)
for (i = 0; i < bmp->array1_size; i ++, __rte_bitmap_index1_inc(bmp)) {
value1 = bmp->array1[bmp->index1];
- if (rte_bsf64(value1, &bmp->offset1)) {
+ if (rte_bsf64_safe(value1, &bmp->offset1))
return 1;
- }
}
return 0;
diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index 87f0f630..66cdf60b 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -270,16 +270,7 @@ rte_is_aligned(void *ptr, unsigned align)
/**
* Triggers an error at compilation time if the condition is true.
*/
-#ifndef __OPTIMIZE__
#define RTE_BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
-#else
-extern int RTE_BUILD_BUG_ON_detected_error;
-#define RTE_BUILD_BUG_ON(condition) do { \
- ((void)sizeof(char[1 - 2*!!(condition)])); \
- if (condition) \
- RTE_BUILD_BUG_ON_detected_error = 1; \
-} while(0)
-#endif
/**
* Combines 32b inputs most significant set bits into the least
@@ -491,6 +482,29 @@ rte_fls_u32(uint32_t x)
return (x == 0) ? 0 : 32 - __builtin_clz(x);
}
+/**
+ * Searches the input parameter for the least significant set bit
+ * (starting from zero). Safe version (checks for input parameter being zero).
+ *
+ * @warning ``pos`` must be a valid pointer. It is not checked!
+ *
+ * @param v
+ * The input parameter.
+ * @param pos
+ * If ``v`` was not 0, this value will contain position of least significant
+ * bit within the input parameter.
+ * @return
+ * Returns 0 if ``v`` was 0, otherwise returns 1.
+ */
+static inline int
+rte_bsf64_safe(uint64_t v, uint32_t *pos)
+{
+ if (v == 0)
+ return 0;
+
+ *pos = __builtin_ctzll(v);
+ return 1;
+}
#ifndef offsetof
/** Return the offset of a field in a structure. */
diff --git a/lib/librte_eal/common/include/rte_version.h b/lib/librte_eal/common/include/rte_version.h
index 45b89430..f01c227f 100644
--- a/lib/librte_eal/common/include/rte_version.h
+++ b/lib/librte_eal/common/include/rte_version.h
@@ -42,14 +42,14 @@ extern "C" {
/**
* Extra string to be appended to version number
*/
-#define RTE_VER_SUFFIX "-rc"
+#define RTE_VER_SUFFIX ""
/**
* Patch release number
* 0-15 = release candidates
* 16 = release
*/
-#define RTE_VER_RELEASE 4
+#define RTE_VER_RELEASE 16
/**
* Macro to compute a version number usable for comparisons
diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
index 6f94621d..32feb415 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -2230,6 +2230,8 @@ memseg_primary_init(void)
socket_id, hugepage_sz);
}
}
+ /* number of memtypes could have been lower due to no NUMA support */
+ n_memtypes = cur_type;
/* set up limits for types */
max_mem = (uint64_t)RTE_MAX_MEM_MB << 20;
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 8a92d91e..1960f3a2 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -1306,8 +1306,6 @@ enum rte_eth_dev_state {
RTE_ETH_DEV_UNUSED = 0,
/** Device is attached when allocated in probing. */
RTE_ETH_DEV_ATTACHED,
- /** The deferred state is useless and replaced by ownership. */
- RTE_ETH_DEV_DEFERRED,
/** Device is in removed state when plug-out is detected. */
RTE_ETH_DEV_REMOVED,
};
diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
index 71d008cd..8831bc35 100644
--- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
@@ -1165,8 +1165,8 @@ rxa_service_func(void *args)
if (rte_spinlock_trylock(&rx_adapter->rx_lock) == 0)
return 0;
if (!rx_adapter->rxa_started) {
- return 0;
rte_spinlock_unlock(&rx_adapter->rx_lock);
+ return 0;
}
stats = &rx_adapter->stats;
diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.c b/lib/librte_eventdev/rte_event_eth_tx_adapter.c
index 3a21defb..ccf8a755 100644
--- a/lib/librte_eventdev/rte_event_eth_tx_adapter.c
+++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.c
@@ -702,7 +702,7 @@ txa_service_queue_add(uint8_t id,
struct txa_service_queue_info *tqi;
struct rte_eth_dev_tx_buffer *tb;
struct txa_retry *txa_retry;
- int ret;
+ int ret = 0;
txa = txa_service_id_to_data(id);
diff --git a/lib/librte_ip_frag/rte_ip_frag_version.map b/lib/librte_ip_frag/rte_ip_frag_version.map
index d40d5515..a193007c 100644
--- a/lib/librte_ip_frag/rte_ip_frag_version.map
+++ b/lib/librte_ip_frag/rte_ip_frag_version.map
@@ -13,9 +13,9 @@ DPDK_2.0 {
};
DPDK_17.08 {
- global:
+ global:
- rte_ip_frag_table_destroy;
+ rte_ip_frag_table_destroy;
} DPDK_2.0;
diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c
index c9726d4f..73aecccc 100644
--- a/lib/librte_kni/rte_kni.c
+++ b/lib/librte_kni/rte_kni.c
@@ -483,7 +483,7 @@ int
rte_kni_handle_request(struct rte_kni *kni)
{
unsigned ret;
- struct rte_kni_request *req;
+ struct rte_kni_request *req = NULL;
if (kni == NULL)
return -1;
diff --git a/lib/librte_power/rte_power_version.map b/lib/librte_power/rte_power_version.map
index 17a083b2..04291736 100644
--- a/lib/librte_power/rte_power_version.map
+++ b/lib/librte_power/rte_power_version.map
@@ -35,14 +35,13 @@ DPDK_18.08 {
} DPDK_17.11;
EXPERIMENTAL {
- global:
-
- rte_empty_poll_detection;
- rte_power_empty_poll_stat_fetch;
- rte_power_empty_poll_stat_free;
- rte_power_empty_poll_stat_init;
- rte_power_empty_poll_stat_update;
- rte_power_poll_stat_fetch;
- rte_power_poll_stat_update;
+ global:
+ rte_empty_poll_detection;
+ rte_power_empty_poll_stat_fetch;
+ rte_power_empty_poll_stat_free;
+ rte_power_empty_poll_stat_init;
+ rte_power_empty_poll_stat_update;
+ rte_power_poll_stat_fetch;
+ rte_power_poll_stat_update;
};
diff --git a/lib/librte_security/rte_security.c b/lib/librte_security/rte_security.c
index bc81ce15..a222b33c 100644
--- a/lib/librte_security/rte_security.c
+++ b/lib/librte_security/rte_security.c
@@ -33,7 +33,7 @@ rte_security_session_create(struct rte_security_ctx *instance,
return sess;
}
-int
+int __rte_experimental
rte_security_session_update(struct rte_security_ctx *instance,
struct rte_security_session *sess,
struct rte_security_session_conf *conf)
@@ -49,7 +49,7 @@ rte_security_session_get_size(struct rte_security_ctx *instance)
return instance->ops->session_get_size(instance->device);
}
-int
+int __rte_experimental
rte_security_session_stats_get(struct rte_security_ctx *instance,
struct rte_security_session *sess,
struct rte_security_stats *stats)
@@ -86,7 +86,7 @@ rte_security_set_pkt_metadata(struct rte_security_ctx *instance,
sess, m, params);
}
-void *
+void * __rte_experimental
rte_security_get_userdata(struct rte_security_ctx *instance, uint64_t md)
{
void *userdata = NULL;
diff --git a/lib/librte_security/rte_security.h b/lib/librte_security/rte_security.h
index e07b1328..718147e0 100644
--- a/lib/librte_security/rte_security.h
+++ b/lib/librte_security/rte_security.h
@@ -344,7 +344,7 @@ rte_security_session_create(struct rte_security_ctx *instance,
* - On success returns 0
* - On failure return errno
*/
-int
+int __rte_experimental
rte_security_session_update(struct rte_security_ctx *instance,
struct rte_security_session *sess,
struct rte_security_session_conf *conf);
@@ -412,7 +412,7 @@ rte_security_set_pkt_metadata(struct rte_security_ctx *instance,
* - On success, userdata
* - On failure, NULL
*/
-void *
+void * __rte_experimental
rte_security_get_userdata(struct rte_security_ctx *instance, uint64_t md);
/**
@@ -499,7 +499,7 @@ struct rte_security_stats {
* - On success return 0
* - On failure errno
*/
-int
+int __rte_experimental
rte_security_session_stats_get(struct rte_security_ctx *instance,
struct rte_security_session *sess,
struct rte_security_stats *stats);
diff --git a/lib/librte_security/rte_security_version.map b/lib/librte_security/rte_security_version.map
index a77ca4bc..36e2ac48 100644
--- a/lib/librte_security/rte_security_version.map
+++ b/lib/librte_security/rte_security_version.map
@@ -14,3 +14,11 @@ DPDK_18.11 {
local: *;
};
+
+EXPERIMENTAL {
+ global:
+
+ rte_security_get_userdata;
+ rte_security_session_stats_get;
+ rte_security_session_update;
+};
diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
index 760f4219..5218f1b1 100644
--- a/lib/librte_vhost/vhost.h
+++ b/lib/librte_vhost/vhost.h
@@ -219,13 +219,6 @@ struct vhost_msg {
#define VIRTIO_F_RING_PACKED 34
-#define VRING_DESC_F_NEXT 1
-#define VRING_DESC_F_WRITE 2
-#define VRING_DESC_F_INDIRECT 4
-
-#define VRING_DESC_F_AVAIL (1ULL << 7)
-#define VRING_DESC_F_USED (1ULL << 15)
-
struct vring_packed_desc {
uint64_t addr;
uint32_t len;
@@ -233,10 +226,6 @@ struct vring_packed_desc {
uint16_t flags;
};
-#define VRING_EVENT_F_ENABLE 0x0
-#define VRING_EVENT_F_DISABLE 0x1
-#define VRING_EVENT_F_DESC 0x2
-
struct vring_packed_desc_event {
uint16_t off_wrap;
uint16_t flags;
@@ -244,6 +233,17 @@ struct vring_packed_desc_event {
#endif
/*
+ * Declare below packed ring defines unconditionally
+ * as Kernel header might use different names.
+ */
+#define VRING_DESC_F_AVAIL (1ULL << 7)
+#define VRING_DESC_F_USED (1ULL << 15)
+
+#define VRING_EVENT_F_ENABLE 0x0
+#define VRING_EVENT_F_DISABLE 0x1
+#define VRING_EVENT_F_DESC 0x2
+
+/*
* Available and used descs are in same order
*/
#ifndef VIRTIO_F_IN_ORDER