diff mbox series

[2.0,v1,1/1] pktio: count padding bytes in pktio's ops_data

Message ID 1510131608-11606-2-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [2.0,v1,1/1] pktio: count padding bytes in pktio's ops_data | expand

Commit Message

Github ODP bot Nov. 8, 2017, 9 a.m. UTC
From: Josep Puigdemont <josep.puigdemont@linaro.org>


By locating the odp_data array at the end of the pktio_entry struct,
we can now account for any padding bytes added by the pktio_entry_u,
and let pktios use them if necessary.

Signed-off-by: Josep Puigdemont <josep.puigdemont@linaro.org>

---
/** Email created from pull request 284 (joseppc:use-padding-bytes)
 ** https://github.com/Linaro/odp/pull/284
 ** Patch: https://github.com/Linaro/odp/pull/284.patch
 ** Base sha: c0f99c441feadd1566b7e92789b11c30c6ee3f64
 ** Merge commit sha: 10405656125e954b98106bda520a3bc2f43ab837
 **/
 platform/linux-generic/include/odp_packet_io_internal.h  | 7 +++++--
 platform/linux-generic/include/odp_pktio_ops_subsystem.h | 4 ++--
 2 files changed, 7 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h
index 7df11618e..69ed1f97a 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -43,8 +43,6 @@  typedef union pktio_entry_u pktio_entry_t;
 
 struct pktio_entry {
 	const pktio_ops_module_t *ops;	/**< Implementation specific methods */
-	uint8_t ops_data[ODP_PKTIO_ODPS_DATA_MAX_SIZE]; /**< IO operation
-							specific data */
 	/* These two locks together lock the whole pktio device */
 	odp_ticketlock_t rxl;		/**< RX ticketlock */
 	odp_ticketlock_t txl;		/**< TX ticketlock */
@@ -97,6 +95,9 @@  struct pktio_entry {
 		odp_queue_t        queue;
 		odp_pktout_queue_t pktout;
 	} out_queue[PKTIO_MAX_QUEUES];
+
+	uint8_t ops_data[ODP_PKTIO_ODPS_DATA_MIN_SIZE]; /**< IO operation
+							specific data */
 };
 
 union pktio_entry_u {
@@ -104,6 +105,8 @@  union pktio_entry_u {
 	uint8_t pad[ROUNDUP_CACHE_LINE(sizeof(struct pktio_entry))];
 };
 
+#define ODP_PKTIO_ODPS_DATA_MAX_SIZE (sizeof(pktio_entry_t) - offsetof(struct pktio_entry, ops_data))
+
 typedef struct {
 	odp_spinlock_t lock;
 	pktio_entry_t entries[ODP_CONFIG_PKTIO_ENTRIES];
diff --git a/platform/linux-generic/include/odp_pktio_ops_subsystem.h b/platform/linux-generic/include/odp_pktio_ops_subsystem.h
index cb107fed2..998b2f7bf 100644
--- a/platform/linux-generic/include/odp_pktio_ops_subsystem.h
+++ b/platform/linux-generic/include/odp_pktio_ops_subsystem.h
@@ -85,8 +85,8 @@  typedef ODP_MODULE_CLASS(pktio_ops) {
 	odp_api_proto(pktio_ops, print) print;
 } pktio_ops_module_t;
 
-/* Maximum size of pktio specific ops data.*/
-#define ODP_PKTIO_ODPS_DATA_MAX_SIZE 80000
+/* Minimum size of pktio specific ops data.*/
+#define ODP_PKTIO_ODPS_DATA_MIN_SIZE 80000
 
 /* Extract pktio ops data from pktio entry structure */
 #define odp_ops_data(_p, _mod) \