Commit Graph

92 Commits

Author SHA1 Message Date
chao an 7d1763a57c net/assert: remove all unnecessary check for psock/conn
Since inet/socket layer already contains sanity checks, so remove unnecessary lower half checks

Signed-off-by: chao an <anchao@xiaomi.com>
2023-08-30 20:36:49 +08:00
chao an 6ee9ec7656 build: add initial cmake build system
1. Update all CMakeLists.txt to adapt to new layout
2. Fix cmake build break
3. Update all new file license
4. Fully compatible with current compilation environment(use configure.sh or cmake as you choose)

------------------

How to test

From within nuttx/. Configure:

cmake -B build -DBOARD_CONFIG=sim/nsh -GNinja
cmake -B build -DBOARD_CONFIG=sim:nsh -GNinja
cmake -B build -DBOARD_CONFIG=sabre-6quad/smp -GNinja
cmake -B build -DBOARD_CONFIG=lm3s6965-ek/qemu-flat -GNinja

(or full path in custom board) :
cmake -B build -DBOARD_CONFIG=$PWD/boards/sim/sim/sim/configs/nsh -GNinja

This uses ninja generator (install with sudo apt install ninja-build). To build:

$ cmake --build build

menuconfig:

$ cmake --build build -t menuconfig

--------------------------

2. cmake/build: reformat the cmake style by cmake-format

https://github.com/cheshirekow/cmake_format

$ pip install cmakelang

$ for i in `find -name CMakeLists.txt`;do cmake-format $i -o $i;done
$ for i in `find -name *\.cmake`;do cmake-format $i -o $i;done

Co-authored-by: Matias N <matias@protobits.dev>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-08 13:50:48 +08:00
Xiang Xiao cff40aa34c net: Remove some minor #warning since it compiler specific
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-18 15:44:28 +03:00
zhanghongyu 91e13c47ae net: remove conn-related casts
remove redundant casts associated with psock

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-05-10 19:32:09 -03:00
Xiang Xiao 3c3dea5d7a net: Make si_poll callback optional
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-03-06 20:58:27 +02:00
Xiang Xiao c39be172da net: Make si_accept callback optional
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-03-06 20:58:27 +02:00
Xiang Xiao a97e2523a4 net: Make si_listen callback optional
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-03-06 20:58:27 +02:00
Fotis Panagiotopoulos 5e625b9cdb Performance optimizations in connection allocations. 2023-02-28 14:23:16 +01:00
Xiang Xiao 2c5f653bfd Remove the tail spaces from all files except Documentation
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-26 13:24:24 -08:00
Fotis Panagiotopoulos 22a82b3f51 Improvements in IEEE 802.15.4 connections allocation. 2023-02-20 09:06:46 +08:00
SPRESENSE 277e0b941a include/sys/socket.h: Add SOCK_CTRL to socket type
SOCK_CTRL is added to provide special control over network drivers
and daemons. Currently, SOCK_DGRAM and SOCK_STREAM perform this control,
but these use socket resources. In the case of usersocket in particular,
this is a waste of the device's limited socket resources.
2023-02-16 12:13:01 +09: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
Masayuki Ishikawa 3f3e090716 Revert "include/sys/socket.h: Add SOCK_CTRL to socket type"
This reverts commit abba05a934.
2023-02-09 09:13:14 +01:00
SPRESENSE abba05a934 include/sys/socket.h: Add SOCK_CTRL to socket type
SOCK_CTRL is added to provide special control over network drivers
and daemons. Currently, SOCK_DGRAM and SOCK_STREAM perform this control,
but these use socket resources. In the case of usersocket in particular,
this is a waste of the device's limited socket resources.
2023-02-08 20:43:33 +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
anjiahao 5724c6b2e4 sem:remove sem default protocl
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-10-22 14:50:48 +08:00
Xiang Xiao 40ef5bc6db libc: Move queue.h from include to include/nuttx
to avoid the conflict with libuv's queue.h

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-26 08:04:58 +02:00
chao.an 162fcd10ca net: cleanup pvconn reference to avoid confuse
More reference:
https://github.com/apache/incubator-nuttx/pull/5252
https://github.com/apache/incubator-nuttx/pull/5434

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-08-26 20:58:11 +08:00
Xiang Xiao ba9486de4a iob: Remove iob_user_e enum and related code
since it is impossible to track producer and consumer
correctly if TCP/IP stack pass IOB directly to netdev

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-08-15 08:41:20 +03:00
larry 8f72799e8e net: Fix frame count check fail
bc_rxtail/rxtail should always point to newly frame.
If input more than one frame before receive,
missing assignment can result in old frame lost.

