From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-x64a.google.com (mail-pl1-x64a.google.com [IPv6:2607:f8b0:4864:20::64a]) by mail.toke.dk (Postfix) with ESMTPS id 0FEC29B2F08 for ; Fri, 4 Nov 2022 04:25:59 +0100 (CET) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20210112 header.b=qtcnXuox Received: by mail-pl1-x64a.google.com with SMTP id a6-20020a170902ecc600b00186f035ed74so2624217plh.12 for ; Thu, 03 Nov 2022 20:25:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=0ERF9BHGvTUETl3abHklzhUDC9Of0VSXJSH80uF2R5E=; b=qtcnXuoxuD0Fg4rg4cv7fMqxZJY1Zim85GVkY9yhw8gShUCEg+Qh9HlP2IPaRgrCku Pjr8BZ8+zT/4gC4yT9OWDLVbQTsT39+FLTnbsJUY8KD0UOWDB/odXVpVFyw2jFMnN3X5 BIJDSt7opsL2j3+7XbCyFyRAfKjXcXwJT5w04whgHoyMesm3bIl9+SdCCgVjrRSA6oxG Iz2HLGMDLgEoVamuOksKMjJz5FGUU10WYsa6uk3HqyDGGg5yESs3MqT6G2UqCgBJKH26 bsVBbI+BFH0C0sBsxgq60GJb8+H3oeEiIrHxmRHmOE3SQLV0Sh5d5TfUiuJRDRzNt1QL JyfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0ERF9BHGvTUETl3abHklzhUDC9Of0VSXJSH80uF2R5E=; b=m7j/T94Xl2EbeccqSmwjYHsfxChvz6feVHHOPObKv6viWY5cnb6nVCYtRD8iNJn3Tv RnGQhAenAczPXiV9zDCBNkv+Q9Pmo8Up766JafFyZvEWi47ThL9SFaK9gmBu1uUiADya 36rZN2yCeJEpArNxh/LOf6UKE5UkG6fee/pb2iI6LvQg0mMJNqHpDU5gD1/Aqjfq5b39 pw8+DJvyaAVcwfKHCNKuWK5a4KWABOW3YCpkUPhHu5uifJ8wNygF5ozP/7KIddhrFIt6 wR+PdK8MQ6K4+ilrAj6hFScy9eWaK32fcTpde6UCcE2bLsMAg24vIjCfrBgyEZyiLI9z 0A8w== X-Gm-Message-State: ACrzQf1AslxVU4WhwhOg1H+R75lZBmiICNhHH2lACphSRXJjO1OCKOFM mInH6f7hBKI/AzUQzDTiCm6Guh8= X-Google-Smtp-Source: AMsMyM6orILfZB5RmRRYvSDa3p/B0DESE08HEe3icEINwzLmxliT4kIQxZGrqHAsBwr+A6ZbX+oXSmw= X-Received: from sdf.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5935]) (user=sdf job=sendgmr) by 2002:a17:90a:b791:b0:214:1440:8d8b with SMTP id m17-20020a17090ab79100b0021414408d8bmr197940pjr.4.1667532357566; Thu, 03 Nov 2022 20:25:57 -0700 (PDT) Date: Thu, 3 Nov 2022 20:25:31 -0700 In-Reply-To: <20221104032532.1615099-1-sdf@google.com> Mime-Version: 1.0 References: <20221104032532.1615099-1-sdf@google.com> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog Message-ID: <20221104032532.1615099-14-sdf@google.com> From: Stanislav Fomichev To: bpf@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Message-ID-Hash: MBMO3YNWNC2PYNMNMAJPESMRSKCGOJJY X-Message-ID-Hash: MBMO3YNWNC2PYNMNMAJPESMRSKCGOJJY X-MailFrom: 3RYZkYwMKCQYyjlmuumrk.ius3jv-notzy3jv-vxupkiz.tkz@flex--sdf.bounces.google.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, David Ahern , Jakub Kicinski , Willem de Bruijn , Jesper Dangaard Brouer , Anatoly Burakov , Alexander Lobakin , Magnus Karlsson , Maryam Tahhan , xdp-hints@xdp-project.net, netdev@vger.kernel.org X-Mailman-Version: 3.3.5 Precedence: list Subject: [xdp-hints] [RFC bpf-next v2 13/14] bnxt: Introduce bnxt_xdp_buff wrapper for xdp_buff List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: No functional changes. Boilerplate to allow stuffing more data after xdp_buff. Cc: John Fastabend Cc: David Ahern Cc: Martin KaFai Lau Cc: Jakub Kicinski Cc: Willem de Bruijn Cc: Jesper Dangaard Brouer Cc: Anatoly Burakov Cc: Alexander Lobakin Cc: Magnus Karlsson Cc: Maryam Tahhan Cc: xdp-hints@xdp-project.net Cc: netdev@vger.kernel.org Signed-off-by: Stanislav Fomichev --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 04cf7684f1b0..b2e0607a6400 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -1789,6 +1789,10 @@ static void bnxt_deliver_skb(struct bnxt *bp, struct bnxt_napi *bnapi, napi_gro_receive(&bnapi->napi, skb); } +struct bnxt_xdp_buff { + struct xdp_buff xdp; +}; + /* returns the following: * 1 - 1 packet successfully received * 0 - successful TPA_START, packet not completed yet @@ -1812,7 +1816,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, bool xdp_active = false; dma_addr_t dma_addr; struct sk_buff *skb; - struct xdp_buff xdp; + struct bnxt_xdp_buff bxbuf; u32 flags, misc; void *data; int rc = 0; @@ -1922,9 +1926,9 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, dma_addr = rx_buf->mapping; if (bnxt_xdp_attached(bp, rxr)) { - bnxt_xdp_buff_init(bp, rxr, cons, &data_ptr, &len, &xdp); + bnxt_xdp_buff_init(bp, rxr, cons, &data_ptr, &len, &bxbuf.xdp); if (agg_bufs) { - u32 frag_len = bnxt_rx_agg_pages_xdp(bp, cpr, &xdp, + u32 frag_len = bnxt_rx_agg_pages_xdp(bp, cpr, &bxbuf.xdp, cp_cons, agg_bufs, false); if (!frag_len) { @@ -1937,7 +1941,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, } if (xdp_active) { - if (bnxt_rx_xdp(bp, rxr, cons, xdp, data, &len, event)) { + if (bnxt_rx_xdp(bp, rxr, cons, bxbuf.xdp, data, &len, event)) { rc = 1; goto next_rx; } @@ -1952,7 +1956,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, bnxt_reuse_rx_agg_bufs(cpr, cp_cons, 0, agg_bufs, false); else - bnxt_xdp_buff_frags_free(rxr, &xdp); + bnxt_xdp_buff_frags_free(rxr, &bxbuf.xdp); } cpr->sw_stats.rx.rx_oom_discards += 1; rc = -ENOMEM; @@ -1983,10 +1987,10 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, goto next_rx; } } else { - skb = bnxt_xdp_build_skb(bp, skb, agg_bufs, rxr->page_pool, &xdp, rxcmp1); + skb = bnxt_xdp_build_skb(bp, skb, agg_bufs, rxr->page_pool, &bxbuf.xdp, rxcmp1); if (!skb) { /* we should be able to free the old skb here */ - bnxt_xdp_buff_frags_free(rxr, &xdp); + bnxt_xdp_buff_frags_free(rxr, &bxbuf.xdp); cpr->sw_stats.rx.rx_oom_discards += 1; rc = -ENOMEM; goto next_rx; -- 2.38.1.431.g37b22c650d-goog