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 94805A09EF; Tue, 22 Dec 2020 00:52:11 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 76675CA98; Tue, 22 Dec 2020 00:52:09 +0100 (CET) Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by dpdk.org (Postfix) with ESMTP id D467DCA97 for ; Tue, 22 Dec 2020 00:52:06 +0100 (CET) Received: by mail-pg1-f176.google.com with SMTP id 15so7256262pgx.7 for ; Mon, 21 Dec 2020 15:52:06 -0800 (PST) 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=kl8bD9RAyeOR9p2wzzXdJVrLMv3lqj+OaFql64+c3b8=; b=cvHjuhc0f1ENIEF0Y6veT6O6gKH/Dx9wkOAluAc/OU2tHdEV865g+K7rqK4iEKmcUI 4bCcfiFZA5KUnsPzNu8pF6B+oF2/zshbcWjtRECYSqRXwxLQ7ClCyrIZlMxeGlQx5+xp G9rFtrLS3yVPZLM8m3LPLY/6fe6lDUiCDtFFq/wPQACHgfNtUfigB1uBXaG2rZQRcUSV nFgU0GAYOti75smc2iIcFoJbSZP9JpH5n5/dbHPv0liHFWqJwghX9vTOQK8pK2+DTjl4 YSw7/nTt05AydQfW+6OHY9nSS2Q08s0K8D+g8N4RyMEAvw5LfbpkIBRRVQNC5+L6o537 9A7Q== 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=kl8bD9RAyeOR9p2wzzXdJVrLMv3lqj+OaFql64+c3b8=; b=jEtb3nNKh2EC+stLEMP8+8/L1GRJk+VchbS/2YEyxXYawr/EV35E25WEW0GJwNKgVN wne5BkHRhnPchs3zrEyyddt0c2s3crqK9KdlJHPOu+5xAyyaBRdomL7Q/kL7Z6wcGY20 OQnDBRirL5jk0cZY9Lw5568tu821hx7cwK22RNM+9tXfQVIu0wGSebtJKRpsg9TDZTil SKDA39r2VhS4cq2Xmmb1qT/R3RW2d6R2eDeGkf6N37YVZ3IZUS1orb9UU54RkxQd7OCQ 0A+fEyC7SFDuGFCUUQK/v4+ppbonIgzu3VziVwlxAKQ55PlbKPeERAns+reD3wSg+Z3l +MzQ== X-Gm-Message-State: AOAM531Mh5NTjQKthBLKF1evMZdkxdul/1G+XNR4Vxo4a3Gw6mg9CyBt bgyVdbn1XolkhXTOJq9WPpPV7g== X-Google-Smtp-Source: ABdhPJxAwAoatwhSHAhPF9eQEvVh+zqrWxMiu21I64w77AILdprGirwi0KifM0Eo4Ez88vy1lFePfg== X-Received: by 2002:a63:550d:: with SMTP id j13mr17300031pgb.365.1608594725805; Mon, 21 Dec 2020 15:52:05 -0800 (PST) Received: from hermes.local (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id er23sm16478905pjb.12.2020.12.21.15.52.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Dec 2020 15:52:05 -0800 (PST) Date: Mon, 21 Dec 2020 15:51:57 -0800 From: Stephen Hemminger To: Long Li Cc: Stephen Hemminger , dev@dpdk.org, Long Li Message-ID: <20201221155157.374d990b@hermes.local> In-Reply-To: <1608586402-20145-1-git-send-email-longli@linuxonhyperv.com> References: <1606809383-26660-2-git-send-email-longli@linuxonhyperv.com> <1608586402-20145-1-git-send-email-longli@linuxonhyperv.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2 2/2] net/netvsc: support VF device hot add/remove 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 Mon, 21 Dec 2020 13:33:22 -0800 Long Li wrote: > /* trying to get mac address if this is a network device*/ > + s = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP); > + if (s == -1) { > + PMD_DRV_LOG(ERR, "Failed to create socket errno %d\n", > + errno); > + break; > + } > + strlcpy(req.ifr_name, dir->d_name, sizeof(req.ifr_name)); > + ret = ioctl(s, SIOCGIFHWADDR, &req); > + close(s); > + if (ret == -1) { > + PMD_DRV_LOG(ERR, "Failed to send SIOCGIFHWADDR for " > + "device %s\n", dir->d_name); > + break; > + } > + if (req.ifr_hwaddr.sa_family != ARPHRD_ETHER) { > + closedir(di); > + return; > + } You have sysfs directory open at this point, would it be easier to continue with sysfs to find the mac address? snprintf(ifpath, sizeof(ifpath), "%s/address", dir->d_name); fd = openat(dirfd(di), ifpath, O_RDONLY); read(fd...)