DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] bonding: fix reordering of IP fragments
@ 2015-12-08 14:47 Andriy Berestovskyy
  2015-12-14 13:54 ` Declan Doherty
  2015-12-14 15:02 ` Andriy Berestovskyy
  0 siblings, 2 replies; 4+ messages in thread
From: Andriy Berestovskyy @ 2015-12-08 14:47 UTC (permalink / raw)
  To: dev

Fragmented IPv4 packets have no TCP/UDP headers, so we hashed
random data introducing reordering of the fragments.
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 8f84ec1..b1373c6 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -39,6 +39,7 @@
 #include <rte_tcp.h>
 #include <rte_udp.h>
 #include <rte_ip.h>
+#include <rte_ip_frag.h>
 #include <rte_devargs.h>
 #include <rte_kvargs.h>
 #include <rte_dev.h>
@@ -552,17 +553,20 @@ xmit_l34_hash(const struct rte_mbuf *buf, uint8_t slave_count)
 
 		l3hash = ipv4_hash(ipv4_hdr);
 
-		ip_hdr_offset = (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) *
-				IPV4_IHL_MULTIPLIER;
-
-		if (ipv4_hdr->next_proto_id == IPPROTO_TCP) {
-			tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr +
-					ip_hdr_offset);
-			l4hash = HASH_L4_PORTS(tcp_hdr);
-		} else if (ipv4_hdr->next_proto_id == IPPROTO_UDP) {
-			udp_hdr = (struct udp_hdr *)((char *)ipv4_hdr +
-					ip_hdr_offset);
-			l4hash = HASH_L4_PORTS(udp_hdr);
+		/* there is no L4 header in fragmented packet */
+		if (likely(rte_ipv4_frag_pkt_is_fragmented(ipv4_hdr) == 0)) {
+			ip_hdr_offset = (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) *
+					IPV4_IHL_MULTIPLIER;
+
+			if (ipv4_hdr->next_proto_id == IPPROTO_TCP) {
+				tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr +
+						ip_hdr_offset);
+				l4hash = HASH_L4_PORTS(tcp_hdr);
+			} else if (ipv4_hdr->next_proto_id == IPPROTO_UDP) {
+				udp_hdr = (struct udp_hdr *)((char *)ipv4_hdr +
+						ip_hdr_offset);
+				l4hash = HASH_L4_PORTS(udp_hdr);
+			}
 		}
 	} else if  (rte_cpu_to_be_16(ETHER_TYPE_IPv6) == proto) {
 		struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *)
-- 
1.9.1

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

* Re: [dpdk-dev] [PATCH] bonding: fix reordering of IP fragments
  2015-12-08 14:47 [dpdk-dev] [PATCH] bonding: fix reordering of IP fragments Andriy Berestovskyy
@ 2015-12-14 13:54 ` Declan Doherty
  2015-12-14 15:02 ` Andriy Berestovskyy
  1 sibling, 0 replies; 4+ messages in thread
From: Declan Doherty @ 2015-12-14 13:54 UTC (permalink / raw)
  To: Andriy Berestovskyy, dev

On 08/12/15 14:47, Andriy Berestovskyy wrote:
> Fragmented IPv4 packets have no TCP/UDP headers, so we hashed
> random data introducing reordering of the fragments.

Acked-by: Declan Doherty<declan.doherty@intel.com>

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

* Re: [dpdk-dev] [PATCH] bonding: fix reordering of IP fragments
  2015-12-08 14:47 [dpdk-dev] [PATCH] bonding: fix reordering of IP fragments Andriy Berestovskyy
  2015-12-14 13:54 ` Declan Doherty
@ 2015-12-14 15:02 ` Andriy Berestovskyy
  2015-12-14 21:45   ` Thomas Monjalon
  1 sibling, 1 reply; 4+ messages in thread
From: Andriy Berestovskyy @ 2015-12-14 15:02 UTC (permalink / raw)
  To: dev

On Tue, Dec 8, 2015 at 3:47 PM, Andriy Berestovskyy <aber@semihalf.com> wrote:
> Fragmented IPv4 packets have no TCP/UDP headers, so we hashed
> random data introducing reordering of the fragments.

Signed-off-by: Andriy Berestovskyy <aber@semihalf.com>

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

* Re: [dpdk-dev] [PATCH] bonding: fix reordering of IP fragments
  2015-12-14 15:02 ` Andriy Berestovskyy
@ 2015-12-14 21:45   ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2015-12-14 21:45 UTC (permalink / raw)
  To: Andriy Berestovskyy; +Cc: dev

2015-12-14 16:02, Andriy Berestovskyy:
> On Tue, Dec 8, 2015 at 3:47 PM, Andriy Berestovskyy <aber@semihalf.com> wrote:
> > Fragmented IPv4 packets have no TCP/UDP headers, so we hashed
> > random data introducing reordering of the fragments.
> 
> Signed-off-by: Andriy Berestovskyy <aber@semihalf.com>

Applied, thanks

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-08 14:47 [dpdk-dev] [PATCH] bonding: fix reordering of IP fragments Andriy Berestovskyy
2015-12-14 13:54 ` Declan Doherty
2015-12-14 15:02 ` Andriy Berestovskyy
2015-12-14 21:45   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).