Skip to contentSkip to conversation

app/crypto-perf: set mbuf lengths correctly for DOCSIS tests

PATCH In review David Coyle 3 participants 6 messages Jul 16, 2020 – Jul 29, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/crypto-perf: set mbuf lengths correctly for DOCSIS tests

Set the source mbuf data and packet lengths correctly for DOCSIS performance tests.

Fixes d4a131a9498d ("test/crypto-perf: support DOCSIS protocol")
---
 app/test-crypto-perf/cperf_ops.c | 4 ++++
 1 file changed, 4 insertions(+)
app/test-crypto-perf/cperf_ops.c +4 -0
index f851509ec..3da835a9c 100644
@@ -48,6 +48,10 @@ cperf_set_ops_security(struct rte_crypto_op **ops,
 			} else
 				buf_sz = options->test_buffer_size;
 
+			sym_op->m_src->buf_len = options->segment_sz;
+			sym_op->m_src->data_len = buf_sz;
+			sym_op->m_src->pkt_len = buf_sz;
+
 			/* DOCSIS header is not CRC'ed */
 			sym_op->auth.data.offset = options->docsis_hdr_sz;
 			sym_op->auth.data.length = buf_sz -
Signature · 1 line
2.17.1
#1 lore raw

Hi David,

Quoted 25 lines

-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Thursday, July 16, 2020 4:31 PM
To: [email protected]; Doherty, Declan <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Trahe, Fiona <[email protected]>
Cc: [email protected]; Ryan, Brendan <[email protected]>; O'loingsigh, Mairtin <[email protected]>; Coyle, David <[email protected]>
Subject: [PATCH v1] app/crypto-perf: set mbuf lengths correctly for DOCSIS tests

Set the source mbuf data and packet lengths correctly for DOCSIS performance tests.

Fixes d4a131a9498d ("test/crypto-perf: support DOCSIS protocol")
---
 app/test-crypto-perf/cperf_ops.c | 4 ++++
 1 file changed, 4 insertions(+)
app/test-crypto-perf/cperf_ops.c +0 -0
index f851509ec..3da835a9c 100644

