Bowen Wang
a4ce775a50
net/rpmsg/rpmsg_sockif: fix compile error about nxsched_getpid
...
need include <nuttx/sched.h>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2025-12-31 02:36:29 +08:00
Zhe Weng
87a7714103
net: Split msg_iovlen check in recvmsg into each protocol
...
To prepare for supporting multiple iov in each protocol.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2025-01-20 17:12:14 +08:00
yintao
265978d16a
net/rpmsg: Don't set POLLHUP if rpmsg channel has not been established
...
Signed-off-by: yintao <yintao@xiaomi.com>
2024-10-31 15:35:03 +08:00
yintao
d2fc3f21de
net/rpmsg: use hash to handle rp_name
...
expand the user's rpname size
hash when exceed RPMSG_SOCKET_NAME_LEN due to the limitation of eptname
Signed-off-by: yintao <yintao@xiaomi.com>
2024-10-13 11:33:04 +08:00
Xiang Xiao
cb2a6a3480
net/rpmsg: Minor cleanups
...
1.Simplify the message process in rpmsg_socket_send_single
2.Add more lock protection in rpmsg socket
3.Fix the style issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-13 11:33:04 +08:00
Xiang Xiao
3a32531a05
net/rpmsg: Remove all the special handle of "backlog == -1"
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-13 11:33:04 +08:00
Xiang Xiao
034215ab9c
net/rpmsg: sendsize should be protected by sendlock not recvlock
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-13 11:33:04 +08:00
yintao
5b372a4706
rpmsg_sockif: add rpmsg_socket_ept_release for free conn
...
Signed-off-by: yintao <yintao@xiaomi.com>
2024-10-13 11:33:04 +08:00
Xiang Xiao
b068e2357a
circbuf: Move from mm/circbuf to libs/libc/misc
...
so that it can be used by userspace program.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-09 08:41:49 +08:00
ligd
f7f8f6c104
rpmsg_socket: add shutdown support
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-09 08:36:19 +08:00
yintao
583dd00034
net/rpmsg: add SO_SNDBUF and SO_RCVBUF support
...
Signed-off-by: yintao <yintao@xiaomi.com>
2024-10-09 02:22:02 +08:00
Xiang Xiao
7c839d7a09
rptun: Remove include/nuttx/rptun/openamp.h
...
and use include/nuttx/rpmsg/rpmsg.h instead
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-07 00:44:28 +08:00
Alin Jerpelea
67d02a45eb
net: migrate to SPDX identifier
...
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-09-12 01:08:11 +08:00
Bowen Wang
fcfd5e8ebf
rpmsg/Kconfig: add rpmsg_local_name to replace rptun_local_name
...
Because rpmsg service depends on RPMSG, make rpmsg socket use the
RPMSG_LOCAL_NAME
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-02-18 04:09:34 -08:00
Xiang Xiao
3594e3e541
net/rpmsgsock: Rename rpmsg_socket_getconnname to rpmsg_socket_getpeername
...
to align with the naming convention of getpeername.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-02-04 22:06:45 +08:00
Bowen Wang
e2cf0cad39
rpmsg_sockif: recv/recvmsg return 0 when peer close
...
Follow the posix standard:
If no messages are available to be received and the peer has
performed an orderly shutdown, recv() shall return 0.
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-01-04 20:07:43 -08:00
Xiang Xiao
eddd90de78
poll: pollsetup should notify only one fd passd by caller
...
since it's redundant to iterate the whole fds array in setup
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-11-21 09:07:17 +01:00
ligd
c9bc6b1ad5
rpmsg socket: add return value check.
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-09-19 09:33:30 +08:00
yintao
89329dff3b
net/rpmsg: set conn->backlog=-1 only when socket listening
...
Signed-off-by: yintao <yintao@xiaomi.com>
2023-09-18 20:58:30 +08:00
Bowen Wang
49dbe7e177
rpmsg_sockif: add recvlock for conn->sendsize in connect
...
conn->sendsize is used in rpmsg_socket_ept_cb() and
rpmsg_socket_connect_internal(), the connected event may be missed
as stated below:
1. in rpmsg_socket_connect_internal(), judge conn->sendsize == 0
and prepare to wait sendsem;
2. interrupt by rptun thread, rpmsg_socket_ept_cb() is called to
update conn->sendsize and post the sendsem, but the no one wait
rx sem yet, so not post (see rpmsg_socket_post());
3. return to rpmsg_socket_connect_internal() to wait the sendsem, but
has miss the connected event.
So add recvlock in rpmsg_socket_connect_internal() also.
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2023-09-09 00:17:36 +08:00
Ville Juven
e163c74b90
rpmsg/rpmsg_sockif.c: Fix printf format for u64 type
...
Use PRIx64 which defines the width correctly regardless or architecture.
Fixes build error:
rpmsg/rpmsg_sockif.c:610:57: error: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'uint64_t' {aka 'long unsigned int'} [-Werror=format=]
610 | snprintf(conn->nameid, sizeof(conn->nameid), ":%llx", g_rpmsg_id++);
| ~~~^ ~~~~~~~~~~~~
| | |
| | uint64_t {aka long unsigned int}
| long long unsigned int
| %lx
2023-08-23 23:36:15 +08:00
Bowen Wang
5bc32727b4
rpmsg_sockif: block poll shoud not set POLLERR
...
Support poll rpmsg socket fd with block mode
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2023-08-19 01:30:18 +08:00
Zhe Weng
d3bca3c2cf
net: Add FIOC_FILEPATH ioctl support for ICMP(v6)/RPMsg/Usrsock sockets
...
Example of /proc/PID/group/fd in this case:
FD OFLAGS TYPE POS PATH
3 3 9 0 icmp:[dev eth0, id 1, flg 1]
4 3 9 0 icmp6:[dev eth0, id 2, flg 1]
5 3 9 0 rpmsg:[ap:[test:0]<->remote] # server side
5 3 9 0 rpmsg:[remote<->ap:[test:0]] # client side
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-08-15 15:00:59 +08:00
ligd
0383377d78
rpmsg_socket: rpmsg_socket_ns_bound() with lock
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-08-03 08:01:31 -07:00
ligd
17010ff811
rpmsg_socket: move nameid outof user define space
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-08-03 08:01:31 -07:00
dongjiuzhu1
44b08d3a67
net/rpmsg: read receiving data after unbind
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-29 07:04:43 -07:00
dongjiuzhu1
9a22741e32
net/rpmsg: get credentials between client and server
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-28 07:40:00 -07:00
chao an
36591af615
net/rpmsg: initialize semaphore count before wait
...
recvmsg() will incorrectly return 0 if the count of sema before waiting is greater than 0,
This commit will reinitialize the sema count before waiting:
1181 static ssize_t rpmsg_socket_recvmsg(FAR struct socket *psock,
1182 FAR struct msghdr *msg, int flags)
1183 {
...
1255 ret = net_sem_timedwait(&conn->recvsem,
1256 _SO_TIMEOUT(conn->sconn.s_rcvtimeo)); // recvsem.sem_count == 1; return 0
...
1264 if (!conn->recvdata) // recvdata not consumed; goto else
1265 {
1266 ret = conn->recvlen;
1267 }
1268 else
1269 {
1270 conn->recvdata = NULL;
1271 }
...
1282 return ret; // BUGON! incorrectly return 0 to user
1283 }
Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-16 17:15:42 +08:00
Zhe Weng
9f8d587b64
net/rpmsg: Set family for rpaddr in ns_bind
...
The rpmsg addr get from socket accept has rp_family=0, which is not
intended, to avoid wrong logic in other place, set the rp_family
in ns_bind function.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-04-21 13:18:48 +03:00
Xiang Xiao
75ecbd4382
net/local: Return the unblock handle correctly in local_accept
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-03-09 09:17:19 +01:00
Xiang Xiao
0ef073573a
net: Remove protocol argument from si_setup callback
...
since the implementor could get the same value from socket::s_proto
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-13 22:41:19 +08:00
Gustavo Henrique Nihei
e6b204f438
nuttx: Use MIN/MAX definitions from "sys/param.h"
...
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-02-01 23:47:44 +08:00
ligd
1b333bfad5
rpmsg_socket: destroy_ept only at close
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-01-18 02:11:16 +08:00
ligd
a7dea8ddf6
rpmsg_socket: shouldn't call create_device again after create_ept
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-01-18 02:11:16 +08:00
ligd
d6cad21a17
rpmsg_socket: rpmsg_send_nocpy() should lock with rpmsg_destroy_ept
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-01-18 02:11:16 +08:00
ligd
c0735f06f6
rpmsg_socket: release tx buffer when send_oncopy failed
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-01-18 02:11:16 +08:00
Xiang Xiao
a851ad84c3
net: consistent the net sem wait naming conversion
...
to prepare the new mutex wait function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-15 12:31:30 -03:00
chao an
3caa551ff4
net: remove psock reference from connect
...
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-24 22:57:42 +08:00
ligd
03ff9d1a94
rpmsg socket: add lock to poll & poll_notify
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-11-11 20:08:17 +08:00
anjiahao
5724c6b2e4
sem:remove sem default protocl
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-10-22 14:50:48 +08:00
anjiahao
d1d46335df
Replace nxsem API when used as a lock with nxmutex API
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-17 15:59:46 +09:00
wangbowen6
344c8be049
poll: add poll_notify() api and call it in all drivers
...
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-09-26 12:06:32 +08:00
Xiang Xiao
e0bb281e7a
net: Align the prototype of sock_intf_s::si_ioctl with file_operations::ioctl
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-06 22:46:37 +08:00
ligd
8a3683fb9f
rptun: add ns_match callback to resolve rptun deadlock
...
thread A: accept -> net_lock -> socket_rpmsg_accept
-> rpmsg_register_callabck -> rptun_lock
thread B: ns_bind -> rpmsg_socket_ns_bind -> get_tx_payload_buffer
-> rptun_wait_tx -> usrsock_rpmsg_ept_cb -> usrsockdev_write
-> net_lock -> deadlock
fix:
add ns_match callback
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-27 20:36:51 +08:00
ligd
79952163c1
rpmsg_socket: use sendto_nocopy() instead of send_nocopy().
...
only wait ept ready after ept_create, not after ept_destroy
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-23 08:16:48 +03:00
ligd
9c106c1bdc
rpmsg_socket: defalut set POLLERR POLLHUP to events
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-23 08:16:48 +03:00
ligd
ba990619ed
socket_rpmsg: set poll err instead return err
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-23 08:16:48 +03:00
ligd
630ca45a50
rpmsg_socket: connect addrlen can bigger then expect
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-23 08:16:48 +03:00
Jiuzhu Dong
fab2f6d3d8
net/rpmsg: fix minor issue on strncpy
...
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 08:16:48 +03:00
hejianliang3
e9648d8a73
net:fix coverity warning
...
Signed-off-by: hejianliang3 <hejianliang3@xiaomi.com>
2022-04-03 14:37:53 +03:00