Skip to contentSkip to conversation

hw/net: fsl_etsec: Tx padding length should exclude CRC

PATCH Applied Bin Meng 2 participants 9 messages Mar 16, 2021 – Mar 23, 2021

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/1 hw/net: fsl_etsec: Tx padding length should exclude CRC

As the comment of tx_padding_and_crc() says: "Never add CRC in QEMU", min_frame_len should excluce CRC, so it should be 60 instead of 64.

---

 hw/net/fsl_etsec/rings.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/fsl_etsec/rings.c +1 -1
index d6be0d7d18..8f08446415 100644
@@ -259,7 +259,7 @@ static void process_tx_bd(eTSEC         *etsec,
                 || etsec->regs[MACCFG2].value & MACCFG2_PADCRC) {
 
                 /* Padding and CRC (Padding implies CRC) */
-                tx_padding_and_crc(etsec, 64);
+                tx_padding_and_crc(etsec, 60);
 
             } else if (etsec->first_bd.flags & BD_TX_TC
                        || etsec->regs[MACCFG2].value & MACCFG2_CRC_EN) {
Signature · 1 line
2.17.1
author
#1 lore raw
Quoted 10 lines · Bin Meng

As the comment of tx_padding_and_crc() says: "Never add CRC in QEMU", min_frame_len should excluce CRC, so it should be 60 instead of 64.

---

 hw/net/fsl_etsec/rings.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Ping?

#2 lore raw
Quoted 5 lines · Bin Meng
Quoted 4 lines · Bin Meng

As the comment of tx_padding_and_crc() says: "Never add CRC in QEMU", min_frame_len should excluce CRC, so it should be 60 instead of 64.

Quoted 8 lines
Quoted 6 lines

---

 hw/net/fsl_etsec/rings.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Ping?

Sorry, I was away on holiday last week.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#3 lore raw
In reply to Bin Meng
Quoted 2 lines · Bin Meng

As the comment of tx_padding_and_crc() says: "Never add CRC in QEMU", min_frame_len should excluce CRC, so it should be 60 instead of 64.

Sorry, your reasoning still isn't clear to me. If qemu is not adding the CRC, what is? Will it always append a CRC after this padding is complete?

Quoted 20 lines

---

 hw/net/fsl_etsec/rings.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/fsl_etsec/rings.c +1 -1
index d6be0d7d18..8f08446415 100644
@@ -259,7 +259,7 @@ static void process_tx_bd(eTSEC         *etsec,
                 || etsec->regs[MACCFG2].value & MACCFG2_PADCRC) {
 
                 /* Padding and CRC (Padding implies CRC) */
-                tx_padding_and_crc(etsec, 64);
+                tx_padding_and_crc(etsec, 60);
 
             } else if (etsec->first_bd.flags & BD_TX_TC
                        || etsec->regs[MACCFG2].value & MACCFG2_CRC_EN) {
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
author
#4 lore raw

Hi David,

Quoted 7 lines · David Gibson
Quoted 2 lines · Bin Meng

As the comment of tx_padding_and_crc() says: "Never add CRC in QEMU", min_frame_len should excluce CRC, so it should be 60 instead of 64.

Sorry, your reasoning still isn't clear to me. If qemu is not adding the CRC, what is?

No one is padding CRC in QEMU. QEMU network backends pass payload without CRC in between.

Quoted 1 line

Will it always append a CRC after this padding is complete?

No.

Regards,
Bin

#5 lore raw
Quoted 6 lines · Bin Meng

Hi David,

Quoted 2 lines · David Gibson

On Tue, Mar 16, 2021 at 04:15:05PM +0800, Bin Meng wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

As the comment of tx_padding_and_crc() says: "Never add CRC in QEMU", min_frame_len should excluce CRC, so it should be 60 instead of 64.

Sorry, your reasoning still isn't clear to me. If qemu is not adding the CRC, what is?

No one is padding CRC in QEMU. QEMU network backends pass payload without CRC in between.

Ok, but the CRCs must be added if the packets are bridged onto a real device, yes? Where does that happen?

Quoted 4 lines
Quoted 2 lines

Will it always append a CRC after this padding is complete?

No.

If that's true, then won't the packets still be shorter than expected if we only pad to 60 bytes?

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
author
#6 lore raw

Hi David,

Quoted 11 lines · David Gibson
Quoted 9 lines · Bin Meng

Hi David,

Quoted 5 lines · David Gibson
Quoted 2 lines · Bin Meng

As the comment of tx_padding_and_crc() says: "Never add CRC in QEMU", min_frame_len should excluce CRC, so it should be 60 instead of 64.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Sorry, your reasoning still isn't clear to me. If qemu is not adding the CRC, what is?

No one is padding CRC in QEMU. QEMU network backends pass payload without CRC in between.

Ok, but the CRCs must be added if the packets are bridged onto a real device, yes? Where does that happen?

I've never used it like that before. What's the command line to test that?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Will it always append a CRC after this padding is complete?

No.

If that's true, then won't the packets still be shorter than expected if we only pad to 60 bytes?

In QEMU packets are transmitted without CRC between network backends, and when a NIC receives a packet, the minimum required payload length is 60 bytes without a CRC.

Regards,
Bin

#7 lore raw
Quoted 29 lines · Bin Meng

Hi David,

Quoted 11 lines · David Gibson
Quoted 9 lines · Bin Meng

Hi David,

Quoted 5 lines · David Gibson
Quoted 2 lines · Bin Meng

As the comment of tx_padding_and_crc() says: "Never add CRC in QEMU", min_frame_len should excluce CRC, so it should be 60 instead of 64.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Sorry, your reasoning still isn't clear to me. If qemu is not adding the CRC, what is?

No one is padding CRC in QEMU. QEMU network backends pass payload without CRC in between.

Ok, but the CRCs must be added if the packets are bridged onto a real device, yes? Where does that happen?

I've never used it like that before. What's the command line to test that?

Quoted 3 lines
Quoted 3 lines
Quoted 2 lines

Will it always append a CRC after this padding is complete?

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

No.

If that's true, then won't the packets still be shorter than expected if we only pad to 60 bytes?

In QEMU packets are transmitted without CRC between network backends, and when a NIC receives a packet, the minimum required payload length is 60 bytes without a CRC.

Ok, I see what you're saying, and indeed it already pads to 60 bytes, rather than 64 on the Rx side.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
Applied
#8 lore raw
In reply to Bin Meng
Quoted 4 lines · Bin Meng

As the comment of tx_padding_and_crc() says: "Never add CRC in QEMU", min_frame_len should excluce CRC, so it should be 60 instead of 64.

Applied to ppc-for-6.0, thanks.

Quoted 18 lines

---

 hw/net/fsl_etsec/rings.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/fsl_etsec/rings.c +1 -1
index d6be0d7d18..8f08446415 100644
@@ -259,7 +259,7 @@ static void process_tx_bd(eTSEC         *etsec,
                 || etsec->regs[MACCFG2].value & MACCFG2_PADCRC) {
 
                 /* Padding and CRC (Padding implies CRC) */
-                tx_padding_and_crc(etsec, 64);
+                tx_padding_and_crc(etsec, 60);
 
             } else if (etsec->first_bd.flags & BD_TX_TC
                        || etsec->regs[MACCFG2].value & MACCFG2_CRC_EN) {
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson