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 451FE45C4C; Fri, 1 Nov 2024 17:13:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 169794027C; Fri, 1 Nov 2024 17:13:13 +0100 (CET) Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by mails.dpdk.org (Postfix) with ESMTP id E9D524003C for ; Fri, 1 Nov 2024 17:13:11 +0100 (CET) Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-720be27db74so1344157b3a.1 for ; Fri, 01 Nov 2024 09:13:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1730477591; x=1731082391; 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=8BTPR5ObEcwMFN0yNOsGlPBUDYhSEsg2MBTFiouDtR0=; b=pm0JIE/TNHaLGMjJDGjWJT08bAVJzHAVJvAMzTE6Grhl2ws3wjdZ1KdKwJqswFQxKm 4BbyDDjRSW/MXn6PdbJ/JMhd+njhTnZPB3+xhCkdzNrrXdBrWZLRiLA66jiCgy0XaY/c NXblcS3SAgQlhsgYMyicK/o6MIN6m8u1/gCOGNlLrhRtPQeERSh3KegtDqACOBnEBbix vw/lVN6nchWysSnt520XB0wmOJ2exDs+wd9CBkohkVgi1LXejbx0i87CPDIVRBg+s6Df 5UNzDwxLVlNu9uzyw57COK7K14bzfHInjNMPvnck7C/hLzJtvRXp/+9QXNjj/hYK28yi CcjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730477591; x=1731082391; 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=8BTPR5ObEcwMFN0yNOsGlPBUDYhSEsg2MBTFiouDtR0=; b=lESJe0Nzs5/m1SL82fkWETmclCeyzLmbOpw8oah9/n5YcCvmYA3C9baErz5+DUwYLU yEApL7AwyzjuFCtIY09vnoSNXHUaTriEOqUP1IDGMHq1CfUNHNdSghEQaiq0GDVKGdcM Hj0nES+qscAe4+dftHwrhQrVOrjcps2/sz7d6dEVJCMjiswoY1s+4/xY+cTbDFL6LJ+o EaAeWl3MlM95ntBWDS74TPi2VXa8uWqRet6OjViCTjB11LgM5qZCAhjU75MJmh53Dbng CHUn1qDBrfOliJ1a2wVKWGeGNYRgvtiDMxzPefb+90MvNl2JunDqI2M68DZ7veI7CUgE +yXQ== X-Gm-Message-State: AOJu0YxDq8Tw1YNs9RkZNFn8gf3ju2H/uwFFZl++jLsjGl7ctWC2aZTl e2l9crdpHH6H6J8Ka8C7lXcX3AAXTCtqQsGtA/VaL3L/z6io4wkGHr+AtibxaIhmwJAxLttAHXd T X-Google-Smtp-Source: AGHT+IEXCRw3V2NjU+hftUsQcvflLFRBDa2lM22s3Vya3RyWhr+NtTHElpN+RDTmKy7ig+SelLAFBw== X-Received: by 2002:a05:6a00:139a:b0:71e:60d9:910d with SMTP id d2e1a72fcca58-720bcd4f613mr9668504b3a.6.1730477590760; Fri, 01 Nov 2024 09:13:10 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-720bc1e6ac9sm2794667b3a.75.2024.11.01.09.13.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 09:13:10 -0700 (PDT) Date: Fri, 1 Nov 2024 09:13:08 -0700 From: Stephen Hemminger To: liwencheng Cc: dev@dpdk.org Subject: Re: [PATCH v1 1/2] net/macb: add new driver Message-ID: <20241101091308.28bb4518@hermes.local> In-Reply-To: <1730455640-1084345-1-git-send-email-liwencheng@phytium.com.cn> References: <1730455640-1084345-1-git-send-email-liwencheng@phytium.com.cn> 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 Fri, 1 Nov 2024 10:07:19 +0000 liwencheng wrote: > add Phytium NIC MACB ethdev PMD driver. > > Signed-off-by: liwencheng Much better. When submitting a new version of already submitted patch. DPDK policy is to use version 2 (v2) and use in-reply-to so that threads in mail client and patchwork archive stay organized. New drivers should be submitted in smaller chunks so that comments are more organized. https://doc.dpdk.org/guides/contributing/new_driver.html A saw a few things. 1. Don't put developer only printf's in under MACB_DEBUG. If you have to leave debugging around use the existing log macros with DEBUG as the level. This applies to all #ifdef's. Please don't use them because it leads to dead untested code. 2. Looks like driver is keeping per queue stats, but they are not filled in the get_stats code. 3. Unnecessary casts of void * pointer. 4. The code in interrupt handler is more complex than necessary. This does the same thing: static void macb_interrupt_handler(void *param) { struct rte_eth_dev *dev = (struct rte_eth_dev *)param; struct macb_priv *priv = dev->data->dev_private; struct rte_eth_link link; char status[128]; if (priv->stopped) return; if (eth_macb_link_update(dev, 0) < 0) return; rte_eth_linkstatus_get(dev, &link); rte_eth_link_to_str(status, sizeof(status), &link); MACB_INFO("Port %u: %s", dev->data->port_id, status); macb_link_change(priv->bp); rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL); } 5. For files, the convention is to use PATH_MAX (you use MAX_FILE_LEN) 6. Use on stack variables where possible (avoids potential memory leaks). Example of where allocation can be avoided is in macb_get_dev_pclk. 7. lots of extra includes. For example, why does macb_rxtx_vec_neon need arp, ioctl, socket and stat? 8. Don't use __builtin_ctz, instead use rte_ctz32() 9. Use __rte_cache_aligned not __rte_aligned(RTE_CACHE_LINE_SIZE) 10. Do not disable warnings it hides bugs 11. Take out this line, it bothers checkpatch meson.build: #allow_experimental_apis = true