Signed-off-by: Laurent Vivier <lvivier(a)redhat.com> --- arp.c | 14 +++++--------- arp.h | 2 +- tap.c | 5 +---- tap.h | 1 + 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/arp.c b/arp.c index 4cb6965e9793..f979ad260275 100644 --- a/arp.c +++ b/arp.c @@ -63,11 +63,11 @@ static bool ignore_arp(const struct ctx *c, /** * arp() - Check if this is a supported ARP message, reply as needed * @c: Execution context - * @p: Packet pool, single packet with Ethernet buffer + * @data: Single packet with Ethernet buffer * * Return: 1 if handled, -1 on failure */ -int arp(const struct ctx *c, const struct pool *p) +int arp(const struct ctx *c, struct iov_tail *data) { struct { struct ethhdr eh; @@ -77,17 +77,13 @@ int arp(const struct ctx *c, const struct pool *p) const struct ethhdr *eh; const struct arphdr *ah; const struct arpmsg *am; - struct iov_tail data; struct arphdr ahc; struct ethhdr ehc; struct arpmsg amc; - if (!packet_data(p, 0, &data)) - return -1; - - eh = IOV_REMOVE_HEADER(&data, ehc); - ah = IOV_REMOVE_HEADER(&data, ahc); - am = IOV_REMOVE_HEADER(&data, amc); + eh = IOV_REMOVE_HEADER(data, ehc); + ah = IOV_REMOVE_HEADER(data, ahc); + am = IOV_REMOVE_HEADER(data, amc); if (!eh || !ah || !am) return -1; diff --git a/arp.h b/arp.h index ac5cd16e47f4..86bcbf878eda 100644 --- a/arp.h +++ b/arp.h @@ -20,6 +20,6 @@ struct arpmsg { unsigned char tip[4]; } __attribute__((__packed__)); -int arp(const struct ctx *c, const struct pool *p); +int arp(const struct ctx *c, struct iov_tail *data); #endif /* ARP_H */ diff --git a/tap.c b/tap.c index 56b8cb21d9dd..b1c817451031 100644 --- a/tap.c +++ b/tap.c @@ -720,10 +720,7 @@ resume: if (!eh) continue; if (ntohs(eh->h_proto) == ETH_P_ARP) { - PACKET_POOL_P(pkt, 1, in->buf, in->buf_size); - - packet_add(pkt, &data); - arp(c, pkt); + arp(c, &data); continue; } diff --git a/tap.h b/tap.h index 954ad440a287..095190eea44e 100644 --- a/tap.h +++ b/tap.h @@ -115,6 +115,7 @@ void tap_handler_passt(struct ctx *c, uint32_t events, const struct timespec *now); int tap_sock_unix_open(char *sock_path); void tap_sock_reset(struct ctx *c); +void tap_sock_set_mr(struct vhost_user_memory *mr, int nb); void tap_sock_update_pool(void *base, size_t size); void tap_backend_init(struct ctx *c); void tap_flush_pools(void); -- 2.49.0