From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B0DF9A00E6 for ; Thu, 11 Jul 2019 18:10:48 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1CBE82BF4; Thu, 11 Jul 2019 18:10:47 +0200 (CEST) Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by dpdk.org (Postfix) with ESMTP id 6C7B63DC for ; Thu, 11 Jul 2019 18:10:46 +0200 (CEST) Received: by mail-pf1-f194.google.com with SMTP id m30so2975763pff.8 for ; Thu, 11 Jul 2019 09:10:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BM3oviDve07x/oXPLJzoQBpzh60SSGidtEdmx2qkBI0=; b=0+YiOVLX9Qd62zW69EKxzi1jvZ1ZKzAn1uHV3nDQceZwo409cucFvYvjxFde0p8PMz pvcn3KttoFvu7FcpEFgXZG9suJlstzIpCPCkk4ekyxjk94TnlUosSxzBtdFdR+BaKHre DDy1h+kh6aihWhtaokYr+VSTmozVQG5MGEoMWYej/5kdAF3VNxNOap6AfriXHeEmzmHr bWnp7It04pn+IEzUAPylwVVlrQA+YOGNapIgWtRU7ZCAm7wumgN/gI3npBXTjSIqh6J1 +pq11BbhtMChHzT+KmSP6S3M8JFhkziax0JWmttCc4rOY9MYXiyDiH8RCO8N3Y6XuIPq V3Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BM3oviDve07x/oXPLJzoQBpzh60SSGidtEdmx2qkBI0=; b=A1VvH0JyoC6q8L81K2phXeer89gRyG3CAd6IG3YTCXUFLsSThudybDGfznB+PRBr6T g1jRXqciaSzY3Y3XfCbf6Fm7EqsDEZAQGjtcOuZ1ra0SbJnb26o+7NRpYBe4Zk+JrNQO AvrJGgqJy1Csxeaxzu2AG7S6Adb/sU72WFCxIBfw0UZeBsiwXjgurOSc9twKuq7hASbg FfuHMx0azYgfZyulksojd0JaZEpmL1EG23NMEOFHJe+/3U+l7m8vqc0ynr2Y652hBbnP KayR0nK04ML5DB0ypKIyb+0PUDz1FvreTDH7mhRbw1p5pV1pN1THl6LXa/SweZl5twf8 mYsw== X-Gm-Message-State: APjAAAURND+xm+rKn6wJ5VtnygHBXYpnWADhRHgewumthZ+al7GJkhXz SIxN2eoqxt9DHnlPac3S68o= X-Google-Smtp-Source: APXvYqw0hv30R9UhvVhY3Wq+H8pHX8wPAnf1pquE3q/H52RIbocnsfk/2i26s/qAYLGvJYtHAf3uRA== X-Received: by 2002:a63:e54f:: with SMTP id z15mr5258425pgj.4.1562861445496; Thu, 11 Jul 2019 09:10:45 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id y10sm5765797pfm.66.2019.07.11.09.10.45 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 11 Jul 2019 09:10:45 -0700 (PDT) Date: Thu, 11 Jul 2019 09:10:38 -0700 From: Stephen Hemminger To: Krzysztof Kanas Cc: "27ee549a-d01b-21a5-4a0b-a7e5594b38c0@intel.com" <27ee549a-d01b-21a5-4a0b-a7e5594b38c0@intel.com>, "dev@dpdk.org" , Ferruh Yigit , "John W. Linville" Message-ID: <20190711091038.2ddbd432@hermes.lan> In-Reply-To: <20190711095629.GA11907@kk-box-0> References: <20190710144630.14926-1-kkanas@marvell.com> <20190710090456.4bfa5833@hermes.lan> <20190711095629.GA11907@kk-box-0> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [EXT] Re: [PATCH v2] net/af_packet: add string error for system errors X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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 Thu, 11 Jul 2019 09:56:32 +0000 Krzysztof Kanas wrote: > On 19-07-10 09:04, Stephen Hemminger wrote: > > External Email > > > > ---------------------------------------------------------------------- > > On Wed, 10 Jul 2019 16:46:30 +0200 > > wrote: > > > > > > > > +#define PMD_LOG_ERRNO(level, fmt, args...) \ > > > + rte_log(RTE_LOG_ ## level, af_packet_logtype, \ > > > + "%s(): " fmt ":%s\n", __func__, ##args, rte_strerror(errno)) > > > + > > > static uint16_t > > > eth_af_packet_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) > > > { > > > @@ -603,9 +609,7 @@ rte_pmd_init_internals(struct rte_vdev_device *dev, > > > return -1; > > > } > > > if (ioctl(sockfd, SIOCGIFINDEX, &ifr) == -1) { > > > - PMD_LOG(ERR, > > > - "%s: ioctl failed (SIOCGIFINDEX)", > > > - name); > > > + PMD_LOG_ERRNO(ERR, "%s: ioctl failed (SIOCGIFINDEX)", name); > > > return -1; > > > > This is wrong. > > The ioctl sets errno not rte_errno. > I was following the documentation on rte_strerror, which states: > > For non-RTE-specific error codes, this function returns the value from > the libc strerror function That document is correct, but the intended usage is to do rte_strerror(rte_errno) and since rte_errno values correspond to errno values for system errors it would work. In conclusion, your code will work but is a little confusing.