Skip to contentSkip to conversation

ethdev: reserve space in main structs for extension

PATCH Superseded Thomas Monjalon 4 participants 8 messages Nov 7, 2019 – Nov 11, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ethdev: reserve space in main structs for extension

The struct rte_eth_dev and rte_eth_dev_data are supposed to be used internally only, but there is a chance that increasing their size would break ABI for some applications. In order to allow smooth addition of features without breaking ABI compatibility, some space is reserved.

---
 lib/librte_ethdev/rte_ethdev_core.h | 6 ++++++
 1 file changed, 6 insertions(+)
lib/librte_ethdev/rte_ethdev_core.h +6 -0
index 392aea8e6b..ea8dd1d9ba 100644
@@ -698,6 +698,9 @@ struct rte_eth_dev {
 	struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
 	enum rte_eth_dev_state state; /**< Flag indicating the port state */
 	void *security_ctx; /**< Context for security ops */
+
+	uint64_t reserved_64s[4]; /**< Reserved for future fields */
+	void *reserved_ptrs[4]; /**< Reserved for future fields */
 } __rte_cache_aligned;
 
 struct rte_eth_dev_sriov;
@@ -764,6 +767,9 @@ struct rte_eth_dev_data {
 			/**< Switch-specific identifier.
 			 *   Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags.
 			 */
+
+	uint64_t reserved_64s[4]; /**< Reserved for future fields */
+	void *reserved_ptrs[4]; /**< Reserved for future fields */
 } __rte_cache_aligned;
 
 /**
Signature · 1 line
2.23.0
#1 lore raw
Quoted 26 lines · On Thu, 7 Nov 2019 23:15:24 +0100 Thomas Monjalon <[email protected]> wrote:

The struct rte_eth_dev and rte_eth_dev_data are supposed to be used internally only, but there is a chance that increasing their size would break ABI for some applications. In order to allow smooth addition of features without breaking ABI compatibility, some space is reserved.

---
 lib/librte_ethdev/rte_ethdev_core.h | 6 ++++++
 1 file changed, 6 insertions(+)
lib/librte_ethdev/rte_ethdev_core.h +3 -0
index 392aea8e6b..ea8dd1d9ba 100644
@@ -698,6 +698,9 @@ struct rte_eth_dev {
 	struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
 	enum rte_eth_dev_state state; /**< Flag indicating the port state */
 	void *security_ctx; /**< Context for security ops */
+
+	uint64_t reserved_64s[4]; /**< Reserved for future fields */
+	void *reserved_ptrs[4]; /**< Reserved for future fields */
 } __rte_cache_aligned;
 
 struct rte_eth_dev_sriov;

lib/librte_ethdev/rte_ethdev_core.h struct rte_eth_dev_data { · line 775

Quoted 9 lines
lib/librte_ethdev/rte_ethdev_core.h +3 -0
@@ -764,6 +767,9 @@ struct rte_eth_dev_data {
 			/**< Switch-specific identifier.
 			 *   Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags.
 			 */
+
+	uint64_t reserved_64s[4]; /**< Reserved for future fields */
+	void *reserved_ptrs[4]; /**< Reserved for future fields */
 } __rte_cache_aligned;
 
 /**

Void * is 32 bits on 32 bit architectures is that helpful or not?

#2 lore raw

08/11/2019 04:41, Stephen Hemminger:

Quoted 9 lines
Quoted 6 lines · On Thu, 7 Nov 2019 23:15:24 +0100 Thomas Monjalon <[email protected]> wrote:

The struct rte_eth_dev and rte_eth_dev_data are supposed to be used internally only, but there is a chance that increasing their size would break ABI for some applications. In order to allow smooth addition of features without breaking ABI compatibility, some space is reserved.

Quoted 9 lines

lib/librte_ethdev/rte_ethdev_core.h struct rte_eth_dev_data { · line 770

Quoted 7 lines

---

lib/librte_ethdev/rte_ethdev_core.h +3 -0
@@ -764,6 +767,9 @@ struct rte_eth_dev_data {
+
+	uint64_t reserved_64s[4]; /**< Reserved for future fields */
+	void *reserved_ptrs[4]; /**< Reserved for future fields */
 } __rte_cache_aligned;

Void * is 32 bits on 32 bit architectures is that helpful or not?

That's why I reserved separately uint and pointers.
If we need to add a pointer, we decrease the size of the pointer array to keep the same struct size on all archs.

#4 lore raw
Quoted 9 lines · Ferruh Yigit
Quoted 7 lines · Thomas Monjalon