Signed-off-by: larry <larry@transtekcorp.com>
2022-07-14 22:56:05 +03:00
Xiang Xiao 7598070508 net: Remove the unnecessary initialization code
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-12 19:24:17 +02:00
chao.an 99cde13a11 net/inet: move socket flags into socket_conn_s
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
chao.an 1b0f85c5bc net/ieee802154: replace the common connect prologue
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-10 15:04:33 -03:00
Petro Karashchenko 8d3bf05fd2 include: fix double include pre-processor guards
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-01-16 11:11:14 -03:00
chao.an 504f1d1b5f net/misc: add support for CONFIG_NET_ALLOC_CONNS
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-01-04 14:36:07 +08:00
Alexander Lunev 36fbedcbfc net/devif/devif_callback.c: corrected the connection event list to work as FIFO instead of LIFO.
In case of enabled packet forwarding mode, packets were forwarded in a reverse order
because of LIFO behavior of the connection event list.
The issue exposed only during high network traffic. Thus the event list started to grow
that resulted in changing the order of packets inside of groups of several packets
like the following: 3, 2, 1, 6, 5, 4, 8, 7 etc.

Remarks concerning the connection event list implementation:
* Now the queue (list) is FIFO as it should be.
* The list is singly linked.
* The list has a head pointer (inside of outer net_driver_s structure),
  and a tail pointer is added into outer net_driver_s structure.
* The list item is devif_callback_s structure.
  It still has two pointers to two different list chains (*nxtconn and *nxtdev).
* As before the first argument (*dev) of the list functions can be NULL,
  while the other argument (*list) is effective (not NULL).
* An extra (*tail) argument is added to devif_callback_alloc()
  and devif_conn_callback_free() functions.
* devif_callback_alloc() time complexity is O(1) (i.e. O(n) to fill the whole list).
* devif_callback_free() time complexity is O(n) (i.e. O(n^2) to empty the whole list).
* devif_conn_event() time complexity is O(n).
2021-09-18 21:01:39 -05:00
Xiang Xiao 5f3a98b5a8 libc/assert: Reference the expression in all case
to avoid the warning "defined but not used"

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I55b7c092d0f2e5882fc1784987657c10cdf2d90b
2021-04-03 21:00:41 +01:00
Gustavo Henrique Nihei 330eff36d7 sourcefiles: Fix relative path in file header 2021-03-09 23:18:28 +08:00
Peter Bee e223f60c09 net/socket: move si_send/recv into sendmsg/recvmsg
Implement si_send/sendto/recvfrom with si_sendmsg/recvmsg, instead of
the other way round.

