Skip to contentSkip to conversation

memif: memif driver does not crashes when there's different N of TX and RX queues

PATCH Applied huzaifa.rahman 4 participants 5 messages Jul 26, 2022 – Nov 10, 2022 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 memif: memif driver does not crashes when there's different N of TX and RX queues

Bugzilla ID: 734

there's a bug in memif_stats_get() function due to confusion between C2S (client->server) and S2C (server->client) rings, causing a crash if there's a different number of RX and TX queues.

this is fixed by selectiing the correct rings for RX and TX i.e for RX, S2C rings are selected and for TX, C2S rings are selected.

---
 drivers/net/memif/rte_eth_memif.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/memif/rte_eth_memif.c +4 -4
index dd951b8296..e56df84e10 100644
@@ -1444,8 +1444,8 @@ memif_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	stats->opackets = 0;
 	stats->obytes = 0;
 
-	tmp = (pmd->role == MEMIF_ROLE_CLIENT) ? pmd->run.num_c2s_rings :
-	    pmd->run.num_s2c_rings;
+	tmp = (pmd->role == MEMIF_ROLE_CLIENT) ? pmd->run.num_s2c_rings :
+	    pmd->run.num_c2s_rings;
 	nq = (tmp < RTE_ETHDEV_QUEUE_STAT_CNTRS) ? tmp :
 	    RTE_ETHDEV_QUEUE_STAT_CNTRS;
 
@@ -1458,8 +1458,8 @@ memif_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 		stats->ibytes += mq->n_bytes;
 	}
 
-	tmp = (pmd->role == MEMIF_ROLE_CLIENT) ? pmd->run.num_s2c_rings :
-	    pmd->run.num_c2s_rings;
+	tmp = (pmd->role == MEMIF_ROLE_CLIENT) ? pmd->run.num_c2s_rings :
+	    pmd->run.num_s2c_rings;
 	nq = (tmp < RTE_ETHDEV_QUEUE_STAT_CNTRS) ? tmp :
 	    RTE_ETHDEV_QUEUE_STAT_CNTRS;
 
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw

Hi Huzaifa,

This patch looks good to me.
And would you please help review my memif patches?
https://patches.dpdk.org/project/dpdk/cover/[email protected]/

Thanks,
Joyce

Quoted 7 lines

-----Original Message-----
From: huzaifa.rahman <[email protected]>
Sent: Tuesday, July 26, 2022 6:16 PM
To: [email protected]
Cc: [email protected]; huzaifa.rahman <[email protected]>
Subject: [PATCH] memif: memif driver does not crashes when there's different N of TX and RX queues

net/memif: fix memif crash with different Tx Rx queues

Quoted 10 lines

Bugzilla ID: 734

there's a bug in memif_stats_get() function due to confusion between C2S (client->server) and S2C (server->client) rings, causing a crash if there's a different number of RX and TX queues.

this is fixed by selectiing the correct rings for RX and TX i.e for RX, S2C rings are selected and for TX, C2S rings are selected.

Fixes 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Quoted 1 line
Quoted 33 lines
---
 drivers/net/memif/rte_eth_memif.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/memif/rte_eth_memif.c +0 -1
index dd951b8296..e56df84e10 100644
@@ -1444,8 +1444,8 @@ memif_stats_get(struct rte_eth_dev *dev, struct
 rte_eth_stats *stats)
      stats->opackets = 0;
      stats->obytes = 0;
 
-     tmp = (pmd->role == MEMIF_ROLE_CLIENT) ? pmd-
Quoted 1 line

run.num_c2s_rings :

drivers/net/memif/rte_eth_memif.c +1 -1
-         pmd->run.num_s2c_rings;
+     tmp = (pmd->role == MEMIF_ROLE_CLIENT) ? pmd-
Quoted 1 line

run.num_s2c_rings :

drivers/net/memif/rte_eth_memif.c +1 -1
+         pmd->run.num_c2s_rings;
      nq = (tmp < RTE_ETHDEV_QUEUE_STAT_CNTRS) ? tmp :
          RTE_ETHDEV_QUEUE_STAT_CNTRS;
@@ -1458,8 +1458,8 @@ memif_stats_get(struct rte_eth_dev *dev, struct
 rte_eth_stats *stats)
              stats->ibytes += mq->n_bytes;
      }
 
-     tmp = (pmd->role == MEMIF_ROLE_CLIENT) ? pmd-
Quoted 1 line

run.num_s2c_rings :

drivers/net/memif/rte_eth_memif.c +1 -1
-         pmd->run.num_c2s_rings;
+     tmp = (pmd->role == MEMIF_ROLE_CLIENT) ? pmd-
Quoted 1 line

run.num_c2s_rings :

Quoted 6 lines

+ pmd->run.num_s2c_rings;
nq = (tmp < RTE_ETHDEV_QUEUE_STAT_CNTRS) ? tmp :
RTE_ETHDEV_QUEUE_STAT_CNTRS;

