From bf28c95b75b7e092b0a909f57a006427ad42045a Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Wed, 14 Sep 2011 23:41:34 -0700 Subject: [PATCH] add additional debug messages --- drivers/net/rckemac.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/rckemac.c b/drivers/net/rckemac.c index 77659309..c00ae77e 100644 --- a/drivers/net/rckemac.c +++ b/drivers/net/rckemac.c @@ -227,6 +227,7 @@ static err_t rckemacif_output(struct netif* netif, struct pbuf* p) rckemacif->tx_write_offset = 1; packets = CLINE_PACKETS(p->tot_len + 2); + LWIP_DEBUGF(NETIF_DEBUG, ("TX packets: %d\n", packets)); read_offset = read_emac(rckemacif->num_emac, EMAC_TX_CONTROL+EMAC_TX_BUFFER_READ_OFFSET, rckemacif->core); #if 1 @@ -317,7 +318,7 @@ again: *((int*)RCCE_fool_write_combine_buffer) = 1; /* set new write offset */ - //LWIP_DEBUGF(NETIF_DEBUG, ("Update tx write offset: %d (read offset %d)\n", rckemacif->tx_write_offset, read_offset)); + LWIP_DEBUGF(NETIF_DEBUG, ("Update tx write offset: %d (read offset %d)\n", rckemacif->tx_write_offset, read_offset)); write_emac(rckemacif->num_emac, EMAC_TX_CONTROL+EMAC_TX_BUFFER_WRITE_OFFSET, rckemacif->core, rckemacif->tx_write_offset); #if ETH_PAD_SIZE @@ -335,7 +336,7 @@ static void rckemacif_input(struct netif* netif, struct pbuf* p) err_t err; /* points to packet payload, which starts with an Ethernet header */ - ethhdr = p->payload; + ethhdr = (struct eth_hdr *) p->payload; switch (htons(ethhdr->type)) { /* IP or ARP packet? */ @@ -364,7 +365,7 @@ static void rckemacif_rx_handler(struct netif* netif, unsigned int write_offset) unsigned short read_offset = rckemacif->rx_read_offset; volatile void *addr = NULL; uint16_t i, length = 0; - struct pbuf *p; + struct pbuf *p = NULL; struct pbuf* q; if (write_offset > rckemacif->rx_buffer_max) { @@ -476,7 +477,6 @@ out: #if ETH_PAD_SIZE pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */ #endif - rckemacif_input(netif, p); LINK_STATS_INC(link.recv); } else { LWIP_DEBUGF(NETIF_DEBUG, ("rckemacif_rx_inthandler: not enough memory!\n")); @@ -490,6 +490,11 @@ rxDone: write_emac(rckemacif->num_emac, EMAC_RX_CONTROL + EMAC_RX_BUFFER_READ_OFFSET, rckemacif->core, read_offset); rckemacif->rx_read_offset = read_offset; + if (p) { + rckemacif_input(netif, p); + p = NULL; + } + if (read_offset != write_offset) goto again; }