Skip to contentSkip to conversation

testpmd: modify the mac of csum forwarding

PATCH Applied Michael Qiu 6 participants 15 messages Aug 7, 2015 – Oct 29, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 testpmd: modify the mac of csum forwarding

For some ethnet-switch like intel RRC, all the packet forwarded out by DPDK will be dropped in switch side, so the packet generator will never receive the packet.

---
 app/test-pmd/csumonly.c | 4 ++++
 1 file changed, 4 insertions(+)
app/test-pmd/csumonly.c +4 -0
index 1bf3485..bf8af1d 100644
@@ -550,6 +550,10 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 		 * and inner headers */
 
 		eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);
+		ether_addr_copy(&peer_eth_addrs[fs->peer_addr],
+				&eth_hdr->d_addr);
+		ether_addr_copy(&ports[fs->tx_port].eth_addr,
+				&eth_hdr->s_addr);
 		parse_ethernet(eth_hdr, &info);
 		l3_hdr = (char *)eth_hdr + info.l2_len;
 
Signature · 1 line
1.9.3
#1 lore raw

Hi Michael,

Quoted 32 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Michael Qiu
Sent: Friday, August 07, 2015 4:29 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH] testpmd: modify the mac of csum forwarding

For some ethnet-switch like intel RRC, all the packet forwarded out by DPDK will be dropped in switch side, so the packet generator will never receive the packet.

---
 app/test-pmd/csumonly.c | 4 ++++
 1 file changed, 4 insertions(+)
app/test-pmd/csumonly.c +4 -1
index 1bf3485..bf8af1d 100644
@@ -550,6 +550,10 @@ pkt_burst_checksum_forward(struct fwd_stream
 *fs)
 		 * and inner headers */
 
 		eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);
+		ether_addr_copy(&peer_eth_addrs[fs->peer_addr],
+				&eth_hdr->d_addr);
+		ether_addr_copy(&ports[fs->tx_port].eth_addr,
+				&eth_hdr->s_addr);
 		parse_ethernet(eth_hdr, &info);
 		l3_hdr = (char *)eth_hdr + info.l2_len;
 
--
Quoted 1 line

1.9.3

Why do you make this change only in this mode? If NICs like RRC has this issue, I assume it would happen in other modes.

Thanks,
Pablo

#3 lore raw
In reply to Michael Qiu
Quoted 10 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Michael Qiu
Sent: Thursday, August 6, 2015 8:29 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH] testpmd: modify the mac of csum forwarding

For some ethnet-switch like intel RRC, all the packet forwarded out by DPDK will be dropped in switch side, so the packet generator will never receive the packet.

Is it because of anti-sproof? E.g. When the hardware found that the dest mac is the port itself, then it will be dropped during TX.
You need to tell the root cause, and why we need to modify like this.

Quoted 11 lines
---
 app/test-pmd/csumonly.c | 4 ++++
 1 file changed, 4 insertions(+)
app/test-pmd/csumonly.c index renamed from app/test-pmd/csumonly.c +0 -0

1bf3485..bf8af1d 100644

app/test-pmd/csumonly.c pkt_burst_checksum_forward(struct fwd_stream *fs) · line 556

Quoted 7 lines
app/test-pmd/csumonly.c +4 -0
@@ -550,6 +550,10 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 		 * and inner headers */
 
 		eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);
+		ether_addr_copy(&peer_eth_addrs[fs->peer_addr],
+				&eth_hdr->d_addr);
+		ether_addr_copy(&ports[fs->tx_port].eth_addr,
+				&eth_hdr->s_addr);

Is it really necessary? Why other NICs do not need this?

Quoted 5 lines
app/test-pmd/csumonly.c +0 -1
 		parse_ethernet(eth_hdr, &info);
 		l3_hdr = (char *)eth_hdr + info.l2_len;
 
--

1.9.3

#2 lore raw
In reply to De Lara Guarch, Pablo
Quoted 33 lines · Pablo

Hi Michael,

Quoted 31 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Michael Qiu
Sent: Friday, August 07, 2015 4:29 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH] testpmd: modify the mac of csum forwarding

For some ethnet-switch like intel RRC, all the packet forwarded out by DPDK will be dropped in switch side, so the packet generator will never receive the packet.

---
 app/test-pmd/csumonly.c | 4 ++++
 1 file changed, 4 insertions(+)
