How to use use restool destroy an object for dpaa2

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use use restool destroy an object for dpaa2

1,421 Views
Caishuang_1
Contributor I

Hi, experts

I use restool to create/destroy objects.

For example, create/destroy dpbp object

[root@TinyLSDK ~]$ restool dpbp create
dpbp.3 is created under dprc.1
[root@TinyLSDK ~]$ restool dprc assign dprc.1 --object=dpbp.3 --plugged=1
[ 943.367016] iommu: Adding device dpbp.3 to group 0

[root@TinyLSDK ~]$ echo dpbp.3 > /sys/bus/fsl-mc/drivers/fsl_mc_allocator/unbind
[root@TinyLSDK ~]$ restool dpbp destroy dpbp.3
dpbp.3 is destroyed
[ 1084.731149] iommu: Removing device dpbp.3 from group 0
[root@TinyLSDK ~]$

I want to know how /sys/bus/fsl-mc/drivers/fsl_mc_allocator/unbind works?

where is the source code for the implementation of unbind? I don't find something about unbind in fsl-mc-allocator.c?

I see the restool command: cmd_dprc_unassign in dprc_command.c. I think if want to unbind a object, should call the dprc unassign, just like when we create an object we need to call dprc assign.

Could you introduce the implementation process of unbind in detail?

Thank you very much!

 

 

 

 

 

 

Labels (1)
0 Kudos
3 Replies

1,412 Views
yipingwang
NXP TechSupport
NXP TechSupport

Please refer to Documentation/ABI/testing/sysfs-bus-fsl-mc

What: /sys/bus/fsl-mc/drivers/.../unbind
Description:
Writing a device location to this file will cause the
driver to attempt to unbind from the device found at
this location. The format for the location is Object.Id
and is the same as found in /sys/bus/fsl-mc/devices/.
For example:
# echo dpni.2 > /sys/bus/fsl-mc/drivers/fsl_dpaa2_eth/unbind

For the source code, please refer to "fsl_mc_allocator_remove" function in drivers/bus/fsl-mc/fsl-mc-allocator.c in Linux Kernel source code.

0 Kudos

1,400 Views
Caishuang_1
Contributor I

Hi, yiping

Thanks for your answers about restool,  I have a few questions want to check with you.

For example create/destroy dpbp object.

[root@TinyLSDK ~]$ restool dpbp create
dpbp.3 is created under dprc.1
[root@TinyLSDK ~]$ restool dprc assign dprc.1 --object=dpbp.3 --plugged=1
[ 943.367016] iommu: Adding device dpbp.3 to group 0

[root@TinyLSDK ~]$ echo dpbp.3 > /sys/bus/fsl-mc/drivers/fsl_mc_allocator/unbind
[root@TinyLSDK ~]$ restool dpbp destroy dpbp.3
dpbp.3 is destroyed
[ 1084.731149] iommu: Removing device dpbp.3 from group 0
[root@TinyLSDK ~]$

I know dprc-driver.c file set interrupt (dprc_setup_irq), when create a dpbp object, dprc trigger interrupt, load fsl-mc-allocator driver.

So when destroy a dpbp object, need to unload driver first, the echo dpbp.3 > /sys/bus/fsl-mc/drivers/fsl_mc_allocator/unbind is used to unload dpbp driver, right?

Create dpbp object, need execute two commands :restool dpbp create and restool dprc assign dprc.1 --object=dpbp.3 --plugged=1  

Does the restool dprc assign dprc.1 --object=dpbp.3 --plugged=1  use to trigger interrupt and load driver?

I test on vxworks that only execute restool dpbp create , also can trigger dprc interrupt and load driver,  so what does the command(restool dprc assign dprc.1 --object=dpbp.3 --plugged=1) really do?

I see function fsl_mc_allocator_remove()used to remove mc device from the resource pool, that is unload the dpbp driver, remove dpbp device from system.

Why not use restool dprc unassign dprc.1 object=dpbp.3, remove dpbp object from dprc.1?

Can you explain the command about cmd_dprc_assign and cmd_dprc_unassign?

I see script provide ls-addni dpmac.3 to enable a MAC interface, this command call restool to create dpbp, dpcon, dpmcp, dpni etc objects, and connect dpmac to dpni.

Do you have commnd to disable the MAC interface which will destroy the objects which are created in ls-addni,  disconnect dpmac and  dpni? So we dont need to destroy every object respectively?

 

 

0 Kudos

1,393 Views
yipingwang
NXP TechSupport
NXP TechSupport
  1. So when destroy a dpbp object, need to unload driver first, the echo dpbp.3 > /sys/bus/fsl-mc/drivers/fsl_mc_allocator/unbind

is used to unload dpbp driver, right?

 

   Yes. It needs to unbind the device from driver with the above echo command.

 

  1. Create dpbp object, need execute two commands :restool dpbp create and restool dprc assign dprc.1 --object=dpbp.3 --plugged=1 Does the restool dprc assign dprc.1 --object=dpbp.3 --plugged=1  use to trigger interrupt and load driver?

 

        command "restool dpbp create" is used to create the dpbp object, and you can find the device has been created after this command.

        command "restool dprc assign ..." is used to move an object or resource from a parent container to a child container.

        Pay attention that it cannot bind the device to driver if the device is not plugged,

        and that is why you need to run assign command with --plugged=1

       

  1. so what does the command(restool dprc assign dprc.1 --object=dpbp.3 --plugged=1) really do?

 

        Please refer to the above explanation.

 

  1. Why not use restool dprc unassign dprc.1 object=dpbp.3, remove dpbp object from dprc.1?

 

        It needs to unbind the device from driver first. No reason to run unassign command.

 

  1. Can you explain the command about cmd_dprc_assign and cmd_dprc_unassign?

        Please refer to the above explanation. Suggest to refer to LSDKUG for more info about restool commands.

 

  1. Do you have commnd to disable the MAC interface which will destroy the objects which are created in ls-addni,  disconnect dpmac and  dpni?

 

        I did not know command to do this. You may refer to script /usr/local/dpdk/dpaa2/destroy_dynamic_dpl.sh

 

0 Kudos