diff --git a/.gitignore b/.gitignore index c536699..500ba0d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +*.a *.o *.cmd* *.ko* diff --git a/examples/tcpserver/tcp_connector.c b/examples/tcpserver/tcp_connector.c index adcf977..4bec32c 100644 --- a/examples/tcpserver/tcp_connector.c +++ b/examples/tcpserver/tcp_connector.c @@ -233,6 +233,16 @@ void* ServerThread(void* pvParam) /* print host-ip */ printf("Connected with client : %s\n", inet_ntoa(tSockAddr.sin_addr)); + /* NOTE: To prevent timeout on client side, as getnameinfo() may take */ + /* more time, first start client thread then retrieve host name. */ + if ( setsockopt(hClient, IPPROTO_TCP, TCP_NODELAY, (void*)&iNoDelay, sizeof(iNoDelay)) != 0 ) + { + printf("The server is not able to send small packets.\n"); + printf("So the communication could be very slow!\n"); + } + ptTcpData->hClient = hClient; + pthread_create(&ptTcpData->hClientThread, NULL,ClientThread, (void*)ptTcpData); + /* Query remote name */ if (0 == getnameinfo( (struct sockaddr *) &tSockAddr, sizeof (struct sockaddr), szHostname,NI_MAXHOST, NULL, 0, 0)) @@ -243,16 +253,6 @@ void* ServerThread(void* pvParam) { printf("Host name unknown!\n"); } - - if ( setsockopt(hClient, IPPROTO_TCP, TCP_NODELAY, (void*)&iNoDelay, sizeof(iNoDelay)) != 0 ) - { - printf("The server is not able to send small packets.\n"); - printf("So the communication could be very slow!\n"); - } - - ptTcpData->hClient = hClient; - pthread_create(&ptTcpData->hClientThread, NULL,ClientThread, (void*)ptTcpData); - } } } diff --git a/libcifx/netx_tap/netx_tap.c b/libcifx/netx_tap/netx_tap.c index 023551c..43283b9 100644 --- a/libcifx/netx_tap/netx_tap.c +++ b/libcifx/netx_tap/netx_tap.c @@ -264,19 +264,10 @@ void* cifxeth_create_device(NETX_ETH_DEV_CFG_T* config) /* Device successfully created */ OS_EnterLock( g_eth_list_lock); - if ((internal_dev = OS_Memalloc( sizeof(internal_dev))) != NULL) - { - TAILQ_INSERT_TAIL( &s_DeviceList, internal_dev, lentry); - ret = internal_dev; - } + TAILQ_INSERT_TAIL( &s_DeviceList, internal_dev, lentry); + ret = internal_dev; OS_LeaveLock( g_eth_list_lock); - if(NULL == ret) - { - if(g_ulTraceLevel & TRACE_LEVEL_ERROR) - { - USER_Trace( internal_dev->devinst, TRACE_LEVEL_ERROR, "Ethernet-IF Error: Not enough memory to create cifx virtual ethernet interface!"); - } - } + return ret; } } } @@ -289,6 +280,12 @@ void* cifxeth_create_device(NETX_ETH_DEV_CFG_T* config) { cifxeth_delete_device( internal_dev); } + } else + { + if(g_ulTraceLevel & TRACE_LEVEL_ERROR) + { + USER_Trace( internal_dev->devinst, TRACE_LEVEL_ERROR, "Ethernet-IF Error: Not enough memory to create cifx virtual ethernet interface!"); + } } channel_no++; } diff --git a/uio_netx/uio_netx.c b/uio_netx/uio_netx.c index 5f7e9bc..f82a77e 100644 --- a/uio_netx/uio_netx.c +++ b/uio_netx/uio_netx.c @@ -566,6 +566,9 @@ static struct pci_device_id netx_pci_ids[] = { { 0, } }; +/* publish PCI ids, to provide automatic load for known PCI cards */ +MODULE_DEVICE_TABLE(pci, netx_pci_ids); + static struct pci_driver netx_pci_driver = { .name = "netx", .id_table = netx_pci_ids,