Kernel freeze when writing e1000 driver
Phani Vadrevu
pvadrevu at gmail.com
Tue Feb 26 11:19:18 EST 2013
Hi list,
I am writing a network driver for the e1000 card. While doing the
receive part, I saw that the kernel freezes whenever it reaches the
netif_rx(skb) call. I was able to reproduce the same error when using
a bare bones driver where I hard codde the skb data.
Please see the code of that test function below. The data is that of a
TCP packet (with IP and Ethernet headers). When I load the driver into
a Virtual Machine, I see the VM process taking above 100% CPU in the
host machine. The OS does not respond to input after this. If I
comment out the netif_rx line it seems to be working fine.
Thanks,
Phani
static void test_skb(void){
unsigned char t[] =
{0x52,0x54,0x00,0x12,0x34,0x56,0x52,0x55,0x0a,0x00,0x02,0x02,0x08,0x00,0x45,0x00,0x00,0x2c,0x00,0x1c,0x00,0x00,0x40,0x06,0x62,0xa0,0x0a,0x00,0x02,0x02,0x0a,0x00,0x02,0x0f,0xc6,0x1a,0x1e,0xdb,0x4c,0x81,0x18,0x01,0x00,0x00,0x00,0x00,0x60,0x02,0x22,0x38,0x14,0x66,0x00,0x00,0x02,0x04,0x05,0xb4};
int len = 58;
struct sk_buff *skb;
skb = dev_alloc_skb (len + 2);
if (skb) {
printk("Allocated skb buffer\n");
memcpy(skb_put(skb, len), t, len);
printk("step1\n");
//skb_put(skb, len);
//skb->dev = dev;
printk("step2\n");
//skb->protocol = eth_type_trans(skb, dev);
skb->protocol = ETH_P_IP;
printk("step3\n");
skb->ip_summed = CHECKSUM_UNNECESSARY;
printk("step4\n");
//netif_rx (skb);
printk("step5\n");
}
printk(KERN_INFO"All Done");
if(skb){
dev_kfree_skb(skb);
}
}
More information about the Kernelnewbies
mailing list