Change-Id: I7b858556996e0862df22807a6edf6d7cfe6518fc
Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
2021-03-05 04:46:13 -08:00
Jiuzhu Dong 4d5a964f29 net: unify socket into file descriptor
Change-Id: I9bcd21564e6c97d3edbb38aed1748c114160ea36
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-03-03 19:01:41 -08:00
Alin Jerpelea 37d5c1b0d9 net: Author Gregory Nutt: update licenses to Apache
Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-02-20 00:38:18 -08:00
Alin Jerpelea 7dc7ef45f1 net: nxstyle fixes
Nxstyle fixes to pass CI.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-02-20 00:38:18 -08:00
Abdelatif Guettouche 6385408483 net/: Correct some comments.
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-01-15 16:23:12 -05:00
Juha Niskanen de1ad1fdb3 net: fix typos, incorrect comments, nxstyle
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-12-13 09:06:28 -06:00
YAMAMOTO Takashi 298299684e net/ieee802154/ieee802154_sendto.c: Fix a syslog format 2020-11-24 22:31:33 -08:00
YAMAMOTO Takashi 7b3cd145de net/ieee802154/ieee802154_sockif.c: Fix a syslog format 2020-11-24 22:31:33 -08:00
chao.an 95be9eaf4b net/callback: remove the assert check of conn instance
remove the connection assertion since the instance will be invalid
if the network device has been taken down.

net/netdev/netdev_ioctl.c:

1847 void netdev_ifdown(FAR struct net_driver_s *dev)
1848 {
...
1871       /* Notify clients that the network has been taken down */
1872
1873       devif_dev_event(dev, NULL, NETDEV_DOWN);
...
1883 }

Change-Id: I492b97b5ebe035ea67bbdd7ed635cb13d085e89c
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-10 19:40:41 -08:00
Peter van der Perk b5c5948e1c NXStyle fixes 2020-06-15 08:07:19 -06:00
Peter van der Perk 55d9e5f7af net: Add SocketCAN support 2020-06-15 08:07:19 -06:00
Gregory Nutt 57bc329aac Run nxstyle all .c and .h files modified by PR. 2020-05-17 14:01:00 -03:00
Gregory Nutt a569006fd8 sched/: Make more naming consistent
Rename various functions per the quidelines of https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions

    nxsem_setprotocol -> nxsem_set_protocol
    nxsem_getprotocol -> nxsem_get_protocol
    nxsem_getvalue -> nxsem_get_value
2020-05-17 14:01:00 -03:00
ligd cbf31bca5c global change: fix tools/checkpatch.sh warnnings
Change-Id: I88cfa979c44bcaf3a8f6e036c6bfccd3402ca85a
Signed-off-by: ligd <liguiding@fishsemi.com>
2020-04-09 10:29:28 -06:00
ligd 231ad202ee global change: repace sched_xfree() to kxmm_free()
Changes:
sched_xfree() => kxmm_free()
remove garbage related APIs
remove ARCH_HAVE_GARBAGE

Cause garbage feature move to mm_heap, then don't need
garbage anymore.

Change-Id: If310790a3208155ca8ab319e8d038cb6ff92c518
Signed-off-by: ligd <liguiding@fishsemi.com>
2020-04-09 10:29:28 -06:00
Xiang Xiao cde88cabcc Run codespell -w with the latest dictonary again
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-23 22:27:46 +01:00
Xiang Xiao bd4e8e19d3 Run codespell -w against all files
and fix the wrong correction
2020-02-22 14:45:07 -06:00
Juha Niskanen 15b78abccf Fix typos in comments 2020-02-14 08:50:45 -06:00
Xiang Xiao 5c80b94820 Replace #include <semaphore.h> to #include <nuttx/semaphore.h>
Since the kernel side should call nxsem_xxx instead and remove the unused inclusion
2020-02-01 08:27:30 -06:00
Xiang Xiao 6e6c670190 Move _SF_BOUND and _SF_CONNECTED modification to common place 2020-01-31 13:45:14 -06:00
Gregory Nutt 98f431d8d8 net/: Run all .c files under net/ through tools/nxstyle and fix all resulting complaints. 2020-01-11 13:41:33 -03:00
Xiang Xiao 5c5c08efcd network: simplify the timeout process logic
1.Consolidate absolute to relative timeout conversion into one place(_net_timedwait)
2.Drive the wait timeout logic by net_timedwait instead of devif_timer
This patch help us remove devif_timer(period tick) to save the power in the future.

Change-Id: I534748a5d767ca6da8a7843c3c2f993ed9ea77d4
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-01-11 08:24:49 -06:00