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 007C445C18; Wed, 30 Oct 2024 20:37:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C551D43245; Wed, 30 Oct 2024 20:37:40 +0100 (CET) Received: from mail-oa1-f45.google.com (mail-oa1-f45.google.com [209.85.160.45]) by mails.dpdk.org (Postfix) with ESMTP id C5F3B42F2B for ; Wed, 30 Oct 2024 20:37:39 +0100 (CET) Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-290d8d5332cso146786fac.2 for ; Wed, 30 Oct 2024 12:37:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1730317059; x=1730921859; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=/WdPaUJbVZBG8UxrIOaBBOARXZH821nHXafxk7HZi1k=; b=LQBz5YWnMUQjNBSBn7VHQU2g6a4fRvjuCqfltmP3AZdsrkPj1Rxhnl9ZqpOvaYAcOF 5AhMqjO5l3k9Kuxv0PXUcftlyJQVKy+bw6tp8wKEMsXOeYj3pnev8hN8a+TeIx49VBTZ RW5Cb3IKOxvqedtfTi7QaUV8lnEnrB4BuudHii4IUxs96ny+Z3GJWbbfSbmZVqOKUwIW HyhG7/vm/wHV8MwB2MC3WBFUeN0xZ6nw+pcO8ED/+/AsvJod8LFKrVe0GcJ3Bya1I7Ao bRB25D8CBQHW5OGaDsHknpTw/DGBo1bbd3OUU04EczaWPrPeUtsGkfAfMuyyPSgILVP5 m7Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730317059; x=1730921859; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/WdPaUJbVZBG8UxrIOaBBOARXZH821nHXafxk7HZi1k=; b=lMGkzGENkZBx2BqZnnS7HSFTM/8euqs9neI78DXyIE930Z/mrLQcW1i1ZT1Tjtx4Y8 RPf5Qadal5Ljn9Ha/H82dQOk5g/cjcgXON+wmiuiI70HTi157WyXW6J5r1v/zCxdw3QP sf2/9PuVDSNLTMrk1IF0yVH5hiEURAl7iSBp1VHis6iCiCTIz6c4zRkgd6TzpG9PDi+I t9tEhPRKpLNWbOyBuhy/U9GB3x2gm94TLPc8SVj5JSIfOr8XGijijifkkF9hK0npKfzO cFfRPjk85KDUSgjfYAvmxehr7Ygc1AOUQnuM8pad1fxrEhT7t4+Xv48cdFO6o1nq1mVN eFSg== X-Forwarded-Encrypted: i=1; AJvYcCWhrhxLvl9M0IF/yDc+mCv5ShgO2gOivT8W2kxvusTZhp7BziGU7Wf9BuqH53L3J7w+HD8=@dpdk.org X-Gm-Message-State: AOJu0YzOJ4ufvWeNYApKTxLCRoYUyx2DrWETd0IkZVRnFXA9sWLJHSyo akMMrCReqvvZkeM9ldpyE+VFnRJvuFuBih5tLjEiGY06sUV+P20lLnveOEglOzQ= X-Google-Smtp-Source: AGHT+IHx5LxwQkoQk90AcR13TMpydkOVf7iTQ9+Yp3oud2sM3YBEURCzp28ojQDnaS1Nh3/pnBtZqg== X-Received: by 2002:a05:6870:d8d1:b0:27b:b2e0:6a5 with SMTP id 586e51a60fabf-29051af085amr16295579fac.3.1730317057362; Wed, 30 Oct 2024 12:37:37 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7edc8685729sm9698879a12.37.2024.10.30.12.37.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2024 12:37:37 -0700 (PDT) Date: Wed, 30 Oct 2024 12:37:35 -0700 From: Stephen Hemminger To: Gregory Etelson Cc: , , , , , , , Subject: Re: [PATCH v6] testpmd: add hairpin map parameter Message-ID: <20241030123735.62156d88@hermes.local> In-Reply-To: <20241030073724.103112-1-getelson@nvidia.com> References: <20240922065053.996568-1-getelson@nvidia.com> <20241030073724.103112-1-getelson@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 On Wed, 30 Oct 2024 09:37:24 +0200 Gregory Etelson wrote: > +static int > +port_config_hairpin_rxq(portid_t pi, uint16_t peer_tx_port, > + queueid_t rxq_head, queueid_t txq_head, > + uint16_t qcount, uint32_t manual_bind) > +{ > + int diag; > + queueid_t i, qi; > + uint32_t tx_explicit = !!(hairpin_mode & 0x10); > + uint32_t force_mem = !!(hairpin_mode & HAIRPIN_MODE_RX_FORCE_MEMORY); > + uint32_t locked_mem = !!(hairpin_mode & HAIRPIN_MODE_RX_LOCKED_MEMORY); > + uint32_t rte_mem = !!(hairpin_mode & HAIRPIN_MODE_RX_RTE_MEMORY); > + struct rte_port *port = &ports[pi]; > + struct rte_eth_hairpin_conf hairpin_conf = { > + .peer_count = 1, > + }; > + > + for (qi = rxq_head, i = 0; qi < rxq_head + qcount; qi++) { > + hairpin_conf.peers[0].port = peer_tx_port; > + hairpin_conf.peers[0].queue = i + txq_head; > + hairpin_conf.manual_bind = manual_bind; > + hairpin_conf.tx_explicit = tx_explicit; > + hairpin_conf.force_memory = force_mem; > + hairpin_conf.use_locked_device_memory = locked_mem; > + hairpin_conf.use_rte_memory = rte_mem; Did you consider that most of the hairpin_conf values could just be set directly, avoiding intermediate variables. > + diag = rte_eth_rx_hairpin_queue_setup > + (pi, qi, nb_rxd, &hairpin_conf); Unnecessary line break. Suggestion: static int port_config_hairpin_rxq(portid_t pi, uint16_t peer_tx_port, queueid_t rxq_head, queueid_t txq_head, uint16_t qcount, uint32_t manual_bind) { int diag; queueid_t i, qi; struct rte_port *port = &ports[pi]; struct rte_eth_hairpin_conf hairpin_conf = { .peer_count = 1, .manual_bind = manual_bind, .tx_explicit = !!(hairpin_mode & 0x10), .force_memory = !!(hairpin_mode & HAIRPIN_MODE_RX_FORCE_MEMORY), .use_locked_device_memory = !!(hairpin_mode & HAIRPIN_MODE_RX_LOCKED_MEMORY), .use_rte_memory = !!(hairpin_mode & HAIRPIN_MODE_RX_RTE_MEMORY), }; for (qi = rxq_head, i = 0; qi < rxq_head + qcount; qi++) { hairpin_conf.peers[0].port = peer_tx_port; hairpin_conf.peers[0].queue = i + txq_head; diag = rte_eth_rx_hairpin_queue_setup(pi, qi, nb_rxd, &hairpin_conf); i++; if (diag == 0) continue;