2008-12-08 08:12:49

by Hitoshi Mitake

[permalink] [raw]
Subject: [RFC] New functions to manipulate registers for ethtool


Hi

I want to add two new functions to ethtool.

One is for setting driver's registers on MMIO area like --change-eeprom option.
I think form of command line is like this,
ethtool -X|--set-register ethX [offset N(in bytes)] [value N(single byte value)]

Another function is for reading driver's register on MMIO.
Currently, there is --register-dump option for dumping registers.
But I want finer granularity one which unit of manipulation is byte.
Like this,
ethtool -B|--dump-register-byte ethX [offset N(in bytes)]
(then print one byte to stdout)

Of course, names of options is temporary.

Because e1000e driver conflicts with some IPMI cards some time,
and the reasons of conflict are setting of registers not supported by
other general options of ethtool.
If this function is added, examing cause of confliction will be much easier.

How do you think about this plan?
If this plan is not bad, and nobody is working on patch like this plan,
I want to do that.

Thanks

Hitoshi


2008-12-08 08:54:43

by David Miller

[permalink] [raw]
Subject: Re: [RFC] New functions to manipulate registers for ethtool

From: Hitoshi Mitake <[email protected]>
Date: Mon, 8 Dec 2008 17:12:30 +0900

> I want to add two new functions to ethtool.
>
> One is for setting driver's registers on MMIO area like
> --change-eeprom option.

You can map the registers into userspace using the bus
level mmap facilities exported to userspace.

No ethtool support is necessary for this.

> Another function is for reading driver's register on MMIO.

Also not necessary, for the same reasons described
above.

2008-12-08 09:02:11

by Hitoshi Mitake

[permalink] [raw]
Subject: Re: [RFC] New functions to manipulate registers for ethtool

On Mon, 08 Dec 2008 00:54:31 -0800 (PST)
David Miller <[email protected]> wrote:

> From: Hitoshi Mitake <[email protected]>
> Date: Mon, 8 Dec 2008 17:12:30 +0900
>
> > I want to add two new functions to ethtool.
> >
> > One is for setting driver's registers on MMIO area like
> > --change-eeprom option.
>
> You can map the registers into userspace using the bus
> level mmap facilities exported to userspace.
>
> No ethtool support is necessary for this.
>
> > Another function is for reading driver's register on MMIO.
>
> Also not necessary, for the same reasons described
> above.

I didn't know that, thanks!
I'll work with my problems with mmap and userspace program.

2008-12-08 09:02:42

by Valdis Klētnieks

[permalink] [raw]
Subject: Re: [RFC] New functions to manipulate registers for ethtool

On Mon, 08 Dec 2008 00:54:31 PST, David Miller said:
> From: Hitoshi Mitake <[email protected]>
> Date: Mon, 8 Dec 2008 17:12:30 +0900
>
> > I want to add two new functions to ethtool.
> >
> > One is for setting driver's registers on MMIO area like
> > --change-eeprom option.
>
> You can map the registers into userspace using the bus
> level mmap facilities exported to userspace.
>
> No ethtool support is necessary for this.

Yes, but if Hitoshi wants to tell a user "run this command and send me
the output", what's the incantation the user needs to use?

The user probably has ethtool installed if they have a semi-sane distro.
Their eyeballs are just gonna glaze over if they're asked to map the registers
into userspace.. ;)


Attachments:
(No filename) (226.00 B)

2008-12-08 09:06:55

by David Miller

[permalink] [raw]
Subject: Re: [RFC] New functions to manipulate registers for ethtool

From: [email protected]
Date: Mon, 08 Dec 2008 04:01:43 -0500

> On Mon, 08 Dec 2008 00:54:31 PST, David Miller said:
> > From: Hitoshi Mitake <[email protected]>
> > Date: Mon, 8 Dec 2008 17:12:30 +0900
> >
> > > I want to add two new functions to ethtool.
> > >
> > > One is for setting driver's registers on MMIO area like
> > > --change-eeprom option.
> >
> > You can map the registers into userspace using the bus
> > level mmap facilities exported to userspace.
> >
> > No ethtool support is necessary for this.
>
> Yes, but if Hitoshi wants to tell a user "run this command and send me
> the output", what's the incantation the user needs to use?

That's an awful reason to have to two ways of doing the exact same
thing from userspace.

Write the tool. Someone will if it's important enough (in fact
such code probably exists already).

2008-12-08 09:26:30

by Valdis Klētnieks

[permalink] [raw]
Subject: Re: [RFC] New functions to manipulate registers for ethtool

On Mon, 08 Dec 2008 01:06:34 PST, David Miller said:

> That's an awful reason to have to two ways of doing the exact same
> thing from userspace.

Which is why 'sysctl' and 'echo > /proc/sys/....' both exist, right?


Attachments:
(No filename) (226.00 B)

2008-12-08 09:57:31

by David Miller

[permalink] [raw]
Subject: Re: [RFC] New functions to manipulate registers for ethtool

From: [email protected]
Date: Mon, 08 Dec 2008 04:26:12 -0500

> On Mon, 08 Dec 2008 01:06:34 PST, David Miller said:
>
> > That's an awful reason to have to two ways of doing the exact same
> > thing from userspace.
>
> Which is why 'sysctl' and 'echo > /proc/sys/....' both exist, right?

We're essentially getting rid of the former, so your sarcasm was
poorly applied, sorry.

2008-12-08 17:37:16

by Jesse Brandeburg

[permalink] [raw]
Subject: RE: [RFC] New functions to manipulate registers for ethtool

David Miller wrote:
> From: [email protected]
> Date: Mon, 08 Dec 2008 04:01:43 -0500
>
>> On Mon, 08 Dec 2008 00:54:31 PST, David Miller said:
>>> From: Hitoshi Mitake <[email protected]>
>>> Date: Mon, 8 Dec 2008 17:12:30 +0900
>>>
>>>> I want to add two new functions to ethtool.
>>>>
>>>> One is for setting driver's registers on MMIO area like
>>>> --change-eeprom option.
>>>
>>> You can map the registers into userspace using the bus
>>> level mmap facilities exported to userspace.

one hiccup, Arjan recently added functionality to the kernel that could
disallow this unless a user overrides at boot. [1]

also, there is a .config option that disallows this but I'm just
mentioning it for posterity.

>>> No ethtool support is necessary for this.
>>
>> Yes, but if Hitoshi wants to tell a user "run this command and send
>> me the output", what's the incantation the user needs to use?
>

ethregs -s <bus>:<dev>.<fn>

> That's an awful reason to have to two ways of doing the exact same
> thing from userspace.
>
> Write the tool. Someone will if it's important enough (in fact
> such code probably exists already).

Hi Hitoshi,
you probably want to download and install our ethregs utility.
http://prdownloads.sf.net/e1000/ethregs-1.1.tar.gz
(this is not a direct link as it seems but gets redirected to a mirror
page, usually)

Please let me know if it doesn't support your device ID.



[1] http://marc.info/?l=linux-kernel&m=122747416512900&w=2


Attachments:
smime.p7s (6.55 kB)

2008-12-10 11:26:44

by Hitoshi Mitake

[permalink] [raw]
Subject: Re: [RFC] New functions to manipulate registers for ethtool

On Mon, 8 Dec 2008 09:36:53 -0800
"Brandeburg, Jesse" <[email protected]> wrote:

> David Miller wrote:
> > From: [email protected]
> > Date: Mon, 08 Dec 2008 04:01:43 -0500
> >
> >> On Mon, 08 Dec 2008 00:54:31 PST, David Miller said:
> >>> From: Hitoshi Mitake <[email protected]>
> >>> Date: Mon, 8 Dec 2008 17:12:30 +0900
> >>>
> >>>> I want to add two new functions to ethtool.
> >>>>
> >>>> One is for setting driver's registers on MMIO area like
> >>>> --change-eeprom option.
> >>>
> >>> You can map the registers into userspace using the bus
> >>> level mmap facilities exported to userspace.
>
> one hiccup, Arjan recently added functionality to the kernel that could
> disallow this unless a user overrides at boot. [1]
>
> also, there is a .config option that disallows this but I'm just
> mentioning it for posterity.
>
> >>> No ethtool support is necessary for this.
> >>
> >> Yes, but if Hitoshi wants to tell a user "run this command and send
> >> me the output", what's the incantation the user needs to use?
> >
>
> ethregs -s <bus>:<dev>.<fn>
>
> > That's an awful reason to have to two ways of doing the exact same
> > thing from userspace.
> >
> > Write the tool. Someone will if it's important enough (in fact
> > such code probably exists already).

Thanks for your replying, David, Valdis and Jesse.

>
> Hi Hitoshi,
> you probably want to download and install our ethregs utility.
> http://prdownloads.sf.net/e1000/ethregs-1.1.tar.gz
> (this is not a direct link as it seems but gets redirected to a mirror
> page, usually)
>

This is a nice software for me, Thanks.

> Please let me know if it doesn't support your device ID.

I used this on my environment.
My NICs are 82573L and 82573E. ethregs could detected them well.

It seems that this program doesn't support for writing value to registers.
I think making ethregs to support writing is not bad idea.
If you are not planning, I want to do that.

I'm not a professional of Intel's NICs.
How do you think?