app/test-pmd/csumonly.c +4 -0
index 1bf3485..bf8af1d 100644
@@ -550,6 +550,10 @@ pkt_burst_checksum_forward(struct fwd_stream
 *fs)
 		 * and inner headers */
 
 		eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);
+		ether_addr_copy(&peer_eth_addrs[fs->peer_addr],
+				&eth_hdr->d_addr);
+		ether_addr_copy(&ports[fs->tx_port].eth_addr,
+				&eth_hdr->s_addr);
 		parse_ethernet(eth_hdr, &info);
 		l3_hdr = (char *)eth_hdr + info.l2_len;
Quoted 4 lines
Quoted 2 lines

--
1.9.3

Why do you make this change only in this mode? If NICs like RRC has this issue, I assume it would happen in other modes.

Yes, exactly, but for iofwd if we change the mac, so the mode is changed .... am I right?

Thanks,
Michael

Quoted 3 lines

Thanks,
Pablo

#4 lore raw
In reply to Zhang, Helin
Quoted 7 lines · Helin
Quoted 7 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Michael Qiu
Sent: Thursday, August 6, 2015 8:29 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH] testpmd: modify the mac of csum forwarding

Quoted 5 lines
Quoted 2 lines

For some ethnet-switch like intel RRC, all the packet forwarded out by DPDK will be dropped in switch side, so the packet generator will never receive the packet.

Is it because of anti-sproof? E.g. When the hardware found that the dest mac is the port itself, then it will be dropped during TX.
You need to tell the root cause, and why we need to modify like this.

Actually, it is not the hardware from PEP(PCI End Point) side, but the switch side.

The TX is OK for DPDK and NIC, but in switch, it receives the packet and try to forward it, but the dest mac is the same as the NIC which transmit this packet.
So switch will drop it as "Loopback Suppression Drop" in RRC. This should only happen when switch forwarding packets using dest mac.

Quoted 13 lines
Quoted 13 lines
---
 app/test-pmd/csumonly.c | 4 ++++
 1 file changed, 4 insertions(+)
app/test-pmd/csumonly.c index renamed from app/test-pmd/csumonly.c +0 -0

1bf3485..bf8af1d 100644

app/test-pmd/csumonly.c +0 -0
@@ -550,6 +550,10 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 		 * and inner headers */
 
Quoted 6 lines

app/test-pmd/csumonly.c pkt_burst_checksum_forward(struct fwd_stream *fs) · line 556

Quoted 5 lines
app/test-pmd/csumonly.c +4 -0
 		eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);
+		ether_addr_copy(&peer_eth_addrs[fs->peer_addr],
+				&eth_hdr->d_addr);
+		ether_addr_copy(&ports[fs->tx_port].eth_addr,
+				&eth_hdr->s_addr);

Is it really necessary? Why other NICs do not need this?

Because other NICs is connect directly to packet generator...., if we using switch to connect the generator and the NICs, I think it will need this.

Thanks,
Michael

Quoted 7 lines
Quoted 6 lines
app/test-pmd/csumonly.c +0 -1
 		parse_ethernet(eth_hdr, &info);
 		l3_hdr = (char *)eth_hdr + info.l2_len;
 
--

1.9.3

#5 lore raw
Quoted 53 lines

-----Original Message-----
From: Qiu, Michael
Sent: Friday, August 7, 2015 11:53 AM
To: Zhang, Helin; [email protected]
Subject: Re: [dpdk-dev] [PATCH] testpmd: modify the mac of csum forwarding

Quoted 10 lines · Helin
Quoted 10 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Michael Qiu
Sent: Thursday, August 6, 2015 8:29 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH] testpmd: modify the mac of csum forwarding

For some ethnet-switch like intel RRC, all the packet forwarded out by DPDK will be dropped in switch side, so the packet generator will never

receive the packet.

Quoted 3 lines

Is it because of anti-sproof? E.g. When the hardware found that the dest mac is the port itself, then it will be dropped during TX. You need to tell the root cause, and why we need to modify like this.

Actually, it is not the hardware from PEP(PCI End Point) side, but the switch side.

The TX is OK for DPDK and NIC, but in switch, it receives the packet and try to forward it, but the dest mac is the same as the NIC which transmit this packet. So switch will drop it as "Loopback Suppression Drop" in RRC. This should only happen when switch forwarding packets using dest mac.

Quoted 11 lines

app/test-pmd/csumonly.c pkt_burst_checksum_forward(struct fwd_stream

Quoted 11 lines
---
 app/test-pmd/csumonly.c | 4 ++++
 1 file changed, 4 insertions(+)
app/test-pmd/csumonly.c index renamed from app/test-pmd/csumonly.c +0 -0

1bf3485..bf8af1d 100644

app/test-pmd/csumonly.c +0 -0
@@ -550,6 +550,10 @@ pkt_burst_checksum_forward(struct fwd_stream

*fs)

Quoted 8 lines

app/test-pmd/csumonly.c pkt_burst_checksum_forward(struct fwd_stream *fs) · line 556

Quoted 7 lines
app/test-pmd/csumonly.c +4 -0
 		 * and inner headers */
 
 		eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);
+		ether_addr_copy(&peer_eth_addrs[fs->peer_addr],
+				&eth_hdr->d_addr);
+		ether_addr_copy(&ports[fs->tx_port].eth_addr,
+				&eth_hdr->s_addr);

Is it really necessary? Why other NICs do not need this?

Quoted 2 lines

Because other NICs is connect directly to packet generator...., if we using switch to connect the generator and the NICs, I think it will need this.

There are 'iofwd' and 'mac' mode in testpmd, and mac forware will modify the dest mac before transmitting the packet. They are for different cases. Why not use mac forwarding mode for your testing, and just keep it as is?

Regards,
Helin

Quoted 10 lines

Thanks,
Michael

Quoted 7 lines
Quoted 6 lines
app/test-pmd/csumonly.c +0 -1
 		parse_ethernet(eth_hdr, &info);
 		l3_hdr = (char *)eth_hdr + info.l2_len;
 
--

1.9.3

#6 lore raw
Quoted 48 lines · Helin
Quoted 48 lines

-----Original Message-----
From: Qiu, Michael
Sent: Friday, August 7, 2015 11:53 AM
To: Zhang, Helin; [email protected]
Subject: Re: [dpdk-dev] [PATCH] testpmd: modify the mac of csum forwarding

Quoted 9 lines · Helin
Quoted 9 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Michael Qiu
Sent: Thursday, August 6, 2015 8:29 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH] testpmd: modify the mac of csum forwarding

For some ethnet-switch like intel RRC, all the packet forwarded out by DPDK will be dropped in switch side, so the packet generator will never

receive the packet.

Quoted 3 lines

Is it because of anti-sproof? E.g. When the hardware found that the dest mac is the port itself, then it will be dropped during TX. You need to tell the root cause, and why we need to modify like this.

Actually, it is not the hardware from PEP(PCI End Point) side, but the switch side.

The TX is OK for DPDK and NIC, but in switch, it receives the packet and try to forward it, but the dest mac is the same as the NIC which transmit this packet. So switch will drop it as "Loopback Suppression Drop" in RRC. This should only happen when switch forwarding packets using dest mac.

Quoted 10 lines

app/test-pmd/csumonly.c pkt_burst_checksum_forward(struct fwd_stream

Quoted 10 lines
---
 app/test-pmd/csumonly.c | 4 ++++
 1 file changed, 4 insertions(+)
app/test-pmd/csumonly.c index renamed from app/test-pmd/csumonly.c +0 -0

1bf3485..bf8af1d 100644

app/test-pmd/csumonly.c +0 -0
@@ -550,6 +550,10 @@ pkt_burst_checksum_forward(struct fwd_stream

*fs)

Quoted 8 lines

app/test-pmd/csumonly.c pkt_burst_checksum_forward(struct fwd_stream *fs) · line 556

Quoted 7 lines
app/test-pmd/csumonly.c +4 -0
 		 * and inner headers */
 
 		eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);
+		ether_addr_copy(&peer_eth_addrs[fs->peer_addr],
+				&eth_hdr->d_addr);
+		ether_addr_copy(&ports[fs->tx_port].eth_addr,
+				&eth_hdr->s_addr);

Is it really necessary? Why other NICs do not need this?

Quoted 5 lines
Quoted 2 lines

Because other NICs is connect directly to packet generator...., if we using switch to connect the generator and the NICs, I think it will need this.

There are 'iofwd' and 'mac' mode in testpmd, and mac forware will modify the dest mac before transmitting the packet. They are for different cases. Why not use mac forwarding mode for your testing, and just keep it as is?

Yes, I don't touch iofwd, I just modify the csum, when we test checksum offload, especially for checksum insert in TX side.

Thanks,
Michael

Quoted 11 lines

Regards,
Helin

