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 E3FF0A0093; Wed, 9 Mar 2022 22:32:28 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9A3C140395; Wed, 9 Mar 2022 22:32:28 +0100 (CET) Received: from mail-pj1-f98.google.com (mail-pj1-f98.google.com [209.85.216.98]) by mails.dpdk.org (Postfix) with ESMTP id 2D5974013F for ; Wed, 9 Mar 2022 22:32:26 +0100 (CET) Received: by mail-pj1-f98.google.com with SMTP id fs4-20020a17090af28400b001bf5624c0aaso3511614pjb.0 for ; Wed, 09 Mar 2022 13:32:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:date:subject:to:message-id; bh=pTLtes1FPw5r519lD9RNAX4ioNqmc9OJ8rtnOVwH83E=; b=aUCvc03Vd4htKB4/KbXsOqGpS/IcfQkZtY+mD/pGHw6iuXlHJpT6BEVoS0EsWw1oHv /+rdCdzNDvj5sdTY9COIxwDbWGKYLFpAa8qLjSs55JMIEp5PnW2f8CufycNJKARP0IF7 UTXGPmFJIWKDdAbFaANNm0muxcyAEUtOXFhFkjIJ1FtS4duFN9FrdBCUNPa3i0FhXWaz lGFqGYpp8t1btb9FZ8ol1Dsuzt7ELsyz0Mk3PxPD1uI77sXBACZ8PVWwcIN/GZIf5qyv 5QDCA/f7sw3uca24JigktNme4m6M2pOl/C/as303f3zV25214U4xX1ETVEmL72N2eJVJ Fujg== X-Gm-Message-State: AOAM5333KGs02A8k0nukdWfmpECG/FH8b9QOjkBEbSyGkLNHzpCNJiZy pgRSEN0mcMam9NTCa8wDWZS5Z38GkfsLzCf6Ux1EkJLF8Tbr4Q== X-Google-Smtp-Source: ABdhPJxzFkth70Tv9g/+fP4zyQSK1hLqvnqy44v3KVY+B7WkyM/hMZpLpXjj8EGjRtt24rmh/Dxrp2XMKwQp X-Received: by 2002:a17:902:b28a:b0:151:bbc9:ec1c with SMTP id u10-20020a170902b28a00b00151bbc9ec1cmr1773737plr.13.1646861546139; Wed, 09 Mar 2022 13:32:26 -0800 (PST) Received: from optima.cs.arizona.edu (optima.cs.arizona.edu. [192.12.69.5]) by smtp-relay.gmail.com with ESMTPS id y2-20020a17090264c200b00151f79afd17sm123015pli.1.2022.03.09.13.32.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Mar 2022 13:32:26 -0800 (PST) X-Relaying-Domain: cs.arizona.edu Received: from cs.arizona.edu (lectura.cs.arizona.edu [192.12.69.186]) by optima.cs.arizona.edu (8.14.4/8.14.4/Debian-2ubuntu2.1) with ESMTP id 229LWP2s016181 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 9 Mar 2022 14:32:25 -0700 Received: from localhost (cs.arizona.edu [local]) by cs.arizona.edu (OpenSMTPD) with ESMTPA id 39ff5b37 for ; Wed, 9 Mar 2022 21:32:13 +0000 (UTC) From: Junxiao Shi Date: Wed, 9 Mar 2022 21:18:43 +0000 Subject: [PATCH] net/af_xdp: fix custom program loading with multiple queues To: dev@dpdk.org Message-ID: <2c42e3e23c18fd60@cs.arizona.edu> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org When the PMD is configured to load a custom XDP program, it sets XSK_LIBBPF_FLAGS__INHIBIT_PROG_LOAD flag to prevent libbpf from loading its default XDP program. However, when queue_count is set to greater than 1, this flag is only set for the first XSK socket but not for subsequent XSK sockets. This causes XSK socket creation failure. This commit ensures that XSK_LIBBPF_FLAGS__INHIBIT_PROG_LOAD flag is set for all XSK socket creations when custom XDP program is being used. Fixes: 01fa83c94d7e ("net/af_xdp: workaround custom program loading") Signed-off-by: Junxiao Shi --- drivers/net/af_xdp/rte_eth_af_xdp.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 65479138d3..9920f49870 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -1307,18 +1307,19 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, cfg.bind_flags |= XDP_USE_NEED_WAKEUP; #endif - if (strnlen(internals->prog_path, PATH_MAX) && - !internals->custom_prog_configured) { - ret = load_custom_xdp_prog(internals->prog_path, - internals->if_index, - &internals->map); - if (ret) { - AF_XDP_LOG(ERR, "Failed to load custom XDP program %s\n", - internals->prog_path); - goto out_umem; + if (strnlen(internals->prog_path, PATH_MAX)) { + if (!internals->custom_prog_configured) { + ret = load_custom_xdp_prog(internals->prog_path, + internals->if_index, + &internals->map); + if (ret) { + AF_XDP_LOG(ERR, "Failed to load custom XDP program %s\n", + internals->prog_path); + goto out_umem; + } + internals->custom_prog_configured = 1; } - internals->custom_prog_configured = 1; - cfg.libbpf_flags = XSK_LIBBPF_FLAGS__INHIBIT_PROG_LOAD; + cfg.libbpf_flags |= XSK_LIBBPF_FLAGS__INHIBIT_PROG_LOAD; } if (internals->shared_umem) -- 2.17.1