From patchwork Wed Dec 3 16:53:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 41863 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A50BB25E66 for ; Wed, 3 Dec 2014 16:53:35 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id ex7sf10013708wid.3 for ; Wed, 03 Dec 2014 08:53:35 -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:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=E1Pl9pnO0UgGgG9VLikdaaJQZ/2Aa+m5W1QNfrviu30=; b=GPIxeQEMvXX4sfFe7GGtgGNOH/flvISEOaNg3KGq4pWAWufuGrjPbI3vmCaVLfXgOY zXSmBCOSbYa7fbi3xywO9Aa/8P0Zm+npGtP8quWbOkuKo6SbDSz8qTYDFzJuY07Gtrrs xiLKoCJO1cYuzMvsLG8R7+7HZ/T2BXeDXI9/vMo/Gw3Idacgh/KeEFjFfhG99+OGcSIZ KAiV23PgHXBjqS8ub+yZUWZFZQthxbyW6tqeinZvk3rocyl0JHyOb7ezisJ31VbliBLE jpei969V5Zek+NCyRS8WDa9cn/LmzcJiL9D8RC+WjwTIJDMOgUYDb7VXu9EHVT8jCSEz IZwg== X-Gm-Message-State: ALoCoQlckAYdA/mSHPz52qvpCyDhQVQnbSidObtw9T3Unk1ETFosWDe4TCijlxWMhVHVFKElnrQ5 X-Received: by 10.180.189.116 with SMTP id gh20mr2327455wic.2.1417625614963; Wed, 03 Dec 2014 08:53:34 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.45.33 with SMTP id j1ls196811lam.59.gmail; Wed, 03 Dec 2014 08:53:34 -0800 (PST) X-Received: by 10.152.164.232 with SMTP id yt8mr5168085lab.7.1417625614787; Wed, 03 Dec 2014 08:53:34 -0800 (PST) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id jc4si23468277lbc.137.2014.12.03.08.53.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Dec 2014 08:53:34 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by mail-lb0-f175.google.com with SMTP id u10so12371018lbd.20 for ; Wed, 03 Dec 2014 08:53:34 -0800 (PST) X-Received: by 10.112.235.196 with SMTP id uo4mr5099128lbc.66.1417625614641; Wed, 03 Dec 2014 08:53:34 -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 ew9csp698978lbc; Wed, 3 Dec 2014 08:53:33 -0800 (PST) X-Received: by 10.236.223.164 with SMTP id v34mr7143545yhp.27.1417625612762; Wed, 03 Dec 2014 08:53:32 -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 l108si28404514qgf.94.2014.12.03.08.53.28 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 03 Dec 2014 08:53:32 -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 1XwDB8-0002Fo-Pw; Wed, 03 Dec 2014 16:53:26 +0000 Received: from mail-la0-f41.google.com ([209.85.215.41]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XwDB1-0002Fj-Hr for lng-odp@lists.linaro.org; Wed, 03 Dec 2014 16:53:19 +0000 Received: by mail-la0-f41.google.com with SMTP id hv19so8134225lab.14 for ; Wed, 03 Dec 2014 08:53:13 -0800 (PST) X-Received: by 10.152.19.6 with SMTP id a6mr3951966lae.9.1417625593567; Wed, 03 Dec 2014 08:53:13 -0800 (PST) Received: from localhost.localdomain ([188.92.105.210]) by mx.google.com with ESMTPSA id j2sm3992204lbs.3.2014.12.03.08.53.11 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Dec 2014 08:53:12 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Wed, 3 Dec 2014 19:53:06 +0300 Message-Id: <1417625586-7146-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 X-Topics: patch Subject: [lng-odp] [PATCH] Rename packet functions 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: maxim.uvarov@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.217.175 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 Patch is based on Bills: "This patch implements the specified odp_packet_flags.h API name changes for ODP v1.0." Plus it includes renames for packet function. Signed-off-by: Maxim Uvarov Reviewed-by: Bill Fischofer --- Original Bill patch did not do change for examples. So I added it here and also did renaming as we discussed on the call. Thanks, Maxim. example/generator/odp_generator.c | 12 ++-- example/ipsec/odp_ipsec.c | 16 ++--- example/ipsec/odp_ipsec_stream.c | 12 ++-- example/packet/odp_pktio.c | 8 +-- helper/include/odph_ip.h | 4 +- helper/include/odph_udp.h | 4 +- platform/linux-generic/include/api/odp_packet.h | 18 +++--- .../linux-generic/include/api/odp_packet_flags.h | 70 +++++++++++----------- platform/linux-generic/odp_packet.c | 16 ++--- platform/linux-generic/odp_packet_flags.c | 70 +++++++++++----------- platform/linux-generic/odp_packet_socket.c | 6 +- 11 files changed, 118 insertions(+), 118 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 73b0369..aec80d8 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -190,13 +190,13 @@ static void pack_udp_pkt(odp_buffer_t obuf) pkt = odp_packet_from_buffer(obuf); /* ether */ - odp_packet_set_l2_offset(pkt, 0); + odp_packet_l2_offset_set(pkt, 0); eth = (odph_ethhdr_t *)buf; memcpy((char *)eth->src.addr, args->appl.srcmac.addr, ODPH_ETHADDR_LEN); memcpy((char *)eth->dst.addr, args->appl.dstmac.addr, ODPH_ETHADDR_LEN); eth->type = odp_cpu_to_be_16(ODPH_ETHTYPE_IPV4); /* ip */ - odp_packet_set_l3_offset(pkt, ODPH_ETHHDR_LEN); + odp_packet_l3_offset_set(pkt, ODPH_ETHHDR_LEN); ip = (odph_ipv4hdr_t *)(buf + ODPH_ETHHDR_LEN); ip->dst_addr = odp_cpu_to_be_32(args->appl.dstip); ip->src_addr = odp_cpu_to_be_32(args->appl.srcip); @@ -209,7 +209,7 @@ static void pack_udp_pkt(odp_buffer_t obuf) ip->chksum = 0; odph_ipv4_csum_update(pkt); /* udp */ - odp_packet_set_l4_offset(pkt, ODPH_ETHHDR_LEN + ODPH_IPV4HDR_LEN); + odp_packet_l4_offset_set(pkt, ODPH_ETHHDR_LEN + ODPH_IPV4HDR_LEN); udp = (odph_udphdr_t *)(buf + ODPH_ETHHDR_LEN + ODPH_IPV4HDR_LEN); udp->src_port = 0; udp->dst_port = 0; @@ -247,13 +247,13 @@ static void pack_icmp_pkt(odp_buffer_t obuf) args->appl.payload = 56; pkt = odp_packet_from_buffer(obuf); /* ether */ - odp_packet_set_l2_offset(pkt, 0); + odp_packet_l2_offset_set(pkt, 0); eth = (odph_ethhdr_t *)buf; memcpy((char *)eth->src.addr, args->appl.srcmac.addr, ODPH_ETHADDR_LEN); memcpy((char *)eth->dst.addr, args->appl.dstmac.addr, ODPH_ETHADDR_LEN); eth->type = odp_cpu_to_be_16(ODPH_ETHTYPE_IPV4); /* ip */ - odp_packet_set_l3_offset(pkt, ODPH_ETHHDR_LEN); + odp_packet_l3_offset_set(pkt, ODPH_ETHHDR_LEN); ip = (odph_ipv4hdr_t *)(buf + ODPH_ETHHDR_LEN); ip->dst_addr = odp_cpu_to_be_32(args->appl.dstip); ip->src_addr = odp_cpu_to_be_32(args->appl.srcip); @@ -401,7 +401,7 @@ static void print_pkts(int thr, odp_packet_t pkt_tbl[], unsigned len) rlen = 0; /* only ip pkts */ - if (!odp_packet_inflag_ipv4(pkt)) + if (!odp_packet_ipv4(pkt)) continue; odp_atomic_inc_u64(&counters.ip); diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 76d27c5..9076918 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -625,10 +625,10 @@ pkt_disposition_e do_input_verify(odp_packet_t pkt, if (odp_unlikely(odp_packet_error(pkt))) return PKT_DROP; - if (!odp_packet_inflag_eth(pkt)) + if (!odp_packet_eth(pkt)) return PKT_DROP; - if (!odp_packet_inflag_ipv4(pkt)) + if (!odp_packet_ipv4(pkt)) return PKT_DROP; return PKT_CONTINUE; @@ -645,13 +645,13 @@ pkt_disposition_e do_input_verify(odp_packet_t pkt, static pkt_disposition_e do_route_fwd_db(odp_packet_t pkt, pkt_ctx_t *ctx) { - odph_ipv4hdr_t *ip = (odph_ipv4hdr_t *)odp_packet_l3(pkt); + odph_ipv4hdr_t *ip = (odph_ipv4hdr_t *)odp_packet_l3_addr(pkt); fwd_db_entry_t *entry; entry = find_fwd_db_entry(odp_be_to_cpu_32(ip->dst_addr)); if (entry) { - odph_ethhdr_t *eth = (odph_ethhdr_t *)odp_packet_l2(pkt); + odph_ethhdr_t *eth = (odph_ethhdr_t *)odp_packet_l2_addr(pkt); memcpy(ð->dst, entry->dst_mac, ODPH_ETHADDR_LEN); memcpy(ð->src, entry->src_mac, ODPH_ETHADDR_LEN); @@ -682,7 +682,7 @@ pkt_disposition_e do_ipsec_in_classify(odp_packet_t pkt, bool *skip) { uint8_t *buf = odp_packet_addr(pkt); - odph_ipv4hdr_t *ip = (odph_ipv4hdr_t *)odp_packet_l3(pkt); + odph_ipv4hdr_t *ip = (odph_ipv4hdr_t *)odp_packet_l3_addr(pkt); int hdr_len; odph_ahhdr_t *ah = NULL; odph_esphdr_t *esp = NULL; @@ -777,7 +777,7 @@ pkt_disposition_e do_ipsec_in_finish(odp_packet_t pkt, return PKT_DROP; if (!is_crypto_compl_status_ok(&auth_rc)) return PKT_DROP; - ip = (odph_ipv4hdr_t *)odp_packet_l3(pkt); + ip = (odph_ipv4hdr_t *)odp_packet_l3_addr(pkt); /* * Finish auth @@ -842,7 +842,7 @@ pkt_disposition_e do_ipsec_out_classify(odp_packet_t pkt, bool *skip) { uint8_t *buf = odp_packet_addr(pkt); - odph_ipv4hdr_t *ip = (odph_ipv4hdr_t *)odp_packet_l3(pkt); + odph_ipv4hdr_t *ip = (odph_ipv4hdr_t *)odp_packet_l3_addr(pkt); uint16_t ip_data_len = ipv4_data_len(ip); uint8_t *ip_data = ipv4_data_p(ip); ipsec_cache_entry_t *entry; @@ -1009,7 +1009,7 @@ pkt_disposition_e do_ipsec_out_finish(odp_packet_t pkt, return PKT_DROP; if (!is_crypto_compl_status_ok(&auth_rc)) return PKT_DROP; - ip = (odph_ipv4hdr_t *)odp_packet_l3(pkt); + ip = (odph_ipv4hdr_t *)odp_packet_l3_addr(pkt); /* Finalize the IPv4 header */ ip->ttl = ctx->ipsec.ip_ttl; diff --git a/example/ipsec/odp_ipsec_stream.c b/example/ipsec/odp_ipsec_stream.c index 139d00e..4322bd8 100644 --- a/example/ipsec/odp_ipsec_stream.c +++ b/example/ipsec/odp_ipsec_stream.c @@ -198,8 +198,8 @@ odp_packet_t create_ipv4_packet(stream_db_entry_t *stream, data = odp_packet_data(pkt); /* Ethernet */ - odp_packet_set_inflag_eth(pkt, 1); - odp_packet_set_l2_offset(pkt, data - base); + odp_packet_eth_set(pkt, 1); + odp_packet_l2_offset_set(pkt, data - base); eth = (odph_ethhdr_t *)data; data += sizeof(*eth); @@ -208,11 +208,11 @@ odp_packet_t create_ipv4_packet(stream_db_entry_t *stream, eth->type = odp_cpu_to_be_16(ODPH_ETHTYPE_IPV4); /* IPv4 */ - odp_packet_set_inflag_ipv4(pkt, 1); - odp_packet_set_l3_offset(pkt, data - base); + odp_packet_ipv4_set(pkt, 1); + odp_packet_l3_offset_set(pkt, data - base); ip = (odph_ipv4hdr_t *)data; data += sizeof(*ip); - odp_packet_set_l4_offset(pkt, data - base); + odp_packet_l4_offset_set(pkt, data - base); /* Wait until almost finished to fill in mutable fields */ memset((char *)ip, 0, sizeof(*ip)); @@ -349,7 +349,7 @@ bool verify_ipv4_packet(stream_db_entry_t *stream, stream_pkt_hdr_t *test; /* Basic IPv4 verify (add checksum verification) */ - data = odp_packet_l3(pkt); + data = odp_packet_l3_addr(pkt); ip = (odph_ipv4hdr_t *)data; data += sizeof(*ip); if (0x45 != ip->ver_ihl) diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index 1763c84..d256a63 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -495,16 +495,16 @@ static void swap_pkt_addrs(odp_packet_t pkt_tbl[], unsigned len) for (i = 0; i < len; ++i) { pkt = pkt_tbl[i]; - if (odp_packet_inflag_eth(pkt)) { - eth = (odph_ethhdr_t *)odp_packet_l2(pkt); + if (odp_packet_eth(pkt)) { + eth = (odph_ethhdr_t *)odp_packet_l2_addr(pkt); tmp_addr = eth->dst; eth->dst = eth->src; eth->src = tmp_addr; - if (odp_packet_inflag_ipv4(pkt)) { + if (odp_packet_ipv4(pkt)) { /* IPv4 */ - ip = (odph_ipv4hdr_t *)odp_packet_l3(pkt); + ip = (odph_ipv4hdr_t *)odp_packet_l3_addr(pkt); ip_tmp_addr = ip->src_addr; ip->src_addr = ip->dst_addr; diff --git a/helper/include/odph_ip.h b/helper/include/odph_ip.h index 2c83c0f..2aaa73b 100644 --- a/helper/include/odph_ip.h +++ b/helper/include/odph_ip.h @@ -82,7 +82,7 @@ static inline int odph_ipv4_csum_valid(odp_packet_t pkt) if (!odp_packet_l3_offset(pkt)) return 0; - memcpy(&ip, odp_packet_l3(pkt), sizeof(odph_ipv4hdr_t)); + memcpy(&ip, odp_packet_l3_addr(pkt), sizeof(odph_ipv4hdr_t)); w = (uint16_t *)(void *)&ip; chksum = ip.chksum; ip.chksum = 0x0; @@ -110,7 +110,7 @@ static inline uint16sum_t odph_ipv4_csum_update(odp_packet_t pkt) if (!odp_packet_l3_offset(pkt)) return 0; - ip = (odph_ipv4hdr_t *)odp_packet_l3(pkt); + ip = (odph_ipv4hdr_t *)odp_packet_l3_addr(pkt); w = (uint16_t *)(void *)ip; ip->chksum = odp_chksum(w, nleft); return ip->chksum; diff --git a/helper/include/odph_udp.h b/helper/include/odph_udp.h index b2eaf03..aacd99b 100644 --- a/helper/include/odph_udp.h +++ b/helper/include/odph_udp.h @@ -64,8 +64,8 @@ static inline uint16_t odph_ipv4_udp_chksum(odp_packet_t pkt) if (!odp_packet_l4_offset(pkt)) return 0; - iph = (odph_ipv4hdr_t *)odp_packet_l3(pkt); - udph = (odph_udphdr_t *)odp_packet_l4(pkt); + iph = (odph_ipv4hdr_t *)odp_packet_l3_addr(pkt); + udph = (odph_udphdr_t *)odp_packet_l4_addr(pkt); udplen = odp_be_to_cpu_16(udph->length); /* the source ip */ diff --git a/platform/linux-generic/include/api/odp_packet.h b/platform/linux-generic/include/api/odp_packet.h index 5298fa0..8ab069f 100644 --- a/platform/linux-generic/include/api/odp_packet.h +++ b/platform/linux-generic/include/api/odp_packet.h @@ -97,14 +97,14 @@ void *odp_packet_get_ctx(odp_packet_t buf); * frame, the protocol header may start 2 or 6 bytes within the buffer to * ensure 32 or 64-bit alignment of the IP header. * - * Use odp_packet_l2(pkt) to get the start address of a received valid frame + * Use odp_packet_l2_addr(pkt) to get the start address of a received valid frame * or odp_packet_data(pkt) to get the current packet data address. * * @param pkt Packet handle * * @return Pointer to the start of the packet buffer * - * @see odp_packet_l2(), odp_packet_data() + * @see odp_packet_l2_addr(), odp_packet_data() */ uint8_t *odp_packet_addr(odp_packet_t pkt); @@ -118,7 +118,7 @@ uint8_t *odp_packet_addr(odp_packet_t pkt); * * @return Pointer to the packet data * - * @see odp_packet_l2(), odp_packet_addr() + * @see odp_packet_l2_addr(), odp_packet_addr() */ uint8_t *odp_packet_data(odp_packet_t pkt); @@ -134,7 +134,7 @@ uint8_t *odp_packet_data(odp_packet_t pkt); * * @see odp_packet_addr(), odp_packet_data() */ -uint8_t *odp_packet_l2(odp_packet_t pkt); +uint8_t *odp_packet_l2_addr(odp_packet_t pkt); /** * Return the byte offset from the packet buffer to the L2 frame @@ -151,7 +151,7 @@ size_t odp_packet_l2_offset(odp_packet_t pkt); * @param pkt Packet handle * @param offset L2 byte offset */ -void odp_packet_set_l2_offset(odp_packet_t pkt, size_t offset); +void odp_packet_l2_offset_set(odp_packet_t pkt, size_t offset); /** @@ -162,7 +162,7 @@ void odp_packet_set_l2_offset(odp_packet_t pkt, size_t offset); * @return Pointer to L3 packet or NULL if not found * */ -uint8_t *odp_packet_l3(odp_packet_t pkt); +uint8_t *odp_packet_l3_addr(odp_packet_t pkt); /** * Return the byte offset from the packet buffer to the L3 packet @@ -179,7 +179,7 @@ size_t odp_packet_l3_offset(odp_packet_t pkt); * @param pkt Packet handle * @param offset L3 byte offset */ -void odp_packet_set_l3_offset(odp_packet_t pkt, size_t offset); +void odp_packet_l3_offset_set(odp_packet_t pkt, size_t offset); /** @@ -190,7 +190,7 @@ void odp_packet_set_l3_offset(odp_packet_t pkt, size_t offset); * @return Pointer to L4 packet or NULL if not found * */ -uint8_t *odp_packet_l4(odp_packet_t pkt); +uint8_t *odp_packet_l4_addr(odp_packet_t pkt); /** * Return the byte offset from the packet buffer to the L4 packet @@ -207,7 +207,7 @@ size_t odp_packet_l4_offset(odp_packet_t pkt); * @param pkt Packet handle * @param offset L4 byte offset */ -void odp_packet_set_l4_offset(odp_packet_t pkt, size_t offset); +void odp_packet_l4_offset_set(odp_packet_t pkt, size_t offset); /** * Print (debug) information about the packet diff --git a/platform/linux-generic/include/api/odp_packet_flags.h b/platform/linux-generic/include/api/odp_packet_flags.h index ccaa04f..2ea4f7c 100644 --- a/platform/linux-generic/include/api/odp_packet_flags.h +++ b/platform/linux-generic/include/api/odp_packet_flags.h @@ -50,7 +50,7 @@ int odp_packet_errflag_frame_len(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains a valid & known L2 header, 0 otherwise */ -int odp_packet_inflag_l2(odp_packet_t pkt); +int odp_packet_l2(odp_packet_t pkt); /** * Check for L3 header, e.g. IPv4, IPv6 @@ -58,7 +58,7 @@ int odp_packet_inflag_l2(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains a valid & known L3 header, 0 otherwise */ -int odp_packet_inflag_l3(odp_packet_t pkt); +int odp_packet_l3(odp_packet_t pkt); /** * Check for L4 header, e.g. UDP, TCP, SCTP (also ICMP) @@ -66,7 +66,7 @@ int odp_packet_inflag_l3(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains a valid & known L4 header, 0 otherwise */ -int odp_packet_inflag_l4(odp_packet_t pkt); +int odp_packet_l4(odp_packet_t pkt); /** * Check for Ethernet header @@ -74,7 +74,7 @@ int odp_packet_inflag_l4(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains a valid eth header, 0 otherwise */ -int odp_packet_inflag_eth(odp_packet_t pkt); +int odp_packet_eth(odp_packet_t pkt); /** * Check for jumbo frame @@ -82,7 +82,7 @@ int odp_packet_inflag_eth(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains jumbo frame, 0 otherwise */ -int odp_packet_inflag_jumbo(odp_packet_t pkt); +int odp_packet_jumbo(odp_packet_t pkt); /** * Check for VLAN @@ -90,7 +90,7 @@ int odp_packet_inflag_jumbo(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains a VLAN header, 0 otherwise */ -int odp_packet_inflag_vlan(odp_packet_t pkt); +int odp_packet_vlan(odp_packet_t pkt); /** * Check for VLAN QinQ (stacked VLAN) @@ -98,7 +98,7 @@ int odp_packet_inflag_vlan(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains a VLAN QinQ header, 0 otherwise */ -int odp_packet_inflag_vlan_qinq(odp_packet_t pkt); +int odp_packet_vlan_qinq(odp_packet_t pkt); /** * Check for ARP @@ -106,7 +106,7 @@ int odp_packet_inflag_vlan_qinq(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains an ARP header, 0 otherwise */ -int odp_packet_inflag_arp(odp_packet_t pkt); +int odp_packet_arp(odp_packet_t pkt); /** * Check for IPv4 @@ -114,7 +114,7 @@ int odp_packet_inflag_arp(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains an IPv4 header, 0 otherwise */ -int odp_packet_inflag_ipv4(odp_packet_t pkt); +int odp_packet_ipv4(odp_packet_t pkt); /** * Check for IPv6 @@ -122,7 +122,7 @@ int odp_packet_inflag_ipv4(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains an IPv6 header, 0 otherwise */ -int odp_packet_inflag_ipv6(odp_packet_t pkt); +int odp_packet_ipv6(odp_packet_t pkt); /** * Check for IP fragment @@ -130,7 +130,7 @@ int odp_packet_inflag_ipv6(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet is an IP fragment, 0 otherwise */ -int odp_packet_inflag_ipfrag(odp_packet_t pkt); +int odp_packet_ipfrag(odp_packet_t pkt); /** * Check for IP options @@ -138,7 +138,7 @@ int odp_packet_inflag_ipfrag(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains IP options, 0 otherwise */ -int odp_packet_inflag_ipopt(odp_packet_t pkt); +int odp_packet_ipopt(odp_packet_t pkt); /** * Check for IPSec @@ -146,7 +146,7 @@ int odp_packet_inflag_ipopt(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet requires IPSec processing, 0 otherwise */ -int odp_packet_inflag_ipsec(odp_packet_t pkt); +int odp_packet_ipsec(odp_packet_t pkt); /** * Check for UDP @@ -154,7 +154,7 @@ int odp_packet_inflag_ipsec(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains a UDP header, 0 otherwise */ -int odp_packet_inflag_udp(odp_packet_t pkt); +int odp_packet_udp(odp_packet_t pkt); /** * Check for TCP @@ -162,7 +162,7 @@ int odp_packet_inflag_udp(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains a TCP header, 0 otherwise */ -int odp_packet_inflag_tcp(odp_packet_t pkt); +int odp_packet_tcp(odp_packet_t pkt); /** * Check for SCTP @@ -170,7 +170,7 @@ int odp_packet_inflag_tcp(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains an SCTP header, 0 otherwise */ -int odp_packet_inflag_sctp(odp_packet_t pkt); +int odp_packet_sctp(odp_packet_t pkt); /** * Check for ICMP @@ -178,14 +178,14 @@ int odp_packet_inflag_sctp(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains an ICMP header, 0 otherwise */ -int odp_packet_inflag_icmp(odp_packet_t pkt); +int odp_packet_icmp(odp_packet_t pkt); /** * Request L4 checksum calculation * * @param pkt Packet handle */ -void odp_packet_outflag_l4_chksum(odp_packet_t pkt); +void odp_packet_override_l4_chksum(odp_packet_t pkt); /** * Set flag for L2 header, e.g. ethernet @@ -193,7 +193,7 @@ void odp_packet_outflag_l4_chksum(odp_packet_t pkt); * @param pkt Packet handle * @param val Value */ -void odp_packet_set_inflag_l2(odp_packet_t pkt, int val); +void odp_packet_l2_set(odp_packet_t pkt, int val); /** * Set flag for L3 header, e.g. IPv4, IPv6 @@ -201,7 +201,7 @@ void odp_packet_set_inflag_l2(odp_packet_t pkt, int val); * @param pkt Packet handle * @param val Value */ -void odp_packet_set_inflag_l3(odp_packet_t pkt, int val); +void odp_packet_l3_set(odp_packet_t pkt, int val); /** * Set flag for L4 header, e.g. UDP, TCP, SCTP (also ICMP) @@ -209,7 +209,7 @@ void odp_packet_set_inflag_l3(odp_packet_t pkt, int val); * @param pkt Packet handle * @param val Value */ -void odp_packet_set_inflag_l4(odp_packet_t pkt, int val); +void odp_packet_l4_set(odp_packet_t pkt, int val); /** * Set flag for Ethernet header @@ -217,7 +217,7 @@ void odp_packet_set_inflag_l4(odp_packet_t pkt, int val); * @param pkt Packet handle * @param val Value */ -void odp_packet_set_inflag_eth(odp_packet_t pkt, int val); +void odp_packet_eth_set(odp_packet_t pkt, int val); /** * Set flag for jumbo frame @@ -225,7 +225,7 @@ void odp_packet_set_inflag_eth(odp_packet_t pkt, int val); * @param pkt Packet handle * @param val Value */ -void odp_packet_set_inflag_jumbo(odp_packet_t pkt, int val); +void odp_packet_jumbo_set(odp_packet_t pkt, int val); /** * Set flag for VLAN @@ -233,7 +233,7 @@ void odp_packet_set_inflag_jumbo(odp_packet_t pkt, int val); * @param pkt Packet handle * @param val Value */ -void odp_packet_set_inflag_vlan(odp_packet_t pkt, int val); +void odp_packet_vlan_set(odp_packet_t pkt, int val); /** * Set flag for VLAN QinQ (stacked VLAN) @@ -241,7 +241,7 @@ void odp_packet_set_inflag_vlan(odp_packet_t pkt, int val); * @param pkt Packet handle * @param val Value */ -void odp_packet_set_inflag_vlan_qinq(odp_packet_t pkt, int val); +void odp_packet_vlan_qinq_set(odp_packet_t pkt, int val); /** * Set flag for ARP @@ -249,7 +249,7 @@ void odp_packet_set_inflag_vlan_qinq(odp_packet_t pkt, int val); * @param pkt Packet handle * @param val Value */ -void odp_packet_set_inflag_arp(odp_packet_t pkt, int val); +void odp_packet_arp_set(odp_packet_t pkt, int val); /** * Set flag for IPv4 @@ -257,7 +257,7 @@ void odp_packet_set_inflag_arp(odp_packet_t pkt, int val); * @param pkt Packet handle * @param val Value */ -void odp_packet_set_inflag_ipv4(odp_packet_t pkt, int val); +void odp_packet_ipv4_set(odp_packet_t pkt, int val); /** * Set flag for IPv6 @@ -265,7 +265,7 @@ void odp_packet_set_inflag_ipv4(odp_packet_t pkt, int val); * @param pkt Packet handle * @param val Value */ -void odp_packet_set_inflag_ipv6(odp_packet_t pkt, int val); +void odp_packet_ipv6_set(odp_packet_t pkt, int val); /** * Set flag for IP fragment @@ -273,7 +273,7 @@ void odp_packet_set_inflag_ipv6(odp_packet_t pkt, int val); * @param pkt Packet handle * @param val Value */ -void odp_packet_set_inflag_ipfrag(odp_packet_t pkt, int val); +void odp_packet_ipfrag_set(odp_packet_t pkt, int val); /** * Set flag for IP options @@ -281,7 +281,7 @@ void odp_packet_set_inflag_ipfrag(odp_packet_t pkt, int val); * @param pkt Packet handle * @param val Value */ -void odp_packet_set_inflag_ipopt(odp_packet_t pkt, int val); +void odp_packet_ipopt_set(odp_packet_t pkt, int val); /** * Set flag for IPSec @@ -289,7 +289,7 @@ void odp_packet_set_inflag_ipopt(odp_packet_t pkt, int val); * @param pkt Packet handle * @param val Value */ -void odp_packet_set_inflag_ipsec(odp_packet_t pkt, int val); +void odp_packet_ipsec_set(odp_packet_t pkt, int val); /** * Set flag for UDP @@ -297,7 +297,7 @@ void odp_packet_set_inflag_ipsec(odp_packet_t pkt, int val); * @param pkt Packet handle * @param val Value */ -void odp_packet_set_inflag_udp(odp_packet_t pkt, int val); +void odp_packet_udp_set(odp_packet_t pkt, int val); /** * Set flag for TCP @@ -305,7 +305,7 @@ void odp_packet_set_inflag_udp(odp_packet_t pkt, int val); * @param pkt Packet handle * @param val Value */ -void odp_packet_set_inflag_tcp(odp_packet_t pkt, int val); +void odp_packet_tcp_set(odp_packet_t pkt, int val); /** * Set flag for SCTP @@ -313,7 +313,7 @@ void odp_packet_set_inflag_tcp(odp_packet_t pkt, int val); * @param pkt Packet handle * @param val Value */ -void odp_packet_set_inflag_sctp(odp_packet_t pkt, int val); +void odp_packet_sctp_set(odp_packet_t pkt, int val); /** * Set flag for ICMP @@ -321,7 +321,7 @@ void odp_packet_set_inflag_sctp(odp_packet_t pkt, int val); * @param pkt Packet handle * @param val Value */ -void odp_packet_set_inflag_icmp(odp_packet_t pkt, int val); +void odp_packet_icmp_set(odp_packet_t pkt, int val); /** * @} diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index f8fd8ef..46af243 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -67,7 +67,7 @@ uint8_t *odp_packet_data(odp_packet_t pkt) } -uint8_t *odp_packet_l2(odp_packet_t pkt) +uint8_t *odp_packet_l2_addr(odp_packet_t pkt) { const size_t offset = odp_packet_l2_offset(pkt); @@ -82,12 +82,12 @@ size_t odp_packet_l2_offset(odp_packet_t pkt) return odp_packet_hdr(pkt)->l2_offset; } -void odp_packet_set_l2_offset(odp_packet_t pkt, size_t offset) +void odp_packet_l2_offset_set(odp_packet_t pkt, size_t offset) { odp_packet_hdr(pkt)->l2_offset = offset; } -uint8_t *odp_packet_l3(odp_packet_t pkt) +uint8_t *odp_packet_l3_addr(odp_packet_t pkt) { const size_t offset = odp_packet_l3_offset(pkt); @@ -102,12 +102,12 @@ size_t odp_packet_l3_offset(odp_packet_t pkt) return odp_packet_hdr(pkt)->l3_offset; } -void odp_packet_set_l3_offset(odp_packet_t pkt, size_t offset) +void odp_packet_l3_offset_set(odp_packet_t pkt, size_t offset) { odp_packet_hdr(pkt)->l3_offset = offset; } -uint8_t *odp_packet_l4(odp_packet_t pkt) +uint8_t *odp_packet_l4_addr(odp_packet_t pkt) { const size_t offset = odp_packet_l4_offset(pkt); @@ -122,7 +122,7 @@ size_t odp_packet_l4_offset(odp_packet_t pkt) return odp_packet_hdr(pkt)->l4_offset; } -void odp_packet_set_l4_offset(odp_packet_t pkt, size_t offset) +void odp_packet_l4_offset_set(odp_packet_t pkt, size_t offset) { odp_packet_hdr(pkt)->l4_offset = offset; } @@ -202,14 +202,14 @@ void odp_packet_parse(odp_packet_t pkt, size_t len, size_t frame_offset) pkt_hdr->input_flags.ipv4 = 1; pkt_hdr->input_flags.l3 = 1; pkt_hdr->l3_offset = frame_offset + ODPH_ETHHDR_LEN + offset; - ipv4 = (odph_ipv4hdr_t *)odp_packet_l3(pkt); + ipv4 = (odph_ipv4hdr_t *)odp_packet_l3_addr(pkt); ip_proto = parse_ipv4(pkt_hdr, ipv4, &offset); break; case ODPH_ETHTYPE_IPV6: pkt_hdr->input_flags.ipv6 = 1; pkt_hdr->input_flags.l3 = 1; pkt_hdr->l3_offset = frame_offset + ODPH_ETHHDR_LEN + offset; - ipv6 = (odph_ipv6hdr_t *)odp_packet_l3(pkt); + ipv6 = (odph_ipv6hdr_t *)odp_packet_l3_addr(pkt); ip_proto = parse_ipv6(pkt_hdr, ipv6, &offset); break; case ODPH_ETHTYPE_ARP: diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c index 06fdeed..391616c 100644 --- a/platform/linux-generic/odp_packet_flags.c +++ b/platform/linux-generic/odp_packet_flags.c @@ -22,181 +22,181 @@ int odp_packet_errflag_frame_len(odp_packet_t pkt) /* Get Input Flags */ -int odp_packet_inflag_l2(odp_packet_t pkt) +int odp_packet_l2(odp_packet_t pkt) { return odp_packet_hdr(pkt)->input_flags.l2; } -int odp_packet_inflag_l3(odp_packet_t pkt) +int odp_packet_l3(odp_packet_t pkt) { return odp_packet_hdr(pkt)->input_flags.l3; } -int odp_packet_inflag_l4(odp_packet_t pkt) +int odp_packet_l4(odp_packet_t pkt) { return odp_packet_hdr(pkt)->input_flags.l4; } -int odp_packet_inflag_eth(odp_packet_t pkt) +int odp_packet_eth(odp_packet_t pkt) { return odp_packet_hdr(pkt)->input_flags.eth; } -int odp_packet_inflag_jumbo(odp_packet_t pkt) +int odp_packet_jumbo(odp_packet_t pkt) { return odp_packet_hdr(pkt)->input_flags.jumbo; } -int odp_packet_inflag_vlan(odp_packet_t pkt) +int odp_packet_vlan(odp_packet_t pkt) { return odp_packet_hdr(pkt)->input_flags.vlan; } -int odp_packet_inflag_vlan_qinq(odp_packet_t pkt) +int odp_packet_vlan_qinq(odp_packet_t pkt) { return odp_packet_hdr(pkt)->input_flags.vlan_qinq; } -int odp_packet_inflag_arp(odp_packet_t pkt) +int odp_packet_arp(odp_packet_t pkt) { return odp_packet_hdr(pkt)->input_flags.arp; } -int odp_packet_inflag_ipv4(odp_packet_t pkt) +int odp_packet_ipv4(odp_packet_t pkt) { return odp_packet_hdr(pkt)->input_flags.ipv4; } -int odp_packet_inflag_ipv6(odp_packet_t pkt) +int odp_packet_ipv6(odp_packet_t pkt) { return odp_packet_hdr(pkt)->input_flags.ipv6; } -int odp_packet_inflag_ipfrag(odp_packet_t pkt) +int odp_packet_ipfrag(odp_packet_t pkt) { return odp_packet_hdr(pkt)->input_flags.ipfrag; } -int odp_packet_inflag_ipopt(odp_packet_t pkt) +int odp_packet_ipopt(odp_packet_t pkt) { return odp_packet_hdr(pkt)->input_flags.ipopt; } -int odp_packet_inflag_ipsec(odp_packet_t pkt) +int odp_packet_ipsec(odp_packet_t pkt) { return odp_packet_hdr(pkt)->input_flags.ipsec; } -int odp_packet_inflag_udp(odp_packet_t pkt) +int odp_packet_udp(odp_packet_t pkt) { return odp_packet_hdr(pkt)->input_flags.udp; } -int odp_packet_inflag_tcp(odp_packet_t pkt) +int odp_packet_tcp(odp_packet_t pkt) { return odp_packet_hdr(pkt)->input_flags.tcp; } -int odp_packet_inflag_sctp(odp_packet_t pkt) +int odp_packet_sctp(odp_packet_t pkt) { return odp_packet_hdr(pkt)->input_flags.sctp; } -int odp_packet_inflag_icmp(odp_packet_t pkt) +int odp_packet_icmp(odp_packet_t pkt) { return odp_packet_hdr(pkt)->input_flags.icmp; } /* Set Output Flags */ -void odp_packet_outflag_l4_chksum(odp_packet_t pkt) +void odp_packet_override_l4_chksum(odp_packet_t pkt) { odp_packet_hdr(pkt)->output_flags.l4_chksum = 1; } /* Set Input Flags */ -void odp_packet_set_inflag_l2(odp_packet_t pkt, int val) +void odp_packet_l2_set(odp_packet_t pkt, int val) { odp_packet_hdr(pkt)->input_flags.l2 = val; } -void odp_packet_set_inflag_l3(odp_packet_t pkt, int val) +void odp_packet_l3_set(odp_packet_t pkt, int val) { odp_packet_hdr(pkt)->input_flags.l3 = val; } -void odp_packet_set_inflag_l4(odp_packet_t pkt, int val) +void odp_packet_l4_set(odp_packet_t pkt, int val) { odp_packet_hdr(pkt)->input_flags.l4 = val; } -void odp_packet_set_inflag_eth(odp_packet_t pkt, int val) +void odp_packet_eth_set(odp_packet_t pkt, int val) { odp_packet_hdr(pkt)->input_flags.eth = val; } -void odp_packet_set_inflag_jumbo(odp_packet_t pkt, int val) +void odp_packet_jumbo_set(odp_packet_t pkt, int val) { odp_packet_hdr(pkt)->input_flags.jumbo = val; } -void odp_packet_set_inflag_vlan(odp_packet_t pkt, int val) +void odp_packet_vlan_set(odp_packet_t pkt, int val) { odp_packet_hdr(pkt)->input_flags.vlan = val; } -void odp_packet_set_inflag_vlan_qinq(odp_packet_t pkt, int val) +void odp_packet_vlan_qinq_set(odp_packet_t pkt, int val) { odp_packet_hdr(pkt)->input_flags.vlan_qinq = val; } -void odp_packet_set_inflag_arp(odp_packet_t pkt, int val) +void odp_packet_arp_set(odp_packet_t pkt, int val) { odp_packet_hdr(pkt)->input_flags.arp = val; } -void odp_packet_set_inflag_ipv4(odp_packet_t pkt, int val) +void odp_packet_ipv4_set(odp_packet_t pkt, int val) { odp_packet_hdr(pkt)->input_flags.ipv4 = val; } -void odp_packet_set_inflag_ipv6(odp_packet_t pkt, int val) +void odp_packet_ipv6_set(odp_packet_t pkt, int val) { odp_packet_hdr(pkt)->input_flags.ipv6 = val; } -void odp_packet_set_inflag_ipfrag(odp_packet_t pkt, int val) +void odp_packet_ipfrag_set(odp_packet_t pkt, int val) { odp_packet_hdr(pkt)->input_flags.ipfrag = val; } -void odp_packet_set_inflag_ipopt(odp_packet_t pkt, int val) +void odp_packet_ipopt_set(odp_packet_t pkt, int val) { odp_packet_hdr(pkt)->input_flags.ipopt = val; } -void odp_packet_set_inflag_ipsec(odp_packet_t pkt, int val) +void odp_packet_ipsec_set(odp_packet_t pkt, int val) { odp_packet_hdr(pkt)->input_flags.ipsec = val; } -void odp_packet_set_inflag_udp(odp_packet_t pkt, int val) +void odp_packet_udp_set(odp_packet_t pkt, int val) { odp_packet_hdr(pkt)->input_flags.udp = val; } -void odp_packet_set_inflag_tcp(odp_packet_t pkt, int val) +void odp_packet_tcp_set(odp_packet_t pkt, int val) { odp_packet_hdr(pkt)->input_flags.tcp = val; } -void odp_packet_set_inflag_sctp(odp_packet_t pkt, int val) +void odp_packet_sctp_set(odp_packet_t pkt, int val) { odp_packet_hdr(pkt)->input_flags.sctp = val; } -void odp_packet_set_inflag_icmp(odp_packet_t pkt, int val) +void odp_packet_icmp_set(odp_packet_t pkt, int val) { odp_packet_hdr(pkt)->input_flags.icmp = val; } diff --git a/platform/linux-generic/odp_packet_socket.c b/platform/linux-generic/odp_packet_socket.c index 68983eb..cfbdc84 100644 --- a/platform/linux-generic/odp_packet_socket.c +++ b/platform/linux-generic/odp_packet_socket.c @@ -382,7 +382,7 @@ int send_pkt_sock_basic(pkt_sock_t *const pkt_sock, while (i < len) { pkt = pkt_table[i]; - frame = odp_packet_l2(pkt); + frame = odp_packet_l2_addr(pkt); frame_len = odp_packet_get_len(pkt); ret = send(sockfd, frame, frame_len, flags); @@ -489,7 +489,7 @@ int send_pkt_sock_mmsg(pkt_sock_t *const pkt_sock, memset(msgvec, 0, sizeof(msgvec)); for (i = 0; i < len; i++) { - uint8_t *const frame = odp_packet_l2(pkt_table[i]); + uint8_t *const frame = odp_packet_l2_addr(pkt_table[i]); const size_t frame_len = odp_packet_get_len(pkt_table[i]); iovecs[i].iov_base = frame; iovecs[i].iov_len = frame_len; @@ -645,7 +645,7 @@ static inline unsigned pkt_mmap_v2_tx(int sock, struct ring *ring, next_frame_num = (frame_num + 1) % ring->rd_num; - pkt_buf = odp_packet_l2(pkt_table[i]); + pkt_buf = odp_packet_l2_addr(pkt_table[i]); pkt_len = odp_packet_get_len(pkt_table[i]); ppd.v2->tp_h.tp_snaplen = pkt_len;