The struct rte_eth_dev and rte_eth_dev_data are supposed to be used internally only, but there is a chance that increasing their size would break ABI for some applications. In order to allow smooth addition of features without breaking ABI compatibility, some space is reserved.

#5 lore raw

PATCH v2 1/1 ethdev: reserve space in main structs for extension

In reply to Thomas Monjalon

In order to allow smooth addition of features without breaking ABI compatibility, some space is reserved in several core structs of ethdev API.

The struct rte_eth_dev and rte_eth_dev_data are supposed to be used internally only, but there is a chance that increasing their size would break ABI for some applications.

---
v2: padding more struct (config and get_info)

Note: previous acks are not kept in order to request an explicit review of these new changes.

---
 lib/librte_ethdev/rte_ethdev.h      | 15 +++++++++++++++
 lib/librte_ethdev/rte_ethdev_core.h |  6 ++++++
 2 files changed, 21 insertions(+)
lib/librte_ethdev/rte_ethdev.h +15 -0
index 44d77b332e..4ba01905c5 100644
@@ -402,6 +402,9 @@ struct rte_eth_rxmode {
 	 * structure are allowed to be set.
 	 */
 	uint64_t offloads;
+
+	uint64_t reserved_64s[2]; /**< Reserved for future fields */
+	void *reserved_ptrs[2];   /**< Reserved for future fields */
 };
 
 /**
@@ -802,6 +805,9 @@ struct rte_eth_txmode {
 		/**< If set, reject sending out untagged pkts */
 		hw_vlan_insert_pvid : 1;
 		/**< If set, enable port based VLAN insertion */
+
+	uint64_t reserved_64s[2]; /**< Reserved for future fields */
+	void *reserved_ptrs[2];   /**< Reserved for future fields */
 };
 
 /**
@@ -818,6 +824,9 @@ struct rte_eth_rxconf {
 	 * fields on rte_eth_dev_info structure are allowed to be set.
 	 */
 	uint64_t offloads;
+
+	uint64_t reserved_64s[2]; /**< Reserved for future fields */
+	void *reserved_ptrs[2];   /**< Reserved for future fields */
 };
 
 /**
@@ -836,6 +845,9 @@ struct rte_eth_txconf {
 	 * fields on rte_eth_dev_info structure are allowed to be set.
 	 */
 	uint64_t offloads;
+
+	uint64_t reserved_64s[2]; /**< Reserved for future fields */
+	void *reserved_ptrs[2];   /**< Reserved for future fields */
 };
 
 /**
@@ -1260,6 +1272,9 @@ struct rte_eth_dev_info {
 	 * embedded managed interconnect/switch.
 	 */
 	struct rte_eth_switch_info switch_info;
+
+	uint64_t reserved_64s[2]; /**< Reserved for future fields */
+	void *reserved_ptrs[2];   /**< Reserved for future fields */
 };
 
 /**
lib/librte_ethdev/rte_ethdev_core.h +6 -0
index f215af7c94..4d52be6121 100644
@@ -785,6 +785,9 @@ struct rte_eth_dev {
 	struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
 	enum rte_eth_dev_state state; /**< Flag indicating the port state */
 	void *security_ctx; /**< Context for security ops */
+
+	uint64_t reserved_64s[4]; /**< Reserved for future fields */
+	void *reserved_ptrs[4];   /**< Reserved for future fields */
 } __rte_cache_aligned;
 
 struct rte_eth_dev_sriov;
@@ -851,6 +854,9 @@ struct rte_eth_dev_data {
 			/**< Switch-specific identifier.
 			 *   Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags.
 			 */
+
+	uint64_t reserved_64s[4]; /**< Reserved for future fields */
+	void *reserved_ptrs[4];   /**< Reserved for future fields */
 } __rte_cache_aligned;
 
 /**
Signature · 1 line
2.23.0
Acked-by on v2 1/1
#6 lore raw
Quoted 9 lines · Thomas Monjalon

In order to allow smooth addition of features without breaking ABI compatibility, some space is reserved in several core structs of ethdev API.

The struct rte_eth_dev and rte_eth_dev_data are supposed to be used internally only, but there is a chance that increasing their size would break ABI for some applications.

Applied
#7 lore raw
Quoted 5 lines · Ferruh Yigit
Quoted 4 lines · Thomas Monjalon

In order to allow smooth addition of features without breaking ABI compatibility, some space is reserved in several core structs of ethdev API.

Quoted 8 lines
Quoted 5 lines

The struct rte_eth_dev and rte_eth_dev_data are supposed to be used internally only, but there is a chance that increasing their size would break ABI for some applications.

Applied to dpdk-next-net/master, thanks.