Skip to content

Commit ae9b7f7

Browse files
committed
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 <[email protected]>
1 parent ecc4c38 commit ae9b7f7

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

include/net/net_context.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,13 @@ struct net_conn_handle;
176176
* anyway. This saves 12 bytes / context in IPv6.
177177
*/
178178
struct net_context {
179+
/** User data.
180+
*
181+
* First member of the structure to let users either have user data
182+
* associated with a context, or put contexts into a FIFO.
183+
*/
184+
void *user_data;
185+
179186
/** Reference count
180187
*/
181188
atomic_t refcount;
@@ -206,10 +213,6 @@ struct net_context {
206213
*/
207214
net_context_connect_cb_t connect_cb;
208215

209-
/** User data.
210-
*/
211-
void *user_data;
212-
213216
#if defined(CONFIG_NET_CONTEXT_NET_PKT_POOL)
214217
/** Get TX net_buf pool for this context.
215218
*/

0 commit comments

Comments
 (0)