Re: [PATCH] net/core: Save the port number a netdevice uses

2010-06-02 Thread David Miller
From: Ben Hutchings 
Date: Wed, 02 Jun 2010 17:42:29 +0100

> On Wed, 2010-05-26 at 02:16 -0700, David Miller wrote:
>> From: Eli Cohen 
>> Date: Wed, 26 May 2010 12:08:52 +0300
>> 
>> > So if I understand you correctly, you think that I should not bother
>> > to set a default value of 1. Each driver that cares about the value
>> > of this field, will set it however they want.
>> 
>> I actually mean that the value "0" should mean the first port,
>> the value "1" should mean the second port, etc.
> 
> There's a compatibility problem here though: when user-space looks at
> this number it can't tell whether "0" really means the first port or
> that the driver isn't setting dev_id.

That's perfect, it means we don't have to add explicit settings to
drivers which driver only one port.  Ie. the vast majority of
cases.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] net/core: Save the port number a netdevice uses

2010-06-02 Thread Ben Hutchings
On Wed, 2010-05-26 at 02:16 -0700, David Miller wrote:
> From: Eli Cohen 
> Date: Wed, 26 May 2010 12:08:52 +0300
> 
> > So if I understand you correctly, you think that I should not bother
> > to set a default value of 1. Each driver that cares about the value
> > of this field, will set it however they want.
> 
> I actually mean that the value "0" should mean the first port,
> the value "1" should mean the second port, etc.

There's a compatibility problem here though: when user-space looks at
this number it can't tell whether "0" really means the first port or
that the driver isn't setting dev_id.  In order to tell that it would
have to check the driver or kernel version too, and this is really nasty
(what if the driver was backported?).  So I think that 1-based numbering
for drivers that previously didn't set dev_id.

Why does this matter?  I'm maintaining the firmware update program for
Solarflare NICs under Linux.  Some of the firmware it updates is
per-port and some of it is per-board.  It needs to be able to tell which
net and PCI devices are associated with the same board.  At the moment
it works on the basis of PCI addresses, but this is unreliable in the
presence of virtualisation.  It would be better to use board serial
number and the port identifier that I just changed the driver to use,
but since there are existing driver versions always leave dev_id = 0, I
it needs to be able to tell whether dev_id is meaningful.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] net/core: Save the port number a netdevice uses

2010-05-26 Thread Eli Cohen
On Wed, May 26, 2010 at 02:16:35AM -0700, David Miller wrote:
> 
> I actually mean that the value "0" should mean the first port,
> the value "1" should mean the second port, etc.

OK, thanks for clarifying. I'll send a new patch soon.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] net/core: Save the port number a netdevice uses

2010-05-26 Thread David Miller
From: Eli Cohen 
Date: Wed, 26 May 2010 12:08:52 +0300

> So if I understand you correctly, you think that I should not bother
> to set a default value of 1. Each driver that cares about the value
> of this field, will set it however they want.

I actually mean that the value "0" should mean the first port,
the value "1" should mean the second port, etc.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] net/core: Save the port number a netdevice uses

2010-05-26 Thread Eli Cohen
On Wed, May 26, 2010 at 01:55:26AM -0700, David Miller wrote:
> From: Eli Cohen 
> Date: Wed, 26 May 2010 11:45:23 +0300
> 
> 
> What's wrong with using the existing dev_id sysfs file name and saying
> that it means the port number of the card?
> 
> Nobody, and I really mean nobody, uses this thing any more.
> 
> It used to be a way for devices like the qeth driver to get it's
> IPV6 EUI48 value set properly for local IPV6 addresses assigned
> to the device, but that got fixed in a different way.
> 
> So we can use this value however we wish now, and it defaults to zero
> for every single device now, and is propagated across VLAN devices,
> which is perfect.

OK. So if I understand you correctly, you think that I should not
bother to set a default value of 1. Each driver that cares about the
value of this field, will set it however they want.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] net/core: Save the port number a netdevice uses

2010-05-26 Thread David Miller
From: Eli Cohen 
Date: Wed, 26 May 2010 11:45:23 +0300

> Do you think we should use dev_id also for the sysfs file name so
> every driver can choose to interpret this field as it chooses to, or
> should I keep the sysfs file name as "port_number"?

What's wrong with using the existing dev_id sysfs file name and saying
that it means the port number of the card?

Nobody, and I really mean nobody, uses this thing any more.

It used to be a way for devices like the qeth driver to get it's
IPV6 EUI48 value set properly for local IPV6 addresses assigned
to the device, but that got fixed in a different way.

So we can use this value however we wish now, and it defaults to zero
for every single device now, and is propagated across VLAN devices,
which is perfect.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] net/core: Save the port number a netdevice uses

2010-05-26 Thread Eli Cohen
On Wed, May 26, 2010 at 01:39:26AM -0700, David Miller wrote:
> From: Eli Cohen 
> Date: Wed, 26 May 2010 11:17:02 +0300
> 
> > Today, there are no means to know which port of a hardware device a netdev
> > interface uses. This patch adds a new field to struct net_device that is 
> > used
> > to store this value. The network driver should use the SET_NETDEV_PORT_NUM()
> > macro to set the port number for the device it manages. For drivers that do 
> > not
> > set a value, a default value of 1 is set at alloc_netdev_mq().
> > This patch also makes use of this feature in the mlx4_en driver.
> > 
> > Signed-off-by: Eli Cohen 
> 
> We have an existing dev_id, use it.

Do you think we should use dev_id also for the sysfs file name so
every driver can choose to interpret this field as it chooses to, or
should I keep the sysfs file name as "port_number"?
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] net/core: Save the port number a netdevice uses

2010-05-26 Thread David Miller
From: Eli Cohen 
Date: Wed, 26 May 2010 11:17:02 +0300

> Today, there are no means to know which port of a hardware device a netdev
> interface uses. This patch adds a new field to struct net_device that is used
> to store this value. The network driver should use the SET_NETDEV_PORT_NUM()
> macro to set the port number for the device it manages. For drivers that do 
> not
> set a value, a default value of 1 is set at alloc_netdev_mq().
> This patch also makes use of this feature in the mlx4_en driver.
> 
> Signed-off-by: Eli Cohen 

We have an existing dev_id, use it.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html