Armv7-M: Remove Px4-only setting of stack to 0xff. This is incompatible with standard NuttX stack montitoring logic

This commit is contained in:
Gregory Nutt 2015-01-22 10:09:10 -06:00
parent 2e8667d304
commit 7106469191
6 changed files with 216 additions and 61 deletions

View File

@ -97,10 +97,6 @@ void up_initial_state(struct tcb_s *tcb)
/* Set the stack limit value */
xcp->regs[REG_R10] = (uint32_t)tcb->stack_alloc_ptr + 64;
/* Fill the stack with a watermark value */
memset(tcb->stack_alloc_ptr, 0xff, tcb->adj_stack_size);
#endif
/* Save the task entry point (stripping off the thumb bit) */

View File

@ -66,6 +66,7 @@
#include "netdev/netdev.h"
#include "devif/devif.h"
#include "arp/arp.h"
#include "neighbor/neighbor.h"
#include "tcp/tcp.h"
#include "socket/socket.h"
@ -232,6 +233,69 @@ static uint16_t ack_interrupt(FAR struct net_driver_s *dev, FAR void *pvconn,
return flags;
}
/****************************************************************************
* Function: sendfile_addrcheck
*
* Description:
* Check if the destination IP address is in the IPv4 ARP or IPv6 Neighbor
* tables. If not, then the send won't actually make it out... it will be
* replaced with an ARP request (IPv4) or a Neighbor Solicitation (IPv6).
*
* NOTE 1: This could be an expensive check if there are a lot of
* entries in the ARP or Neighbor tables.
*
* NOTE 2: If we are actually harvesting IP addresses on incoming IP
* packets, then this check should not be necessary; the MAC mapping
* should already be in the ARP table in many cases (IPv4 only).
*
* NOTE 3: If CONFIG_NET_ARP_SEND then we can be assured that the IP
* address mapping is already in the ARP table.
*
* Parameters:
* conn - The TCP connection structure
*
* Returned Value:
* None
*
* Assumptions:
* Running at the interrupt level
*
****************************************************************************/
#ifdef CONFIG_NET_ETHERNET
static inline bool sendfile_addrcheck(FAR struct tcp_conn_s *conn)
{
#ifdef CONFIG_NET_IPv4
#ifdef CONFIG_NET_IPv6
if (conn->domain == PF_INET)
#endif
{
#if !defined(CONFIG_NET_ARP_IPIN) && !defined(CONFIG_NET_ARP_SEND)
return (arp_find(conn->u.ipv4.raddr) != NULL);
#else
return true;
#endif
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
#if !defined(CONFIG_NET_ICMPv6_SEND)
return (neighbor_findentry(conn->u.ipv6.raddr) != NULL);
#else
return true;
#endif
}
#endif /* CONFIG_NET_IPv6 */
}
#else /* CONFIG_NET_ETHERNET */
# sendfile_addrcheck(r) (true)
#endif /* CONFIG_NET_ETHERNET */
/****************************************************************************
* Function: sendfile_interrupt
*
@ -337,26 +401,12 @@ static uint16_t sendfile_interrupt(FAR struct net_driver_s *dev, FAR void *pvcon
tcp_setsequence(conn->sndseq, seqno);
/* Check if the destination IP address is in the ARP table. If not,
* then the send won't actually make it out... it will be replaced with
* an ARP request.
*
* NOTE 1: This could be an expensive check if there are a lot of entries
* in the ARP table. Hence, we only check on the first packet -- when
* snd_sent is zero.
*
* NOTE 2: If we are actually harvesting IP addresses on incoming IP
* packets, then this check should not be necessary; the MAC mapping
* should already be in the ARP table in many cases.
*
* NOTE 3: If CONFIG_NET_ARP_SEND then we can be assured that the IP
* address mapping is already in the ARP table.
/* Check if the destination IP address is in the ARP or Neighbor
* table. If not, then the send won't actually make it out... it
* will be replaced with an ARP request or Neighbor Solicitation.
*/
#if defined(CONFIG_NET_ETHERNET) && !defined(CONFIG_NET_ARP_IPIN) && \
!defined(CONFIG_NET_ARP_SEND)
if (pstate->snd_sent != 0 || arp_find(conn->u.ipv4.raddr) != NULL)
#endif
if (pstate->snd_sent != 0 || sendfile_addrcheck(conn))
{
/* Update the amount of data sent (but not necessarily ACKed) */

View File

@ -226,7 +226,7 @@ void tcp_rexmit(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
#endif
{
DEBUGASSERT(IFF_IS_IPv4(dev->d_flags));
hdrlen = IPv4TCP_HDRLEN;
hdrlen = IPv4_HDRLEN;
}
#endif /* CONFIG_NET_IPv4 */
@ -236,9 +236,10 @@ void tcp_rexmit(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
#endif
{
DEBUGASSERT(IFF_IS_IPv6(dev->d_flags));
hdrlen = IPv6TCP_HDRLEN;
hdrlen = IPv6_HDRLEN;
}
#endif /* CONFIG_NET_IPv6 */
lldbg("hdrlen=%d\n", hdrlen); // REMOVE ME
/* If the application has data to be sent, or if the incoming packet had
* new data in it, we must send out a packet.

View File

@ -176,7 +176,7 @@ static inline void tcp_ipv4_sendcomplete(FAR struct net_driver_s *dev,
#endif /* CONFIG_NET_IPv4 */
/****************************************************************************
* Name: tcp_pv6_sendcomplete
* Name: tcp_ipv6_sendcomplete
*
* Description:
* Complete the final portions of the send operation. This function sets
@ -304,7 +304,8 @@ static void tcp_sendcommon(FAR struct net_driver_s *dev,
FAR struct tcp_conn_s *conn,
FAR struct tcp_hdr_s *tcp)
{
/* Copy the IP address into the IPv6 header */
/* Copy the IP address into the IPv6 header */
lldbg("d_len=%d\n", dev->d_len); // REMOVE ME
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
@ -386,6 +387,7 @@ void tcp_send(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
uint16_t flags, uint16_t len)
{
FAR struct tcp_hdr_s *tcp = tcp_header(dev);
lldbg("sndlen=%d len=%d d_len=%d\n", dev->d_sndlen, len, dev->d_len); // REMOVE ME
tcp->flags = flags;
dev->d_len = len;

View File

@ -72,6 +72,7 @@
#include "socket/socket.h"
#include "netdev/netdev.h"
#include "arp/arp.h"
#include "neighbor/neighbor.h"
#include "tcp/tcp.h"
#include "devif/devif.h"
@ -246,6 +247,69 @@ static inline void send_ipselect(FAR struct net_driver_s *dev,
}
#endif
/****************************************************************************
* Function: psock_send_addrchck
*
* Description:
* Check if the destination IP address is in the IPv4 ARP or IPv6 Neighbor
* tables. If not, then the send won't actually make it out... it will be
* replaced with an ARP request (IPv4) or a Neighbor Solicitation (IPv6).
*
* NOTE 1: This could be an expensive check if there are a lot of
* entries in the ARP or Neighbor tables.
*
* NOTE 2: If we are actually harvesting IP addresses on incoming IP
* packets, then this check should not be necessary; the MAC mapping
* should already be in the ARP table in many cases (IPv4 only).
*
* NOTE 3: If CONFIG_NET_ARP_SEND then we can be assured that the IP
* address mapping is already in the ARP table.
*
* Parameters:
* conn - The TCP connection structure
*
* Returned Value:
* None
*
* Assumptions:
* Running at the interrupt level
*
****************************************************************************/
#ifdef CONFIG_NET_ETHERNET
static inline bool psock_send_addrchck(FAR struct tcp_conn_s *conn)
{
#ifdef CONFIG_NET_IPv4
#ifdef CONFIG_NET_IPv6
if (conn->domain == PF_INET)
#endif
{
#if !defined(CONFIG_NET_ARP_IPIN) && !defined(CONFIG_NET_ARP_SEND)
return (arp_find(conn->u.ipv4.raddr) != NULL);
#else
return true;
#endif
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
#if !defined(CONFIG_NET_ICMPv6_SEND)
return (neighbor_findentry(conn->u.ipv6.raddr) != NULL);
#else
return true;
#endif
}
#endif /* CONFIG_NET_IPv6 */
}
#else /* CONFIG_NET_ETHERNET */
# psock_send_addrchck(r) (true)
#endif /* CONFIG_NET_ETHERNET */
/****************************************************************************
* Function: psock_send_interrupt
*
@ -286,6 +350,7 @@ static uint16_t psock_send_interrupt(FAR struct net_driver_s *dev,
FAR sq_entry_t *entry;
FAR sq_entry_t *next;
uint32_t ackno;
lldbg("TCP_ACKDATA\n"); // REMOVE ME
/* Get the offset address of the TCP header */
@ -591,6 +656,7 @@ static uint16_t psock_send_interrupt(FAR struct net_driver_s *dev,
if (dev->d_sndlen > 0)
{
/* Another thread has beat us sending data, wait for the next poll */
lldbg("d_sndlen > 0, ABORTING\n"); // REMOVE ME
return flags;
}
@ -607,25 +673,12 @@ static uint16_t psock_send_interrupt(FAR struct net_driver_s *dev,
(flags & (TCP_POLL | TCP_REXMIT)) &&
!(sq_empty(&conn->write_q)))
{
/* Check if the destination IP address is in the ARP table. If not,
* then the send won't actually make it out... it will be replaced with
* an ARP request.
*
* NOTE 1: This could be an expensive check if there are a lot of
* entries in the ARP table.
*
* NOTE 2: If we are actually harvesting IP addresses on incoming IP
* packets, then this check should not be necessary; the MAC mapping
* should already be in the ARP table in many cases.
*
* NOTE 3: If CONFIG_NET_ARP_SEND then we can be assured that the IP
* address mapping is already in the ARP table.
/* Check if the destination IP address is in the ARP or Neighbor
* table. If not, then the send won't actually make it out... it
* will be replaced with an ARP request or Neighbor Solicitation.
*/
#if defined(CONFIG_NET_ETHERNET) && !defined(CONFIG_NET_ARP_IPIN) && \
!defined(CONFIG_NET_ARP_SEND)
if (arp_find(conn->u.ipv4.raddr) != NULL)
#endif
if (psock_send_addrchck(conn))
{
FAR struct tcp_wrbuffer_s *wrb;
size_t sndlen;
@ -740,6 +793,9 @@ static uint16_t psock_send_interrupt(FAR struct net_driver_s *dev,
flags &= ~TCP_POLL;
}
else { // REMOVE ME
lldbg("NOT sending!!!\n"); // REMOVE ME
} // REMOVE ME
}
/* Continue waiting */

View File

@ -60,6 +60,7 @@
#include "netdev/netdev.h"
#include "devif/devif.h"
#include "arp/arp.h"
#include "neighbor/neighbor.h"
#include "tcp/tcp.h"
#include "socket/socket.h"
@ -197,6 +198,69 @@ static inline void tcpsend_ipselect(FAR struct net_driver_s *dev,
}
#endif
/****************************************************************************
* Function: psock_send_addrchck
*
* Description:
* Check if the destination IP address is in the IPv4 ARP or IPv6 Neighbor
* tables. If not, then the send won't actually make it out... it will be
* replaced with an ARP request (IPv4) or a Neighbor Solicitation (IPv6).
*
* NOTE 1: This could be an expensive check if there are a lot of
* entries in the ARP or Neighbor tables.
*
* NOTE 2: If we are actually harvesting IP addresses on incoming IP
* packets, then this check should not be necessary; the MAC mapping
* should already be in the ARP table in many cases (IPv4 only).
*
* NOTE 3: If CONFIG_NET_ARP_SEND then we can be assured that the IP
* address mapping is already in the ARP table.
*
* Parameters:
* conn - The TCP connection structure
*
* Returned Value:
* None
*
* Assumptions:
* Running at the interrupt level
*
****************************************************************************/
#ifdef CONFIG_NET_ETHERNET
static inline bool psock_send_addrchck(FAR struct tcp_conn_s *conn)
{
#ifdef CONFIG_NET_IPv4
#ifdef CONFIG_NET_IPv6
if (conn->domain == PF_INET)
#endif
{
#if !defined(CONFIG_NET_ARP_IPIN) && !defined(CONFIG_NET_ARP_SEND)
return (arp_find(conn->u.ipv4.raddr) != NULL);
#else
return true;
#endif
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
#if !defined(CONFIG_NET_ICMPv6_SEND)
return (neighbor_findentry(conn->u.ipv6.raddr) != NULL);
#else
return true;
#endif
}
#endif /* CONFIG_NET_IPv6 */
}
#else /* CONFIG_NET_ETHERNET */
# psock_send_addrchck(r) (true)
#endif /* CONFIG_NET_ETHERNET */
/****************************************************************************
* Function: tcpsend_interrupt
*
@ -466,26 +530,12 @@ static uint16_t tcpsend_interrupt(FAR struct net_driver_s *dev,
devif_send(dev, &pstate->snd_buffer[pstate->snd_sent], sndlen);
/* Check if the destination IP address is in the ARP table. If not,
* then the send won't actually make it out... it will be replaced with
* an ARP request.
*
* NOTE 1: This could be an expensive check if there are a lot of entries
* in the ARP table. Hence, we only check on the first packet -- when
* snd_sent is zero.
*
* NOTE 2: If we are actually harvesting IP addresses on incoming IP
* packets, then this check should not be necessary; the MAC mapping
* should already be in the ARP table in many cases.
*
* NOTE 3: If CONFIG_NET_ARP_SEND then we can be assured that the IP
* address mapping is already in the ARP table.
/* Check if the destination IP address is in the ARP or Neighbor
* table. If not, then the send won't actually make it out... it
* will be replaced with an ARP request or Neighbor Solicitation.
*/
#if defined(CONFIG_NET_ETHERNET) && !defined(CONFIG_NET_ARP_IPIN) && \
!defined(CONFIG_NET_ARP_SEND)
if (pstate->snd_sent != 0 || arp_find(conn->u.ipv4.raddr) != NULL)
#endif
if (pstate->snd_sent != 0 || psock_send_addrchck(conn))
{
/* Update the amount of data sent (but not necessarily ACKed) */