From patchwork Fri Apr 9 18:06:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matteo Croce X-Patchwork-Id: 418652 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFB49C433B4 for ; Fri, 9 Apr 2021 18:06:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C6D646115C for ; Fri, 9 Apr 2021 18:06:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234427AbhDISGi (ORCPT ); Fri, 9 Apr 2021 14:06:38 -0400 Received: from mail-ed1-f50.google.com ([209.85.208.50]:40956 "EHLO mail-ed1-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233332AbhDISGh (ORCPT ); Fri, 9 Apr 2021 14:06:37 -0400 Received: by mail-ed1-f50.google.com with SMTP id w23so7565257edx.7; Fri, 09 Apr 2021 11:06:23 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=HY433txR2TPxtfhAmq6V4OY/PH9A7hXTvBzJvxSGgpo=; b=ue/P7d95FaSn8T6Si7V3Av7Gj+pCN5FoDIUNXcp7UctA1Sp1mNNoX9gYad+o2ePCo0 hQN+SN8EPAXm9mPfoR6e+bNglehCIXHZvXmN+R+JwZgFyxZqO7RX2mZrrRdVatCQh69R Pq8aSjPZUblQqw0QL5f+7zrfLiMOufvc6BqIAAP2ONY4MgHHEm15v1GjWLYVfmSPIlwx RzsG3FDIvFkgVUdVBE0ujBVwyZshXzcqr6TPBgyMOFRoCyBeq980bV9Z3uAlsmKrDCcD J+nBsvpsD3WULp55OcyJwyazvWDqYl0GoxFBB6FqjRMZEQymVHQI/x7ipDFlFM5x71j+ dDtw== X-Gm-Message-State: AOAM533f/8dIipzQA0NfqkJ1DKk5LdwRO4ZX/j2/VP7Ka5AI2RWgmbHk M68XUiDLQ3+iXD1URtudaH9p4cWKIAk= X-Google-Smtp-Source: ABdhPJzU4XeBiIcjIs2Hwgf+96KOFrMiJI/+rgHKP0RCyXVVu3JT8Q2fM4K9UF49RQzylEe0IHzFOw== X-Received: by 2002:a50:e887:: with SMTP id f7mr18211092edn.107.1617991582918; Fri, 09 Apr 2021 11:06:22 -0700 (PDT) Received: from msft-t490s.teknoraver.net (net-93-66-21-119.cust.vodafonedsl.it. [93.66.21.119]) by smtp.gmail.com with ESMTPSA id k26sm1571383ejc.23.2021.04.09.11.06.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Apr 2021 11:06:22 -0700 (PDT) From: Matteo Croce To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, "David S. Miller" , Jakub Kicinski , Julia Lawall Subject: [PATCH net-next 1/3] skbuff: add helper to walk over the fraglist Date: Fri, 9 Apr 2021 20:06:03 +0200 Message-Id: <20210409180605.78599-2-mcroce@linux.microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210409180605.78599-1-mcroce@linux.microsoft.com> References: <20210409180605.78599-1-mcroce@linux.microsoft.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Matteo Croce Add an skb_for_each_frag() macro to iterate on SKB fragments. Signed-off-by: Matteo Croce --- include/linux/skbuff.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index dbf820a50a39..a8d4ccacdda5 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -1528,6 +1528,10 @@ static inline void skb_mark_not_on_list(struct sk_buff *skb) for ((skb) = (first), (next_skb) = (skb) ? (skb)->next : NULL; (skb); \ (skb) = (next_skb), (next_skb) = (skb) ? (skb)->next : NULL) +/* Iterate through skb fragments. */ +#define skb_for_each_frag(skb, __i) \ + for (__i = 0; __i < skb_shinfo(skb)->nr_frags; __i++) + static inline void skb_list_del_init(struct sk_buff *skb) { __list_del_entry(&skb->list); From patchwork Fri Apr 9 18:06:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matteo Croce X-Patchwork-Id: 418651 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 650DEC433B4 for ; Fri, 9 Apr 2021 18:06:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3A47D6115B for ; Fri, 9 Apr 2021 18:06:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234470AbhDISHE (ORCPT ); Fri, 9 Apr 2021 14:07:04 -0400 Received: from mail-ed1-f49.google.com ([209.85.208.49]:33370 "EHLO mail-ed1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234453AbhDISHD (ORCPT ); Fri, 9 Apr 2021 14:07:03 -0400 Received: by mail-ed1-f49.google.com with SMTP id w18so7637093edc.0; Fri, 09 Apr 2021 11:06:48 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=Z4sgDBLXwxEY87QxPLWCqsAiKmh0VfdIxRXwqQ8C9+k=; b=b3fVo17tF5IL4ho5V2g40OnMsRLnc8hiQYNfqryBdXvsE20oPSAbkAKc/T5KrK6MR/ OLB+ey+anMxqMLWbmDVpJ53Ttl+P5uwgPFJc6hfkhtLFqJlTpX64j5Y0Bx17gKP9B1CC Do9wAR6RXIawJ9V0DCn7mf1+RWe3G2dBDaJ7GYu5YxStRm5HJUm4zvrrgQn+R7crCsno RKYNOrt6gK+ZpAQBEktdxuPgyW598842ep1zk1mgvfzWeogwK/7fZkK0PGU5GXgWvB8X y9Ny1om6MR3507wO2Ndol1h1WRLEbNc6nY7DjCwuFvKKiVVcfy0s+ZeOBXeq3yt0u4/Q A9Pg== X-Gm-Message-State: AOAM530lcBAwxcORNxIpnOpInO2vPAMwiIvmzJYAkcRiXaowwKvQflE1 gkoNWS0Qr71VlpxehIV1xOOocz7pcBg= X-Google-Smtp-Source: ABdhPJwEUk+2l0biYLbYUC+4wXkKlCAPMzP9tXwpwn021PMMZk3NGjqhyGk3d+wmGFNJLZJnp9jJZQ== X-Received: by 2002:a05:6402:4405:: with SMTP id y5mr19075811eda.32.1617991607832; Fri, 09 Apr 2021 11:06:47 -0700 (PDT) Received: from msft-t490s.teknoraver.net (net-93-66-21-119.cust.vodafonedsl.it. [93.66.21.119]) by smtp.gmail.com with ESMTPSA id k26sm1571383ejc.23.2021.04.09.11.06.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Apr 2021 11:06:47 -0700 (PDT) From: Matteo Croce To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, "David S. Miller" , Jakub Kicinski , Julia Lawall Subject: [PATCH net-next 3/3] net: use skb_for_each_frag() in illegal_highdma() Date: Fri, 9 Apr 2021 20:06:05 +0200 Message-Id: <20210409180605.78599-4-mcroce@linux.microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210409180605.78599-1-mcroce@linux.microsoft.com> References: <20210409180605.78599-1-mcroce@linux.microsoft.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Matteo Croce Coccinelle failed with the following error: EXN: Failure("no position information") in net/core/dev.c Apply it by hand as it's trivial. Signed-off-by: Matteo Croce --- net/core/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/dev.c b/net/core/dev.c index 33ff4a944109..98deb4852151 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3505,7 +3505,7 @@ static int illegal_highdma(struct net_device *dev, struct sk_buff *skb) int i; if (!(dev->features & NETIF_F_HIGHDMA)) { - for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { + skb_for_each_frag(skb, i) { skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; if (PageHighMem(skb_frag_page(frag)))