You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/08/26 12:58:16 UTC

[incubator-nuttx] branch master updated (1ad066955f -> 162fcd10ca)

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


    from 1ad066955f Avoid assertion violation in case of kmm_free(NULL)
     new ea621599fd net: remove pvconn reference from all devif callback
     new 162fcd10ca net: cleanup pvconn reference to avoid confuse

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 net/arp/arp_poll.c                   |  2 +-
 net/arp/arp_send.c                   |  1 -
 net/bluetooth/bluetooth_callback.c   |  3 +--
 net/bluetooth/bluetooth_recvmsg.c    |  5 ++---
 net/bluetooth/bluetooth_sendmsg.c    |  3 +--
 net/can/can_callback.c               |  2 +-
 net/can/can_recvmsg.c                |  3 +--
 net/can/can_sendmsg.c                |  3 +--
 net/can/can_sockif.c                 |  5 ++---
 net/devif/devif.h                    | 14 +++-----------
 net/devif/devif_callback.c           | 17 +++++------------
 net/icmp/icmp_input.c                |  2 +-
 net/icmp/icmp_netpoll.c              |  5 ++---
 net/icmp/icmp_poll.c                 |  2 +-
 net/icmp/icmp_recvmsg.c              |  6 ++----
 net/icmp/icmp_sendmsg.c              |  6 ++----
 net/icmpv6/icmpv6_autoconfig.c       |  1 -
 net/icmpv6/icmpv6_input.c            |  2 +-
 net/icmpv6/icmpv6_neighbor.c         |  1 -
 net/icmpv6/icmpv6_netpoll.c          |  5 ++---
 net/icmpv6/icmpv6_poll.c             |  2 +-
 net/icmpv6/icmpv6_recvmsg.c          |  6 ++----
 net/icmpv6/icmpv6_sendmsg.c          |  4 +---
 net/ieee802154/ieee802154_callback.c |  3 +--
 net/ieee802154/ieee802154_recvmsg.c  |  7 +++----
 net/ieee802154/ieee802154_sendmsg.c  |  3 +--
 net/ipforward/ipfwd_forward.c        |  4 +---
 net/ipforward/ipfwd_poll.c           |  2 +-
 net/netdev/netdev_carrier.c          |  2 +-
 net/netdev/netdev_ioctl.c            |  2 +-
 net/pkt/pkt_callback.c               |  2 +-
 net/pkt/pkt_recvmsg.c                |  3 +--
 net/pkt/pkt_sendmsg.c                |  3 +--
 net/sixlowpan/sixlowpan_send.c       |  9 ++++-----
 net/sixlowpan/sixlowpan_tcpsend.c    | 13 ++++---------
 net/tcp/tcp.h                        |  5 ++++-
 net/tcp/tcp_callback.c               |  4 ++--
 net/tcp/tcp_close.c                  | 17 +++++++----------
 net/tcp/tcp_connect.c                |  6 ++----
 net/tcp/tcp_dump.c                   | 13 ++++++-------
 net/tcp/tcp_monitor.c                |  8 +++-----
 net/tcp/tcp_netpoll.c                |  5 ++---
 net/tcp/tcp_recvfrom.c               | 21 +++------------------
 net/tcp/tcp_send_buffered.c          | 26 ++------------------------
 net/tcp/tcp_send_unbuffered.c        | 26 ++------------------------
 net/tcp/tcp_sendfile.c               | 28 +++-------------------------
 net/udp/udp_callback.c               |  2 +-
 net/udp/udp_netpoll.c                |  5 ++---
 net/udp/udp_recvfrom.c               |  7 +++----
 net/udp/udp_sendto_buffered.c        |  8 +++-----
 net/udp/udp_sendto_unbuffered.c      |  6 ++----
 net/usrsock/usrsock.h                |  2 +-
 net/usrsock/usrsock_accept.c         |  4 ++--
 net/usrsock/usrsock_bind.c           |  4 ++--
 net/usrsock/usrsock_close.c          |  4 ++--
 net/usrsock/usrsock_connect.c        |  4 ++--
 net/usrsock/usrsock_event.c          |  2 +-
 net/usrsock/usrsock_getpeername.c    |  3 +--
 net/usrsock/usrsock_getsockname.c    |  3 +--
 net/usrsock/usrsock_getsockopt.c     |  5 ++---
 net/usrsock/usrsock_ioctl.c          |  5 ++---
 net/usrsock/usrsock_listen.c         |  4 ++--
 net/usrsock/usrsock_poll.c           | 18 +++++++++---------
 net/usrsock/usrsock_recvmsg.c        |  5 ++---
 net/usrsock/usrsock_sendmsg.c        |  4 ++--
 net/usrsock/usrsock_setsockopt.c     |  5 ++---
 net/usrsock/usrsock_socket.c         |  4 ++--
 67 files changed, 135 insertions(+), 281 deletions(-)


[incubator-nuttx] 02/02: net: cleanup pvconn reference to avoid confuse

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 162fcd10caac9f369afe890e154323db2b2aea20
Author: chao.an <an...@xiaomi.com>
AuthorDate: Thu Aug 25 21:17:57 2022 +0800

    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 <an...@xiaomi.com>
---
 net/arp/arp_poll.c                   |  2 +-
 net/arp/arp_send.c                   |  1 -
 net/bluetooth/bluetooth_callback.c   |  3 +--
 net/bluetooth/bluetooth_recvmsg.c    |  5 ++---
 net/bluetooth/bluetooth_sendmsg.c    |  3 +--
 net/can/can_callback.c               |  2 +-
 net/can/can_recvmsg.c                |  3 +--
 net/can/can_sendmsg.c                |  3 +--
 net/can/can_sockif.c                 |  5 ++---
 net/devif/devif.h                    | 14 +++-----------
 net/devif/devif_callback.c           | 17 +++++------------
 net/icmp/icmp_input.c                |  2 +-
 net/icmp/icmp_netpoll.c              |  5 ++---
 net/icmp/icmp_poll.c                 |  2 +-
 net/icmp/icmp_recvmsg.c              |  6 ++----
 net/icmp/icmp_sendmsg.c              |  6 ++----
 net/icmpv6/icmpv6_autoconfig.c       |  1 -
 net/icmpv6/icmpv6_input.c            |  2 +-
 net/icmpv6/icmpv6_neighbor.c         |  1 -
 net/icmpv6/icmpv6_netpoll.c          |  5 ++---
 net/icmpv6/icmpv6_poll.c             |  2 +-
 net/icmpv6/icmpv6_recvmsg.c          |  6 ++----
 net/icmpv6/icmpv6_sendmsg.c          |  4 +---
 net/ieee802154/ieee802154_callback.c |  3 +--
 net/ieee802154/ieee802154_recvmsg.c  |  7 +++----
 net/ieee802154/ieee802154_sendmsg.c  |  3 +--
 net/ipforward/ipfwd_forward.c        |  4 +---
 net/ipforward/ipfwd_poll.c           |  2 +-
 net/netdev/netdev_carrier.c          |  2 +-
 net/netdev/netdev_ioctl.c            |  2 +-
 net/pkt/pkt_callback.c               |  2 +-
 net/pkt/pkt_recvmsg.c                |  3 +--
 net/pkt/pkt_sendmsg.c                |  3 +--
 net/sixlowpan/sixlowpan_send.c       |  9 ++++-----
 net/sixlowpan/sixlowpan_tcpsend.c    |  4 +---
 net/tcp/tcp.h                        |  1 -
 net/tcp/tcp_callback.c               |  4 ++--
 net/tcp/tcp_close.c                  |  3 +--
 net/tcp/tcp_connect.c                |  6 ++----
 net/tcp/tcp_dump.c                   | 13 ++++++-------
 net/tcp/tcp_monitor.c                |  8 +++-----
 net/tcp/tcp_netpoll.c                |  5 ++---
 net/tcp/tcp_recvfrom.c               | 21 +++------------------
 net/tcp/tcp_send_buffered.c          | 26 ++------------------------
 net/tcp/tcp_send_unbuffered.c        | 26 ++------------------------
 net/tcp/tcp_sendfile.c               | 28 +++-------------------------
 net/udp/udp_callback.c               |  2 +-
 net/udp/udp_netpoll.c                |  5 ++---
 net/udp/udp_recvfrom.c               |  7 +++----
 net/udp/udp_sendto_buffered.c        |  8 +++-----
 net/udp/udp_sendto_unbuffered.c      |  6 ++----
 net/usrsock/usrsock_accept.c         |  2 +-
 net/usrsock/usrsock_bind.c           |  2 +-
 net/usrsock/usrsock_close.c          |  2 +-
 net/usrsock/usrsock_connect.c        |  2 +-
 net/usrsock/usrsock_event.c          |  2 +-
 net/usrsock/usrsock_getpeername.c    |  1 -
 net/usrsock/usrsock_getsockname.c    |  1 -
 net/usrsock/usrsock_getsockopt.c     |  3 +--
 net/usrsock/usrsock_ioctl.c          |  3 +--
 net/usrsock/usrsock_listen.c         |  2 +-
 net/usrsock/usrsock_poll.c           |  4 ++--
 net/usrsock/usrsock_recvmsg.c        |  3 +--
 net/usrsock/usrsock_sendmsg.c        |  2 +-
 net/usrsock/usrsock_setsockopt.c     |  3 +--
 net/usrsock/usrsock_socket.c         |  2 +-
 66 files changed, 101 insertions(+), 246 deletions(-)

diff --git a/net/arp/arp_poll.c b/net/arp/arp_poll.c
index a9ca0fb182..6df5bcc9d7 100644
--- a/net/arp/arp_poll.c
+++ b/net/arp/arp_poll.c
@@ -60,7 +60,7 @@ int arp_poll(FAR struct net_driver_s *dev, devif_poll_callback_t callback)
 
   /* Perform the ARP callbacks */
 
-  devif_conn_event(dev, NULL, ARP_POLL, dev->d_conncb);
+  devif_conn_event(dev, ARP_POLL, dev->d_conncb);
 
   /* Call back into the driver */
 
