Hi all

From: Ferruh Yigit, Thursday, April 19, 2018 2:08 PM
> > But rte_eth_dev_release_port() is still broken because of this change,
> > please check _rte_eth_dev_callback_process() which uses dev->data-
> >port_id.

The issue is that a DESTROY callback gets port_id=0 all the time, regardless 
the destroyed port id.

Let's discuss about the fix:

There are 2 options for the DESTROY event meaning:

1. The device is going to be destroyed in the future (a bit after the callbacks 
calling).
        The user may think that there is a valid data in the device structure 
in the callback time,
        Thus, he may use it.
        The fix here is to move the callback to the start of the function,
        In this time the data field is still valid.

2. The device was already destroyed in the past (a bit before the callbacks 
calling).
        The user should think that there is no any valid data in the device 
structure in the callback time,
        Thus, he doesn't use it.
        The issue here:
        _rte_eth_dev_callback_process() assumes there is a valid data in the 
data field  all the time,
        But in this case the data field is not valid because the device was 
already destroyed.
        Optional fixes:
        1. Always keep the data->port_id valid.
        2. keep the data->port_id valid only for the 
_rte_eth_dev_callback_process() call.
        2. Change _rte_eth_dev_callback_process() arg from "struct rte_eth_dev 
*dev" to "uint16_t port_id"
                a. Need to change all the calls for this internal API.

I vote to 2.1.


What do you think?

Matan.
        



Reply via email to