net: sockets: Add a socket offload module

This patch enables BSD socket offload to a dedicated
TCP/IP offload engine.

This provides a simpler, more direct mechanism than going
through NET_OFFLOAD (zsock -> net_context -> socket conversions)
for those devices which provide complete TCP/IP offload at the
BSD socket level, and whose use cases do not require
IP routing between multiple network interfaces.

To use, configure CONFIG_NET_SOCKETS_OFFLOAD=y, and register
socket_offload_ops with this module.

Fixes #3706

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
This commit is contained in:
Gil Pitney 2017-07-18 13:54:53 -07:00 committed by Jukka Rissanen
commit c21b0fb357
6 changed files with 249 additions and 8 deletions

View file

@ -0,0 +1,18 @@
/*
* Copyright (c) 2018 Linaro Limited.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <net/socket_offload.h>
/* Only one provider may register socket operations upon boot. */
const struct socket_offload *socket_ops;
void socket_offload_register(const struct socket_offload *ops)
{
__ASSERT_NO_MSG(ops);
__ASSERT_NO_MSG(socket_ops == NULL);
socket_ops = ops;
}