sw_apps: call the tcp fast and slow timers in user context instead of timer interrupt context

This patch fixes the issue TCP re-transmission and data abort were noticed
in the echo server app when send/receive at high rates.
To fix this issue call the tcp fast and slow timers in the application
context instead of timer interrupt context

Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
This commit is contained in:
Kedareswara rao Appana 2014-11-20 14:27:10 +05:30 committed by Suneel Garapati
parent b3c477a161
commit 3877f190b9
3 changed files with 23 additions and 5 deletions

View file

@ -42,6 +42,8 @@
#include "xil_printf.h"
#endif
#include "lwip/tcp.h"
#if LWIP_DHCP==1
#include "lwip/dhcp.h"
#endif
@ -59,6 +61,8 @@ extern volatile int dhcp_timoutcntr;
err_t dhcp_start(struct netif *netif);
#endif
extern volatile int TcpFastTmrFlag;
extern volatile int TcpSlowTmrFlag;
static struct netif server_netif;
struct netif *echo_netif;
@ -165,6 +169,14 @@ int main()
/* receive and process packets */
while (1) {
if (TcpFastTmrFlag) {
tcp_fasttmr();
TcpFastTmrFlag = 0;
}
if (TcpSlowTmrFlag) {
tcp_slowtmr();
TcpSlowTmrFlag = 0;
}
xemacif_input(echo_netif);
transfer_data();
}

View file

@ -37,6 +37,7 @@
#include "xparameters.h"
#include "xintc.h"
#include "xil_exception.h"
#include "lwip/tcp.h"
#ifdef STDOUT_IS_16550
#include "xuartns550_l.h"
#endif
@ -49,6 +50,9 @@ void dhcp_fine_tmr();
void dhcp_coarse_tmr();
#endif
volatile int TcpFastTmrFlag = 0;
volatile int TcpSlowTmrFlag = 0;
void
timer_callback()
{
@ -59,7 +63,7 @@ timer_callback()
#if LWIP_DHCP==1
static int dhcp_timer = 0;
#endif
tcp_fasttmr();
TcpFastTmrFlag = 1;
odd = !odd;
if (odd) {
@ -68,8 +72,7 @@ timer_callback()
dhcp_timer++;
dhcp_timoutcntr--;
#endif
tcp_slowtmr();
TcpSlowTmrFlag = 1;
#if LWIP_DHCP==1
dhcp_fine_tmr();
if (dhcp_timer >= 120) {

View file

@ -79,6 +79,9 @@ static int ResetRxCntr = 0;
extern struct netif *echo_netif;
#endif
volatile int TcpFastTmrFlag = 0;
volatile int TcpSlowTmrFlag = 0;
#if LWIP_DHCP==1
volatile int dhcp_timoutcntr = 24;
void dhcp_fine_tmr();
@ -95,18 +98,18 @@ timer_callback(XScuTimer * TimerInstance)
#if LWIP_DHCP==1
static int dhcp_timer = 0;
#endif
TcpFastTmrFlag = 1;
odd = !odd;
#ifndef USE_SOFTETH_ON_ZYNQ
ResetRxCntr++;
#endif
tcp_fasttmr();
if (odd) {
#if LWIP_DHCP==1
dhcp_timer++;
dhcp_timoutcntr--;
#endif
tcp_slowtmr();
TcpSlowTmrFlag = 1;
#if LWIP_DHCP==1
dhcp_fine_tmr();
if (dhcp_timer >= 120) {