Commit Graph

453 Commits

Author SHA1 Message Date
Alin Jerpelea ccff570e6f drivers: nxstyle fixes
nxstyle fixes to pass the CI.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-03-04 18:32:27 -08:00
Alin Jerpelea e5b6305f4a drivers: 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-03-04 18:32:27 -08:00
Jiuzhu Dong 48493dac5b telnet: fix crash about telnet client connect
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-03-05 06:55:17 +09: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
Jukka Laitinen b8dc64ffed drivers/net/encx24j600.c: Correct setting of ifstate
The ifstate is already set in
  enc_ifup -> enc_reset -> enc_linkstatus

The ifstate after this call is either ENCSTATE_RUNNING or ENCSTATE_UP

If ifstate is ENCSTATE_RUNNING, it would be wrong to set it to ENCSTATE_UP;
this would lead to enc_txavail never invoking the driver callback, causing
very long latencies in sending.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-01-29 09:52:04 -08:00
chao.an 84daee1f76 drivers/netdev: try tcp timer in every txavail call
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-18 14:16:11 +09:00
YAMAMOTO Takashi fc05f89c78 drivers/net/enc28j60.c: Fix syslog formats 2020-12-02 02:53:47 -06:00
YAMAMOTO Takashi 3086ceb28a drivers/net/enc28j60.c: Replace non ascii character (0xB5, "micro") 2020-12-02 02:53:47 -06:00
YAMAMOTO Takashi 8bfd344600 drivers/net/tun.c: Fix a syslog format 2020-12-02 02:53:47 -06:00
YAMAMOTO Takashi 510e72567f drivers/net/dm90x0.c: Fix a syslog format 2020-11-25 05:11:26 -08:00
YAMAMOTO Takashi 86c16667f8 drivers/net/loopback.c: Fix a syslog format 2020-11-23 05:00:10 -08:00
YAMAMOTO Takashi 5c5fc00fc4 drivers/net/telnet.c: Fix syslog formats 2020-11-23 05:00:10 -08:00
Michal Lenc 8cf6cfda1a imxrt: Added support for DP83825I PHY
Signed-off-by: Michal Lenc <lencmich@fel.cvut.cz>
2020-11-20 20:34:57 -03:00
Yoshinori Sugino c13f869432 Modify SIGSTP to SIGTSTP
Follow the POSIX description.
SIGTSTP should be sent when the Ctrl-Z characters is encountered, not SIGSTP.

Testing:
Built with hifive1-revb:nsh (CONFIG_SERIAL_TERMIOS=y, CONFIG_SIG_DEFAULT=y and CONFIG_TTY_SIGTSTP=y)
2020-10-29 01:12:43 -07:00
Xiang Xiao b5f429c88b Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-22 17:37:21 -06:00
Xiang Xiao ae356001cf Change all files come from Xiaomi/Pinecone to Apache License 2.0
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-22 17:37:21 -06:00
Johannes Schock 83f6c94209 telnet.c: td_offset had been uint8_t. TELNET_RXBUFFER_SIZE over 256 had been broken. 2020-08-19 04:44:03 -05:00
Gregory Nutt 2af62314d7 Fix build breakage from PR #1565
Fixes:

    ##[error]net/tun.c:837:13: error: conflicting types for 'tun_poll_expiry'
      837 | static void tun_poll_expiry(FAR void *arg)
          |             ^~~~~~~~~~~~~~~
    net/tun.c:196:13: note: previous declaration of 'tun_poll_expiry' was here
      196 | static void tun_poll_expiry(wdparm_t arg);
          |             ^~~~~~~~~~~~~~~

And

    ##[error]net/tun.c:881:57: error: passing argument 4 of 'wd_start' makes integer from pointer without a cast [-Werror=int-conversion]
      881 |   wd_start(&priv->txpoll, TUN_WDDELAY, tun_poll_expiry, priv);
          |                                                         ^~~~
          |                                                         |
          |                                                         struct tun_device_s *
    In file included from /github/workspace/sources/nuttx/include/nuttx/sched.h:41,
                     from /github/workspace/sources/nuttx/include/sched.h:34,
                     from /github/workspace/sources/nuttx/include/nuttx/arch.h:81,
                     from net/tun.c:60:
    /github/workspace/sources/nuttx/include/nuttx/wdog.h:134:42: note: expected 'wdparm_t' {aka 'long unsigned int'} but argument is of type 'struct tun_device_s *'
      134 |              wdentry_t wdentry, wdparm_t arg);
          |                                 ~~~~~~~~~^~~

And

    chip/cxd56_rtc.c: In function 'up_rtc_initialize':
    ##[error]chip/cxd56_rtc.c:358:3: error: too many arguments to function 'cxd56_rtc_initialize'
      358 |   cxd56_rtc_initialize(1, NULL);
          |   ^~~~~~~~~~~~~~~~~~~~
    chip/cxd56_rtc.c:253:13: note: declared here
      253 | static void cxd56_rtc_initialize(wdparm_t arg)
          |             ^~~~~~~~~~~~~~~~~~~~