--
2.25.1

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

#2 lore raw
Quoted 25 lines · Joyce Kong

Hi Huzaifa,

This patch looks good to me.
And would you please help review my memif patches?
https://patches.dpdk.org/project/dpdk/cover/[email protected]/

Thanks,
Joyce

Quoted 7 lines

-----Original Message-----
From: huzaifa.rahman <[email protected]>
Sent: Tuesday, July 26, 2022 6:16 PM
To: [email protected]
Cc: [email protected]; huzaifa.rahman <[email protected]>
Subject: [PATCH] memif: memif driver does not crashes when there's different N of TX and RX queues

net/memif: fix memif crash with different Tx Rx queues

Quoted 7 lines

Bugzilla ID: 734

there's a bug in memif_stats_get() function due to confusion between C2S (client->server) and S2C (server->client) rings, causing a crash if there's a different number of RX and TX queues.

Quoted 8 lines
Quoted 3 lines

this is fixed by selectiing the correct rings for RX and TX i.e for RX, S2C rings are selected and for TX, C2S rings are selected.

Fixes 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Quoted 1 line

Fixed above on applying.

Applied to dpdk-next-net/main, thanks.

#3 lore raw

Hi,

Is there any other work/changes required for this patch to be submitted?

Thanks

Quoted 44 lines · Andrew Rybchenko
Quoted 5 lines · Joyce Kong

Hi Huzaifa,

This patch looks good to me.
And would you please help review my memif patches?

https://patches.dpdk.org/project/dpdk/cover/[email protected]/

Quoted 4 lines

Thanks,
Joyce

Quoted 14 lines
Quoted 7 lines

-----Original Message-----
From: huzaifa.rahman <[email protected]>
Sent: Tuesday, July 26, 2022 6:16 PM
To: [email protected]
Cc: [email protected]; huzaifa.rahman <[email protected]>
Subject: [PATCH] memif: memif driver does not crashes when there's different N of TX and RX queues

net/memif: fix memif crash with different Tx Rx queues

Quoted 5 lines

Bugzilla ID: 734

there's a bug in memif_stats_get() function due to confusion between C2S (client->server) and S2C (server->client) rings, causing a crash if

there's a

Quoted 3 lines
Quoted 3 lines

different number of RX and TX queues.

this is fixed by selectiing the correct rings for RX and TX i.e for RX,

S2C rings

Quoted 7 lines
Quoted 2 lines

are selected and for TX, C2S rings are selected.

Fixes 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Quoted 1 line

Fixed above on applying.

Applied to dpdk-next-net/main, thanks.

#4 lore raw
Quoted 4 lines · Huzaifa Rahman

Hi,

Is there any other work/changes required for this patch to be submitted?

Hi Huzaifa,

Patch seems already merged by Andrew and pulled to main repo:
https://git.dpdk.org/dpdk/commit/?id=231435a5e6c7fa915697d8f84a91b44176

So it will in oncoming 22.11 release.

Quoted 53 lines

Thanks

On Tue, Oct 4, 2022 at 7:53 PM Andrew Rybchenko <[email protected] <mailto:[email protected]>> wrote:

On 8/8/22 13:39, Joyce Kong wrote:
> Hi Huzaifa,
>
> This patch looks good to me.
> And would you please help review my memif patches?
>
https://patches.dpdk.org/project/dpdk/cover/[email protected]/ <https://patches.dpdk.org/project/dpdk/cover/[email protected]/>
>
> Thanks,
> Joyce
>
>> -----Original Message-----
>> From: huzaifa.rahman <[email protected]
<mailto:[email protected]>>
>> Sent: Tuesday, July 26, 2022 6:16 PM
>> To: [email protected] <mailto:[email protected]>
>> Cc: [email protected] <mailto:[email protected]>; huzaifa.rahman
<[email protected] <mailto:[email protected]>>
>> Subject: [PATCH] memif: memif driver does not crashes when there's
>> different N of TX and RX queues
> net/memif: fix memif crash with different Tx Rx queues
>
>>
>> Bugzilla ID: 734
>>
>> there's a bug in memif_stats_get() function due to confusion
between C2S
>> (client->server) and S2C (server->client) rings, causing a crash
if there's a
>> different number of RX and TX queues.
>>
>> this is fixed by selectiing the correct rings for RX and TX i.e
for RX, S2C rings
>> are selected and for TX, C2S rings are selected.
>>
> Fixes: 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
> Cc: [email protected] <mailto:[email protected]>
>
>> Signed-off-by: huzaifa.rahman <[email protected]
<mailto:[email protected]>>
> Reviewed-by: Joyce Kong <[email protected]
<mailto:[email protected]>>

Fixed above on applying.

Applied to dpdk-next-net/main, thanks.