net: context: Allow to put context into FIFO at expense of user_data
By moving user_data member at the beginning of structure. With
refcount at the beginning, reliable passsing of contexts via
FIFO was just impossible. (Queuing contexts to a FIFO is required
for BSD Sockets API).
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
diff --git a/include/net/net_context.h b/include/net/net_context.h
index e7d2027..d8ab952 100644
--- a/include/net/net_context.h
+++ b/include/net/net_context.h
@@ -176,6 +176,13 @@
* anyway. This saves 12 bytes / context in IPv6.
*/
struct net_context {
+ /** User data.
+ *
+ * First member of the structure to let users either have user data
+ * associated with a context, or put contexts into a FIFO.
+ */
+ void *user_data;
+
/** Reference count
*/
atomic_t refcount;
@@ -206,10 +213,6 @@
*/
net_context_connect_cb_t connect_cb;
- /** User data.
- */
- void *user_data;
-
#if defined(CONFIG_NET_CONTEXT_NET_PKT_POOL)
/** Get TX net_buf pool for this context.
*/