From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 04F0511F5 for ; Tue, 20 Oct 2015 16:40:45 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 20 Oct 2015 07:39:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,707,1437462000"; d="scan'208";a="830922382" Received: from unknown (HELO stargo) ([10.217.248.233]) by orsmga002.jf.intel.com with SMTP; 20 Oct 2015 07:39:51 -0700 Received: by stargo (sSMTP sendmail emulation); Tue, 20 Oct 2015 16:40:48 +0200 From: Piotr Azarewicz To: dev@dpdk.org Date: Tue, 20 Oct 2015 16:36:13 +0200 Message-Id: <1445351774-4459-3-git-send-email-piotrx.t.azarewicz@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445351774-4459-1-git-send-email-piotrx.t.azarewicz@intel.com> References: <1443088539-28194-1-git-send-email-piotrx.t.azarewicz@intel.com> <1445351774-4459-1-git-send-email-piotrx.t.azarewicz@intel.com> Subject: [dpdk-dev] [PATCH v3 2/3] port: fix ras ring ports 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, 20 Oct 2015 14:40:46 -0000 Bug fixes for ring ports with IPv4/IPv6 reassembly support. Previous implementation can't work properly due to incorrect choosing process function. Also, assuming that, when processing ip packet, ip header is know we can set l3_len parameter here. Fixes: 50f54a84dfb7 ("port: add IPv6 reassembly port") Signed-off-by: Piotr Azarewicz --- lib/librte_port/rte_port_ras.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/librte_port/rte_port_ras.c b/lib/librte_port/rte_port_ras.c index 6bd0f8c..e45d450 100644 --- a/lib/librte_port/rte_port_ras.c +++ b/lib/librte_port/rte_port_ras.c @@ -144,7 +144,7 @@ rte_port_ring_writer_ras_create(void *params, int socket_id, int is_ipv4) port->tx_burst_sz = conf->tx_burst_sz; port->tx_buf_count = 0; - port->f_ras = (is_ipv4 == 0) ? process_ipv4 : process_ipv6; + port->f_ras = (is_ipv4 == 1) ? process_ipv4 : process_ipv6; return port; } @@ -182,7 +182,7 @@ process_ipv4(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt) /* Assume there is no ethernet header */ struct ipv4_hdr *pkt_hdr = rte_pktmbuf_mtod(pkt, struct ipv4_hdr *); - /* Get "Do not fragment" flag and fragment offset */ + /* Get "More fragments" flag and fragment offset */ uint16_t frag_field = rte_be_to_cpu_16(pkt_hdr->fragment_offset); uint16_t frag_offset = (uint16_t)(frag_field & IPV4_HDR_OFFSET_MASK); uint16_t frag_flag = (uint16_t)(frag_field & IPV4_HDR_MF_FLAG); @@ -195,6 +195,8 @@ process_ipv4(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt) struct rte_ip_frag_tbl *tbl = p->frag_tbl; struct rte_ip_frag_death_row *dr = &p->death_row; + pkt->l3_len = sizeof(*pkt_hdr); + /* Process this fragment */ mo = rte_ipv4_frag_reassemble_packet(tbl, dr, pkt, rte_rdtsc(), pkt_hdr); @@ -224,6 +226,8 @@ process_ipv6(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt) struct rte_ip_frag_tbl *tbl = p->frag_tbl; struct rte_ip_frag_death_row *dr = &p->death_row; + pkt->l3_len = sizeof(*pkt_hdr) + sizeof(*frag_hdr); + /* Process this fragment */ mo = rte_ipv6_frag_reassemble_packet(tbl, dr, pkt, rte_rdtsc(), pkt_hdr, frag_hdr); -- 1.7.9.5