[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpW+bnMG+43cyMJuLYCqEKM4jk5LbxGtsHFOFY=Ha7nZfA@mail.gmail.com>
Date: Mon, 17 Jun 2019 14:18:01 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: John Hurley <john.hurley@...ronome.com>
Cc: Linux Kernel Network Developers <netdev@...r.kernel.org>,
David Miller <davem@...emloft.net>,
Jiri Pirko <jiri@...lanox.com>,
Davide Caratti <dcaratti@...hat.com>,
Simon Horman <simon.horman@...ronome.com>,
Jakub Kicinski <jakub.kicinski@...ronome.com>,
oss-drivers@...ronome.com
Subject: Re: [PATCH net-next v2 1/3] net: sched: add mpls manipulation actions
to TC
On Fri, Jun 14, 2019 at 3:56 PM John Hurley <john.hurley@...ronome.com> wrote:
>
> On Fri, Jun 14, 2019 at 5:59 PM Cong Wang <xiyou.wangcong@...il.com> wrote:
> >
> > On Thu, Jun 13, 2019 at 10:44 AM John Hurley <john.hurley@...ronome.com> wrote:
> > > +static inline void tcf_mpls_set_eth_type(struct sk_buff *skb, __be16 ethertype)
> > > +{
> > > + struct ethhdr *hdr = eth_hdr(skb);
> > > +
> > > + skb_postpull_rcsum(skb, &hdr->h_proto, ETH_TLEN);
> > > + hdr->h_proto = ethertype;
> > > + skb_postpush_rcsum(skb, &hdr->h_proto, ETH_TLEN);
> >
> > So you just want to adjust the checksum with the new ->h_proto
> > value. please use a right csum API, rather than skb_post*_rcsum().
> >
>
> Hi Cong,
> Yes, I'm trying to maintain the checksum value if checksum complete
> has been set.
> The function above pulls the old eth type out of the checksum value
> (if it is checksum complete), updates the eth type, and pushes the new
> eth type into the checksum.
> This passes my tests on the checksum.
> I couldn't see an appropriate function to do this other than
> recalculating the whole thing.
> Maybe I missed something?
I never say it is wrong, I mean to say using a csum API is more
clear. Please look into checksum API's, there are many options
for different scenarios, there must be one serves your purpose.
Thanks.
Powered by blists - more mailing lists