kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Kernel freeze when writing e1000 driver
@ 2013-02-26 16:19 Phani Vadrevu
  2013-02-26 16:49 ` Jonathan Neuschäfer
  2013-02-26 17:01 ` Valdis.Kletnieks at vt.edu
  0 siblings, 2 replies; 3+ messages in thread
From: Phani Vadrevu @ 2013-02-26 16:19 UTC (permalink / raw)
  To: kernelnewbies

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);
        }

}

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-26 17:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-26 16:19 Kernel freeze when writing e1000 driver Phani Vadrevu
2013-02-26 16:49 ` Jonathan Neuschäfer
2013-02-26 17:01 ` Valdis.Kletnieks at vt.edu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).