From patchwork Tue Jan 30 16:00:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 126269 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp3488893ljd; Tue, 30 Jan 2018 08:04:45 -0800 (PST) X-Google-Smtp-Source: AH8x227TvJQECKhWKsaQwDwaiT5goLfibyV8I2/CnK9pN8nHvdFCrVvm6F0XBogo9ib0Y6nybWOp X-Received: by 10.55.168.137 with SMTP id r131mr42979495qke.27.1517328285559; Tue, 30 Jan 2018 08:04:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517328285; cv=none; d=google.com; s=arc-20160816; b=u1bwTPCnqFWZkQ1sGaRt2bUUMJWyRFd233yGzBSP66y6RVRAXOxDSWkns7HaTnKWpJ +OjNQWqHdZcGzyFG8bFxWXUhrdM2pq/iS8jrY9DdRAe2BmxxGOZpwKXZBDg49BnY46Gn uVJOBTcRMozUnoqf+YY2ONJKZkvgZMSrNVdS0lmB8F9pi4EEdoDtnqAOWyGVpYd4VJHo h7f5/cc8570IeoCKubFvCOiktV3HlI4ngYxLncet9Wx5J3KasudjTKerbkR1GO8g7upa kv293wihQUyR5nguLpm6rXYH2tx1ibem/qJQ51vQXtROSLPmiZ3um3uPgB1gP8E8UsOi KEJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=mrHFt9NQw/vi8LL5el6FZWmYwwE00pJX7PcTVue+Dm4=; b=WBWgDpalZsSKzuKtxvDIatTZUkm6vXrZKC4u1o2LH2pBp7ZKh8gxfDUunCQWY0NEyT TnMp7kdkKzBg/50nKeTTRVHHK9G3jbls7Yv/q8rNjwZwtTus5Y226VP31A7+eiUkTA7q 0zQnEljsSmkO6Q0qnDvwgHj2Uc3VeNiqtn1xNgaIgD2zJ4znX0n4BCiV+qavXn1sVxCR YjrLa8XdYDr/jTgpXfEt35zvS+cZ1wmywazjW7m03OiLVe7qzIC7Vutw/Sztm6V6g9AO QKVvPejli7vqW8DrQHGWBLIYjM9YlaL+on0xhwqHU1HupWbuHKBX3bAS25put7mbS9kf q3eQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id h45si4328545qtk.47.2018.01.30.08.04.45; Tue, 30 Jan 2018 08:04:45 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 3CF2961756; Tue, 30 Jan 2018 16:04:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 8059261744; Tue, 30 Jan 2018 16:00:53 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id AFEED616E3; Tue, 30 Jan 2018 16:00:24 +0000 (UTC) Received: from forward105o.mail.yandex.net (forward105o.mail.yandex.net [37.140.190.183]) by lists.linaro.org (Postfix) with ESMTPS id 5750460C5D for ; Tue, 30 Jan 2018 16:00:15 +0000 (UTC) Received: from mxback6j.mail.yandex.net (mxback6j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10f]) by forward105o.mail.yandex.net (Yandex) with ESMTP id 2C8394444537 for ; Tue, 30 Jan 2018 19:00:14 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback6j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id VIAIEoZcIv-0EEqR4Gw; Tue, 30 Jan 2018 19:00:14 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Nz8CQ597Mi-0DR8bE5P; Tue, 30 Jan 2018 19:00:13 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 30 Jan 2018 19:00:02 +0300 Message-Id: <1517328009-16379-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517328009-16379-1-git-send-email-odpbot@yandex.ru> References: <1517328009-16379-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 437 Subject: [lng-odp] [PATCH v1 4/11] linux-gen: packet: use inlined copy functions X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Use always inlined versions of packet to/from memory copy functions. Signed-off-by: Petri Savolainen --- /** Email created from pull request 437 (psavol:master-packet-optim) ** https://github.com/Linaro/odp/pull/437 ** Patch: https://github.com/Linaro/odp/pull/437.patch ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd ** Merge commit sha: ab7875c186fe80cfe103c5be5634b0eda312aed4 **/ platform/linux-generic/odp_traffic_mngr.c | 24 ++++++++++++------------ platform/linux-generic/pktio/dpdk.c | 4 ++-- platform/linux-generic/pktio/netmap.c | 4 ++-- platform/linux-generic/pktio/pcap.c | 5 +++-- platform/linux-generic/pktio/socket_mmap.c | 7 ++++--- platform/linux-generic/pktio/tap.c | 5 +++-- 6 files changed, 26 insertions(+), 23 deletions(-) diff --git a/platform/linux-generic/odp_traffic_mngr.c b/platform/linux-generic/odp_traffic_mngr.c index 557e77ba3..03094cc37 100644 --- a/platform/linux-generic/odp_traffic_mngr.c +++ b/platform/linux-generic/odp_traffic_mngr.c @@ -1941,8 +1941,8 @@ static void egress_vlan_marking(tm_vlan_marking_t *vlan_marking, * correctness rather then performance. */ split_hdr = hdr_len < (_ODP_ETHHDR_LEN + _ODP_VLANHDR_LEN); if (split_hdr) { - odp_packet_copy_to_mem(odp_pkt, _ODP_ETHHDR_LEN, - _ODP_VLANHDR_LEN, &vlan_hdr); + _odp_packet_copy_to_mem(odp_pkt, _ODP_ETHHDR_LEN, + _ODP_VLANHDR_LEN, &vlan_hdr); vlan_hdr_ptr = &vlan_hdr; } @@ -1956,8 +1956,8 @@ static void egress_vlan_marking(tm_vlan_marking_t *vlan_marking, vlan_hdr_ptr->tci = _odp_cpu_to_be_16(new_tci); if (split_hdr) - odp_packet_copy_from_mem(odp_pkt, _ODP_ETHHDR_LEN, - _ODP_VLANHDR_LEN, &vlan_hdr); + _odp_packet_copy_from_mem(odp_pkt, _ODP_ETHHDR_LEN, + _ODP_VLANHDR_LEN, &vlan_hdr); } static void egress_ipv4_tos_marking(tm_tos_marking_t *tos_marking, @@ -1980,8 +1980,8 @@ static void egress_ipv4_tos_marking(tm_tos_marking_t *tos_marking, * correctness rather then performance. */ split_hdr = hdr_len < 12; if (split_hdr) { - odp_packet_copy_to_mem(odp_pkt, l3_offset, - _ODP_IPV4HDR_LEN, &ipv4_hdr); + _odp_packet_copy_to_mem(odp_pkt, l3_offset, + _ODP_IPV4HDR_LEN, &ipv4_hdr); ipv4_hdr_ptr = &ipv4_hdr; } @@ -2022,8 +2022,8 @@ static void egress_ipv4_tos_marking(tm_tos_marking_t *tos_marking, ipv4_hdr_ptr->tos = new_tos; ipv4_hdr_ptr->chksum = _odp_cpu_to_be_16((~ones_compl_sum) & 0xFFFF); if (split_hdr) - odp_packet_copy_from_mem(odp_pkt, l3_offset, - _ODP_IPV4HDR_LEN, &ipv4_hdr); + _odp_packet_copy_from_mem(odp_pkt, l3_offset, + _ODP_IPV4HDR_LEN, &ipv4_hdr); } static void egress_ipv6_tc_marking(tm_tos_marking_t *tos_marking, @@ -2046,8 +2046,8 @@ static void egress_ipv6_tc_marking(tm_tos_marking_t *tos_marking, * correctness rather then performance. */ split_hdr = hdr_len < 4; if (split_hdr) { - odp_packet_copy_to_mem(odp_pkt, l3_offset, - _ODP_IPV6HDR_LEN, &ipv6_hdr); + _odp_packet_copy_to_mem(odp_pkt, l3_offset, + _ODP_IPV6HDR_LEN, &ipv6_hdr); ipv6_hdr_ptr = &ipv6_hdr; } @@ -2075,8 +2075,8 @@ static void egress_ipv6_tc_marking(tm_tos_marking_t *tos_marking, ipv6_hdr_ptr->ver_tc_flow = _odp_cpu_to_be_32(new_ver_tc_flow); if (split_hdr) - odp_packet_copy_from_mem(odp_pkt, l3_offset, - _ODP_IPV6HDR_LEN, &ipv6_hdr); + _odp_packet_copy_from_mem(odp_pkt, l3_offset, + _ODP_IPV6HDR_LEN, &ipv6_hdr); } static void tm_egress_marking(tm_system_t *tm_system, odp_packet_t odp_pkt) diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index 4ae72e10a..86d7a4513 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -471,7 +471,7 @@ static inline int mbuf_to_pkt(pktio_entry_t *pktio_entry, pkt_hdr = odp_packet_hdr(pkt); pull_tail(pkt_hdr, alloc_len - pkt_len); - if (odp_packet_copy_from_mem(pkt, 0, pkt_len, data) != 0) + if (_odp_packet_copy_from_mem(pkt, 0, pkt_len, data) != 0) goto fail; pkt_hdr->input = pktio_entry->s.handle; @@ -649,7 +649,7 @@ static inline int pkt_to_mbuf(pktio_entry_t *pktio_entry, /* Packet always fits in mbuf */ data = rte_pktmbuf_append(mbuf_table[i], pkt_len); - odp_packet_copy_to_mem(pkt_table[i], 0, pkt_len, data); + _odp_packet_copy_to_mem(pkt_table[i], 0, pkt_len, data); if (odp_unlikely(pktio_entry->s.chksum_insert_ena)) { odp_pktout_config_opt_t *pktout_capa = diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c index a7c479001..c03564f4e 100644 --- a/platform/linux-generic/pktio/netmap.c +++ b/platform/linux-generic/pktio/netmap.c @@ -652,7 +652,7 @@ static inline int netmap_pkt_to_odp(pktio_entry_t *pktio_entry, /* For now copy the data in the mbuf, worry about zero-copy later */ - if (odp_packet_copy_from_mem(pkt, 0, len, slot.buf) != 0) + if (_odp_packet_copy_from_mem(pkt, 0, len, slot.buf) != 0) goto fail; pkt_hdr->input = pktio_entry->s.handle; @@ -938,7 +938,7 @@ static int netmap_send(pktio_entry_t *pktio_entry, int index, buf = NETMAP_BUF(ring, ring->slot[slot_id].buf_idx); - if (odp_packet_copy_to_mem(pkt, 0, pkt_len, buf)) { + if (_odp_packet_copy_to_mem(pkt, 0, pkt_len, buf)) { i = NM_INJECT_RETRIES; break; } diff --git a/platform/linux-generic/pktio/pcap.c b/platform/linux-generic/pktio/pcap.c index 7fc925149..76cbf9eef 100644 --- a/platform/linux-generic/pktio/pcap.c +++ b/platform/linux-generic/pktio/pcap.c @@ -39,6 +39,7 @@ #include #include +#include #include #include @@ -249,7 +250,7 @@ static int pcapif_recv_pkt(pktio_entry_t *pktio_entry, int index ODP_UNUSED, pkt_hdr = odp_packet_hdr(pkt); - if (odp_packet_copy_from_mem(pkt, 0, hdr->caplen, data) != 0) { + if (_odp_packet_copy_from_mem(pkt, 0, hdr->caplen, data) != 0) { ODP_ERR("failed to copy packet data\n"); break; } @@ -283,7 +284,7 @@ static int _pcapif_dump_pkt(pkt_pcap_t *pcap, odp_packet_t pkt) hdr.len = hdr.caplen; (void)gettimeofday(&hdr.ts, NULL); - if (odp_packet_copy_to_mem(pkt, 0, hdr.len, pcap->buf) != 0) + if (_odp_packet_copy_to_mem(pkt, 0, hdr.len, pcap->buf) != 0) return -1; pcap_dump(pcap->tx_dump, &hdr, pcap->buf); diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c index b53173d29..2ace1a597 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -243,8 +244,8 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, continue; } hdr = odp_packet_hdr(pkt_table[nb_rx]); - ret = odp_packet_copy_from_mem(pkt_table[nb_rx], 0, - pkt_len, pkt_buf); + ret = _odp_packet_copy_from_mem(pkt_table[nb_rx], 0, + pkt_len, pkt_buf); if (ret != 0) { odp_packet_free(pkt_table[nb_rx]); mmap_rx_user_ready(ppd.raw); /* drop */ @@ -345,7 +346,7 @@ static inline unsigned pkt_mmap_v2_tx(int sock, struct ring *ring, buf = (uint8_t *)ppd.raw + TPACKET2_HDRLEN - sizeof(struct sockaddr_ll); - odp_packet_copy_to_mem(pkt_table[i], 0, pkt_len, buf); + _odp_packet_copy_to_mem(pkt_table[i], 0, pkt_len, buf); mmap_tx_user_ready(ppd.raw); diff --git a/platform/linux-generic/pktio/tap.c b/platform/linux-generic/pktio/tap.c index ebd4d94be..ccfa19b25 100644 --- a/platform/linux-generic/pktio/tap.c +++ b/platform/linux-generic/pktio/tap.c @@ -42,6 +42,7 @@ #include #include +#include #include #include #include @@ -273,7 +274,7 @@ static odp_packet_t pack_odp_pkt(pktio_entry_t *pktio_entry, const void *data, if (num != 1) return ODP_PACKET_INVALID; - if (odp_packet_copy_from_mem(pkt, 0, len, data) < 0) { + if (_odp_packet_copy_from_mem(pkt, 0, len, data) < 0) { ODP_ERR("failed to copy packet data\n"); odp_packet_free(pkt); return ODP_PACKET_INVALID; @@ -352,7 +353,7 @@ static int tap_pktio_send_lockless(pktio_entry_t *pktio_entry, break; } - if (odp_packet_copy_to_mem(pkts[i], 0, pkt_len, buf) < 0) { + if (_odp_packet_copy_to_mem(pkts[i], 0, pkt_len, buf) < 0) { ODP_ERR("failed to copy packet data\n"); break; }