From patchwork Fri May 6 04:33:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 619138 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3r1Jmx37Phz9t3s for ; Fri, 6 May 2016 14:33:20 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=netronome-com.20150623.gappssmtp.com header.i=@netronome-com.20150623.gappssmtp.com header.b=t4wjEeh3; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750997AbcEFEdR (ORCPT ); Fri, 6 May 2016 00:33:17 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:34675 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750734AbcEFEdQ (ORCPT ); Fri, 6 May 2016 00:33:16 -0400 Received: by mail-pa0-f43.google.com with SMTP id r5so44370423pag.1 for ; Thu, 05 May 2016 21:33:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=9eQcDSTRNrNYrzEjRX0O6ZexAFjU64y29BLMXv20My4=; b=t4wjEeh3mKU1No3nULJMR0aj/LPvia5W5aE5JdemGZ8HcjFZMPKEBJ49CnCeEmav8r k6De8pEU7JjA3rdTMCQxe/LrzutYsMyhw+p//yuoOfcEzqiwHqZKPROkCM+/GDqUpUQ5 NFbm9uPIBnyOaP8NSHvKvPbKm0MkR43a1rj8rvB0wF4jVCo3cAUid5q2+NSQ/ExTaXCy PAF8dN5Ju35YwVy13VRSIYnvhsOKnRZ8zGP4PrkDfXR9Mm44VogEABlfvDs2o2qhPj2/ /z2KwE82c4SJGM6YeGoNAHplQ497pvrleVJnqGAwssytwOYRfrXnYIyF/S3qnwGI2AH6 l0HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=9eQcDSTRNrNYrzEjRX0O6ZexAFjU64y29BLMXv20My4=; b=UET26mfnAhbYWph80/wEK+OfWIKZx5EICXpCkPCjI1n7FlXvVDD8zFcW6/MDU/ij4c yatiHTbBdSHCT1RFJbu2ygTDDkPHQySaw/1vtkGStN2YiutrPlo4VSUCPk3zZnSxtZ5j Odnmo11eSEaz2bgPnt0EMi32LhMNrgQfY4wrx7VNNFXJrsD4WU+p0BIynQtkvCpk+hlP Gt05b9J7xRL9/amCeh6aWRSuHggn6qtJXV+xC61LBIehzQevPAATDG2Z+QRdHTKqFoeE Jz3odhOTjD0AUyKwiz73GLb/9EP4kstTwld0lA1SR5bHtFhXQAeETFLfUqAF7ntfTM4N Xgrw== X-Gm-Message-State: AOPr4FXA0KLhxc00C9EH1CzJUoYtxAGIIBSGDgfqTlw/tFlJV+4NDHFnuFw372+JjjEoD8RO X-Received: by 10.66.41.43 with SMTP id c11mr25895836pal.96.1462509195004; Thu, 05 May 2016 21:33:15 -0700 (PDT) Received: from penelope.isobedori.kobe.vergenet.net (penelope-musen.kanocho.kobe.vergenet.net. [2001:470:f44f:404:c685:8ff:fe7c:9971]) by smtp.gmail.com with ESMTPSA id x89sm17105631pfa.87.2016.05.05.21.33.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 May 2016 21:33:14 -0700 (PDT) Date: Fri, 6 May 2016 13:33:06 +0900 From: Simon Horman To: pravin shelar Cc: Linux Kernel Network Developers , ovs dev Subject: Re: [PATCH v9 net-next 3/7] openvswitch: add support to push and pop mpls for layer3 packets Message-ID: <20160506043304.GA9342@penelope.isobedori.kobe.vergenet.net> References: <1462347393-22354-1-git-send-email-simon.horman@netronome.com> <1462347393-22354-4-git-send-email-simon.horman@netronome.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, May 05, 2016 at 10:35:52AM -0700, pravin shelar wrote: > On Wed, May 4, 2016 at 12:36 AM, Simon Horman > wrote: > > Allow push and pop mpls actions to act on layer 3 packets by teaching > > them not to access non-existent L2 headers of such packets. > > > > Signed-off-by: Simon Horman > > --- > > v9 > > * New Patch > > --- > > net/openvswitch/actions.c | 22 ++++++++++++++-------- > > 1 file changed, 14 insertions(+), 8 deletions(-) > > > > diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c > > index 879185fe183f..fe885a89f501 100644 > > --- a/net/openvswitch/actions.c > > +++ b/net/openvswitch/actions.c > > @@ -160,8 +160,10 @@ static int push_mpls(struct sk_buff *skb, struct sw_flow_key *key, > > > > skb_postpush_rcsum(skb, new_mpls_lse, MPLS_HLEN); > > > > - hdr = eth_hdr(skb); > > - hdr->h_proto = mpls->mpls_ethertype; > > + if (skb->mac_len) { > can you move hdr definition to this block? Sure, sorry for overlooking that. > > + hdr = eth_hdr(skb); > > + hdr->h_proto = mpls->mpls_ethertype; > > + } > > > We need to update skb checksum here. This bug is not related to your > patch. since you are changing this code can you also fix this? Yes, of course. Would something like this broken out into a patch earlier in the series resolve the problem you see? If so it looks like a similar fix is also needed for pop_mpls(). > > > if (!skb->inner_protocol) > > skb_set_inner_protocol(skb, skb->protocol); > > @@ -174,7 +176,6 @@ static int push_mpls(struct sk_buff *skb, struct sw_flow_key *key, > > static int pop_mpls(struct sk_buff *skb, struct sw_flow_key *key, > > const __be16 ethertype) > > { > > - struct ethhdr *hdr; > > int err; > > diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c index 63d29263d51a..89ad0027420a 100644 --- a/net/openvswitch/actions.c +++ b/net/openvswitch/actions.c @@ -161,6 +160,14 @@ static int push_mpls(struct sk_buff *skb, struct sw_flow_key *key, struct ethhdr *hdr; hdr = eth_hdr(skb); + + if (skb->ip_summed == CHECKSUM_COMPLETE) { + __be16 diff[] = { ~(hdr->h_proto), mpls->mpls_ethertype }; + + skb->csum = ~csum_partial((char *)diff, sizeof(diff), + ~skb->csum); + } + hdr->h_proto = mpls->mpls_ethertype; }