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 8622AA0547; Wed, 27 Oct 2021 09:23:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 48A0B40E0F; Wed, 27 Oct 2021 09:23:45 +0200 (CEST) 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 38FFB40DDA for ; Wed, 27 Oct 2021 09:23:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635319423; 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=c6ABqTtMLFAY2B4xVYxQiOgB5SVganql4NXy9WJWThY=; b=Z+Cukk6o8FfX842IbotOsGhYXO4hk+ZfMSuCLMKmZcuKBTVt0VFh/QHE0zlh4bFT+Dn3JZ hTTNc7BKOUPHJU8juVj3S/SbceulYZzVPbks43w6ehjB2+sG4Z1l3tPKiqtBfK7/smEC0A 4GPMCCt+FU3FIAkyF4wCNCxA+BaVWg8= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-338-gJVGeKY3Nt-ewHV9J3vZzg-1; Wed, 27 Oct 2021 03:23:42 -0400 X-MC-Unique: gJVGeKY3Nt-ewHV9J3vZzg-1 Received: by mail-lj1-f200.google.com with SMTP id v11-20020a2e990b000000b0021174a28c48so288249lji.13 for ; Wed, 27 Oct 2021 00:23:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=c6ABqTtMLFAY2B4xVYxQiOgB5SVganql4NXy9WJWThY=; b=p44t657NLOTxgDJw3UYzy6pfBUY3fpWfHNKtPfjiu2zguNvGk1ZUBkA1Nmz1DgoBoc i+tT5Pf2lDprV38W/5g66wZ2yhM4NIaMMtHkWvJcv8fpqBWcGHEKml5LZQmWkGKEiYUr kOl8a8cn19KzqNXN6vZtkxicnbfMg5dcAUOrmHnntbUN7Y9I+rwmfPXBVWdpMhEhCcqm TVVi6nyySaVg61MXMypa7zmu2bxL7At1+qFgJlhBUyERmQrItjiULnSvhhMh6peZt8bI /45TBz78x35DJ4R3jPlMQ46Hy0+Yrme59BM/wsCXdSrIxw2CdyxQ99uO1AmNIhCVKKLc LR7A== X-Gm-Message-State: AOAM532slxwxWjvi+yQNYTpkcYottjcG9VMOwn1c64P6ohKqVyeCEWUp uQgxzPxmTOU7lBZT0ROZk7CE9yqQxyuN5Dm439xk0OHu8WM+VA7lBcJrQF/WkVVnNu/ECWzCwPp HS77K1V45LbhtRI5oChQ= X-Received: by 2002:ac2:4bc1:: with SMTP id o1mr27442952lfq.553.1635319420982; Wed, 27 Oct 2021 00:23:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwmLPufhJleMzbGngMlMRUY8Go22fqPHsLAnBq3oM81H9vW1gYeuXcXdeiLzVeMVEOxnVCIWov+oRsp7J1DTQ= X-Received: by 2002:ac2:4bc1:: with SMTP id o1mr27442933lfq.553.1635319420794; Wed, 27 Oct 2021 00:23:40 -0700 (PDT) MIME-Version: 1.0 References: <20211026145851.21944-1-david.marchand@redhat.com> In-Reply-To: From: David Marchand Date: Wed, 27 Oct 2021 09:23:29 +0200 Message-ID: To: "Ananyev, Konstantin" Cc: "dev@dpdk.org" , "Yigit, Ferruh" , "andrew.rybchenko@oktetlabs.ru" , "thomas@monjalon.net" , "bingz@nvidia.com" , "Li, Xiaoyun" Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH] ethdev: warn only once for badly behaving applications 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 Sender: "dev" On Tue, Oct 26, 2021 at 7:10 PM Ananyev, Konstantin wrote: > > static uint16_t > > -dummy_eth_rx_burst(__rte_unused void *rxq, > > +dummy_eth_rx_burst(void *rxq, > > __rte_unused struct rte_mbuf **rx_pkts, > > __rte_unused uint16_t nb_pkts) > > { > > - RTE_ETHDEV_LOG(ERR, "rx_pkt_burst for not ready port\n"); > > + struct dummy_queue *q = rxq; > > + > > LGTM in general, just one thing: > I think we'd better add extra check that rxq really points to dummy queues > before de-referencing it. > Something like: > > uintptr_t port_id; > .... > port_id = q - dummy_queues; > if (port_id < RTE_DIM(dummy_queues) && !q->rx_warn_once) { > .... > } > > Same for tx. Yep, will add. > > > + if (!q->rx_warn_once) { > > + uint16_t port_id = q - dummy_queues; > > + > > + RTE_ETHDEV_LOG(ERR, "lcore %u called rx_pkt_burst for not ready port %"PRIu16"\n", > > + rte_lcore_id(), port_id); > > + rte_dump_stack(); > > + q->rx_warn_once = true; > > + } > > rte_errno = ENOTSUP; > > return 0; > > } > > > > static uint16_t > > -dummy_eth_tx_burst(__rte_unused void *txq, > > +dummy_eth_tx_burst(void *txq, > > __rte_unused struct rte_mbuf **tx_pkts, > > __rte_unused uint16_t nb_pkts) > > { > > - RTE_ETHDEV_LOG(ERR, "tx_pkt_burst for not ready port\n"); > > + struct dummy_queue *q = txq; > > + > > + if (!q->tx_warn_once) { > > + uint16_t port_id = q - dummy_queues; > > + > > + RTE_ETHDEV_LOG(ERR, "lcore %u called tx_pkt_burst for not ready port %"PRIu16"\n", > > + rte_lcore_id(), port_id); > > + rte_dump_stack(); > > + q->tx_warn_once = true; > > + } > > rte_errno = ENOTSUP; > > return 0; > > } > > @@ -199,14 +236,22 @@ void > > eth_dev_fp_ops_reset(struct rte_eth_fp_ops *fpo) > > { > > static void *dummy_data[RTE_MAX_QUEUES_PER_PORT]; > > - static const struct rte_eth_fp_ops dummy_ops = { > > + uint16_t port_id = fpo - rte_eth_fp_ops; > > + > > + dummy_queues[port_id].rx_warn_once = false; > > + dummy_queues[port_id].tx_warn_once = false; > > + *fpo = (struct rte_eth_fp_ops) { > > .rx_pkt_burst = dummy_eth_rx_burst, > > .tx_pkt_burst = dummy_eth_tx_burst, > > - .rxq = {.data = dummy_data, .clbk = dummy_data,}, > > - .txq = {.data = dummy_data, .clbk = dummy_data,}, > > + .rxq = (struct rte_ethdev_qdata) { > > Here and for txq, do we need to explicitly specify type? > Wouldn't: > .rxq = {.data=..., .clbk=...,}, > be enough here? Well, same question from Thomas. It seems to work without it. -- David Marchand