found it. DMA can obviously not handle fragmented pbufs to receive packets. -> debug cleanup needed

This commit is contained in:
Ulrich Mohr 2024-08-22 18:14:51 +02:00
parent 497e380860
commit ae47ca8291
5 changed files with 37 additions and 3 deletions

View File

@ -166,7 +166,7 @@ a lot of data that needs to be copied, this should be set high. */
#define PBUF_POOL_SIZE 120 #define PBUF_POOL_SIZE 120
/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */ /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
#define PBUF_POOL_BUFSIZE 256 #define PBUF_POOL_BUFSIZE 2048
/** SYS_LIGHTWEIGHT_PROT /** SYS_LIGHTWEIGHT_PROT
* define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection

View File

@ -273,11 +273,20 @@ s32_t xemacpsif_input(struct netif *netif)
/* no packet could be read, silently ignore this */ /* no packet could be read, silently ignore this */
if (p == NULL) { if (p == NULL) {
outbyte('x');
return 0; return 0;
} }
/* points to packet payload, which starts with an Ethernet header */ /* points to packet payload, which starts with an Ethernet header */
ethhdr = p->payload; ethhdr = p->payload;
xil_printf(" %p",p->payload);
for (int j = 0; j < 6; j++) {
for (int i = 0; i < 8; i++) {
xil_printf(" %02x", *((uint8_t *)(p->payload) + i + j * 8 ) );
}
xil_printf("\n");
}
#if LINK_STATS #if LINK_STATS
lwip_stats.link.recv++; lwip_stats.link.recv++;
@ -298,13 +307,19 @@ s32_t xemacpsif_input(struct netif *netif)
#endif /* PPPOE_SUPPORT */ #endif /* PPPOE_SUPPORT */
/* full packet send to tcpip_thread to process */ /* full packet send to tcpip_thread to process */
if (netif->input(p, netif) != ERR_OK) { if (netif->input(p, netif) != ERR_OK) {
outbyte('y');
LWIP_DEBUGF(NETIF_DEBUG, ("xemacpsif_input: IP input error\r\n")); LWIP_DEBUGF(NETIF_DEBUG, ("xemacpsif_input: IP input error\r\n"));
pbuf_free(p); pbuf_free(p);
p = NULL; p = NULL;
} }
outbyte('o');
break; break;
default: default:
outbyte('z');
for (int i = 0; i < 14; i++) {
xil_printf(" %02x", *((uint8_t *)(p->payload) + i ) );
}
pbuf_free(p); pbuf_free(p);
p = NULL; p = NULL;
break; break;

View File

@ -115,6 +115,17 @@ volatile u32_t notifyinfo[4*XLWIP_CONFIG_N_TX_DESC];
* for BDs. The rest 768 KB of memory is just unused. * for BDs. The rest 768 KB of memory is just unused.
*********************************************************************************/ *********************************************************************************/
void printInt(int i) {
outbyte(i / 100 + 0x30);
i = i % 100;
outbyte(i / 10 + 0x30);
i = i %10;
outbyte(i + 0x30);
outbyte(10);
}
#if defined __aarch64__ #if defined __aarch64__
u8_t emac_bd_space[0x200000] __attribute__ ((aligned (0x200000))); u8_t emac_bd_space[0x200000] __attribute__ ((aligned (0x200000)));
#else #else
@ -291,6 +302,7 @@ void xemacps_process_sent_bds(xemacpsif_s *xemacpsif, XEmacPs_BdRing *txring)
void emacps_send_handler(void *arg) void emacps_send_handler(void *arg)
{ {
outbyte('t');
struct xemac_s *xemac; struct xemac_s *xemac;
xemacpsif_s *xemacpsif; xemacpsif_s *xemacpsif;
XEmacPs_BdRing *txringptr; XEmacPs_BdRing *txringptr;
@ -498,6 +510,7 @@ void setup_rx_bds(xemacpsif_s *xemacpsif, XEmacPs_BdRing *rxring)
void emacps_recv_handler(void *arg) void emacps_recv_handler(void *arg)
{ {
outbyte('r');
struct pbuf *p; struct pbuf *p;
XEmacPs_Bd *rxbdset, *curbdptr; XEmacPs_Bd *rxbdset, *curbdptr;
struct xemac_s *xemac; struct xemac_s *xemac;
@ -538,10 +551,13 @@ void emacps_recv_handler(void *arg)
} }
for (k = 0, curbdptr=rxbdset; k < bd_processed; k++) { for (k = 0, curbdptr=rxbdset; k < bd_processed; k++) {
outbyte('p');
bdindex = XEMACPS_BD_TO_INDEX(rxring, curbdptr); bdindex = XEMACPS_BD_TO_INDEX(rxring, curbdptr);
p = (struct pbuf *)rx_pbufs_storage[index + bdindex]; p = (struct pbuf *)rx_pbufs_storage[index + bdindex];
xil_printf("reading bd index %i bdindex %i p %p payload %p\n", index, bdindex, p, p->payload);
/* /*
* Adjust the buffer size to the actual number of bytes received. * Adjust the buffer size to the actual number of bytes received.
*/ */
@ -550,6 +566,7 @@ void emacps_recv_handler(void *arg)
#else #else
rx_bytes = XEmacPs_BdGetLength(curbdptr); rx_bytes = XEmacPs_BdGetLength(curbdptr);
#endif #endif
printInt(rx_bytes);
pbuf_realloc(p, rx_bytes); pbuf_realloc(p, rx_bytes);
/* Invalidate RX frame before queuing to handle /* Invalidate RX frame before queuing to handle
@ -775,6 +792,8 @@ XStatus init_dma(struct xemac_s *xemac)
#endif #endif
XEmacPs_BdSetAddressRx(rxbd, (UINTPTR)p->payload); XEmacPs_BdSetAddressRx(rxbd, (UINTPTR)p->payload);
xil_printf("setting bd index %i bdindex %i p %p payload %p\n", index, bdindex, p, p->payload);
rx_pbufs_storage[index + bdindex] = (UINTPTR)p; rx_pbufs_storage[index + bdindex] = (UINTPTR)p;
} }
XEmacPs_SetQueuePtr(&(xemacpsif->emacps), xemacpsif->emacps.RxBdRing.BaseBdAddr, 0, XEMACPS_RECV); XEmacPs_SetQueuePtr(&(xemacpsif->emacps), xemacpsif->emacps.RxBdRing.BaseBdAddr, 0, XEMACPS_RECV);

View File

@ -67,7 +67,7 @@ int main(void) {
testEth(); testEth();
mission(); //mission();
} }
static void prvSetupHardware(void) { static void prvSetupHardware(void) {

View File

@ -142,7 +142,7 @@ void udp_receiver(void *arg, struct udp_pcb *pcb, struct pbuf *p,
xil_printf("%i received len: %i tot_len: %i data: ", now, p->len, p->tot_len); xil_printf("%i received len: %i tot_len: %i data: ", now, p->len, p->tot_len);
char * pointer = p->payload; char * pointer = p->payload;
for(uint8_t i = 0; i < p->len; i++) { for(uint8_t i = 0; i < p->len; i++) {
xil_printf(" %c", pointer + i); xil_printf(" %02x", *(pointer + i));
} }
xil_printf("\n"); xil_printf("\n");
} }