From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 7FEA6A0096 for ; Wed, 10 Apr 2019 10:34:51 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7E1065F44; Wed, 10 Apr 2019 10:33:14 +0200 (CEST) Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 4B2F65424 for ; Wed, 10 Apr 2019 10:32:30 +0200 (CEST) Received: from glumotte.dev.6wind.com. (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id 3BCBE295E71; Wed, 10 Apr 2019 10:32:30 +0200 (CEST) From: Olivier Matz To: dev@dpdk.org Cc: Ferruh Yigit Date: Wed, 10 Apr 2019 10:32:17 +0200 Message-Id: <20190410083218.17531-14-olivier.matz@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190410083218.17531-1-olivier.matz@6wind.com> References: <20181024081833.21432-1-olivier.matz@6wind.com> <20190410083218.17531-1-olivier.matz@6wind.com> Subject: [dpdk-dev] [RFC v2 13/14] net: add rte prefix to tcp structure X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190410083217.rWJvs7NEzGVb0ViOiu4Gn8QZnmZzcJN1hEVs-w8k4uY@z> Add 'rte_' prefix to structures: - rename struct tcp_hdr as struct rte_tcp_hdr. Signed-off-by: Olivier Matz --- app/test-pmd/csumonly.c | 12 ++++++------ app/test/packet_burst_generator.c | 10 +++++----- app/test/packet_burst_generator.h | 2 +- app/test/test_flow_classify.c | 6 +++--- doc/guides/sample_app_ug/flow_classify.rst | 4 ++-- drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++--- drivers/net/dpaa/dpaa_rxtx.c | 2 +- drivers/net/e1000/em_rxtx.c | 2 +- drivers/net/e1000/igb_rxtx.c | 2 +- drivers/net/ena/ena_ethdev.c | 2 +- drivers/net/enic/enic_clsf.c | 8 ++++---- drivers/net/enic/enic_flow.c | 8 ++++---- drivers/net/i40e/i40e_fdir.c | 20 ++++++++++---------- drivers/net/i40e/i40e_rxtx.c | 2 +- drivers/net/iavf/iavf_rxtx.c | 2 +- drivers/net/ice/ice_rxtx.c | 2 +- drivers/net/ixgbe/ixgbe_rxtx.c | 2 +- drivers/net/mlx5/mlx5_flow.c | 8 ++++---- drivers/net/mlx5/mlx5_flow_tcf.c | 4 ++-- drivers/net/qede/qede_filter.c | 12 ++++++------ drivers/net/sfc/sfc_ef10_tx.c | 4 ++-- drivers/net/sfc/sfc_tso.c | 4 ++-- drivers/net/softnic/rte_eth_softnic_pipeline.c | 8 ++++---- drivers/net/tap/rte_eth_tap.c | 2 +- drivers/net/virtio/virtio_rxtx.c | 4 ++-- drivers/net/vmxnet3/vmxnet3_rxtx.c | 14 +++++++------- examples/flow_classify/flow_classify.c | 4 ++-- examples/ip_pipeline/pipeline.c | 8 ++++---- examples/l3fwd-power/main.c | 8 ++++---- examples/l3fwd-vf/main.c | 4 ++-- examples/tep_termination/vxlan.c | 4 ++-- examples/vhost/main.c | 4 ++-- lib/librte_ethdev/rte_flow.h | 2 +- lib/librte_gro/gro_tcp4.c | 4 ++-- lib/librte_gro/gro_tcp4.h | 10 +++++----- lib/librte_gro/gro_vxlan_tcp4.c | 6 +++--- lib/librte_gso/gso_common.h | 4 ++-- lib/librte_gso/gso_tcp4.c | 4 ++-- lib/librte_gso/gso_tunnel_tcp4.c | 4 ++-- lib/librte_gso/rte_gso.h | 2 +- lib/librte_net/rte_net.c | 8 ++++---- lib/librte_net/rte_net.h | 6 +++--- lib/librte_net/rte_tcp.h | 2 +- lib/librte_pipeline/rte_table_action.c | 8 ++++---- lib/librte_vhost/virtio_net.c | 6 +++--- 45 files changed, 125 insertions(+), 125 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index ac1c2ec60..ae4a091dd 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -102,14 +102,14 @@ get_udptcp_checksum(void *l3_hdr, void *l4_hdr, uint16_t ethertype) static void parse_ipv4(struct rte_ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) { - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; info->l3_len = (ipv4_hdr->version_ihl & 0x0f) * 4; info->l4_proto = ipv4_hdr->next_proto_id; /* only fill l4_len for TCP, it's useful for TSO */ if (info->l4_proto == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + info->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + info->l3_len); info->l4_len = (tcp_hdr->data_off & 0xf0) >> 2; } else if (info->l4_proto == IPPROTO_UDP) info->l4_len = sizeof(struct udp_hdr); @@ -121,14 +121,14 @@ parse_ipv4(struct rte_ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) static void parse_ipv6(struct rte_ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) { - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; info->l3_len = sizeof(struct rte_ipv6_hdr); info->l4_proto = ipv6_hdr->proto; /* only fill l4_len for TCP, it's useful for TSO */ if (info->l4_proto == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *)((char *)ipv6_hdr + info->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv6_hdr + info->l3_len); info->l4_len = (tcp_hdr->data_off & 0xf0) >> 2; } else if (info->l4_proto == IPPROTO_UDP) info->l4_len = sizeof(struct udp_hdr); @@ -364,7 +364,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, { struct rte_ipv4_hdr *ipv4_hdr = l3_hdr; struct udp_hdr *udp_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; uint32_t max_pkt_len, tso_segsz = 0; @@ -418,7 +418,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, if (info->gso_enable) ol_flags |= PKT_TX_UDP_SEG; } else if (info->l4_proto == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *)((char *)l3_hdr + info->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)l3_hdr + info->l3_len); tcp_hdr->cksum = 0; if (tso_segsz) ol_flags |= PKT_TX_TCP_SEG; diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index 9aa07e176..5730f8129 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -106,14 +106,14 @@ initialize_udp_header(struct udp_hdr *udp_hdr, uint16_t src_port, } uint16_t -initialize_tcp_header(struct tcp_hdr *tcp_hdr, uint16_t src_port, +initialize_tcp_header(struct rte_tcp_hdr *tcp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len) { uint16_t pkt_len; - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct tcp_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_tcp_hdr)); - memset(tcp_hdr, 0, sizeof(struct tcp_hdr)); + memset(tcp_hdr, 0, sizeof(struct rte_tcp_hdr)); tcp_hdr->src_port = rte_cpu_to_be_16(src_port); tcp_hdr->dst_port = rte_cpu_to_be_16(dst_port); @@ -389,7 +389,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, break; case IPPROTO_TCP: copy_buf_to_pkt(proto_hdr, - sizeof(struct tcp_hdr), pkt, + sizeof(struct rte_tcp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; case IPPROTO_SCTP: @@ -411,7 +411,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, break; case IPPROTO_TCP: copy_buf_to_pkt(proto_hdr, - sizeof(struct tcp_hdr), pkt, + sizeof(struct rte_tcp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; case IPPROTO_SCTP: diff --git a/app/test/packet_burst_generator.h b/app/test/packet_burst_generator.h index 98185c162..5cfe0c600 100644 --- a/app/test/packet_burst_generator.h +++ b/app/test/packet_burst_generator.h @@ -38,7 +38,7 @@ initialize_udp_header(struct udp_hdr *udp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t -initialize_tcp_header(struct tcp_hdr *tcp_hdr, uint16_t src_port, +initialize_tcp_header(struct rte_tcp_hdr *tcp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t diff --git a/app/test/test_flow_classify.c b/app/test/test_flow_classify.c index 85228486d..1a79326b8 100644 --- a/app/test/test_flow_classify.c +++ b/app/test/test_flow_classify.c @@ -74,7 +74,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, { /* rte_flow uses a bit mask for protocol ports */ @@ -84,7 +84,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; @@ -528,7 +528,7 @@ init_ipv4_tcp_traffic(struct rte_mempool *mp, { struct rte_ether_hdr pkt_eth_hdr; struct rte_ipv4_hdr pkt_ipv4_hdr; - struct tcp_hdr pkt_tcp_hdr; + struct rte_tcp_hdr pkt_tcp_hdr; uint32_t src_addr = IPV4_ADDR(1, 2, 3, 4); uint32_t dst_addr = IPV4_ADDR(5, 6, 7, 8); uint16_t src_port = 16; diff --git a/doc/guides/sample_app_ug/flow_classify.rst b/doc/guides/sample_app_ug/flow_classify.rst index 46703acbf..96a5c66d0 100644 --- a/doc/guides/sample_app_ug/flow_classify.rst +++ b/doc/guides/sample_app_ug/flow_classify.rst @@ -126,7 +126,7 @@ initialisation of the ``Flow Classify`` application.. .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, { /* rte_flow uses a bit mask for protocol ports */ @@ -136,7 +136,7 @@ initialisation of the ``Flow Classify`` application.. .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 66ed885fa..d9a47159a 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -836,7 +836,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, int i; struct udp_hdr *udp_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; uint32_t hash, l3hash, l4hash; for (i = 0; i < nb_pkts; i++) { @@ -861,7 +861,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, RTE_IPV4_IHL_MULTIPLIER; if (ipv4_hdr->next_proto_id == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *) + tcp_hdr = (struct rte_tcp_hdr *) ((char *)ipv4_hdr + ip_hdr_offset); l4hash = HASH_L4_PORTS(tcp_hdr); @@ -879,7 +879,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, l3hash = ipv6_hash(ipv6_hdr); if (ipv6_hdr->proto == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *)(ipv6_hdr + 1); + tcp_hdr = (struct rte_tcp_hdr *)(ipv6_hdr + 1); l4hash = HASH_L4_PORTS(tcp_hdr); } else if (ipv6_hdr->proto == IPPROTO_UDP) { udp_hdr = (struct udp_hdr *)(ipv6_hdr + 1); diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index 63243a79a..3a3964330 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -218,7 +218,7 @@ static inline void dpaa_checksum(struct rte_mbuf *mbuf) ipv6_hdr = (struct rte_ipv6_hdr *)l3_hdr; if ((mbuf->packet_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_TCP) { - struct tcp_hdr *tcp_hdr = (struct tcp_hdr *)(l3_hdr + + struct rte_tcp_hdr *tcp_hdr = (struct rte_tcp_hdr *)(l3_hdr + mbuf->l3_len); tcp_hdr->cksum = 0; if (eth_hdr->ether_type == htons(RTE_ETHER_TYPE_IPv4)) diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c index f59215894..427d434f4 100644 --- a/drivers/net/e1000/em_rxtx.c +++ b/drivers/net/e1000/em_rxtx.c @@ -249,7 +249,7 @@ em_set_xmit_ctx(struct em_tx_queue* txq, break; case PKT_TX_TCP_CKSUM: ctx.upper_setup.tcp_fields.tucso = (uint8_t)(ipcse + - offsetof(struct tcp_hdr, cksum)); + offsetof(struct rte_tcp_hdr, cksum)); cmd_len |= E1000_TXD_CMD_TCP; cmp_mask |= TX_MACIP_LEN_CMP_MASK; break; diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index 3bfddc651..e36e9e1f7 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -294,7 +294,7 @@ igbe_set_xmit_ctx(struct igb_tx_queue* txq, case PKT_TX_TCP_CKSUM: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_TCP | E1000_ADVTXD_DTYP_CTXT | E1000_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct tcp_hdr) << E1000_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_tcp_hdr) << E1000_ADVTXD_L4LEN_SHIFT; break; case PKT_TX_SCTP_CKSUM: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_SCTP | diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 3671b3876..2e3599f33 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -75,7 +75,7 @@ #define TEST_BIT(val, bit_shift) (val & (1UL << bit_shift)) #define GET_L4_HDR_LEN(mbuf) \ - ((rte_pktmbuf_mtod_offset(mbuf, struct tcp_hdr *, \ + ((rte_pktmbuf_mtod_offset(mbuf, struct rte_tcp_hdr *, \ mbuf->l3_len + mbuf->l2_len)->data_off) >> 4) #define ENA_RX_RSS_TABLE_LOG_SIZE 7 diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c index 6c37e2ec5..90494299a 100644 --- a/drivers/net/enic/enic_clsf.c +++ b/drivers/net/enic/enic_clsf.c @@ -137,7 +137,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, enic_set_layer(gp, FILTER_GENERIC_1_UDP, FILTER_GENERIC_1_L4, &udp_mask, &udp_val, sizeof(struct udp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_TCP) { - struct tcp_hdr tcp_mask, tcp_val; + struct rte_tcp_hdr tcp_mask, tcp_val; memset(&tcp_mask, 0, sizeof(tcp_mask)); memset(&tcp_val, 0, sizeof(tcp_val)); @@ -151,7 +151,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, } enic_set_layer(gp, FILTER_GENERIC_1_TCP, FILTER_GENERIC_1_L4, - &tcp_mask, &tcp_val, sizeof(struct tcp_hdr)); + &tcp_mask, &tcp_val, sizeof(struct rte_tcp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_SCTP) { struct rte_sctp_hdr sctp_mask, sctp_val; memset(&sctp_mask, 0, sizeof(sctp_mask)); @@ -232,7 +232,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, enic_set_layer(gp, FILTER_GENERIC_1_UDP, FILTER_GENERIC_1_L4, &udp_mask, &udp_val, sizeof(struct udp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_TCP) { - struct tcp_hdr tcp_mask, tcp_val; + struct rte_tcp_hdr tcp_mask, tcp_val; memset(&tcp_mask, 0, sizeof(tcp_mask)); memset(&tcp_val, 0, sizeof(tcp_val)); @@ -245,7 +245,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, tcp_val.dst_port = input->flow.tcp6_flow.dst_port; } enic_set_layer(gp, FILTER_GENERIC_1_TCP, FILTER_GENERIC_1_L4, - &tcp_mask, &tcp_val, sizeof(struct tcp_hdr)); + &tcp_mask, &tcp_val, sizeof(struct rte_tcp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_SCTP) { struct rte_sctp_hdr sctp_mask, sctp_val; memset(&sctp_mask, 0, sizeof(sctp_mask)); diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index 9dee5d2ee..76eba44a4 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -487,7 +487,7 @@ enic_copy_item_tcp_v1(struct copy_item_args *arg) const struct rte_flow_item_tcp *spec = item->spec; const struct rte_flow_item_tcp *mask = item->mask; struct filter_ipv4_5tuple *enic_5tup = &enic_filter->u.ipv4; - struct tcp_hdr supported_mask = { + struct rte_tcp_hdr supported_mask = { .src_port = 0xffff, .dst_port = 0xffff, }; @@ -653,7 +653,7 @@ enic_copy_item_inner_tcp_v2(struct copy_item_args *arg) mask = &rte_flow_item_tcp_mask; /* Append tcp header to L5 and set ip proto = tcp */ return copy_inner_common(&arg->filter->u.generic_1, off, - arg->item->spec, mask, sizeof(struct tcp_hdr), + arg->item->spec, mask, sizeof(struct rte_tcp_hdr), arg->l3_proto_off, IPPROTO_TCP, 1); } @@ -845,9 +845,9 @@ enic_copy_item_tcp_v2(struct copy_item_args *arg) return ENOTSUP; memcpy(gp->layer[FILTER_GENERIC_1_L4].mask, &mask->hdr, - sizeof(struct tcp_hdr)); + sizeof(struct rte_tcp_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L4].val, &spec->hdr, - sizeof(struct tcp_hdr)); + sizeof(struct rte_tcp_hdr)); return 0; } diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 14a82426e..46dfa79b7 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -800,7 +800,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, { unsigned char *payload, *ptr; struct udp_hdr *udp; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; struct rte_sctp_hdr *sctp; uint8_t size, dst = 0; uint8_t i, pit_idx, set_idx = I40E_FLXPLD_L4_IDX; /* use l4 by default*/ @@ -828,8 +828,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, break; case RTE_ETH_FLOW_NONFRAG_IPV4_TCP: - tcp = (struct tcp_hdr *)(raw_pkt + len); - payload = (unsigned char *)tcp + sizeof(struct tcp_hdr); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); + payload = (unsigned char *)tcp + sizeof(struct rte_tcp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -873,8 +873,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, break; case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: - tcp = (struct tcp_hdr *)(raw_pkt + len); - payload = (unsigned char *)tcp + sizeof(struct tcp_hdr); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); + payload = (unsigned char *)tcp + sizeof(struct rte_tcp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1090,7 +1090,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, unsigned char *payload = NULL; unsigned char *ptr; struct udp_hdr *udp; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; struct rte_sctp_hdr *sctp; struct rte_flow_item_gtp *gtp; struct rte_ipv4_hdr *gtp_ipv4; @@ -1127,8 +1127,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, udp->dst_port = fdir_input->flow.udp4_flow.src_port; udp->dgram_len = rte_cpu_to_be_16(I40E_FDIR_UDP_DEFAULT_LEN); } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV4_TCP) { - tcp = (struct tcp_hdr *)(raw_pkt + len); - payload = (unsigned char *)tcp + sizeof(struct tcp_hdr); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); + payload = (unsigned char *)tcp + sizeof(struct rte_tcp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1164,8 +1164,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, udp->dst_port = fdir_input->flow.udp6_flow.src_port; udp->dgram_len = rte_cpu_to_be_16(I40E_FDIR_IPv6_PAYLOAD_LEN); } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_TCP) { - tcp = (struct tcp_hdr *)(raw_pkt + len); - payload = (unsigned char *)tcp + sizeof(struct tcp_hdr); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); + payload = (unsigned char *)tcp + sizeof(struct rte_tcp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index edd4509ee..6b8e586e5 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -302,7 +302,7 @@ i40e_txd_enable_checksum(uint64_t ol_flags, switch (ol_flags & PKT_TX_L4_MASK) { case PKT_TX_TCP_CKSUM: *td_cmd |= I40E_TX_DESC_CMD_L4T_EOFT_TCP; - *td_offset |= (sizeof(struct tcp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_tcp_hdr) >> 2) << I40E_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; case PKT_TX_SCTP_CKSUM: diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 7a6750e02..9c733a596 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -1417,7 +1417,7 @@ iavf_txd_enable_checksum(uint64_t ol_flags, switch (ol_flags & PKT_TX_L4_MASK) { case PKT_TX_TCP_CKSUM: *td_cmd |= IAVF_TX_DESC_CMD_L4T_EOFT_TCP; - *td_offset |= (sizeof(struct tcp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_tcp_hdr) >> 2) << IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; case PKT_TX_SCTP_CKSUM: diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 2e15de46d..0862ab0cc 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -1761,7 +1761,7 @@ ice_txd_enable_checksum(uint64_t ol_flags, switch (ol_flags & PKT_TX_L4_MASK) { case PKT_TX_TCP_CKSUM: *td_cmd |= ICE_TX_DESC_CMD_L4T_EOFT_TCP; - *td_offset |= (sizeof(struct tcp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_tcp_hdr) >> 2) << ICE_TX_DESC_LEN_L4_LEN_S; break; case PKT_TX_SCTP_CKSUM: diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 08b2f5df5..c720a6db9 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -429,7 +429,7 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, case PKT_TX_TCP_CKSUM: type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_TCP | IXGBE_ADVTXD_DTYP_CTXT | IXGBE_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct tcp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_tcp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT; tx_offload_mask.l2_len |= ~0; tx_offload_mask.l3_len |= ~0; break; diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 43a5dd4cb..a1e90ea2d 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -2607,11 +2607,11 @@ flow_fdir_filter_convert(struct rte_eth_dev *dev, }; break; case RTE_ETH_FLOW_NONFRAG_IPV4_TCP: - attributes->l4.tcp.hdr = (struct tcp_hdr){ + attributes->l4.tcp.hdr = (struct rte_tcp_hdr){ .src_port = input->flow.tcp4_flow.src_port, .dst_port = input->flow.tcp4_flow.dst_port, }; - attributes->l4_mask.tcp.hdr = (struct tcp_hdr){ + attributes->l4_mask.tcp.hdr = (struct rte_tcp_hdr){ .src_port = mask->src_port_mask, .dst_port = mask->dst_port_mask, }; @@ -2637,11 +2637,11 @@ flow_fdir_filter_convert(struct rte_eth_dev *dev, }; break; case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: - attributes->l4.tcp.hdr = (struct tcp_hdr){ + attributes->l4.tcp.hdr = (struct rte_tcp_hdr){ .src_port = input->flow.tcp6_flow.src_port, .dst_port = input->flow.tcp6_flow.dst_port, }; - attributes->l4_mask.tcp.hdr = (struct tcp_hdr){ + attributes->l4_mask.tcp.hdr = (struct rte_tcp_hdr){ .src_port = mask->src_port_mask, .dst_port = mask->dst_port_mask, }; diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index 743ae8546..c118ede97 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -776,8 +776,8 @@ flow_tcf_pedit_key_set_tp_port(const struct rte_flow_action *actions, /* offset of src/dst port is same for TCP and UDP */ p_parser->keys[idx].off = actions->type == RTE_FLOW_ACTION_TYPE_SET_TP_SRC ? - offsetof(struct tcp_hdr, src_port) : - offsetof(struct tcp_hdr, dst_port); + offsetof(struct rte_tcp_hdr, src_port) : + offsetof(struct rte_tcp_hdr, dst_port); p_parser->keys[idx].mask = 0xFFFF0000; p_parser->keys[idx].val = (__u32)((const struct rte_flow_action_set_tp *) diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c index 34299b993..cd762cddb 100644 --- a/drivers/net/qede/qede_filter.c +++ b/drivers/net/qede/qede_filter.c @@ -460,7 +460,7 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, struct rte_ipv4_hdr *ip; struct rte_ipv6_hdr *ip6; struct udp_hdr *udp; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; uint16_t len; raw_pkt = (uint8_t *)buff; @@ -496,13 +496,13 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, ip->total_length += sizeof(struct udp_hdr); params->udp = true; } else { /* TCP */ - tcp = (struct tcp_hdr *)(raw_pkt + len); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); tcp->src_port = arfs->tuple.src_port; tcp->dst_port = arfs->tuple.dst_port; tcp->data_off = QEDE_FDIR_TCP_DEFAULT_DATAOFF; - len += sizeof(struct tcp_hdr); + len += sizeof(struct rte_tcp_hdr); /* adjust ip total_length */ - ip->total_length += sizeof(struct tcp_hdr); + ip->total_length += sizeof(struct rte_tcp_hdr); params->tcp = true; } break; @@ -528,11 +528,11 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, len += sizeof(struct udp_hdr); params->udp = true; } else { /* TCP */ - tcp = (struct tcp_hdr *)(raw_pkt + len); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); tcp->src_port = arfs->tuple.src_port; tcp->dst_port = arfs->tuple.dst_port; tcp->data_off = QEDE_FDIR_TCP_DEFAULT_DATAOFF; - len += sizeof(struct tcp_hdr); + len += sizeof(struct rte_tcp_hdr); params->tcp = true; } break; diff --git a/drivers/net/sfc/sfc_ef10_tx.c b/drivers/net/sfc/sfc_ef10_tx.c index 055389efe..4e4f35827 100644 --- a/drivers/net/sfc/sfc_ef10_tx.c +++ b/drivers/net/sfc/sfc_ef10_tx.c @@ -373,7 +373,7 @@ sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg, size_t header_len = tcph_off + m_seg->l4_len; /* Offset of the payload in the last segment that contains the header */ size_t in_off = 0; - const struct tcp_hdr *th; + const struct rte_tcp_hdr *th; uint16_t packet_id = 0; uint16_t outer_packet_id = 0; uint32_t sent_seq; @@ -489,7 +489,7 @@ sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg, outer_packet_id = sfc_tso_ip4_get_ipid(hdr_addr, first_m_seg->outer_l2_len); - th = (const struct tcp_hdr *)(hdr_addr + tcph_off); + th = (const struct rte_tcp_hdr *)(hdr_addr + tcph_off); rte_memcpy(&sent_seq, &th->sent_seq, sizeof(uint32_t)); sent_seq = rte_be_to_cpu_32(sent_seq); diff --git a/drivers/net/sfc/sfc_tso.c b/drivers/net/sfc/sfc_tso.c index 1374aceaa..2e34fc045 100644 --- a/drivers/net/sfc/sfc_tso.c +++ b/drivers/net/sfc/sfc_tso.c @@ -95,7 +95,7 @@ sfc_efx_tso_do(struct sfc_efx_txq *txq, unsigned int idx, unsigned int *pkt_descs, size_t *pkt_len) { uint8_t *tsoh; - const struct tcp_hdr *th; + const struct rte_tcp_hdr *th; efsys_dma_addr_t header_paddr; uint16_t packet_id = 0; uint32_t sent_seq; @@ -150,7 +150,7 @@ sfc_efx_tso_do(struct sfc_efx_txq *txq, unsigned int idx, packet_id = sfc_tso_ip4_get_ipid(tsoh, nh_off); /* Handle TCP header */ - th = (const struct tcp_hdr *)(tsoh + tcph_off); + th = (const struct rte_tcp_hdr *)(tsoh + tcph_off); rte_memcpy(&sent_seq, &th->sent_seq, sizeof(uint32_t)); sent_seq = rte_be_to_cpu_32(sent_seq); diff --git a/drivers/net/softnic/rte_eth_softnic_pipeline.c b/drivers/net/softnic/rte_eth_softnic_pipeline.c index e0e5856a4..337aa32e5 100644 --- a/drivers/net/softnic/rte_eth_softnic_pipeline.c +++ b/drivers/net/softnic/rte_eth_softnic_pipeline.c @@ -688,7 +688,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .field_index = 3, .input_index = 3, .offset = sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, /* Destination Port */ @@ -698,7 +698,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .field_index = 4, .input_index = 3, .offset = sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; @@ -785,7 +785,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .field_index = 9, .input_index = 9, .offset = sizeof(struct rte_ipv6_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, /* Destination Port */ @@ -795,7 +795,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .field_index = 10, .input_index = 9, .offset = sizeof(struct rte_ipv6_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 2465d9c2c..a6d3baa5f 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -510,7 +510,7 @@ tap_tx_l3_cksum(char *packet, uint64_t ol_flags, unsigned int l2_len, if ((ol_flags & PKT_TX_L4_MASK) == PKT_TX_UDP_CKSUM) *l4_cksum = &((struct udp_hdr *)l4_hdr)->dgram_cksum; else if ((ol_flags & PKT_TX_L4_MASK) == PKT_TX_TCP_CKSUM) - *l4_cksum = &((struct tcp_hdr *)l4_hdr)->cksum; + *l4_cksum = &((struct rte_tcp_hdr *)l4_hdr)->cksum; else return; **l4_cksum = 0; diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index 2b1080155..6c3f21bfb 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -481,7 +481,7 @@ virtio_tso_fix_cksum(struct rte_mbuf *m) m->l4_len)) { struct rte_ipv4_hdr *iph; struct rte_ipv6_hdr *ip6h; - struct tcp_hdr *th; + struct rte_tcp_hdr *th; uint16_t prev_cksum, new_cksum, ip_len, ip_paylen; uint32_t tmp; @@ -545,7 +545,7 @@ virtqueue_xmit_offload(struct virtio_net_hdr *hdr, case PKT_TX_TCP_CKSUM: hdr->csum_start = cookie->l2_len + cookie->l3_len; - hdr->csum_offset = offsetof(struct tcp_hdr, cksum); + hdr->csum_offset = offsetof(struct rte_tcp_hdr, cksum); hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; break; diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index 949798c39..550cd8738 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -541,7 +541,7 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, switch (txm->ol_flags & PKT_TX_L4_MASK) { case PKT_TX_TCP_CKSUM: - gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct tcp_hdr, cksum); + gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct rte_tcp_hdr, cksum); break; case PKT_TX_UDP_CKSUM: gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct udp_hdr, dgram_cksum); @@ -669,7 +669,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, uint32_t hlen, slen; struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; char *ptr; RTE_ASSERT(rcd->tcp); @@ -681,7 +681,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, if (rcd->v4) { if (unlikely(slen < hlen + sizeof(struct rte_ipv4_hdr))) return hw->mtu - sizeof(struct rte_ipv4_hdr) - - sizeof(struct tcp_hdr); + - sizeof(struct rte_tcp_hdr); ipv4_hdr = (struct rte_ipv4_hdr *)(ptr + hlen); hlen += (ipv4_hdr->version_ihl & RTE_IPV4_HDR_IHL_MASK) * @@ -689,7 +689,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, } else if (rcd->v6) { if (unlikely(slen < hlen + sizeof(struct rte_ipv6_hdr))) return hw->mtu - sizeof(struct rte_ipv6_hdr) - - sizeof(struct tcp_hdr); + sizeof(struct rte_tcp_hdr); ipv6_hdr = (struct rte_ipv6_hdr *)(ptr + hlen); hlen += sizeof(struct rte_ipv6_hdr); @@ -701,11 +701,11 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, } } - if (unlikely(slen < hlen + sizeof(struct tcp_hdr))) - return hw->mtu - hlen - sizeof(struct tcp_hdr) + + if (unlikely(slen < hlen + sizeof(struct rte_tcp_hdr))) + return hw->mtu - hlen - sizeof(struct rte_tcp_hdr) + sizeof(struct rte_ether_hdr); - tcp_hdr = (struct tcp_hdr *)(ptr + hlen); + tcp_hdr = (struct rte_tcp_hdr *)(ptr + hlen); hlen += (tcp_hdr->data_off & 0xf0) >> 2; if (rxm->udata64 > 1) diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c index e68d0f694..75a66fd5b 100644 --- a/examples/flow_classify/flow_classify.c +++ b/examples/flow_classify/flow_classify.c @@ -133,7 +133,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, { /* rte_flow uses a bit mask for protocol ports */ @@ -143,7 +143,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; diff --git a/examples/ip_pipeline/pipeline.c b/examples/ip_pipeline/pipeline.c index 9cc7e32d8..b627310a0 100644 --- a/examples/ip_pipeline/pipeline.c +++ b/examples/ip_pipeline/pipeline.c @@ -664,7 +664,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .field_index = 3, .input_index = 3, .offset = sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, /* Destination Port */ @@ -674,7 +674,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .field_index = 4, .input_index = 3, .offset = sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; @@ -761,7 +761,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .field_index = 9, .input_index = 9, .offset = sizeof(struct rte_ipv6_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, /* Destination Port */ @@ -771,7 +771,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .field_index = 10, .input_index = 9, .offset = sizeof(struct rte_ipv6_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 959925e73..cd43b37dc 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -527,7 +527,7 @@ get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t * ipv4_l3fwd_lookup_struct) { struct ipv4_5tuple key; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; struct udp_hdr *udp; int ret = 0; @@ -537,7 +537,7 @@ get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, switch (ipv4_hdr->next_proto_id) { case IPPROTO_TCP: - tcp = (struct tcp_hdr *)((unsigned char *)ipv4_hdr + + tcp = (struct rte_tcp_hdr *)((unsigned char *)ipv4_hdr + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); @@ -566,7 +566,7 @@ get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid, lookup_struct_t *ipv6_l3fwd_lookup_struct) { struct ipv6_5tuple key; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; struct udp_hdr *udp; int ret = 0; @@ -577,7 +577,7 @@ get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid, switch (ipv6_hdr->proto) { case IPPROTO_TCP: - tcp = (struct tcp_hdr *)((unsigned char *) ipv6_hdr + + tcp = (struct rte_tcp_hdr *)((unsigned char *) ipv6_hdr + sizeof(struct rte_ipv6_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index 5e3809b8d..d57ac262b 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -366,7 +366,7 @@ get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *l3fwd_lookup_struct) { struct ipv4_5tuple key; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; struct udp_hdr *udp; int ret = 0; @@ -376,7 +376,7 @@ get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, switch (ipv4_hdr->next_proto_id) { case IPPROTO_TCP: - tcp = (struct tcp_hdr *)((unsigned char *) ipv4_hdr + + tcp = (struct rte_tcp_hdr *)((unsigned char *) ipv4_hdr + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c index 07a53abc3..261332adf 100644 --- a/examples/tep_termination/vxlan.c +++ b/examples/tep_termination/vxlan.c @@ -76,7 +76,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; struct udp_hdr *udp_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; @@ -112,7 +112,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i udp_hdr->dgram_cksum = get_psd_sum(l3_hdr, ethertype, ol_flags); } else if (l4_proto == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *)((char *)l3_hdr + info->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)l3_hdr + info->l3_len); /* Put PKT_TX_TCP_SEG bit setting before get_psd_sum(), because * it depends on PKT_TX_TCP_SEG to calculate pseudo-header * checksum. diff --git a/examples/vhost/main.c b/examples/vhost/main.c index ce14b100a..a8719caec 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -865,7 +865,7 @@ static void virtio_tx_offload(struct rte_mbuf *m) { void *l3_hdr; struct rte_ipv4_hdr *ipv4_hdr = NULL; - struct tcp_hdr *tcp_hdr = NULL; + struct rte_tcp_hdr *tcp_hdr = NULL; struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); l3_hdr = (char *)eth_hdr + m->l2_len; @@ -876,7 +876,7 @@ static void virtio_tx_offload(struct rte_mbuf *m) m->ol_flags |= PKT_TX_IP_CKSUM; } - tcp_hdr = (struct tcp_hdr *)((char *)l3_hdr + m->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)l3_hdr + m->l3_len); tcp_hdr->cksum = get_psd_sum(l3_hdr, m->ol_flags); } diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index f93427a44..fcf444ffd 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -712,7 +712,7 @@ static const struct rte_flow_item_udp rte_flow_item_udp_mask = { * Matches a TCP header. */ struct rte_flow_item_tcp { - struct tcp_hdr hdr; /**< TCP header definition. */ + struct rte_tcp_hdr hdr; /**< TCP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_TCP. */ diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c index 20f2ea7e6..70d8c5d19 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -196,7 +196,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, { struct rte_ether_hdr *eth_hdr; struct rte_ipv4_hdr *ipv4_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; uint32_t sent_seq; int32_t tcp_dl; uint16_t ip_id, hdr_len, frag_off; @@ -217,7 +217,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv4_hdr = (struct rte_ipv4_hdr *)((char *)eth_hdr + pkt->l2_len); - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); hdr_len = pkt->l2_len + pkt->l3_len + pkt->l4_len; /* diff --git a/lib/librte_gro/gro_tcp4.h b/lib/librte_gro/gro_tcp4.h index 0a42a1ae8..9fe291191 100644 --- a/lib/librte_gro/gro_tcp4.h +++ b/lib/librte_gro/gro_tcp4.h @@ -20,7 +20,7 @@ /* The maximum TCP header length */ #define MAX_TCP_HLEN 60 #define INVALID_TCP_HDRLEN(len) \ - (((len) < sizeof(struct tcp_hdr)) || ((len) > MAX_TCP_HLEN)) + (((len) < sizeof(struct rte_tcp_hdr)) || ((len) > MAX_TCP_HLEN)) /* Header fields representing a TCP/IPv4 flow */ struct tcp4_flow_key { @@ -260,7 +260,7 @@ merge_two_tcp4_packets(struct gro_tcp4_item *item, */ static inline int check_seq_option(struct gro_tcp4_item *item, - struct tcp_hdr *tcph, + struct rte_tcp_hdr *tcph, uint32_t sent_seq, uint16_t ip_id, uint16_t tcp_hl, @@ -270,16 +270,16 @@ check_seq_option(struct gro_tcp4_item *item, { struct rte_mbuf *pkt_orig = item->firstseg; struct rte_ipv4_hdr *iph_orig; - struct tcp_hdr *tcph_orig; + struct rte_tcp_hdr *tcph_orig; uint16_t len, tcp_hl_orig; iph_orig = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt_orig, char *) + l2_offset + pkt_orig->l2_len); - tcph_orig = (struct tcp_hdr *)((char *)iph_orig + pkt_orig->l3_len); + tcph_orig = (struct rte_tcp_hdr *)((char *)iph_orig + pkt_orig->l3_len); tcp_hl_orig = pkt_orig->l4_len; /* Check if TCP option fields equal */ - len = RTE_MAX(tcp_hl, tcp_hl_orig) - sizeof(struct tcp_hdr); + len = RTE_MAX(tcp_hl, tcp_hl_orig) - sizeof(struct rte_tcp_hdr); if ((tcp_hl != tcp_hl_orig) || ((len > 0) && (memcmp(tcph + 1, tcph_orig + 1, len) != 0))) diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index d26aa95b4..e8adb310b 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -207,7 +207,7 @@ is_same_vxlan_tcp4_flow(struct vxlan_tcp4_flow_key k1, static inline int check_vxlan_seq_option(struct gro_vxlan_tcp4_item *item, - struct tcp_hdr *tcp_hdr, + struct rte_tcp_hdr *tcp_hdr, uint32_t sent_seq, uint16_t outer_ip_id, uint16_t ip_id, @@ -291,7 +291,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, { struct rte_ether_hdr *outer_eth_hdr, *eth_hdr; struct rte_ipv4_hdr *outer_ipv4_hdr, *ipv4_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; struct udp_hdr *udp_hdr; struct rte_vxlan_hdr *vxlan_hdr; uint32_t sent_seq; @@ -323,7 +323,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, eth_hdr = (struct rte_ether_hdr *)((char *)vxlan_hdr + sizeof(struct rte_vxlan_hdr)); ipv4_hdr = (struct rte_ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); /* * Don't process the packet which has FIN, SYN, RST, PSH, URG, diff --git a/lib/librte_gso/gso_common.h b/lib/librte_gso/gso_common.h index 13c9aeea8..3edd2429b 100644 --- a/lib/librte_gso/gso_common.h +++ b/lib/librte_gso/gso_common.h @@ -71,9 +71,9 @@ static inline void update_tcp_header(struct rte_mbuf *pkt, uint16_t l4_offset, uint32_t sent_seq, uint8_t non_tail) { - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; - tcp_hdr = (struct tcp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + tcp_hdr = (struct rte_tcp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + l4_offset); tcp_hdr->sent_seq = rte_cpu_to_be_32(sent_seq); if (likely(non_tail)) diff --git a/lib/librte_gso/gso_tcp4.c b/lib/librte_gso/gso_tcp4.c index ad0cce6f9..ade172ac7 100644 --- a/lib/librte_gso/gso_tcp4.c +++ b/lib/librte_gso/gso_tcp4.c @@ -10,7 +10,7 @@ update_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, struct rte_mbuf **segs, uint16_t nb_segs) { struct rte_ipv4_hdr *ipv4_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; uint32_t sent_seq; uint16_t id, tail_idx, i; uint16_t l3_offset = pkt->l2_len; @@ -18,7 +18,7 @@ update_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char*) + l3_offset); - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); id = rte_be_to_cpu_16(ipv4_hdr->packet_id); sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); tail_idx = nb_segs - 1; diff --git a/lib/librte_gso/gso_tunnel_tcp4.c b/lib/librte_gso/gso_tunnel_tcp4.c index f5a19bc43..e0384c26d 100644 --- a/lib/librte_gso/gso_tunnel_tcp4.c +++ b/lib/librte_gso/gso_tunnel_tcp4.c @@ -10,7 +10,7 @@ update_tunnel_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, struct rte_mbuf **segs, uint16_t nb_segs) { struct rte_ipv4_hdr *ipv4_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; uint32_t sent_seq; uint16_t outer_id, inner_id, tail_idx, i; uint16_t outer_ipv4_offset, inner_ipv4_offset; @@ -32,7 +32,7 @@ update_tunnel_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, inner_ipv4_offset); inner_id = rte_be_to_cpu_16(ipv4_hdr->packet_id); - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); tail_idx = nb_segs - 1; diff --git a/lib/librte_gso/rte_gso.h b/lib/librte_gso/rte_gso.h index ee879968c..8f65adf1c 100644 --- a/lib/librte_gso/rte_gso.h +++ b/lib/librte_gso/rte_gso.h @@ -19,7 +19,7 @@ extern "C" { /* Minimum GSO segment size for TCP based packets. */ #define RTE_GSO_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ - sizeof(struct rte_ipv4_hdr) + sizeof(struct tcp_hdr) + 1) + sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_tcp_hdr) + 1) /* Minimum GSO segment size for UDP based packets. */ #define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index 4a46df58d..268892cc9 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -360,8 +360,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->l4_len = sizeof(struct udp_hdr); return pkt_type; } else if ((pkt_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_TCP) { - const struct tcp_hdr *th; - struct tcp_hdr th_copy; + const struct rte_tcp_hdr *th; + struct rte_tcp_hdr th_copy; th = rte_pktmbuf_read(m, off, sizeof(*th), &th_copy); if (unlikely(th == NULL)) @@ -496,8 +496,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->inner_l4_len = sizeof(struct udp_hdr); } else if ((pkt_type & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_TCP) { - const struct tcp_hdr *th; - struct tcp_hdr th_copy; + const struct rte_tcp_hdr *th; + struct rte_tcp_hdr th_copy; th = rte_pktmbuf_read(m, off, sizeof(*th), &th_copy); if (unlikely(th == NULL)) diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h index 5c9a37a94..57b5ce363 100644 --- a/lib/librte_net/rte_net.h +++ b/lib/librte_net/rte_net.h @@ -114,7 +114,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) { struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; struct udp_hdr *udp_hdr; uint64_t inner_l3_offset = m->l2_len; @@ -170,7 +170,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) (ol_flags & PKT_TX_TCP_SEG)) { if (ol_flags & PKT_TX_IPV4) { /* non-TSO tcp or TSO */ - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + m->l3_len); tcp_hdr->cksum = rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); @@ -178,7 +178,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, inner_l3_offset); /* non-TSO tcp or TSO */ - tcp_hdr = rte_pktmbuf_mtod_offset(m, struct tcp_hdr *, + tcp_hdr = rte_pktmbuf_mtod_offset(m, struct rte_tcp_hdr *, inner_l3_offset + m->l3_len); tcp_hdr->cksum = rte_ipv6_phdr_cksum(ipv6_hdr, ol_flags); diff --git a/lib/librte_net/rte_tcp.h b/lib/librte_net/rte_tcp.h index 91f58987b..4bcda5565 100644 --- a/lib/librte_net/rte_tcp.h +++ b/lib/librte_net/rte_tcp.h @@ -23,7 +23,7 @@ extern "C" { /** * TCP Header */ -struct tcp_hdr { +struct rte_tcp_hdr { uint16_t src_port; /**< TCP source port. */ uint16_t dst_port; /**< TCP destination port. */ uint32_t sent_seq; /**< TX data sequence number. */ diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index 682df6cc4..3df121c06 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -1340,7 +1340,7 @@ pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip, { if (cfg->source_nat) { if (cfg->proto == 0x6) { - struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1]; + struct rte_tcp_hdr *tcp = (struct rte_tcp_hdr *) &ip[1]; uint16_t ip_cksum, tcp_cksum; ip_cksum = nat_ipv4_checksum_update(ip->hdr_checksum, @@ -1379,7 +1379,7 @@ pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip, } } else { if (cfg->proto == 0x6) { - struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1]; + struct rte_tcp_hdr *tcp = (struct rte_tcp_hdr *) &ip[1]; uint16_t ip_cksum, tcp_cksum; ip_cksum = nat_ipv4_checksum_update(ip->hdr_checksum, @@ -1426,7 +1426,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, { if (cfg->source_nat) { if (cfg->proto == 0x6) { - struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1]; + struct rte_tcp_hdr *tcp = (struct rte_tcp_hdr *) &ip[1]; uint16_t tcp_cksum; tcp_cksum = nat_ipv6_tcp_udp_checksum_update(tcp->cksum, @@ -1454,7 +1454,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, } } else { if (cfg->proto == 0x6) { - struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1]; + struct rte_tcp_hdr *tcp = (struct rte_tcp_hdr *) &ip[1]; uint16_t tcp_cksum; tcp_cksum = nat_ipv6_tcp_udp_checksum_update(tcp->cksum, diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 720d77ba6..fadfa3288 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -218,7 +218,7 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) switch (csum_l4) { case PKT_TX_TCP_CKSUM: - net_hdr->csum_offset = (offsetof(struct tcp_hdr, + net_hdr->csum_offset = (offsetof(struct rte_tcp_hdr, cksum)); break; case PKT_TX_UDP_CKSUM: @@ -1014,7 +1014,7 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) { uint16_t l4_proto = 0; void *l4_hdr = NULL; - struct tcp_hdr *tcp_hdr = NULL; + struct rte_tcp_hdr *tcp_hdr = NULL; if (hdr->flags == 0 && hdr->gso_type == VIRTIO_NET_HDR_GSO_NONE) return; @@ -1023,7 +1023,7 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) if (hdr->flags == VIRTIO_NET_HDR_F_NEEDS_CSUM) { if (hdr->csum_start == (m->l2_len + m->l3_len)) { switch (hdr->csum_offset) { - case (offsetof(struct tcp_hdr, cksum)): + case (offsetof(struct rte_tcp_hdr, cksum)): if (l4_proto == IPPROTO_TCP) m->ol_flags |= PKT_TX_TCP_CKSUM; break; -- 2.11.0