2020-08-14 14:12:51 -03:00
Xiang Xiao acca9fcc3b sched/wdog: Remove MAX_WDOGPARMS and related stuff
since the variable arguments are error prone and seldom used.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-14 08:19:50 -06:00
Xiang Xiao a0ce81d659 sched/wdog: Don't dynamically allocate wdog_s
to save the preserved space(1KB) and also avoid the heap overhead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I694073f68e1bd63960cedeea1ddec441437be025
2020-08-11 12:28:55 -06:00
Xiang Xiao f618de9c97 Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-08 17:30:26 -03:00
Xiang Xiao 4c706771c3 sched/wdog: Replace all callback argument from uint32_t to wdparm_t
and alwasy cast the argument of wd_start to wdparm_t

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-08 17:30:26 -03:00
Gregory Nutt 188d4b0fb4 user-space memalign() must not be called from within the OS.
drivers/net/ftmac100.c, libs/libc/stdlib/lib_aligned_alloc.c

A continuation of PRs #1507, #1510, and #1512.  See Issue #1481 for additional information.
2020-08-04 22:45:47 +01:00
Gregory Nutt 3cad9f498f drivers/mkrd.c
drivers/net/telnet.c
 drivers/wireless/bluetooth/bt_uart_bcm4343x.c
 drivers/wireless/ieee802154/mrf24j40/mrf24j40.c

Kernel memory was allocated using kmm_malloc() or kmm_zalloc() but freed with with the user-space allocator free().  In the FLAT build, this is bad style, but not harmful because there is only a single, heap and malloc() and kmm_malloc() map to the same function.

But that is not true in the case of the PROTECTED or KERNEL builds.  In those cases, there are separate heaps.  kmm_malloc() will allocate from the kernel heap.  free() will attempt to free the kernel memory from the user heap and will cause an assertion (or other obscure failure if assertions are disabled).
2020-08-04 13:00:53 -05:00
Alan C. Assis a7a272661e Char drivers should return -ENOTTY if CMD is not recognized 2020-06-06 14:51:02 -03: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
Xiang Xiao 517974787f Rename clock_systime[r|spec] to clock_systime_[ticks|timespec]
follow up the new naming convention:
https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions
2020-05-10 14:35:50 -06:00
Xiang Xiao b7d922960f Fix nxstyle issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-08 07:20:49 -06:00
Gregory Nutt 2aabf76815 Run nxstyle against modified files in PR 2020-04-13 02:09:34 +08:00
Gregory Nutt 62c1389825 Fix warnings noted in PR build checks:
net/telnet.c:1317:40: warning: result of comparison of constant 256 with expression of type 'uint8_t' (aka 'unsigned char') is always true [-Wtautological-constant-out-of-range-compare]
                      if (priv->td_pending < CONFIG_TELNET_RXBUFFER_SIZE)
                          ~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~

    time/lib_localtime.c:569:32: warning: sizeof on pointer operation will return size of 'char *' instead of 'char [33]' [-Wsizeof-array-decay]
              sizeof(lsp->fullname - 1) <= strlen(p) + strlen(name))
                     ~~~~~~~~~~~~~ ^
2020-04-13 02:09:34 +08:00
Gregory Nutt 9ff1795760 Check return from nxsem_wait_initialize()
Resolution of Issue 619 will require multiple steps, this part of the first step in that resolution:  Every call to nxsem_wait_uninterruptible() must handle the return value from nxsem_wait_uninterruptible properly.  This commit is only for rwbuffer.c and those files under drivers/serial, drivers/timers, and drivers/usbdev.

This commit completes that step for all of the files under drivers/.  Still remaining:  All of the files under arch/.
2020-04-01 14:20:04 -03:00
Gregory Nutt 5b74974919 Check return from nxsem_wait_initialize()
Resolution of Issue 619 will require multiple steps, this part of the first step in that resolution:  Every call to nxsem_wait_uninterruptible() must handle the return value from nxsem_wait_uninterruptible properly.  This commit is only for those files under drivers/audio, drivers/net, and drivers/lcd.
2020-03-31 20:12:21 +01:00
YAMAMOTO Takashi f8077022bd Introduce CONFIG_DEFAULT_TASK_STACKSIZE
* The appropriate size of stack varies among archs.
  E.g. for 64-bit sim, 2048 is way too small, especially when the task
  happens to use host OS functionalities.
  I plan to allow an arch provide its own default.

* I plan to use this to replace hardcoded "STACKSIZE = 2048" in APPDIR.
2020-03-26 22:30:13 -05:00
Gregory Nutt 0efed95115 drivers/net/tun.c: Eliminate unused function.
Eliminated unused function tun_ipv6multicast().  This eliminates a warning from the build test:

net/tun.c:1061:13: warning: 'tun_ipv6multicast' defined but not used [-Wunused-function]
 static void tun_ipv6multicast(FAR struct tun_device_s *priv)
             ^~~~~~~~~~~~~~~~~
