From patchwork Fri May 14 18:39:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matteo Croce X-Patchwork-Id: 12258615 X-Patchwork-Delegate: kuba@kernel.org 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=unavailable 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 0433DC433ED for ; Fri, 14 May 2021 18:40:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D97ED6144B for ; Fri, 14 May 2021 18:40:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231847AbhENSlu (ORCPT ); Fri, 14 May 2021 14:41:50 -0400 Received: from mail-ed1-f52.google.com ([209.85.208.52]:39825 "EHLO mail-ed1-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231834AbhENSlu (ORCPT ); Fri, 14 May 2021 14:41:50 -0400 Received: by mail-ed1-f52.google.com with SMTP id h16so1363592edr.6; Fri, 14 May 2021 11:40:37 -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=Y4MTLt5TFZRdEBttrmfCcK1QF/TJDQ6Lo2hOuLadKIY=; b=GoacduemQ/+y4JnpILwBtZg0yJyHSLXxW2CKgafxfo7l8KndU5tVU3Q5+UTVeXii6I J6au3OZix4r+HjzD3iQs5S/sNj+HaOOTg0qQN9FCUh0opN1R8jTfhsKnsoEvpR3wGReU bMacm7vvLIZ5FmcLnD7SbWJo8DFCuEUyn6cvr1l/InWZFQrha2yo/2Mn2DUa9nwEwZiF vnNkQSEj2YNGOB0UgQ41GtjnZ8M6UbNYjiy7KqTPpycSIv+FFkrA9sLTUW5QzvrHf6Ab LK2X5BO+1btHxpj8zVowbudIAQtmyD9WySmBQ4jxAvIC13hbmCcmGpC5U+rrH4AMYZrQ CDbA== X-Gm-Message-State: AOAM532qfd2l4Ibt1wenDG/WPVwVZWWr1w5f9DWZIX/zVYugcZS3JHEp mUhW32tv5oUXIk5hJ25v8yHD0azBl+xrXZWB X-Google-Smtp-Source: ABdhPJztVPeeFds+ovfXgi5hiN0AM5Kzib6Wesqh/ef775Q8o65ykbVOOjTXi8FRmrOvM5b3sV8Pyw== X-Received: by 2002:aa7:de99:: with SMTP id j25mr36955284edv.91.1621017637149; Fri, 14 May 2021 11:40:37 -0700 (PDT) Received: from turbo.teknoraver.net (net-5-94-253-60.cust.vodafonedsl.it. [5.94.253.60]) by smtp.gmail.com with ESMTPSA id dj17sm5081505edb.7.2021.05.14.11.40.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 11:40:36 -0700 (PDT) From: Matteo Croce To: netdev@vger.kernel.org, bpf@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-stm32@st-md-mailman.stormreply.com, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Cc: linux-kernel@vger.kernel.org, Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Jakub Kicinski , Giuseppe Cavallaro , Alexandre Torgue , "Michael S. Tsirkin" , Jason Wang Subject: [PATCH net-next 1/3] stmmac: use XDP helpers Date: Fri, 14 May 2021 20:39:52 +0200 Message-Id: <20210514183954.7129-2-mcroce@linux.microsoft.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210514183954.7129-1-mcroce@linux.microsoft.com> References: <20210514183954.7129-1-mcroce@linux.microsoft.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Matteo Croce Make use of the xdp_{init,prepare}_buff() helpers instead of an open-coded version. Signed-off-by: Matteo Croce --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 345b4c6d1fd4..bf9fe25fed69 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -5167,12 +5167,9 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) dma_sync_single_for_cpu(priv->device, buf->addr, buf1_len, dma_dir); - xdp.data = page_address(buf->page) + buf->page_offset; - xdp.data_end = xdp.data + buf1_len; - xdp.data_hard_start = page_address(buf->page); - xdp_set_data_meta_invalid(&xdp); - xdp.frame_sz = buf_sz; - xdp.rxq = &rx_q->xdp_rxq; + xdp_init_buff(&xdp, buf_sz, &rx_q->xdp_rxq); + xdp_prepare_buff(&xdp, page_address(buf->page), + buf->page_offset, buf1_len, false); pre_len = xdp.data_end - xdp.data_hard_start - buf->page_offset; From patchwork Fri May 14 18:39:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matteo Croce X-Patchwork-Id: 12258617 X-Patchwork-Delegate: kuba@kernel.org 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 832F4C433B4 for ; Fri, 14 May 2021 18:41:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6677B61444 for ; Fri, 14 May 2021 18:41:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230272AbhENSmN (ORCPT ); Fri, 14 May 2021 14:42:13 -0400 Received: from mail-ed1-f54.google.com ([209.85.208.54]:41570 "EHLO mail-ed1-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230142AbhENSmN (ORCPT ); Fri, 14 May 2021 14:42:13 -0400 Received: by mail-ed1-f54.google.com with SMTP id v5so24657859edc.8; Fri, 14 May 2021 11:41:00 -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=1j2CjgQxW57TkMOuAnVDHfqnEQcNfSuPJZQGVnmFSJA=; b=J8SMDuIRqXr9SC70H4mBfVAZ6k0wG7OdjWzxZbQWdffM5RESayj0lPgPGpPd6P7Gig dNqcrduAMDxcFoLamWORRV5y5c04QJ+ws/a3fYz6+qaadamtaP591rf8vVL71KyVuYM4 q1oK2o8ddyG5CH6fCSMQ3Xs9ZxneQ4gjjE79W6NDMu/Y9h/5GgwRSPkh0XCIoqYMl71k 5d6Q1tRu61Wkd2XUxGkkMfcl1NXQKoQ+qTAJvoBG+ajK9pxSzGkoqJdjTu2pPYDosASJ XI80+PSwrLcaGhSpngz6OdwiTKelh5mVHLZpROjYNZK8ZRdGYFAIWSao+k+j/1z2US2A 90UA== X-Gm-Message-State: AOAM533OXL3OrH13PRqCueKGpXuOmZi8rOQIQNmWTgkK78o/m94EjGog XoP8Xn9gEKKARpS2palnQA0e8ot6Yr1vUWjZ X-Google-Smtp-Source: ABdhPJyxTNKn6+GyJPbWrzuE82v4D4fgdRH1Pr1QrTsEjU4XnM0G1aa5z5Rgrt8LmwOzr3dkOMs5Pw== X-Received: by 2002:a50:9f6b:: with SMTP id b98mr6260005edf.318.1621017659634; Fri, 14 May 2021 11:40:59 -0700 (PDT) Received: from turbo.teknoraver.net (net-5-94-253-60.cust.vodafonedsl.it. [5.94.253.60]) by smtp.gmail.com with ESMTPSA id dj17sm5081505edb.7.2021.05.14.11.40.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 11:40:59 -0700 (PDT) From: Matteo Croce To: netdev@vger.kernel.org, bpf@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-stm32@st-md-mailman.stormreply.com, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Cc: linux-kernel@vger.kernel.org, Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Jakub Kicinski , Giuseppe Cavallaro , Alexandre Torgue , "Michael S. Tsirkin" , Jason Wang Subject: [PATCH net-next 2/3] igc: use XDP helpers Date: Fri, 14 May 2021 20:39:53 +0200 Message-Id: <20210514183954.7129-3-mcroce@linux.microsoft.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210514183954.7129-1-mcroce@linux.microsoft.com> References: <20210514183954.7129-1-mcroce@linux.microsoft.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Matteo Croce Make use of the xdp_{init,prepare}_buff() helpers instead of an open-coded version. Signed-off-by: Matteo Croce --- drivers/net/ethernet/intel/igc/igc_main.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index 069471b7ffb0..92c0701e2a36 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -2151,12 +2151,9 @@ static int igc_clean_rx_irq(struct igc_q_vector *q_vector, const int budget) } if (!skb) { - xdp.data = pktbuf + pkt_offset; - xdp.data_end = xdp.data + size; - xdp.data_hard_start = pktbuf - igc_rx_offset(rx_ring); - xdp_set_data_meta_invalid(&xdp); - xdp.frame_sz = truesize; - xdp.rxq = &rx_ring->xdp_rxq; + xdp_init_buff(&xdp, truesize, &rx_ring->xdp_rxq); + xdp_prepare_buff(&xdp, pktbuf - igc_rx_offset(rx_ring), + igc_rx_offset(rx_ring) + pkt_offset, size, false); skb = igc_xdp_run_prog(adapter, &xdp); } From patchwork Fri May 14 18:39:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matteo Croce X-Patchwork-Id: 12258619 X-Patchwork-Delegate: kuba@kernel.org 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 8BA01C433B4 for ; Fri, 14 May 2021 18:41:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6C09C61444 for ; Fri, 14 May 2021 18:41:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231368AbhENSm2 (ORCPT ); Fri, 14 May 2021 14:42:28 -0400 Received: from mail-ej1-f46.google.com ([209.85.218.46]:36488 "EHLO mail-ej1-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230142AbhENSm2 (ORCPT ); Fri, 14 May 2021 14:42:28 -0400 Received: by mail-ej1-f46.google.com with SMTP id c20so127971ejm.3; Fri, 14 May 2021 11:41:15 -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=gPu3JhIKExQczwKARwj2go99YLQAcb+tX8q8d0+CLrs=; b=IRhnxiNFs4rhtOcDPhilDB/M7RDi1YjJ7fRyPHpVEV0TDpsuwQud3UAKsOx8MJYmPT pBInW92wCHW6xfynwJR6Om+PYyaTgZC2m0WsvekjVOMamctBCOvsKDMuxqN8Ln2nzaCN qhEu6FbfKTt1orfjEOx/LHRz6zITZm1/jYlRXhLgEVf6klZLmTmOjrkcP+3Tw5CQswRD BZWrhqSegQE+J3M4MLPsZOMlLd9z+0+NgKeH7pnM+KlGxJMgKiZTgcZBPOSnviCoYWbx SHq8tU/f8k1XwjQ0klzouPCKPabsPL4LPXVDJx4vXNSnRyCTa/F0SU6VfmO900/VXFM7 2CPQ== X-Gm-Message-State: AOAM5331ZeMcroTGnlUHqukhEVO75QKvKYZxoOWEsCvBA6n0Bc5XXaSH fFUoP8o4A/P9ts4zpqoXiY/vC4rP82i3bg0y X-Google-Smtp-Source: ABdhPJw/bzz+edLEyA47WDc1rrEAXftvdXlwn8/p6LzoZoO4/o+QryD11sVkSt7P+ExsEP3oTa1Mxg== X-Received: by 2002:a17:906:6a93:: with SMTP id p19mr50865392ejr.319.1621017675225; Fri, 14 May 2021 11:41:15 -0700 (PDT) Received: from turbo.teknoraver.net (net-5-94-253-60.cust.vodafonedsl.it. [5.94.253.60]) by smtp.gmail.com with ESMTPSA id dj17sm5081505edb.7.2021.05.14.11.41.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 11:41:14 -0700 (PDT) From: Matteo Croce To: netdev@vger.kernel.org, bpf@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-stm32@st-md-mailman.stormreply.com, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Cc: linux-kernel@vger.kernel.org, Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Jakub Kicinski , Giuseppe Cavallaro , Alexandre Torgue , "Michael S. Tsirkin" , Jason Wang Subject: [PATCH net-next 3/3] vhost_net: use XDP helpers Date: Fri, 14 May 2021 20:39:54 +0200 Message-Id: <20210514183954.7129-4-mcroce@linux.microsoft.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210514183954.7129-1-mcroce@linux.microsoft.com> References: <20210514183954.7129-1-mcroce@linux.microsoft.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Matteo Croce Make use of the xdp_{init,prepare}_buff() helpers instead of an open-coded version. Also, the field xdp->rxq was never set, so pass NULL to xdp_init_buff() to clear it. Signed-off-by: Matteo Croce --- drivers/vhost/net.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index df82b124170e..6414bd5741b8 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -744,11 +744,9 @@ static int vhost_net_build_xdp(struct vhost_net_virtqueue *nvq, if (copied != len) return -EFAULT; - xdp->data_hard_start = buf; - xdp->data = buf + pad; - xdp->data_end = xdp->data + len; + xdp_init_buff(xdp, buflen, NULL); + xdp_prepare_buff(xdp, buf, pad, len, true); hdr->buflen = buflen; - xdp->frame_sz = buflen; --net->refcnt_bias; alloc_frag->offset += buflen;