Merge pull request #19 in NXY/nxdrv-linux from bugfix/minor-fixes to main

* commit '86ff0cb4f8e368d46d00bd25df2c94b8aa31ddc9':
  [#####] - Add static library builds to gitignore.
  [NXDRVLINUX-150] - Fix "virteth" device allocation error, which led to an access violation at shutdown.
  [NXDRVLINUX-149] - Fix server/client connection establishment failure due to a time consuming (>timeout on client side) call of getnameinfo().
  [NXDRVLINUX-148] - Add auto-loading of the kernel module for known PCI cards.
This commit is contained in:
Sebastian Döll 2024-03-28 11:53:48 +01:00
commit 9920bf44f1
4 changed files with 23 additions and 22 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*.a
*.o
*.cmd*
*.ko*

View File

@ -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);
}
}
}

View File

@ -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++;
}

View File

@ -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,