[dpdk-dev] [PATCH v2] ethdev: fix updating device data when ops pointer is NULL
Andrew Rybchenko
arybchenko at solarflare.com
Fri Jan 17 08:57:25 CET 2020
On 1/17/20 9:23 AM, Wei Hu (Xavier) wrote:
> From: "Wei Hu (Xavier)" <xavier.huwei at huawei.com>
I think summary is misleading. It is too generic and does not
mention VLAN offloads. Consider something like:
ethdev: fix VLAN offloads set if no driver callback
> Currently, there is a potential problem that changing the content of
> dev->data->dev_conf.rxmode.offloads even when the pointer named
> dev->dev_ops->vlan_offload_set is NULL in the API function named
> rte_eth_dev_set_vlan_offload.
Consider to change
"when the pointer named dev->dev_ops->vlan_offload_set is NULL in the
API function named rte_eth_dev_set_vlan_offload." to "when there is no
vlan_offload_set driver callback."
> It is a good idea that prevent the side effect and make the API return
> success if no change requested. This patch fixes the problem, the detail
> information as below:
> - Update a local 'dev_offloads' variable, instead of directly updating the
> device config data
> - if no change requested, "mask == 0", return success
> - if change requested, check the 'vlan_offload_set' dev_ops in this stage
> - assign the local 'dev_offloads' to 'dev->data->dev_conf.rxmode.offloads'
> and call the dev_ops
> - On error recover the 'dev->data->dev_conf.rxmode.offloads' to
> 'orig_offloads'
I see no point to repeat in description what the code does.
IMHO it is sufficient to mention main ideas:
- keep possibility to do dummy set even if there is no driver
callback
- do not touch Rx mode offloads in device data before
checking the driver callback availability
- ensure that Rx mode offloads are rolled back correctly if
driver callback returns error
> Fixes: 01eb53eefeb4 ("ethdev: rename folder to library name")
I think it is wrong Fixes. Rename just moves the code, it is
not the changeset which introduces the bug.
> Cc: stable at dpdk.org
>
> Signed-off-by: Wei Hu (Xavier) <xavier.huwei at huawei.com>
> Signed-off-by: Chunsong Feng <fengchunsong at huawei.com>
> Signed-off-by: Min Wang (Jushui) <wangmin3 at huawei.com>
> Signed-off-by: Min Hu (Connor) <humin29 at huawei.com>
with above notes processed
Reviewed-by: Andrew Rybchenko <arybchenko at solarflare.com>
More information about the dev
mailing list