app/testpmd: fix DCB set failure in FreeBSD by clang
PATCH 1/1 app/testpmd: fix DCB set failure in FreeBSD by clang
When set DCB in testpmd by clang, there is a segmentation fault. It is because the local variable rss_conf in get_eth_dcb_conf() is not cleared, so that the pointer member variable rss_key has a random address, which leads to an error in the following processing. This patch initialized the local variable rss_conf to avoid random address.
--- app/test-pmd/testpmd.c | 1 + 1 file changed, 1 insertion(+)
app/test-pmd/testpmd.c +1 -0
@@ -3408,6 +3408,7 @@ get_eth_dcb_conf(portid_t pid, struct rte_eth_conf *eth_conf,int32_t rc;struct rte_eth_rss_conf rss_conf; +memset (&rss_conf,0 ,sizeof (struct rte_eth_rss_conf ));/* * Builds up the correct configuration for dcb+vt based on the vlan tags array * given above, and the number of traffic classes available for use.
Signature · 1 line
2.17.1
Quoted 37 lines
-----Original Message-----
From: Xu, Ting <[email protected]>
Sent: Monday, May 11, 2020 6:25 PM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Xing, Beilei <[email protected]>; Iremonger, Bernard <[email protected]>; [email protected]
Subject: [PATCH v1] app/testpmd: fix DCB set failure in FreeBSD by clangWhen set DCB in testpmd by clang, there is a segmentation fault. It is because the local variable
rss_confinget_eth_dcb_conf()is not cleared, so that the pointer member variablerss_keyhas a random address, which leads to an error in the following processing. This patch initialized the local variablerss_confto avoid random address.Fixes b57b66a97ebf ("app/testpmd: support mbuf dynamic flag")Signed-off-by Ting Xu <[email protected]>--- app/test-pmd/testpmd.c | 1 + 1 file changed, 1 insertion(+)app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0
-0
99bacddbf..1276476ca100644app/test-pmd/testpmd.c +1
-0@@ -3408,6 +3408,7 @@ get_eth_dcb_conf(portid_t pid, struct rte_eth_conf *eth_conf, int32_t rc;struct rte_eth_rss_conf rss_conf; +memset (&rss_conf,0 ,sizeof (struct rte_eth_rss_conf ));/* * Builds up the correct configuration for dcb+vt based on the vlan
Quoted 4 lines
tags array
* given above, and the number of traffic classes available for use.
--
2.17.1
Regards,
HuangZhiMin
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Ting Xu
Sent: Monday, May 11, 2020 6:25 PM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Xing, Beilei <[email protected]>; Iremonger, Bernard <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v1] app/testpmd: fix DCB set failure in FreeBSD by clang
When set DCB in testpmd by clang, there is a segmentation fault.
It is because the local variable rss_conf in get_eth_dcb_conf() is not cleared, so that the pointer member variable rss_key has a random address, which leads to an error in the following processing. This patch initialized the local variable rss_conf to avoid random address.
--- app/test-pmd/testpmd.c | 1 + 1 file changed, 1 insertion(+)
app/test-pmd/testpmd.c +1 -0
@@ -3408,6 +3408,7 @@ get_eth_dcb_conf(portid_t pid, struct rte_eth_conf *eth_conf,int32_t rc;struct rte_eth_rss_conf rss_conf; +memset (&rss_conf,0 ,sizeof (struct rte_eth_rss_conf ));/* * Builds up the correct configuration for dcb+vt based on the vlan tags array * given above, and the number of traffic classes available for use.
--
2.17.1
Quoted 6 lines · Ting Xu
When set DCB in testpmd by clang, there is a segmentation fault. It is because the local variable
rss_confinget_eth_dcb_conf()is not cleared, so that the pointer member variablerss_keyhas a random address, which leads to an error in the following processing. This patch initialized the local variablerss_confto avoid random address.
This is nothing really FreeBSD or clang issue, although it may be reproduced that environment, this is a pointer with random value issue. We may drop FreeBSD and clang reference to not create confusion.
Quoted 2 lines
Fixes b57b66a97ebf ("app/testpmd: support mbuf dynamic flag")
This commit looks unrelated, if not can you please explain why above commit causing the issue?
Quoted 12 lines
Signed-off-by Ting Xu <[email protected]>--- app/test-pmd/testpmd.c | 1 + 1 file changed, 1 insertion(+)app/test-pmd/testpmd.c +0
-0
app/test-pmd/testpmd.c get_eth_dcb_conf(portid_t pid, struct rte_eth_conf *eth_conf, · line 3411
Quoted 4 lines
app/test-pmd/testpmd.c +1
-0@@ -3408,6 +3408,7 @@ get_eth_dcb_conf(portid_t pid, struct rte_eth_conf *eth_conf,int32_t rc;struct rte_eth_rss_conf rss_conf; +memset (&rss_conf,0 ,sizeof (struct rte_eth_rss_conf ));
The variable is used in the 'else' leg, memset can be moved there, but more importantly should this be done in the 'rte_eth_dev_rss_hash_conf_get()' API.
@Andrew, @Thomas,
What do you think 'rte_eth_dev_rss_hash_conf_get()' memset the 'rss_conf' param before passing it to the PMD? To prevent issues like above in user application.
Quoted 20 lines
-----Original Message-----
From: Yigit, Ferruh <[email protected]>
Sent: Tuesday, May 12, 2020 12:29 AM
To: Xu, Ting <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Xing, Beilei <[email protected]>; Iremonger, Bernard <[email protected]>; [email protected]; Andrew Rybchenko <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v1] app/testpmd: fix DCB set failure in FreeBSD by clangQuoted 5 lines · Ting Xu
When set DCB in testpmd by clang, there is a segmentation fault. It is because the local variable
rss_confinget_eth_dcb_conf()is not cleared, so that the pointer member variablerss_keyhas a random address, which leads to an error in the following processing. This patch initialized the local variablerss_confto avoid random address.
Quoted 4 lines
This is nothing really FreeBSD or clang issue, although it may be reproduced that environment, this is a pointer with random value issue. We may drop FreeBSD and clang reference to not create confusion.
OK, I will modify the commit log.
Quoted 6 lines
Quoted 2 lines
Fixes b57b66a97ebf ("app/testpmd: support mbuf dynamic flag")This commit looks unrelated, if not can you please explain why above commit causing the issue?
This is the bad commit the validation team find for this issue. Honestly speaking, I did not find the relation between this commit and the issue either.
Quoted 21 lines
app/test-pmd/testpmd.c get_eth_dcb_conf(portid_t pid, struct
Quoted 12 lines
Signed-off-by Ting Xu <[email protected]>--- app/test-pmd/testpmd.c | 1 + 1 file changed, 1 insertion(+)app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0
-0
99bacddbf..1276476ca100644app/test-pmd/testpmd.c +0
-0@@ -3408,6 +3408,7 @@ get_eth_dcb_conf(portid_t pid, struct
rte_eth_conf*eth_conf,app/test-pmd/testpmd.c get_eth_dcb_conf(portid_t pid, struct rte_eth_conf *eth_conf, · line 3411
Quoted 4 lines
app/test-pmd/testpmd.c +1
-0int32_t rc;struct rte_eth_rss_conf rss_conf; +memset (&rss_conf,0 ,sizeof (struct rte_eth_rss_conf ));The variable is used in the 'else' leg, memset can be moved there, but more importantly should this be done in the '
rte_eth_dev_rss_hash_conf_get()' API.
Quoted 5 lines
@Andrew, @Thomas,
What do you think '
rte_eth_dev_rss_hash_conf_get()' memset the 'rss_conf' param before passing it to the PMD? To prevent issues like above in user application.
I will move it to the else leg first in the v2 patch. Wait for more comments. Thanks!
Hi Ting,
Quoted 68 lines
-----Original Message-----
From: Xu, Ting <[email protected]>
Sent: Tuesday, May 12, 2020 3:17 AM
To: Yigit, Ferruh <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Xing, Beilei <[email protected]>; Iremonger, Bernard <[email protected]>; [email protected]; Andrew Rybchenko <[email protected]>; Thomas Monjalon <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v1] app/testpmd: fix DCB set failure in FreeBSD by clangQuoted 8 lines
-----Original Message-----
From: Yigit, Ferruh <[email protected]>
Sent: Tuesday, May 12, 2020 12:29 AM
To: Xu, Ting <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Xing, Beilei <[email protected]>; Iremonger, Bernard <[email protected]>; [email protected]; Andrew Rybchenko <[email protected]>; Thomas MonjalonQuoted 10 lines
Subject: Re: [dpdk-dev] [PATCH v1] app/testpmd: fix DCB set failure in FreeBSD by clang
Quoted 5 lines · Ting Xu
When set DCB in testpmd by clang, there is a segmentation fault. It is because the local variable
rss_confinget_eth_dcb_conf()is not cleared, so that the pointer member variablerss_keyhas a random address, which leads to an error in the following processing. This patch initialized the local variablerss_confto avoid random address.Quoted 4 lines
This is nothing really FreeBSD or clang issue, although it may be reproduced that environment, this is a pointer with random value issue. We may drop FreeBSD and clang reference to not create confusion.
OK, I will modify the commit log.
Quoted 6 lines
Quoted 2 lines
Fixes b57b66a97ebf ("app/testpmd: support mbuf dynamic flag")This commit looks unrelated, if not can you please explain why above commit causing the issue?
This is the bad commit the validation team find for this issue. Honestly speaking, I did not find the relation between this commit and the issue either.
Quoted 18 lines
app/test-pmd/testpmd.c get_eth_dcb_conf(portid_t pid, struct
Quoted 12 lines
Signed-off-by Ting Xu <[email protected]>--- app/test-pmd/testpmd.c | 1 + 1 file changed, 1 insertion(+)app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0
-0
99bacddbf..1276476ca100644app/test-pmd/testpmd.c +0
-0@@ -3408,6 +3408,7 @@ get_eth_dcb_conf(portid_t pid, struct
rte_eth_conf*eth_conf,Quoted 4 lines
app/test-pmd/testpmd.c +1
-0int32_t rc;struct rte_eth_rss_conf rss_conf; +memset (&rss_conf,0 ,sizeof (struct rte_eth_rss_conf ));
Quoted 10 lines
Quoted 2 lines
The variable is used in the 'else' leg, memset can be moved there, but more importantly should this be done in the
'
rte_eth_dev_rss_hash_conf_get()' API.Quoted 4 lines
@Andrew, @Thomas,
What do you think '
rte_eth_dev_rss_hash_conf_get()' memset the'
rss_conf'Quoted 2 lines
param before passing it to the PMD? To prevent issues like above in user application.
Seems like a good idea to me, to fix it in rte_eth_dev_rss_hash_conf_get() instead of in testpmd.
Quoted 3 lines
I will move it to the else leg first in the v2 patch. Wait for more comments. Thanks!
Regards,
Bernard.
PATCH v2 1/1 app/testpmd: fix DCB set failure
In reply to Ting XuWhen set DCB in testpmd, there is a segmentation fault. It is because the local variable rss_conf in get_eth_dcb_conf() is not cleared, so that the pointer member variable rss_key has a random address, which leads to an error in the following processing. This patch initialized the local variable rss_conf to avoid this situation.
---v1->v2: modify commit log, move memset to else leg
--- app/test-pmd/testpmd.c | 2 ++ 1 file changed, 2 insertions(+)
app/test-pmd/testpmd.c +2 -0
@@ -3448,6 +3448,8 @@ get_eth_dcb_conf(portid_t pid, struct rte_eth_conf *eth_conf,struct rte_eth_dcb_tx_conf *tx_conf = ð_conf->tx_adv_conf.dcb_tx_conf; +memset (&rss_conf,0 ,sizeof (struct rte_eth_rss_conf )); + rc =rte_eth_dev_rss_hash_conf_get (pid, &rss_conf);if (rc !=0 )return rc;
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v2] app/testpmd: fix DCB set failure
Quoted 11 lines · Ting Xu
When set DCB in testpmd, there is a segmentation fault. It is because the local variable
rss_confinget_eth_dcb_conf()is not cleared, so that the pointer member variablerss_keyhas a random address, which leads to an error in the following processing. This patch initialized the local variablerss_confto avoid this situation.Fixes ac7c491c3fec ("app/testpmd: fix DCB config")Signed-off-by Ting Xu <[email protected]>
Applied to dpdk-next-net/master, thanks.
PATCH v3 1/1 app/testpmd: fix DCB set failure
In reply to Ting XuWhen set DCB in testpmd, there is a segmentation fault. It is because the local variable rss_conf in get_eth_dcb_conf() is not cleared, so that the pointer member variable rss_key has a random address, which leads to an error in the following processing. This patch initialized the local variable rss_conf to avoid this situation.
---v2->v3: move memset to rte_eth_dev_rss_hash_conf_get from testpmd v1->v2: modify commit log, move memset to else leg
--- lib/librte_ethdev/rte_ethdev.c | 2 ++ 1 file changed, 2 insertions(+)
lib/librte_ethdev/rte_ethdev.c +2 -0
@@ -3549,6 +3549,8 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id, {struct rte_eth_dev *dev; +memset (&rss_conf,0 ,sizeof (struct rte_eth_rss_conf )); +RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); dev = &rte_eth_devices[port_id];RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->rss_hash_conf_get, -ENOTSUP );
Signature · 1 line
2.17.1
PATCH v4 1/1 app/testpmd: fix DCB set failure
In reply to Ting XuWhen set DCB in testpmd, there is a segmentation fault. It is because the local variable rss_conf in get_eth_dcb_conf() is not cleared, so that the pointer member variable rss_key has a random address, which leads to an error in the following processing. This patch initialized the local variable rss_conf to avoid this situation.
---V3->v4: fix build failurev2->v3: move memset to rte_eth_dev_rss_hash_conf_get from testpmd v1->v2: modify commit log, move memset to else leg
--- lib/librte_ethdev/rte_ethdev.c | 2 ++ 1 file changed, 2 insertions(+)
lib/librte_ethdev/rte_ethdev.c +2 -0
@@ -3549,6 +3549,8 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id, {struct rte_eth_dev *dev; +memset (rss_conf,0 ,sizeof (*rss_conf)); +RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); dev = &rte_eth_devices[port_id];RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->rss_hash_conf_get, -ENOTSUP );
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v4] app/testpmd: fix DCB set failure
Hi Ting,
Quoted 7 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Ting Xu
Sent: Wednesday, May 13, 2020 11:08 AM
To: [email protected]
Cc: [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v4] app/testpmd: fix DCB set failure
The fix is no longer in testpmd, so the commit line should be "ethdev: fix DCB set failure".
Quoted 5 lines
When set DCB in testpmd, there is a segmentation fault. It is because the local variable
rss_confinget_eth_dcb_conf()is not cleared, so that the pointer member variablerss_keyhas a random address, which leads to an error in the following processing. This patch initialized the local variablerss_confto avoid this situation.
The commit message should probably be revised.
Quoted 2 lines
Fixes ac7c491c3fec ("app/testpmd: fix DCB config")
Also the Fixes line may need to change.
Quoted 17 lines
Signed-off-by Ting Xu <[email protected]>---
V3->v4: fix build failurev2->v3: move memset torte_eth_dev_rss_hash_conf_getfrom testpmdv1->v2: modify commit log, move memset to else leg--- lib/librte_ethdev/rte_ethdev.c | 2 ++ 1 file changed, 2 insertions(+)lib/librte_ethdev/rte_ethdev.c +0
-0
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_rss_hash_conf_get(uint16_t port_id, · line 3552
Quoted 4 lines
lib/librte_ethdev/rte_ethdev.c +1
-0@@ -3549,6 +3549,8 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id, {struct rte_eth_dev *dev; +memset (rss_conf,0 ,sizeof (*rss_conf));
The memset call should be moved to after the error checks to just before the function is called.
Quoted 7 lines
lib/librte_ethdev/rte_ethdev.c +1
-2+RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); dev = &rte_eth_devices[port_id]; RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_conf_get, -ENOTSUP ); --2.17.1
Regards,
Bernard.
Re: [dpdk-dev] [PATCH v4] app/testpmd: fix DCB set failure
13/05/2020 10:54, Iremonger, Bernard:
Quoted 1 line
The fix is no longer in testpmd, so the commit line should be "ethdev: fix DCB set failure".
In general, the word "failure" (or error, etc) is not needed. Because it is a fix, we know there was a failure before :)
And specifically here, you are not fixing just DCB.
PATCH v5 1/1 ethdev: fix DCB set failure
In reply to Ting XuWhen rte_eth_dev_rss_hash_conf_get() is called, if the variable rss_conf is not initialized, the pointer member variable rss_key may have a random address, which leads to an error in the following processing. This patch initialized the variable rss_conf to avoid this situation.
---v4->v5: modify commit logV3->v4: fix build failurev2->v3: move memset to rte_eth_dev_rss_hash_conf_get from testpmd v1->v2: modify commit log, move memset to else leg
--- lib/librte_ethdev/rte_ethdev.c | 1 + 1 file changed, 1 insertion(+)
lib/librte_ethdev/rte_ethdev.c +1 -0
@@ -3552,6 +3552,7 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id,RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); dev = &rte_eth_devices[port_id];RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->rss_hash_conf_get, -ENOTSUP ); +memset (rss_conf,0 ,sizeof (*rss_conf));return eth_err (port_id, (*dev->dev_ops->rss_hash_conf_get)(dev, rss_conf)); }
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v5] ethdev: fix DCB set failure
Quoted 11 lines · Ting Xu
When
rte_eth_dev_rss_hash_conf_get()is called, if the variablerss_confis not initialized, the pointer member variablerss_keymay have a random address, which leads to an error in the following processing. This patch initialized the variablerss_confto avoid this situation.Fixes 16321de09396 ("ethdev: allow to get RSS hash functions and key")Signed-off-by Ting Xu <[email protected]>
Applied to dpdk-next-net/master, thanks.
Re: [dpdk-dev] [dpdk-stable] [PATCH v5] ethdev: fix DCB set failure
Quoted 10 lines · Ferruh Yigit
Quoted 9 lines · Ting Xu
When
rte_eth_dev_rss_hash_conf_get()is called, if the variablerss_confis not initialized, the pointer member variablerss_keymay have a random address, which leads to an error in the following processing. This patch initialized the variablerss_confto avoid this situation.Fixes 16321de09396 ("ethdev: allow to get RSS hash functions and key")
Quoted 7 lines
Quoted 2 lines
Signed-off-by Ting Xu <[email protected]>Reviewed-by Ferruh Yigit <[email protected]>Applied to dpdk-next-net/master, thanks.
Dropped from next-net.
Re: [dpdk-dev] [PATCH v5] ethdev: fix DCB set failure
In reply to Ting XuQuoted 43 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Ting Xu
Sent: Wednesday, May 13, 2020 6:16 PM
To: [email protected]
Cc: [email protected]; Yigit, Ferruh <[email protected]>; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v5] ethdev: fix DCB set failureWhen
rte_eth_dev_rss_hash_conf_get()is called, if the variablerss_confis not initialized, the pointer member variablerss_keymay have a random address, which leads to an error in the following processing. This patch initialized the variablerss_confto avoid this situation.Fixes 16321de09396 ("ethdev: allow to get RSS hash functions and key")Signed-off-by Ting Xu <[email protected]>---
v4->v5: modify commit logV3->v4: fix build failurev2->v3: move memset torte_eth_dev_rss_hash_conf_getfrom testpmdv1->v2: modify commit log, move memset to else leg--- lib/librte_ethdev/rte_ethdev.c | 1 + 1 file changed, 1 insertion(+)lib/librte_ethdev/rte_ethdev.c +1
-2@@ -3552,6 +3552,7 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id,RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); dev = &rte_eth_devices[port_id];RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->rss_hash_conf_get, -ENOTSUP ); + memset(rss_conf, 0, sizeof(*rss_conf));return eth_err (port_id, (*dev->dev_ops->rss_hash_conf_get)(dev, rss_conf)); } --
Quoted 1 line
2.17.1
The commit line should probably be reworded to describe the revised fix.
Otherwise
Re: [dpdk-dev] [PATCH v5] ethdev: fix DCB set failure
In reply to Ting XuCC net/nfp maintainer
Quoted 26 lines · Ting Xu
When
rte_eth_dev_rss_hash_conf_get()is called, if the variablerss_confis not initialized, the pointer member variablerss_keymay have a random address, which leads to an error in the following processing. This patch initialized the variablerss_confto avoid this situation.Fixes 16321de09396 ("ethdev: allow to get RSS hash functions and key")Signed-off-by Ting Xu <[email protected]>---
v4->v5: modify commit logV3->v4: fix build failurev2->v3: move memset torte_eth_dev_rss_hash_conf_getfrom testpmdv1->v2: modify commit log, move memset to else leg--- lib/librte_ethdev/rte_ethdev.c | 1 + 1 file changed, 1 insertion(+)lib/librte_ethdev/rte_ethdev.c +0
-0
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_rss_hash_conf_get(uint16_t port_id, · line 3558
Quoted 7 lines
lib/librte_ethdev/rte_ethdev.c +1
-0@@ -3552,6 +3552,7 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id,RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); dev = &rte_eth_devices[port_id];RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->rss_hash_conf_get, -ENOTSUP ); +memset (rss_conf,0 ,sizeof (*rss_conf));return eth_err (port_id, (*dev->dev_ops->rss_hash_conf_get)(dev, rss_conf)); }
The patch breaks getting of RSS key since it resets rss_conf->rss_key to NULL, but all drivers treat it as
a pointer to buffer to copy RSS key to.
Almost all driver just skip RSS key copy if the pointer
is NULL.
I think it should be removed from next-net or improved to reset rss_hf only since rss_key_len may be treated as a size of rss_key buffer. The API is not clear at the place.
It looks like net/nfp is the only driver which does not check that that pointer is not NULL before coping key to it.
Re: [dpdk-dev] [PATCH v5] ethdev: fix DCB set failure
Hi
From: Andrew Rybchenko
Quoted 44 lines
CC net/nfp maintainer
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_rss_hash_conf_get(uint16_t
Quoted 26 lines · Ting Xu
When
rte_eth_dev_rss_hash_conf_get()is called, if the variablerss_confis not initialized, the pointer member variablerss_keymay have a random address, which leads to an error in the following processing. This patch initialized the variablerss_confto avoid this situation.Fixes 16321de09396 ("ethdev: allow to get RSS hash functions andkey")
Cc: [email protected]Signed-off-by Ting Xu <[email protected]>---
v4->v5: modify commit logV3->v4: fix build failurev2->v3: move memset torte_eth_dev_rss_hash_conf_getfrom testpmdv1->v2: modify commit log, move memset to else leg--- lib/librte_ethdev/rte_ethdev.c | 1 + 1 file changed, 1 insertion(+)(quoted diff) +0
-0
b/lib/librte_ethdev/rte_ethdev.cindex8e10a6fc3..b20c6bb2d100644lib/librte_ethdev/rte_ethdev.c +0
-0@@ -3552,6 +3552,7 @@ rte_eth_dev_rss_hash_conf_get(uint16_t
port_id,lib/librte_ethdev/rte_ethdev.c rte_eth_dev_rss_hash_conf_get(uint16_t port_id,
Quoted 3 lines
lib/librte_ethdev/rte_ethdev.c +0
-0RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); dev = &rte_eth_devices[port_id]; RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_conf_get,
-ENOTSUP);lib/librte_ethdev/rte_ethdev.c rte_eth_dev_rss_hash_conf_get(uint16_t port_id, · line 3558
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.c +1
-0+memset (rss_conf,0 ,sizeof (*rss_conf));return eth_err (port_id, (*dev->dev_ops->rss_hash_conf_get)(dev, rss_conf)); }The patch breaks getting of RSS key since it resets
rss_conf->rss_keyto NULL, but all drivers treat it as a pointer to buffer to copy RSS key to. Almost all driver just skip RSS key copy if the pointer is NULL.
Quoted 6 lines
I think it should be removed from next-net or improved to reset
rss_hfonly sincerss_key_lenmay be treated as a size ofrss_keybuffer. The API is not clear at the place.It looks like net/nfp is the only driver which does not check that that pointer is not NULL before coping key to it.
+1
Looks like this breaks also Testpmd "show port 0 rss-hash key" command.
Matan
Re: [dpdk-dev] [PATCH v5] ethdev: fix DCB set failure
Quoted 52 lines · Matan Azrad
Hi
From: Andrew Rybchenko
Quoted 48 lines
CC net/nfp maintainer
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_rss_hash_conf_get(uint16_t
Quoted 26 lines · Ting Xu
When
rte_eth_dev_rss_hash_conf_get()is called, if the variablerss_confis not initialized, the pointer member variablerss_keymay have a random address, which leads to an error in the following processing. This patch initialized the variablerss_confto avoid this situation.Fixes 16321de09396 ("ethdev: allow to get RSS hash functions andkey")
Cc: [email protected]Signed-off-by Ting Xu <[email protected]>---
v4->v5: modify commit logV3->v4: fix build failurev2->v3: move memset torte_eth_dev_rss_hash_conf_getfrom testpmdv1->v2: modify commit log, move memset to else leg--- lib/librte_ethdev/rte_ethdev.c | 1 + 1 file changed, 1 insertion(+)(quoted diff) +0
-0
b/lib/librte_ethdev/rte_ethdev.cindex8e10a6fc3..b20c6bb2d100644lib/librte_ethdev/rte_ethdev.c +0
-0@@ -3552,6 +3552,7 @@ rte_eth_dev_rss_hash_conf_get(uint16_t
port_id,lib/librte_ethdev/rte_ethdev.c rte_eth_dev_rss_hash_conf_get(uint16_t port_id,
Quoted 3 lines
lib/librte_ethdev/rte_ethdev.c +0
-0RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); dev = &rte_eth_devices[port_id]; RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_conf_get,
-ENOTSUP);lib/librte_ethdev/rte_ethdev.c rte_eth_dev_rss_hash_conf_get(uint16_t port_id, · line 3558
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.c +1
-0+memset (rss_conf,0 ,sizeof (*rss_conf));return eth_err (port_id, (*dev->dev_ops->rss_hash_conf_get)(dev, rss_conf)); }The patch breaks getting of RSS key since it resets
rss_conf->rss_keyto NULL, but all drivers treat it as a pointer to buffer to copy RSS key to. Almost all driver just skip RSS key copy if the pointer is NULL.I think it should be removed from next-net or improved to reset
rss_hfonly sincerss_key_lenmay be treated as a size ofrss_keybuffer. The API is not clear at the place.
Quoted 8 lines
Quoted 2 lines
It looks like net/nfp is the only driver which does not check that that pointer is not NULL before coping key to it.
+1
Looks like this breaks also Testpmd "show port 0 rss-hash key" command.
Hi Matan, it is clearly wrong, I will drop it.
Re: [dpdk-dev] [PATCH v5] ethdev: fix DCB set failure
In reply to Andrew RybchenkoQuoted 32 lines · Andrew Rybchenko
CC net/nfp maintainer
Quoted 29 lines · Ting Xu
When
rte_eth_dev_rss_hash_conf_get()is called, if the variablerss_confis not initialized, the pointer member variablerss_keymay have a random address, which leads to an error in the following processing. This patch initialized the variablerss_confto avoid this situation.Fixes 16321de09396 ("ethdev: allow to get RSS hash functions and key")Signed-off-by Ting Xu <[email protected]>---
v4->v5: modify commit logV3->v4: fix build failurev2->v3: move memset torte_eth_dev_rss_hash_conf_getfrom testpmdv1->v2: modify commit log, move memset to else leg--- lib/librte_ethdev/rte_ethdev.c | 1 + 1 file changed, 1 insertion(+)lib/librte_ethdev/rte_ethdev.c +1
-0@@ -3552,6 +3552,7 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id,RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); dev = &rte_eth_devices[port_id];RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->rss_hash_conf_get, -ENOTSUP ); +memset (rss_conf,0 ,sizeof (*rss_conf));
Quoted 8 lines
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_rss_hash_conf_get(uint16_t port_id, · line 3558
Quoted 4 lines
lib/librte_ethdev/rte_ethdev.c +0
-0return eth_err (port_id, (*dev->dev_ops->rss_hash_conf_get)(dev, rss_conf)); }The patch breaks getting of RSS key since it resets
rss_conf->rss_keyto NULL, but all drivers treat it as
a pointer to buffer to copy RSS key to.
:(
Of course it is a pointer to copy the RSS key, no idea what I was thinking.
Thanks for catching this before goes into main repo.
Quoted 4 lines
Almost all driver just skip RSS key copy if the pointer is NULL.
I think it should be removed from next-net or improved
+1, I will drop the ethdev patch, and replace it with the testpmd one.
Quoted 8 lines
to reset
rss_hfonly sincerss_key_lenmay be treated as a size ofrss_keybuffer. The API is not clear at the place.It looks like net/nfp is the only driver which does not check that that pointer is not NULL before coping key to it.