RE: Need one info in netif_rx_schedule()

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

 



 
-----Original Message-----
From: kernelnewbies-bounce@xxxxxxxxxxxx [mailto:kernelnewbies-bounce@xxxxxxxxxxxx]On Behalf Of Pranjal Kumar Dutta
Sent: Tuesday, April 18, 2006 4:37 PM
To: kernelnewbies@xxxxxxxxxxxx
Subject: Need one info in netif_rx_schedule()

 
Hi,
           I need one clarification in the following networking  code in Linux MailScanner has detected a possible fraud attempt from "2.6.15.1" claiming to be MailScanner warning: numerical links are often malicious: 2.6.15.1 . The following function is called from netif_rx to enqueue a new packet (sk_buff) to be processed later by ksoftirq on NET_RX_SOFTIRQ. The *dev argument passed on is softnet_data->backlog_dev

  netif_rx_schedule(&queue->backlog_dev) where queue is of sofnet_data for the CPU.
 
 
static inline void __netif_rx_schedule(struct net_device *dev)
{
 unsigned long flags;
 local_irq_save(flags);
 dev_hold(dev);
 list_add_tail(&dev->poll_list, &__get_cpu_var(softnet_data).poll_list);
 if (dev->quota < 0)
  dev->quota += dev->weight;
 else
  dev->quota = dev->weight;
 __raise_softirq_irqoff(NET_RX_SOFTIRQ);
 local_irq_restore(flags);
}
 
Question:
=======
In the above function I am not able to understand what we are trying to achieve in  the list_add_tail. We are adding the poll_list from the backlog_dev to the poll_list of softnet_data.
Which net_devices the backlog_dev->poll_list contain? And which net_devices the softnet_data->poll_list contain ? If somebody can explain the theory behind this it would be of great help.
 
Thanks,
Pranjal  
 
IIRC, Linux kernel version 2.4.20 onwards the network subsystem has changed and is called NAPI now. So the backlog_dev was added to "struct softnet_data" for network drivers not modified for NAPI to work correctly. Any non NAPI network driver will use polling function from backlog_dev(NAPI compliant drivers have their own implementation of polling routine). And this is what is queued to global polling list in the highlighted line.
 
For more info on NAPI see:
Linux kernel source: Documentation/networking/NAPI_HOWTO.txt

[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