Open fcuzzocrea opened 2 years ago
Hi, I Agree. The update needs to be added in the driver. We will take this up.
About the packet reception, you might have don't this but just to crosscheck, please make sure that in PLIC interrupts are enabled and you have registered the handlers using MSS_MAC_set_tx_callback() etc.
The important thing to remember about MSS_MAC_receive_pkt() is that when doing the initial setup, it needs to be called multiple times to allocate the complete set of buffers. Only when all MSS_MAC_RX_RING_SIZE buffers are allocated will rx be enabled. Have a look at the sample applications to see how this is done:
/*
a receive buffer has been filled with an rx packet. */
MSS_MAC_set_tx_callback(g_test_mac, 0, packet_tx_complete_handler); MSS_MAC_set_rx_callback(g_test_mac, 0, mac_rx_callback);
/*
if(count != (MSS_MAC_RX_RING_SIZE - 1)) { MSS_MAC_receive_pkt(g_test_mac, 0, g_mac_rx_buffer + count MSS_MAC_MAX_RX_BUF_SIZE, 0, 0); } else { MSS_MAC_receive_pkt(g_test_mac, 0, g_mac_rx_buffer + count MSS_MAC_MAX_RX_BUF_SIZE, 0, -1); }
if(count != (MSS_MAC_RX_RING_SIZE - 1)) { MSS_MAC_receive_pkt(g_test_mac, 0, g_mac_rx_buffer[count], 0, 0); } else { MSS_MAC_receive_pkt(g_test_mac, 0, g_mac_rx_buffer[count], 0, -1); }
}
thanks @petermcs-01 in fact this is what fixed it yesterday in my tests :)
@nitindeshpande I sent some small fixes in a PR, would be nice to have them in the update as well :)
Sure, @fcuzzocrea :)
Ciao!
I am trying to setup a simple test of eth0 LOOPBACK (with null_phy configuration) using the baremetal driver provided in the bsp (I also sent some pull requests to fix compilation).
I am setting up mac0 in this way:
After this, according to the documentation, I created a TX and RX handler which are doing nothing but incrementing a counter (to keep is as simple as possible), and I register them.
After the registration of the handlers, I first call the MSS_MAC_receive_pkt() function, to enable the RX interrupt, and then I send a packet with the MSS_MAC_send_pkt() function.
However, the MSS_MAC_receive_pkt() function always fails to arm the rx. Looking trough the code of the function itself, it seems that status is initialized with
MSS_MAC_FAILED
https://github.com/polarfire-soc/platform/blob/48c848c6ce788e517b67aab356c1a385799b63a8/drivers/mss/mss_ethernet_mac/mss_ethernet_mac.c#L1544
But then, trough the body of the function, seems that status never get updated. How can I check if the ARM phase is done correctly ?
Thank you!!