Skip to contentSkip to conversation

rtnetlink and many VFs

DISCUSSION Ben Hutchings 3 participants 9 messages Apr 21, 2011 – Apr 22, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

My colleagues have been working on SR-IOV support for sfc. The hardware supports up to 127 VFs per port.

If we configure all 127 VFs through the net device, an RTM_GETLINK dump will need to include messages describing them, with a total size of:

127 * (sizeof(struct ifla_vf_mac) + sizeof(struct ifla_vf_vlan) +
sizeof(struct ifla_vf_tx_rate) + protocol overhead)

Quoted 1 line

7112

These messages are nested within the message describing the device as a whole, so they cannot be split. The maximum size of an outgoing netlink message, based on NLMSG_GOODSIZE, seems to be min(PAGE_SIZE, 8192). So when PAGE_SIZE = 4096 it is simply impossible to dump information about such a device!

I think it needs to be made possible to grow a netlink skb during generation of the first message. Userspace may still be unable to receive the large message but at least it has a chance.

Ben.

Signature · 3 lines
Ben Hutchings, Senior Software 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.
#1 lore raw
Quoted 24 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Ben Hutchings
Sent: Thursday, April 21, 2011 7:36 AM
To: David Miller
Cc: netdev; sf-linux-drivers
Subject: rtnetlink and many VFs

My colleagues have been working on SR-IOV support for sfc. The hardware supports up to 127 VFs per port.

If we configure all 127 VFs through the net device, an RTM_GETLINK dump will need to include messages describing them, with a total size of:

127 * (sizeof(struct ifla_vf_mac) + sizeof(struct ifla_vf_vlan) +
sizeof(struct ifla_vf_tx_rate) + protocol overhead)

Quoted 1 line

7112

These messages are nested within the message describing the device as a whole, so they cannot be split. The maximum size of an outgoing netlink message, based on NLMSG_GOODSIZE, seems to be min(PAGE_SIZE, 8192). So when PAGE_SIZE = 4096 it is simply impossible to dump information about such a device!

Quoted 3 lines

I think it needs to be made possible to grow a netlink skb during generation of the first message. Userspace may still be unable to receive the large message but at least it has a chance.

I've been looking at this one too. The limit seems to be about 40 or so in the most common case. My netlink fu is weak but I've been looking at the code in iproute2/ip and netlink to see what we can do about it.

As more VFs become possible it really needs a fix. I was thinking about something along the lines of this:

# ip link show eth(x) vf (n)

Where eth(x) is the physical function that owns the VFs and (n) is the specific VF you want information for. That way one could easily script something that loops through the VFs and gets the information for each. This really becomes necessary when we start adding additional MAC and VLAN filters for each VF that need to be displayed. In that case you can only show a few VFs before you run out of space.

In any case I've been working on an RFC patch for this and hope to have it soon. I consider this a pretty serious limitation and one could even view it as a bug.

- Greg
Greg Rose
LAD Division
Intel Corp.

#2 lore raw
Quoted 24 lines · Gregory V
Quoted 24 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Ben Hutchings
Sent: Thursday, April 21, 2011 7:36 AM
To: David Miller
Cc: netdev; sf-linux-drivers
Subject: rtnetlink and many VFs

My colleagues have been working on SR-IOV support for sfc. The hardware supports up to 127 VFs per port.

If we configure all 127 VFs through the net device, an RTM_GETLINK dump will need to include messages describing them, with a total size of:

127 * (sizeof(struct ifla_vf_mac) + sizeof(struct ifla_vf_vlan) +
sizeof(struct ifla_vf_tx_rate) + protocol overhead)

Quoted 1 line

7112

These messages are nested within the message describing the device as a whole, so they cannot be split. The maximum size of an outgoing netlink message, based on NLMSG_GOODSIZE, seems to be min(PAGE_SIZE, 8192). So when PAGE_SIZE = 4096 it is simply impossible to dump information about such a device!

Quoted 6 lines
Quoted 3 lines

I think it needs to be made possible to grow a netlink skb during generation of the first message. Userspace may still be unable to receive the large message but at least it has a chance.

I've been looking at this one too. The limit seems to be about 40 or so in the most common case.

Right. When Steve Hodgson investigated this here, he found that 46 VFs would fit.

Quoted 6 lines