app/test-crypto-perf/cperf_ops.c cperf_set_ops_security(struct rte_crypto_op **ops, · line 54

Quoted 7 lines
app/test-crypto-perf/cperf_ops.c +4 -0
@@ -48,6 +48,10 @@ cperf_set_ops_security(struct rte_crypto_op **ops,
 			} else
 				buf_sz = options->test_buffer_size;
 
+			sym_op->m_src->buf_len = options->segment_sz;
+			sym_op->m_src->data_len = buf_sz;
+			sym_op->m_src->pkt_len = buf_sz;
+

Actually, I am wondering why this is needed at all (for DOCSIS and PDCP). This is already set in " fill_multi_seg_mbuf" or " fill_single_seg_mbuf" (and this was already working without this patch, right?).

Regards,
Pablo

#2 lore raw

Hi Pablo,

Quoted 7 lines

-----Original Message-----
From: De Lara Guarch, Pablo <[email protected]>
Sent: Friday, July 17, 2020 8:04 PM

Quoted 4 lines
app/test-crypto-perf/cperf_ops.c +0 -0
@@ -48,6 +48,10 @@ cperf_set_ops_security(struct rte_crypto_op **ops,
 			} else
 				buf_sz = options->test_buffer_size;
 
Quoted 8 lines

app/test-crypto-perf/cperf_ops.c cperf_set_ops_security(struct rte_crypto_op **ops, · line 54

Quoted 4 lines
app/test-crypto-perf/cperf_ops.c +4 -0
+			sym_op->m_src->buf_len = options->segment_sz;
+			sym_op->m_src->data_len = buf_sz;
+			sym_op->m_src->pkt_len = buf_sz;
+

Actually, I am wondering why this is needed at all (for DOCSIS and PDCP). This is already set in " fill_multi_seg_mbuf" or " fill_single_seg_mbuf" (and this was already working without this patch, right?).

[DC] I have found that if a number of buffer sizes are specified like this on the cmd line "--buffer-sz 64,256,1024", then the pkt_len and data_len filled in "fill_multi_seg_mbuf" or " fill_single_seg_mbuf" is always the largest of the sizes specified. The cipher/auth lengths are then set based on the --buffer-sz option.

For DOCSIS, I tried to be more accurate and set the correct pkt_len and data_len in the mbuf. This followed what PDCP did too, even though I'm not sure of the background why PDCP did it - possibly spotted the same issue. I have also found that DOCSIS performance figures can be better if the correct pkt_len and data_len are set in the mbuf - I don't have any proper explanation for this though as the cipher/ auth lengths are always the same.

I've dug around a bit more on this now though and this is actually a problem across the perf tool. Some of the crypto PMDs have logic based on the mbuf pkt_len and data_len, but because the perf tool isn't always setting these fields correctly, that logic may not work as expected.

Quoted 1 line
#3 lore raw

Hi David,

Quoted 41 lines

-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Monday, July 20, 2020 1:59 PM
To: De Lara Guarch, Pablo <[email protected]>; [email protected]; Doherty, Declan <[email protected]>; Trahe, Fiona <[email protected]>
Cc: [email protected]; Ryan, Brendan <[email protected]>; O'loingsigh, Mairtin <[email protected]>
Subject: RE: [PATCH v1] app/crypto-perf: set mbuf lengths correctly for DOCSIS tests

Hi Pablo,

Quoted 7 lines

-----Original Message-----
From: De Lara Guarch, Pablo <[email protected]>
Sent: Friday, July 17, 2020 8:04 PM

Quoted 4 lines
app/test-crypto-perf/cperf_ops.c +0 -0
@@ -48,6 +48,10 @@ cperf_set_ops_security(struct rte_crypto_op **ops,
 			} else
 				buf_sz = options->test_buffer_size;
 
Quoted 8 lines

app/test-crypto-perf/cperf_ops.c cperf_set_ops_security(struct rte_crypto_op **ops, · line 54

Quoted 4 lines
app/test-crypto-perf/cperf_ops.c +4 -0
+			sym_op->m_src->buf_len = options->segment_sz;
+			sym_op->m_src->data_len = buf_sz;
+			sym_op->m_src->pkt_len = buf_sz;
+

Actually, I am wondering why this is needed at all (for DOCSIS and PDCP). This is already set in " fill_multi_seg_mbuf" or " fill_single_seg_mbuf" (and this was already working without this patch, right?).

[DC] I have found that if a number of buffer sizes are specified like this on the cmd line "--buffer-sz 64,256,1024", then the pkt_len and data_len filled in "fill_multi_seg_mbuf" or " fill_single_seg_mbuf" is always the largest of the sizes specified. The cipher/auth lengths are then set based on the --buffer-sz option.

For DOCSIS, I tried to be more accurate and set the correct pkt_len and data_len in the mbuf. This followed what PDCP did too, even though I'm not sure of the background why PDCP did it - possibly spotted the same issue. I have also found that DOCSIS performance figures can be better if the correct pkt_len and data_len are set in the mbuf - I don't have any proper explanation for this though as the cipher/ auth lengths are always the same.

Quoted 5 lines

I've dug around a bit more on this now though and this is actually a problem across the perf tool. Some of the crypto PMDs have logic based on the mbuf pkt_len and data_len, but because the perf tool isn't always setting these fields correctly, that logic may not work as expected.

Quoted 1 line

Right, thanks for checking this. If I remember correctly, it was fine to have this set to the maximum size as the important field for crypto PMDs to check is the cipher/auth lengths, as you said. If there is more logic that depends on data_len on other PMDs, I agree it might be a problem. The only usage I knew for it was the multi segment case (in AES-GCM PMD), where data_len is checked in each segment size to see if all the cipher/auth length resides within these segments, but in the tool we set data_len for each segment when "going multi-segment". I see that other PMDs like DPAA2_SEC use these fields for something which I am not sure what's for. It would be good if the maintainers check if this is a problem for them, and in that case, this should be fixed for the other functions (for "normal" crypto).

Thanks,
Pablo

Acked-by
#4 lore raw

Hi Pablo/David,

Quoted 43 lines

Hi David,

Quoted 17 lines

Hi Pablo,

Quoted 15 lines

-----Original Message-----
From: De Lara Guarch, Pablo <[email protected]>
Sent: Friday, July 17, 2020 8:04 PM

app/test-crypto-perf/cperf_ops.c cperf_set_ops_security(struct rte_crypto_op **ops, · line 54

Quoted 8 lines
app/test-crypto-perf/cperf_ops.c +4 -0
@@ -48,6 +48,10 @@ cperf_set_ops_security(struct rte_crypto_op **ops,
 			} else
 				buf_sz = options->test_buffer_size;
 
+			sym_op->m_src->buf_len = options->segment_sz;
+			sym_op->m_src->data_len = buf_sz;
+			sym_op->m_src->pkt_len = buf_sz;
+

Actually, I am wondering why this is needed at all (for DOCSIS and PDCP). This is already set in " fill_multi_seg_mbuf" or " fill_single_seg_mbuf" (and this was already working without this patch,

right?).

Quoted 4 lines

[DC] I have found that if a number of buffer sizes are specified like this on the cmd line "--buffer-sz 64,256,1024", then the pkt_len and data_len filled in "fill_multi_seg_mbuf" or " fill_single_seg_mbuf" is always the largest of the

sizes

Quoted 3 lines

specified. The cipher/auth lengths are then set based on the --buffer-sz option.

For DOCSIS, I tried to be more accurate and set the correct pkt_len and

data_len

Quoted 2 lines

in the mbuf. This followed what PDCP did too, even though I'm not sure of the background why PDCP did it - possibly spotted the same issue. I have also

found

Quoted 9 lines

that DOCSIS performance figures can be better if the correct pkt_len and data_len are set in the mbuf - I don't have any proper explanation for this though as the cipher/ auth lengths are always the same.

I've dug around a bit more on this now though and this is actually a problem across the perf tool. Some of the crypto PMDs have logic based on the mbuf pkt_len and data_len, but because the perf tool isn't always setting these fields correctly, that logic may not work as expected.

Quoted 1 line
Quoted 12 lines

Right, thanks for checking this. If I remember correctly, it was fine to have this set to the maximum size as the important field for crypto PMDs to check is the cipher/auth lengths, as you said. If there is more logic that depends on data_len on other PMDs, I agree it might be a problem. The only usage I knew for it was the multi segment case (in AES-GCM PMD), where data_len is checked in each segment size to see if all the cipher/auth length resides within these segments, but in the tool we set data_len for each segment when "going multi-segment". I see that other PMDs like DPAA2_SEC use these fields for something which I am not sure what's for. It would be good if the maintainers check if this is a problem for them, and in that case, this should be fixed for the other functions (for "normal" crypto).

In case of test-crypto-perf, the buffers are flat and there is no case of multi segment. So this is not because of that.
In case of PDCP and probably all the protocol offload cases would need the buf_len/ data_len/pkt_len to be set properly. As the complete buffer is given to hardware and depending on the headers added, HW/PMD will adjust these lengths when the packet is dequeued, provided it has room available to expand.

We may not need this in cases of pure crypto which have fixed lengths and PMD does not control them.

So in my opinion this patch is fine.

#5 lore raw
Quoted 76 lines

Hi Pablo/David,

Quoted 9 lines

Hi David,

Quoted 6 lines

Hi Pablo,

Quoted 4 lines

-----Original Message-----
From: De Lara Guarch, Pablo <[email protected]>
Sent: Friday, July 17, 2020 8:04 PM

Review cperf_set_ops_security(struct rte_crypto_op

Quoted 1 line
(quoted diff) +0 -0
@@ -48,6 +48,10 @@ cperf_set_ops_security(struct rte_crypto_op

**ops,

Quoted 5 lines
Quoted 4 lines
Quoted 4 lines

app/test-crypto-perf/cperf_ops.c cperf_set_ops_security(struct rte_crypto_op **ops,

Quoted 4 lines
app/test-crypto-perf/cperf_ops.c +1 -0
 			} else
 				buf_sz = options->test_buffer_size;
 
+			sym_op->m_src->buf_len = options-

segment_sz;

Quoted 10 lines
Quoted 7 lines
Quoted 7 lines

app/test-crypto-perf/cperf_ops.c cperf_set_ops_security(struct rte_crypto_op **ops, · line 54

Quoted 3 lines
app/test-crypto-perf/cperf_ops.c +3 -0
+			sym_op->m_src->data_len = buf_sz;
+			sym_op->m_src->pkt_len = buf_sz;
+

Actually, I am wondering why this is needed at all (for DOCSIS and PDCP). This is already set in " fill_multi_seg_mbuf" or " fill_single_seg_mbuf" (and this was already working without this patch,

right?).

Quoted 2 lines

[DC] I have found that if a number of buffer sizes are specified like this on

the

Quoted 4 lines
Quoted 2 lines

cmd line "--buffer-sz 64,256,1024", then the pkt_len and data_len filled in "fill_multi_seg_mbuf" or " fill_single_seg_mbuf" is always the largest of the

sizes

Quoted 1 line

specified. The cipher/auth lengths are then set based on the --buffer-sz

option.

Quoted 4 lines
Quoted 2 lines

For DOCSIS, I tried to be more accurate and set the correct pkt_len and

data_len

Quoted 1 line

in the mbuf. This followed what PDCP did too, even though I'm not sure of

the

Quoted 9 lines
Quoted 1 line

background why PDCP did it - possibly spotted the same issue. I have also

found

Quoted 7 lines

that DOCSIS performance figures can be better if the correct pkt_len and data_len are set in the mbuf - I don't have any proper explanation for this though as the cipher/ auth lengths are always the same.

I've dug around a bit more on this now though and this is actually a problem across the perf tool. Some of the crypto PMDs have logic based on the mbuf pkt_len and data_len, but because the perf tool isn't always setting these

fields

Quoted 6 lines
Quoted 2 lines

correctly, that logic may not work as expected.

Quoted 1 line

Right, thanks for checking this. If I remember correctly, it was fine to have this set to the maximum size as the important field for crypto PMDs to check is the cipher/auth lengths, as you said. If there is more logic that depends on

data_len

Quoted 4 lines

on other PMDs, I agree it might be a problem. The only usage I knew for it was the multi segment case (in AES-GCM PMD), where data_len is checked in each segment size to see if all the cipher/auth length resides within these segments, but in the tool we set data_len for each segment when "going multi-segment".

I

Quoted 2 lines

see that other PMDs like DPAA2_SEC use these fields for something which I am not sure what's for. It would be good if the maintainers check if this is a

problem

Quoted 3 lines

for them, and in that case, this should be fixed for the other functions (for "normal" crypto).

In case of test-crypto-perf, the buffers are flat and there is no case of multi segment.
So this is not because of that.
In case of PDCP and probably all the protocol offload cases would need the buf_len/
data_len/pkt_len to be set properly. As the complete buffer is given to hardware and depending on the headers added, HW/PMD will adjust these lengths when the
packet is dequeued, provided it has room available to expand.

Quoted 9 lines

We may not need this in cases of pure crypto which have fixed lengths and PMD does
not control them.

So in my opinion this patch is fine.

This patch was applied yesterday to dpdk-next-crypto And is now pulled to master as well.