2.2.14 kernel timers,,Kernel Panic

From: Pradeep Anbumani
Date: Fri May 27 2005 - 01:51:12 EST


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:
//Added by Me
struct *sock localcopy;

//This Function is ADDED BY ME....
void xt_tcp_send_ack(unsigned long x)
{
tcp_send_ack(sk);
}


//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 */
localcopy=sk;
struct timer_list ack_delay_timer;
init_timer(&ack_delay_timer);
ack_delay_timer.function=xt_tcp_send_ack;
ack_delay_timer.data=0;
ack_delay_timer.expires=jiffies + 1;
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:

In function "void xt_tcp_send_ack(unsigned long x)"
i'm calling the tcp_send_ack function which takes a
socket structure element as argument. I've declared a socket structure
as a global variable which is "struct sock *localcopy" and copied the
structure element sk to localcopy. Is this ok or alright.

then for testing purpose I've added a single timer that starts for the
11th packet, gets expired and sends an acknowledgement for the 11 th
packet, for the 12th packet normal TCP transaction takes place. These
modifications have got compiled but the system goes into kernel panic
state.

and can anybody please suggest me how to I implement multiple timers
So plz suggest me a solution 4 this problem.....

regards
Pradeep.A
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html