Kernel timers...delay not introduced after 9th ack

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
      I'm using a 2.2.14 kernel and I tried using the timer_list structure
 to introduce a delay of 10ms for just one acknowledgement, well
 actually it failed and the kernel went into a "kernel panic" state.
 After goin through some of the mailing list I found that kernel timers
 in 2.2 series kernel are bugs prone...is there any solution to solve
 this problem.

I'm sending the code which I've modified and I'll also
explain the problem that Iam facing.

CODE:

struct timer_list ack_delay_timer;


//This Function is ADDED BY ME....
void xt_tcp_send_ack(unsigned long x)
{
 struct localcopysk=(struct sock *)x;
tcp_send_ack(localcopysk);
}


//BUILT IN.........SOME PART MODIFIED BY ME..I'VE MARKED
//THOSE PARTS

/*
 * Check if sending an ack is needed.
 */
static __inline__ void __tcp_ack_snd_check(struct sock
*sk)
{
int i=0;
struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp);

/* This also takes care of updating the window.
* This if statement needs to be simplified.
*
* Rules for delaying an ack:
*      - delay time <= 0.5 HZ
*      - we don't have a window update to send
*      - must send at least every 2 full sized
packets
* - must send an ACK if we have any out of order
data
*
* With an extra heuristic to handle loss of packet
* situations and also helping the sender leave slow
* start in an expediant manner.
*/

/* Two full frames received or... */
if (((tp->rcv_nxt - tp->rcv_wup) >= tp->rcv_mss *
MAX_DELAY_ACK) ||
   /* We will update the window "significantly"
or... */
   tcp_raise_window(sk) ||
   /* We entered "quick ACK" mode or... */
   tcp_in_quickack_mode(tp) ||
   /* We have out of order data */
   (skb_peek(&tp->out_of_order_queue) != NULL)) {
pkt_count++; //ADDED BY ME TILL ELSE PART

if(pkt_count<10)
{
tcp_send_ack(sk);
}else if(pkt_count == 10)
{
/* Then ack it now */
            init_timer(&ack_delay_timer);
            ack_delay_timer.function=xt_tcp_send_ack;
            ack_delay_timer.data=(unsigned long)sk;
            ack_delay_timer.expires=jiffies + HZ
            add_timer(&ack_delay_timer);
} else if(pkt_count > 10)
{
 tcp_send_ack(sk);
}else {
/* Else, send delayed ack. */
tcp_send_delayed_ack(tp, HZ/2);
      }
}
}

static __inline__ void tcp_ack_snd_check(struct sock
*sk)
{
struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp);
if (tp->delayed_acks == 0) {
/* We sent a data segment already. */
return;
}
__tcp_ack_snd_check(sk);
}

ISSUE:
I'm trying to introduce a delay of 1 sec after the 9th acknowledgement
so that the 10th acknowledgements is sent after 1 sec. The
modifications that I have made to the kernel has got compiled, but I
don see a delay of 1 second after the 9th acknowledgement. Can any one
tell me the reason for my code not working, and also I need to extend
this code for using multiple timers......plz help me!!!!!


regards
Pradeep.A

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux