From: Stephen Hemminger <stephen@networkplumber.org>
To: Long Li <longli@linuxonhyperv.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>,
dev@dpdk.org, Long Li <longli@microsoft.com>
Subject: Re: [dpdk-dev] [PATCH v2 2/2] net/netvsc: support VF device hot add/remove
Date: Mon, 21 Dec 2020 15:51:57 -0800 [thread overview]
Message-ID: <20201221155157.374d990b@hermes.local> (raw)
In-Reply-To: <1608586402-20145-1-git-send-email-longli@linuxonhyperv.com>
On Mon, 21 Dec 2020 13:33:22 -0800
Long Li <longli@linuxonhyperv.com> 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...)
next prev parent reply other threads:[~2020-12-21 23:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-01 7:56 [dpdk-dev] [PATCH 1/2] eal/hotplug: allow monitor to be setup by multiple places Long Li
2020-12-01 7:56 ` [dpdk-dev] [PATCH 2/2] net/netvsc: support VF device hot add/remove Long Li
2020-12-21 21:33 ` [dpdk-dev] [PATCH v2 " Long Li
2020-12-21 23:51 ` Stephen Hemminger [this message]
2021-01-06 2:50 ` Long Li
2020-12-17 15:08 ` [dpdk-dev] [PATCH 1/2] eal/hotplug: allow monitor to be setup by multiple places Luca Boccassi
2020-12-17 22:37 ` Long Li
2020-12-21 21:32 ` [dpdk-dev] [PATCH v2 " Long Li
2021-01-17 21:26 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201221155157.374d990b@hermes.local \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=longli@linuxonhyperv.com \
--cc=longli@microsoft.com \
--cc=sthemmin@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).