From patchwork Tue May 21 16:13:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier Matz X-Patchwork-Id: 53584 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 978F9695D; Tue, 21 May 2019 18:13:53 +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 A54F14C80 for ; Tue, 21 May 2019 18:13:25 +0200 (CEST) Received: from glumotte.dev.6wind.com. (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id 910162B83DF; Tue, 21 May 2019 18:13:25 +0200 (CEST) From: Olivier Matz To: dev@dpdk.org Cc: stephen@networkplumber.org, ferruh.yigit@intel.com Date: Tue, 21 May 2019 18:13:12 +0200 Message-Id: <20190521161315.25500-13-olivier.matz@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190521161315.25500-1-olivier.matz@6wind.com> References: <20190410083218.17531-1-olivier.matz@6wind.com> <20190521161315.25500-1-olivier.matz@6wind.com> Subject: [dpdk-dev] [PATCH 12/15] net: add rte prefix to sctp 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" Add 'rte_' prefix to structures: - rename struct sctp_hdr as struct rte_sctp_hdr. Signed-off-by: Olivier Matz --- app/test-pmd/csumonly.c | 5 +++-- app/test/packet_burst_generator.c | 6 +++--- app/test/packet_burst_generator.h | 2 +- app/test/test_flow_classify.c | 2 +- drivers/net/e1000/igb_rxtx.c | 3 ++- drivers/net/enic/enic_clsf.c | 8 ++++---- drivers/net/enic/enic_flow.c | 4 ++-- 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 | 3 ++- examples/tep_termination/vxlan.c | 5 +++-- lib/librte_ethdev/rte_flow.h | 2 +- lib/librte_net/rte_net.c | 4 ++-- lib/librte_net/rte_sctp.h | 2 +- lib/librte_vhost/virtio_net.c | 4 ++-- 17 files changed, 40 insertions(+), 36 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 9e6630e80..1df83477e 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -368,7 +368,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 sctp_hdr *sctp_hdr; + struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; uint32_t max_pkt_len, tso_segsz = 0; @@ -435,7 +435,8 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, if (info->gso_enable) ol_flags |= PKT_TX_TCP_SEG; } else if (info->l4_proto == IPPROTO_SCTP) { - sctp_hdr = (struct sctp_hdr *)((char *)l3_hdr + info->l3_len); + sctp_hdr = (struct rte_sctp_hdr *) + ((char *)l3_hdr + info->l3_len); sctp_hdr->cksum = 0; /* sctp payload must be a multiple of 4 to be * offloaded */ diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index 02afc5547..ab65c3f07 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -124,7 +124,7 @@ initialize_tcp_header(struct tcp_hdr *tcp_hdr, uint16_t src_port, } uint16_t -initialize_sctp_header(struct sctp_hdr *sctp_hdr, uint16_t src_port, +initialize_sctp_header(struct rte_sctp_hdr *sctp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len) { uint16_t pkt_len; @@ -402,7 +402,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, break; case IPPROTO_SCTP: copy_buf_to_pkt(proto_hdr, - sizeof(struct sctp_hdr), pkt, + sizeof(struct rte_sctp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; @@ -427,7 +427,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, break; case IPPROTO_SCTP: copy_buf_to_pkt(proto_hdr, - sizeof(struct sctp_hdr), pkt, + sizeof(struct rte_sctp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; diff --git a/app/test/packet_burst_generator.h b/app/test/packet_burst_generator.h index c8bc372db..6a9d4dce8 100644 --- a/app/test/packet_burst_generator.h +++ b/app/test/packet_burst_generator.h @@ -43,7 +43,7 @@ initialize_tcp_header(struct tcp_hdr *tcp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t -initialize_sctp_header(struct sctp_hdr *sctp_hdr, uint16_t src_port, +initialize_sctp_header(struct rte_sctp_hdr *sctp_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 f2c100a0d..d228ccc10 100644 --- a/app/test/test_flow_classify.c +++ b/app/test/test_flow_classify.c @@ -567,7 +567,7 @@ init_ipv4_sctp_traffic(struct rte_mempool *mp, { struct rte_ether_hdr pkt_eth_hdr; struct rte_ipv4_hdr pkt_ipv4_hdr; - struct sctp_hdr pkt_sctp_hdr; + struct rte_sctp_hdr pkt_sctp_hdr; uint32_t src_addr = IPV4_ADDR(11, 12, 13, 14); uint32_t dst_addr = IPV4_ADDR(15, 16, 17, 18); uint16_t src_port = 10; diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index 01f5e735b..e814a0050 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -299,7 +299,8 @@ igbe_set_xmit_ctx(struct igb_tx_queue* txq, case PKT_TX_SCTP_CKSUM: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_SCTP | E1000_ADVTXD_DTYP_CTXT | E1000_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct sctp_hdr) << E1000_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_sctp_hdr) + << E1000_ADVTXD_L4LEN_SHIFT; break; default: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_RSV | diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c index 65d0be3b6..f4d604a46 100644 --- a/drivers/net/enic/enic_clsf.c +++ b/drivers/net/enic/enic_clsf.c @@ -152,7 +152,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)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_SCTP) { - struct sctp_hdr sctp_mask, sctp_val; + struct rte_sctp_hdr sctp_mask, sctp_val; memset(&sctp_mask, 0, sizeof(sctp_mask)); memset(&sctp_val, 0, sizeof(sctp_val)); @@ -175,7 +175,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, * manually set proto_id=sctp below. */ enic_set_layer(gp, 0, FILTER_GENERIC_1_L4, &sctp_mask, - &sctp_val, sizeof(struct sctp_hdr)); + &sctp_val, sizeof(struct rte_sctp_hdr)); } if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_UDP || @@ -246,7 +246,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)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_SCTP) { - struct sctp_hdr sctp_mask, sctp_val; + struct rte_sctp_hdr sctp_mask, sctp_val; memset(&sctp_mask, 0, sizeof(sctp_mask)); memset(&sctp_val, 0, sizeof(sctp_val)); @@ -264,7 +264,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, } enic_set_layer(gp, 0, FILTER_GENERIC_1_L4, &sctp_mask, - &sctp_val, sizeof(struct sctp_hdr)); + &sctp_val, sizeof(struct rte_sctp_hdr)); } if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_UDP || diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index d15b00942..a1582d019 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -910,9 +910,9 @@ enic_copy_item_sctp_v2(struct copy_item_args *arg) mask = &rte_flow_item_sctp_mask; memcpy(gp->layer[FILTER_GENERIC_1_L4].mask, &mask->hdr, - sizeof(struct sctp_hdr)); + sizeof(struct rte_sctp_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L4].val, &spec->hdr, - sizeof(struct sctp_hdr)); + sizeof(struct rte_sctp_hdr)); return 0; } diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index b20f30fb4..14a82426e 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -801,7 +801,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, unsigned char *payload, *ptr; struct udp_hdr *udp; struct tcp_hdr *tcp; - struct sctp_hdr *sctp; + 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*/ int len; @@ -841,8 +841,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, break; case RTE_ETH_FLOW_NONFRAG_IPV4_SCTP: - sctp = (struct sctp_hdr *)(raw_pkt + len); - payload = (unsigned char *)sctp + sizeof(struct sctp_hdr); + sctp = (struct rte_sctp_hdr *)(raw_pkt + len); + payload = (unsigned char *)sctp + sizeof(struct rte_sctp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -886,8 +886,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, break; case RTE_ETH_FLOW_NONFRAG_IPV6_SCTP: - sctp = (struct sctp_hdr *)(raw_pkt + len); - payload = (unsigned char *)sctp + sizeof(struct sctp_hdr); + sctp = (struct rte_sctp_hdr *)(raw_pkt + len); + payload = (unsigned char *)sctp + sizeof(struct rte_sctp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1091,7 +1091,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, unsigned char *ptr; struct udp_hdr *udp; struct tcp_hdr *tcp; - struct sctp_hdr *sctp; + struct rte_sctp_hdr *sctp; struct rte_flow_item_gtp *gtp; struct rte_ipv4_hdr *gtp_ipv4; struct rte_ipv6_hdr *gtp_ipv6; @@ -1138,8 +1138,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, tcp->dst_port = fdir_input->flow.tcp4_flow.src_port; tcp->data_off = I40E_FDIR_TCP_DEFAULT_DATAOFF; } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV4_SCTP) { - sctp = (struct sctp_hdr *)(raw_pkt + len); - payload = (unsigned char *)sctp + sizeof(struct sctp_hdr); + sctp = (struct rte_sctp_hdr *)(raw_pkt + len); + payload = (unsigned char *)sctp + sizeof(struct rte_sctp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1175,8 +1175,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, tcp->src_port = fdir_input->flow.udp6_flow.dst_port; tcp->dst_port = fdir_input->flow.udp6_flow.src_port; } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_SCTP) { - sctp = (struct sctp_hdr *)(raw_pkt + len); - payload = (unsigned char *)sctp + sizeof(struct sctp_hdr); + sctp = (struct rte_sctp_hdr *)(raw_pkt + len); + payload = (unsigned char *)sctp + sizeof(struct rte_sctp_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 c0ded1d26..fcbae1a33 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -307,7 +307,7 @@ i40e_txd_enable_checksum(uint64_t ol_flags, break; case PKT_TX_SCTP_CKSUM: *td_cmd |= I40E_TX_DESC_CMD_L4T_EOFT_SCTP; - *td_offset |= (sizeof(struct sctp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_sctp_hdr) >> 2) << I40E_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; case PKT_TX_UDP_CKSUM: diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 3b83605e8..c0fc0a3e7 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -1422,7 +1422,7 @@ iavf_txd_enable_checksum(uint64_t ol_flags, break; case PKT_TX_SCTP_CKSUM: *td_cmd |= IAVF_TX_DESC_CMD_L4T_EOFT_SCTP; - *td_offset |= (sizeof(struct sctp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_sctp_hdr) >> 2) << IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; case PKT_TX_UDP_CKSUM: diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 40e5db767..69f749a08 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -1767,7 +1767,7 @@ ice_txd_enable_checksum(uint64_t ol_flags, break; case PKT_TX_SCTP_CKSUM: *td_cmd |= ICE_TX_DESC_CMD_L4T_EOFT_SCTP; - *td_offset |= (sizeof(struct sctp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_sctp_hdr) >> 2) << ICE_TX_DESC_LEN_L4_LEN_S; break; case PKT_TX_UDP_CKSUM: diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 44b2f85d4..a0bd3b366 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -436,7 +436,8 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, case PKT_TX_SCTP_CKSUM: type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_SCTP | IXGBE_ADVTXD_DTYP_CTXT | IXGBE_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct sctp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_sctp_hdr) + << IXGBE_ADVTXD_L4LEN_SHIFT; tx_offload_mask.l2_len |= ~0; tx_offload_mask.l3_len |= ~0; break; diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c index 084b06e19..1add9904a 100644 --- a/examples/tep_termination/vxlan.c +++ b/examples/tep_termination/vxlan.c @@ -79,7 +79,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, struct rte_ipv6_hdr *ipv6_hdr; struct udp_hdr *udp_hdr; struct tcp_hdr *tcp_hdr; - struct sctp_hdr *sctp_hdr; + struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; info->l2_len = sizeof(struct rte_ether_hdr); @@ -129,7 +129,8 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, tcp_hdr->cksum = get_psd_sum(l3_hdr, ethertype, ol_flags); } else if (l4_proto == IPPROTO_SCTP) { - sctp_hdr = (struct sctp_hdr *)((char *)l3_hdr + info->l3_len); + sctp_hdr = (struct rte_sctp_hdr *) + ((char *)l3_hdr + info->l3_len); sctp_hdr->cksum = 0; ol_flags |= PKT_TX_SCTP_CKSUM; } diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index e2b441f24..0e4e3a5a5 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -730,7 +730,7 @@ static const struct rte_flow_item_tcp rte_flow_item_tcp_mask = { * Matches a SCTP header. */ struct rte_flow_item_sctp { - struct sctp_hdr hdr; /**< SCTP header definition. */ + struct rte_sctp_hdr hdr; /**< SCTP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_SCTP. */ diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index 712383484..4a46df58d 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -370,7 +370,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->l4_len = (th->data_off & 0xf0) >> 2; return pkt_type; } else if ((pkt_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_SCTP) { - hdr_lens->l4_len = sizeof(struct sctp_hdr); + hdr_lens->l4_len = sizeof(struct rte_sctp_hdr); return pkt_type; } else { uint32_t prev_off = off; @@ -506,7 +506,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->inner_l4_len = (th->data_off & 0xf0) >> 2; } else if ((pkt_type & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_SCTP) { - hdr_lens->inner_l4_len = sizeof(struct sctp_hdr); + hdr_lens->inner_l4_len = sizeof(struct rte_sctp_hdr); } else { hdr_lens->inner_l4_len = 0; } diff --git a/lib/librte_net/rte_sctp.h b/lib/librte_net/rte_sctp.h index bfb7165a6..b3661b0db 100644 --- a/lib/librte_net/rte_sctp.h +++ b/lib/librte_net/rte_sctp.h @@ -23,7 +23,7 @@ extern "C" { /** * SCTP Header */ -struct sctp_hdr { +struct rte_sctp_hdr { uint16_t src_port; /**< Source port. */ uint16_t dst_port; /**< Destin port. */ uint32_t tag; /**< Validation tag. */ diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index db364debd..1f5555392 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -226,7 +226,7 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) dgram_cksum)); break; case PKT_TX_SCTP_CKSUM: - net_hdr->csum_offset = (offsetof(struct sctp_hdr, + net_hdr->csum_offset = (offsetof(struct rte_sctp_hdr, cksum)); break; } @@ -1032,7 +1032,7 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) if (l4_proto == IPPROTO_UDP) m->ol_flags |= PKT_TX_UDP_CKSUM; break; - case (offsetof(struct sctp_hdr, cksum)): + case (offsetof(struct rte_sctp_hdr, cksum)): if (l4_proto == IPPROTO_SCTP) m->ol_flags |= PKT_TX_SCTP_CKSUM; break;