X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fipv4_multicast%2Fmain.c;h=a84d28c86deaa4dcb3f57d4bc2072b04bb577b1b;hb=a7c528e5d71ff3f569898d268f9de129fdfc152b;hp=6530d4830ca018dc70a648381b7c6192f3d57886;hpb=323e7b667f18376c60351282950b28d4d0cc6165;p=dpdk.git diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index 6530d4830c..a84d28c86d 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -80,7 +80,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[MAX_PORTS]; +static struct rte_ether_addr ports_eth_addr[MAX_PORTS]; /* mask of enabled ports */ static uint32_t enabled_port_mask = 0; @@ -254,20 +254,10 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone) /* prepend new header */ hdr->next = pkt; - /* update header's fields */ hdr->pkt_len = (uint16_t)(hdr->data_len + pkt->pkt_len); hdr->nb_segs = pkt->nb_segs + 1; - /* copy metadata from source packet*/ - hdr->port = pkt->port; - hdr->vlan_tci = pkt->vlan_tci; - hdr->vlan_tci_outer = pkt->vlan_tci_outer; - hdr->tx_offload = pkt->tx_offload; - hdr->hash = pkt->hash; - - hdr->ol_flags = pkt->ol_flags; - __rte_mbuf_sanity_check(hdr, 1); return hdr; } @@ -277,19 +267,20 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone) * and put it into the outgoing queue for the given port. */ static inline void -mcast_send_pkt(struct rte_mbuf *pkt, struct ether_addr *dest_addr, +mcast_send_pkt(struct rte_mbuf *pkt, struct rte_ether_addr *dest_addr, struct lcore_queue_conf *qconf, uint16_t port) { - struct ether_hdr *ethdr; + struct rte_ether_hdr *ethdr; uint16_t len; /* Construct Ethernet header. */ - ethdr = (struct ether_hdr *)rte_pktmbuf_prepend(pkt, (uint16_t)sizeof(*ethdr)); + ethdr = (struct rte_ether_hdr *) + rte_pktmbuf_prepend(pkt, (uint16_t)sizeof(*ethdr)); RTE_ASSERT(ethdr != NULL); - ether_addr_copy(dest_addr, ðdr->d_addr); - ether_addr_copy(&ports_eth_addr[port], ðdr->s_addr); - ethdr->ether_type = rte_be_to_cpu_16(ETHER_TYPE_IPv4); + rte_ether_addr_copy(dest_addr, ðdr->d_addr); + rte_ether_addr_copy(&ports_eth_addr[port], ðdr->s_addr); + ethdr->ether_type = rte_be_to_cpu_16(RTE_ETHER_TYPE_IPv4); /* Put new packet into the output queue */ len = qconf->tx_mbufs[port].len; @@ -306,17 +297,18 @@ static inline void mcast_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf) { struct rte_mbuf *mc; - struct ipv4_hdr *iphdr; + struct rte_ipv4_hdr *iphdr; uint32_t dest_addr, port_mask, port_num, use_clone; int32_t hash; uint16_t port; union { uint64_t as_int; - struct ether_addr as_addr; + struct rte_ether_addr as_addr; } dst_eth_addr; /* Remove the Ethernet header from the input packet */ - iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, (uint16_t)sizeof(struct ether_hdr)); + iphdr = (struct rte_ipv4_hdr *) + rte_pktmbuf_adj(m, (uint16_t)sizeof(struct rte_ether_hdr)); RTE_ASSERT(iphdr != NULL); dest_addr = rte_be_to_cpu_32(iphdr->dst_addr); @@ -545,10 +537,10 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, struct ether_addr *eth_addr) +print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } @@ -773,7 +765,7 @@ main(int argc, char **argv) qconf->tx_queue_id[portid] = queueid; queueid++; } - + rte_eth_allmulticast_enable(portid); /* Start device */ ret = rte_eth_dev_start(portid); if (ret < 0)