On Tue, 2013-05-21 at 17:26 +0300, Eliezer Tamir wrote: > Adds a new ndo_ll_poll method and the code that supports and uses it. > This method can be used by low latency applications to busy poll ethernet > device queues directly from the socket code. The ip_low_latency_poll sysctl > entry controls how many cycles to poll. Set to zero to disable.
Microseconds, not cycles. [...] > --- a/Documentation/networking/ip-sysctl.txt > +++ b/Documentation/networking/ip-sysctl.txt > @@ -19,6 +19,12 @@ ip_no_pmtu_disc - BOOLEAN > Disable Path MTU Discovery. > default FALSE > > +ip_low_latency_poll - INTEGER > + Low latency busy poll timeout. (needs CONFIG_INET_LL_RX_POLL) > + Approximate time in ms to spin waiting for packets on the device queue. us, not ms. [...] > --- /dev/null > +++ b/include/net/ll_poll.h > @@ -0,0 +1,117 @@ > +/* > + * low latency network device queue flush > + * Copyright(c) 2013 Intel Corporation. > + * Author: Eliezer Tamir > + * > + * For now this depends on CONFIG_I86_TSC CONFIG_X86_TSC [...] > +static inline bool sk_poll_ll(struct sock *sk, int nonblock) > +{ > + unsigned long end_time = TSC_MHZ * ACCESS_ONCE(sysctl_net_ll_poll) > + + get_cycles(); > + struct napi_struct *napi = sk->dev_ref; > + const struct net_device_ops *ops; > + int rc; > + > + if (!napi->dev->netdev_ops->ndo_ll_poll) > + return false; > + > + local_bh_disable(); > + > + ops = napi->dev->netdev_ops; Should be done before testing ndo_ll_poll above, so you can avoid repeating the indirections. > + while (skb_queue_empty(&sk->sk_receive_queue) && > + !time_after((unsigned long)get_cycles(), end_time)) { > + rc = ops->ndo_ll_poll(napi); > + > + if (rc == LL_FLUSH_FAILED) > + break; /* premanent failure */ [...] Typo: 'permanent'. Ben. -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked. ------------------------------------------------------------------------------ Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may _______________________________________________ E1000-devel mailing list E1000-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/e1000-devel To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired