Commit eada4c6a authored by julien.delange's avatar julien.delange
Browse files

add more debug output to trace RTEMS x86 errors with network



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-c@1001 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 40742dbf
......@@ -35,6 +35,21 @@ extern __po_hi_inetport_t node_port[__PO_HI_NB_NODES];
extern __po_hi_inetaddr_t node_addr[__PO_HI_NB_NODES];
extern __po_hi_node_t mynode;
/* We only need to set the timeout for the NE2000 driver socket.
* So, this function is used only for this driver.
*/
#ifdef __PO_HI_NEED_DRIVER_RTEMS_NE2000_SOCKETS
#include <sys/time.h>
#define __PO_HI_SET_SOCKET_TIMEOUT(mysocket,nsec) { struct timeval timeout; \
timeout.tv_sec = nsec; \
timeout.tv_usec = 0; \
setsockopt (mysocket, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout,sizeof (timeout)); }
#else
#define __PO_HI_SET_SOCKET_TIMEOUT(fd)
#endif
#define __PO_HI_TRANSPORT_SOCKET_NEED_RECEIVER_TASK() \
(node_port[mynode] != __PO_HI_NOPORT)
/*
......
......@@ -35,7 +35,6 @@
#define CONFIGURE_MAXIMUM_TASKS 20
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20
int POSIX_Init ();
#define CONFIGURE_MAXIMUM_POSIX_THREADS __PO_HI_NB_TASKS + 10
#define CONFIGURE_EXTRA_TASK_STACKS (20 * RTEMS_MINIMUM_STACK_SIZE)
......
......@@ -221,10 +221,10 @@ $(BINARY): generate-asn1-deployment target-objects check-rtems compile-po-hi $(U
ifeq ($(NEED_TRANSPORT), yes)
run: $(BINARY)
pidof qemu >/dev/null 2>&1 ; if [ $$? -eq 0 ]; then \
( sleep 5 ; qemu -net nic,model=ne2k_pci,vlan=1,macaddr=00:1F:C6:BF:74:93 -net socket,connect=127.0.0.1:12345 -fda $(RUNTIME_PATH)/utils/x86-rtems-boot.img -hda fat:. -boot a ; )& \
( sleep 5 ; qemu -net nic,model=ne2k_pci,macaddr=52:54:00:12:34:93 -net socket,connect=127.0.0.1:12345 -fda $(RUNTIME_PATH)/utils/x86-rtems-boot.img -hda fat:. -boot a -serial /dev/stdout ; )& \
echo "Launching QEMU in connect mode" ; \
else \
qemu -net nic,model=ne2k_pci,vlan=1,macaddr=00:1F:C6:BF:74:92 -net socket,listen=:12345 -fda $(RUNTIME_PATH)/utils/x86-rtems-boot.img -hda fat:. -boot a ; \
qemu -net nic,model=ne2k_pci,macaddr=52:54:00:12:34:92 -net socket,listen=:12345 -fda $(RUNTIME_PATH)/utils/x86-rtems-boot.img -hda fat:. -boot a -serial /dev/stdout; \
echo "Launching QEMU in listen mode" ; \
fi
else
......
......@@ -13,7 +13,7 @@
extern __po_hi_device_id socket_device_id;
extern struct rtems_bsdnet_ifconfig netdriver_config;
char __po_hi_rtems_ethernet_address[6] = { 0x00, 0x1F, 0xC6, 0xBF, 0x74, 0x06};
char __po_hi_rtems_ethernet_address[6] = { 0x52, 0x54, 0x00, 0x12, 0x34, 0x57};
extern __po_hi_inetnode_t nodes[__PO_HI_NB_DEVICES];
extern __po_hi_inetnode_t rnodes[__PO_HI_NB_DEVICES];
......
......@@ -25,6 +25,7 @@
#include <po_hi_main.h>
#include <po_hi_task.h>
#include <drivers/po_hi_driver_sockets.h>
#include <drivers/po_hi_driver_sockets_common.h>
#include <activity.h>
......@@ -164,6 +165,7 @@ void* __po_hi_sockets_poller (void)
__po_hi_node_t dev_init;
__po_hi_request_t received_request;
__po_hi_msg_t msg;
int established = 0;
max_socket = 0; /* Used to compute the max socket number, useful for listen() call */
......@@ -183,12 +185,27 @@ void* __po_hi_sockets_poller (void)
{
if (dev != socket_device_id)
{
sock = accept (nodes[socket_device_id].socket, (struct sockaddr*) &sa, &socklen);
__DEBUGMSG ("[DRIVER SOCKETS] Poller wait for connection with device %d\n", dev);
if (read (sock, &dev_init, sizeof (__po_hi_device_id)) != sizeof (__po_hi_device_id))
__PO_HI_SET_SOCKET_TIMEOUT(nodes[socket_device_id].socket,5);
established = 0;
while (established == 0)
{
__DEBUGMSG ("[DRIVER SOCKETS] Cannot read device-id for device %d, socket=%d\n", dev, sock);
continue;
sock = accept (nodes[socket_device_id].socket, (struct sockaddr*) &sa, &socklen);
__PO_HI_SET_SOCKET_TIMEOUT(sock,10);
if (read (sock, &dev_init, sizeof (__po_hi_device_id)) != sizeof (__po_hi_device_id))
{
established = 0;
__DEBUGMSG ("[DRIVER SOCKETS] Cannot read device-id for device %d, socket=%d\n", dev, sock);
}
else
{
established = 1;
}
}
__DEBUGMSG ("[DRIVER SOCKETS] read device-id %d from socket=%d\n", dev_init, sock);
rnodes[dev].socket = sock;
......
......@@ -119,7 +119,7 @@ void __po_hi_driver_sockets_common_generic_init (__po_hi_device_id id, void* (*p
if( listen( nodes[id].socket , __PO_HI_NB_ENTITIES ) < 0 )
{
#ifdef __PO_HI_DEBUG
__DEBUGMSG ("Cannot listen on socket %d\n", nodes[mynode].socket);
__DEBUGMSG ("Cannot listen on socket %d\n", nodes[id].socket);
#endif
}
......@@ -173,10 +173,12 @@ void __po_hi_driver_sockets_common_generic_init (__po_hi_device_id id, void* (*p
if (nodes[dev].socket == -1 )
{
__DEBUGMSG ("[DRIVER SOCKETS] Socket for node %d is not created", node);
__DEBUGMSG ("[DRIVER SOCKETS] Socket for dev %d is not created\n", dev);
return;
}
__DEBUGMSG ("[DRIVER SOCKETS] Socket for dev %d created, value=%d\n", dev, nodes[dev].socket);
hostinfo = gethostbyname ((char*)dev_addr);
if (hostinfo == NULL )
......@@ -207,6 +209,7 @@ void __po_hi_driver_sockets_common_generic_init (__po_hi_device_id id, void* (*p
* We try to connect on the remote host. We try every
* second to connect on.
*/
__PO_HI_SET_SOCKET_TIMEOUT(nodes[dev].socket,5);
ret = connect (nodes[dev].socket,
(struct sockaddr*) &sa ,
......@@ -220,8 +223,13 @@ void __po_hi_driver_sockets_common_generic_init (__po_hi_device_id id, void* (*p
{
__DEBUGMSG ("[DRIVER SOCKETS] Device %d cannot send his id\n", id);
}
__DEBUGMSG ("[DRIVER SOCKETS] Connection established with device %d\n", id);
break;
}
else
{
__DEBUGMSG ("connect() failed, return=%d\n", ret);
}
if (close (nodes[dev].socket))
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment