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 1C921A0548 for ; Fri, 11 Nov 2022 18:38:14 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1576E427EB; Fri, 11 Nov 2022 18:38:14 +0100 (CET) Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by mails.dpdk.org (Postfix) with ESMTP id C4B314014F for ; Fri, 11 Nov 2022 18:38:12 +0100 (CET) Received: by mail-pg1-f177.google.com with SMTP id 136so4930161pga.1 for ; Fri, 11 Nov 2022 09:38:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; 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=ovnuR42wQogB88fSFr2XQ0H8n/PSPvARrO8i+iKkA2c=; b=2TFtKFUKRGeNDOf1mF1QH4a9AMzCz5yPocre9xcgIdi9s6wijziG/WJt09ZzqriYC2 zW9CzQcMfcmYKroBim7YLgmrcw1uwBT6tX//rjyN93fS5ANjydXqHn01R3jkgdBplg80 KgNsIqNDdf4lHzcDzada6EqEbhg/0ni6XHRrGi09DSm+ke/dhq1pcr38Vb1QbPKPZyzn x56Z9YJcQFjYjYrkUE8yF1muf3znC2oDqx6IsbkDYsBE2S75SxnIcaFUUosAQ5w9acLp uAesCQtfL7dCl36SHFN5W9ndLugM2b8n01n9KpoIwpx4PhGXXQUBJFMbcIGNl8r9w3uS kq2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=ovnuR42wQogB88fSFr2XQ0H8n/PSPvARrO8i+iKkA2c=; b=oyKv9aN10JYGuyTo6mFiFDjD03mSMadTkL8EOzLgycANH7wbTaV4kuZ2I1xRzV4qk5 F4BRRbh707AoBLZz3H8K+aPN47EInoTCaqdyghlEMrfHqSh7uuDFLgHrILc6b5SBw7Bj qw6cAgRBeW9FxiRpHFfoF8SCyiiV4y6ojSauuf231roxPU4H34RnH317gIHEsLxWGD9H V7fHrh7lWFzJb7eW1u4fdbrXf601HNj7g+vRhA94BdyKTK5LHtGA0sEadvs9tqpKoe4D C6vKt8Tf0s56onj24D5EGs5AC5JNZwnDnKRHA9PcvPXymMsCbUCwF14odTOrc3LfMnI6 saBA== X-Gm-Message-State: ANoB5pnUU84i2/Zq0hKkDnZmQrVF4aIP9OvQ3tJ4esQAf6s1WNh3rraC VPvNPuAS2IFNU4QFAowiVrzKe5WwI1srug== X-Google-Smtp-Source: AA0mqf6uomrTm/s0dBQDuaqY3IMJUpl5K8zQ56C+DQS1GaB1elJdkz+v+uWTaCdnWNY9XikcBpEiXg== X-Received: by 2002:a05:6a00:3011:b0:563:5e0a:97e8 with SMTP id ay17-20020a056a00301100b005635e0a97e8mr3617465pfb.75.1668188292029; Fri, 11 Nov 2022 09:38:12 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id h16-20020a635310000000b0046f56534d9fsm1607613pgb.21.2022.11.11.09.38.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 09:38:11 -0800 (PST) Date: Fri, 11 Nov 2022 09:38:09 -0800 From: Stephen Hemminger To: Bing Zhao Cc: Slava Ovsiienko , Matan Azrad , "dev@dpdk.org" , Raslan Darawsheh , "stable@dpdk.org" Subject: Re: [PATCH] common/mlx5: fix the sysfs port name translation Message-ID: <20221111093809.38358203@hermes.local> In-Reply-To: References: <20221110155726.649190-1-bingz@nvidia.com> <20221110082154.118781cd@hermes.local> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On Fri, 11 Nov 2022 05:41:05 +0000 Bing Zhao wrote: > Hi Stephen, > > > -----Original Message----- > > From: Stephen Hemminger > > Sent: Friday, November 11, 2022 12:22 AM > > To: Bing Zhao > > Cc: Slava Ovsiienko ; Matan Azrad > > ; dev@dpdk.org; Raslan Darawsheh > > ; stable@dpdk.org > > Subject: Re: [PATCH] common/mlx5: fix the sysfs port name > > translation > > > > External email: Use caution opening links or attachments > > > > > > On Thu, 10 Nov 2022 17:57:26 +0200 > > Bing Zhao wrote: > > > > > With some OFED or upstream kernel of mlx5, the port name fetched > > from > > > "/sys/class/net/[DEV]/phys_port_name" may have a tailing "\n" as > > the > > > EOL. The sscanf() will return the scanned items number with this > > EOL. > > > > Why not fix the DPDK driver to strip off the new line when the port > > name is read? The code in mlx5_os.c should do it there. > > Thanks for your comments. Yes, IF_NAMESIZE is large enough to read all the characters including the newline into the buffer. > After fgets(), the strlen() or strchr() can be used to remove the tailing newline character. > > > BR. Bing Another alternative would be to use getline() which doesn't have annoying length restrictions to deal with.