All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] app/testpmd: swap mac in IEEE1588 forwarding
@ 2015-12-10  9:28 Pablo de Lara
  2015-12-10 10:18 ` Mcnamara, John
  0 siblings, 1 reply; 3+ messages in thread
From: Pablo de Lara @ 2015-12-10  9:28 UTC (permalink / raw)
  To: dev

IEEE1588 forwarding mode uses same port to receive and transmit packets.
In this mode, the MAC address in the packets are not touched,
and therefore, packets could be sent with the same destination
MAC address as the MAC address of the port that is transmitting,
which causes the packet to be dropped in some NICs.

In order to avoid this scenario, MAC addresses are swapped
before packet is sent out.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 app/test-pmd/ieee1588fwd.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/app/test-pmd/ieee1588fwd.c b/app/test-pmd/ieee1588fwd.c
index c69023a..0d3b37a 100644
--- a/app/test-pmd/ieee1588fwd.c
+++ b/app/test-pmd/ieee1588fwd.c
@@ -123,6 +123,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs)
 {
 	struct rte_mbuf  *mb;
 	struct ether_hdr *eth_hdr;
+	struct ether_addr addr;
 	struct ptpv2_msg *ptp_hdr;
 	uint16_t eth_type;
 	uint32_t timesync_index;
@@ -205,6 +206,11 @@ ieee1588_packet_fwd(struct fwd_stream *fs)
 	/* Read and check the RX timestamp. */
 	port_ieee1588_rx_timestamp_check(fs->rx_port, timesync_index);
 
+	/* Swap dest and src mac addresses. */
+	ether_addr_copy(&eth_hdr->d_addr, &addr);
+	ether_addr_copy(&eth_hdr->s_addr, &eth_hdr->d_addr);
+	ether_addr_copy(&addr, &eth_hdr->s_addr);
+
 	/* Forward PTP packet with hardware TX timestamp */
 	mb->ol_flags |= PKT_TX_IEEE1588_TMST;
 	fs->tx_packets += 1;
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] app/testpmd: swap mac in IEEE1588 forwarding
  2015-12-10  9:28 [PATCH] app/testpmd: swap mac in IEEE1588 forwarding Pablo de Lara
@ 2015-12-10 10:18 ` Mcnamara, John
  2015-12-10 21:21   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Mcnamara, John @ 2015-12-10 10:18 UTC (permalink / raw)
  To: De Lara Guarch, Pablo, dev

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pablo de Lara
> Sent: Thursday, December 10, 2015 9:28 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] app/testpmd: swap mac in IEEE1588 forwarding
> 
> IEEE1588 forwarding mode uses same port to receive and transmit packets.
> In this mode, the MAC address in the packets are not touched, and
> therefore, packets could be sent with the same destination MAC address as
> the MAC address of the port that is transmitting, which causes the packet
> to be dropped in some NICs.
> 
> In order to avoid this scenario, MAC addresses are swapped before packet
> is sent out.
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Acked-by: John McNamara <john.mcnamara@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] app/testpmd: swap mac in IEEE1588 forwarding
  2015-12-10 10:18 ` Mcnamara, John
@ 2015-12-10 21:21   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2015-12-10 21:21 UTC (permalink / raw)
  To: De Lara Guarch, Pablo; +Cc: dev

> > IEEE1588 forwarding mode uses same port to receive and transmit packets.
> > In this mode, the MAC address in the packets are not touched, and
> > therefore, packets could be sent with the same destination MAC address as
> > the MAC address of the port that is transmitting, which causes the packet
> > to be dropped in some NICs.
> > 
> > In order to avoid this scenario, MAC addresses are swapped before packet
> > is sent out.
> > 
> > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> 
> Acked-by: John McNamara <john.mcnamara@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-10 21:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-10  9:28 [PATCH] app/testpmd: swap mac in IEEE1588 forwarding Pablo de Lara
2015-12-10 10:18 ` Mcnamara, John
2015-12-10 21:21   ` Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.