Re: [PATCH v3 2/4] bus: fsl-mc: add restool userspace support

From: Stuart Yoder
Date: Tue Apr 03 2018 - 23:22:45 EST


On Tue, Apr 3, 2018 at 8:05 PM, Andrew Lunn <andrew@xxxxxxx> wrote:
>> Suppose you want to create and assign a network interface to a KVM
>> virtual machine, you would do something like the following using
>> a user space tool like restool:
>> -create a new (empty) dprc object
>> -create a new dpni and assign it to the dprc
>> -create a new dpio and assign it to the dprc
>> -create a new dpbp and assign it to the dprc
>> -create a new dpmcp and assign it to the dprc
>> -create a new dpmac and assign it to the dprc
>> -connect the dpni to the dpmac
>
> Hi Stuart
>
> It this connecting to a physical port at the bottom?

Yes.

> If so, i would expect that when you probe the device you just create
> all these for each physical port.

The problem is that there is not just one set of objects to implement a network
interface. For the highest throughput packet processing you need one dpio
per core. So, it will depend on what the requirements are. You might want
multiple dpbp (buffer pools) and set up pools of different size
buffers for different
packet classifications.

You might want to have other objects like a crypto accelerator (dpseci) in the
container as well.

The dprc is a container holding any combination of those objects. So you have
complete flexibility.

> You then just need to map one of
> them into the KVM, in the same way you map one PCI device into a KVM.
>
> If these are virtual devices, VF devices you would normally do
>
> echo 4 > /sys/class/net/<device name>/device/sriov_numvfs
>
> on the physical device to create virtual devices.
>
>> The fsl-mc bus and DPAA2 is very NXP-specific, so there doesn't
>> seem to be anything that can be made generic here to provide
>> more common benefit.
>
> Which is why you should try to avoid all of this. The user knows how
> to use standard linux commands and concepts. They don't want to have
> to learn the inside plumbing of your hardware.

I hear you. It is more complicated this way...having all these individual
objects vs just a single "bundle" of them that represents a NIC. But, that's
the way the DPAA2 hardware is, and we're implementing kernel support for
the hardware as it is.

Thanks,
Stuart