From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5F422461BA for ; Fri, 7 Feb 2025 10:18:20 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 358E3427B5; Fri, 7 Feb 2025 10:18:20 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 69A6D427B5 for ; Fri, 7 Feb 2025 10:18:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1738919899; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=d/1NlXjhNhz26CmuoSuEuqT1Zy790wqVQUG4c/qbcws=; b=XyywK9q26W6lnITYbAYkZex3JLPPCZbEwFNrB4IC7z6oRrLO1JJGOpRq7A/9SKlEl7fca+ jE29w04+cVTyxqr7riXv9ZdqdDGGRbqm6AcK+Oy7/1B5UxGuZcSjw5PndOpyD8/Cu/2Vjv JFwHlnsRfspo/5dVKD+B3WLz8LdCK3Q= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-376-hYwcdGY7MzaE5XqsFtm9pg-1; Fri, 07 Feb 2025 04:18:17 -0500 X-MC-Unique: hYwcdGY7MzaE5XqsFtm9pg-1 X-Mimecast-MFC-AGG-ID: hYwcdGY7MzaE5XqsFtm9pg Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-438da39bb69so14534665e9.0 for ; Fri, 07 Feb 2025 01:18:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738919896; x=1739524696; h=in-reply-to:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=d/1NlXjhNhz26CmuoSuEuqT1Zy790wqVQUG4c/qbcws=; b=icJN9jDb3bDYbvzYXFA+k42SJ+epEaC/JKUkUaHoaHyZAbgip6K7X1jHMAy3U3/PbU HmHkfqP+rOy05cZudFScmn9L53OR/WoTs/zhYVx74Qy0+sVbRz+PnPE/RikLlz8MwG+o wlvmQkU4wxyHSqC38DGkJqwkXqlWiD4dDOgNuaWM4PwpUvm6sh5zRSv2kEcxARyCIH9i JidjgZAuZ6PUHoZMsVMdQC2aVuag31edbFq5XMoMlexXHHSneg9kDfmnWf5da1X5bipv d7qVxn+cl5I1pM7EB+BCaUqDcUooBIdGRNLTEAewQDmwhL1jOVyzdptDqxciX++iXgZd GO5A== X-Forwarded-Encrypted: i=1; AJvYcCX6a4t6WuVpiXeC861JSA7M5H5y+x0tJ4Wycp4FrW9MAuPD5fEEeVkxU+d3Gk4SOCZlUpYtmFU=@dpdk.org X-Gm-Message-State: AOJu0YwYQ7PTkqki0esC//f088Anz1m9YxQUaRqDxk6QGH5Rvx9uL58v bzt2XoH3g5+8u05XAfqI/56GJcDVhuDryCHe5acTjEUv78UPykMjAcmikcMv8cJGKtS3yJHBQR+ Gad7S/U/vWoBBJipCxGtKFriAG9eGJvWbiIYna3RwTpzI X-Gm-Gg: ASbGncsAq971Df8jFx8eOccQEdSk92S+MRA2hX1id4bd4/wOBIwnK1VrNgT+17hj+TT fwHoLus+8Qe4BG/aNMsqhXLxag1cmJp/kd6nR2UL39ksf1Fu5UsboHJaZtn7seA6v5r6+MOV3s1 ejgupgYYgZYT3+DH/Y0oteSPtA50wfyWkl1WeQK8/KKBZzeS/7GeIbb0BxSWnICLY4ZnWqeMaKW dqkwkwOL+31guYl6euRc7UI2/P9rt+lbYw85IGUDbKyEBwJ2ezinOJu52U3JgvF9bkBq29zmEZu HBSnMeOdLdKfbolzqyuffxQfWlgffEc6rGU3UXDrzhd53zkzIeSycUDaNjSzJy7Jwjtj X-Received: by 2002:a05:600c:3c87:b0:438:c18c:5ad8 with SMTP id 5b1f17b1804b1-439249d189cmr20578815e9.31.1738919896050; Fri, 07 Feb 2025 01:18:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFAHgtvfN9gBaKk97AVgqjiWee1j8ewVYgpUqeMpymTz745LgH2QYQbhLq0LgvK4Mh+kY8b9Q== X-Received: by 2002:a05:600c:3c87:b0:438:c18c:5ad8 with SMTP id 5b1f17b1804b1-439249d189cmr20578585e9.31.1738919895628; Fri, 07 Feb 2025 01:18:15 -0800 (PST) Received: from ?IPV6:2a06:5900:c00c:9000:256d:904:9b40:6d8b? ([2a06:5900:c00c:9000:256d:904:9b40:6d8b]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4390daf44f3sm85383465e9.29.2025.02.07.01.18.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 07 Feb 2025 01:18:15 -0800 (PST) Message-ID: <055c94e4-948e-4f29-9625-f9de269a4d9a@redhat.com> Date: Fri, 7 Feb 2025 09:18:14 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v8 2/2] net/af_xdp: Refactor af_xdp_tx_zc To: Stephen Hemminger , Ariel Otilibili Cc: dev@dpdk.org, stable@dpdk.org, Thomas Monjalon , David Marchand , Ciara Loftus References: <20250116195640.68885-1-ariel.otilibili@6wind.com> <20250206204645.1564535-1-ariel.otilibili@6wind.com> <20250206204645.1564535-3-ariel.otilibili@6wind.com> <20250206134245.0989988f@hermes.local> From: Maryam Tahhan In-Reply-To: <20250206134245.0989988f@hermes.local> X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: joYMqjZ0qEQONXYg9v1amfP2S2XdJpr-5NNsiJAQcV0_1738919896 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="------------wC1JzjRTItKIaMaWuznply0E" Content-Language: en-US X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org This is a multi-part message in MIME format. --------------wC1JzjRTItKIaMaWuznply0E Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 06/02/2025 21:42, Stephen Hemminger wrote: > On Thu, 6 Feb 2025 21:46:45 +0100 > Ariel Otilibili wrote: > >> >> +static inline struct xdp_desc * >> +reserve_and_fill(struct pkt_tx_queue *txq, struct rte_mbuf *mbuf, >> + struct xsk_umem_info *umem, void **pkt_ptr) >> +{ >> + struct xdp_desc *desc = NULL; >> + uint64_t addr, offset; >> + uint32_t idx_tx; >> + >> + if (!xsk_ring_prod__reserve(&txq->tx, 1, &idx_tx)) >> + goto out; >> + >> + desc = xsk_ring_prod__tx_desc(&txq->tx, idx_tx); >> + desc->len = mbuf->pkt_len; >> + >> + addr = (uint64_t)mbuf - (uint64_t)umem->buffer >> + - umem->mb_pool->header_size; > addr (and the cast of mbuf) should probably be uintptr_t since the > intent is to do calculations with pointers. > I think it's ok as we would end up casting it anyway for the `struct xdp_desc` /* Rx/Tx descriptor */ struct xdp_desc {     __u64 addr;     __u32 len;     __u32 options; }; --------------wC1JzjRTItKIaMaWuznply0E Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit


On 06/02/2025 21:42, Stephen Hemminger wrote:
On Thu,  6 Feb 2025 21:46:45 +0100
Ariel Otilibili <ariel.otilibili@6wind.com> wrote:

 
+static inline struct xdp_desc *
+reserve_and_fill(struct pkt_tx_queue *txq, struct rte_mbuf *mbuf,
+		 struct xsk_umem_info *umem, void **pkt_ptr)
+{
+	struct xdp_desc *desc = NULL;
+	uint64_t addr, offset;
+	uint32_t idx_tx;
+
+	if (!xsk_ring_prod__reserve(&txq->tx, 1, &idx_tx))
+		goto out;
+
+	desc = xsk_ring_prod__tx_desc(&txq->tx, idx_tx);
+	desc->len = mbuf->pkt_len;
+
+	addr = (uint64_t)mbuf - (uint64_t)umem->buffer
+		- umem->mb_pool->header_size;
addr (and the cast of mbuf) should probably be uintptr_t since the
intent is to do calculations with pointers.

I think it's ok as we would end up casting it anyway for the `struct xdp_desc`

/* Rx/Tx descriptor */
struct xdp_desc {
    __u64 addr;
    __u32 len;
    __u32 options;
};


--------------wC1JzjRTItKIaMaWuznply0E--