Quoted 7 lines

Thanks,
Michael

Quoted 5 lines
Quoted 5 lines
app/test-pmd/csumonly.c +0 -1
 		parse_ethernet(eth_hdr, &info);
 		l3_hdr = (char *)eth_hdr + info.l2_len;
 
--

1.9.3

#7 lore raw
In reply to Zhang, Helin
Quoted 36 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Zhang, Helin
Sent: Saturday, August 8, 2015 12:07 AM
To: Qiu, Michael; [email protected]
Subject: Re: [dpdk-dev] [PATCH] testpmd: modify the mac of csum forwarding

Quoted 8 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Michael Qiu
Sent: Thursday, August 6, 2015 8:29 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH] testpmd: modify the mac of csum forwarding

For some ethnet-switch like intel RRC, all the packet forwarded out by DPDK will be dropped in switch side, so the packet generator will never

receive the packet.
Is it because of anti-sproof? E.g. When the hardware found that the dest mac is the port itself, then it will be dropped during TX.
You need to tell the root cause, and why we need to modify like this.

app/test-pmd/csumonly.c pkt_burst_checksum_forward(struct fwd_stream

Quoted 11 lines
---
 app/test-pmd/csumonly.c | 4 ++++
 1 file changed, 4 insertions(+)
app/test-pmd/csumonly.c index renamed from app/test-pmd/csumonly.c +0 -0

1bf3485..bf8af1d 100644

app/test-pmd/csumonly.c +0 -0
@@ -550,6 +550,10 @@ pkt_burst_checksum_forward(struct fwd_stream

*fs)

Quoted 9 lines

app/test-pmd/csumonly.c pkt_burst_checksum_forward(struct fwd_stream *fs) · line 556

Quoted 7 lines
app/test-pmd/csumonly.c +4 -0
 		 * and inner headers */
 
 		eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);
+		ether_addr_copy(&peer_eth_addrs[fs->peer_addr],
+				&eth_hdr->d_addr);
+		ether_addr_copy(&ports[fs->tx_port].eth_addr,
+				&eth_hdr->s_addr);

Is it really necessary? Why other NICs do not need this?

Seems the behavior changes from io fwd into mac fwd?

Quoted 5 lines
Quoted 5 lines
app/test-pmd/csumonly.c +0 -1
 		parse_ethernet(eth_hdr, &info);
 		l3_hdr = (char *)eth_hdr + info.l2_len;
 
--

1.9.3

#8 lore raw
Quoted 2 lines · Changchun
Quoted 2 lines

[.../...]

Quoted 9 lines
Quoted 8 lines
app/test-pmd/csumonly.c +4 -0
 		eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);
+		ether_addr_copy(&peer_eth_addrs[fs->peer_addr],
+				&eth_hdr->d_addr);
+		ether_addr_copy(&ports[fs->tx_port].eth_addr,
+				&eth_hdr->s_addr);

Is it really necessary? Why other NICs do not need this?

Seems the behavior changes from io fwd into mac fwd?

Yes, but I think it is no influence for checksum offload.

Thanks,
Michael

Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
app/test-pmd/csumonly.c +0 -1
 		parse_ethernet(eth_hdr, &info);
 		l3_hdr = (char *)eth_hdr + info.l2_len;
 
--

1.9.3

Acked-by on v1 1/1
#9 lore raw
In reply to Michael Qiu
Quoted 34 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Michael Qiu
Sent: Friday, August 07, 2015 11:29 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH] testpmd: modify the mac of csum forwarding

For some ethnet-switch like intel RRC, all the packet forwarded out by DPDK will be dropped in switch side, so the packet generator will never receive the packet.

---
 app/test-pmd/csumonly.c | 4 ++++
 1 file changed, 4 insertions(+)
app/test-pmd/csumonly.c index renamed from app/test-pmd/csumonly.c +0 -0

1bf3485..bf8af1d 100644

app/test-pmd/csumonly.c +4 -1
@@ -550,6 +550,10 @@ pkt_burst_checksum_forward(struct fwd_stream
 *fs)
 		 * and inner headers */
 
 		eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);
+		ether_addr_copy(&peer_eth_addrs[fs->peer_addr],
+				&eth_hdr->d_addr);
+		ether_addr_copy(&ports[fs->tx_port].eth_addr,
+				&eth_hdr->s_addr);
 		parse_ethernet(eth_hdr, &info);
 		l3_hdr = (char *)eth_hdr + info.l2_len;
 
