You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/08/29 07:50:06 UTC

[GitHub] [incubator-nuttx] ethanlcz opened a new pull request, #6949: usrsock:refine usrsock's architecture

ethanlcz opened a new pull request, #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949

   Seperate usrsock device driver with usrsock core function layer
   to make it more flexiable to adopt other kind of usrsock interface driver
   
   Signed-off-by: liangchaozhong <li...@xiaomi.com>
   
   ## Summary
   
   ## Impact
   
   ## Testing
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#discussion_r964356305


##########
net/usrsock/usrsock_recvmsg.c:
##########
@@ -83,8 +83,9 @@ static uint16_t recvfrom_event(FAR struct net_driver_s *dev,
           pstate->valuelen_nontrunc = conn->resp.valuelen_nontrunc;
         }
 
-      if (pstate->reqstate.result >= 0 ||
-          pstate->reqstate.result == -EAGAIN)
+      if (!(flags & USRSOCK_EVENT_RECVFROM_AVAIL) &&

Review Comment:
   why change?



##########
net/usrsock/usrsock_connect.c:
##########
@@ -115,7 +116,13 @@ static int do_connect_request(FAR struct usrsock_conn_s *conn,
   bufs[1].iov_base = (FAR void *)addr;
   bufs[1].iov_len = addrlen;
 
-  return usrsockdev_do_request(conn, bufs, ARRAY_SIZE(bufs));
+  ret = usrsock_do_request(conn, bufs, ARRAY_SIZE(bufs));
+  if (ret == -ENETDOWN)
+    {
+      ret = -ECONNABORTED;

Review Comment:
   let's usrsock_do_request return the correct error code



##########
net/usrsock/usrsock_sendmsg.c:
##########
@@ -71,7 +71,8 @@ static uint16_t sendto_event(FAR struct net_driver_s *dev,
 
       pstate->result = conn->resp.result;
 
-      if (pstate->result >= 0 || pstate->result == -EAGAIN)
+      if (!(flags & USRSOCK_EVENT_SENDTO_READY) &&

Review Comment:
   ditto



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] ethanlcz commented on a diff in pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
ethanlcz commented on code in PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#discussion_r964409062


##########
net/usrsock/usrsock_sendmsg.c:
##########
@@ -71,7 +71,8 @@ static uint16_t sendto_event(FAR struct net_driver_s *dev,
 
       pstate->result = conn->resp.result;
 
-      if (pstate->result >= 0 || pstate->result == -EAGAIN)
+      if (!(flags & USRSOCK_EVENT_SENDTO_READY) &&

Review Comment:
   I revert this change



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#discussion_r966758936


##########
net/usrsock/usrsock_dev.c:
##########
@@ -1132,91 +545,55 @@ static int usrsockdev_poll(FAR struct file *filep, FAR struct pollfd *fds,
  ****************************************************************************/
 
 /****************************************************************************
- * Name: usrsockdev_do_request
+ * Name: usrsock_request
  ****************************************************************************/
 
-int usrsockdev_do_request(FAR struct usrsock_conn_s *conn,
-                          FAR struct iovec *iov, unsigned int iovcnt)
+int usrsock_request(FAR struct iovec *iov, unsigned int iovcnt)
 {
   FAR struct usrsockdev_s *dev = &g_usrsockdev;
-  FAR struct usrsock_request_common_s *req_head = iov[0].iov_base;
-
-  if (!usrsockdev_is_opened(dev))
-    {
-      ninfo("usockid=%d; daemon has closed /dev/usrsock.\n", conn->usockid);
-
-      return -ENETDOWN;
-    }
-
-  /* Get exchange id. */
-
-  if (++dev->newxid == 0)
-    {
-      ++dev->newxid;
-    }
-
-  req_head->xid = dev->newxid;
-
-  /* Prepare connection for response. */
-
-  conn->resp.xid = req_head->xid;
-  conn->resp.result = -EACCES;
-
-  ++dev->req.nbusy; /* net_lock held. */
+  int ret;
 
   /* Set outstanding request for daemon to handle. */
 
-  net_lockedwait_uninterruptible(&dev->req.sem);
+  net_lockedwait_uninterruptible(&dev->devsem);
 
   if (usrsockdev_is_opened(dev))
     {
       DEBUGASSERT(dev->req.iov == NULL);
-      dev->req.ackxid = req_head->xid;
       dev->req.iov = iov;
       dev->req.pos = 0;
       dev->req.iovcnt = iovcnt;
 
       /* Notify daemon of new request. */
 
       usrsockdev_pollnotify(dev, POLLIN);
-
-      /* Wait ack for request. */
-
-      net_lockedwait_uninterruptible(&dev->req.acksem);
+      ret =0;

Review Comment:
   merge to line 554



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] ethanlcz commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
ethanlcz commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1240130057

   > @hmm,
   > 
   > The assertion still happens with the latest code. Could you provide the following info?
   > 
   > > I'm using the following defconfig and run the nuttx sim on Ubuntu 18.04 x86_64.
   > > What OS are you using to test the nuttx sim?
   
   I can reproduce it now with all the following options enabled(last time I only enabled CONFIG_DEBUG_ASSERTIONS=y), let me check what happened.
   
   CONFIG_DEBUG_ASSERTIONS=y
   CONFIG_DEBUG_ERROR=y
   CONFIG_DEBUG_FEATURES=y
   CONFIG_NDEBUG=y


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#discussion_r965526159


##########
net/usrsock/Make.defs:
##########
@@ -28,6 +28,7 @@ NET_CSRCS += usrsock_event.c usrsock_getsockname.c usrsock_getsockopt.c
 NET_CSRCS += usrsock_poll.c usrsock_recvmsg.c usrsock_sendmsg.c
 NET_CSRCS += usrsock_setsockopt.c usrsock_socket.c usrsock_sockif.c
 NET_CSRCS += usrsock_accept.c usrsock_listen.c usrsock_ioctl.c
+NET_CSRCS += usrsock_devif.c

Review Comment:
   merge to line 26?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1232295231

   >I will try this project later after I get the test board.
   @ethanlcz 
   Please change this PR to Draft.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] ethanlcz commented on a diff in pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
ethanlcz commented on code in PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#discussion_r957107784


##########
net/usrsock/usrsock_dev.c:
##########
@@ -264,22 +133,6 @@ static void usrsockdev_semgive(FAR sem_t *sem)
   nxsem_post(sem);
 }
 
-/****************************************************************************
- * Name: usrsockdev_is_opened
- ****************************************************************************/
-
-static bool usrsockdev_is_opened(FAR struct usrsockdev_s *dev)

Review Comment:
   done



##########
net/usrsock/usrsock_dev.c:
##########
@@ -1129,91 +538,58 @@ static int usrsockdev_poll(FAR struct file *filep, FAR struct pollfd *fds,
  ****************************************************************************/
 
 /****************************************************************************
- * Name: usrsockdev_do_request
+ * Name: usrsock_request
  ****************************************************************************/
 
-int usrsockdev_do_request(FAR struct usrsock_conn_s *conn,
-                          FAR struct iovec *iov, unsigned int iovcnt)
+int usrsock_request(FAR struct iovec *iov, unsigned int iovcnt)
 {
   FAR struct usrsockdev_s *dev = &g_usrsockdev;
-  FAR struct usrsock_request_common_s *req_head = iov[0].iov_base;
-
-  if (!usrsockdev_is_opened(dev))

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] ethanlcz commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
ethanlcz commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1238075360

   basic_setsockopt test passed after remote_disconnect disabled. 
   Still other failure exist.
   
   NuttShell (NSH) NuttX-10.4.0
   nsh> usrsocketst
   nsh: usrsocketst: command not found
   nsh> usrsocktest
   Starting unit-tests...
   Testing group "char_dev" =>
   	Group "char_dev": [OK]
   Testing group "no_daemon" =>
   	Group "no_daemon": [OK]
   Testing group "basic_daemon" =>
   	Group "basic_daemon": [OK]
   Testing group "basic_connect" =>
   	Group "basic_connect": [OK]
   Testing group "basic_connect_delay" =>
   	Group "basic_connect_delay": [OK]
   Testing group "no_block_connect" =>
   	Group "no_block_connect": [OK]
   Testing group "basic_send" =>
   	Group "basic_send": [OK]
   Testing group "no_block_send" =>
   	Group "no_block_send": [OK]
   Testing group "block_send" =>
   	Group "block_send": [OK]
   Testing group "no_block_recv" =>
   	Group "no_block_recv": [OK]
   Testing group "block_recv" =>
   	Group "block_recv": [OK]
   Testing group "basic_setsockopt" =>
   	Group "basic_setsockopt": [OK]
   Testing group "basic_getsockopt" =>
   	Group "basic_getsockopt": [OK]
   Testing group "basic_getsockname" =>
   	Group "basic_getsockname": [OK]
   Testing group "wake_with_signal" =>
   	[TEST ASSERT FAILED!]
   		In function "do_usrsock_blocking_connect_thread":
   		line 238: Assertion `(ssize_t)((*__errno())) == (ssize_t)((test_abort ? 113 : 4))' failed.
   			got value: 115
   			should be: 113
   	[TEST ASSERT FAILED!]
   		In function "do_usrsock_blocking_connect_thread":
   		line 238: Assertion `(ssize_t)((*__errno())) == (ssize_t)((test_abort ? 113 : 4))' failed.
   			got value: 115
   			should be: 113
   	[TEST ASSERT FAILED!]
   		In function "do_usrsock_blocking_connect_thread":
   		line 238: Assertion `(ssize_t)((*__errno())) == (ssize_t)((test_abort ? 113 : 4))' failed.
   			got value: 115
   			should be: 113
   	[TEST ASSERT FAILED!]
   		In function "do_wake_test":
   		line 600: Assertion `(bool)((usrsocktest_test_failed)) == (bool)(false)' failed.
   			got value: 1
   			should be: 0
   	Group "wake_with_signal": [FAILED]
   Testing group "multithread" =>
   	Group "multithread": [OK]
   Unit-test groups done... OK:15, FAILED:1, TOTAL:16
    -- number of checks made: 2381
   HEAP BEFORE TESTS:
                total       used       free    largest
   Mem:      67108368     283088   66825280   66825216
   HEAP AFTER TESTS:
                total       used       free    largest
   Mem:      67108368     623408   66484960   66483360


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1238008606

   @ethanlcz 
   
   Please fix the style check.
   
   ```
   Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/net/usrsock/usrsock_devif.c:575:1: error: Missing blank line after comment
   ```
   
   Also, please fix the assertion when running usrsocktest with sim:usrsocktes
   
   ```
   nsh> usrsocktest
   Starting unit-tests...
   Testing group "char_dev" =>
   	Group "char_dev": [OK]
   Testing group "no_daemon" =>
   	Group "no_daemon": [OK]
   Testing group "basic_daemon" =>
   	Group "basic_daemon": [OK]
   Testing group "basic_connect" =>
   	Group "basic_connect": [OK]
   Testing group "basic_connect_delay" =>
   	Group "basic_connect_delay": [OK]
   Testing group "no_block_connect" =>
   	Group "no_block_connect": [OK]
   Testing group "basic_send" =>
   	Group "basic_send": [OK]
   Testing group "no_block_send" =>
   	Group "no_block_send": [OK]
   Testing group "block_send" =>
   	Group "block_send": [OK]
   Testing group "no_block_recv" =>
   	Group "no_block_recv": [OK]
   Testing group "block_recv" =>
   	Group "block_recv": [OK]
   Testing group "remote_disconnect" =>
   	Group "remote_disconnect": [OK]
   Testing group "basic_setsockopt" =>
   up_assert: Assertion failed at file:usrsock/usrsock_dev.c line: 577 task: usrsocktest
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] ethanlcz commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
ethanlcz commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1240452867

   > @ethanlcz Because #7039 has just been merged, could you rebase again?
   
   it's done.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1238869569

   @ethanlcz 
   Please test this PR with `CONFIG_DEBUG_ASSERTIONS=y`
   
   ```
   nsh> usrsocktest
   Starting unit-tests...
   Testing group "char_dev" =>
   	Group "char_dev": [OK]
   Testing group "no_daemon" =>
   	Group "no_daemon": [OK]
   Testing group "basic_daemon" =>
   	Group "basic_daemon": [OK]
   Testing group "basic_connect" =>
   	Group "basic_connect": [OK]
   Testing group "basic_connect_delay" =>
   	Group "basic_connect_delay": [OK]
   Testing group "no_block_connect" =>
   	Group "no_block_connect": [OK]
   Testing group "basic_send" =>
   	Group "basic_send": [OK]
   Testing group "no_block_send" =>
   	Group "no_block_send": [OK]
   Testing group "block_send" =>
   	Group "block_send": [OK]
   Testing group "no_block_recv" =>
   	Group "no_block_recv": [OK]
   Testing group "block_recv" =>
   	Group "block_recv": [OK]
   Testing group "remote_disconnect" =>
   	Group "remote_disconnect": [OK]
   Testing group "basic_setsockopt" =>
   up_assert: Assertion failed at file:usrsock/usrsock_dev.c line: 577 task: usrsocktest
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1231151645

   @ethanlcz 
   I tried this PR with spresense:wifi_smp but it does not work.
   
   ```
   NuttShell (NSH)
   nsh> uname -a
   NuttX  0.0.0 6bb1c0902d Aug 30 2022 14:01:59 arm spresense
   nsh> ps
     PID GROUP CPU PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK   STACK   USED  FILLED COMMAND
       0     0   0   0 FIFO     Kthread N-- Assigned           00000000 001000 000456  45.6%  CPU0 IDLE
       1     1   1   0 FIFO     Kthread N-- Running            00000000 001000 000228  22.8%  CPU1 IDLE
       2     2 --- 224 RR       Kthread --- Waiting  Signal    00000000 001992 000476  23.8%  hpwork 0x2d057324
       3     3 ---  60 RR       Kthread --- Waiting  Semaphore 00000000 001992 000284  14.2%  lpwork 0x2d057334
       5     5 --- 200 RR       Task    --- Waiting  MQ empty  00000000 000976 000472  48.3%  cxd56_pm_task
       6     6   0 100 RR       Task    --- Running            00000000 003024 001240  41.0%  spresense_main
   nsh> free
                      total       used       free    largest  nused  nfree
           Umem:    1201120      41872    1159248    1157360    119      2
   nsh> mount
     /mnt/spif type smartfs
     /proc type procfs
   nsh> ifconfig
   wlan0	Link encap:Ethernet HWaddr 00:00:00:00:00:00 at UP
   	inet addr:0.0.0.0 DRaddr:0.0.0.0 Mask:0.0.0.0
   
   nsh> gs2200m raspi3-g wifi-test-24g & 
   gs2200m [7:50]
   nsh> renew wlan0
   Traceback (most recent call last):
     File "/home/ishikawa/script/expect_nuttx_wifi_streaming_test.py", line 39, in <module>
       child.expect('nsh> ', timeout=7)
     File "/home/ishikawa/.local/lib/python3.6/site-packages/pexpect/spawnbase.py", line 344, in expect
       timeout, searchwindowsize, async_)
     File "/home/ishikawa/.local/lib/python3.6/site-packages/pexpect/spawnbase.py", line 372, in expect_list
       return exp.expect_loop(timeout)
     File "/home/ishikawa/.local/lib/python3.6/site-packages/pexpect/expect.py", line 181, in expect_loop
       return self.timeout(e)
     File "/home/ishikawa/.local/lib/python3.6/site-packages/pexpect/expect.py", line 144, in timeout
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#discussion_r957372644


##########
net/usrsock/usrsock_dev.c:
##########
@@ -1129,91 +554,60 @@ static int usrsockdev_poll(FAR struct file *filep, FAR struct pollfd *fds,
  ****************************************************************************/
 
 /****************************************************************************
- * Name: usrsockdev_do_request
+ * Name: usrsock_request
  ****************************************************************************/
 
-int usrsockdev_do_request(FAR struct usrsock_conn_s *conn,
-                          FAR struct iovec *iov, unsigned int iovcnt)
+int usrsock_request(FAR struct iovec *iov, unsigned int iovcnt)
 {
   FAR struct usrsockdev_s *dev = &g_usrsockdev;
-  FAR struct usrsock_request_common_s *req_head = iov[0].iov_base;
-
-  if (!usrsockdev_is_opened(dev))
-    {
-      ninfo("usockid=%d; daemon has closed /dev/usrsock.\n", conn->usockid);
-
-      return -ENETDOWN;
-    }
+  int ret;
 
-  /* Get exchange id. */
+  /* Set outstanding request for daemon to handle. */
 
-  if (++dev->newxid == 0)
+  ret = usrsockdev_semtake(&dev->devsem);
+  if (ret < 0)
     {
-      ++dev->newxid;
+      return ret;
     }
 
-  req_head->xid = dev->newxid;
-
-  /* Prepare connection for response. */
-
-  conn->resp.xid = req_head->xid;
-  conn->resp.result = -EACCES;
-
-  ++dev->req.nbusy; /* net_lock held. */
+  /* device not opened */
 
-  /* Set outstanding request for daemon to handle. */
-
-  net_lockedwait_uninterruptible(&dev->req.sem);
-
-  if (usrsockdev_is_opened(dev))
+  if (!usrsockdev_is_opened(dev))

Review Comment:
   let's keep the original logic



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1237906478

   > @masayuki2009 spresense:wifi_smp should work with latest patchset now.
   
   @ethanlcz 
   Can you rebase this PR to the latest master?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1241833705

   @masayuki2009 can the last version pass your test? @ethanlcz has more patches depend on this change.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] ethanlcz commented on a diff in pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
ethanlcz commented on code in PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#discussion_r957939333


##########
net/usrsock/usrsock_dev.c:
##########
@@ -1129,91 +554,61 @@ static int usrsockdev_poll(FAR struct file *filep, FAR struct pollfd *fds,
  ****************************************************************************/
 
 /****************************************************************************
- * Name: usrsockdev_do_request
+ * Name: usrsock_request
  ****************************************************************************/
 
-int usrsockdev_do_request(FAR struct usrsock_conn_s *conn,
-                          FAR struct iovec *iov, unsigned int iovcnt)
+int usrsock_request(FAR struct iovec *iov, unsigned int iovcnt)
 {
   FAR struct usrsockdev_s *dev = &g_usrsockdev;
-  FAR struct usrsock_request_common_s *req_head = iov[0].iov_base;
-
-  if (!usrsockdev_is_opened(dev))
-    {
-      ninfo("usockid=%d; daemon has closed /dev/usrsock.\n", conn->usockid);
-
-      return -ENETDOWN;
-    }
+  int ret;
 
-  /* Get exchange id. */
+  /* Set outstanding request for daemon to handle. */
 
-  if (++dev->newxid == 0)
+  ret = usrsockdev_semtake(&dev->devsem);
+  if (ret < 0)
     {
-      ++dev->newxid;
+      return ret;
     }
 
-  req_head->xid = dev->newxid;
-
-  /* Prepare connection for response. */
-
-  conn->resp.xid = req_head->xid;
-  conn->resp.result = -EACCES;
-
-  ++dev->req.nbusy; /* net_lock held. */
-
-  /* Set outstanding request for daemon to handle. */
-
-  net_lockedwait_uninterruptible(&dev->req.sem);
+  /* device not opened */

Review Comment:
   done



##########
net/usrsock/usrsock_dev.c:
##########
@@ -1129,91 +554,61 @@ static int usrsockdev_poll(FAR struct file *filep, FAR struct pollfd *fds,
  ****************************************************************************/
 
 /****************************************************************************
- * Name: usrsockdev_do_request
+ * Name: usrsock_request
  ****************************************************************************/
 
-int usrsockdev_do_request(FAR struct usrsock_conn_s *conn,
-                          FAR struct iovec *iov, unsigned int iovcnt)
+int usrsock_request(FAR struct iovec *iov, unsigned int iovcnt)
 {
   FAR struct usrsockdev_s *dev = &g_usrsockdev;
-  FAR struct usrsock_request_common_s *req_head = iov[0].iov_base;
-
-  if (!usrsockdev_is_opened(dev))
-    {
-      ninfo("usockid=%d; daemon has closed /dev/usrsock.\n", conn->usockid);
-
-      return -ENETDOWN;
-    }
+  int ret;
 
-  /* Get exchange id. */
+  /* Set outstanding request for daemon to handle. */
 
-  if (++dev->newxid == 0)
+  ret = usrsockdev_semtake(&dev->devsem);
+  if (ret < 0)
     {
-      ++dev->newxid;
+      return ret;
     }
 
-  req_head->xid = dev->newxid;
-
-  /* Prepare connection for response. */
-
-  conn->resp.xid = req_head->xid;
-  conn->resp.result = -EACCES;
-
-  ++dev->req.nbusy; /* net_lock held. */
-
-  /* Set outstanding request for daemon to handle. */
-
-  net_lockedwait_uninterruptible(&dev->req.sem);
+  /* device not opened */
 
   if (usrsockdev_is_opened(dev))
     {
       DEBUGASSERT(dev->req.iov == NULL);
-      dev->req.ackxid = req_head->xid;
       dev->req.iov = iov;
       dev->req.pos = 0;
       dev->req.iovcnt = iovcnt;
 
       /* Notify daemon of new request. */
 
       usrsockdev_pollnotify(dev, POLLIN);
-
-      /* Wait ack for request. */
-
-      net_lockedwait_uninterruptible(&dev->req.acksem);
+      ret = OK;

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1238870190

   @ethanlcz 
   Also, please rebase this PR to the latest master so that we can test this PR with spresense + gs2200m.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1239082642

   @ethanlcz 
   Please do not merge the master into your branch but rebase the master on your branch.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1240484333

   @ethanlcz 
   I tried the latest PR with `spresense:wifi_smp`
   However, it does not work with this PR.
   
   Without this PR,
   
   ```
   nsh> uname -a
   NuttX  0.0.0 b6e76966b9 Sep  8 2022 18:41:20 arm spresense
   nsh> ps
     PID GROUP CPU PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK   STACK   USED  FILLED COMMAND
       0     0   0   0 FIFO     Kthread N-- Assigned           00000000 001000 000456  45.6%  CPU0 IDLE
       1     1   1   0 FIFO     Kthread N-- Running            00000000 001000 000228  22.8%  CPU1 IDLE
       2     2 --- 224 RR       Kthread --- Waiting  Signal    00000000 001992 000492  24.6%  hpwork 0x2d057c74
       3     3 ---  60 RR       Kthread --- Waiting  Semaphore 00000000 001992 000300  15.0%  lpwork 0x2d057c84
       5     5 --- 200 RR       Task    --- Waiting  MQ empty  00000000 000976 000472  48.3%  cxd56_pm_task
       6     6   0 100 RR       Task    --- Running            00000000 003024 001404  46.4%  spresense_main
   nsh> free
                      total       used       free    largest  nused  nfree
           Umem:    1200400      41872    1158528    1156640    119      2
   nsh> mount
     /mnt/spif type smartfs
     /proc type procfs
   nsh> ifconfig
   nsh> gs2200m raspi3-g wifi-test-24g & 
   gs2200m [7:50]
   nsh> renew wlan0
   nsh> ntpcstart
   Started the NTP daemon as PID=24
   nsh> ls -l /proc/net
   /proc/net:
    -r--r--r--       0 wlan0
   nsh> ifconfig
   wlan0	Link encap:Ethernet HWaddr 3c:95:09:00:89:96 at UP
   	inet addr:192.168.10.22 DRaddr:192.168.10.1 Mask:255.255.255.0
   ```
   
   With this PR,
   
   ```
   nsh> uname -a
   NuttX  0.0.0 5264777f24 Sep  8 2022 18:45:51 arm spresense
   nsh> ps
     PID GROUP CPU PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK   STACK   USED  FILLED COMMAND
       0     0   0   0 FIFO     Kthread N-- Assigned           00000000 001000 000456  45.6%  CPU0 IDLE
       1     1   1   0 FIFO     Kthread N-- Running            00000000 001000 000228  22.8%  CPU1 IDLE
       2     2 --- 224 RR       Kthread --- Waiting  Signal    00000000 001992 000492  24.6%  hpwork 0x2d057d0c
       3     3 ---  60 RR       Kthread --- Waiting  Semaphore 00000000 001992 000300  15.0%  lpwork 0x2d057d1c
       5     5 --- 200 RR       Task    --- Waiting  MQ empty  00000000 000976 000472  48.3%  cxd56_pm_task
       6     6   0 100 RR       Task    --- Running            00000000 003024 001240  41.0%  spresense_main
   nsh> free
                      total       used       free    largest  nused  nfree
           Umem:    1200400      41872    1158528    1156640    119      2
   nsh> mount
     /mnt/spif type smartfs
     /proc type procfs
   nsh> ifconfig
   nsh> gs2200m raspi3-g wifi-test-24g & 
   gs2200m [7:50]
   nsh> renew wlan0
   nsh> ntpcstart
   Started the NTP daemon as PID=24
   nsh> ls -l /proc/net
   /proc/net:
   ```
   
    


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1240012619

   @Hmm,
   
   The assertion still happens with the latest code.
   Could you provide the following info?
   
   >I'm using the following defconfig and run the nuttx sim on Ubuntu 18.04 x86_64.
   >What OS are you using to test the nuttx sim?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] ethanlcz commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
ethanlcz commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1239097435

   > @ethanlcz Please do not merge the master into your branch but rebase the master on your branch.
   
   done
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] ethanlcz commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
ethanlcz commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1241667627

   @masayuki2009 
   Could you please help to review again?
   Thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] ethanlcz commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
ethanlcz commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1241615420

   > @ethanlcz I tried the latest PR with `spresense:wifi_smp` However, it does not work with this PR.
   > 
   > Without this PR,
   > 
   > ```
   > nsh> uname -a
   > NuttX  0.0.0 b6e76966b9 Sep  8 2022 18:41:20 arm spresense
   > nsh> ps
   >   PID GROUP CPU PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK   STACK   USED  FILLED COMMAND
   >     0     0   0   0 FIFO     Kthread N-- Assigned           00000000 001000 000456  45.6%  CPU0 IDLE
   >     1     1   1   0 FIFO     Kthread N-- Running            00000000 001000 000228  22.8%  CPU1 IDLE
   >     2     2 --- 224 RR       Kthread --- Waiting  Signal    00000000 001992 000492  24.6%  hpwork 0x2d057c74
   >     3     3 ---  60 RR       Kthread --- Waiting  Semaphore 00000000 001992 000300  15.0%  lpwork 0x2d057c84
   >     5     5 --- 200 RR       Task    --- Waiting  MQ empty  00000000 000976 000472  48.3%  cxd56_pm_task
   >     6     6   0 100 RR       Task    --- Running            00000000 003024 001404  46.4%  spresense_main
   > nsh> free
   >                    total       used       free    largest  nused  nfree
   >         Umem:    1200400      41872    1158528    1156640    119      2
   > nsh> mount
   >   /mnt/spif type smartfs
   >   /proc type procfs
   > nsh> ifconfig
   > nsh> gs2200m raspi3-g wifi-test-24g & 
   > gs2200m [7:50]
   > nsh> renew wlan0
   > nsh> ntpcstart
   > Started the NTP daemon as PID=24
   > nsh> ls -l /proc/net
   > /proc/net:
   >  -r--r--r--       0 wlan0
   > nsh> ifconfig
   > wlan0	Link encap:Ethernet HWaddr 3c:95:09:00:89:96 at UP
   > 	inet addr:192.168.10.22 DRaddr:192.168.10.1 Mask:255.255.255.0
   > ```
   > 
   > With this PR,
   > 
   > ```
   > nsh> uname -a
   > NuttX  0.0.0 5264777f24 Sep  8 2022 18:45:51 arm spresense
   > nsh> ps
   >   PID GROUP CPU PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK   STACK   USED  FILLED COMMAND
   >     0     0   0   0 FIFO     Kthread N-- Assigned           00000000 001000 000456  45.6%  CPU0 IDLE
   >     1     1   1   0 FIFO     Kthread N-- Running            00000000 001000 000228  22.8%  CPU1 IDLE
   >     2     2 --- 224 RR       Kthread --- Waiting  Signal    00000000 001992 000492  24.6%  hpwork 0x2d057d0c
   >     3     3 ---  60 RR       Kthread --- Waiting  Semaphore 00000000 001992 000300  15.0%  lpwork 0x2d057d1c
   >     5     5 --- 200 RR       Task    --- Waiting  MQ empty  00000000 000976 000472  48.3%  cxd56_pm_task
   >     6     6   0 100 RR       Task    --- Running            00000000 003024 001240  41.0%  spresense_main
   > nsh> free
   >                    total       used       free    largest  nused  nfree
   >         Umem:    1200400      41872    1158528    1156640    119      2
   > nsh> mount
   >   /mnt/spif type smartfs
   >   /proc type procfs
   > nsh> ifconfig
   > nsh> gs2200m raspi3-g wifi-test-24g & 
   > gs2200m [7:50]
   > nsh> renew wlan0
   > nsh> ntpcstart
   > Started the NTP daemon as PID=24
   > nsh> ls -l /proc/net
   > /proc/net:
   > ```
   
   Deadlock happened between net_lock and devsem(in usrsock_dev.c) and it is now fixed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] ethanlcz commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
ethanlcz commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1237863138

   @masayuki2009 spresense:wifi_smp should work with latest patchset now.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] ethanlcz commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
ethanlcz commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1238070932

   basic_setsockopt test follows after remote_disconnect, since remote_disconnect fails, so I didn't reproduce the assert you met.
   Let me disable remote_disconnect and try again.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1232447185

   @ethanlcz 
   Can you try to add `CONFIG_WIFI_BOARD_IS110B_HARDWARE_VERSION_10C=y` to defconfig?
   If it still does not work, try `CONFIG_WIFI_BOARD_IS110B_HARDWARE_VERSION_10B=y`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1233733739

   @ethanlcz need rebase the change again.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1229923816

   @ethanlcz please fetch the last code and rebase your change.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 merged pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
masayuki2009 merged PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] ethanlcz commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
ethanlcz commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1240190337

   @xiaoxiang781216 @masayuki2009 
   Please help to review again.
   The patch passed all usrsocktest cases without assert now.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] ethanlcz commented on a diff in pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
ethanlcz commented on code in PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#discussion_r964408774


##########
net/usrsock/usrsock_recvmsg.c:
##########
@@ -83,8 +83,9 @@ static uint16_t recvfrom_event(FAR struct net_driver_s *dev,
           pstate->valuelen_nontrunc = conn->resp.valuelen_nontrunc;
         }
 
-      if (pstate->reqstate.result >= 0 ||
-          pstate->reqstate.result == -EAGAIN)
+      if (!(flags & USRSOCK_EVENT_RECVFROM_AVAIL) &&

Review Comment:
   I rever this change



##########
net/usrsock/usrsock_recvmsg.c:
##########
@@ -83,8 +83,9 @@ static uint16_t recvfrom_event(FAR struct net_driver_s *dev,
           pstate->valuelen_nontrunc = conn->resp.valuelen_nontrunc;
         }
 
-      if (pstate->reqstate.result >= 0 ||
-          pstate->reqstate.result == -EAGAIN)
+      if (!(flags & USRSOCK_EVENT_RECVFROM_AVAIL) &&

Review Comment:
   I revert this change



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#discussion_r957043352


##########
net/usrsock/usrsock_dev.c:
##########
@@ -264,22 +133,6 @@ static void usrsockdev_semgive(FAR sem_t *sem)
   nxsem_post(sem);
 }
 
-/****************************************************************************
- * Name: usrsockdev_is_opened
- ****************************************************************************/
-
-static bool usrsockdev_is_opened(FAR struct usrsockdev_s *dev)

Review Comment:
   let's keep this



##########
net/usrsock/usrsock_dev.c:
##########
@@ -1129,91 +538,58 @@ static int usrsockdev_poll(FAR struct file *filep, FAR struct pollfd *fds,
  ****************************************************************************/
 
 /****************************************************************************
- * Name: usrsockdev_do_request
+ * Name: usrsock_request
  ****************************************************************************/
 
-int usrsockdev_do_request(FAR struct usrsock_conn_s *conn,
-                          FAR struct iovec *iov, unsigned int iovcnt)
+int usrsock_request(FAR struct iovec *iov, unsigned int iovcnt)
 {
   FAR struct usrsockdev_s *dev = &g_usrsockdev;
-  FAR struct usrsock_request_common_s *req_head = iov[0].iov_base;
-
-  if (!usrsockdev_is_opened(dev))

Review Comment:
   keep



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] ethanlcz commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
ethanlcz commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1231488064

   > @ethanlcz I tried this PR with spresense:wifi_smp but it does not work.
   > 
   > ```
   > NuttShell (NSH)
   > nsh> uname -a
   > NuttX  0.0.0 6bb1c0902d Aug 30 2022 14:01:59 arm spresense
   > nsh> ps
   >   PID GROUP CPU PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK   STACK   USED  FILLED COMMAND
   >     0     0   0   0 FIFO     Kthread N-- Assigned           00000000 001000 000456  45.6%  CPU0 IDLE
   >     1     1   1   0 FIFO     Kthread N-- Running            00000000 001000 000228  22.8%  CPU1 IDLE
   >     2     2 --- 224 RR       Kthread --- Waiting  Signal    00000000 001992 000476  23.8%  hpwork 0x2d057324
   >     3     3 ---  60 RR       Kthread --- Waiting  Semaphore 00000000 001992 000284  14.2%  lpwork 0x2d057334
   >     5     5 --- 200 RR       Task    --- Waiting  MQ empty  00000000 000976 000472  48.3%  cxd56_pm_task
   >     6     6   0 100 RR       Task    --- Running            00000000 003024 001240  41.0%  spresense_main
   > nsh> free
   >                    total       used       free    largest  nused  nfree
   >         Umem:    1201120      41872    1159248    1157360    119      2
   > nsh> mount
   >   /mnt/spif type smartfs
   >   /proc type procfs
   > nsh> ifconfig
   > wlan0	Link encap:Ethernet HWaddr 00:00:00:00:00:00 at UP
   > 	inet addr:0.0.0.0 DRaddr:0.0.0.0 Mask:0.0.0.0
   > 
   > nsh> gs2200m raspi3-g wifi-test-24g & 
   > gs2200m [7:50]
   > nsh> renew wlan0
   > Traceback (most recent call last):
   >   File "/home/ishikawa/script/expect_nuttx_wifi_streaming_test.py", line 39, in <module>
   >     child.expect('nsh> ', timeout=7)
   >   File "/home/ishikawa/.local/lib/python3.6/site-packages/pexpect/spawnbase.py", line 344, in expect
   >     timeout, searchwindowsize, async_)
   >   File "/home/ishikawa/.local/lib/python3.6/site-packages/pexpect/spawnbase.py", line 372, in expect_list
   >     return exp.expect_loop(timeout)
   >   File "/home/ishikawa/.local/lib/python3.6/site-packages/pexpect/expect.py", line 181, in expect_loop
   >     return self.timeout(e)
   >   File "/home/ishikawa/.local/lib/python3.6/site-packages/pexpect/expect.py", line 144, in timeout
   > ```
   
   I will try this project later after I get the test board.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1229936624

   @ethanlcz, @xiaoxiang781216 
   Before refining the usrsock architecture, I think we need to fix apps/examples/usrsocktest first.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] ethanlcz commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
ethanlcz commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1238069005

   @masayuki2009 
   
   I fixed the patch check error.
   I tried to run usrsocktest and got the same failure result like belows with or without this patch. But I didn't reproduce the assert (usrsock/usrsock_dev.c line: 577) you found after several tries.
   
   I suggest let's fix the failure later with other patches since the failure seems has nothing to do with the current patch.
   How do you think?
   
   NuttShell (NSH) NuttX-10.4.0
   nsh> usrsocktest
   Starting unit-tests...
   Testing group "char_dev" =>
   	Group "char_dev": [OK]
   Testing group "no_daemon" =>
   	Group "no_daemon": [OK]
   Testing group "basic_daemon" =>
   	Group "basic_daemon": [OK]
   Testing group "basic_connect" =>
   	Group "basic_connect": [OK]
   Testing group "basic_connect_delay" =>
   	Group "basic_connect_delay": [OK]
   Testing group "no_block_connect" =>
   	Group "no_block_connect": [OK]
   Testing group "basic_send" =>
   	Group "basic_send": [OK]
   Testing group "no_block_send" =>
   	Group "no_block_send": [OK]
   Testing group "block_send" =>
   	Group "block_send": [OK]
   Testing group "no_block_recv" =>
   	Group "no_block_recv": [OK]
   Testing group "block_recv" =>
   	Group "block_recv": [OK]
   Testing group "remote_disconnect" =>
   	[TEST ASSERT FAILED!]
   		In function "receive":
   		line 497: Assertion `(ssize_t)((ret)) == (ssize_t)((0))' failed.
   			got value: -1
   			should be: 0
   	Group "remote_disconnect": [FAILED]
   Testing group "basic_setsockopt" =>
   	[TEST ASSERT FAILED!]
   		In function "basic_setsockopt_open":
   		line 89: Assertion `(ssize_t)((usrsocktest_daemon_start(dconf))) == (ssize_t)((OK))' failed.
   			got value: -120
   			should be: 0
   	Group "basic_setsockopt": [FAILED]
   Testing group "basic_getsockopt" =>
   	[TEST ASSERT FAILED!]
   		In function "basic_getsockopt_open":
   		line 89: Assertion `(ssize_t)((usrsocktest_daemon_start(dconf))) == (ssize_t)((OK))' failed.
   			got value: -120
   			should be: 0
   	Group "basic_getsockopt": [FAILED]
   Testing group "basic_getsockname" =>
   	[TEST ASSERT FAILED!]
   		In function "basic_getsockname_open":
   		line 94: Assertion `(ssize_t)((usrsocktest_daemon_start(dconf))) == (ssize_t)((OK))' failed.
   			got value: -120
   			should be: 0
   	Group "basic_getsockname": [FAILED]
   Testing group "wake_with_signal" =>
   	[TEST ASSERT FAILED!]
   		In function "do_wake_test":
   		line 516: Assertion `(ssize_t)((usrsocktest_daemon_start(&usrsocktest_daemon_config))) == (ssize_t)((OK))' failed.
   			got value: -120
   			should be: 0
   	Group "wake_with_signal": [FAILED]
   Testing group "multithread" =>
   	[TEST ASSERT FAILED!]
   		In function "usrsocktest_test_multithread_open_close":
   		line 209: Assertion `(ssize_t)((usrsocktest_daemon_start(&usrsocktest_daemon_config))) == (ssize_t)((OK))' failed.
   			got value: -120
   			should be: 0
   	Group "multithread": [FAILED]
   Unit-test groups done... OK:11, FAILED:6, TOTAL:17
    -- number of checks made: 1945
   HEAP BEFORE TESTS:
                total       used       free    largest
   Mem:      67108368     283088   66825280   66825216
   HEAP AFTER TESTS:
                total       used       free    largest
   Mem:      67108368     420816   66687552   66687488
   nsh> quit
   nsh: quit: command not found
   nsh> [1]    3100589 killed     sudo ./nuttx


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] ethanlcz commented on a diff in pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
ethanlcz commented on code in PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#discussion_r965586526


##########
net/usrsock/Make.defs:
##########
@@ -28,6 +28,7 @@ NET_CSRCS += usrsock_event.c usrsock_getsockname.c usrsock_getsockopt.c
 NET_CSRCS += usrsock_poll.c usrsock_recvmsg.c usrsock_sendmsg.c
 NET_CSRCS += usrsock_setsockopt.c usrsock_socket.c usrsock_sockif.c
 NET_CSRCS += usrsock_accept.c usrsock_listen.c usrsock_ioctl.c
+NET_CSRCS += usrsock_devif.c

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] ethanlcz commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
ethanlcz commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1237988706

   > ### 4 workflows awaiting approval
   
   it's done.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] ethanlcz commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
ethanlcz commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1238939400

   > @ethanlcz Please test this PR with `CONFIG_DEBUG_ASSERTIONS=y`
   > 
   > ```
   > nsh> usrsocktest
   > Starting unit-tests...
   > Testing group "char_dev" =>
   > 	Group "char_dev": [OK]
   > Testing group "no_daemon" =>
   > 	Group "no_daemon": [OK]
   > Testing group "basic_daemon" =>
   > 	Group "basic_daemon": [OK]
   > Testing group "basic_connect" =>
   > 	Group "basic_connect": [OK]
   > Testing group "basic_connect_delay" =>
   > 	Group "basic_connect_delay": [OK]
   > Testing group "no_block_connect" =>
   > 	Group "no_block_connect": [OK]
   > Testing group "basic_send" =>
   > 	Group "basic_send": [OK]
   > Testing group "no_block_send" =>
   > 	Group "no_block_send": [OK]
   > Testing group "block_send" =>
   > 	Group "block_send": [OK]
   > Testing group "no_block_recv" =>
   > 	Group "no_block_recv": [OK]
   > Testing group "block_recv" =>
   > 	Group "block_recv": [OK]
   > Testing group "remote_disconnect" =>
   > 	Group "remote_disconnect": [OK]
   > Testing group "basic_setsockopt" =>
   > up_assert: Assertion failed at file:usrsock/usrsock_dev.c line: 577 task: usrsocktest
   > ```
   
   The patch now is rebased to the latest master.
   I enabled CONFIG_DEBUG_ASSERTIONS=y on sim:usrsocktest and tried several times and could not reproduct this assert.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1241887769

   @ethanlcz 
   The latest PR now works with spresense:wifi_smp.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1230033921

   The break is fixed here: https://github.com/apache/incubator-nuttx-apps/pull/1301
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] ethanlcz commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
ethanlcz commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1229936056

   > @ethanlcz please fetch the last code and rebase your change.
   
   done


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#discussion_r957431803


##########
net/usrsock/usrsock_dev.c:
##########
@@ -1129,91 +554,61 @@ static int usrsockdev_poll(FAR struct file *filep, FAR struct pollfd *fds,
  ****************************************************************************/
 
 /****************************************************************************
- * Name: usrsockdev_do_request
+ * Name: usrsock_request
  ****************************************************************************/
 
-int usrsockdev_do_request(FAR struct usrsock_conn_s *conn,
-                          FAR struct iovec *iov, unsigned int iovcnt)
+int usrsock_request(FAR struct iovec *iov, unsigned int iovcnt)
 {
   FAR struct usrsockdev_s *dev = &g_usrsockdev;
-  FAR struct usrsock_request_common_s *req_head = iov[0].iov_base;
-
-  if (!usrsockdev_is_opened(dev))
-    {
-      ninfo("usockid=%d; daemon has closed /dev/usrsock.\n", conn->usockid);
-
-      return -ENETDOWN;
-    }
+  int ret;
 
-  /* Get exchange id. */
+  /* Set outstanding request for daemon to handle. */
 
-  if (++dev->newxid == 0)
+  ret = usrsockdev_semtake(&dev->devsem);
+  if (ret < 0)
     {
-      ++dev->newxid;
+      return ret;
     }
 
-  req_head->xid = dev->newxid;
-
-  /* Prepare connection for response. */
-
-  conn->resp.xid = req_head->xid;
-  conn->resp.result = -EACCES;
-
-  ++dev->req.nbusy; /* net_lock held. */
-
-  /* Set outstanding request for daemon to handle. */
-
-  net_lockedwait_uninterruptible(&dev->req.sem);
+  /* device not opened */
 
   if (usrsockdev_is_opened(dev))
     {
       DEBUGASSERT(dev->req.iov == NULL);
-      dev->req.ackxid = req_head->xid;
       dev->req.iov = iov;
       dev->req.pos = 0;
       dev->req.iovcnt = iovcnt;
 
       /* Notify daemon of new request. */
 
       usrsockdev_pollnotify(dev, POLLIN);
-
-      /* Wait ack for request. */
-
-      net_lockedwait_uninterruptible(&dev->req.acksem);
+      ret = OK;

Review Comment:
   remove



##########
net/usrsock/usrsock_dev.c:
##########
@@ -1129,91 +554,61 @@ static int usrsockdev_poll(FAR struct file *filep, FAR struct pollfd *fds,
  ****************************************************************************/
 
 /****************************************************************************
- * Name: usrsockdev_do_request
+ * Name: usrsock_request
  ****************************************************************************/
 
-int usrsockdev_do_request(FAR struct usrsock_conn_s *conn,
-                          FAR struct iovec *iov, unsigned int iovcnt)
+int usrsock_request(FAR struct iovec *iov, unsigned int iovcnt)
 {
   FAR struct usrsockdev_s *dev = &g_usrsockdev;
-  FAR struct usrsock_request_common_s *req_head = iov[0].iov_base;
-
-  if (!usrsockdev_is_opened(dev))
-    {
-      ninfo("usockid=%d; daemon has closed /dev/usrsock.\n", conn->usockid);
-
-      return -ENETDOWN;
-    }
+  int ret;
 
-  /* Get exchange id. */
+  /* Set outstanding request for daemon to handle. */
 
-  if (++dev->newxid == 0)
+  ret = usrsockdev_semtake(&dev->devsem);
+  if (ret < 0)
     {
-      ++dev->newxid;
+      return ret;
     }
 
-  req_head->xid = dev->newxid;
-
-  /* Prepare connection for response. */
-
-  conn->resp.xid = req_head->xid;
-  conn->resp.result = -EACCES;
-
-  ++dev->req.nbusy; /* net_lock held. */
-
-  /* Set outstanding request for daemon to handle. */
-
-  net_lockedwait_uninterruptible(&dev->req.sem);
+  /* device not opened */

Review Comment:
   remove



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] ethanlcz commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
ethanlcz commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1232474661

   > gs2200m
   
   Thanks Masayuki !
   It works after set "CONFIG_WIFI_BOARD_IS110B_HARDWARE_VERSION_10C=y".
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] ethanlcz commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
ethanlcz commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1232438122

   > > @ethanlcz I tried this PR with spresense:wifi_smp but it does not work.
   > > ```
   > > NuttShell (NSH)
   > > nsh> uname -a
   > > NuttX  0.0.0 6bb1c0902d Aug 30 2022 14:01:59 arm spresense
   > > nsh> ps
   > >   PID GROUP CPU PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK   STACK   USED  FILLED COMMAND
   > >     0     0   0   0 FIFO     Kthread N-- Assigned           00000000 001000 000456  45.6%  CPU0 IDLE
   > >     1     1   1   0 FIFO     Kthread N-- Running            00000000 001000 000228  22.8%  CPU1 IDLE
   > >     2     2 --- 224 RR       Kthread --- Waiting  Signal    00000000 001992 000476  23.8%  hpwork 0x2d057324
   > >     3     3 ---  60 RR       Kthread --- Waiting  Semaphore 00000000 001992 000284  14.2%  lpwork 0x2d057334
   > >     5     5 --- 200 RR       Task    --- Waiting  MQ empty  00000000 000976 000472  48.3%  cxd56_pm_task
   > >     6     6   0 100 RR       Task    --- Running            00000000 003024 001240  41.0%  spresense_main
   > > nsh> free
   > >                    total       used       free    largest  nused  nfree
   > >         Umem:    1201120      41872    1159248    1157360    119      2
   > > nsh> mount
   > >   /mnt/spif type smartfs
   > >   /proc type procfs
   > > nsh> ifconfig
   > > wlan0	Link encap:Ethernet HWaddr 00:00:00:00:00:00 at UP
   > > 	inet addr:0.0.0.0 DRaddr:0.0.0.0 Mask:0.0.0.0
   > > 
   > > nsh> gs2200m raspi3-g wifi-test-24g & 
   > > gs2200m [7:50]
   > > nsh> renew wlan0
   > > Traceback (most recent call last):
   > >   File "/home/ishikawa/script/expect_nuttx_wifi_streaming_test.py", line 39, in <module>
   > >     child.expect('nsh> ', timeout=7)
   > >   File "/home/ishikawa/.local/lib/python3.6/site-packages/pexpect/spawnbase.py", line 344, in expect
   > >     timeout, searchwindowsize, async_)
   > >   File "/home/ishikawa/.local/lib/python3.6/site-packages/pexpect/spawnbase.py", line 372, in expect_list
   > >     return exp.expect_loop(timeout)
   > >   File "/home/ishikawa/.local/lib/python3.6/site-packages/pexpect/expect.py", line 181, in expect_loop
   > >     return self.timeout(e)
   > >   File "/home/ishikawa/.local/lib/python3.6/site-packages/pexpect/expect.py", line 144, in timeout
   > > ```
   > 
   > I will try this project later after I get the test board.
   
   I tried both spresense:wifi_smp and spresense:wifi, but the board fail to bootup, uart log show the following assert information:
   Terminal ready
   [    0.420000] up_assert: Assertion failed at file:wireless/gs2200m.c line: 897 task: lpwork
   [    0.420000] up_assert: Assertion failed at file:armv7-m/arm_hardfault.c line: 173 task: lpwork
   
   It seems the communication between spresense board and GS2200M modules goes wrong.
   I connect spresense board and GS2200M according to the following picture.
   Do you have any idea how to fix this?
   ![image](https://user-images.githubusercontent.com/78590662/187590768-7f3da67d-69fa-4a20-aeca-6fe55384777e.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1240402456

   LGTM, @masayuki2009 could you try it again? Thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] ethanlcz commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
ethanlcz commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1238838032

   @xiaoxiang781216 @masayuki2009
   I forgot to upgrade latest nuttx app and got the failure yesterday. Now it passed usrsocktest with latest nuttx kernel and app.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1239004313

   >The patch now is rebased to the latest master.
   >I enabled CONFIG_DEBUG_ASSERTIONS=y on sim:usrsocktest and tried several times and could not reproduct this assert.
   
   @ethanlcz 
   Hmm, it's  very strange.
   I'm using the following defconfig and run the nuttx sim on Ubuntu 18.04 x86_64.
   What OS are you using to test the nuttx sim?
   
   ```
   --- a/boards/sim/sim/sim/configs/usrsocktest/defconfig
   +++ b/boards/sim/sim/sim/configs/usrsocktest/defconfig
   @@ -12,12 +12,16 @@ CONFIG_ARCH_CHIP="sim"
    CONFIG_ARCH_SIM=y
    CONFIG_BOARDCTL_POWEROFF=y
    CONFIG_BUILTIN=y
   +CONFIG_DEBUG_ASSERTIONS=y
   +CONFIG_DEBUG_ERROR=y
   +CONFIG_DEBUG_FEATURES=y
    CONFIG_DEBUG_SYMBOLS=y
    CONFIG_DEV_LOOP=y
    CONFIG_DEV_ZERO=y
    CONFIG_EXAMPLES_USRSOCKTEST=y
    CONFIG_IDLETHREAD_STACKSIZE=4096
    CONFIG_INIT_ENTRYPOINT="nsh_main"
   +CONFIG_NDEBUG=y
    CONFIG_NET=y
    CONFIG_NET_USRSOCK=y
    CONFIG_NSH_ARCHINIT=y
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#issuecomment-1239011931

   >The patch now is rebased to the latest master.
   
   @ethanlcz 
   Hmm, I can't see recent commits such as https://github.com/apache/incubator-nuttx/pull/7024


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] ethanlcz commented on a diff in pull request #6949: usrsock:refine usrsock's architecture

Posted by GitBox <gi...@apache.org>.
ethanlcz commented on code in PR #6949:
URL: https://github.com/apache/incubator-nuttx/pull/6949#discussion_r966772018


##########
net/usrsock/usrsock_dev.c:
##########
@@ -1132,91 +545,55 @@ static int usrsockdev_poll(FAR struct file *filep, FAR struct pollfd *fds,
  ****************************************************************************/
 
 /****************************************************************************
- * Name: usrsockdev_do_request
+ * Name: usrsock_request
  ****************************************************************************/
 
-int usrsockdev_do_request(FAR struct usrsock_conn_s *conn,
-                          FAR struct iovec *iov, unsigned int iovcnt)
+int usrsock_request(FAR struct iovec *iov, unsigned int iovcnt)
 {
   FAR struct usrsockdev_s *dev = &g_usrsockdev;
-  FAR struct usrsock_request_common_s *req_head = iov[0].iov_base;
-
-  if (!usrsockdev_is_opened(dev))
-    {
-      ninfo("usockid=%d; daemon has closed /dev/usrsock.\n", conn->usockid);
-
-      return -ENETDOWN;
-    }
-
-  /* Get exchange id. */
-
-  if (++dev->newxid == 0)
-    {
-      ++dev->newxid;
-    }
-
-  req_head->xid = dev->newxid;
-
-  /* Prepare connection for response. */
-
-  conn->resp.xid = req_head->xid;
-  conn->resp.result = -EACCES;
-
-  ++dev->req.nbusy; /* net_lock held. */
+  int ret;
 
   /* Set outstanding request for daemon to handle. */
 
-  net_lockedwait_uninterruptible(&dev->req.sem);
+  net_lockedwait_uninterruptible(&dev->devsem);
 
   if (usrsockdev_is_opened(dev))
     {
       DEBUGASSERT(dev->req.iov == NULL);
-      dev->req.ackxid = req_head->xid;
       dev->req.iov = iov;
       dev->req.pos = 0;
       dev->req.iovcnt = iovcnt;
 
       /* Notify daemon of new request. */
 
       usrsockdev_pollnotify(dev, POLLIN);
-
-      /* Wait ack for request. */
-
-      net_lockedwait_uninterruptible(&dev->req.acksem);
+      ret =0;

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org