From patchwork Tue Nov 4 17:38:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zoltan Kiss X-Patchwork-Id: 40163 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EE4D921894 for ; Tue, 4 Nov 2014 17:38:54 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id w7sf2494766lbi.8 for ; Tue, 04 Nov 2014 09:38:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=m5Lya+lldToVyhlAIuPbHPwXYNFLy28cp73BxTp+fsM=; b=IxvHMA+P7/4jSLGUYxt/A5VXDXW6kCu+aaaQzWp/tt5JYlh5OQh3Qa7QONC112TesV j++//lJ8fKJzNk8cHrlkb6HNCViWOXAw8WtphCWqB3Ja4V9dP8yTOVTAE5LZQioS6wJp BDW8jdHK8zQMZFT61NQaVGD/HnQ1FJ8WowE5WiV9MVzSxSSSzrtHRp8fMaLG7ob6I5qp 71vCH3O+IpntORROTLZv1Gw596v/cdEFmSD9P3wNJMUwCzYroCRrIk1tLdDu36CHw8cl Big6SV2BkQj98xQ6xSHYUBoe4y3PRFColOl7+/Gs9eDRiVxCcJBn//qCmEDzJX9lSDz6 Od4A== X-Gm-Message-State: ALoCoQnXFEWPisQUYHB+A/SqFKzbT3xUrEGknitxyR+cBQ5YyVW2hVEh3SxkQAasN09aE7aNy1Ii X-Received: by 10.152.42.171 with SMTP id p11mr4294536lal.4.1415122733861; Tue, 04 Nov 2014 09:38:53 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.97 with SMTP id p1ls736394laj.87.gmail; Tue, 04 Nov 2014 09:38:53 -0800 (PST) X-Received: by 10.112.57.227 with SMTP id l3mr60631832lbq.68.1415122733573; Tue, 04 Nov 2014 09:38:53 -0800 (PST) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id db1si1779262lad.79.2014.11.04.09.38.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Nov 2014 09:38:53 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by mail-la0-f48.google.com with SMTP id gq15so1307368lab.7 for ; Tue, 04 Nov 2014 09:38:53 -0800 (PST) X-Received: by 10.152.116.102 with SMTP id jv6mr61186945lab.40.1415122732993; Tue, 04 Nov 2014 09:38:52 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp159908lbc; Tue, 4 Nov 2014 09:38:52 -0800 (PST) X-Received: by 10.224.114.79 with SMTP id d15mr76096796qaq.29.1415122731443; Tue, 04 Nov 2014 09:38:51 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id f2si1871467qas.11.2014.11.04.09.38.50 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 04 Nov 2014 09:38:51 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Xli49-0000yJ-6t; Tue, 04 Nov 2014 17:38:49 +0000 Received: from mail-wg0-f54.google.com ([74.125.82.54]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Xli43-0000vy-7S for lng-odp@lists.linaro.org; Tue, 04 Nov 2014 17:38:43 +0000 Received: by mail-wg0-f54.google.com with SMTP id n12so8770766wgh.27 for ; Tue, 04 Nov 2014 09:38:37 -0800 (PST) X-Received: by 10.180.39.8 with SMTP id l8mr5252252wik.19.1415122717585; Tue, 04 Nov 2014 09:38:37 -0800 (PST) Received: from localhost.localdomain ([90.152.119.35]) by mx.google.com with ESMTPSA id b6sm1749029wiy.22.2014.11.04.09.38.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Nov 2014 09:38:36 -0800 (PST) From: Zoltan Kiss To: lng-odp@lists.linaro.org, ciprian.barbu@linaro.org Date: Tue, 4 Nov 2014 17:38:06 +0000 Message-Id: <1415122686-5184-1-git-send-email-zoltan.kiss@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [PATCH linux-dpdk] Adjust ODP DPDK platform to latest DPDK API (EXPERIMENTAL) X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: zoltan.kiss@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 The following commits changed the master branch of DPDK: http://dpdk.org/browse/dpdk/commit/?id=7869536f http://dpdk.org/browse/dpdk/commit/?id=ca04aaea http://dpdk.org/browse/dpdk/commit/?id=08b563ff http://dpdk.org/browse/dpdk/commit/?id=ea672a8b http://dpdk.org/browse/dpdk/commit/?id=9aaccf1a http://dpdk.org/browse/dpdk/commit/?id=e5ffdd14 http://dpdk.org/browse/dpdk/commit/?id=591a9d79 This patch adjust the code to these changes. Signed-off-by: Zoltan Kiss diff --git a/platform/linux-dpdk/odp_buffer.c b/platform/linux-dpdk/odp_buffer.c index 4914ca2..b586fa2 100644 --- a/platform/linux-dpdk/odp_buffer.c +++ b/platform/linux-dpdk/odp_buffer.c @@ -69,8 +69,6 @@ int odp_buffer_snprint(char *str, size_t n, odp_buffer_t buf) len += snprintf(&str[len], n-len, " ref_count %i\n", hdr->mb.refcnt); len += snprintf(&str[len], n-len, - " dpdk type %i\n", hdr->mb.type); - len += snprintf(&str[len], n-len, " odp type %i\n", hdr->type); return len; diff --git a/platform/linux-dpdk/odp_buffer_pool.c b/platform/linux-dpdk/odp_buffer_pool.c index 8325b9e..e2183d6 100644 --- a/platform/linux-dpdk/odp_buffer_pool.c +++ b/platform/linux-dpdk/odp_buffer_pool.c @@ -169,18 +169,18 @@ odp_dpdk_mbuf_ctor(struct rte_mempool *mp, /* keep some headroom between start of buffer and data */ if (mb_ctor_arg->buf_type == ODP_BUFFER_TYPE_PACKET || mb_ctor_arg->buf_type == ODP_BUFFER_TYPE_ANY) - mb->pkt.data = (char *)mb->buf_addr + RTE_PKTMBUF_HEADROOM; + mb->data_off = RTE_PKTMBUF_HEADROOM; else - mb->pkt.data = mb->buf_addr; + mb->data_off = 0; /* init some constant fields */ - mb->type = RTE_MBUF_PKT; mb->pool = mp; - mb->pkt.nb_segs = 1; - mb->pkt.in_port = 0xff; + mb->nb_segs = 1; + mb->port = 0xff; mb->ol_flags = 0; - mb->pkt.vlan_macip.data = 0; - mb->pkt.hash.rss = 0; + mb->l2_l3_len = 0; + mb->vlan_tci = 0; + mb->hash.rss = 0; /* Save index, might be useful for debugging purposes */ buf_hdr = (struct odp_buffer_hdr_t *)raw_mbuf; @@ -282,5 +282,5 @@ void odp_buffer_free(odp_buffer_t buf) void odp_buffer_pool_print(odp_buffer_pool_t pool_id) { - rte_mempool_dump((const struct rte_mempool *)pool_id); + rte_mempool_dump(stdout, (const struct rte_mempool *)pool_id); } diff --git a/platform/linux-dpdk/odp_init.c b/platform/linux-dpdk/odp_init.c index ecc2066..97f8b21 100644 --- a/platform/linux-dpdk/odp_init.c +++ b/platform/linux-dpdk/odp_init.c @@ -37,11 +37,6 @@ int odp_init_dpdk(void) return -1; } - if (rte_pmd_init_all() < 0) { - ODP_ERR("Cannot init pmd\n"); - return -1; - } - if (rte_eal_pci_probe() < 0) { ODP_ERR("Cannot probe PCI\n"); return -1; diff --git a/platform/linux-dpdk/odp_packet.c b/platform/linux-dpdk/odp_packet.c index 1cd190d..0586538 100644 --- a/platform/linux-dpdk/odp_packet.c +++ b/platform/linux-dpdk/odp_packet.c @@ -51,14 +51,12 @@ static int odp_packet_set_offset_len(odp_packet_t pkt, size_t frame_offset, size_t len) { struct rte_mbuf *mb = &(odp_packet_hdr(pkt)->buf_hdr.mb); - uint16_t offset; + uint16_t offset = mb->data_off; uint16_t data_len; /* The pkt buf may have been pulled back into the headroom * so we cannot rely on finding the data right after the * ODP header and HEADROOM */ - offset = (uint16_t)((unsigned long)mb->pkt.data - - (unsigned long)mb->buf_addr); ODP_ASSERT(mb->buf_len >= offset, "Corrupted mbuf"); data_len = mb->buf_len - offset; @@ -66,14 +64,14 @@ static int odp_packet_set_offset_len(odp_packet_t pkt, size_t frame_offset, ODP_ERR("Frame offset too big"); return -1; } - mb->pkt.data = (void *)((char *)mb->pkt.data + frame_offset); + mb->data_off += frame_offset; data_len -= frame_offset; if (data_len < len) { ODP_ERR("Packet len too big"); return -1; } - mb->pkt.pkt_len = len; + mb->pkt_len = len; return 0; } @@ -86,7 +84,7 @@ void odp_packet_set_len(odp_packet_t pkt, size_t len) size_t odp_packet_get_len(odp_packet_t pkt) { struct rte_mbuf *mb = &(odp_packet_hdr(pkt)->buf_hdr.mb); - return mb->pkt.pkt_len; + return mb->pkt_len; } uint8_t *odp_packet_buf_addr(odp_packet_t pkt) @@ -97,7 +95,7 @@ uint8_t *odp_packet_buf_addr(odp_packet_t pkt) uint8_t *odp_packet_start(odp_packet_t pkt) { struct rte_mbuf *mb = &(odp_packet_hdr(pkt)->buf_hdr.mb); - return mb->pkt.data; + return ((uint8_t *)(mb->buf_addr) + mb->data_off); } @@ -360,13 +358,13 @@ void odp_packet_print(odp_packet_t pkt) len += snprintf(&str[len], n-len, " l4_offset %u\n", hdr->l4_offset); len += snprintf(&str[len], n-len, - " frame_len %u\n", hdr->buf_hdr.mb.pkt.pkt_len); + " frame_len %u\n", hdr->buf_hdr.mb.pkt_len); len += snprintf(&str[len], n-len, " input %u\n", hdr->input); str[len] = '\0'; printf("\n%s\n", str); - rte_pktmbuf_dump(&hdr->buf_hdr.mb, 32); + rte_pktmbuf_dump(stdout, &hdr->buf_hdr.mb, 32); p = odp_packet_start(pkt); printf("00000000: %02X %02X %02X %02X %02X %02X %02X %02X\n", @@ -393,12 +391,12 @@ int odp_packet_copy(odp_packet_t pkt_dst, odp_packet_t pkt_src) mb_dst = &(odp_packet_hdr(pkt_dst)->buf_hdr.mb); mb_src = &(odp_packet_hdr(pkt_src)->buf_hdr.mb); - if (mb_dst->pkt.nb_segs != mb_src->pkt.nb_segs) { + if (mb_dst->nb_segs != mb_src->nb_segs) { ODP_ERR("Different nb_segs in pkt_dst and pkt_src"); return -1; } - nb_segs = mb_src->pkt.nb_segs; + nb_segs = mb_src->nb_segs; if (mb_dst->buf_len < mb_src->buf_len) { ODP_ERR("dst_pkt smaller than src_pkt"); @@ -411,8 +409,8 @@ int odp_packet_copy(odp_packet_t pkt_dst, odp_packet_t pkt_src) return -1; } memcpy(mb_dst->buf_addr, mb_src->buf_addr, mb_src->buf_len); - mb_dst = mb_dst->pkt.next; - mb_src = mb_src->pkt.next; + mb_dst = mb_dst->next; + mb_src = mb_src->next; } return 0; } diff --git a/platform/linux-dpdk/odp_packet_dpdk.c b/platform/linux-dpdk/odp_packet_dpdk.c index 9fe4bbd..94653d4 100644 --- a/platform/linux-dpdk/odp_packet_dpdk.c +++ b/platform/linux-dpdk/odp_packet_dpdk.c @@ -167,7 +167,7 @@ int recv_pkt_dpdk(pkt_dpdk_t * const pkt_dpdk, odp_packet_t pkt_table[], for (i = 0; i < nb_rx; i++) { odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt_table[i]); struct rte_mbuf *mb = &pkt_hdr->buf_hdr.mb; - odp_packet_parse(pkt_table[i], mb->pkt.pkt_len, 0); + odp_packet_parse(pkt_table[i], mb->pkt_len, 0); } return nb_rx; }