ethdev: fix VLAN offloads set if no driver callback
authorWei Hu (Xavier) <xavier.huwei@huawei.com>
Fri, 17 Jan 2020 11:49:14 +0000 (19:49 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 17 Jan 2020 18:59:19 +0000 (19:59 +0100)
commit2e02a2afff77d8cf7acb9a3bf5272c582b688307
treeb3464ef95093c72c8d9a31b6be2fbea859941835
parent47e7ad1b91811fe04ae8bd1fe1928c5e06cc79fe
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 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:
 - 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: 81f9db8ecc2c ("ethdev: add vlan offload support")
Cc: stable@dpdk.org
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Chunsong Feng <fengchunsong@huawei.com>
Signed-off-by: Min Wang (Jushui) <wangmin3@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
lib/librte_ethdev/rte_ethdev.c