From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758808AbcAKIKM (ORCPT ); Mon, 11 Jan 2016 03:10:12 -0500 Received: from plane.gmane.org ([80.91.229.3]:36792 "EHLO plane.gmane.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758602AbcAKIKK (ORCPT ); Mon, 11 Jan 2016 03:10:10 -0500 X-Injected-Via-Gmane: http://gmane.org/ To: linux-kernel@vger.kernel.org From: Zang MingJie Subject: Re: [PATCH] net: preserve IP control block during GSO segmentation Date: Mon, 11 Jan 2016 15:45:57 +0800 Message-ID: <56935DB5.1030502@gmail.com> References: <145225444176.22215.2003378381077166898.stgit@zurg> <063D6719AE5E284EB5DD2968C1650D6D1CCC01BA@AcuExch.aculab.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: li414-6.members.linode.com User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.5.0 In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D1CCC01BA@AcuExch.aculab.com> Cc: dev@openvswitch.org, netdev@vger.kernel.org Cc: dev@openvswitch.org, linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/08/2016 08:13 PM, David Laight wrote: > You could set SKB_SGO_CB_OFFSET to sizeof ((skb)->cb) - sizeof (struct skb_gso_cb) > so that the end of 'cb' is always used. > (Assuming the former is a multiple of 4.) > > It might be worth using an on-stack structure passed through as a separate > parameter - it doesn't look as though it has to be queued with the skb. > (Clearly a bigger change.) I would definitely prefer the stack structure. As a kernel developer, sometime I can hardly figure out which struct current cb is without debug it, and the worst they are not documented anywhere. I can hardly know the life time of the cb types. If using a stack, things can be much easier. only an extra var to store the stack top: int cb_top; and several macro to manage the stack: SKB_CB_PUSH(skb, type) SKB_CB_POP(skb) SKB_CB_TOP(skb, type) and maybe a debug variable to store current cb type. All current cb macro can be replaced by SKB_CB_TOP. Although it is a big change, I think it worths, for both performance and maintainability