On Mon, Jun 17, 2019 at 10:18 PM Cong Wang <xiyou.wangc...@gmail.com> wrote:
>
> On Fri, Jun 14, 2019 at 3:56 PM John Hurley <john.hur...@netronome.com> wrote:
> >
> > On Fri, Jun 14, 2019 at 5:59 PM Cong Wang <xiyou.wangc...@gmail.com> wrote:
> > >
> > > On Thu, Jun 13, 2019 at 10:44 AM John Hurley <john.hur...@netronome.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.
>

Ok, I'll have another look here and see if I can get something more appropriate.
Thanks

> Thanks.

Reply via email to