From patchwork Wed Jan 31 14:00:04 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: 126347 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp774856ljc; Wed, 31 Jan 2018 06:20:41 -0800 (PST) X-Google-Smtp-Source: AH8x227PsDtxmqd6HfVk4+VTC2Gk6PEEpY/aCZcn4MJjGoCsTPe/Rs7DBCLaHMBy+GP2VqqZKA/h X-Received: by 10.200.54.208 with SMTP id b16mr53033954qtc.187.1517408441845; Wed, 31 Jan 2018 06:20:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517408441; cv=none; d=google.com; s=arc-20160816; b=e/FUoZeSLLo6uBE393LhZnmmHvigzWcYLYUambmPTOKTRWibg6hCE1kKimozXeBYNJ Jgu8ka6fjJM0MmlVXiWdu4t2Rv0slf7w3cEsXhHymNhZoK/JfPsYhOwGONZr2/0z6xr2 lCuZx0+rZhukSt1ygX2vTJTl08NNQNCwivGhG10qhSeFYDzSq67vecroGJC45IwYs6JL 0FbOyczSiK8r6B9AgwsioY2bG9NFbBL2MrUntbtpnYkI3lW/Zb2unf2k6WGIsrgjMGVi /PHt89dTcyGXz9MD509Rc6M42dwx6XiivNJjtDyJvU7YlZCO/Mz1QZ7+O91ZstFabjC1 AIog== 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=dp/rZM1WgJ6kHv3YEQd2z3t5JbRVPpmzy29ka28zgok=; b=GN5B0ichQYM94YoUqCWdiI4j3yOU0WooHCj7HdYjv7fpX6TBUtnCefdRZVhk8FGuYn DE2H4t2GgaOClfJHF6qH4kEmkdxMjuQXxO5y7a17FFDdao6oqa8DW9ZFNHWObZBp/MXk AQI+VXHhDV07k75evmTNofL58FZyI9gMFSNd+53MPNaxgwiZWm1GeknNAARMGykiW0Lh NbPxBnUfMES06Wwsl+5v4iMAapONp2NdNb3uceI6Vr1kyWH0iOPXfy02RpGT8bcm0/HG EYcRpHbZBLGHCQRJfI/vcci8dI8kK3peozSh5onXMxREu8Su6q04k3P4XjVfn+nYQ3kQ o2pA== 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 h199si2046077qke.456.2018.01.31.06.20.41; Wed, 31 Jan 2018 06:20:41 -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 6D20B617D6; Wed, 31 Jan 2018 14:20:41 +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 99F26617C3; Wed, 31 Jan 2018 14:05:21 +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 076BC60813; Wed, 31 Jan 2018 14:05:17 +0000 (UTC) Received: from forward105j.mail.yandex.net (forward105j.mail.yandex.net [5.45.198.248]) by lists.linaro.org (Postfix) with ESMTPS id 0A6C0617C6 for ; Wed, 31 Jan 2018 14:01:14 +0000 (UTC) Received: from mxback5o.mail.yandex.net (mxback5o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1f]) by forward105j.mail.yandex.net (Yandex) with ESMTP id B413C18639B for ; Wed, 31 Jan 2018 17:00:15 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback5o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id QyMFTbP6k6-0FRWV15D; Wed, 31 Jan 2018 17:00:15 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id nmVaH0g7bK-0FVWLKmA; Wed, 31 Jan 2018 17:00:15 +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: Wed, 31 Jan 2018 17:00:04 +0300 Message-Id: <1517407211-19105-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517407211-19105-1-git-send-email-odpbot@yandex.ru> References: <1517407211-19105-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 437 Subject: [lng-odp] [PATCH v2 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: 3c2134ecc18e4fd52cd526b5c067815ca73864cc **/ 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; }