[CLOUD-DEV,v3,1/9] linux-gen: pktio: introduce generic pktio_ops data storage

Message ID 1507636815-18816-2-git-send-email-odpbot@yandex.ru
State New
Headers show
Series
  • Cloud dev pktio ops data pr
Related show

Commit Message

Github ODP bot Oct. 10, 2017, noon
From: Bogdan Pricope <bogdan.pricope@linaro.org>


Signed-off-by: Bogdan Pricope <bogdan.pricope@linaro.org>

---
/** Email created from pull request 196 (bogdanPricope:cloud_dev_pktio_ops_data_pr)
 ** https://github.com/Linaro/odp/pull/196
 ** Patch: https://github.com/Linaro/odp/pull/196.patch
 ** Base sha: 3d3c8f71f39ff139695d6f4b8e5ea17502c5f7cf
 ** Merge commit sha: 2bae88983ff377d83fcf9c99bf5c380275454327
 **/
 platform/linux-dpdk/include/odp_packet_io_internal.h     | 5 ++++-
 platform/linux-generic/include/odp_packet_io_internal.h  | 5 ++++-
 platform/linux-generic/include/odp_pktio_ops_subsystem.h | 7 +++++++
 3 files changed, 15 insertions(+), 2 deletions(-)

Patch

diff --git a/platform/linux-dpdk/include/odp_packet_io_internal.h b/platform/linux-dpdk/include/odp_packet_io_internal.h
index 10760ca47..d31c449e2 100644
--- a/platform/linux-dpdk/include/odp_packet_io_internal.h
+++ b/platform/linux-dpdk/include/odp_packet_io_internal.h
@@ -42,7 +42,10 @@  typedef union pktio_entry_u pktio_entry_t;
 
 struct pktio_entry {
 	const pktio_ops_module_t *ops;	/**< Implementation specific methods */
-	pktio_ops_data_t ops_data;
+	union {
+		pktio_ops_data_t ops_data;
+		uint8_t _ops_data[ODP_PKTIO_ODPS_DATA_MAX_SIZE];
+	};
 	/* These two locks together lock the whole pktio device */
 	odp_ticketlock_t rxl;		/**< RX ticketlock */
 	odp_ticketlock_t txl;		/**< TX ticketlock */
diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h
index dacea47c9..79f5b1082 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -50,7 +50,10 @@  typedef union pktio_entry_u pktio_entry_t;
 
 struct pktio_entry {
 	const pktio_ops_module_t *ops;	/**< Implementation specific methods */
-	pktio_ops_data_t ops_data;	/**< IO operation specific data */
+	union {
+		pktio_ops_data_t ops_data;  /**< IO operation specific data */
+		uint8_t _ops_data[ODP_PKTIO_ODPS_DATA_MAX_SIZE];
+	};
 	/* These two locks together lock the whole pktio device */
 	odp_ticketlock_t rxl;		/**< RX ticketlock */
 	odp_ticketlock_t txl;		/**< TX ticketlock */
diff --git a/platform/linux-generic/include/odp_pktio_ops_subsystem.h b/platform/linux-generic/include/odp_pktio_ops_subsystem.h
index 7a915b82c..a8da6197b 100644
--- a/platform/linux-generic/include/odp_pktio_ops_subsystem.h
+++ b/platform/linux-generic/include/odp_pktio_ops_subsystem.h
@@ -103,4 +103,11 @@  typedef union {
 /* Extract pktio ops data from pktio entry structure */
 #define ops_data(mod) s.ops_data.mod
 
+/* Maximum size of pktio specific ops data.*/
+#define ODP_PKTIO_ODPS_DATA_MAX_SIZE 80000
+
+/* Extract pktio ops data from pktio entry structure */
+#define odp_ops_data(_p, _mod) \
+	((pktio_ops_ ## _mod ## _data_t *)(uintptr_t)_p->s._ops_data)
+
 #endif