struct rte_ether_addr addr;
/* Swap dest and src mac addresses. */
- rte_ether_addr_copy(ð_hdr->d_addr, &addr);
- rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr);
- rte_ether_addr_copy(&addr, ð_hdr->s_addr);
+ rte_ether_addr_copy(ð_hdr->dst_addr, &addr);
+ rte_ether_addr_copy(ð_hdr->src_addr, ð_hdr->dst_addr);
+ rte_ether_addr_copy(&addr, ð_hdr->src_addr);
}
static inline void
eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
rte_ether_addr_copy(&peer_eth_addrs[fs->peer_addr],
- ð_hdr->d_addr);
+ ð_hdr->dst_addr);
rte_ether_addr_copy(&ports[fs->tx_port].eth_addr,
- ð_hdr->s_addr);
+ ð_hdr->src_addr);
parse_ethernet(eth_hdr, &info);
l3_hdr = (char *)eth_hdr + info.l2_len;
/* Initialize Ethernet header. */
eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *);
- rte_ether_addr_copy(&cfg_ether_dst, ð_hdr->d_addr);
- rte_ether_addr_copy(&cfg_ether_src, ð_hdr->s_addr);
+ rte_ether_addr_copy(&cfg_ether_dst, ð_hdr->dst_addr);
+ rte_ether_addr_copy(&cfg_ether_src, ð_hdr->src_addr);
eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
/* Initialize IP header. */
if (verbose_level > 0) {
printf("\nPort %d pkt-len=%u nb-segs=%u\n",
fs->rx_port, pkt->pkt_len, pkt->nb_segs);
- ether_addr_dump(" ETH: src=", ð_h->s_addr);
- ether_addr_dump(" dst=", ð_h->d_addr);
+ ether_addr_dump(" ETH: src=", ð_h->src_addr);
+ ether_addr_dump(" dst=", ð_h->dst_addr);
}
if (eth_type == RTE_ETHER_TYPE_VLAN) {
vlan_h = (struct rte_vlan_hdr *)
*/
/* Use source MAC address as destination MAC address. */
- rte_ether_addr_copy(ð_h->s_addr, ð_h->d_addr);
+ rte_ether_addr_copy(ð_h->src_addr, ð_h->dst_addr);
/* Set source MAC address with MAC address of TX port */
rte_ether_addr_copy(&ports[fs->tx_port].eth_addr,
- ð_h->s_addr);
+ ð_h->src_addr);
arp_h->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY);
rte_ether_addr_copy(&arp_h->arp_data.arp_tha,
ð_addr);
rte_ether_addr_copy(&arp_h->arp_data.arp_sha,
&arp_h->arp_data.arp_tha);
- rte_ether_addr_copy(ð_h->s_addr,
+ rte_ether_addr_copy(ð_h->src_addr,
&arp_h->arp_data.arp_sha);
/* Swap IP addresses in ARP payload */
* ICMP checksum is computed by assuming it is valid in the
* echo request and not verified.
*/
- rte_ether_addr_copy(ð_h->s_addr, ð_addr);
- rte_ether_addr_copy(ð_h->d_addr, ð_h->s_addr);
- rte_ether_addr_copy(ð_addr, ð_h->d_addr);
+ rte_ether_addr_copy(ð_h->src_addr, ð_addr);
+ rte_ether_addr_copy(ð_h->dst_addr, ð_h->src_addr);
+ rte_ether_addr_copy(ð_addr, ð_h->dst_addr);
ip_addr = ip_h->src_addr;
if (is_multicast_ipv4_addr(ip_h->dst_addr)) {
uint32_t ip_src;
port_ieee1588_rx_timestamp_check(fs->rx_port, timesync_index);
/* Swap dest and src mac addresses. */
- rte_ether_addr_copy(ð_hdr->d_addr, &addr);
- rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr);
- rte_ether_addr_copy(&addr, ð_hdr->s_addr);
+ rte_ether_addr_copy(ð_hdr->dst_addr, &addr);
+ rte_ether_addr_copy(ð_hdr->src_addr, ð_hdr->dst_addr);
+ rte_ether_addr_copy(&addr, ð_hdr->src_addr);
/* Forward PTP packet with hardware TX timestamp */
mb->ol_flags |= PKT_TX_IEEE1588_TMST;
mb = pkts_burst[i];
eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *);
rte_ether_addr_copy(&peer_eth_addrs[fs->peer_addr],
- ð_hdr->d_addr);
+ ð_hdr->dst_addr);
rte_ether_addr_copy(&ports[fs->tx_port].eth_addr,
- ð_hdr->s_addr);
+ ð_hdr->src_addr);
mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF;
mb->ol_flags |= ol_flags;
mb->l2_len = sizeof(struct rte_ether_hdr);
eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *);
/* Swap dest and src mac addresses. */
- rte_ether_addr_copy(ð_hdr->d_addr, &addr);
- rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr);
- rte_ether_addr_copy(&addr, ð_hdr->s_addr);
+ rte_ether_addr_copy(ð_hdr->dst_addr, &addr);
+ rte_ether_addr_copy(ð_hdr->src_addr, ð_hdr->dst_addr);
+ rte_ether_addr_copy(&addr, ð_hdr->src_addr);
mbuf_field_set(mb, ol_flags);
}
/*
* Initialize Ethernet header.
*/
- 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);
+ rte_ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ð_hdr.dst_addr);
+ rte_ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_hdr.src_addr);
eth_hdr.ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
if (rte_mempool_get_bulk(mbp, (void **)pkts_burst,
" - no miss group");
MKDUMPSTR(print_buf, buf_size, cur_len, "\n");
}
- print_ether_addr(" src=", ð_hdr->s_addr,
+ print_ether_addr(" src=", ð_hdr->src_addr,
print_buf, buf_size, &cur_len);
- print_ether_addr(" - dst=", ð_hdr->d_addr,
+ print_ether_addr(" - dst=", ð_hdr->dst_addr,
print_buf, buf_size, &cur_len);
MKDUMPSTR(print_buf, buf_size, cur_len,
" - type=0x%04x - length=%u - nb_segs=%d",
struct rte_ether_addr *dst_mac, uint16_t ether_type,
uint8_t vlan_enabled, uint16_t van_id)
{
- rte_ether_addr_copy(dst_mac, ð_hdr->d_addr);
- rte_ether_addr_copy(src_mac, ð_hdr->s_addr);
+ rte_ether_addr_copy(dst_mac, ð_hdr->dst_addr);
+ rte_ether_addr_copy(src_mac, ð_hdr->src_addr);
if (vlan_enabled) {
struct rte_vlan_hdr *vhdr = (struct rte_vlan_hdr *)(
* Initialize ether header.
*/
rte_ether_addr_copy((struct rte_ether_addr *)dst_mac,
- &dn->eth_hdr.d_addr);
+ &dn->eth_hdr.dst_addr);
rte_ether_addr_copy((struct rte_ether_addr *)src_mac,
- &dn->eth_hdr.s_addr);
+ &dn->eth_hdr.src_addr);
dn->eth_hdr.ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN);
/*
slow_hdr = rte_pktmbuf_mtod(pkt, struct slow_protocol_frame *);
/* Change source address to partner address */
- rte_ether_addr_copy(&parnter_mac_default, &slow_hdr->eth_hdr.s_addr);
- slow_hdr->eth_hdr.s_addr.addr_bytes[RTE_ETHER_ADDR_LEN - 1] =
+ rte_ether_addr_copy(&parnter_mac_default, &slow_hdr->eth_hdr.src_addr);
+ slow_hdr->eth_hdr.src_addr.addr_bytes[RTE_ETHER_ADDR_LEN - 1] =
slave->port_id;
lacp = (struct lacpdu *) &slow_hdr->slow_protocol;
for (i = 0; i < expected_pkts_cnt; i++) {
hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *);
- cnt[rte_is_same_ether_addr(&hdr->d_addr,
+ cnt[rte_is_same_ether_addr(&hdr->dst_addr,
&bonded_mac)]++;
}
for (i = 0; i < expected_pkts_cnt; i++) {
hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *);
- eq_cnt += rte_is_same_ether_addr(&hdr->d_addr,
+ eq_cnt += rte_is_same_ether_addr(&hdr->dst_addr,
&bonded_mac);
}
/* Copy multicast destination address */
rte_ether_addr_copy(&slow_protocol_mac_addr,
- &marker_hdr->eth_hdr.d_addr);
+ &marker_hdr->eth_hdr.dst_addr);
/* Init source address */
- rte_ether_addr_copy(&parnter_mac_default, &marker_hdr->eth_hdr.s_addr);
- marker_hdr->eth_hdr.s_addr.addr_bytes[RTE_ETHER_ADDR_LEN - 1] =
+ rte_ether_addr_copy(&parnter_mac_default,
+ &marker_hdr->eth_hdr.src_addr);
+ marker_hdr->eth_hdr.src_addr.addr_bytes[RTE_ETHER_ADDR_LEN - 1] =
slave->port_id;
marker_hdr->eth_hdr.ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_SLOW);
consistent with existing outer header checksum status flag naming, which
should help in reducing confusion about its usage.
-* net: ``s_addr`` and ``d_addr`` fields of ``rte_ether_hdr`` structure
- will be renamed in DPDK 21.11 to avoid conflict with Windows Sockets headers.
-
* net: The structure ``rte_ipv4_hdr`` will have two unions.
The first union is for existing ``version_ihl`` byte
and new bitfield for version and IHL.
removed. Its usages have been replaced by a new function
``rte_kvargs_get_with_value()``.
+* net: Renamed ``s_addr`` and ``d_addr`` fields of ``rte_ether_hdr`` structure
+ to ``src_addr`` and ``dst_addr``, respectively.
+
* cryptodev: The API rte_cryptodev_pmd_is_valid_dev is modified to
rte_cryptodev_is_valid_dev as it can be used by the application as
well as PMD to check whether the device is valid or not.
{
struct rte_ether_hdr *eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
- if (likely(_avp_cmp_ether_addr(&avp->ethaddr, ð->d_addr) == 0)) {
+ if (likely(_avp_cmp_ether_addr(&avp->ethaddr, ð->dst_addr) == 0)) {
/* allow all packets destined to our address */
return 0;
}
- if (likely(rte_is_broadcast_ether_addr(ð->d_addr))) {
+ if (likely(rte_is_broadcast_ether_addr(ð->dst_addr))) {
/* allow all broadcast packets */
return 0;
}
- if (likely(rte_is_multicast_ether_addr(ð->d_addr))) {
+ if (likely(rte_is_multicast_ether_addr(ð->dst_addr))) {
/* allow all multicast packets */
return 0;
}
tx_parse_bd =
&txq->tx_ring[TX_BD(bd_prod, txq)].parse_bd_e2;
- if (rte_is_multicast_ether_addr(&eh->d_addr)) {
- if (rte_is_broadcast_ether_addr(&eh->d_addr))
+ if (rte_is_multicast_ether_addr(&eh->dst_addr)) {
+ if (rte_is_broadcast_ether_addr(&eh->dst_addr))
mac_type = BROADCAST_ADDRESS;
else
mac_type = MULTICAST_ADDRESS;
(mac_type << ETH_TX_PARSE_BD_E2_ETH_ADDR_TYPE_SHIFT);
rte_memcpy(&tx_parse_bd->data.mac_addr.dst_hi,
- &eh->d_addr.addr_bytes[0], 2);
+ &eh->dst_addr.addr_bytes[0], 2);
rte_memcpy(&tx_parse_bd->data.mac_addr.dst_mid,
- &eh->d_addr.addr_bytes[2], 2);
+ &eh->dst_addr.addr_bytes[2], 2);
rte_memcpy(&tx_parse_bd->data.mac_addr.dst_lo,
- &eh->d_addr.addr_bytes[4], 2);
+ &eh->dst_addr.addr_bytes[4], 2);
rte_memcpy(&tx_parse_bd->data.mac_addr.src_hi,
- &eh->s_addr.addr_bytes[0], 2);
+ &eh->src_addr.addr_bytes[0], 2);
rte_memcpy(&tx_parse_bd->data.mac_addr.src_mid,
- &eh->s_addr.addr_bytes[2], 2);
+ &eh->src_addr.addr_bytes[2], 2);
rte_memcpy(&tx_parse_bd->data.mac_addr.src_lo,
- &eh->s_addr.addr_bytes[4], 2);
+ &eh->src_addr.addr_bytes[4], 2);
tx_parse_bd->data.mac_addr.dst_hi =
rte_cpu_to_be_16(tx_parse_bd->data.mac_addr.dst_hi);
hdr = rte_pktmbuf_mtod(lacp_pkt, struct lacpdu_header *);
/* Source and destination MAC */
- rte_ether_addr_copy(&lacp_mac_addr, &hdr->eth_hdr.d_addr);
- rte_eth_macaddr_get(slave_id, &hdr->eth_hdr.s_addr);
+ rte_ether_addr_copy(&lacp_mac_addr, &hdr->eth_hdr.dst_addr);
+ rte_eth_macaddr_get(slave_id, &hdr->eth_hdr.src_addr);
hdr->eth_hdr.ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_SLOW);
lacpdu = &hdr->lacpdu;
} while (unlikely(retval == 0));
m_hdr->marker.tlv_type_marker = MARKER_TLV_TYPE_RESP;
- rte_eth_macaddr_get(slave_id, &m_hdr->eth_hdr.s_addr);
+ rte_eth_macaddr_get(slave_id, &m_hdr->eth_hdr.src_addr);
if (internals->mode4.dedicated_queues.enabled == 0) {
if (rte_ring_enqueue(port->tx_ring, pkt) != 0) {
rte_spinlock_lock(&internals->mode6.lock);
eth_h = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *);
- rte_ether_addr_copy(&client_info->app_mac, ð_h->s_addr);
- rte_ether_addr_copy(&client_info->cli_mac, ð_h->d_addr);
+ rte_ether_addr_copy(&client_info->app_mac, ð_h->src_addr);
+ rte_ether_addr_copy(&client_info->cli_mac, ð_h->dst_addr);
if (client_info->vlan_count > 0)
eth_h->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN);
else
bufs[j])) ||
!collecting ||
(!promisc &&
- ((rte_is_unicast_ether_addr(&hdr->d_addr) &&
+ ((rte_is_unicast_ether_addr(&hdr->dst_addr) &&
!rte_is_same_ether_addr(bond_mac,
- &hdr->d_addr)) ||
+ &hdr->dst_addr)) ||
(!allmulti &&
- rte_is_multicast_ether_addr(&hdr->d_addr)))))) {
+ rte_is_multicast_ether_addr(&hdr->dst_addr)))))) {
if (hdr->ether_type == ether_type_slow_be) {
bond_mode_8023ad_handle_slow_pkt(
"DstMAC:" RTE_ETHER_ADDR_PRT_FMT " DstIP:%s %s %d\n", \
info, \
port, \
- RTE_ETHER_ADDR_BYTES(ð_h->s_addr), \
+ RTE_ETHER_ADDR_BYTES(ð_h->src_addr), \
src_ip, \
- RTE_ETHER_ADDR_BYTES(ð_h->d_addr), \
+ RTE_ETHER_ADDR_BYTES(ð_h->dst_addr), \
dst_ip, \
arp_op, ++burstnumber)
#endif
ether_hash(struct rte_ether_hdr *eth_hdr)
{
unaligned_uint16_t *word_src_addr =
- (unaligned_uint16_t *)eth_hdr->s_addr.addr_bytes;
+ (unaligned_uint16_t *)eth_hdr->src_addr.addr_bytes;
unaligned_uint16_t *word_dst_addr =
- (unaligned_uint16_t *)eth_hdr->d_addr.addr_bytes;
+ (unaligned_uint16_t *)eth_hdr->dst_addr.addr_bytes;
return (word_src_addr[0] ^ word_dst_addr[0]) ^
(word_src_addr[1] ^ word_dst_addr[1]) ^
ether_hdr = rte_pktmbuf_mtod(bufs[j],
struct rte_ether_hdr *);
- if (rte_is_same_ether_addr(ðer_hdr->s_addr,
+ if (rte_is_same_ether_addr(ðer_hdr->src_addr,
&primary_slave_addr))
rte_ether_addr_copy(&active_slave_addr,
- ðer_hdr->s_addr);
+ ðer_hdr->src_addr);
#if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1)
mode6_debug("TX IPv4:", ether_hdr, slaves[i], &burstnumberTX);
#endif
slave_idx = bond_mode_alb_arp_xmit(eth_h, offset, internals);
/* Change src mac in eth header */
- rte_eth_macaddr_get(slave_idx, ð_h->s_addr);
+ rte_eth_macaddr_get(slave_idx, ð_h->src_addr);
/* Add packet to slave tx buffer */
slave_bufs[slave_idx][slave_bufs_pkts[slave_idx]] = bufs[i];
if (!mask)
mask = &rte_flow_item_eth_mask;
- memcpy(enic_spec.d_addr.addr_bytes, spec->dst.addr_bytes,
+ memcpy(enic_spec.dst_addr.addr_bytes, spec->dst.addr_bytes,
RTE_ETHER_ADDR_LEN);
- memcpy(enic_spec.s_addr.addr_bytes, spec->src.addr_bytes,
+ memcpy(enic_spec.src_addr.addr_bytes, spec->src.addr_bytes,
RTE_ETHER_ADDR_LEN);
- memcpy(enic_mask.d_addr.addr_bytes, mask->dst.addr_bytes,
+ memcpy(enic_mask.dst_addr.addr_bytes, mask->dst.addr_bytes,
RTE_ETHER_ADDR_LEN);
- memcpy(enic_mask.s_addr.addr_bytes, mask->src.addr_bytes,
+ memcpy(enic_mask.src_addr.addr_bytes, mask->src.addr_bytes,
RTE_ETHER_ADDR_LEN);
enic_spec.ether_type = spec->type;
enic_mask.ether_type = mask->type;
/* Build test packet L2 header (Ethernet). */
dst = (uint8_t *)&es->inline_data;
eth_hdr = (struct rte_ether_hdr *)dst;
- rte_eth_random_addr(ð_hdr->d_addr.addr_bytes[0]);
- rte_eth_random_addr(ð_hdr->s_addr.addr_bytes[0]);
+ rte_eth_random_addr(ð_hdr->dst_addr.addr_bytes[0]);
+ rte_eth_random_addr(ð_hdr->src_addr.addr_bytes[0]);
eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
/* Build test packet L3 header (IP v4). */
dst += sizeof(struct rte_ether_hdr);
static int lcore_main(__rte_unused void *arg1)
{
struct rte_mbuf *pkts[MAX_PKT_BURST] __rte_cache_aligned;
- struct rte_ether_addr d_addr;
+ struct rte_ether_addr dst_addr;
struct rte_ether_addr bond_mac_addr;
struct rte_ether_hdr *eth_hdr;
if (arp_hdr->arp_opcode == rte_cpu_to_be_16(RTE_ARP_OP_REQUEST)) {
arp_hdr->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY);
/* Switch src and dst data and set bonding MAC */
- rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr);
- rte_ether_addr_copy(&bond_mac_addr, ð_hdr->s_addr);
+ rte_ether_addr_copy(ð_hdr->src_addr, ð_hdr->dst_addr);
+ rte_ether_addr_copy(&bond_mac_addr, ð_hdr->src_addr);
rte_ether_addr_copy(&arp_hdr->arp_data.arp_sha,
&arp_hdr->arp_data.arp_tha);
arp_hdr->arp_data.arp_tip = arp_hdr->arp_data.arp_sip;
- rte_ether_addr_copy(&bond_mac_addr, &d_addr);
- rte_ether_addr_copy(&d_addr, &arp_hdr->arp_data.arp_sha);
+ rte_ether_addr_copy(&bond_mac_addr, &dst_addr);
+ rte_ether_addr_copy(&dst_addr, &arp_hdr->arp_data.arp_sha);
arp_hdr->arp_data.arp_sip = bond_ip;
rte_eth_tx_burst(BOND_PORT, 0, &pkts[i], 1);
is_free = 1;
}
ipv4_hdr = (struct rte_ipv4_hdr *)((char *)(eth_hdr + 1) + offset);
if (ipv4_hdr->dst_addr == bond_ip) {
- rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr);
- rte_ether_addr_copy(&bond_mac_addr, ð_hdr->s_addr);
+ rte_ether_addr_copy(ð_hdr->src_addr,
+ ð_hdr->dst_addr);
+ rte_ether_addr_copy(&bond_mac_addr,
+ ð_hdr->src_addr);
ipv4_hdr->dst_addr = ipv4_hdr->src_addr;
ipv4_hdr->src_addr = bond_ip;
rte_eth_tx_burst(BOND_PORT, 0, &pkts[i], 1);
created_pkt->pkt_len = pkt_size;
eth_hdr = rte_pktmbuf_mtod(created_pkt, struct rte_ether_hdr *);
- rte_ether_addr_copy(&bond_mac_addr, ð_hdr->s_addr);
- memset(ð_hdr->d_addr, 0xFF, RTE_ETHER_ADDR_LEN);
+ rte_ether_addr_copy(&bond_mac_addr, ð_hdr->src_addr);
+ memset(ð_hdr->dst_addr, 0xFF, RTE_ETHER_ADDR_LEN);
eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP);
arp_hdr = (struct rte_arp_hdr *)(
struct rte_ether_hdr *ptr_mac_hdr;
ptr_mac_hdr = rte_pktmbuf_mtod(ptr_frame, struct rte_ether_hdr *);
- rte_ether_addr_copy(&ptr_mac_hdr->s_addr, &ptr_mac_hdr->d_addr);
- rte_ether_addr_copy(&ptr_port->mac_addr, &ptr_mac_hdr->s_addr);
+ rte_ether_addr_copy(&ptr_mac_hdr->src_addr, &ptr_mac_hdr->dst_addr);
+ rte_ether_addr_copy(&ptr_port->mac_addr, &ptr_mac_hdr->src_addr);
}
static int worker_main(__rte_unused void *ptr_data)
/* change mac addresses on packet (to use mbuf data) */
eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
- rte_ether_addr_copy(ð->d_addr, &addr);
- rte_ether_addr_copy(&addr, ð->d_addr);
+ rte_ether_addr_copy(ð->dst_addr, &addr);
+ rte_ether_addr_copy(&addr, ð->dst_addr);
}
static __rte_always_inline void
eth_hdr = rte_pktmbuf_mtod(m,
struct rte_ether_hdr *);
print_ether_addr("src=",
- ð_hdr->s_addr);
+ ð_hdr->src_addr);
print_ether_addr(" - dst=",
- ð_hdr->d_addr);
+ ð_hdr->dst_addr);
printf(" - queue=0x%x",
(unsigned int)i);
printf("\n");
/* 02:00:00:00:00:xx - overwriting 2 bytes of source address but
* it's acceptable cause it gets overwritten by rte_ether_addr_copy
*/
- tmp = ð->d_addr.addr_bytes[0];
+ tmp = ð->dst_addr.addr_bytes[0];
*((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dest_portid << 40);
/* src addr */
- rte_ether_addr_copy(&ioat_ports_eth_addr[dest_portid], ð->s_addr);
+ rte_ether_addr_copy(&ioat_ports_eth_addr[dest_portid], ð->src_addr);
}
/* Perform packet copy there is a user-defined function. 8< */
m->l2_len = sizeof(struct rte_ether_hdr);
/* 02:00:00:00:00:xx */
- d_addr_bytes = ð_hdr->d_addr.addr_bytes[0];
+ d_addr_bytes = ð_hdr->dst_addr.addr_bytes[0];
*((uint64_t *)d_addr_bytes) = 0x000000000002 +
((uint64_t)port_out << 40);
/* src addr */
rte_ether_addr_copy(&ports_eth_addr[port_out],
- ð_hdr->s_addr);
+ ð_hdr->src_addr);
eth_hdr->ether_type = ether_type;
}
/* if packet wasn't IPv4 or IPv6, it's forwarded to the port it came from */
/* 02:00:00:00:00:xx */
- d_addr_bytes = ð_hdr->d_addr.addr_bytes[0];
+ d_addr_bytes = ð_hdr->dst_addr.addr_bytes[0];
*((uint64_t *)d_addr_bytes) = 0x000000000002 + ((uint64_t)dst_port << 40);
/* src addr */
- rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr);
+ rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->src_addr);
send_single_packet(m, dst_port);
}
ethhdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV6);
}
- memcpy(ðhdr->s_addr, ðaddr_tbl[port].src,
+ memcpy(ðhdr->src_addr, ðaddr_tbl[port].src,
sizeof(struct rte_ether_addr));
- memcpy(ðhdr->d_addr, ðaddr_tbl[port].dst,
+ memcpy(ðhdr->dst_addr, ðaddr_tbl[port].dst,
sizeof(struct rte_ether_addr));
}
struct rte_ether_hdr *ethhdr;
ethhdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *);
- memcpy(ðhdr->s_addr, ðaddr_tbl[portid].src, RTE_ETHER_ADDR_LEN);
- memcpy(ðhdr->d_addr, ðaddr_tbl[portid].dst, RTE_ETHER_ADDR_LEN);
+ memcpy(ðhdr->src_addr, ðaddr_tbl[portid].src, RTE_ETHER_ADDR_LEN);
+ memcpy(ðhdr->dst_addr, ðaddr_tbl[portid].dst, RTE_ETHER_ADDR_LEN);
}
static inline void
rte_pktmbuf_prepend(pkt, (uint16_t)sizeof(*ethdr));
RTE_ASSERT(ethdr != NULL);
- rte_ether_addr_copy(dest_addr, ðdr->d_addr);
- rte_ether_addr_copy(&ports_eth_addr[port], ðdr->s_addr);
+ rte_ether_addr_copy(dest_addr, ðdr->dst_addr);
+ rte_ether_addr_copy(&ports_eth_addr[port], ðdr->src_addr);
ethdr->ether_type = rte_be_to_cpu_16(RTE_ETHER_TYPE_IPV4);
/* Put new packet into the output queue */
eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
/* 02:00:00:00:00:xx */
- tmp = ð->d_addr.addr_bytes[0];
+ tmp = ð->dst_addr.addr_bytes[0];
*((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dest_portid << 40);
/* src addr */
- rte_ether_addr_copy(&l2fwd_ports_eth_addr[dest_portid], ð->s_addr);
+ rte_ether_addr_copy(&l2fwd_ports_eth_addr[dest_portid], ð->src_addr);
}
static void
eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
/* 02:00:00:00:00:xx */
- tmp = ð->d_addr.addr_bytes[0];
+ tmp = ð->dst_addr.addr_bytes[0];
*((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dest_port_id << 40);
/* src addr */
- rte_ether_addr_copy(addr, ð->s_addr);
+ rte_ether_addr_copy(addr, ð->src_addr);
}
static __rte_always_inline struct l2fwd_resources *
eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
/* 02:00:00:00:00:xx */
- tmp = ð->d_addr.addr_bytes[0];
+ tmp = ð->dst_addr.addr_bytes[0];
*((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40);
/* src addr */
- rte_ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr);
+ rte_ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->src_addr);
buffer = tx_buffer[dst_port];
sent = rte_eth_tx_buffer(dst_port, 0, buffer, m);
eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
/* 02:00:00:00:00:xx */
- tmp = ð->d_addr.addr_bytes[0];
+ tmp = ð->dst_addr.addr_bytes[0];
*((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40);
/* src addr */
- rte_ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr);
+ rte_ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->src_addr);
buffer = tx_buffer[dst_port];
sent = rte_eth_tx_buffer(dst_port, 0, buffer, m);
eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
/* 02:00:00:00:00:xx */
- tmp = ð->d_addr.addr_bytes[0];
+ tmp = ð->dst_addr.addr_bytes[0];
*((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dest_portid << 40);
/* src addr */
- rte_ether_addr_copy(&l2fwd_ports_eth_addr[dest_portid], ð->s_addr);
+ rte_ether_addr_copy(&l2fwd_ports_eth_addr[dest_portid], ð->src_addr);
}
/* Simple forward. 8< */
/* update src and dst mac*/
eh = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
- memcpy(eh, &port_l2hdr[port], sizeof(eh->d_addr) + sizeof(eh->s_addr));
+ memcpy(eh, &port_l2hdr[port],
+ sizeof(eh->dst_addr) + sizeof(eh->src_addr));
qconf = &lcore_conf[lcore_id];
rte_eth_tx_buffer(port, qconf->tx_queue_id[port],
return "port value exceeds RTE_MAX_ETHPORTS("
RTE_STR(RTE_MAX_ETHPORTS) ")";
- if (cmdline_parse_etheraddr(NULL, port_end, &port_l2hdr[portid].d_addr,
- sizeof(port_l2hdr[portid].d_addr)) < 0)
+ if (cmdline_parse_etheraddr(NULL, port_end,
+ &port_l2hdr[portid].dst_addr,
+ sizeof(port_l2hdr[portid].dst_addr)) < 0)
return "Invalid ethernet address";
return NULL;
}
uint32_t i;
for (i = 0; i != RTE_DIM(port_l2hdr); i++) {
- port_l2hdr[i].d_addr.addr_bytes[0] = RTE_ETHER_LOCAL_ADMIN_ADDR;
- port_l2hdr[i].d_addr.addr_bytes[5] = i;
+ port_l2hdr[i].dst_addr.addr_bytes[0] =
+ RTE_ETHER_LOCAL_ADMIN_ADDR;
+ port_l2hdr[i].dst_addr.addr_bytes[5] = i;
}
}
"rte_eth_dev_adjust_nb_rx_tx_desc: err=%d, port=%d\n",
ret, portid);
- ret = rte_eth_macaddr_get(portid, &port_l2hdr[portid].s_addr);
+ ret = rte_eth_macaddr_get(portid, &port_l2hdr[portid].src_addr);
if (ret < 0)
rte_exit(EXIT_FAILURE,
"rte_eth_macaddr_get: err=%d, port=%d\n",
ret, portid);
- print_ethaddr("Dst MAC:", &port_l2hdr[portid].d_addr);
- print_ethaddr(", Src MAC:", &port_l2hdr[portid].s_addr);
+ print_ethaddr("Dst MAC:", &port_l2hdr[portid].dst_addr);
+ print_ethaddr(", Src MAC:", &port_l2hdr[portid].src_addr);
printf(", ");
/* init memory */
dst_port = portid;
/* 02:00:00:00:00:xx */
- d_addr_bytes = ð_hdr->d_addr.addr_bytes[0];
+ d_addr_bytes = ð_hdr->dst_addr.addr_bytes[0];
*((uint64_t *)d_addr_bytes) =
0x000000000002 + ((uint64_t)dst_port << 40);
/* src addr */
rte_ether_addr_copy(&ports_eth_addr[dst_port],
- ð_hdr->s_addr);
+ ð_hdr->src_addr);
send_single_packet(m, dst_port);
} else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) {
dst_port = portid;
/* 02:00:00:00:00:xx */
- d_addr_bytes = ð_hdr->d_addr.addr_bytes[0];
+ d_addr_bytes = ð_hdr->dst_addr.addr_bytes[0];
*((uint64_t *)d_addr_bytes) =
0x000000000002 + ((uint64_t)dst_port << 40);
/* src addr */
rte_ether_addr_copy(&ports_eth_addr[dst_port],
- ð_hdr->s_addr);
+ ð_hdr->src_addr);
send_single_packet(m, dst_port);
#else
++(ipv4_hdr->hdr_checksum);
#endif
/* dst addr */
- *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port];
+ *(uint64_t *)ð_hdr->dst_addr = dest_eth_addr[dst_port];
/* src addr */
rte_ether_addr_copy(&ports_eth_addr[dst_port],
- ð_hdr->s_addr);
+ ð_hdr->src_addr);
return dst_port;
}
dst_port = portid;
/* dst addr */
- *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port];
+ *(uint64_t *)ð_hdr->dst_addr = dest_eth_addr[dst_port];
/* src addr */
rte_ether_addr_copy(&ports_eth_addr[dst_port],
- ð_hdr->s_addr);
+ ð_hdr->src_addr);
return dst_port;
}
/* Set MAC addresses. */
eth_hdr = rte_pktmbuf_mtod(pkts_burst[j],
struct rte_ether_hdr *);
- *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[hops[j]];
+ *(uint64_t *)ð_hdr->dst_addr = dest_eth_addr[hops[j]];
rte_ether_addr_copy(&ports_eth_addr[hops[j]],
- ð_hdr->s_addr);
+ ð_hdr->src_addr);
/* Send single packet. */
send_single_packet(qconf, pkts_burst[j], hops[j]);
}
#endif
/* dst addr */
- *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[mbuf->port];
+ *(uint64_t *)ð_hdr->dst_addr = dest_eth_addr[mbuf->port];
/* src addr */
rte_ether_addr_copy(&ports_eth_addr[mbuf->port],
- ð_hdr->s_addr);
+ ð_hdr->src_addr);
#endif
return mbuf->port;
}
++(ipv4_hdr->hdr_checksum);
#endif
/* dst addr */
- *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port];
+ *(uint64_t *)ð_hdr->dst_addr = dest_eth_addr[dst_port];
/* src addr */
rte_ether_addr_copy(&ports_eth_addr[dst_port],
- ð_hdr->s_addr);
+ ð_hdr->src_addr);
send_single_packet(qconf, m, dst_port);
} else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) {
dst_port = portid;
/* dst addr */
- *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port];
+ *(uint64_t *)ð_hdr->dst_addr = dest_eth_addr[dst_port];
/* src addr */
rte_ether_addr_copy(&ports_eth_addr[dst_port],
- ð_hdr->s_addr);
+ ð_hdr->src_addr);
send_single_packet(qconf, m, dst_port);
} else {
eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
/* 02:00:00:00:00:xx */
- tmp = ð->d_addr.addr_bytes[0];
+ tmp = ð->dst_addr.addr_bytes[0];
*((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40);
/* src addr */
- rte_ether_addr_copy(&lsi_ports_eth_addr[dst_port], ð->s_addr);
+ rte_ether_addr_copy(&lsi_ports_eth_addr[dst_port], ð->src_addr);
buffer = tx_buffer[dst_port];
sent = rte_eth_tx_buffer(dst_port, 0, buffer, m);
#endif
/* dst addr */
- *(uint64_t *)ð_hdr[0]->d_addr = dest_eth_addr[dst_port[0]];
- *(uint64_t *)ð_hdr[1]->d_addr = dest_eth_addr[dst_port[1]];
- *(uint64_t *)ð_hdr[2]->d_addr = dest_eth_addr[dst_port[2]];
- *(uint64_t *)ð_hdr[3]->d_addr = dest_eth_addr[dst_port[3]];
- *(uint64_t *)ð_hdr[4]->d_addr = dest_eth_addr[dst_port[4]];
- *(uint64_t *)ð_hdr[5]->d_addr = dest_eth_addr[dst_port[5]];
- *(uint64_t *)ð_hdr[6]->d_addr = dest_eth_addr[dst_port[6]];
- *(uint64_t *)ð_hdr[7]->d_addr = dest_eth_addr[dst_port[7]];
+ *(uint64_t *)ð_hdr[0]->dst_addr = dest_eth_addr[dst_port[0]];
+ *(uint64_t *)ð_hdr[1]->dst_addr = dest_eth_addr[dst_port[1]];
+ *(uint64_t *)ð_hdr[2]->dst_addr = dest_eth_addr[dst_port[2]];
+ *(uint64_t *)ð_hdr[3]->dst_addr = dest_eth_addr[dst_port[3]];
+ *(uint64_t *)ð_hdr[4]->dst_addr = dest_eth_addr[dst_port[4]];
+ *(uint64_t *)ð_hdr[5]->dst_addr = dest_eth_addr[dst_port[5]];
+ *(uint64_t *)ð_hdr[6]->dst_addr = dest_eth_addr[dst_port[6]];
+ *(uint64_t *)ð_hdr[7]->dst_addr = dest_eth_addr[dst_port[7]];
/* src addr */
- rte_ether_addr_copy(&ports_eth_addr[dst_port[0]], ð_hdr[0]->s_addr);
- rte_ether_addr_copy(&ports_eth_addr[dst_port[1]], ð_hdr[1]->s_addr);
- rte_ether_addr_copy(&ports_eth_addr[dst_port[2]], ð_hdr[2]->s_addr);
- rte_ether_addr_copy(&ports_eth_addr[dst_port[3]], ð_hdr[3]->s_addr);
- rte_ether_addr_copy(&ports_eth_addr[dst_port[4]], ð_hdr[4]->s_addr);
- rte_ether_addr_copy(&ports_eth_addr[dst_port[5]], ð_hdr[5]->s_addr);
- rte_ether_addr_copy(&ports_eth_addr[dst_port[6]], ð_hdr[6]->s_addr);
- rte_ether_addr_copy(&ports_eth_addr[dst_port[7]], ð_hdr[7]->s_addr);
+ rte_ether_addr_copy(&ports_eth_addr[dst_port[0]], ð_hdr[0]->src_addr);
+ rte_ether_addr_copy(&ports_eth_addr[dst_port[1]], ð_hdr[1]->src_addr);
+ rte_ether_addr_copy(&ports_eth_addr[dst_port[2]], ð_hdr[2]->src_addr);
+ rte_ether_addr_copy(&ports_eth_addr[dst_port[3]], ð_hdr[3]->src_addr);
+ rte_ether_addr_copy(&ports_eth_addr[dst_port[4]], ð_hdr[4]->src_addr);
+ rte_ether_addr_copy(&ports_eth_addr[dst_port[5]], ð_hdr[5]->src_addr);
+ rte_ether_addr_copy(&ports_eth_addr[dst_port[6]], ð_hdr[6]->src_addr);
+ rte_ether_addr_copy(&ports_eth_addr[dst_port[7]], ð_hdr[7]->src_addr);
send_single_packet(m[0], (uint8_t)dst_port[0]);
send_single_packet(m[1], (uint8_t)dst_port[1]);
dst_port[7] = portid;
/* dst addr */
- *(uint64_t *)ð_hdr[0]->d_addr = dest_eth_addr[dst_port[0]];
- *(uint64_t *)ð_hdr[1]->d_addr = dest_eth_addr[dst_port[1]];
- *(uint64_t *)ð_hdr[2]->d_addr = dest_eth_addr[dst_port[2]];
- *(uint64_t *)ð_hdr[3]->d_addr = dest_eth_addr[dst_port[3]];
- *(uint64_t *)ð_hdr[4]->d_addr = dest_eth_addr[dst_port[4]];
- *(uint64_t *)ð_hdr[5]->d_addr = dest_eth_addr[dst_port[5]];
- *(uint64_t *)ð_hdr[6]->d_addr = dest_eth_addr[dst_port[6]];
- *(uint64_t *)ð_hdr[7]->d_addr = dest_eth_addr[dst_port[7]];
+ *(uint64_t *)ð_hdr[0]->dst_addr = dest_eth_addr[dst_port[0]];
+ *(uint64_t *)ð_hdr[1]->dst_addr = dest_eth_addr[dst_port[1]];
+ *(uint64_t *)ð_hdr[2]->dst_addr = dest_eth_addr[dst_port[2]];
+ *(uint64_t *)ð_hdr[3]->dst_addr = dest_eth_addr[dst_port[3]];
+ *(uint64_t *)ð_hdr[4]->dst_addr = dest_eth_addr[dst_port[4]];
+ *(uint64_t *)ð_hdr[5]->dst_addr = dest_eth_addr[dst_port[5]];
+ *(uint64_t *)ð_hdr[6]->dst_addr = dest_eth_addr[dst_port[6]];
+ *(uint64_t *)ð_hdr[7]->dst_addr = dest_eth_addr[dst_port[7]];
/* src addr */
- rte_ether_addr_copy(&ports_eth_addr[dst_port[0]], ð_hdr[0]->s_addr);
- rte_ether_addr_copy(&ports_eth_addr[dst_port[1]], ð_hdr[1]->s_addr);
- rte_ether_addr_copy(&ports_eth_addr[dst_port[2]], ð_hdr[2]->s_addr);
- rte_ether_addr_copy(&ports_eth_addr[dst_port[3]], ð_hdr[3]->s_addr);
- rte_ether_addr_copy(&ports_eth_addr[dst_port[4]], ð_hdr[4]->s_addr);
- rte_ether_addr_copy(&ports_eth_addr[dst_port[5]], ð_hdr[5]->s_addr);
- rte_ether_addr_copy(&ports_eth_addr[dst_port[6]], ð_hdr[6]->s_addr);
- rte_ether_addr_copy(&ports_eth_addr[dst_port[7]], ð_hdr[7]->s_addr);
+ rte_ether_addr_copy(&ports_eth_addr[dst_port[0]], ð_hdr[0]->src_addr);
+ rte_ether_addr_copy(&ports_eth_addr[dst_port[1]], ð_hdr[1]->src_addr);
+ rte_ether_addr_copy(&ports_eth_addr[dst_port[2]], ð_hdr[2]->src_addr);
+ rte_ether_addr_copy(&ports_eth_addr[dst_port[3]], ð_hdr[3]->src_addr);
+ rte_ether_addr_copy(&ports_eth_addr[dst_port[4]], ð_hdr[4]->src_addr);
+ rte_ether_addr_copy(&ports_eth_addr[dst_port[5]], ð_hdr[5]->src_addr);
+ rte_ether_addr_copy(&ports_eth_addr[dst_port[6]], ð_hdr[6]->src_addr);
+ rte_ether_addr_copy(&ports_eth_addr[dst_port[7]], ð_hdr[7]->src_addr);
send_single_packet(m[0], dst_port[0]);
send_single_packet(m[1], dst_port[1]);
++(ipv4_hdr->hdr_checksum);
#endif
/* dst addr */
- *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port];
+ *(uint64_t *)ð_hdr->dst_addr = dest_eth_addr[dst_port];
/* src addr */
rte_ether_addr_copy(&ports_eth_addr[dst_port],
- ð_hdr->s_addr);
+ ð_hdr->src_addr);
send_single_packet(m, dst_port);
} else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) {
dst_port = portid;
/* dst addr */
- *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port];
+ *(uint64_t *)ð_hdr->dst_addr = dest_eth_addr[dst_port];
/* src addr */
rte_ether_addr_copy(&ports_eth_addr[dst_port],
- ð_hdr->s_addr);
+ ð_hdr->src_addr);
send_single_packet(m, dst_port);
} else
created_pkt->data_len = pkt_size;
created_pkt->pkt_len = pkt_size;
eth_hdr = rte_pktmbuf_mtod(created_pkt, struct rte_ether_hdr *);
- rte_ether_addr_copy(ð_addr, ð_hdr->s_addr);
+ rte_ether_addr_copy(ð_addr, ð_hdr->src_addr);
/* Set multicast address 01-1B-19-00-00-00. */
- rte_ether_addr_copy(ð_multicast, ð_hdr->d_addr);
+ rte_ether_addr_copy(ð_multicast, ð_hdr->dst_addr);
eth_hdr->ether_type = htons(PTP_PROTOCOL);
ptp_msg = (struct ptp_message *)
client_clkid =
&ptp_msg->delay_req.hdr.source_port_id.clock_id;
- client_clkid->id[0] = eth_hdr->s_addr.addr_bytes[0];
- client_clkid->id[1] = eth_hdr->s_addr.addr_bytes[1];
- client_clkid->id[2] = eth_hdr->s_addr.addr_bytes[2];
+ client_clkid->id[0] = eth_hdr->src_addr.addr_bytes[0];
+ client_clkid->id[1] = eth_hdr->src_addr.addr_bytes[1];
+ client_clkid->id[2] = eth_hdr->src_addr.addr_bytes[2];
client_clkid->id[3] = 0xFF;
client_clkid->id[4] = 0xFE;
- client_clkid->id[5] = eth_hdr->s_addr.addr_bytes[3];
- client_clkid->id[6] = eth_hdr->s_addr.addr_bytes[4];
- client_clkid->id[7] = eth_hdr->s_addr.addr_bytes[5];
+ client_clkid->id[5] = eth_hdr->src_addr.addr_bytes[3];
+ client_clkid->id[6] = eth_hdr->src_addr.addr_bytes[4];
+ client_clkid->id[7] = eth_hdr->src_addr.addr_bytes[5];
rte_memcpy(&ptp_data->client_clock_id,
client_clkid,
/* Learn MAC address of guest device from packet */
pkt_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
- if (find_vhost_dev(&pkt_hdr->s_addr)) {
+ if (find_vhost_dev(&pkt_hdr->src_addr)) {
RTE_LOG(ERR, VHOST_DATA,
"(%d) device is using a registered MAC!\n",
vdev->vid);
}
for (i = 0; i < RTE_ETHER_ADDR_LEN; i++)
- vdev->mac_address.addr_bytes[i] = pkt_hdr->s_addr.addr_bytes[i];
+ vdev->mac_address.addr_bytes[i] =
+ pkt_hdr->src_addr.addr_bytes[i];
/* vlan_tag currently uses the device_id. */
vdev->vlan_tag = vlan_tags[vdev->vid];
uint16_t lcore_id = rte_lcore_id();
pkt_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
- dst_vdev = find_vhost_dev(&pkt_hdr->d_addr);
+ dst_vdev = find_vhost_dev(&pkt_hdr->dst_addr);
if (!dst_vdev)
return -1;
struct rte_ether_hdr *pkt_hdr =
rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
- dst_vdev = find_vhost_dev(&pkt_hdr->d_addr);
+ dst_vdev = find_vhost_dev(&pkt_hdr->dst_addr);
if (!dst_vdev)
return 0;
nh = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
- if (unlikely(rte_is_broadcast_ether_addr(&nh->d_addr))) {
+ if (unlikely(rte_is_broadcast_ether_addr(&nh->dst_addr))) {
struct vhost_dev *vdev2;
TAILQ_FOREACH(vdev2, &vhost_dev_list, global_vdev_entry) {
eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
/* 02:00:00:00:00:xx */
- tmp = ð->d_addr.addr_bytes[0];
+ tmp = ð->dst_addr.addr_bytes[0];
*((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40);
/* src addr */
- rte_ether_addr_copy(&vmdq_ports_eth_addr[dst_port], ð->s_addr);
+ rte_ether_addr_copy(&vmdq_ports_eth_addr[dst_port], ð->src_addr);
}
/* When we receive a HUP signal, print out our stats */
eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
/* 02:00:00:00:00:xx */
- tmp = ð->d_addr.addr_bytes[0];
+ tmp = ð->dst_addr.addr_bytes[0];
*((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40);
/* src addr */
- rte_ether_addr_copy(&vmdq_ports_eth_addr[dst_port], ð->s_addr);
+ rte_ether_addr_copy(&vmdq_ports_eth_addr[dst_port], ð->src_addr);
}
/* When we receive a HUP signal, print out our stats */
/** Default mask for RTE_FLOW_ITEM_TYPE_ETH. */
#ifndef __cplusplus
static const struct rte_flow_item_eth rte_flow_item_eth_mask = {
- .hdr.d_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff",
- .hdr.s_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff",
+ .hdr.dst_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff",
+ .hdr.src_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff",
.hdr.ether_type = RTE_BE16(0x0000),
};
#endif
ip_id = is_atomic ? 0 : rte_be_to_cpu_16(ipv4_hdr->packet_id);
sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq);
- rte_ether_addr_copy(&(eth_hdr->s_addr), &(key.eth_saddr));
- rte_ether_addr_copy(&(eth_hdr->d_addr), &(key.eth_daddr));
+ rte_ether_addr_copy(&(eth_hdr->src_addr), &(key.eth_saddr));
+ rte_ether_addr_copy(&(eth_hdr->dst_addr), &(key.eth_daddr));
key.ip_src_addr = ipv4_hdr->src_addr;
key.ip_dst_addr = ipv4_hdr->dst_addr;
key.src_port = tcp_hdr->src_port;
is_last_frag = ((frag_offset & RTE_IPV4_HDR_MF_FLAG) == 0) ? 1 : 0;
frag_offset = (uint16_t)(frag_offset & RTE_IPV4_HDR_OFFSET_MASK) << 3;
- rte_ether_addr_copy(&(eth_hdr->s_addr), &(key.eth_saddr));
- rte_ether_addr_copy(&(eth_hdr->d_addr), &(key.eth_daddr));
+ rte_ether_addr_copy(&(eth_hdr->src_addr), &(key.eth_saddr));
+ rte_ether_addr_copy(&(eth_hdr->dst_addr), &(key.eth_daddr));
key.ip_src_addr = ipv4_hdr->src_addr;
key.ip_dst_addr = ipv4_hdr->dst_addr;
key.ip_id = ip_id;
sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq);
- rte_ether_addr_copy(&(eth_hdr->s_addr), &(key.inner_key.eth_saddr));
- rte_ether_addr_copy(&(eth_hdr->d_addr), &(key.inner_key.eth_daddr));
+ rte_ether_addr_copy(&(eth_hdr->src_addr), &(key.inner_key.eth_saddr));
+ rte_ether_addr_copy(&(eth_hdr->dst_addr), &(key.inner_key.eth_daddr));
key.inner_key.ip_src_addr = ipv4_hdr->src_addr;
key.inner_key.ip_dst_addr = ipv4_hdr->dst_addr;
key.inner_key.recv_ack = tcp_hdr->recv_ack;
key.vxlan_hdr.vx_flags = vxlan_hdr->vx_flags;
key.vxlan_hdr.vx_vni = vxlan_hdr->vx_vni;
- rte_ether_addr_copy(&(outer_eth_hdr->s_addr), &(key.outer_eth_saddr));
- rte_ether_addr_copy(&(outer_eth_hdr->d_addr), &(key.outer_eth_daddr));
+ rte_ether_addr_copy(&(outer_eth_hdr->src_addr), &(key.outer_eth_saddr));
+ rte_ether_addr_copy(&(outer_eth_hdr->dst_addr), &(key.outer_eth_daddr));
key.outer_ip_src_addr = outer_ipv4_hdr->src_addr;
key.outer_ip_dst_addr = outer_ipv4_hdr->dst_addr;
key.outer_src_port = udp_hdr->src_port;
is_last_frag = ((frag_offset & RTE_IPV4_HDR_MF_FLAG) == 0) ? 1 : 0;
frag_offset = (uint16_t)(frag_offset & RTE_IPV4_HDR_OFFSET_MASK) << 3;
- rte_ether_addr_copy(&(eth_hdr->s_addr), &(key.inner_key.eth_saddr));
- rte_ether_addr_copy(&(eth_hdr->d_addr), &(key.inner_key.eth_daddr));
+ rte_ether_addr_copy(&(eth_hdr->src_addr), &(key.inner_key.eth_saddr));
+ rte_ether_addr_copy(&(eth_hdr->dst_addr), &(key.inner_key.eth_daddr));
key.inner_key.ip_src_addr = ipv4_hdr->src_addr;
key.inner_key.ip_dst_addr = ipv4_hdr->dst_addr;
key.inner_key.ip_id = ip_id;
key.vxlan_hdr.vx_flags = vxlan_hdr->vx_flags;
key.vxlan_hdr.vx_vni = vxlan_hdr->vx_vni;
- rte_ether_addr_copy(&(outer_eth_hdr->s_addr), &(key.outer_eth_saddr));
- rte_ether_addr_copy(&(outer_eth_hdr->d_addr), &(key.outer_eth_daddr));
+ rte_ether_addr_copy(&(outer_eth_hdr->src_addr), &(key.outer_eth_saddr));
+ rte_ether_addr_copy(&(outer_eth_hdr->dst_addr), &(key.outer_eth_daddr));
key.outer_ip_src_addr = outer_ipv4_hdr->src_addr;
key.outer_ip_dst_addr = outer_ipv4_hdr->dst_addr;
/* Note: It is unnecessary to save outer_src_port here because it can
}
/* Ethernet header. */
- memset(eth_hdr->d_addr.addr_bytes, 0xff, RTE_ETHER_ADDR_LEN);
- rte_ether_addr_copy(mac, ð_hdr->s_addr);
+ memset(eth_hdr->dst_addr.addr_bytes, 0xff, RTE_ETHER_ADDR_LEN);
+ rte_ether_addr_copy(mac, ð_hdr->src_addr);
eth_hdr->ether_type = RTE_BE16(RTE_ETHER_TYPE_RARP);
/* RARP header. */
int
rte_ether_unformat_addr(const char *str, struct rte_ether_addr *eth_addr);
-/* Windows Sockets headers contain `#define s_addr S_un.S_addr`.
- * Temporarily disable this macro to avoid conflict at definition.
- * Place source MAC address in both `s_addr` and `S_un.S_addr` fields,
- * so that access works either directly or through the macro.
- */
-#pragma push_macro("s_addr")
-#ifdef s_addr
-#undef s_addr
-#endif
-
/**
* Ethernet header: Contains the destination address, source address
* and frame type.
*/
struct rte_ether_hdr {
- struct rte_ether_addr d_addr; /**< Destination address. */
- RTE_STD_C11
- union {
- struct rte_ether_addr s_addr; /**< Source address. */
- struct {
- struct rte_ether_addr S_addr;
- } S_un; /**< Do not use directly; use s_addr instead.*/
- };
+ struct rte_ether_addr dst_addr; /**< Destination address. */
+ struct rte_ether_addr src_addr; /**< Source address. */
rte_be16_t ether_type; /**< Frame type. */
} __rte_aligned(2);
-#pragma pop_macro("s_addr")
-
/**
* Ethernet VLAN Header.
* Contains the 16-bit VLAN Tag Control Identifier and the Ethernet type
RTE_ETHER_TYPE_IPV6;
/* Ethernet */
- rte_ether_addr_copy(&p->ether.ether.da, &d->ether.d_addr);
- rte_ether_addr_copy(&p->ether.ether.sa, &d->ether.s_addr);
+ rte_ether_addr_copy(&p->ether.ether.da, &d->ether.dst_addr);
+ rte_ether_addr_copy(&p->ether.ether.sa, &d->ether.src_addr);
d->ether.ether_type = rte_htons(ethertype);
return 0;
RTE_ETHER_TYPE_IPV6;
/* Ethernet */
- rte_ether_addr_copy(&p->vlan.ether.da, &d->ether.d_addr);
- rte_ether_addr_copy(&p->vlan.ether.sa, &d->ether.s_addr);
+ rte_ether_addr_copy(&p->vlan.ether.da, &d->ether.dst_addr);
+ rte_ether_addr_copy(&p->vlan.ether.sa, &d->ether.src_addr);
d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_VLAN);
/* VLAN */
RTE_ETHER_TYPE_IPV6;
/* Ethernet */
- rte_ether_addr_copy(&p->qinq.ether.da, &d->ether.d_addr);
- rte_ether_addr_copy(&p->qinq.ether.sa, &d->ether.s_addr);
+ rte_ether_addr_copy(&p->qinq.ether.da, &d->ether.dst_addr);
+ rte_ether_addr_copy(&p->qinq.ether.sa, &d->ether.src_addr);
d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_QINQ);
/* SVLAN */
struct encap_qinq_pppoe_data *d = data;
/* Ethernet */
- rte_ether_addr_copy(&p->qinq.ether.da, &d->ether.d_addr);
- rte_ether_addr_copy(&p->qinq.ether.sa, &d->ether.s_addr);
+ rte_ether_addr_copy(&p->qinq.ether.da, &d->ether.dst_addr);
+ rte_ether_addr_copy(&p->qinq.ether.sa, &d->ether.src_addr);
d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_VLAN);
/* SVLAN */
uint32_t i;
/* Ethernet */
- rte_ether_addr_copy(&p->mpls.ether.da, &d->ether.d_addr);
- rte_ether_addr_copy(&p->mpls.ether.sa, &d->ether.s_addr);
+ rte_ether_addr_copy(&p->mpls.ether.da, &d->ether.dst_addr);
+ rte_ether_addr_copy(&p->mpls.ether.sa, &d->ether.src_addr);
d->ether.ether_type = rte_htons(ethertype);
/* MPLS */
struct encap_pppoe_data *d = data;
/* Ethernet */
- rte_ether_addr_copy(&p->pppoe.ether.da, &d->ether.d_addr);
- rte_ether_addr_copy(&p->pppoe.ether.sa, &d->ether.s_addr);
+ rte_ether_addr_copy(&p->pppoe.ether.da, &d->ether.dst_addr);
+ rte_ether_addr_copy(&p->pppoe.ether.sa, &d->ether.src_addr);
d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_PPPOE_SESSION);
/* PPPoE and PPP*/
/* Ethernet */
rte_ether_addr_copy(&p->vxlan.ether.da,
- &d->ether.d_addr);
+ &d->ether.dst_addr);
rte_ether_addr_copy(&p->vxlan.ether.sa,
- &d->ether.s_addr);
+ &d->ether.src_addr);
d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_VLAN);
/* VLAN */
/* Ethernet */
rte_ether_addr_copy(&p->vxlan.ether.da,
- &d->ether.d_addr);
+ &d->ether.dst_addr);
rte_ether_addr_copy(&p->vxlan.ether.sa,
- &d->ether.s_addr);
+ &d->ether.src_addr);
d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_IPV4);
/* IPv4*/
/* Ethernet */
rte_ether_addr_copy(&p->vxlan.ether.da,
- &d->ether.d_addr);
+ &d->ether.dst_addr);
rte_ether_addr_copy(&p->vxlan.ether.sa,
- &d->ether.s_addr);
+ &d->ether.src_addr);
d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_VLAN);
/* VLAN */
/* Ethernet */
rte_ether_addr_copy(&p->vxlan.ether.da,
- &d->ether.d_addr);
+ &d->ether.dst_addr);
rte_ether_addr_copy(&p->vxlan.ether.sa,
- &d->ether.s_addr);
+ &d->ether.src_addr);
d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_IPV6);
/* IPv6*/