X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest-pmd%2Ftxonly.c;h=3caf281cb813e899db706d4101db054546071fad;hb=02aa899d600059560ab7392ff13e111a497c44da;hp=e558b40185bf6538b0d215ab072c0d814aa519af;hpb=6d13ea8e8e49ab957deae2bba5ecf4a4bfe747d1;p=dpdk.git diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index e558b40185..3caf281cb8 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -49,13 +49,10 @@ uint32_t tx_ip_src_addr = (192U << 24) | (18 << 16) | (0 << 8) | 1; uint32_t tx_ip_dst_addr = (192U << 24) | (18 << 16) | (0 << 8) | 2; #define IP_DEFTTL 64 /* from RFC 1340. */ -#define IP_VERSION 0x40 -#define IP_HDRLEN 0x05 /* default IP header length == five 32-bits words. */ -#define IP_VHL_DEF (IP_VERSION | IP_HDRLEN) -static struct ipv4_hdr pkt_ip_hdr; /**< IP header of transmitted packets. */ +static struct rte_ipv4_hdr pkt_ip_hdr; /**< IP header of transmitted packets. */ RTE_DEFINE_PER_LCORE(uint8_t, _ip_var); /**< IP address variation */ -static struct udp_hdr pkt_udp_hdr; /**< UDP header of transmitted packets. */ +static struct rte_udp_hdr pkt_udp_hdr; /**< UDP header of tx packets. */ static void copy_buf_to_pkt_segs(void* buf, unsigned len, struct rte_mbuf *pkt, @@ -95,8 +92,8 @@ copy_buf_to_pkt(void* buf, unsigned len, struct rte_mbuf *pkt, unsigned offset) } static void -setup_pkt_udp_ip_headers(struct ipv4_hdr *ip_hdr, - struct udp_hdr *udp_hdr, +setup_pkt_udp_ip_headers(struct rte_ipv4_hdr *ip_hdr, + struct rte_udp_hdr *udp_hdr, uint16_t pkt_data_len) { uint16_t *ptr16; @@ -106,7 +103,7 @@ setup_pkt_udp_ip_headers(struct ipv4_hdr *ip_hdr, /* * Initialize UDP header. */ - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct udp_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_udp_hdr)); udp_hdr->src_port = rte_cpu_to_be_16(tx_udp_src_port); udp_hdr->dst_port = rte_cpu_to_be_16(tx_udp_dst_port); udp_hdr->dgram_len = RTE_CPU_TO_BE_16(pkt_len); @@ -115,8 +112,8 @@ setup_pkt_udp_ip_headers(struct ipv4_hdr *ip_hdr, /* * Initialize IP header. */ - pkt_len = (uint16_t) (pkt_len + sizeof(struct ipv4_hdr)); - ip_hdr->version_ihl = IP_VHL_DEF; + pkt_len = (uint16_t) (pkt_len + sizeof(struct rte_ipv4_hdr)); + ip_hdr->version_ihl = RTE_IPV4_VHL_DEF; ip_hdr->type_of_service = 0; ip_hdr->fragment_offset = 0; ip_hdr->time_to_live = IP_DEFTTL; @@ -162,7 +159,7 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, uint8_t i; if (unlikely(tx_pkt_split == TX_PKT_SPLIT_RND)) - nb_segs = random() % tx_pkt_nb_segs + 1; + nb_segs = rte_rand() % tx_pkt_nb_segs + 1; else nb_segs = tx_pkt_nb_segs; @@ -177,7 +174,7 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, pkt->vlan_tci = vlan_tci; pkt->vlan_tci_outer = vlan_tci_outer; pkt->l2_len = sizeof(struct rte_ether_hdr); - pkt->l3_len = sizeof(struct ipv4_hdr); + pkt->l3_len = sizeof(struct rte_ipv4_hdr); pkt_len = pkt->data_len; pkt_seg = pkt; @@ -195,11 +192,11 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, copy_buf_to_pkt(&pkt_ip_hdr, sizeof(pkt_ip_hdr), pkt, sizeof(struct rte_ether_hdr)); if (txonly_multi_flow) { - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; uint32_t addr; ip_hdr = rte_pktmbuf_mtod_offset(pkt, - struct ipv4_hdr *, + struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); /* * Generate multiple flows by varying IP src addr. This @@ -213,7 +210,7 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, } copy_buf_to_pkt(&pkt_udp_hdr, sizeof(pkt_udp_hdr), pkt, sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); /* * Complete first mbuf of packet and append it to the * burst of packets to be transmitted. @@ -266,9 +263,9 @@ pkt_burst_transmit(struct fwd_stream *fs) /* * Initialize Ethernet header. */ - ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ð_hdr.d_addr); - ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_hdr.s_addr); - eth_hdr.ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + rte_ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ð_hdr.d_addr); + rte_ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_hdr.s_addr); + eth_hdr.ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4); if (rte_mempool_get_bulk(mbp, (void **)pkts_burst, nb_pkt_per_burst) == 0) { @@ -349,8 +346,8 @@ tx_only_begin(__attribute__((unused)) portid_t pi) pkt_data_len = (uint16_t) (tx_pkt_length - ( sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + - sizeof(struct udp_hdr))); + sizeof(struct rte_ipv4_hdr) + + sizeof(struct rte_udp_hdr))); setup_pkt_udp_ip_headers(&pkt_ip_hdr, &pkt_udp_hdr, pkt_data_len); }