@@ -51,7 +51,8 @@ const char* default_eal_argv[] = {"homa", NULL};
5151 * Memory location in the mbuf where the packet data should be stored.
5252 */
5353DpdkDriver::Impl::Packet::Packet (struct rte_mbuf * mbuf, void * data)
54- : base {.payload = data, .length = 0 , .sourceIp = 0 }
54+ : base {.payload = data,
55+ .length = 0 }
5556 , bufType(MBUF)
5657 , bufRef()
5758{
@@ -65,7 +66,8 @@ DpdkDriver::Impl::Packet::Packet(struct rte_mbuf* mbuf, void* data)
6566 * Overflow buffer that holds this packet.
6667 */
6768DpdkDriver::Impl::Packet::Packet (OverflowBuffer* overflowBuf)
68- : base {.payload = overflowBuf->data , .length = 0 , .sourceIp = 0 }
69+ : base {.payload = overflowBuf->data ,
70+ .length = 0 }
6971 , bufType(OVERFLOW_BUF)
7072 , bufRef()
7173{
@@ -252,7 +254,8 @@ DpdkDriver::Impl::sendPacket(Driver::Packet* packet, IpAddress destination,
252254 vlanHdr->eth_proto = rte_cpu_to_be_16 (EthPayloadType::HOMA);
253255
254256 // Store our local IP address right before the payload.
255- *rte_pktmbuf_mtod_offset (mbuf, uint32_t *, PACKET_HDR_LEN - 4 ) = localIp;
257+ *rte_pktmbuf_mtod_offset (mbuf, uint32_t *, PACKET_HDR_LEN - 4 ) =
258+ (uint32_t )localIp;
256259
257260 // In the normal case, we pre-allocate a pakcet's mbuf with enough
258261 // storage to hold the MAX_PAYLOAD_SIZE. If the actual payload is
@@ -322,7 +325,8 @@ DpdkDriver::Impl::uncork()
322325// See Driver::receivePackets()
323326uint32_t
324327DpdkDriver::Impl::receivePackets (uint32_t maxPackets,
325- Driver::Packet* receivedPackets[])
328+ Driver::Packet* receivedPackets[],
329+ IpAddress sourceAddresses[])
326330{
327331 uint32_t numPacketsReceived = 0 ;
328332
@@ -398,9 +402,10 @@ DpdkDriver::Impl::receivePackets(uint32_t maxPackets,
398402 packet = packetPool.construct (m, payload);
399403 }
400404 packet->base .length = length;
401- packet->base .sourceIp = srcIp;
402405
403- receivedPackets[numPacketsReceived++] = &packet->base ;
406+ receivedPackets[numPacketsReceived] = &packet->base ;
407+ sourceAddresses[numPacketsReceived] = {srcIp};
408+ ++numPacketsReceived;
404409 }
405410
406411 return numPacketsReceived;
@@ -504,7 +509,7 @@ DpdkDriver::Impl::_init()
504509 int cols = sscanf (line.c_str (), " %s 0x%x 0x%x %99s %99s %99s\n " ,
505510 ip, &type, &flags, hwa, mask, dev);
506511 if (cols != 6 ) continue ;
507- arpTable.emplace (Homa::Util::stringToIp (ip), hwa);
512+ arpTable.emplace (IpAddress::fromString (ip), hwa);
508513 }
509514
510515 // Use ioctl to obtain the IP and MAC addresses of the network interface.
@@ -528,7 +533,7 @@ DpdkDriver::Impl::_init()
528533 throw DriverInitFailure (HERE_STR,
529534 StringUtil::format (" Failed to obtain IP address: %s" , error));
530535 }
531- localIp = be32toh (((struct sockaddr_in *) &ifr.ifr_addr )->sin_addr .s_addr );
536+ localIp = { be32toh (((struct sockaddr_in *) &ifr.ifr_addr )->sin_addr .s_addr )} ;
532537
533538 if (ioctl (fd, SIOCGIFHWADDR, &ifr) == -1 ) {
534539 char * error = strerror (errno);
@@ -550,7 +555,7 @@ DpdkDriver::Impl::_init()
550555 }
551556 }
552557 NOTICE (" Using interface %s, ip %s, mac %s, port %u" ,
553- ifname.c_str (), Homa::Util::ipToString (localIp).c_str (),
558+ ifname.c_str (), IpAddress::toString (localIp).c_str (),
554559 localMac.toString ().c_str (), port);
555560
556561 std::string poolName = StringUtil::format (" homa_mbuf_pool_%u" , port);
0 commit comments