aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorLaurent Vivier <lvivier@redhat.com>2025-09-02 09:52:45 +0200
committerStefano Brivio <sbrivio@redhat.com>2025-09-03 20:43:37 +0200
commitc977d1ff6195e5b8eafb5af3552b8116052bc3b0 (patch)
tree41532e7fca7db52196dbd023770cfea974d71aac
parent7e2535163a846077617c880721b511fd83f0f8b8 (diff)
downloadpasst-c977d1ff6195e5b8eafb5af3552b8116052bc3b0.tar
passt-c977d1ff6195e5b8eafb5af3552b8116052bc3b0.tar.gz
passt-c977d1ff6195e5b8eafb5af3552b8116052bc3b0.tar.bz2
passt-c977d1ff6195e5b8eafb5af3552b8116052bc3b0.tar.lz
passt-c977d1ff6195e5b8eafb5af3552b8116052bc3b0.tar.xz
passt-c977d1ff6195e5b8eafb5af3552b8116052bc3b0.tar.zst
passt-c977d1ff6195e5b8eafb5af3552b8116052bc3b0.zip
arp: use iov_tail rather than pool
The arp() function signature is changed to accept `struct iov_tail *data` directly, replacing the previous `const struct pool *p` parameter. Consequently, arp() no longer fetches packet data internally using packet_data(), streamlining its logic. This simplifies callers like tap4_handler(), which now pass the iov_tail for the L2 ARP frame directly, removing intermediate pool handling. Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--arp.c14
-rw-r--r--arp.h2
-rw-r--r--tap.c5
3 files changed, 7 insertions, 14 deletions
diff --git a/arp.c b/arp.c
index 8b97df6..44677ad 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;
@@ -80,14 +80,10 @@ 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;
- if (!packet_get(p, 0, &data))
- return -1;
-
- eh = IOV_REMOVE_HEADER(&data, eh_storage);
- ah = IOV_REMOVE_HEADER(&data, ah_storage);
- am = IOV_REMOVE_HEADER(&data, am_storage);
+ eh = IOV_REMOVE_HEADER(data, eh_storage);
+ ah = IOV_REMOVE_HEADER(data, ah_storage);
+ am = IOV_REMOVE_HEADER(data, am_storage);
if (!eh || !ah || !am)
return -1;
diff --git a/arp.h b/arp.h
index ac5cd16..86bcbf8 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 4b3f087..7a538b2 100644
--- a/tap.c
+++ b/tap.c
@@ -722,10 +722,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;
}