=================================
The IPv4 Multicast application is a simple example of packet processing
=================================
The IPv4 Multicast application is a simple example of packet processing
The application performs L3 multicasting.
Overview
--------
The application demonstrates the use of zero-copy buffers for packet forwarding.
The application performs L3 multicasting.
Overview
--------
The application demonstrates the use of zero-copy buffers for packet forwarding.
This guide highlights the differences between the two applications.
There are two key differences from the L2 Forwarding sample application:
This guide highlights the differences between the two applications.
There are two key differences from the L2 Forwarding sample application:
The following sections provide some explanation of the code.
As mentioned in the overview section,
The following sections provide some explanation of the code.
As mentioned in the overview section,
The following sections describe aspects that are specific to the IPv4 Multicast sample application.
Memory Pool Initialization
The following sections describe aspects that are specific to the IPv4 Multicast sample application.
Memory Pool Initialization
/* Remove the Ethernet header from the input packet */
iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, sizeof(struct ether_hdr));
/* Remove the Ethernet header from the input packet */
iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, sizeof(struct ether_hdr));
dest_addr = rte_be_to_cpu_32(iphdr->dst_addr);
Then, the packet is checked to see if it has a multicast destination address and
dest_addr = rte_be_to_cpu_32(iphdr->dst_addr);
Then, the packet is checked to see if it has a multicast destination address and
dst_eth_addr = ETHER_ADDR_FOR_IPV4_MCAST(dest_addr);
Since Ethernet addresses are also part of the multicast process, each outgoing packet carries the same destination Ethernet address.
dst_eth_addr = ETHER_ADDR_FOR_IPV4_MCAST(dest_addr);
Since Ethernet addresses are also part of the multicast process, each outgoing packet carries the same destination Ethernet address.
ether_addr_copy(dest_addr, ðdr->d_addr);
ether_addr_copy(&ports_eth_addr[port], ðdr->s_addr);
ether_addr_copy(dest_addr, ðdr->d_addr);
ether_addr_copy(&ports_eth_addr[port], ðdr->s_addr);
/* If requested, then make a new clone packet. */
if (use_clone != 0 && unlikely ((pkt = rte_pktmbuf_clone(pkt, clone_pool)) == NULL)) {
rte_pktmbuf_free(hdr);
/* If requested, then make a new clone packet. */
if (use_clone != 0 && unlikely ((pkt = rte_pktmbuf_clone(pkt, clone_pool)) == NULL)) {
rte_pktmbuf_free(hdr);
hdr->ol_flags = pkt->ol_flags;
rte_mbuf_sanity_check(hdr, RTE_MBUF_PKT, 1);
hdr->ol_flags = pkt->ol_flags;
rte_mbuf_sanity_check(hdr, RTE_MBUF_PKT, 1);