尿频尿急尿不尽吃什么药效果最好| 男朋友发烧该说些什么| 什么是伤官见官| 诺五行属什么| 空调的几匹是什么意思| 什么现象说明奶吸通了| 吃小米粥有什么好处和坏处| 中国第一长洞是什么| 摩羯男喜欢什么类型的女生| 胃炎胃溃疡吃什么药| 马拉色菌毛囊炎用什么药治疗最好| 咖啡有什么作用| 做梦烧纸钱什么意思| 洋盘是什么意思| 九岁属什么生肖| 你说什么| 房间隔缺损是什么意思| 发热出汗是什么原因| 中医康复技术学什么| 清朝什么时候建立| 成都市市长是什么级别| 歇后语是什么意思| 为什么要小心AB型血的人| 脓毒血症是什么病| 煲电话粥什么意思| 花生不能和什么食物一起吃| ldpe是什么材料| 曼珠沙华是什么意思| 唾液腺是什么组织| 2月2号是什么星座| 五花大绑是什么意思| 脑梗吃什么鱼最好| 小腿肚酸胀是什么原因| 摄取是什么意思| 山炮是什么意思| 什么人适合吃蛋白质粉| 腹泻肚子疼吃什么药| 什么食物含叶酸| 男生为什么会遗精| 抑郁症吃的药叫什么| 海底椰是什么东西| 酸梅汤不适合什么人喝| 创伤弧菌用什么抗生素| 早上流鼻血是什么原因| 总是低烧是什么原因造成的| 半胱氨酸是什么| 寒热往来什么意思| 拔智齿后吃什么消炎药| 仙草是什么| 猪筒骨配什么炖汤好| 为什么会打哈欠| hpv52高危阳性是什么意思| 凉面用的是什么面条| 共济失调是什么病| 654-2是什么药| 步后尘是什么意思| 早上起来手麻是什么原因| 饮食男女是什么意思| 瓜蒌是什么东西| 太抽象了是什么意思| 金今念什么| 睾丸突然疼痛什么原因| 为什么长火疖子| 诺贝尔奖为什么没有数学奖| 什么他妈的叫他妈的惊喜| 什么头什么颈| 妊高症是什么意思| 说话不清楚是什么原因导致的| 杜甫被称为什么| 农历五月是什么星座| 初检检查什么| 射手座和什么座最配| 站着说话不腰疼是什么意思| 干咳吃什么食物好| 西洋参有什么用| 孛儿只斤现在姓什么| 夜尿频繁是什么原因| 干事是什么职务| 沙葱是什么| 皮肤属于什么系统| 化疗是什么意思| 嗓子总有痰吃什么药| 元气大伤什么意思| 苍蝇馆子什么意思| 劫富济贫是什么意思| 女人的网名叫什么好听| 来姨妈头疼是什么原因| 五行属性是什么| 半夜胎动频繁是什么原因| 头孢过敏什么症状| 阴离子是什么| 小狗得细小是什么症状| 阙是什么意思| 狗狗流眼泪是什么原因| 天蝎座男和什么星座最配| 马跟什么生肖最配| 为什么会有口臭| 阴茎供血不足吃什么药| 领袖是什么意思| 荷叶茶有什么功效和作用| sansay是什么牌子| 帛书是什么意思| 书到用时方恨少下一句是什么| 上呼吸道感染吃什么中成药| 上坟用什么水果| 口臭什么原因| 红茶加枸杞有什么功效| 儿童急性肠胃炎吃什么药| 梦见自己和别人结婚是什么意思| 冒菜和麻辣烫有什么区别| 大肠杆菌是什么意思| 昱怎么读音是什么| 脾胃科主要看什么| 望梅止渴是什么梅| 肝火旺是什么意思| 糖类抗原125高是什么意思| 8月29日什么星座| 1960属什么生肖| 为什么左手会发麻| 眉骨疼是什么原因| 肝内结节是什么意思啊| 排骨用什么炖好吃| 风花雪月是什么生肖| 发烧流鼻血是什么原因| 牙龈流血是什么原因| 国安局是干什么的| 病毒四项检查都有什么| 弯脚杆是什么意思| 棉绸是什么面料| 健胃消食片什么时候吃| 12岁属什么| 什么是虎牙| 梦见门坏了什么意思| 医生为什么叫大夫| 医院可以点痣吗挂什么科| 铊是什么东西| 神经性头疼是什么原因造成的| 牛油果坏了是什么样| 幽门螺杆菌什么药最好| 韧带损伤挂什么科| 尿酸高会引起什么病| 尿隐血1十是什么| 苦荞茶有什么功效| 豆腐干炒什么好吃| 续航是什么意思| 金命适合什么颜色| 拔牙之前要注意什么| 为什么要割包皮| 理工科是什么意思| 为什么微信运动总是显示步数为0| 咳嗽吃什么好得快| 表哥的孩子叫我什么| 什么是豹子号| 地中海贫血携带者是什么意思| 酥油是什么油| 贵妇是什么意思| 白细胞多是什么原因| 脱肛吃什么药| 缺钾是什么原因引起| 头孢不能和什么药一起吃| 玄学什么意思| 开拔是什么意思| 淋巴门消失是什么意思| 外阴痒用什么洗| 5月30日是什么星座| 什么叫唐氏综合症| 肺有问题挂什么科| 千山暮雪结局是什么| 拉锯战是什么意思| 宝宝病毒感染吃什么药效果好| 高职是什么学历| 大拇指指甲凹凸不平是什么原因| 什么花是紫色的| 给男朋友买什么礼物比较好| 下面痒是什么原因女性| 吃什么菜能降血糖| 头皮真菌感染用什么药| 恶心是什么原因| 白细胞酯酶弱阳性什么意思| 痛风能吃什么菜谱大全| 什么的白云| 怀孕去医院检查挂什么科| 世界上最大的湖泊是什么湖| 什么东西放进去是硬的拿出来是软的| 小孩干咳是什么原因| 十八反是什么意思| 突然尿多是什么原因| 地图鱼吃什么| 聚字五行属什么| 什么是硬下疳| EPS什么意思| 血压低挂什么科| 蜂蜜和什么食物相克| 成功的反义词是什么| negative是什么意思| 吃止痛药有什么副作用| 七月出生的是什么星座| 连坐是什么意思| 爱新觉罗是什么民族| 怀孕做糖耐是检查什么| 日加西念什么| 支气管炎是什么原因引起的| 试婚是什么意思啊| 股骨径是指胎儿什么| 痰多吃什么好| 缺心眼是什么意思| 什么什么有力| 为什么睡久了会头疼| 什么是g大调| 入木三分是什么生肖| 低压高是什么意思| 6代表什么| 多梦睡眠质量不好是什么原因| 多保重是什么意思| 人工牛黄是什么| xxoo什么意思| 为什么头朝西睡觉不好| 醉酒第二天吃什么才能缓解难受| 亚急性甲状腺炎吃什么药| 甲状腺彩超能查出什么| 为什么没人敢动景甜| 牙龈疼是什么原因| 什么叫强直性脊柱炎| 骨肉相连是什么肉| 拉条子是什么意思| 月经来了吃什么水果好| 喜用神什么意思| 晒背有什么好处| 7.4是什么星座| 什么的表达| 肺疼是什么原因| 表现手法是什么| 重庆以前叫什么| 草莓是什么季节的水果| 会厌炎是什么病| 色泽是什么意思| 不务正业是什么意思| 人民检察院是国家的什么机关| 汇字五行属什么| 小肚子痛吃什么药| 男人阴茎硬不起来是什么原因| 血虚是什么原因造成的| 眼皮老是跳是什么原因| 生是什么意思| 无为而治是什么意思| 最近有什么新闻| 腋毛变白是什么原因| 青团是用什么做的| 毛子是什么意思| 麒字五行属什么| 嘴里起泡是什么原因| 肾小球有什么作用| 无所不用其极是什么意思| 早晨起来口干舌燥是什么原因| 佛心是什么意思| 什么可以误诊为畸胎瘤| 脸色暗沉发黑是什么原因| 双肾盂是什么意思| 肺部真菌感染用什么药最好| 五行缺什么怎么算| 上大学需要准备什么| 诗情画意是什么意思| 泡妞是什么意思| 梅毒是什么病| 百度
|
|
Subscribe / Log in / New account