2020-03-08 08:40:05 -05:00
Xiang Xiao 553585a000 net: phy_notify_subscribe call phy_notify_unsubscribe if sigev_notify equals SIGEV_NONE 2020-03-07 12:59:47 -06:00
Juha Niskanen f3490e42c3 Fix typos in comments 2020-03-03 09:11:57 -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
Gregory Nutt 21aef0dd68 drivers/*/Kconfig: Consolidate driver Kconfig Files.
This commit does two things:

1. First, it reorganizes the driver Kconfig files so that each is self contained.  Before, a part of the driver configuration was in drivers/Kconfig and the rest was in in drivers/xyz/Konfig.  Now, all of the driver configuration is consolitated in the latter.

2. Second, this commit correct numerous serious errors introduced in a previous reorganization of the driver Kconfig files.  This was first noted by Nicholas Chin in PR270 for the case of the drivers/i2c/Kconfig but some examination indicates that the error was introduced into several other Kconfig files as well.

The nature of the introduced error was basically this:

- Nothing must intervene between the menuconfig selection and the following conditional configuration otpions.
- A previous PR erroneously introduced unconditional options between the menuconfig and the following confditional logic, thus corrupting the driver menus.

This error was easy to make because the driver Kconfig files were not well modularized.  Making them fully self-contained should eliminate this kind of error in the future.
2020-02-15 15:19:11 +01:00
Gregory Nutt 3c0b49448a Network Loopback Driver: A configuration option to control packet size.
Historically, the loopback driver used the largest packet size of all enabled link layer protocols.  This permitted packets to be forward via the loopbak device with no major loss of performance.  However, in experimenting with configurations where no other link layer protocols were enabled, this means the loopback packet size was set to the smallest possible size, to the SLIP minimum of 296 bytes.  This resulted in terrible loopback performance.

    This commit adds an option to increase the loopback packet size with the option CONFIG_NET_LOOPBACK_PACKETSIZE.

    The loopback driver packet buffer should be quite large.  The larger the loopback packet buffer, the better will be TCP performance of the loopback transfers.  The Linux loopback device historically used packet buffers of size 16Kb, but that was increased in recent Linux versions to 64Kb.  Those sizes may be excessive for resource constrained MCUs, however.

    The network still enforces the lower limit that is the maximum packet size of all enabled link layer protocols.  But this new option permits the loopback packet size to be increased from that.

    * net/Kconfig:  Adds CONFIG_NET_LOOPBACK_PKTSIZE option
    * include/nuttx/net/netconfig.h:  Assures that the packet size that is used is at least as large as the largest packet size of other link layer protocols.
    * drivers/net/loopback.c:  Use that larger packet size.
    * boards/sim/sim/sim/configs/tcploop/defconfig:  Set the loopback packet size to 1500
2020-02-10 22:17:32 -03:00
Xiang Xiao d68693f74c drivers/telnet: Stop the loop if SIGSTP char is match and SIGINT not enabled
Change-Id: I78510616e68330b0171230ca0e081c0d702a6f42
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-10 09:21:34 -06:00
Gregory Nutt d09af3b7f3 Run .c and .h files modified by PR241 through nxstyle. 2020-02-10 08:57:20 -06:00
liuhaitao bbd102808d drivers/net/telnet.c: correct typo error to fix build break
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2020-02-10 10:12:10 -03:00
Gregory Nutt 10721c0826 Kconfig: Move the ARCH_PHY_INTERRUPT option to net/Kconfig and make it
unconditionally selectable.
2020-02-09 00:55:41 +00:00
Xiang Xiao 3cb259daa6 drivers/Kconfig: Move if/endif to subfolder Kconfig
Move if/endif to subfolder Kconfig and make ARCH_HAVE_XXX option always selectable by moving out of if/endif
2020-02-08 08:04:05 -06:00
Gregory Nutt b35bf20824 drivers/net/telnet.c: Run file changed in last PR through nxstyle. 2020-02-07 07:25:57 -06:00
Xiang Xiao 652c763a32 drivers/net/telnet.c: Unify the coding style in telnet driver
Unify th ecoding style in the telenet driver and ensure kernel version API used in all place and remove the unused stuff
2020-02-07 07:24:43 -06:00
Xiang Xiao 6be0b2f1b8 drivers/net/telnet.c: Trigger SGA and ECHO proactively in the character mode
Trigger SGA and ECHO proactively in character mode otherwise Ubuntu bultin telnet can't enter this mode

Change-Id: I8aa2ab2b31c35007077c701c264b3971152435f0
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-07 07:23:45 -06:00
Xiang Xiao ed2a002ee5 drivers/net/telnet.c: Remove g_telnet_common global variable
Remove g_telnet_common global variable; we can reuse g_clients_sem as the lock guard

Change-Id: Ic3af9f2116f70523a4249b29c65bd1fb83ca4da2
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-07 07:21:54 -06:00