Skip to contentSkip to conversation

perm_addr get

DISCUSSION Jiri Pirko 2 participants 4 messages Dec 21, 2012

Subsystems (2)
lore
Share & tools
lore

Jiri Pirko

author
#0 lore raw

Hi all.

Quoted 1 line

From what I understand dev->perm_addr is set only in case the hw has

permanent hw address somewhere written (for example EPROM).

So when I query device which does not have perm_addr set I get:

testt1:~$ ethtool -P team0
Permanent address: 00:00:00:00:00:00

Is this the correct behaviour? Wouldn't it be more correct if ethtool_get_perm_addr() fails with -ENOENT for something like that?

Thanks.

Jiri

#1 lore raw
Quoted 5 lines · Jiri Pirko

Hi all.

From what I understand dev->perm_addr is set only in case the hw has permanent hw address somewhere written (for example EPROM).

Quoted 7 lines

So when I query device which does not have perm_addr set I get:

testt1:~$ ethtool -P team0
Permanent address: 00:00:00:00:00:00

Is this the correct behaviour? Wouldn't it be more correct if ethtool_get_perm_addr() fails with -ENOENT for something like that?

I don't think we should change the implementation now, as someone might depend on it. It's trivial to distinguish this not-a-permanent-address case. However the ethtool command output could be improved.

Ben.

Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
author
#2 lore raw
Quoted 11 lines · Fri, Dec 21, 2012 at 02:09:55PM CET, [email protected] wrote:
Quoted 10 lines · Jiri Pirko

Hi all.

From what I understand dev->perm_addr is set only in case the hw has permanent hw address somewhere written (for example EPROM).

So when I query device which does not have perm_addr set I get:

testt1:~$ ethtool -P team0
Permanent address: 00:00:00:00:00:00
Quoted 6 lines
Quoted 2 lines

Is this the correct behaviour? Wouldn't it be more correct if ethtool_get_perm_addr() fails with -ENOENT for something like that?

I don't think we should change the implementation now, as someone might depend on it. It's trivial to distinguish this not-a-permanent-address case. However the ethtool command output could be improved.

Well, not change it even if it is not correct? And by "trivial to distinguish" you mean 00:00:00:00:00:00 ~ device has no permanent address?
But in some cases (like vxge, mac80211) it's possible to see 00:00:00:00:00:00 by ethtool -P even though the device has permanent address (set later on, after register_netdev call).

I think that ethtool_get_perm_addr should return:
-ENOENT if dev has no perm addr
-EAGAIN if dev perm addr hasn't been obtained yet
0 (and addr) in other cases

And how exactly should be the ethtool output improved?

Thanks

Jiri

Quoted 8 lines

Ben.

Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
#3 lore raw
Quoted 19 lines · Jiri Pirko
Quoted 11 lines · Fri, Dec 21, 2012 at 02:09:55PM CET, [email protected] wrote:
Quoted 10 lines · Jiri Pirko

Hi all.

From what I understand dev->perm_addr is set only in case the hw has permanent hw address somewhere written (for example EPROM).

So when I query device which does not have perm_addr set I get:

testt1:~$ ethtool -P team0
Permanent address: 00:00:00:00:00:00
Quoted 6 lines
Quoted 2 lines

Is this the correct behaviour? Wouldn't it be more correct if ethtool_get_perm_addr() fails with -ENOENT for something like that?

I don't think we should change the implementation now, as someone might depend on it. It's trivial to distinguish this not-a-permanent-address case. However the ethtool command output could be improved.

Quoted 5 lines

Well, not change it even if it is not correct? And by "trivial to distinguish" you mean 00:00:00:00:00:00 ~ device has no permanent address?
But in some cases (like vxge, mac80211) it's possible to see 00:00:00:00:00:00 by ethtool -P even though the device has permanent address (set later on, after register_netdev call).

Oh well, those are just driver bugs that should be fixed.

Quoted 6 lines

I think that ethtool_get_perm_addr should return:

(quoted diff) +0 -2
-ENOENT if dev has no perm addr
-EAGAIN if dev perm addr hasn't been obtained yet

0 (and addr) in other cases

And how exactly should be the ethtool output improved?

Print something like 'No permanent address assigned' when the address is all-zeroes.

Ben.

Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.