[PATCH v5 4/5] net/ice: allowing stopping port to apply TM topology
Medvedkin, Vladimir
vladimir.medvedkin at intel.com
Fri Oct 25 19:02:23 CEST 2024
Acked-by: Vladimir Medvedkin <vladimir.medvedkin at intel.com>
On 23/10/2024 17:55, Bruce Richardson wrote:
> The rte_tm topology commit requires the port to be stopped on apply.
> Rather than just returning an error when the port is already started, we
> can stop the port, apply the topology to it and then restart it.
>
> Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
> ---
> drivers/net/ice/ice_tm.c | 23 +++++++++++++++++++----
> 1 file changed, 19 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ice/ice_tm.c b/drivers/net/ice/ice_tm.c
> index 4809bdde40..09e947a3b1 100644
> --- a/drivers/net/ice/ice_tm.c
> +++ b/drivers/net/ice/ice_tm.c
> @@ -844,15 +844,30 @@ ice_hierarchy_commit(struct rte_eth_dev *dev,
> int clear_on_fail,
> struct rte_tm_error *error)
> {
> - RTE_SET_USED(error);
> - /* commit should only be done to topology before start! */
> - if (dev->data->dev_started)
> - return -1;
> + bool restart = false;
> +
> + /* commit should only be done to topology before start
> + * If port is already started, stop it and then restart when done.
> + */
> + if (dev->data->dev_started) {
> + if (rte_eth_dev_stop(dev->data->port_id) != 0) {
> + error->message = "Device failed to Stop";
> + return -1;
> + }
> + restart = true;
> + }
>
> int ret = commit_new_hierarchy(dev);
> if (ret < 0 && clear_on_fail) {
> ice_tm_conf_uninit(dev);
> ice_tm_conf_init(dev);
> }
> +
> + if (restart) {
> + if (rte_eth_dev_start(dev->data->port_id) != 0) {
> + error->message = "Device failed to Start";
> + return -1;
> + }
> + }
> return ret;
> }
--
Regards,
Vladimir
More information about the dev
mailing list