zhhyu7 commented on code in PR #20148:
URL: https://github.com/apache/nuttx/pull/20148#discussion_r4011654231
##########
net/pkt/pkt.h:
##########
@@ -105,6 +105,10 @@ struct pkt_conn_s
struct iob_queue_s readahead; /* Read-ahead buffering */
FAR struct iob_s *pendiob; /* The iob currently being sent */
+ uint16_t pendiob_len; /* Length of pendiob, to disambiguate
Review Comment:
Can the following repair solution be tried to see if it can solve the
problem you are facing?
```
diff --git a/net/devif/devif_poll.c b/net/devif/devif_poll.c
index 0e84fdba9cf..ff867b322f5 100644
--- a/net/devif/devif_poll.c
+++ b/net/devif/devif_poll.c
@@ -259,6 +259,16 @@ devif_poll_pkt_connections(FAR struct net_driver_s *dev,
{
bstop = callback(dev);
}
+
+ /* pkt_poll() records the outgoing IOB in pkt_conn->pendiob so
that
+ * the TX tap run from the driver callback above can skip the
+ * sending connection. Drop the reference now that the callback
+ * has returned: it must not outlive the buffer it points at, or a
+ * later frame reusing the same IOB address would be withheld from
+ * this connection.
+ */
+
+ pkt_conn->pendiob = NULL;
}
}
diff --git a/net/pkt/pkt_input.c b/net/pkt/pkt_input.c
index 41808322021..fa1bb4241f7 100644
--- a/net/pkt/pkt_input.c
+++ b/net/pkt/pkt_input.c
@@ -164,9 +164,11 @@ static int pkt_in_(FAR struct net_driver_s *dev, bool
loopback)
{
if (loopback && conn->pendiob == dev->d_iob)
{
- /* Do not read back the packet sent by oneself */
+ /* Do not read back the packet sent by oneself. pendiob is
+ * released by devif_poll_pkt_connections() once this tap run
+ * completes, so it is always a live reference here.
+ */
- conn->pendiob = NULL;
continue;
}
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]