As part of my Bachelor final project, I will work on implementing network support.
I ported a driver for the smc911x nic(Based on u-boot driver) and configured the dts. This port enables me to send and receive raw ethernet packet.
No parsing yet… I’m assessing LwIP for this purpose.
After many padding and endianess issues, LwIP now is able to send DHCP request over the network (and I think any other request, I couldn’t test). Packets are also handled over to LwIP but they are not parsed by it… Some more work to do.
Below you can see the raw packet sent by SO3 and a screenshoot of the packet captured by wireshark.
It will be easier for me to fully port LwIP into SO3 if semaphore wait (sem_down in SO3) supports timeouts. For now I’m ignoring timouts which is not optimal and could lead to undocumented behavior.
Below you can find the prototype of the Linux funciton.
int sem_timedwait(sem_t *sem, const struct timespec *abs_timeout);
Now, a new function called sem_timeddown() has been implemented and available. The second argument is the max delay expressed in ns (relatively from now).
The prototype is as follows:
int sem_timeddown(sem_t *sem, uint64_t timeout)
The function returns 0 in case of success and -1 in case of timeout.