My netlink fu is weak but I've been looking at the code in iproute2/ip and netlink to see what we can do about it.

As more VFs become possible it really needs a fix. I was thinking about something along the lines of this:

Quoted 8 lines
# ip link show eth(x) vf (n)

Where eth(x) is the physical function that owns the VFs and (n) is the specific VF you want information for. That way one could easily script something that loops through the VFs and gets the information for each. This really becomes necessary when we start adding additional MAC and VLAN filters for each VF that need to be displayed. In that case you can only show a few VFs before you run out of space.

I think that what 'ip link show' is doing now seems to be perfectly valid. It allocates a 16K buffer which would be enough if netlink didn't apply this PAGE_SIZE limit to single messages.

Quoted 3 lines

In any case I've been working on an RFC patch for this and hope to have it soon. I consider this a pretty serious limitation and one could even view it as a bug.

It is certainly a bug. rtnetlink is the currently favoured API for querying and configuring network device settings, but there are now valid device settings that cannot be queried.

Ben.

Signature · 3 lines
Ben Hutchings, Senior Software 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 30 lines

-----Original Message-----
From: Ben Hutchings [mailto:[email protected]]
Sent: Thursday, April 21, 2011 10:40 AM
To: Rose, Gregory V
Cc: David Miller; netdev; sf-linux-drivers
Subject: RE: rtnetlink and many VFs

Quoted 2 lines · Gregory V
Quoted 2 lines

-----Original Message-----
From: [email protected] [mailto:netdev-

[email protected]]

Quoted 10 lines
Quoted 6 lines

On Behalf Of Ben Hutchings
Sent: Thursday, April 21, 2011 7:36 AM
To: David Miller
Cc: netdev; sf-linux-drivers
Subject: rtnetlink and many VFs

As more VFs become possible it really needs a fix. I was thinking about something along the lines of this:

Quoted 8 lines
# ip link show eth(x) vf (n)

Where eth(x) is the physical function that owns the VFs and (n) is the specific VF you want information for. That way one could easily script something that loops through the VFs and gets the information for each. This really becomes necessary when we start adding additional MAC and VLAN filters for each VF that need to be displayed. In that case you can only show a few VFs before you run out of space.

Quoted 3 lines

I think that what 'ip link show' is doing now seems to be perfectly valid. It allocates a 16K buffer which would be enough if netlink didn't apply this PAGE_SIZE limit to single messages.

Ah, I hadn't seen that it was allocating 16K, that would then be enough for 128 VFs but in the future would not be enough for 40Gig (or higher speed) devices that might support two or 4 times that many VFs. I still feel like eventually the number of VFs will outgrow the capability of a single message to handle, especially when VFs will have the capability of having multiple MAC address and VLAN filters assigned to them. And it seems orthogonal to me to mirror the 'ip link set eth(x) vf (n)' syntax with a 'ip link show eth(x) vf (n)' syntax.

That's just me though.

Quoted 4 lines

It is certainly a bug. rtnetlink is the currently favoured API for querying and configuring network device settings, but there are now valid device settings that cannot be queried.

I'll look into just fixing the bug for now and reserve (at least what I consider to be) future improvements for later.

- Greg

#4 lore raw
Quoted 30 lines · Gregory V
Quoted 30 lines

-----Original Message-----
From: Ben Hutchings [mailto:[email protected]]
Sent: Thursday, April 21, 2011 10:40 AM
To: Rose, Gregory V
Cc: David Miller; netdev; sf-linux-drivers
Subject: RE: rtnetlink and many VFs

Quoted 2 lines · Gregory V
Quoted 2 lines

-----Original Message-----
From: [email protected] [mailto:netdev-

[email protected]]

Quoted 18 lines
Quoted 6 lines

On Behalf Of Ben Hutchings
Sent: Thursday, April 21, 2011 7:36 AM
To: David Miller
Cc: netdev; sf-linux-drivers
Subject: rtnetlink and many VFs

As more VFs become possible it really needs a fix. I was thinking about something along the lines of this:

# ip link show eth(x) vf (n)

Where eth(x) is the physical function that owns the VFs and (n) is the specific VF you want information for. That way one could easily script something that loops through the VFs and gets the information for each. This really becomes necessary when we start adding additional MAC and VLAN filters for each VF that need to be displayed. In that case you can only show a few VFs before you run out of space.

