mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 01:21:26 +08:00
net/pkt: delete the read-back mechanism in pkt stack
When app send a pkt-packet, then it will read back it and case some problem. Connection should not read back the message sent by itself. Signed-off-by: gaohedong <gaohedong@xiaomi.com>
This commit is contained in:
@@ -74,6 +74,8 @@ struct pkt_conn_s
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
struct iob_queue_s readahead; /* Read-ahead buffering */
|
struct iob_queue_s readahead; /* Read-ahead buffering */
|
||||||
|
|
||||||
|
FAR struct iob_s *pendiob; /* The iob currently being sent */
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -156,6 +156,14 @@ static int pkt_in(FAR struct net_driver_s *dev)
|
|||||||
{
|
{
|
||||||
uint16_t flags;
|
uint16_t flags;
|
||||||
|
|
||||||
|
if (conn->pendiob == dev->d_iob)
|
||||||
|
{
|
||||||
|
/* Do not read back the packet sent by oneself */
|
||||||
|
|
||||||
|
conn->pendiob = NULL;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_NET_TIMESTAMP) && !defined(CONFIG_ARCH_HAVE_NETDEV_TIMESTAMP)
|
#if defined(CONFIG_NET_TIMESTAMP) && !defined(CONFIG_ARCH_HAVE_NETDEV_TIMESTAMP)
|
||||||
/* Get system as timestamp if no hardware timestamp */
|
/* Get system as timestamp if no hardware timestamp */
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ struct send_s
|
|||||||
{
|
{
|
||||||
FAR struct socket *snd_sock; /* Points to the parent socket structure */
|
FAR struct socket *snd_sock; /* Points to the parent socket structure */
|
||||||
FAR struct devif_callback_s *snd_cb; /* Reference to callback instance */
|
FAR struct devif_callback_s *snd_cb; /* Reference to callback instance */
|
||||||
|
FAR struct pkt_conn_s *snd_conn; /* Reference to the packet connection */
|
||||||
sem_t snd_sem; /* Used to wake up the waiting thread */
|
sem_t snd_sem; /* Used to wake up the waiting thread */
|
||||||
FAR const uint8_t *snd_buffer; /* Points to the buffer of data to send */
|
FAR const uint8_t *snd_buffer; /* Points to the buffer of data to send */
|
||||||
size_t snd_buflen; /* Number of bytes in the buffer to send */
|
size_t snd_buflen; /* Number of bytes in the buffer to send */
|
||||||
@@ -117,6 +118,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev,
|
|||||||
|
|
||||||
dev->d_len = dev->d_sndlen;
|
dev->d_len = dev->d_sndlen;
|
||||||
pstate->snd_sent = pstate->snd_buflen;
|
pstate->snd_sent = pstate->snd_buflen;
|
||||||
|
pstate->snd_conn->pendiob = dev->d_iob;
|
||||||
|
|
||||||
/* Make sure no ARP request overwrites this ARP request. This
|
/* Make sure no ARP request overwrites this ARP request. This
|
||||||
* flag will be cleared in arp_out().
|
* flag will be cleared in arp_out().
|
||||||
@@ -227,6 +229,7 @@ ssize_t pkt_sendmsg(FAR struct socket *psock, FAR struct msghdr *msg,
|
|||||||
state.snd_sock = psock; /* Socket descriptor to use */
|
state.snd_sock = psock; /* Socket descriptor to use */
|
||||||
state.snd_buflen = len; /* Number of bytes to send */
|
state.snd_buflen = len; /* Number of bytes to send */
|
||||||
state.snd_buffer = buf; /* Buffer to send from */
|
state.snd_buffer = buf; /* Buffer to send from */
|
||||||
|
state.snd_conn = psock->s_conn; /* Connection info */
|
||||||
|
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user