diff --git a/net/arp/arp_send.c b/net/arp/arp_send.c
index 174aa933a8..1851140835 100644
--- a/net/arp/arp_send.c
+++ b/net/arp/arp_send.c
@@ -71,7 +71,6 @@ static void arp_send_terminate(FAR struct arp_send_s *state, int result)
  ****************************************************************************/
 
 static uint16_t arp_send_eventhandler(FAR struct net_driver_s *dev,
-                                      FAR void *pvconn,
                                       FAR void *priv, uint16_t flags)
 {
   FAR struct arp_send_s *state = (FAR struct arp_send_s *)priv;
diff --git a/net/bluetooth/bluetooth_callback.c b/net/bluetooth/bluetooth_callback.c
index 3141182d5a..05aba05f9f 100644
--- a/net/bluetooth/bluetooth_callback.c
+++ b/net/bluetooth/bluetooth_callback.c
@@ -69,8 +69,7 @@ uint16_t bluetooth_callback(FAR struct radio_driver_s *radio,
     {
       /* Perform the callback */
 
-      flags = devif_conn_event(&radio->r_dev, conn,
-                               flags, conn->bc_conn.list);
+      flags = devif_conn_event(&radio->r_dev, flags, conn->bc_conn.list);
     }
 
   return flags;
diff --git a/net/bluetooth/bluetooth_recvmsg.c b/net/bluetooth/bluetooth_recvmsg.c
index b7e2d119b1..f3325dd3b7 100644
--- a/net/bluetooth/bluetooth_recvmsg.c
+++ b/net/bluetooth/bluetooth_recvmsg.c
@@ -205,7 +205,6 @@ static ssize_t
  ****************************************************************************/
 
 static uint16_t bluetooth_recvfrom_eventhandler(FAR struct net_driver_s *dev,
-                                                 FAR void *pvconn,
                                                  FAR void *pvpriv,
                                                  uint16_t flags)
 {
@@ -215,7 +214,7 @@ static uint16_t bluetooth_recvfrom_eventhandler(FAR struct net_driver_s *dev,
 
   ninfo("flags: %04x\n", flags);
 
-  DEBUGASSERT(pvpriv != NULL && dev != NULL && pvconn != NULL);
+  DEBUGASSERT(pvpriv != NULL && dev != NULL);
 
   /* Ignore polls from non Bluetooth network drivers */
 
@@ -228,7 +227,7 @@ static uint16_t bluetooth_recvfrom_eventhandler(FAR struct net_driver_s *dev,
 
 #warning Missing logic
 
-  pstate = (FAR struct bluetooth_recvfrom_s *)pvpriv;
+  pstate = pvpriv;
   radio  = (FAR struct radio_driver_s *)dev;
 
   /* 'pstate' might be null in some race conditions (?) */
diff --git a/net/bluetooth/bluetooth_sendmsg.c b/net/bluetooth/bluetooth_sendmsg.c
index ba30eff9e5..e2df25958d 100644
--- a/net/bluetooth/bluetooth_sendmsg.c
+++ b/net/bluetooth/bluetooth_sendmsg.c
@@ -82,7 +82,6 @@ struct bluetooth_sendto_s
  ****************************************************************************/
 
 static uint16_t bluetooth_sendto_eventhandler(FAR struct net_driver_s *dev,
-                                               FAR void *pvconn,
                                                FAR void *pvpriv,
                                                uint16_t flags)
 {
@@ -106,7 +105,7 @@ static uint16_t bluetooth_sendto_eventhandler(FAR struct net_driver_s *dev,
 
 #warning Missing logic
 
-  pstate = (FAR struct bluetooth_sendto_s *)pvpriv;
+  pstate = pvpriv;
   radio  = (FAR struct radio_driver_s *)dev;
 
   ninfo("flags: %04x sent: %zd\n", flags, pstate->is_sent);
diff --git a/net/can/can_callback.c b/net/can/can_callback.c
index 1c1630ed61..394c1d51ac 100644
--- a/net/can/can_callback.c
+++ b/net/can/can_callback.c
@@ -139,7 +139,7 @@ uint16_t can_callback(FAR struct net_driver_s *dev,
 
       if (net_trylock() == OK)
         {
-          flags = devif_conn_event(dev, conn, flags, conn->sconn.list);
+          flags = devif_conn_event(dev, flags, conn->sconn.list);
           net_unlock();
         }
 
diff --git a/net/can/can_recvmsg.c b/net/can/can_recvmsg.c
index 0e4e1275d8..4f27c31799 100644
--- a/net/can/can_recvmsg.c
+++ b/net/can/can_recvmsg.c
@@ -404,10 +404,9 @@ static int can_recv_filter(struct can_conn_s *conn, canid_t id)
 #endif
 
 static uint16_t can_recvfrom_eventhandler(FAR struct net_driver_s *dev,
-                                          FAR void *pvconn,
                                           FAR void *pvpriv, uint16_t flags)
 {
-  struct can_recvfrom_s *pstate = (struct can_recvfrom_s *)pvpriv;
+  struct can_recvfrom_s *pstate = pvpriv;
 #if defined(CONFIG_NET_CANPROTO_OPTIONS) || defined(CONFIG_NET_TIMESTAMP)
   struct can_conn_s *conn = (struct can_conn_s *)pstate->pr_sock->s_conn;
 #endif
diff --git a/net/can/can_sendmsg.c b/net/can/can_sendmsg.c
index 3ccea61826..c4aa84ec06 100644
--- a/net/can/can_sendmsg.c
+++ b/net/can/can_sendmsg.c
@@ -77,10 +77,9 @@ struct send_s
  ****************************************************************************/
 
 static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev,
-                                        FAR void *pvconn,
                                         FAR void *pvpriv, uint16_t flags)
 {
-  FAR struct send_s *pstate = (FAR struct send_s *)pvpriv;
+  FAR struct send_s *pstate = pvpriv;
 
   if (pstate)
     {
diff --git a/net/can/can_sockif.c b/net/can/can_sockif.c
index bddc3ef9b8..01ddf193e9 100644
--- a/net/can/can_sockif.c
+++ b/net/can/can_sockif.c
@@ -100,7 +100,7 @@ const struct sock_intf_s g_can_sockif =
  *
  * Input Parameters:
  *   dev      The structure of the network driver that caused the event
- *   conn     The connection structure associated with the socket
+ *   pvpriv   An instance of struct can_poll_s cast to void*
  *   flags    Set of events describing why the callback was invoked
  *
  * Returned Value:
@@ -112,10 +112,9 @@ const struct sock_intf_s g_can_sockif =
  ****************************************************************************/
 
 static uint16_t can_poll_eventhandler(FAR struct net_driver_s *dev,
-                                      FAR void *conn,
                                       FAR void *pvpriv, uint16_t flags)
 {
-  FAR struct can_poll_s *info = (FAR struct can_poll_s *)pvpriv;
+  FAR struct can_poll_s *info = pvpriv;
 
   DEBUGASSERT(!info || (info->psock && info->fds));
 
diff --git a/net/devif/devif.h b/net/devif/devif.h
index 17bb068720..e78f7b5b4e 100644
--- a/net/devif/devif.h
+++ b/net/devif/devif.h
@@ -253,7 +253,6 @@
 struct net_driver_s;       /* Forward reference */
 
 typedef CODE uint16_t (*devif_callback_event_t)(FAR struct net_driver_s *dev,
-                                                FAR void *pvconn,
                                                 FAR void *pvpriv,
                                                 uint16_t flags);
 
@@ -389,9 +388,6 @@ void devif_dev_callback_free(FAR struct net_driver_s *dev,
  * Input Parameters:
  *   dev - The network device state structure associated with the network
  *     device that initiated the callback event.
- *   pvconn - Holds a reference to the TCP connection structure or the UDP
- *     port structure. It can be NULL if the event is not related to a TCP
- *     connection or UDP port.
  *   flags - The bit set of events to be notified.
  *   list - The list to traverse in performing the notifications
  *
@@ -403,8 +399,8 @@ void devif_dev_callback_free(FAR struct net_driver_s *dev,
  *
  ****************************************************************************/
 
-uint16_t devif_conn_event(FAR struct net_driver_s *dev, FAR void *pvconn,
-                          uint16_t flags, FAR struct devif_callback_s *list);
+uint16_t devif_conn_event(FAR struct net_driver_s *dev, uint16_t flags,
+                          FAR struct devif_callback_s *list);
 
 /****************************************************************************
  * Name: devif_dev_event
@@ -415,9 +411,6 @@ uint16_t devif_conn_event(FAR struct net_driver_s *dev, FAR void *pvconn,
  * Input Parameters:
  *   dev - The network device state structure associated with the network
  *     device that initiated the callback event.
- *   pvconn - Holds a reference to the TCP connection structure or the UDP
- *     port structure. It can be NULL if the event is not related to a TCP
- *     connection or UDP port.
  *   flags - The bit set of events to be notified.
  *
  * Returned Value:
@@ -428,8 +421,7 @@ uint16_t devif_conn_event(FAR struct net_driver_s *dev, FAR void *pvconn,
  *
  ****************************************************************************/
 
-uint16_t devif_dev_event(FAR struct net_driver_s *dev, void *pvconn,
-                         uint16_t flags);
+uint16_t devif_dev_event(FAR struct net_driver_s *dev, uint16_t flags);
 
 /****************************************************************************
  * Send data on the current connection.
diff --git a/net/devif/devif_callback.c b/net/devif/devif_callback.c
index aac3695f71..68ce2aece4 100644
--- a/net/devif/devif_callback.c
+++ b/net/devif/devif_callback.c
@@ -465,9 +465,6 @@ void devif_dev_callback_free(FAR struct net_driver_s *dev,
  * Input Parameters:
  *   dev - The network device state structure associated with the network
  *     device that initiated the callback event.
- *   pvconn - Holds a reference to the TCP connection structure or the UDP
- *     port structure. It can be NULL if the event is not related to a TCP
- *     connection or UDP port.
  *   flags - The bit set of events to be notified.
  *   list - The list to traverse in performing the notifications
  *
@@ -479,8 +476,8 @@ void devif_dev_callback_free(FAR struct net_driver_s *dev,
  *
  ****************************************************************************/
 
-uint16_t devif_conn_event(FAR struct net_driver_s *dev, void *pvconn,
-                          uint16_t flags, FAR struct devif_callback_s *list)
+uint16_t devif_conn_event(FAR struct net_driver_s *dev, uint16_t flags,
+                          FAR struct devif_callback_s *list)
 {
   FAR struct devif_callback_s *next;
 
@@ -507,7 +504,7 @@ uint16_t devif_conn_event(FAR struct net_driver_s *dev, void *pvconn,
            * beginning of the list (which will be ignored on this pass)
            */
 
-          flags = list->event(dev, pvconn, list->priv, flags);
+          flags = list->event(dev, list->priv, flags);
         }
 
       /* Set up for the next time through the loop */
@@ -528,9 +525,6 @@ uint16_t devif_conn_event(FAR struct net_driver_s *dev, void *pvconn,
  * Input Parameters:
  *   dev - The network device state structure associated with the network
  *     device that initiated the callback event.
- *   pvconn - Holds a reference to the TCP connection structure or the UDP
- *     port structure. It can be NULL if the event is not related to a TCP
- *     connection or UDP port.
  *   flags - The bit set of events to be notified.
  *
  * Returned Value:
@@ -541,8 +535,7 @@ uint16_t devif_conn_event(FAR struct net_driver_s *dev, void *pvconn,
  *
  ****************************************************************************/
 
-uint16_t devif_dev_event(FAR struct net_driver_s *dev, void *pvconn,
-                         uint16_t flags)
+uint16_t devif_dev_event(FAR struct net_driver_s *dev, uint16_t flags)
 {
   FAR struct devif_callback_s *cb;
   FAR struct devif_callback_s *next;
@@ -570,7 +563,7 @@ uint16_t devif_dev_event(FAR struct net_driver_s *dev, void *pvconn,
            * beginning of the list (which will be ignored on this pass)
            */
 
-          flags = cb->event(dev, pvconn, cb->priv, flags);
+          flags = cb->event(dev, cb->priv, flags);
         }
     }
 
diff --git a/net/icmp/icmp_input.c b/net/icmp/icmp_input.c
index d22f5e47c7..04c2d11bc0 100644
--- a/net/icmp/icmp_input.c
+++ b/net/icmp/icmp_input.c
@@ -330,7 +330,7 @@ void icmp_input(FAR struct net_driver_s *dev)
           goto drop;
         }
 
-      flags = devif_conn_event(dev, conn, ICMP_NEWDATA, conn->sconn.list);
+      flags = devif_conn_event(dev, ICMP_NEWDATA, conn->sconn.list);
       if ((flags & ICMP_NEWDATA) != 0)
         {
           uint16_t nbuffered;
diff --git a/net/icmp/icmp_netpoll.c b/net/icmp/icmp_netpoll.c
index 3438bc338f..a5050e3665 100644
--- a/net/icmp/icmp_netpoll.c
+++ b/net/icmp/icmp_netpoll.c
@@ -49,7 +49,7 @@
  *
  * Input Parameters:
  *   dev      The structure of the network driver that caused the event
- *   conn     The connection structure associated with the socket
+ *   pvpriv   An instance of struct icmp_poll_s cast to void*
  *   flags    Set of events describing why the callback was invoked
  *
  * Returned Value:
@@ -61,10 +61,9 @@
  ****************************************************************************/
 
 static uint16_t icmp_poll_eventhandler(FAR struct net_driver_s *dev,
-                                       FAR void *pvconn,
                                        FAR void *pvpriv, uint16_t flags)
 {
-  FAR struct icmp_poll_s *info = (FAR struct icmp_poll_s *)pvpriv;
+  FAR struct icmp_poll_s *info = pvpriv;
   FAR struct icmp_conn_s *conn;
   FAR struct socket *psock;
   pollevent_t eventset;
diff --git a/net/icmp/icmp_poll.c b/net/icmp/icmp_poll.c
index b99b317f35..e71690bf00 100644
--- a/net/icmp/icmp_poll.c
+++ b/net/icmp/icmp_poll.c
@@ -72,7 +72,7 @@ void icmp_poll(FAR struct net_driver_s *dev, FAR struct icmp_conn_s *conn)
 
   /* Perform the application callback */
 
-  devif_conn_event(dev, conn, ICMP_POLL, conn->sconn.list);
+  devif_conn_event(dev, ICMP_POLL, conn->sconn.list);
 }
 
 #endif /* CONFIG_NET && CONFIG_NET_ICMP && CONFIG_NET_ICMP_SOCKET */
diff --git a/net/icmp/icmp_recvmsg.c b/net/icmp/icmp_recvmsg.c
index e8dca25a6c..47a7cd5071 100644
--- a/net/icmp/icmp_recvmsg.c
+++ b/net/icmp/icmp_recvmsg.c
@@ -80,7 +80,6 @@ struct icmp_recvfrom_s
  * Input Parameters:
  *   dev        The structure of the network driver that generated the
  *              event.
- *   conn       The received packet, cast to (void *)
  *   pvpriv     An instance of struct icmp_recvfrom_s cast to void*
  *   flags      Set of events describing why the callback was invoked
  *
@@ -93,10 +92,9 @@ struct icmp_recvfrom_s
  ****************************************************************************/
 
 static uint16_t recvfrom_eventhandler(FAR struct net_driver_s *dev,
-                                  FAR void *pvconn,
-                                  FAR void *pvpriv, uint16_t flags)
+                                      FAR void *pvpriv, uint16_t flags)
 {
-  FAR struct icmp_recvfrom_s *pstate = (struct icmp_recvfrom_s *)pvpriv;
+  FAR struct icmp_recvfrom_s *pstate = pvpriv;
   FAR struct socket *psock;
   FAR struct icmp_conn_s *conn;
   FAR struct ipv4_hdr_s *ipv4;
diff --git a/net/icmp/icmp_sendmsg.c b/net/icmp/icmp_sendmsg.c
index 118a638b0f..16335494bb 100644
--- a/net/icmp/icmp_sendmsg.c
+++ b/net/icmp/icmp_sendmsg.c
@@ -178,7 +178,6 @@ static void sendto_request(FAR struct net_driver_s *dev,
  * Input Parameters:
  *   dev        The structure of the network driver that generated the
  *              event.
- *   conn       The received packet, cast to (void *)
  *   pvpriv     An instance of struct icmp_sendto_s cast to (void *)
  *   flags      Set of events describing why the callback was invoked
  *
@@ -191,10 +190,9 @@ static void sendto_request(FAR struct net_driver_s *dev,
  ****************************************************************************/
 
 static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev,
-                                  FAR void *conn,
-                                  FAR void *pvpriv, uint16_t flags)
+                                    FAR void *pvpriv, uint16_t flags)
 {
-  FAR struct icmp_sendto_s *pstate = (struct icmp_sendto_s *)pvpriv;
+  FAR struct icmp_sendto_s *pstate = pvpriv;
 
   ninfo("flags: %04x\n", flags);
 
diff --git a/net/icmpv6/icmpv6_autoconfig.c b/net/icmpv6/icmpv6_autoconfig.c
index 14b277ed4c..9a4f95b7cf 100644
--- a/net/icmpv6/icmpv6_autoconfig.c
+++ b/net/icmpv6/icmpv6_autoconfig.c
@@ -90,7 +90,6 @@ static void icmpv6_router_terminate(FAR struct icmpv6_router_s *state,
  ****************************************************************************/
 
 static uint16_t icmpv6_router_eventhandler(FAR struct net_driver_s *dev,
-                                           FAR void *pvconn,
                                            FAR void *priv, uint16_t flags)
 {
   FAR struct icmpv6_router_s *state = (FAR struct icmpv6_router_s *)priv;
diff --git a/net/icmpv6/icmpv6_input.c b/net/icmpv6/icmpv6_input.c
index 62ef36068b..71a5555ca9 100644
--- a/net/icmpv6/icmpv6_input.c
+++ b/net/icmpv6/icmpv6_input.c
@@ -479,7 +479,7 @@ void icmpv6_input(FAR struct net_driver_s *dev, unsigned int iplen)
 
         /* Dispatch the ECHO reply to the waiting thread */
 
-        flags = devif_conn_event(dev, conn, flags, conn->sconn.list);
+        flags = devif_conn_event(dev, flags, conn->sconn.list);
 
         /* Was the ECHO reply consumed by any waiting thread? */
 
diff --git a/net/icmpv6/icmpv6_neighbor.c b/net/icmpv6/icmpv6_neighbor.c
index 65c668efec..8b960d5d9b 100644
--- a/net/icmpv6/icmpv6_neighbor.c
+++ b/net/icmpv6/icmpv6_neighbor.c
@@ -73,7 +73,6 @@ struct icmpv6_neighbor_s
  ****************************************************************************/
 
 static uint16_t icmpv6_neighbor_eventhandler(FAR struct net_driver_s *dev,
-                                             FAR void *pvconn,
                                              FAR void *priv, uint16_t flags)
 {
   FAR struct icmpv6_neighbor_s *state = (FAR struct icmpv6_neighbor_s *)priv;
diff --git a/net/icmpv6/icmpv6_netpoll.c b/net/icmpv6/icmpv6_netpoll.c
index aca4c8c92e..b4cf027e29 100644
--- a/net/icmpv6/icmpv6_netpoll.c
+++ b/net/icmpv6/icmpv6_netpoll.c
@@ -49,7 +49,7 @@
  *
  * Input Parameters:
  *   dev      The structure of the network driver that caused the event
- *   conn     The connection structure associated with the socket
+ *   pvpriv   An instance of struct icmpv6_poll_s cast to void*
  *   flags    Set of events describing why the callback was invoked
  *
  * Returned Value:
@@ -61,10 +61,9 @@
  ****************************************************************************/
 
 static uint16_t icmpv6_poll_eventhandler(FAR struct net_driver_s *dev,
-                                         FAR void *pvconn,
                                          FAR void *pvpriv, uint16_t flags)
 {
-  FAR struct icmpv6_poll_s *info = (FAR struct icmpv6_poll_s *)pvpriv;
+  FAR struct icmpv6_poll_s *info = pvpriv;
   FAR struct icmpv6_conn_s *conn;
   FAR struct socket *psock;
   pollevent_t eventset;
diff --git a/net/icmpv6/icmpv6_poll.c b/net/icmpv6/icmpv6_poll.c
index e7f5a07296..1d2c5aa54f 100644
--- a/net/icmpv6/icmpv6_poll.c
+++ b/net/icmpv6/icmpv6_poll.c
@@ -73,7 +73,7 @@ void icmpv6_poll(FAR struct net_driver_s *dev,
 
   /* Perform the application callback */
 
-  devif_conn_event(dev, conn, ICMPv6_POLL,
+  devif_conn_event(dev, ICMPv6_POLL,
                    conn ? conn->sconn.list : dev->d_conncb);
 }
 
diff --git a/net/icmpv6/icmpv6_recvmsg.c b/net/icmpv6/icmpv6_recvmsg.c
index 5f7098e3a8..3c3ee24e9f 100644
--- a/net/icmpv6/icmpv6_recvmsg.c
+++ b/net/icmpv6/icmpv6_recvmsg.c
@@ -83,7 +83,6 @@ struct icmpv6_recvfrom_s
  * Input Parameters:
  *   dev        The structure of the network driver that generated the
  *              event
- *   conn       The received packet, cast to (void *)
  *   pvpriv     An instance of struct icmpv6_recvfrom_s cast to void*
  *   flags      Set of events describing why the callback was invoked
  *
@@ -96,10 +95,9 @@ struct icmpv6_recvfrom_s
  ****************************************************************************/
 
 static uint16_t recvfrom_eventhandler(FAR struct net_driver_s *dev,
-                                  FAR void *pvconn,
-                                  FAR void *pvpriv, uint16_t flags)
+                                      FAR void *pvpriv, uint16_t flags)
 {
-  FAR struct icmpv6_recvfrom_s *pstate = (struct icmpv6_recvfrom_s *)pvpriv;
+  FAR struct icmpv6_recvfrom_s *pstate = pvpriv;
   FAR struct socket *psock;
   FAR struct icmpv6_conn_s *conn;
   FAR struct ipv6_hdr_s *ipv6;
diff --git a/net/icmpv6/icmpv6_sendmsg.c b/net/icmpv6/icmpv6_sendmsg.c
index 6234855d2b..2ee12aeaaa 100644
--- a/net/icmpv6/icmpv6_sendmsg.c
+++ b/net/icmpv6/icmpv6_sendmsg.c
@@ -168,7 +168,6 @@ static void sendto_request(FAR struct net_driver_s *dev,
  * Input Parameters:
  *   dev        The structure of the network driver that generated the
  *              event
- *   pvconn     The received packet, cast to (void *)
  *   pvpriv     An instance of struct icmpv6_sendto_s cast to (void *)
  *   flags      Set of events describing why the callback was invoked
  *
@@ -181,10 +180,9 @@ static void sendto_request(FAR struct net_driver_s *dev,
  ****************************************************************************/
 
 static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev,
-                                    FAR void *pvconn,
                                     FAR void *pvpriv, uint16_t flags)
 {
-  FAR struct icmpv6_sendto_s *pstate = (struct icmpv6_sendto_s *)pvpriv;
+  FAR struct icmpv6_sendto_s *pstate = pvpriv;
 
   ninfo("flags: %04x\n", flags);
 
diff --git a/net/ieee802154/ieee802154_callback.c b/net/ieee802154/ieee802154_callback.c
index dbb71274ac..4b552560e8 100644
--- a/net/ieee802154/ieee802154_callback.c
+++ b/net/ieee802154/ieee802154_callback.c
@@ -66,8 +66,7 @@ uint16_t ieee802154_callback(FAR struct radio_driver_s *radio,
     {
       /* Perform the callback */
 
-      flags = devif_conn_event(&radio->r_dev, conn, flags,
-                               conn->sconn.list);
+      flags = devif_conn_event(&radio->r_dev, flags, conn->sconn.list);
     }
 
   return flags;
diff --git a/net/ieee802154/ieee802154_recvmsg.c b/net/ieee802154/ieee802154_recvmsg.c
index e629c2d7d2..7d37f7142c 100644
--- a/net/ieee802154/ieee802154_recvmsg.c
+++ b/net/ieee802154/ieee802154_recvmsg.c
@@ -206,8 +206,7 @@ static ssize_t
 
 static uint16_t
   ieee802154_recvfrom_eventhandler(FAR struct net_driver_s *dev,
-                                   FAR void *pvconn, FAR void *pvpriv,
-                                   uint16_t flags)
+                                   FAR void *pvpriv, uint16_t flags)
 {
   FAR struct ieee802154_recvfrom_s *pstate;
   FAR struct radio_driver_s *radio;
@@ -215,7 +214,7 @@ static uint16_t
 
   ninfo("flags: %04x\n", flags);
 
-  DEBUGASSERT(pvpriv != NULL && dev != NULL && pvconn != NULL);
+  DEBUGASSERT(pvpriv != NULL && dev != NULL);
 
   /* Ignore polls from non IEEE 802.15.4 network drivers */
 
@@ -228,7 +227,7 @@ static uint16_t
 
 #warning Missing logic
 
-  pstate = (FAR struct ieee802154_recvfrom_s *)pvpriv;
+  pstate = pvpriv;
   radio  = (FAR struct radio_driver_s *)dev;
 
   /* 'pstate' might be null in some race conditions (?) */
diff --git a/net/ieee802154/ieee802154_sendmsg.c b/net/ieee802154/ieee802154_sendmsg.c
index bfb6383f53..c742c5ccd7 100644
--- a/net/ieee802154/ieee802154_sendmsg.c
+++ b/net/ieee802154/ieee802154_sendmsg.c
@@ -271,7 +271,6 @@ static void ieee802154_meta_data(FAR struct radio_driver_s *radio,
  ****************************************************************************/
 
 static uint16_t ieee802154_sendto_eventhandler(FAR struct net_driver_s *dev,
-                                               FAR void *pvconn,
                                                FAR void *pvpriv,
                                                uint16_t flags)
 {
@@ -295,7 +294,7 @@ static uint16_t ieee802154_sendto_eventhandler(FAR struct net_driver_s *dev,
 
 #warning Missing logic
 
-  pstate = (FAR struct ieee802154_sendto_s *)pvpriv;
+  pstate = pvpriv;
   radio  = (FAR struct radio_driver_s *)dev;
 
   ninfo("flags: %04x sent: %zd\n", flags, pstate->is_sent);
diff --git a/net/ipforward/ipfwd_forward.c b/net/ipforward/ipfwd_forward.c
index d83e63ea50..aeaad6d532 100644
--- a/net/ipforward/ipfwd_forward.c
+++ b/net/ipforward/ipfwd_forward.c
@@ -107,7 +107,6 @@ static inline void forward_ipselect(FAR struct forward_s *fwd)
  * Input Parameters:
  *   dev        The structure of the network driver that generated the
  *              event
- *   conn       An instance of the forwarding structure cast to (void *)
  *   pvpriv     An instance of struct forward_s cast to (void *)
  *   flags      Set of events describing why the callback was invoked
  *
@@ -120,10 +119,9 @@ static inline void forward_ipselect(FAR struct forward_s *fwd)
  ****************************************************************************/
 
 static uint16_t ipfwd_eventhandler(FAR struct net_driver_s *dev,
-                                   FAR void *conn,
                                    FAR void *pvpriv, uint16_t flags)
 {
-  FAR struct forward_s *fwd = (FAR struct forward_s *)pvpriv;
+  FAR struct forward_s *fwd = pvpriv;
 
   ninfo("flags: %04x\n", flags);
   DEBUGASSERT(fwd != NULL && fwd->f_iob != NULL && fwd->f_dev != NULL);
diff --git a/net/ipforward/ipfwd_poll.c b/net/ipforward/ipfwd_poll.c
index b3b909a40b..dadbcf686f 100644
--- a/net/ipforward/ipfwd_poll.c
+++ b/net/ipforward/ipfwd_poll.c
@@ -171,7 +171,7 @@ void ipfwd_poll(FAR struct net_driver_s *dev)
    * the packet was forwarded, then the new set will be zero.
    */
 
-  flags = devif_conn_event(dev, NULL, IPFWD_POLL, dev->d_conncb);
+  flags = devif_conn_event(dev, IPFWD_POLL, dev->d_conncb);
 
 #ifdef CONFIG_NET_6LOWPAN
   if ((flags & DEVPOLL_MASK) == 0)
diff --git a/net/netdev/netdev_carrier.c b/net/netdev/netdev_carrier.c
index 630bb76b0a..769ce3fd41 100644
--- a/net/netdev/netdev_carrier.c
+++ b/net/netdev/netdev_carrier.c
@@ -94,7 +94,7 @@ int netdev_carrier_off(FAR struct net_driver_s *dev)
 
       /* Notify clients that the network has been taken down */
 
-      devif_dev_event(dev, NULL, NETDEV_DOWN);
+      devif_dev_event(dev, NETDEV_DOWN);
       arp_cleanup(dev);
 
       return OK;
diff --git a/net/netdev/netdev_ioctl.c b/net/netdev/netdev_ioctl.c
index b33871f09c..5eff1867b4 100644
--- a/net/netdev/netdev_ioctl.c
+++ b/net/netdev/netdev_ioctl.c
@@ -1943,7 +1943,7 @@ int netdev_ifdown(FAR struct net_driver_s *dev)
 
               /* Notify clients that the network has been taken down */
 
-              devif_dev_event(dev, NULL, NETDEV_DOWN);
+              devif_dev_event(dev, NETDEV_DOWN);
 
 #ifdef CONFIG_NETDOWN_NOTIFIER
               /* Provide signal notifications to threads that want to be
diff --git a/net/pkt/pkt_callback.c b/net/pkt/pkt_callback.c
index bc4e0fb8cb..fe3a9ec3b8 100644
--- a/net/pkt/pkt_callback.c
+++ b/net/pkt/pkt_callback.c
@@ -63,7 +63,7 @@ uint16_t pkt_callback(FAR struct net_driver_s *dev,
     {
       /* Perform the callback */
 
-      flags = devif_conn_event(dev, conn, flags, conn->sconn.list);
+      flags = devif_conn_event(dev, flags, conn->sconn.list);
     }
 
   return flags;
diff --git a/net/pkt/pkt_recvmsg.c b/net/pkt/pkt_recvmsg.c
index 85c2344ff6..e2a774da05 100644
--- a/net/pkt/pkt_recvmsg.c
+++ b/net/pkt/pkt_recvmsg.c
@@ -168,10 +168,9 @@ static inline void pkt_recvfrom_sender(FAR struct net_driver_s *dev,
  ****************************************************************************/
 
 static uint16_t pkt_recvfrom_eventhandler(FAR struct net_driver_s *dev,
-                                          FAR void *pvconn,
                                           FAR void *pvpriv, uint16_t flags)
 {
-  struct pkt_recvfrom_s *pstate = (struct pkt_recvfrom_s *)pvpriv;
+  struct pkt_recvfrom_s *pstate = pvpriv;
 
   ninfo("flags: %04x\n", flags);
 
diff --git a/net/pkt/pkt_sendmsg.c b/net/pkt/pkt_sendmsg.c
index 9a84559659..864c8dd09b 100644
--- a/net/pkt/pkt_sendmsg.c
+++ b/net/pkt/pkt_sendmsg.c
@@ -73,10 +73,9 @@ struct send_s
  ****************************************************************************/
 
 static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev,
-                                        FAR void *pvconn,
                                         FAR void *pvpriv, uint16_t flags)
 {
-  FAR struct send_s *pstate = (FAR struct send_s *)pvpriv;
+  FAR struct send_s *pstate = pvpriv;
 
   ninfo("flags: %04x sent: %zd\n", flags, pstate->snd_sent);
 
diff --git a/net/sixlowpan/sixlowpan_send.c b/net/sixlowpan/sixlowpan_send.c
index e76b9fd620..d9b1830977 100644
--- a/net/sixlowpan/sixlowpan_send.c
+++ b/net/sixlowpan/sixlowpan_send.c
@@ -85,9 +85,9 @@ struct sixlowpan_send_s
  *   send operation when polled by the lower, device interfacing layer.
  *
  * Input Parameters:
- *   dev   - The structure of the network driver that generated the event.
- *   conn  - The connection structure associated with the socket
- *   flags - Set of events describing why the callback was invoked
+ *   dev    - The structure of the network driver that generated the event.
+ *   pvpriv - An instance of struct sixlowpan_send_s cast to void*
+ *   flags  - Set of events describing why the callback was invoked
  *
  * Returned Value:
  *   None
@@ -98,10 +98,9 @@ struct sixlowpan_send_s
  ****************************************************************************/
 
 static uint16_t send_eventhandler(FAR struct net_driver_s *dev,
-                                  FAR void *pvconn,
                                   FAR void *pvpriv, uint16_t flags)
 {
-  FAR struct sixlowpan_send_s *sinfo = (FAR struct sixlowpan_send_s *)pvpriv;
+  FAR struct sixlowpan_send_s *sinfo = pvpriv;
 
   ninfo("flags: %04x\n", flags);
 
diff --git a/net/sixlowpan/sixlowpan_tcpsend.c b/net/sixlowpan/sixlowpan_tcpsend.c
index 0a8acd08f3..68d90d305f 100644
--- a/net/sixlowpan/sixlowpan_tcpsend.c
+++ b/net/sixlowpan/sixlowpan_tcpsend.c
@@ -288,7 +288,6 @@ static int sixlowpan_tcp_header(FAR struct tcp_conn_s *conn,
  *
  * Input Parameters:
  *   dev    - The structure of the network driver that generated the event.
- *   pvconn - The connection structure associated with the socket
  *   pvpriv - The event handler's private data argument
  *   flags  - Set of events describing why the callback was invoked
  *
@@ -301,10 +300,9 @@ static int sixlowpan_tcp_header(FAR struct tcp_conn_s *conn,
  ****************************************************************************/
 
 static uint16_t tcp_send_eventhandler(FAR struct net_driver_s *dev,
-                                      FAR void *pvconn,
                                       FAR void *pvpriv, uint16_t flags)
 {
-  FAR struct sixlowpan_send_s *sinfo = (FAR struct sixlowpan_send_s *)pvpriv;
+  FAR struct sixlowpan_send_s *sinfo = pvpriv;
   FAR struct tcp_conn_s *conn = sinfo->s_conn;
   struct ipv6tcp_hdr_s ipv6tcp;
   int ret;
diff --git a/net/tcp/tcp.h b/net/tcp/tcp.h
index 57daa59536..d41bf843cd 100644
--- a/net/tcp/tcp.h
+++ b/net/tcp/tcp.h
@@ -1722,7 +1722,6 @@ int tcp_wrbuffer_test(void);
 
 #ifdef CONFIG_DEBUG_FEATURES
 void tcp_event_handler_dump(FAR struct net_driver_s *dev,
-                            FAR void *pvconn,
                             FAR void *pvpriv,
                             uint16_t flags,
                             FAR struct tcp_conn_s *conn);
diff --git a/net/tcp/tcp_callback.c b/net/tcp/tcp_callback.c
index b5e054de91..4855c821c0 100644
--- a/net/tcp/tcp_callback.c
+++ b/net/tcp/tcp_callback.c
@@ -166,7 +166,7 @@ uint16_t tcp_callback(FAR struct net_driver_s *dev,
    *                 not set, then dev->d_len should also be cleared).
    */
 
-  flags = devif_conn_event(dev, conn, flags, conn->sconn.list);
+  flags = devif_conn_event(dev, flags, conn->sconn.list);
 
   /* There may be no new data handler in place at them moment that the new
    * incoming data is received.  If the new incoming data was not handled,
@@ -190,7 +190,7 @@ uint16_t tcp_callback(FAR struct net_driver_s *dev,
     {
       /* Perform the callback disconnect callbacks */
 
-      flags = devif_conn_event(dev, conn, flags, conn->connevents);
+      flags = devif_conn_event(dev, flags, conn->connevents);
     }
 
 #ifdef CONFIG_NET_TCP_NOTIFIER
diff --git a/net/tcp/tcp_close.c b/net/tcp/tcp_close.c
index d99096580b..4a98c9833e 100644
--- a/net/tcp/tcp_close.c
+++ b/net/tcp/tcp_close.c
@@ -66,8 +66,7 @@ static void tcp_close_work(FAR void *param)
  ****************************************************************************/
 
 static uint16_t tcp_close_eventhandler(FAR struct net_driver_s *dev,
-                                       FAR void *pvconn, FAR void *pvpriv,
-                                       uint16_t flags)
+                                       FAR void *pvpriv, uint16_t flags)
 {
   FAR struct tcp_conn_s *conn = pvpriv;
 
diff --git a/net/tcp/tcp_connect.c b/net/tcp/tcp_connect.c
index ce4143e136..4728adc678 100644
--- a/net/tcp/tcp_connect.c
+++ b/net/tcp/tcp_connect.c
@@ -68,7 +68,6 @@ static inline int psock_setup_callbacks(FAR struct socket *psock,
 static void psock_teardown_callbacks(FAR struct tcp_connect_s *pstate,
                                      int status);
 static uint16_t psock_connect_eventhandler(FAR struct net_driver_s *dev,
-                                           FAR void *pvconn,
                                            FAR void *pvpriv, uint16_t flags);
 
 /****************************************************************************
@@ -149,7 +148,7 @@ static void psock_teardown_callbacks(FAR struct tcp_connect_s *pstate,
  *
  * Input Parameters:
  *   dev      The structure of the network driver that reported the event
- *   pvconn   The connection structure associated with the socket
+ *   pvpriv   An instance of struct tcp_connect_s cast to void*
  *   flags    Set of events describing why the callback was invoked
  *
  * Returned Value:
@@ -161,10 +160,9 @@ static void psock_teardown_callbacks(FAR struct tcp_connect_s *pstate,
  ****************************************************************************/
 
 static uint16_t psock_connect_eventhandler(FAR struct net_driver_s *dev,
-                                           FAR void *pvconn,
                                            FAR void *pvpriv, uint16_t flags)
 {
-  struct tcp_connect_s *pstate = (struct tcp_connect_s *)pvpriv;
+  struct tcp_connect_s *pstate = pvpriv;
   FAR struct tcp_conn_s *conn = pstate->tc_conn;
 
   ninfo("flags: %04x\n", flags);
diff --git a/net/tcp/tcp_dump.c b/net/tcp/tcp_dump.c
index a2ed37dd20..b8601a1f0e 100644
--- a/net/tcp/tcp_dump.c
+++ b/net/tcp/tcp_dump.c
@@ -47,31 +47,30 @@
  ****************************************************************************/
 
 void tcp_event_handler_dump(FAR struct net_driver_s *dev,
-                            FAR void *pvconn,
                             FAR void *pvpriv,
                             uint16_t flags,
                             FAR struct tcp_conn_s *conn)
 {
 #ifdef CONFIG_NET_TCP_WRITE_BUFFERS
-  nerr("ERROR: conn->dev == NULL or pvconn != conn:"
-       " dev=%p pvconn=%p pvpriv=%p flags=0x%04x"
+  nerr("ERROR: conn->dev == NULL:"
+       " dev=%p pvpriv=%p flags=0x%04x"
        " conn->dev=%p conn->flags=0x%04x tcpstateflags=0x%02x crefs=%d"
        " isn=%" PRIu32 " sndseq=%" PRIu32
        " tx_unacked=%" PRId32 " sent=%" PRId32
        " conn=%p s_flags=0x%02x\n",
-       dev, pvconn, pvpriv, flags,
+       dev, pvpriv, flags,
        conn->dev, conn->flags, conn->tcpstateflags, conn->crefs,
        conn->isn, tcp_getsequence(conn->sndseq),
        (uint32_t)conn->tx_unacked, conn->sent,
        conn, conn->sconn.s_flags);
 #else
-  nerr("ERROR: conn->dev == NULL or pvconn != conn:"
-       " dev=%p pvconn=%p pvpriv=%p flags=0x%04x"
+  nerr("ERROR: conn->dev == NULL:"
+       " dev=%p pvpriv=%p flags=0x%04x"
        " conn->dev=%p conn->flags=0x%04x tcpstateflags=0x%02x crefs=%d"
        " sndseq=%" PRIu32
        " tx_unacked=%" PRId32
        " conn=%p s_flags=0x%02x\n",
-       dev, pvconn, pvpriv, flags,
+       dev, pvpriv, flags,
        conn->dev, conn->flags, conn->tcpstateflags, conn->crefs,
        tcp_getsequence(conn->sndseq),
        (uint32_t)conn->tx_unacked,
diff --git a/net/tcp/tcp_monitor.c b/net/tcp/tcp_monitor.c
index 2f0de4ce31..3df9a061e9 100644
--- a/net/tcp/tcp_monitor.c
+++ b/net/tcp/tcp_monitor.c
@@ -43,8 +43,7 @@
 static void tcp_close_connection(FAR struct tcp_conn_s *conn,
                                  uint16_t flags);
 static uint16_t tcp_monitor_event(FAR struct net_driver_s *dev,
-                                  FAR void *pvconn, FAR void *pvpriv,
-                                  uint16_t flags);
+                                  FAR void *pvpriv, uint16_t flags);
 
 /****************************************************************************
  * Private Functions
@@ -114,7 +113,7 @@ static void tcp_close_connection(FAR struct tcp_conn_s *conn, uint16_t flags)
  *
  * Input Parameters:
  *   dev      The device which as active when the event was detected.
- *   conn     The connection structure associated with the socket
+ *   pvpriv   An instance of struct tcp_conn_s cast to void*
  *   flags    Set of events describing why the callback was invoked
  *
  * Returned Value:
@@ -126,8 +125,7 @@ static void tcp_close_connection(FAR struct tcp_conn_s *conn, uint16_t flags)
  ****************************************************************************/
 
 static uint16_t tcp_monitor_event(FAR struct net_driver_s *dev,
-                                  FAR void *pvconn, FAR void *pvpriv,
-                                  uint16_t flags)
+                                  FAR void *pvpriv, uint16_t flags)
 {
   FAR struct tcp_conn_s *conn = pvpriv;
 
diff --git a/net/tcp/tcp_netpoll.c b/net/tcp/tcp_netpoll.c
index e9b6f7c2c6..6f35b11188 100644
--- a/net/tcp/tcp_netpoll.c
+++ b/net/tcp/tcp_netpoll.c
@@ -52,7 +52,7 @@
  *
  * Input Parameters:
  *   dev      The structure of the network driver that caused the event
- *   conn     The connection structure associated with the socket
+ *   pvpriv   An instance of struct tcp_poll_s cast to void*
  *   flags    Set of events describing why the callback was invoked
  *
  * Returned Value:
@@ -64,10 +64,9 @@
  ****************************************************************************/
 
 static uint16_t tcp_poll_eventhandler(FAR struct net_driver_s *dev,
-                                      FAR void *conn,
                                       FAR void *pvpriv, uint16_t flags)
 {
-  FAR struct tcp_poll_s *info = (FAR struct tcp_poll_s *)pvpriv;
+  FAR struct tcp_poll_s *info = pvpriv;
   int reason;
 
   ninfo("flags: %04x\n", flags);
diff --git a/net/tcp/tcp_recvfrom.c b/net/tcp/tcp_recvfrom.c
index cfd72e1385..24a2b5b081 100644
--- a/net/tcp/tcp_recvfrom.c
+++ b/net/tcp/tcp_recvfrom.c
@@ -363,7 +363,7 @@ static inline void tcp_sender(FAR struct net_driver_s *dev,
  *
  * Input Parameters:
  *   dev      The structure of the network driver that generated the event.
- *   pvconn   The connection structure associated with the socket
+ *   pvpriv   An instance of struct tcp_recvfrom_s cast to void*
  *   flags    Set of events describing why the callback was invoked
  *
  * Returned Value:
@@ -375,24 +375,9 @@ static inline void tcp_sender(FAR struct net_driver_s *dev,
  ****************************************************************************/
 
 static uint16_t tcp_recvhandler(FAR struct net_driver_s *dev,
-                                FAR void *pvconn, FAR void *pvpriv,
-                                uint16_t flags)
+                                FAR void *pvpriv, uint16_t flags)
 {
-  FAR struct tcp_recvfrom_s *pstate = (struct tcp_recvfrom_s *)pvpriv;
-
-#if 0 /* REVISIT: The assertion fires.  Why? */
-  FAR struct tcp_conn_s *conn = (FAR struct tcp_conn_s *)pvconn;
-
-  /* The TCP socket is connected and, hence, should be bound to a device.
-   * Make sure that the polling device is the own that we are bound to.
-   */
-
-  DEBUGASSERT(conn->dev == NULL || conn->dev == dev);
-  if (conn->dev != NULL && conn->dev != dev)
-    {
-      return flags;
-    }
-#endif
+  FAR struct tcp_recvfrom_s *pstate = pvpriv;
 
   ninfo("flags: %04x\n", flags);
 
diff --git a/net/tcp/tcp_send_buffered.c b/net/tcp/tcp_send_buffered.c
index 1a5b22095d..7086a6fab7 100644
--- a/net/tcp/tcp_send_buffered.c
+++ b/net/tcp/tcp_send_buffered.c
@@ -299,7 +299,7 @@ static inline void send_ipselect(FAR struct net_driver_s *dev,
  *
  * Input Parameters:
  *   dev      The structure of the network driver that caused the event
- *   conn     The connection structure associated with the socket
+ *   pvpriv   An instance of struct tcp_conn_s cast to void*
  *   flags    Set of events describing why the callback was invoked
  *
  * Returned Value:
@@ -311,17 +311,8 @@ static inline void send_ipselect(FAR struct net_driver_s *dev,
  ****************************************************************************/
 
 static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev,
-                                        FAR void *pvconn, FAR void *pvpriv,
-                                        uint16_t flags)
+                                        FAR void *pvpriv, uint16_t flags)
 {
-  /* FAR struct tcp_conn_s *conn = (FAR struct tcp_conn_s *)pvconn;
-   *
-   * Do not use pvconn argument to get the TCP connection pointer (the above
-   * commented line) because pvconn is normally NULL for some events like
-   * NETDEV_DOWN. Instead, the TCP connection pointer can be reliably
-   * obtained from the corresponding TCP socket.
-   */
-
   FAR struct tcp_conn_s *conn = pvpriv;
 #ifdef CONFIG_NET_TCP_FAST_RETRANSMIT
   uint32_t rexmitno = 0;
@@ -333,19 +324,6 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev,
 
   DEBUGASSERT(conn != NULL);
 
-#ifdef CONFIG_DEBUG_FEATURES
-  if (conn->dev == NULL || (pvconn != conn && pvconn != NULL))
-    {
-      tcp_event_handler_dump(dev, pvconn, pvpriv, flags, conn);
-    }
-#endif
-
-  /* If pvconn is not NULL, make sure that pvconn refers to the same
-   * connection as the socket is bound to.
-   */
-
-  DEBUGASSERT(pvconn == conn || pvconn == NULL);
-
   /* The TCP socket is connected and, hence, should be bound to a device.
    * Make sure that the polling device is the one that we are bound to.
    */
diff --git a/net/tcp/tcp_send_unbuffered.c b/net/tcp/tcp_send_unbuffered.c
index 2b28081d43..feacc097d8 100644
--- a/net/tcp/tcp_send_unbuffered.c
+++ b/net/tcp/tcp_send_unbuffered.c
@@ -157,7 +157,7 @@ static inline void tcpsend_ipselect(FAR struct net_driver_s *dev,
  *
  * Input Parameters:
  *   dev      The structure of the network driver that caused the event
- *   conn     The connection structure associated with the socket
+ *   pvpriv   An instance of struct send_s cast to void*
  *   flags    Set of events describing why the callback was invoked
  *
  * Returned Value:
@@ -169,18 +169,9 @@ static inline void tcpsend_ipselect(FAR struct net_driver_s *dev,
  ****************************************************************************/
 
 static uint16_t tcpsend_eventhandler(FAR struct net_driver_s *dev,
-                                     FAR void *pvconn,
                                      FAR void *pvpriv, uint16_t flags)
 {
-  /* FAR struct tcp_conn_s *conn = (FAR struct tcp_conn_s *)pvconn;
-   *
-   * Do not use pvconn argument to get the TCP connection pointer (the above
-   * commented line) because pvconn is normally NULL for some events like
-   * NETDEV_DOWN. Instead, the TCP connection pointer can be reliably
-   * obtained from the corresponding TCP socket.
-   */
-
-  FAR struct send_s *pstate = (FAR struct send_s *)pvpriv;
+  FAR struct send_s *pstate = pvpriv;
   FAR struct socket *psock;
   FAR struct tcp_conn_s *conn;
 
@@ -196,19 +187,6 @@ static uint16_t tcpsend_eventhandler(FAR struct net_driver_s *dev,
   conn = psock->s_conn;
   DEBUGASSERT(conn != NULL);
 
-#ifdef CONFIG_DEBUG_NET_ERROR
-  if (conn->dev == NULL || (pvconn != conn && pvconn != NULL))
-    {
-      tcp_event_handler_dump(dev, pvconn, pvpriv, flags, conn);
-    }
-#endif
-
-  /* If pvconn is not NULL, make sure that pvconn refers to the same
-   * connection as the socket is bound to.
-   */
-
-  DEBUGASSERT(pvconn == conn || pvconn == NULL);
-
   /* The TCP socket is connected and, hence, should be bound to a device.
    * Make sure that the polling device is the one that we are bound to.
    */
diff --git a/net/tcp/tcp_sendfile.c b/net/tcp/tcp_sendfile.c
index 54ee14af71..8cc32a700d 100644
--- a/net/tcp/tcp_sendfile.c
+++ b/net/tcp/tcp_sendfile.c
@@ -110,7 +110,7 @@ struct sendfile_s
  *
  * Input Parameters:
  *   dev      The structure of the network driver that caused the event
- *   conn     The connection structure associated with the socket
+ *   pvpriv   An instance of struct sendfile_s cast to void*
  *   flags    Set of events describing why the callback was invoked
  *
  * Returned Value:
@@ -122,18 +122,9 @@ struct sendfile_s
  ****************************************************************************/
 
 static uint16_t sendfile_eventhandler(FAR struct net_driver_s *dev,
-                                      FAR void *pvconn, FAR void *pvpriv,
-                                      uint16_t flags)
+                                      FAR void *pvpriv, uint16_t flags)
 {
-  /* FAR struct tcp_conn_s *conn = (FAR struct tcp_conn_s *)pvconn;
-   *
-   * Do not use pvconn argument to get the TCP connection pointer (the above
-   * commented line) because pvconn is normally NULL for some events like
-   * NETDEV_DOWN. Instead, the TCP connection pointer can be reliably
-   * obtained from the corresponding TCP socket.
-   */
-
-  FAR struct sendfile_s *pstate = (FAR struct sendfile_s *)pvpriv;
+  FAR struct sendfile_s *pstate = pvpriv;
   FAR struct socket *psock;
   FAR struct tcp_conn_s *conn;
   int ret;
@@ -150,19 +141,6 @@ static uint16_t sendfile_eventhandler(FAR struct net_driver_s *dev,
   conn = psock->s_conn;
   DEBUGASSERT(conn != NULL);
 
-#ifdef CONFIG_DEBUG_NET_ERROR
-  if (conn->dev == NULL || (pvconn != conn && pvconn != NULL))
-    {
-      tcp_event_handler_dump(dev, pvconn, pvpriv, flags, conn);
-    }
-#endif
-
-  /* If pvconn is not NULL, make sure that pvconn refers to the same
-   * connection as the socket is bound to.
-   */
-
-  DEBUGASSERT(pvconn == conn || pvconn == NULL);
-
   /* The TCP socket is connected and, hence, should be bound to a device.
    * Make sure that the polling device is the own that we are bound to.
    */
diff --git a/net/udp/udp_callback.c b/net/udp/udp_callback.c
index c1723159a9..07210e3eac 100644
--- a/net/udp/udp_callback.c
+++ b/net/udp/udp_callback.c
@@ -316,7 +316,7 @@ uint16_t udp_callback(FAR struct net_driver_s *dev,
     {
       /* Perform the callback */
 
-      flags = devif_conn_event(dev, conn, flags, conn->sconn.list);
+      flags = devif_conn_event(dev, flags, conn->sconn.list);
 
       if ((flags & UDP_NEWDATA) != 0)
         {
diff --git a/net/udp/udp_netpoll.c b/net/udp/udp_netpoll.c
index d1b86396d0..c907f2dd29 100644
--- a/net/udp/udp_netpoll.c
+++ b/net/udp/udp_netpoll.c
@@ -50,7 +50,7 @@
  *
  * Input Parameters:
  *   dev      The structure of the network driver that caused the event
- *   conn     The connection structure associated with the socket
+ *   pvpriv   An instance of struct udp_poll_s cast to void*
  *   flags    Set of events describing why the callback was invoked
  *
  * Returned Value:
@@ -62,10 +62,9 @@
  ****************************************************************************/
 
 static uint16_t udp_poll_eventhandler(FAR struct net_driver_s *dev,
-                                      FAR void *conn,
                                       FAR void *pvpriv, uint16_t flags)
 {
-  FAR struct udp_poll_s *info = (FAR struct udp_poll_s *)pvpriv;
+  FAR struct udp_poll_s *info = pvpriv;
 
   ninfo("flags: %04x\n", flags);
 
diff --git a/net/udp/udp_recvfrom.c b/net/udp/udp_recvfrom.c
index 774ca839db..de56b32c65 100644
--- a/net/udp/udp_recvfrom.c
+++ b/net/udp/udp_recvfrom.c
@@ -411,7 +411,7 @@ static void udp_terminate(FAR struct udp_recvfrom_s *pstate, int result)
  *
  * Input Parameters:
  *   dev      The structure of the network driver that generated the event.
- *   pvconn   The connection structure associated with the socket
+ *   pvpriv   An instance of struct udp_recvfrom_s cast to void*
  *   flags    Set of events describing why the callback was invoked
  *
  * Returned Value:
@@ -423,10 +423,9 @@ static void udp_terminate(FAR struct udp_recvfrom_s *pstate, int result)
  ****************************************************************************/
 
 static uint16_t udp_eventhandler(FAR struct net_driver_s *dev,
-                                 FAR void *pvconn, FAR void *pvpriv,
-                                 uint16_t flags)
+                                 FAR void *pvpriv, uint16_t flags)
 {
-  FAR struct udp_recvfrom_s *pstate = (FAR struct udp_recvfrom_s *)pvpriv;
+  FAR struct udp_recvfrom_s *pstate = pvpriv;
 
   ninfo("flags: %04x\n", flags);
 
diff --git a/net/udp/udp_sendto_buffered.c b/net/udp/udp_sendto_buffered.c
index 1814adfb45..481c99c0b0 100644
--- a/net/udp/udp_sendto_buffered.c
+++ b/net/udp/udp_sendto_buffered.c
@@ -97,8 +97,7 @@ static inline void sendto_ipselect(FAR struct net_driver_s *dev,
 #endif
 static int sendto_next_transfer(FAR struct udp_conn_s *conn);
 static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev,
-                                    FAR void *pvconn, FAR void *pvpriv,
-                                    uint16_t flags);
+                                    FAR void *pvpriv, uint16_t flags);
 
 /****************************************************************************
  * Private Functions
@@ -352,10 +351,9 @@ static int sendto_next_transfer(FAR struct udp_conn_s *conn)
  ****************************************************************************/
 
 static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev,
-                                    FAR void *pvconn, FAR void *pvpriv,
-                                    uint16_t flags)
+                                    FAR void *pvpriv, uint16_t flags)
 {
-  FAR struct udp_conn_s *conn = (FAR struct udp_conn_s *)pvpriv;
+  FAR struct udp_conn_s *conn = pvpriv;
 
   DEBUGASSERT(dev != NULL && conn != NULL);
 
diff --git a/net/udp/udp_sendto_unbuffered.c b/net/udp/udp_sendto_unbuffered.c
index d3fa39067d..3c797eeed8 100644
--- a/net/udp/udp_sendto_unbuffered.c
+++ b/net/udp/udp_sendto_unbuffered.c
@@ -132,7 +132,6 @@ static inline void sendto_ipselect(FAR struct net_driver_s *dev,
  *
  * Input Parameters:
  *   dev        The structure of the network driver that caused the event
- *   conn       An instance of the UDP connection structure cast to void *
  *   pvpriv     An instance of struct sendto_s cast to void*
  *   flags      Set of events describing why the callback was invoked
  *
@@ -145,10 +144,9 @@ static inline void sendto_ipselect(FAR struct net_driver_s *dev,
  ****************************************************************************/
 
 static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev,
-                                    FAR void *conn, FAR void *pvpriv,
-                                    uint16_t flags)
+                                    FAR void *pvpriv, uint16_t flags)
 {
-  FAR struct sendto_s *pstate = (FAR struct sendto_s *)pvpriv;
+  FAR struct sendto_s *pstate = pvpriv;
 
   DEBUGASSERT(pstate != NULL && pstate->st_dev != NULL);
   if (pstate != NULL)
diff --git a/net/usrsock/usrsock_accept.c b/net/usrsock/usrsock_accept.c
index ca6f8ad5f9..f0e80dacf7 100644
--- a/net/usrsock/usrsock_accept.c
+++ b/net/usrsock/usrsock_accept.c
@@ -38,7 +38,7 @@
  * Private Functions
  ****************************************************************************/
 
-static uint16_t accept_event(FAR struct net_driver_s *dev, FAR void *pvconn,
+static uint16_t accept_event(FAR struct net_driver_s *dev,
                              FAR void *pvpriv, uint16_t flags)
 {
   FAR struct usrsock_data_reqstate_s *pstate = pvpriv;
diff --git a/net/usrsock/usrsock_bind.c b/net/usrsock/usrsock_bind.c
index 2b8905e562..da879ddb5d 100644
--- a/net/usrsock/usrsock_bind.c
+++ b/net/usrsock/usrsock_bind.c
@@ -43,7 +43,7 @@
  * Private Functions
  ****************************************************************************/
 
-static uint16_t bind_event(FAR struct net_driver_s *dev, FAR void *pvconn,
+static uint16_t bind_event(FAR struct net_driver_s *dev,
                            FAR void *pvpriv, uint16_t flags)
 {
   FAR struct usrsock_reqstate_s *pstate = pvpriv;
diff --git a/net/usrsock/usrsock_close.c b/net/usrsock/usrsock_close.c
index f3148fb152..11410dcf2f 100644
--- a/net/usrsock/usrsock_close.c
+++ b/net/usrsock/usrsock_close.c
@@ -43,7 +43,7 @@
  * Private Functions
  ****************************************************************************/
 
-static uint16_t close_event(FAR struct net_driver_s *dev, FAR void *pvconn,
+static uint16_t close_event(FAR struct net_driver_s *dev,
                             FAR void *pvpriv, uint16_t flags)
 {
   FAR struct usrsock_reqstate_s *pstate = pvpriv;
diff --git a/net/usrsock/usrsock_connect.c b/net/usrsock/usrsock_connect.c
index 46614aa1d3..afa6d55c08 100644
--- a/net/usrsock/usrsock_connect.c
+++ b/net/usrsock/usrsock_connect.c
@@ -43,7 +43,7 @@
  * Private Functions
  ****************************************************************************/
 
-static uint16_t connect_event(FAR struct net_driver_s *dev, FAR void *pvconn,
+static uint16_t connect_event(FAR struct net_driver_s *dev,
                               FAR void *pvpriv, uint16_t flags)
 {
   FAR struct usrsock_reqstate_s *pstate = pvpriv;
diff --git a/net/usrsock/usrsock_event.c b/net/usrsock/usrsock_event.c
index b7475a3f6d..32248464dc 100644
--- a/net/usrsock/usrsock_event.c
+++ b/net/usrsock/usrsock_event.c
@@ -110,7 +110,7 @@ int usrsock_event(FAR struct usrsock_conn_s *conn, uint16_t events)
 
   /* Send events to callbacks */
 
-  devif_conn_event(NULL, conn, events, conn->sconn.list);
+  devif_conn_event(NULL, events, conn->sconn.list);
   net_unlock();
 
   return OK;
diff --git a/net/usrsock/usrsock_getpeername.c b/net/usrsock/usrsock_getpeername.c
index 268ad38a43..84cd6a032e 100644
--- a/net/usrsock/usrsock_getpeername.c
+++ b/net/usrsock/usrsock_getpeername.c
@@ -44,7 +44,6 @@
  ****************************************************************************/
 
 static uint16_t getpeername_event(FAR struct net_driver_s *dev,
-                                  FAR void *pvconn,
                                   FAR void *pvpriv, uint16_t flags)
 {
   FAR struct usrsock_data_reqstate_s *pstate = pvpriv;
diff --git a/net/usrsock/usrsock_getsockname.c b/net/usrsock/usrsock_getsockname.c
index acabebe18f..9f1df492e0 100644
--- a/net/usrsock/usrsock_getsockname.c
+++ b/net/usrsock/usrsock_getsockname.c
@@ -44,7 +44,6 @@
  ****************************************************************************/
 
 static uint16_t getsockname_event(FAR struct net_driver_s *dev,
-                                  FAR void *pvconn,
                                   FAR void *pvpriv, uint16_t flags)
 {
   FAR struct usrsock_data_reqstate_s *pstate = pvpriv;
diff --git a/net/usrsock/usrsock_getsockopt.c b/net/usrsock/usrsock_getsockopt.c
index 57032d093a..bcfeffa25a 100644
--- a/net/usrsock/usrsock_getsockopt.c
+++ b/net/usrsock/usrsock_getsockopt.c
@@ -45,8 +45,7 @@
  ****************************************************************************/
 
 static uint16_t getsockopt_event(FAR struct net_driver_s *dev,
-                                 FAR void *pvconn, FAR void *pvpriv,
-                                 uint16_t flags)
+                                 FAR void *pvpriv, uint16_t flags)
 {
   FAR struct usrsock_data_reqstate_s *pstate = pvpriv;
   FAR struct usrsock_conn_s *conn = pstate->reqstate.conn;
diff --git a/net/usrsock/usrsock_ioctl.c b/net/usrsock/usrsock_ioctl.c
index e541e1d617..66bf83242e 100644
--- a/net/usrsock/usrsock_ioctl.c
+++ b/net/usrsock/usrsock_ioctl.c
@@ -45,8 +45,7 @@
  ****************************************************************************/
 
 static uint16_t ioctl_event(FAR struct net_driver_s *dev,
-                                  FAR void *pvconn,
-                                  FAR void *pvpriv, uint16_t flags)
+                            FAR void *pvpriv, uint16_t flags)
 {
   FAR struct usrsock_data_reqstate_s *pstate = pvpriv;
   FAR struct usrsock_conn_s *conn = pstate->reqstate.conn;
diff --git a/net/usrsock/usrsock_listen.c b/net/usrsock/usrsock_listen.c
index d9a7a79a66..6cf277a6d6 100644
--- a/net/usrsock/usrsock_listen.c
+++ b/net/usrsock/usrsock_listen.c
@@ -38,7 +38,7 @@
  * Private Functions
  ****************************************************************************/
 
-static uint16_t listen_event(FAR struct net_driver_s *dev, FAR void *pvconn,
+static uint16_t listen_event(FAR struct net_driver_s *dev,
                              FAR void *pvpriv, uint16_t flags)
 {
   FAR struct usrsock_reqstate_s *pstate = pvpriv;
diff --git a/net/usrsock/usrsock_poll.c b/net/usrsock/usrsock_poll.c
index 91bcd059f9..0a03bb4806 100644
--- a/net/usrsock/usrsock_poll.c
+++ b/net/usrsock/usrsock_poll.c
@@ -45,10 +45,10 @@
  * Private Functions
  ****************************************************************************/
 
-static uint16_t poll_event(FAR struct net_driver_s *dev, FAR void *pvconn,
+static uint16_t poll_event(FAR struct net_driver_s *dev,
                            FAR void *pvpriv, uint16_t flags)
 {
-  FAR struct usrsock_poll_s *info = (FAR struct usrsock_poll_s *)pvpriv;
+  FAR struct usrsock_poll_s *info = pvpriv;
   FAR struct usrsock_conn_s *conn = info->conn;
   pollevent_t eventset = 0;
 
diff --git a/net/usrsock/usrsock_recvmsg.c b/net/usrsock/usrsock_recvmsg.c
index 74c2092994..becc6b8f1f 100644
--- a/net/usrsock/usrsock_recvmsg.c
+++ b/net/usrsock/usrsock_recvmsg.c
@@ -44,8 +44,7 @@
  ****************************************************************************/
 
 static uint16_t recvfrom_event(FAR struct net_driver_s *dev,
-                               FAR void *pvconn, FAR void *pvpriv,
-                               uint16_t flags)
+                               FAR void *pvpriv, uint16_t flags)
 {
   FAR struct usrsock_data_reqstate_s *pstate = pvpriv;
   FAR struct usrsock_conn_s *conn = pstate->reqstate.conn;
diff --git a/net/usrsock/usrsock_sendmsg.c b/net/usrsock/usrsock_sendmsg.c
index 704d17faf0..ee3171ce7e 100644
--- a/net/usrsock/usrsock_sendmsg.c
+++ b/net/usrsock/usrsock_sendmsg.c
@@ -43,7 +43,7 @@
  * Private Functions
  ****************************************************************************/
 
-static uint16_t sendto_event(FAR struct net_driver_s *dev, FAR void *pvconn,
+static uint16_t sendto_event(FAR struct net_driver_s *dev,
                              FAR void *pvpriv, uint16_t flags)
 {
   FAR struct usrsock_reqstate_s *pstate = pvpriv;
diff --git a/net/usrsock/usrsock_setsockopt.c b/net/usrsock/usrsock_setsockopt.c
index 2a97acc65e..9fa2654bc6 100644
--- a/net/usrsock/usrsock_setsockopt.c
+++ b/net/usrsock/usrsock_setsockopt.c
@@ -45,8 +45,7 @@
  ****************************************************************************/
 
 static uint16_t setsockopt_event(FAR struct net_driver_s *dev,
-                                 FAR void *pvconn, FAR void *pvpriv,
-                                 uint16_t flags)
+                                 FAR void *pvpriv, uint16_t flags)
 {
   FAR struct usrsock_reqstate_s *pstate = pvpriv;
   FAR struct usrsock_conn_s *conn = pstate->conn;
diff --git a/net/usrsock/usrsock_socket.c b/net/usrsock/usrsock_socket.c
index df153140c0..6351dedc8d 100644
--- a/net/usrsock/usrsock_socket.c
+++ b/net/usrsock/usrsock_socket.c
@@ -44,7 +44,7 @@
  * Private Functions
  ****************************************************************************/
 
-static uint16_t socket_event(FAR struct net_driver_s *dev, FAR void *pvconn,
+static uint16_t socket_event(FAR struct net_driver_s *dev,
                              FAR void *pvpriv, uint16_t flags)
 {
   FAR struct usrsock_reqstate_s *pstate = pvpriv;


[incubator-nuttx] 01/02: net: remove pvconn reference from all devif callback

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit ea621599fd5502d9bcffeae7723f66797ebd72cc
Author: chao.an <an...@xiaomi.com>
AuthorDate: Thu Aug 25 20:15:56 2022 +0800

    net: remove pvconn reference from all devif callback
    
    Do not use 'pvconn' argument to get the connection pointer since
    pvconn is normally NULL for some events like NETDEV_DOWN.
    Instead, the connection pointer can be reliably obtained from the
    corresponding private pointer.
    
    Signed-off-by: chao.an <an...@xiaomi.com>
---
 net/sixlowpan/sixlowpan_tcpsend.c |  9 +++------
 net/tcp/tcp.h                     |  4 ++++
 net/tcp/tcp_close.c               | 14 ++++++--------
 net/usrsock/usrsock.h             |  2 +-
 net/usrsock/usrsock_accept.c      |  2 +-
 net/usrsock/usrsock_bind.c        |  2 +-
 net/usrsock/usrsock_close.c       |  2 +-
 net/usrsock/usrsock_connect.c     |  2 +-
 net/usrsock/usrsock_getpeername.c |  2 +-
 net/usrsock/usrsock_getsockname.c |  2 +-
 net/usrsock/usrsock_getsockopt.c  |  2 +-
 net/usrsock/usrsock_ioctl.c       |  2 +-
 net/usrsock/usrsock_listen.c      |  2 +-
 net/usrsock/usrsock_poll.c        | 14 +++++++-------
 net/usrsock/usrsock_recvmsg.c     |  2 +-
 net/usrsock/usrsock_sendmsg.c     |  2 +-
 net/usrsock/usrsock_setsockopt.c  |  2 +-
 net/usrsock/usrsock_socket.c      |  2 +-
 18 files changed, 34 insertions(+), 35 deletions(-)

diff --git a/net/sixlowpan/sixlowpan_tcpsend.c b/net/sixlowpan/sixlowpan_tcpsend.c
index cd6e4009c6..0a8acd08f3 100644
--- a/net/sixlowpan/sixlowpan_tcpsend.c
+++ b/net/sixlowpan/sixlowpan_tcpsend.c
@@ -76,7 +76,7 @@
 
 struct sixlowpan_send_s
 {
-  FAR struct socket           *s_sock;          /* Internal socket reference */
+  FAR struct tcp_conn_s       *s_conn;          /* Internal connect reference */
   FAR struct devif_callback_s *s_cb;            /* Reference to callback
                                                  * instance */
   sem_t                        s_waitsem;       /* Supports waiting for
@@ -305,7 +305,7 @@ static uint16_t tcp_send_eventhandler(FAR struct net_driver_s *dev,
                                       FAR void *pvpriv, uint16_t flags)
 {
   FAR struct sixlowpan_send_s *sinfo = (FAR struct sixlowpan_send_s *)pvpriv;
-  FAR struct tcp_conn_s *conn = (FAR struct tcp_conn_s *)pvconn;
+  FAR struct tcp_conn_s *conn = sinfo->s_conn;
   struct ipv6tcp_hdr_s ipv6tcp;
   int ret;
 
@@ -391,8 +391,6 @@ static uint16_t tcp_send_eventhandler(FAR struct net_driver_s *dev,
 
   else if ((flags & TCP_DISCONN_EVENTS) != 0)
     {
-      FAR struct socket *psock = sinfo->s_sock;
-
       nwarn("WARNING: Lost connection\n");
 
       /* We could get here recursively through the callback actions of
@@ -400,7 +398,6 @@ static uint16_t tcp_send_eventhandler(FAR struct net_driver_s *dev,
        * already been disconnected.
        */
 
-      DEBUGASSERT(psock != NULL);
       if (_SS_ISCONNECTED(conn->sconn.s_flags))
         {
           /* Report the disconnection event to all socket clones */
@@ -620,7 +617,7 @@ static int sixlowpan_send_packet(FAR struct socket *psock,
           nxsem_init(&sinfo.s_waitsem, 0, 0);
           nxsem_set_protocol(&sinfo.s_waitsem, SEM_PRIO_NONE);
 
-          sinfo.s_sock      = psock;
+          sinfo.s_conn      = conn;
           sinfo.s_result    = -EBUSY;
           sinfo.s_destmac   = destmac;
           sinfo.s_buf       = buf;
diff --git a/net/tcp/tcp.h b/net/tcp/tcp.h
index e18b84d61e..57daa59536 100644
--- a/net/tcp/tcp.h
+++ b/net/tcp/tcp.h
@@ -301,6 +301,10 @@ struct tcp_conn_s
   FAR struct devif_callback_s *connevents;
   FAR struct devif_callback_s *connevents_tail;
 
+  /* Reference to TCP close callback instance */
+
+  FAR struct devif_callback_s *clscb;
+
 #if defined(CONFIG_NET_TCP_WRITE_BUFFERS)
   /* Callback instance for TCP send() */
 
diff --git a/net/tcp/tcp_close.c b/net/tcp/tcp_close.c
index 50f466d430..d99096580b 100644
--- a/net/tcp/tcp_close.c
+++ b/net/tcp/tcp_close.c
@@ -69,8 +69,7 @@ static uint16_t tcp_close_eventhandler(FAR struct net_driver_s *dev,
                                        FAR void *pvconn, FAR void *pvpriv,
                                        uint16_t flags)
 {
-  FAR struct tcp_conn_s *conn = pvconn;
-  FAR struct devif_callback_s *cb = pvpriv;
+  FAR struct tcp_conn_s *conn = pvpriv;
 
   ninfo("flags: %04x\n", flags);
 
@@ -177,7 +176,7 @@ static uint16_t tcp_close_eventhandler(FAR struct net_driver_s *dev,
   return flags;
 
 end_wait:
-  tcp_callback_free(conn, cb);
+  tcp_callback_free(conn, conn->clscb);
 
   /* Free network resources */
 
@@ -253,7 +252,6 @@ static inline void tcp_close_txnotify(FAR struct socket *psock,
 static inline int tcp_close_disconnect(FAR struct socket *psock)
 {
   FAR struct tcp_conn_s *conn;
-  FAR struct devif_callback_s *cb;
   int ret = OK;
 
   /* Interrupts are disabled here to avoid race conditions */
@@ -306,13 +304,13 @@ static inline int tcp_close_disconnect(FAR struct socket *psock)
 
   if ((conn->tcpstateflags == TCP_ESTABLISHED ||
        conn->tcpstateflags == TCP_LAST_ACK) &&
-      (cb = tcp_callback_alloc(conn)) != NULL)
+      (conn->clscb = tcp_callback_alloc(conn)) != NULL)
     {
       /* Set up to receive TCP data event callbacks */
 
-      cb->flags = (TCP_NEWDATA | TCP_POLL | TCP_DISCONN_EVENTS);
-      cb->event = tcp_close_eventhandler;
-      cb->priv  = cb; /* reference for event handler to free cb */
+      conn->clscb->flags = TCP_NEWDATA | TCP_POLL | TCP_DISCONN_EVENTS;
+      conn->clscb->event = tcp_close_eventhandler;
+      conn->clscb->priv  = conn; /* reference for event handler to free cb */
 
       /* Notify the device driver of the availability of TX data */
 
diff --git a/net/usrsock/usrsock.h b/net/usrsock/usrsock.h
index e429a08f08..d663d4661a 100644
--- a/net/usrsock/usrsock.h
+++ b/net/usrsock/usrsock.h
@@ -74,7 +74,7 @@ enum usrsock_conn_state_e
 
 struct usrsock_poll_s
 {
-  FAR struct socket *psock;        /* Needed to handle loss of connection */
+  FAR struct usrsock_conn_s *conn; /* Needed to handle loss of connection */
   struct pollfd *fds;              /* Needed to handle poll events */
   FAR struct devif_callback_s *cb; /* Needed to teardown the poll */
 };
diff --git a/net/usrsock/usrsock_accept.c b/net/usrsock/usrsock_accept.c
index a5e0dc093c..ca6f8ad5f9 100644
--- a/net/usrsock/usrsock_accept.c
+++ b/net/usrsock/usrsock_accept.c
@@ -42,7 +42,7 @@ static uint16_t accept_event(FAR struct net_driver_s *dev, FAR void *pvconn,
                              FAR void *pvpriv, uint16_t flags)
 {
   FAR struct usrsock_data_reqstate_s *pstate = pvpriv;
-  FAR struct usrsock_conn_s *conn = pvconn;
+  FAR struct usrsock_conn_s *conn = pstate->reqstate.conn;
 
   if (flags & USRSOCK_EVENT_ABORT)
     {
diff --git a/net/usrsock/usrsock_bind.c b/net/usrsock/usrsock_bind.c
index 6a15930b5d..2b8905e562 100644
--- a/net/usrsock/usrsock_bind.c
+++ b/net/usrsock/usrsock_bind.c
@@ -47,7 +47,7 @@ static uint16_t bind_event(FAR struct net_driver_s *dev, FAR void *pvconn,
                            FAR void *pvpriv, uint16_t flags)
 {
   FAR struct usrsock_reqstate_s *pstate = pvpriv;
-  FAR struct usrsock_conn_s *conn = pvconn;
+  FAR struct usrsock_conn_s *conn = pstate->conn;
 
   if (flags & USRSOCK_EVENT_ABORT)
     {
diff --git a/net/usrsock/usrsock_close.c b/net/usrsock/usrsock_close.c
index 14b4da8957..f3148fb152 100644
--- a/net/usrsock/usrsock_close.c
+++ b/net/usrsock/usrsock_close.c
@@ -47,7 +47,7 @@ static uint16_t close_event(FAR struct net_driver_s *dev, FAR void *pvconn,
                             FAR void *pvpriv, uint16_t flags)
 {
   FAR struct usrsock_reqstate_s *pstate = pvpriv;
-  FAR struct usrsock_conn_s *conn = pvconn;
+  FAR struct usrsock_conn_s *conn = pstate->conn;
 
   if (flags & USRSOCK_EVENT_ABORT)
     {
diff --git a/net/usrsock/usrsock_connect.c b/net/usrsock/usrsock_connect.c
index 1a671b66a5..46614aa1d3 100644
--- a/net/usrsock/usrsock_connect.c
+++ b/net/usrsock/usrsock_connect.c
@@ -47,7 +47,7 @@ static uint16_t connect_event(FAR struct net_driver_s *dev, FAR void *pvconn,
                               FAR void *pvpriv, uint16_t flags)
 {
   FAR struct usrsock_reqstate_s *pstate = pvpriv;
-  FAR struct usrsock_conn_s *conn = pvconn;
+  FAR struct usrsock_conn_s *conn = pstate->conn;
 
   if (flags & USRSOCK_EVENT_ABORT)
     {
diff --git a/net/usrsock/usrsock_getpeername.c b/net/usrsock/usrsock_getpeername.c
index 3fafe929cd..268ad38a43 100644
--- a/net/usrsock/usrsock_getpeername.c
+++ b/net/usrsock/usrsock_getpeername.c
@@ -48,7 +48,7 @@ static uint16_t getpeername_event(FAR struct net_driver_s *dev,
                                   FAR void *pvpriv, uint16_t flags)
 {
   FAR struct usrsock_data_reqstate_s *pstate = pvpriv;
-  FAR struct usrsock_conn_s *conn = pvconn;
+  FAR struct usrsock_conn_s *conn = pstate->reqstate.conn;
 
   if (flags & USRSOCK_EVENT_ABORT)
     {
diff --git a/net/usrsock/usrsock_getsockname.c b/net/usrsock/usrsock_getsockname.c
index 10f3f65f99..acabebe18f 100644
--- a/net/usrsock/usrsock_getsockname.c
+++ b/net/usrsock/usrsock_getsockname.c
@@ -48,7 +48,7 @@ static uint16_t getsockname_event(FAR struct net_driver_s *dev,
                                   FAR void *pvpriv, uint16_t flags)
 {
   FAR struct usrsock_data_reqstate_s *pstate = pvpriv;
-  FAR struct usrsock_conn_s *conn = pvconn;
+  FAR struct usrsock_conn_s *conn = pstate->reqstate.conn;
 
   if (flags & USRSOCK_EVENT_ABORT)
     {
diff --git a/net/usrsock/usrsock_getsockopt.c b/net/usrsock/usrsock_getsockopt.c
index 3e23efeccf..57032d093a 100644
--- a/net/usrsock/usrsock_getsockopt.c
+++ b/net/usrsock/usrsock_getsockopt.c
@@ -49,7 +49,7 @@ static uint16_t getsockopt_event(FAR struct net_driver_s *dev,
                                  uint16_t flags)
 {
   FAR struct usrsock_data_reqstate_s *pstate = pvpriv;
-  FAR struct usrsock_conn_s *conn = pvconn;
+  FAR struct usrsock_conn_s *conn = pstate->reqstate.conn;
 
   if (flags & USRSOCK_EVENT_ABORT)
     {
diff --git a/net/usrsock/usrsock_ioctl.c b/net/usrsock/usrsock_ioctl.c
index f77c563fd4..e541e1d617 100644
--- a/net/usrsock/usrsock_ioctl.c
+++ b/net/usrsock/usrsock_ioctl.c
@@ -49,7 +49,7 @@ static uint16_t ioctl_event(FAR struct net_driver_s *dev,
                                   FAR void *pvpriv, uint16_t flags)
 {
   FAR struct usrsock_data_reqstate_s *pstate = pvpriv;
-  FAR struct usrsock_conn_s *conn = pvconn;
+  FAR struct usrsock_conn_s *conn = pstate->reqstate.conn;
 
   if (flags & USRSOCK_EVENT_ABORT)
     {
diff --git a/net/usrsock/usrsock_listen.c b/net/usrsock/usrsock_listen.c
index 1d691ba32b..d9a7a79a66 100644
--- a/net/usrsock/usrsock_listen.c
+++ b/net/usrsock/usrsock_listen.c
@@ -42,7 +42,7 @@ static uint16_t listen_event(FAR struct net_driver_s *dev, FAR void *pvconn,
                              FAR void *pvpriv, uint16_t flags)
 {
   FAR struct usrsock_reqstate_s *pstate = pvpriv;
-  FAR struct usrsock_conn_s *conn = pvconn;
+  FAR struct usrsock_conn_s *conn = pstate->conn;
 
   if (flags & USRSOCK_EVENT_ABORT)
     {
diff --git a/net/usrsock/usrsock_poll.c b/net/usrsock/usrsock_poll.c
index 2dd4364415..91bcd059f9 100644
--- a/net/usrsock/usrsock_poll.c
+++ b/net/usrsock/usrsock_poll.c
@@ -49,10 +49,10 @@ static uint16_t poll_event(FAR struct net_driver_s *dev, FAR void *pvconn,
                            FAR void *pvpriv, uint16_t flags)
 {
   FAR struct usrsock_poll_s *info = (FAR struct usrsock_poll_s *)pvpriv;
-  FAR struct usrsock_conn_s *conn = pvconn;
+  FAR struct usrsock_conn_s *conn = info->conn;
   pollevent_t eventset = 0;
 
-  DEBUGASSERT(!info || (info->psock && info->fds));
+  DEBUGASSERT(!info || info->fds);
 
   if (info == NULL)
     {
@@ -161,7 +161,7 @@ static int usrsock_pollsetup(FAR struct socket *psock,
   /* Find a container to hold the poll information */
 
   info = conn->pollinfo;
-  while (info->psock != NULL)
+  while (info->conn != NULL)
     {
       if (++info >= &conn->pollinfo[CONFIG_NET_USRSOCK_NPOLLWAITERS])
         {
@@ -181,9 +181,9 @@ static int usrsock_pollsetup(FAR struct socket *psock,
 
   /* Initialize the poll info container */
 
-  info->psock  = psock;
-  info->fds    = fds;
-  info->cb     = cb;
+  info->conn  = conn;
+  info->fds   = fds;
+  info->cb    = cb;
 
   /* Initialize the callback structure.  Save the reference to the info
    * structure as callback private data so that it will be available during
@@ -327,7 +327,7 @@ static int usrsock_pollteardown(FAR struct socket *psock,
 
       /* Then free the poll info container */
 
-      info->psock = NULL;
+      info->conn = NULL;
     }
 
   return OK;
diff --git a/net/usrsock/usrsock_recvmsg.c b/net/usrsock/usrsock_recvmsg.c
index bcf87eb926..74c2092994 100644
--- a/net/usrsock/usrsock_recvmsg.c
+++ b/net/usrsock/usrsock_recvmsg.c
@@ -48,7 +48,7 @@ static uint16_t recvfrom_event(FAR struct net_driver_s *dev,
                                uint16_t flags)
 {
   FAR struct usrsock_data_reqstate_s *pstate = pvpriv;
-  FAR struct usrsock_conn_s *conn = pvconn;
+  FAR struct usrsock_conn_s *conn = pstate->reqstate.conn;
 
   if (flags & USRSOCK_EVENT_ABORT)
     {
diff --git a/net/usrsock/usrsock_sendmsg.c b/net/usrsock/usrsock_sendmsg.c
index cc20b0698f..704d17faf0 100644
--- a/net/usrsock/usrsock_sendmsg.c
+++ b/net/usrsock/usrsock_sendmsg.c
@@ -47,7 +47,7 @@ static uint16_t sendto_event(FAR struct net_driver_s *dev, FAR void *pvconn,
                              FAR void *pvpriv, uint16_t flags)
 {
   FAR struct usrsock_reqstate_s *pstate = pvpriv;
-  FAR struct usrsock_conn_s *conn = pvconn;
+  FAR struct usrsock_conn_s *conn = pstate->conn;
 
   if (flags & USRSOCK_EVENT_ABORT)
     {
diff --git a/net/usrsock/usrsock_setsockopt.c b/net/usrsock/usrsock_setsockopt.c
index 38788c5e7c..2a97acc65e 100644
--- a/net/usrsock/usrsock_setsockopt.c
+++ b/net/usrsock/usrsock_setsockopt.c
@@ -49,7 +49,7 @@ static uint16_t setsockopt_event(FAR struct net_driver_s *dev,
                                  uint16_t flags)
 {
   FAR struct usrsock_reqstate_s *pstate = pvpriv;
-  FAR struct usrsock_conn_s *conn = pvconn;
+  FAR struct usrsock_conn_s *conn = pstate->conn;
 
   if (flags & USRSOCK_EVENT_ABORT)
     {
diff --git a/net/usrsock/usrsock_socket.c b/net/usrsock/usrsock_socket.c
index 0f6c3aadfc..df153140c0 100644
--- a/net/usrsock/usrsock_socket.c
+++ b/net/usrsock/usrsock_socket.c
@@ -48,7 +48,7 @@ static uint16_t socket_event(FAR struct net_driver_s *dev, FAR void *pvconn,
                              FAR void *pvpriv, uint16_t flags)
 {
   FAR struct usrsock_reqstate_s *pstate = pvpriv;
-  FAR struct usrsock_conn_s *conn = pvconn;
+  FAR struct usrsock_conn_s *conn = pstate->conn;
 
   if (flags & USRSOCK_EVENT_ABORT)
     {