[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <50C76372.7070403@intel.com>
Date: Tue, 11 Dec 2012 08:46:42 -0800
From: Alexander Duyck <alexander.h.duyck@...el.com>
To: saeed bishara <saeed.bishara@...il.com>
CC: Dmitry Kravkov <dmitry@...adcom.com>,
Joseph Gasparakis <joseph.gasparakis@...el.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"shemminger@...tta.com" <shemminger@...tta.com>,
"chrisw@...s-sol.org" <chrisw@...s-sol.org>,
"gospo@...hat.com" <gospo@...hat.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"bhutchings@...arflare.com" <bhutchings@...arflare.com>,
Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@...el.com>
Subject: Re: [PATCH v4 1/5] net: Add support for hardware-offloaded encapsulation
On 12/11/2012 12:11 AM, saeed bishara wrote:
> On Mon, Dec 10, 2012 at 9:58 PM, Dmitry Kravkov <dmitry@...adcom.com> wrote:
>>> -----Original Message-----
>>> From: saeed bishara [mailto:saeed.bishara@...il.com]
>>> Sent: Monday, December 10, 2012 12:04 PM
>>> To: Joseph Gasparakis
>>> Cc: davem@...emloft.net; shemminger@...tta.com; chrisw@...s-sol.org;
>>> gospo@...hat.com; netdev@...r.kernel.org; linux-kernel@...r.kernel.org;
>>> Dmitry Kravkov; bhutchings@...arflare.com; Peter P Waskiewicz Jr; Alexander
>>> Duyck
>>> Subject: Re: [PATCH v4 1/5] net: Add support for hardware-offloaded
>>> encapsulation
>>>
>>>> +static inline struct iphdr *inner_ip_hdr(const struct sk_buff *skb)
>>>> +{
>>>> + return (struct iphdr *)skb_inner_network_header(skb);
>>>> +}
>>>
>>> Hi,
>>> I'm a little bit bothered because of those inner_ functions, what
>>> about the following approach:
>>> 1. the skb will have a new state, that state can be outer (normal
>>> mode) and inner.
>>> 2. when you change the state to inner, all the helper functions such
>>> as ip_hdr will return the innter header.
>>>
>>> that's ofcourse the API side. the implementation may still use the
>>> fields you added to the skb.
>>>
>>> what you think?
>>> saeed
>>
>> Some drivers will probably need both inner_ and other_ in same flow, switching between two states will consume cpu cycles.
> from performance perspective, I'm not sure the switching is worse, it
> may be better as it reduces code size. please have a look at patch
> 2/5, with switching you can avoid doing the following change -> less
> code, less if-else.
> - skb_set_transport_header(skb,
> - skb_checksum_start_offset(skb));
> + if (skb->encapsulation)
> + skb_set_inner_transport_header(skb,
> + skb_checksum_start_offset(skb));
> + else
> + skb_set_transport_header(skb,
> + skb_checksum_start_offset(skb));
> if (!(features & NETIF_F_ALL_CSUM) &&
>
> I think also that from (stack) maintenance perspective, less code is better.
I don't think your argument is making much sense. With the approach we
took the switching only needs to take place in the offloaded path. If
we were to put the switching in place generically we would end up with
the code scattered all throughout the stack. In addition we will need
both the inner and outer headers to be captured in the case of an
encapsulated offload because the stack will need access to the outer
headers for routing.
My advice is if you have an idea then please just code it up, test it,
and submit a patch so that we can see what you are talking about. My
concern is that you are suggesting we come up with a generic network and
transport offset that I don't believe has been completely thought through.
Thanks,
Alex
--
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