lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20110511.134727.957370621658043260.davem@davemloft.net>
Date:	Wed, 11 May 2011 13:47:27 -0400 (EDT)
From:	David Miller <davem@...emloft.net>
To:	oliver@...kum.org
Cc:	shemminger@...tta.com, stern@...land.harvard.edu,
	tom.leiming@...il.com, netdev@...r.kernel.org,
	linux-usb@...r.kernel.org
Subject: Re: future developments of usbnet

From: Oliver Neukum <oliver@...kum.org>
Date: Wed, 11 May 2011 19:37:47 +0200

> How is the frequency NAPI uses to poll determined? We could abuse
> this and resubmit the rx URBs only at poll time, but this feels dirty,
> because we would still leave interrupts enabled.

It's not a frequency determined internally by the networking.

It is purely event based (meaning triggered by the device's interrupt).

Control flow is:

IRQ --> irq_handler()
	my_netdevice_disable_device_irq();
	napi_schedule();
		--> schedule POLL soft irq
SOFTIRQ --> net_rx_action()
	budget = netdev_budget;
	for_each_net_device_needing_polling() {
		...
		weight = napi_state->weight;
		...
		work = n->poll(n, weight);
		...
		budget -= work;
		...
	}

That's the general idea.

Basically once you take you interrupt, and disable device interrupts,
the generic net device layer calls your ->poll() routing with a "weight"
You should not process more RX packets than this value.

If you have less than "weight" work to do, you should do a napi_complete(),
which takes you out of the polling group, and re-enable device interrupts.

So the idea is that you keep getting ->poll()'d until there is no more
RX work to do.

The "weight" argument implements fairness amongst competing, actively
polling, devices on the same CPU.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