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 CF3CE436E3; Wed, 13 Dec 2023 17:41:58 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9276342FB7; Wed, 13 Dec 2023 17:40:26 +0100 (CET) Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by mails.dpdk.org (Postfix) with ESMTP id 2F1D842F79 for ; Wed, 13 Dec 2023 17:40:18 +0100 (CET) Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1d331f12f45so14817325ad.2 for ; Wed, 13 Dec 2023 08:40:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1702485617; x=1703090417; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oazGRehyaV7lEhIuAA2jjOuXmN7/tVDcDYpfuj/uPes=; b=QAv7XduiRjLCV2LiLXMWaxabhRZUlTJUkx0pFo+Os76xrD3XV/3zm7usDlmPo1ibtq wNAilkmPtEHgj6SLF7zJvuT/cIbkXd0VTpO/S7ebm5KLHdD4JeHgoqocmHL6eRTAGjpf QHmlxeuBB7yzNliY93WVADzbEIIbvDItzB+mCnyMHNJkTt2dAwfhf3TxU15adGnviR2z 7hX7jS/9/aAK5++7GBM1NIrSMT2qPAvdB139+0qhinyUxiR+up/uU1ir5XcvrfgYNj5d q19I6eT2HRhFIi3D1OD4DcUV5NTZg4EqimP2TJaTomEyQ72TGN5rM7svTk1Xcn8nXkIw 1bwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702485617; x=1703090417; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oazGRehyaV7lEhIuAA2jjOuXmN7/tVDcDYpfuj/uPes=; b=un/jaOKSt4hrjiQIAIl+2sdCBYO4j+A+RsTwpNBE2OP9CdDxAr7DmolzFPtKslpNA4 up9wSFBTA5urVFQzxoUg1d6vApQCM6QTG+MylPGK/UdgSvqqGNjoNEvrHuCHfTWd0MjC lp0u9uKY02WasF4tmswV/OburKRsxZgvAoOjuow1yPUqDkuYi30NWJvZh78qVlp7PKK8 Xv6+KWCMCcbuzT0bJ7tumCeVpWRbjPJqh1gwx/TEhVjrNVYqzgKnXu01Z/PLgDdjLViP d4qRJUsprqajDZK31EpBHdD990d5xbp2kQ2+NcnQ10wxKuKfY3mPWqoy8Emv/Idctu0C RZ2w== X-Gm-Message-State: AOJu0YxxzTx3jD9rPPlXsGNzHzATT9YeTtf77mKu4k933RniTTAeIiPs eszK7DoPBBVxLS7hq1BTjxoujn4aPvDTYpBqmeM= X-Google-Smtp-Source: AGHT+IGgjjIeWtp6g9Dfmo0RhkeILn8ICgSqTstWsnr3yfZq8GAzlnkz40dzJ4Tp6V57TuETCX/yQQ== X-Received: by 2002:a17:903:40c8:b0:1d3:49fc:b780 with SMTP id t8-20020a17090340c800b001d349fcb780mr949512pld.78.1702485617422; Wed, 13 Dec 2023 08:40:17 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id 4-20020a170902c24400b001d0a6f31519sm10749593plg.188.2023.12.13.08.40.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 08:40:17 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Jakub Palider , Tomasz Duszynski Subject: [PATCH v3 27/37] raw/cnxk_bphy: replace PMD logtype with dynamic type Date: Wed, 13 Dec 2023 08:36:01 -0800 Message-ID: <20231213163820.894987-28-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231213163820.894987-1-stephen@networkplumber.org> References: <20231213014408.612051-1-stephen@networkplumber.org> <20231213163820.894987-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Driver should not be using PMD logtype, they should have their own logtype. Signed-off-by: Stephen Hemminger --- drivers/raw/cnxk_bphy/cnxk_bphy.c | 3 ++- drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c | 2 +- drivers/raw/cnxk_bphy/cnxk_bphy_cgx_test.c | 31 +++++++++++----------- drivers/raw/cnxk_bphy/rte_pmd_bphy.h | 5 ++++ 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy.c b/drivers/raw/cnxk_bphy/cnxk_bphy.c index 15dbc4c1a637..f1c14125d5c5 100644 --- a/drivers/raw/cnxk_bphy/cnxk_bphy.c +++ b/drivers/raw/cnxk_bphy/cnxk_bphy.c @@ -251,7 +251,7 @@ cnxk_bphy_irq_enqueue_bufs(struct rte_rawdev *dev, /* get rid of last response if any */ if (qp->rsp) { - RTE_LOG(WARNING, PMD, "Previous response got overwritten\n"); + BPHY_LOG(WARNING, "Previous response got overwritten"); rte_free(qp->rsp); } qp->rsp = rsp; @@ -410,3 +410,4 @@ static struct rte_pci_driver cnxk_bphy_rawdev_pmd = { RTE_PMD_REGISTER_PCI(bphy_rawdev_pci_driver, cnxk_bphy_rawdev_pmd); RTE_PMD_REGISTER_PCI_TABLE(bphy_rawdev_pci_driver, pci_bphy_map); RTE_PMD_REGISTER_KMOD_DEP(bphy_rawdev_pci_driver, "vfio-pci"); +RTE_LOG_REGISTER_DEFAULT(bphy_logtype, INFO); diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c index 2d8466ef918b..b2e8fc0e5c6f 100644 --- a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c +++ b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c @@ -189,7 +189,7 @@ cnxk_bphy_cgx_process_buf(struct cnxk_bphy_cgx *cgx, unsigned int queue, /* get rid of last response if any */ if (qp->rsp) { - RTE_LOG(WARNING, PMD, "Previous response got overwritten\n"); + BPHY_LOG(WARNING, "Previous response got overwritten"); rte_free(qp->rsp); } qp->rsp = rsp; diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx_test.c b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx_test.c index a3021b4bb7db..148ee551ead1 100644 --- a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx_test.c +++ b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx_test.c @@ -57,62 +57,61 @@ cnxk_bphy_cgx_dev_selftest(uint16_t dev_id) if (ret) break; if (descs != 1) { - RTE_LOG(ERR, PMD, "Wrong number of descs reported\n"); + BPHY_LOG(ERR, "Wrong number of descs reported"); ret = -ENODEV; break; } - RTE_LOG(INFO, PMD, "Testing queue %d\n", i); + BPHY_LOG(INFO, "Testing queue %d", i); ret = rte_pmd_bphy_cgx_stop_rxtx(dev_id, i); if (ret) { - RTE_LOG(ERR, PMD, "Failed to stop rx/tx\n"); + BPHY_LOG(ERR, "Failed to stop rx/tx"); break; } ret = rte_pmd_bphy_cgx_start_rxtx(dev_id, i); if (ret) { - RTE_LOG(ERR, PMD, "Failed to start rx/tx\n"); + BPHY_LOG(ERR, "Failed to start rx/tx"); break; } ret = rte_pmd_bphy_cgx_set_link_state(dev_id, i, false); if (ret) { - RTE_LOG(ERR, PMD, "Failed to set link down\n"); + BPHY_LOG(ERR, "Failed to set link down"); break; } ret = cnxk_bphy_cgx_link_cond(dev_id, i, 0); if (ret != 0) - RTE_LOG(ERR, PMD, - "Timed out waiting for a link down\n"); + BPHY_LOG(ERR, "Timed out waiting for a link down"); ret = rte_pmd_bphy_cgx_set_link_state(dev_id, i, true); if (ret) { - RTE_LOG(ERR, PMD, "Failed to set link up\n"); + BPHY_LOG(ERR, "Failed to set link up"); break; } ret = cnxk_bphy_cgx_link_cond(dev_id, i, 1); if (ret != 1) - RTE_LOG(ERR, PMD, "Timed out waiting for a link up\n"); + BPHY_LOG(ERR, "Timed out waiting for a link up"); ret = rte_pmd_bphy_cgx_intlbk_enable(dev_id, i); if (ret) { - RTE_LOG(ERR, PMD, "Failed to enable internal lbk\n"); + BPHY_LOG(ERR, "Failed to enable internal lbk"); break; } ret = rte_pmd_bphy_cgx_intlbk_disable(dev_id, i); if (ret) { - RTE_LOG(ERR, PMD, "Failed to disable internal lbk\n"); + BPHY_LOG(ERR, "Failed to disable internal lbk"); break; } ret = rte_pmd_bphy_cgx_ptp_rx_enable(dev_id, i); /* ptp not available on RPM */ if (ret < 0 && ret != -ENOTSUP) { - RTE_LOG(ERR, PMD, "Failed to enable ptp\n"); + BPHY_LOG(ERR, "Failed to enable ptp"); break; } ret = 0; @@ -120,27 +119,27 @@ cnxk_bphy_cgx_dev_selftest(uint16_t dev_id) ret = rte_pmd_bphy_cgx_ptp_rx_disable(dev_id, i); /* ptp not available on RPM */ if (ret < 0 && ret != -ENOTSUP) { - RTE_LOG(ERR, PMD, "Failed to disable ptp\n"); + BPHY_LOG(ERR, "Failed to disable ptp"); break; } ret = 0; ret = rte_pmd_bphy_cgx_get_supported_fec(dev_id, i, &fec); if (ret) { - RTE_LOG(ERR, PMD, "Failed to get supported FEC\n"); + BPHY_LOG(ERR, "Failed to get supported FEC"); break; } ret = rte_pmd_bphy_cgx_set_fec(dev_id, i, fec); if (ret) { - RTE_LOG(ERR, PMD, "Failed to set FEC to %d\n", fec); + BPHY_LOG(ERR, "Failed to set FEC to %d", fec); break; } fec = CNXK_BPHY_CGX_ETH_LINK_FEC_NONE; ret = rte_pmd_bphy_cgx_set_fec(dev_id, i, fec); if (ret) { - RTE_LOG(ERR, PMD, "Failed to disable FEC\n"); + BPHY_LOG(ERR, "Failed to disable FEC"); break; } } diff --git a/drivers/raw/cnxk_bphy/rte_pmd_bphy.h b/drivers/raw/cnxk_bphy/rte_pmd_bphy.h index 9d8d0285581b..5926adbcece9 100644 --- a/drivers/raw/cnxk_bphy/rte_pmd_bphy.h +++ b/drivers/raw/cnxk_bphy/rte_pmd_bphy.h @@ -26,6 +26,11 @@ extern "C" { #endif +extern int bphy_logtype; + +#define BPHY_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, bphy_logtype, "%s(): " fmt "\n", __func__, ## args) + /** Available message types */ enum cnxk_bphy_cgx_msg_type { /** Type used to obtain link information */ -- 2.43.0