From patchwork Thu Aug 20 22:49:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348683 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=LqW4w+Ps; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BXg5x2Q0cz9sPB for ; Fri, 21 Aug 2020 08:57:41 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id A689C22FD5; Thu, 20 Aug 2020 22:57:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SNRAw5NqIBFq; Thu, 20 Aug 2020 22:57:26 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 5239824F8D; Thu, 20 Aug 2020 22:51:28 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2A745C08A6; Thu, 20 Aug 2020 22:51:28 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9E70EC0051 for ; Thu, 20 Aug 2020 22:51:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 8CF158857E for ; Thu, 20 Aug 2020 22:51:26 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ikCumEK5kYxF for ; Thu, 20 Aug 2020 22:51:24 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by whitealder.osuosl.org (Postfix) with ESMTPS id F29218858F for ; Thu, 20 Aug 2020 22:50:37 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id p37so65872pgl.3 for ; Thu, 20 Aug 2020 15:50:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6MwFrFjex2QKEHDtxRl1AlmhjLbVEEXRaxTf0hEtjvE=; b=LqW4w+PsDeVfVlf2x7EfkBj7gAeo7QD7mnEnVpIVhmHybW8uWkq3+/41kP47lrpr7r 20A+HoecPqPae9qoBXBCB7cKPY/i9Xq8bCnQ0liSZAEQrKzXhiZ5eOpxn2Jc4oyJjHiI VhSo69nqaFYU+mDPsbRpLFwlKvNwKxyTVQ6wgEcXPnCwFrWj0vge/GrKUtj9oUbLE07E bNGhHTHtDw/dtufTmwwd+rRU0KYi0BO6Pdj9onGPcK/AThs7hZyLC8xOYncWT3+7YB5e 4bbxUiqirOYxuK34QSF+sJH6YBTsKwWhDsPpBSwhKFHK2lSs0FYndRcuDtblsYXfJM1g Zcvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6MwFrFjex2QKEHDtxRl1AlmhjLbVEEXRaxTf0hEtjvE=; b=VFwrKe8nw7XD9+0nIsKcMY/F2wwqimkxT1tMHhJy+2/0rHWZlHVbRGfpS55RHCf82e cJqM/yo5a+estRCol+SEFz8zWLa2VPMyoXjoi4UGt5bn3aX8YCNHzqrD5rHfmw9d0HtI EABFyZrbknaLs/gOR3elwiL83RfVO4riCZSu1xtbskqfQ22vW2BQ3KEnhrwZtrDOfn3g sjugdtRH7wUqVmVTVMC8uu2X0tVJZae2z3aexl0xYoxiBhiA3YfG1a4GlD52kiPiNah8 qAQs5RKUt6BBUXprXm5xzUcKx+F8/FLeIUSC5nbXYMr5JA0mXV2ZmIcCyspixyCRU/5z /1fg== X-Gm-Message-State: AOAM532JzlTDx81C/i2t6MxtyP8LB+jP8iTjK/AlKutAGHa1T08g0rwr ygd7P5fZ9sbq3WCyHNOPpPgnaj/EYmUu9g== X-Google-Smtp-Source: ABdhPJz5iQJ3X8n89I5KtZvpvpDbDuTWiy4w7R8N4nqjyF9YBKSaaimMl9JbyYU/td+MqHbw2auXqQ== X-Received: by 2002:a63:488:: with SMTP id 130mr241135pge.92.1597963836755; Thu, 20 Aug 2020 15:50:36 -0700 (PDT) Received: from gizo.domain (97-115-99-106.ptld.qwest.net. [97.115.99.106]) by smtp.gmail.com with ESMTPSA id y6sm116866pfr.61.2020.08.20.15.50.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:35 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:47 -0700 Message-Id: <1597963790-12362-21-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597963790-12362-1-git-send-email-gvrose8192@gmail.com> References: <1597963790-12362-1-git-send-email-gvrose8192@gmail.com> Cc: "Jason A. Donenfeld" Subject: [ovs-dev] [PATCH 20/23] datapath: use skb_list_walk_safe helper for gso segments X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: "Jason A. Donenfeld" Upstream commit: commit 2cec4448db38758832c2edad439f99584bb8fa0d Author: Jason A. Donenfeld Date: Mon Jan 13 18:42:29 2020 -0500 net: openvswitch: use skb_list_walk_safe helper for gso segments This is a straight-forward conversion case for the new function, keeping the flow of the existing code as intact as possible. Signed-off-by: Jason A. Donenfeld Signed-off-by: David S. Miller Cc: Jason A. Donenfeld Signed-off-by: Greg Rose --- datapath/datapath.c | 11 ++++------- datapath/linux/compat/include/linux/skbuff.h | 7 +++++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index deffb3a..4b71e2c 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -343,8 +343,7 @@ static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb, } #endif /* Queue all of the segments. */ - skb = segs; - do { + skb_list_walk_safe(segs, skb, nskb) { *OVS_CB(skb) = ovs_cb; #ifdef HAVE_SKB_GSO_UDP if (gso_type & SKB_GSO_UDP && skb != segs) @@ -354,17 +353,15 @@ static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb, if (err) break; - } while ((skb = skb->next)); + } /* Free all of the segments. */ - skb = segs; - do { - nskb = skb->next; + skb_list_walk_safe(segs, skb, nskb) { if (err) kfree_skb(skb); else consume_skb(skb); - } while ((skb = nskb)); + } return err; } diff --git a/datapath/linux/compat/include/linux/skbuff.h b/datapath/linux/compat/include/linux/skbuff.h index 6d248b3..204ce54 100644 --- a/datapath/linux/compat/include/linux/skbuff.h +++ b/datapath/linux/compat/include/linux/skbuff.h @@ -487,4 +487,11 @@ static inline __u32 skb_get_hash_raw(const struct sk_buff *skb) } #endif +#ifndef skb_list_walk_safe +/* Iterate through singly-linked GSO fragments of an skb. */ +#define skb_list_walk_safe(first, skb, next_skb) \ + for ((skb) = (first), (next_skb) = (skb) ? (skb)->next : NULL; (skb); \ + (skb) = (next_skb), (next_skb) = (skb) ? (skb)->next : NULL) +#endif + #endif