Quoted 7 lines
Quoted 3 lines

I think that what 'ip link show' is doing now seems to be perfectly valid. It allocates a 16K buffer which would be enough if netlink didn't apply this PAGE_SIZE limit to single messages.

Ah, I hadn't seen that it was allocating 16K, that would then be enough for 128 VFs but in the future would not be enough for 40Gig (or higher speed) devices that might support two or 4 times that many VFs.

There are only 256 available function addresses per PCIe link, so there can be at most 255 VFs associated with a single PF.

(The function number could be extended further by effectively assigning multiple bus numbers to a link, but that would be a significantly more disruptive change than ARI.)

Quoted 8 lines

I still feel like eventually the number of VFs will outgrow the capability of a single message to handle, especially when VFs will have the capability of having multiple MAC address and VLAN filters assigned to them. And it seems orthogonal to me to mirror the 'ip link set eth(x) vf (n)' syntax with a 'ip link show eth(x) vf (n)' syntax.

That's just me though.

[...]

I think it would be a useful extension, but we have to keep the current API working as far as possible.

Ben.

Signature · 3 lines
Ben Hutchings, Senior Software 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.
#5 lore raw
Quoted 24 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Ben Hutchings
Sent: Thursday, April 21, 2011 11:12 AM
To: Rose, Gregory V
Cc: David Miller; netdev; sf-linux-drivers
Subject: RE: rtnetlink and many VFs

Quoted 15 lines · Gregory V
Quoted 7 lines

-----Original Message-----
From: Ben Hutchings [mailto:[email protected]]
Sent: Thursday, April 21, 2011 10:40 AM
To: Rose, Gregory V
Cc: David Miller; netdev; sf-linux-drivers
Subject: RE: rtnetlink and many VFs

I still feel like eventually the number of VFs will outgrow the capability of a single message to handle, especially when VFs will have the capability of having multiple MAC address and VLAN filters assigned to them. And it seems orthogonal to me to mirror the 'ip link set eth(x) vf (n)' syntax with a 'ip link show eth(x) vf (n)' syntax.

Quoted 5 lines
Quoted 1 line

That's just me though.

[...]

I think it would be a useful extension, but we have to keep the current API working as far as possible.

Sure, sounds good. I'm working on something that will patch things up for the present use case right now.

- Greg

#6 lore raw
In reply to Ben Hutchings
Quoted 12 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Ben Hutchings
Sent: Thursday, April 21, 2011 11:12 AM
To: Rose, Gregory V
Cc: David Miller; netdev; sf-linux-drivers
Subject: RE: rtnetlink and many VFs

Quoted 4 lines
Quoted 3 lines

I think that what 'ip link show' is doing now seems to be perfectly valid. It allocates a 16K buffer which would be enough if netlink didn't apply this PAGE_SIZE limit to single messages.

If someone who knew (or knows) a bit more about netlink could point out where this limitation is set in the code I'd really appreciate it. I've been poking around for a few hours and still can't find it. I found the spot in the iproute2 code where the 16k is allocated and traced it down to the netlink socket call but from the kernel side I just can't find this PAGE_SIZE limit invocation.

- Greg

maintainer
#7 lore raw

From: "Rose, Gregory V" <[email protected]>
Date: Fri, 22 Apr 2011 15:29:41 -0700

Quoted 4 lines

If someone who knew (or knows) a bit more about netlink could point out where this limitation is set in the code I'd really appreciate it. I've been poking around for a few hours and still can't find it.

NLMSG_GOODSIZE

#8 lore raw
Quoted 11 lines

-----Original Message-----
From: David Miller [mailto:[email protected]]
Sent: Friday, April 22, 2011 3:32 PM
To: Rose, Gregory V
Cc: [email protected]; [email protected]; linux-net- [email protected]
Subject: Re: rtnetlink and many VFs

From: "Rose, Gregory V" <[email protected]>
Date: Fri, 22 Apr 2011 15:29:41 -0700

Quoted 6 lines
Quoted 4 lines

If someone who knew (or knows) a bit more about netlink could point out where this limitation is set in the code I'd really appreciate it. I've been poking around for a few hours and still can't find it.

NLMSG_GOODSIZE

Thank you sir!

- Greg