燕塘乳业诉风行牛奶 涉包装侵权

Ready to give LWN a try? 百度   女侠43年救起25名落水者  60岁的吴永秀在念高中时,水性就非常好,曾担任学校游泳队队长。

With a subscription to LWN, you can stay current with what is happening in the Linux and free-software community and take advantage of subscriber-only site features. We are pleased to offer you a free trial subscription, no credit card required, so that you can see for yourself. Please, join us!

By Jonathan Corbet
August 1, 2007
High-performance networking is continually faced with a challenge: local networking technologies are getting faster more quickly than processor and memory speeds. So every time that the venerable Ethernet technology provides another speed increment, networking developers must find ways to enable the rest of the system to keep up - even on fast contemporary hardware.

One recurring idea is to push more of the work into the networking hardware itself. TCP offload engines have been around since the days when systems were having trouble keeping up with 10Mb Ethernet, but that technology has always been limited in its acceptance; see this 2005 LWN article for some discussion of why. But some more restrained hardware assist techniques have been more successful; for example, TCP segmentation offload (TSO), where network adapters turn a stream of data into packets for transmission, is well supported under Linux.

Use of TSO can boost networking performance considerably. When one is dealing with thousands of packets every second, even a slight per-packet assist will add up. TSO reduces the amount of work needed to build headers and checksum the data, and it cuts down on the number of times that the driver must program operations into the network adapter. There is, however, no analogous assistance for incoming data. So, if you have two identical Linux servers with one sending a high-bandwidth stream to the other, the receiving side may be barely keeping up with the load while the transmitting side barely breaks a sweat.

