From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com [209.85.217.170]) by dpdk.org (Postfix) with ESMTP id 6F642E62 for ; Tue, 8 Dec 2015 15:47:44 +0100 (CET) Received: by lbbcs9 with SMTP id cs9so12319214lbb.1 for ; Tue, 08 Dec 2015 06:47:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=iVyVteLJdcrdEm1G1+y2ZeR1wfpTbD1Rc/DX+Wgxekg=; b=XXch4c/9eTfk/yr0gt4bg3BUyQnBh9taJ/FPzwO+uEW8u7GT9NbjDA9haJ7XN5SQif EDkN1VixGm0gHo3WRqX6O91q1te9h9kSTWC3rtLKhLCO3XXl91VqjT7F/GLk4T2So6EZ y30CsyyTz7UT8WzK32X5YcWrzkqPUmQALy70nJft1CmM0oIiWU9DFoLCCOYaaW7vn6md ko/NF02Z/djtri3s/HaANuRsYsOjAZb1yfwZns2GafvM85czbDiDtTBSPKR8iNgBJzso AOy3h+m2y53ISTnVkmpMeCIp06otitryike7ebmvk84QY5ySuFQDo+OJ6R2W5XsDHQku Mupw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=iVyVteLJdcrdEm1G1+y2ZeR1wfpTbD1Rc/DX+Wgxekg=; b=hW0UmY96fBNXETOZcXn6PoFGqnUokH/LJlDQ+1SmGq0NpUra1ECa0vow5N2rUy1RwT 92bdjgujs/OmijxQi35wuLCPdDzHe3/yPU+BFojd5/GDb8SvSjrj+vlwTQWYZLT54gbu BAHDhHjP5y8DPhDoBCkvevWVhzAnR0W01T1qjMrRWU0GXiIO41+WgPqk+vlf0Xz2xzOk jAmrjEtZISZ1pFkLgTFsM65gNpUtAEZq3y0f2lElfY8dUoRb9/j1ZojSHFI/TO0dsufA BB1oEUv4x5aKDjlb9ozUHekOWSDGAgo8Nk4Ox9H3oL94nvAGGytvFnamsvA1Jf12TOv8 +0BQ== X-Gm-Message-State: ALoCoQmvw41/7byMJjjOThrDFBmAoqa9+KGkaP2co/YU6+ATwU0v+ANd7TqysVu2+/r07HXfQEhzY3LLd+bCJf6JjjYJed/kug== X-Received: by 10.112.62.230 with SMTP id b6mr125206lbs.56.1449586064009; Tue, 08 Dec 2015 06:47:44 -0800 (PST) Received: from b.semihalf.local ([80.82.22.190]) by smtp.gmail.com with ESMTPSA id f71sm646027lfe.36.2015.12.08.06.47.43 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Dec 2015 06:47:43 -0800 (PST) From: Andriy Berestovskyy To: dev@dpdk.org Date: Tue, 8 Dec 2015 15:47:03 +0100 Message-Id: <1449586023-22623-1-git-send-email-aber@semihalf.com> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [PATCH] bonding: fix reordering of IP fragments X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2015 14:47:44 -0000 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 #include #include +#include #include #include #include @@ -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