net: sockets: Add separate macro for registering offloaded sockets

Add a separate macro for registering offloaded sockets implementation,
along with information in the structure whether the implementation is
offloaded or not. This allows to differentiate between native and
offloaded socket implementations, which is critical for binding socket
API with an interface.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2022-03-30 14:55:35 +02:00 committed by Carles Cufí
commit 7946988b16
6 changed files with 20 additions and 12 deletions

View file

@ -1207,5 +1207,5 @@ NET_DEVICE_DT_INST_OFFLOAD_DEFINE(0, modem_init, NULL,
&api_funcs, MDM_MAX_DATA_LENGTH);
/* Register NET sockets. */
NET_SOCKET_REGISTER(quectel_bg9x, CONFIG_NET_SOCKETS_OFFLOAD_PRIORITY, AF_UNSPEC,
offload_is_supported, offload_socket);
NET_SOCKET_OFFLOAD_REGISTER(quectel_bg9x, CONFIG_NET_SOCKETS_OFFLOAD_PRIORITY,
AF_UNSPEC, offload_is_supported, offload_socket);

View file

@ -2399,5 +2399,5 @@ NET_DEVICE_DT_INST_OFFLOAD_DEFINE(0, modem_init, NULL, &mdata, NULL,
CONFIG_MODEM_SIMCOM_SIM7080_INIT_PRIORITY, &api_funcs,
MDM_MAX_DATA_LENGTH);
NET_SOCKET_REGISTER(simcom_sim7080, CONFIG_NET_SOCKETS_OFFLOAD_PRIORITY, AF_UNSPEC,
offload_is_supported, offload_socket);
NET_SOCKET_OFFLOAD_REGISTER(simcom_sim7080, CONFIG_NET_SOCKETS_OFFLOAD_PRIORITY,
AF_UNSPEC, offload_is_supported, offload_socket);

View file

@ -1966,8 +1966,8 @@ static bool offload_is_supported(int family, int type, int proto)
return true;
}
NET_SOCKET_REGISTER(ublox_sara_r4, CONFIG_NET_SOCKETS_OFFLOAD_PRIORITY, AF_UNSPEC,
offload_is_supported, offload_socket);
NET_SOCKET_OFFLOAD_REGISTER(ublox_sara_r4, CONFIG_NET_SOCKETS_OFFLOAD_PRIORITY,
AF_UNSPEC, offload_is_supported, offload_socket);
#if defined(CONFIG_DNS_RESOLVER)
/* TODO: This is a bare-bones implementation of DNS handling

View file

@ -588,8 +588,8 @@ static const struct socket_op_vtable eswifi_socket_fd_op_vtable = {
};
#ifdef CONFIG_NET_SOCKETS_OFFLOAD
NET_SOCKET_REGISTER(eswifi, CONFIG_NET_SOCKETS_OFFLOAD_PRIORITY, AF_UNSPEC,
eswifi_socket_is_supported, eswifi_socket_create);
NET_SOCKET_OFFLOAD_REGISTER(eswifi, CONFIG_NET_SOCKETS_OFFLOAD_PRIORITY, AF_UNSPEC,
eswifi_socket_is_supported, eswifi_socket_create);
#endif
static int eswifi_off_getaddrinfo(const char *node, const char *service,

View file

@ -1304,8 +1304,8 @@ static int simplelink_socket_accept(void *obj, struct sockaddr *addr,
}
#ifdef CONFIG_NET_SOCKETS_OFFLOAD
NET_SOCKET_REGISTER(simplelink, CONFIG_NET_SOCKETS_OFFLOAD_PRIORITY, AF_UNSPEC,
simplelink_is_supported, simplelink_socket_create);
NET_SOCKET_OFFLOAD_REGISTER(simplelink, CONFIG_NET_SOCKETS_OFFLOAD_PRIORITY, AF_UNSPEC,
simplelink_is_supported, simplelink_socket_create);
#endif
void simplelink_sockets_init(void)