Proposals for assistance for packet reception often go under the name "large receive offload" (LRO); the idea was first proposed for Linux in this OLS 2005 talk [PDF]. The initial LRO implementation used hardware features found in Neterion adapters; it never made it into the mainline and little has been heard from that direction since. The LRO idea has recently returned, though, in the form of this patch by Jan-Bernd Themann. Interestingly, the new LRO code does not require any hardware assistance at all.

With Jan-Bernd's patch, a driver must, to support LRO, fill in an LRO manager structure which looks like this:

    #include <linux/inet_lro.h>

    struct net_lro_mgr {
	struct net_device *dev;
	struct net_lro_stats stats;

	unsigned long features;

	u32 ip_summed; /* Options to be set in generated SKB in page mode */
	int max_desc; /* Max number of LRO descriptors  */
	int max_aggr; /* Max number of LRO packets to be aggregated */

	struct net_lro_desc *lro_arr; /* Array of LRO descriptors */
	/*
	 * Optimized driver functions
	 *
	 * get_skb_header: returns tcp and ip header for packet in SKB
	 */
	int (*get_skb_header)(struct sk_buff *skb, void **ip_hdr,
			      void **tcpudp_hdr, u64 *hdr_flags, void *priv);

	/*
	 * get_frag_header: returns mac, tcp and ip header for packet in SKB
	 *
	 * @hdr_flags: Indicate what kind of LRO has to be done
	 *             (IPv4/IPv6/TCP/UDP)
	 */
	int (*get_frag_header)(struct skb_frag_struct *frag, void **mac_hdr,
			       void **ip_hdr, void **tcpudp_hdr, u64 *hdr_flags,
			       void *priv);
    };

In this structure, dev is the network interface for which LRO is to be implemented; stats contains some statistics which can be queried to see how well LRO is working. The features field controls how the LRO code should feed packets into the networking stack; it has two flags defined currently:

  • LRO_F_NAPI says that the driver is NAPI compliant, and that, in particular, packets should be passed upward with netif_receive_skb().

  • LRO_F_EXTRACT_VLAN_ID is for drivers with VLAN support. This article won't go further into VLAN support for the simple reason that your editor does not understand it.

Checksum information for the final packets should go into ip_summed. The maximum number of "LRO descriptors" should be stored in max_desc. Each descriptor describes one TCP stream, so the maximum limits the number of streams for which LRO can be done simultaneously. Increasing the maximum requires more memory and will slow things a bit, since packets are matched to streams by way of a linear search. max_aggr is the maximum number of incoming packets which will be aggregated into a single, larger packet. The lro_arr array contains the descriptors for tracking streams; the driver should provide it with enough memory for at least max_desc structures or very unpleasant things are likely to happen.

Finally, there are the get_skb_header() and get_frag_header() methods. Their job is to locate the IP and TCP headers in a packet as quickly as possible. Typically a driver will only provide one of the two functions, depending on how it feeds packets into the LRO aggregation code.

A driver which receives packets in fully-completed sk_buff structures would normally pass them up directly to the network stack with netif_rx() or netif_receive_skb(). If LRO is being done, instead, the packets should be handed to:

    void lro_receive_skb(struct net_lro_mgr *lro_mgr,
		     	 struct sk_buff *skb,
		     	 void *priv);

This function will attempt to identify an LRO descriptor for the given packet, creating one if need be. Then it will try to join that packet with any others in the stream, making one large, fragmented packet. In the process, it will call the driver's get_skb_header() method, passing through the pointer given as priv. If the packet cannot be aggregated with others (it may not be a TCP packet, for example, or it could have TCP options which require it to be processed separately) it will be passed directly to the network stack. Either way, the driver can consider it delivered and move on to its next task.

Some drivers receive packets directly into memory represented by page structures, constructing the full sk_buff structure after reception. For such drivers, the interface is:

    void lro_receive_frags(struct net_lro_mgr *lro_mgr,
	 	       	   struct skb_frag_struct *frags,
			   int len, int true_size, 
			   void *priv, __wsum sum);

The LRO code will build the necessary sk_buff structure, perhaps aggregating fragments from several packets, and (sooner or later) feed the results to the network stack. It will call the driver's get_frag_header() method to locate the headers in the first element of the frags array; that method should also ensure that the packet is an IPv4 TCP packet and set LRO_IPV4 and LRO_TCP in the flags argument if so.