--
Quoted 1 line

1.9.3

The change will affect on the csum fwd performance.
But I also think the change is necessary, or we cannot use csumonly fwd mode in guest。

#10 lore raw

Hi, all

any other comments about this patch?

Thanks,
Michael

Quoted 40 lines · Jijiang
Quoted 33 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Michael Qiu
Sent: Friday, August 07, 2015 11:29 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH] testpmd: modify the mac of csum forwarding

For some ethnet-switch like intel RRC, all the packet forwarded out by DPDK will be dropped in switch side, so the packet generator will never receive the packet.

---
 app/test-pmd/csumonly.c | 4 ++++
 1 file changed, 4 insertions(+)
app/test-pmd/csumonly.c index renamed from app/test-pmd/csumonly.c +0 -0

1bf3485..bf8af1d 100644

app/test-pmd/csumonly.c +4 -1
@@ -550,6 +550,10 @@ pkt_burst_checksum_forward(struct fwd_stream
 *fs)
 		 * and inner headers */
 
 		eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);
+		ether_addr_copy(&peer_eth_addrs[fs->peer_addr],
+				&eth_hdr->d_addr);
+		ether_addr_copy(&ports[fs->tx_port].eth_addr,
+				&eth_hdr->s_addr);
 		parse_ethernet(eth_hdr, &info);
 		l3_hdr = (char *)eth_hdr + info.l2_len;
 
--
Quoted 1 line

1.9.3

The change will affect on the csum fwd performance.
But I also think the change is necessary, or we cannot use csumonly fwd mode in guest。

#11 lore raw
In reply to Liu, Jijiang

Hi, Thomas

Any comments on this patch? Is it suitable for DPDK?

Thanks,
Michael

Quoted 40 lines · Jijiang
Quoted 33 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Michael Qiu
Sent: Friday, August 07, 2015 11:29 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH] testpmd: modify the mac of csum forwarding

For some ethnet-switch like intel RRC, all the packet forwarded out by DPDK will be dropped in switch side, so the packet generator will never receive the packet.

---
 app/test-pmd/csumonly.c | 4 ++++
 1 file changed, 4 insertions(+)
app/test-pmd/csumonly.c index renamed from app/test-pmd/csumonly.c +0 -0

1bf3485..bf8af1d 100644

app/test-pmd/csumonly.c +4 -1
@@ -550,6 +550,10 @@ pkt_burst_checksum_forward(struct fwd_stream
 *fs)
 		 * and inner headers */
 
 		eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);
+		ether_addr_copy(&peer_eth_addrs[fs->peer_addr],
+				&eth_hdr->d_addr);
+		ether_addr_copy(&ports[fs->tx_port].eth_addr,
+				&eth_hdr->s_addr);
 		parse_ethernet(eth_hdr, &info);
 		l3_hdr = (char *)eth_hdr + info.l2_len;
 
--
Quoted 1 line

1.9.3

The change will affect on the csum fwd performance.
But I also think the change is necessary, or we cannot use csumonly fwd mode in guest。

#12 lore raw

2015-10-13 06:29, Qiu, Michael:

Quoted 3 lines

Hi, Thomas

Any comments on this patch? Is it suitable for DPDK?

Please check with the testpmd maintainer.
Pablo?

#13 lore raw

HI,

Quoted 8 lines

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Saturday, October 24, 2015 5:52 PM
To: Qiu, Michael
Cc: [email protected]; Liu, Jijiang; De Lara Guarch, Pablo
Subject: Re: [dpdk-dev] [PATCH] testpmd: modify the mac of csum forwarding

Quoted 7 lines

2015-10-13 06:29, Qiu, Michael:

Quoted 3 lines

Hi, Thomas

Any comments on this patch? Is it suitable for DPDK?

Please check with the testpmd maintainer.
Pablo?

The patch looks harmless for other NICs, and it does similar stuff as other forwarding modes, so I think it is safe to integrate.

Thanks,
Pablo

#14 lore raw

2015-10-26 19:47, De Lara Guarch, Pablo:

Quoted 10 lines
Quoted 7 lines

2015-10-13 06:29, Qiu, Michael:

Quoted 3 lines

Hi, Thomas

Any comments on this patch? Is it suitable for DPDK?

Please check with the testpmd maintainer.
Pablo?

The patch looks harmless for other NICs, and it does similar stuff as other forwarding modes, so I think it is safe to integrate.

Applied, thanks