Avatar Blogs during GSoC-2025 period at RTEMS for the project - Providing SPARC GRETH Network Drivers for lwIP

Week-10 @RTEMS-GSoC-2025

Overview


This week, I completed the following tasks :

  • Developed approach for freeing pbufs associated with GRETH GBIT TX mechanism
  • Made minor changes to TX mechansim as a whole

Work completed this week


  1. Developed approach for freeing pbufs associated with GRETH GBIT TX mechanism
    • lwIP didn’t seem to have any inbuilt method to free single pbuf like m_free() in BSD networking.
    • So, I made a custom approach, using pbuf_free() from lwIP, which frees a pbuf chain starting from given head.
    • My approach jumps as much buffer descriptors as much pbufs are needed to contain that packet, and then frees that whole pbuf chain. pbuf_free_gbit_mechanism
  2. Made minor changes to TX mechansim as a whole :
    • Modified IRQs of transmission functions, making them more suitable for the purpose
    • The Transmit WRAP flag was set very early, during the buffer descriptor initialization, likewise with reception. I removed that WRAP flag setting from initialization part since it was not needed there.
  3. Error 1 : Descriptor already enabled
    • Added several debug printf() statements throughout the code
    • Faced an issue that whenever udp command, which is custom command run to execute the test, is ru in the RTEMS SIS shell, the next descriptor appears to be in use as observed from its control field set to 0x800 indicating TX_EN flagg of descriptor is set, which means the descriptor is still in use and hence, cannot be used for further transmission.
    • The code repeatedly tries to access the same descriptor, since previous atte,pt failed to use it, the descriptor pointer isn’t updated.
    • repeated_fail_of_tx
  4. Error 2 : ILLEGAL_USE_OF_FLOATING_POINT_UNIT when using printf()
    • Another issue was that I was getting ILLEGAL_USE_OF_FLOATING_POINT_UNIT when using printf() statements, this probably indicated that the thread/context in which the printf() statement as well as greth_send() ultimately was being executed, was not having floating point support.
    • repeated_fail_of_tx
    • Using iprintf() which is a version of printf() handling only integer formats helped solve this issue much faster.
  5. Error 3 : Descriptors not getting used in spite of being freed
    • In my code, first, I was setting control field of TX decsriptors to 0 (i.e. disabling them), then setting required flags in RX descriptors
    • Apparently, both the types of descriptors were getting assigned the same memory, so it was like the same descriptors are disabled tand then again enabled, since on the simulator they probably held zero value and simulator probably allocates memory starting from zero address.
    • For this I started workig on including the TX and RX channel structs under the greth_netif_state structure, as told by mentors.

Plans for next week


  1. Work on gettig expected results from GRETH lwIP driver transmission mechanism

  2. Start with reception mechanism code atleast to some extent