Combined packets will be pushed up into the network stack whenever max_aggr individual packets have been merged into them. Delaying data for too long while waiting for additional packets is not a good idea, though; occasionally packets should be sent on even if they are not as large as they could be. The function for this job is:

    void lro_flush_all(struct net_lro_mgr *lro_mgr);

It will cause all packets to sent on. A logical place for such a call might be at the end of a NAPI driver's poll() method. An individual stream can be flushed with:

    void lro_flush_pkt(struct net_lro_mgr *lro_mgr,
		       struct iphdr *iph, 
		       struct tcphdr *tcph);

This call will locate the stream associated with the given IP and TCP headers and send its accumulated data onward. It will not add any data associated with the given headers; the packet associated with those headers should have already been added with one of the receive functions if need be.

That is, for all practical purposes, the entire interface. One might well wonder how this code can improve performance, given that it is just aggregating packets which have already been received in the usual way by the driver. The answer is that it is reducing the number of packets that the network stack has to work with, cutting the per-packet overhead at higher levels in the stack. A clever driver can, using the struct page approach, also reduce the number of memory allocations required for each packet, which can be a big win. So LRO appears to be worth having, and current plans call for it to be merged in 2.6.24.

Index entries for this article
KernelDevice drivers/Network drivers
KernelNetworking


to post comments

Large receive offload

Posted Aug 4, 2007 7:59 UTC (Sat) by bgoglin (subscriber, #7800) [Link]

> The initial LRO implementation used hardware features found in Neterion
> adapters; it never made it into the mainline and little has been heard from
> that direction since.

Actually, lots happened in the last year or so. First, the neterion driver (s2io) had its own LRO implementation merged in mainline for a while, since 2.6.17. Then some patches were posted to add LRO in the Myri-10G driver (myri10ge) for 2.6.19, but they got rejected because the kernel maintainers didn't want 2 driver-specific implementations, they wanted a generic LRO (what Jan-Bernd did in the end). For the same reason, the Chelsio driver (cxgb3) LRO got the same reject later.

However, this long discussion got unfair suddenly because the new NetXen driver (netxen-nic) got merged in 2.6.20 with its own LRO by mistake, which made the myri10ge and cxgb3 maintainers kind of jalous :)

Now that Jan-Bernd posted this generic LRO patch, drivers are being ported to use it. "skb-mode" drivers can take a look at the patch that Jan-Bernd posted to port the eHEA driver. "page-based" drivers can look at the myri10ge driver patch that has been posted by Andrew Gallatin. He also provided lots of useful input during Jan Bernd's rework of his initial LRO patch (which was basically only designed for eHEA, i.e. skb-mode, only certain HW-checksum features, ...).

Everybody should be happy now, at least as long as the generic LRO performance is as good as the driver-specific LRO perf. So far, only the myri10ge driver can run both the generic LRO from Jan-Bernd or its own specific LRO (not included in mainline). Andrew confirmed the performance was similar, fortunately.


Copyright © 2007, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds

狗头什么意思 什么是富贵包 身上毛发旺盛什么原因 虚荣心是什么意思 同一首歌为什么停播了
痰湿体质吃什么食物好 安全感是什么 3月1号是什么星座 木耳菜是什么菜 东是什么生肖
白起为什么被赐死 r的平方是什么意思 手术室为什么在三楼 小姐姐是什么意思 sos代表什么
胆红素偏高挂什么科 it代表什么 梦见下大雨是什么意思 lol锤石什么时候出的 10月11日是什么星座
和合是什么意思hcv8jop1ns0r.cn 美国为什么不敢动朝鲜hcv9jop4ns3r.cn 鳗鱼是什么鱼hcv9jop4ns9r.cn tfboys是什么意思hcv8jop8ns1r.cn 白细胞计数偏低是什么原因hcv8jop4ns7r.cn
size是什么意思hcv8jop6ns5r.cn 1955年是什么年hcv8jop2ns6r.cn 什么是褪黑素hcv8jop2ns9r.cn 缪斯女神什么意思chuanglingweilai.com 精神恍惚是什么意思hcv8jop7ns1r.cn
感染是什么症状hcv9jop7ns3r.cn 江西什么最出名hcv8jop1ns6r.cn 什么是玄学xianpinbao.com 大佐是什么军衔hcv9jop4ns8r.cn 椭圆脸适合什么发型男hcv8jop1ns6r.cn
皂基是什么hcv9jop6ns1r.cn 女性肾虚吃什么补最好最快weuuu.com 口腔溃疡什么症状hcv8jop7ns3r.cn 生肖龙和什么生肖最配gangsutong.com 印尼买什么比国内便宜hcv9jop4ns5r.cn
百度